Test Failed
Push — master ( d47f34...2b52fe )
by Stiofan
08:45
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   +2138 added lines, -2138 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 154
 if (!function_exists('geodir_custom_field_adminhtml')) {
155
-    /**
156
-     * Adds admin html for custom fields.
157
-     *
158
-     * @since 1.0.0
159
-     * @package GeoDirectory
160
-     * @global object $wpdb WordPress Database object.
161
-     * @param string $field_type The form field type.
162
-     * @param object|int $result_str The custom field results object or row id.
163
-     * @param string $field_ins_upd When set to "submit" displays form.
164
-     * @param bool $default when set to true field will be for admin use only.
165
-     */
166
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
167
-    {
168
-        global $wpdb;
169
-        $cf = $result_str;
170
-        if (!is_object($cf)) {
171
-
172
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
173
-
174
-        } else {
175
-            $field_info = $cf;
176
-            $result_str = $cf->id;
177
-        }
178
-        /**
179
-         * Contains custom field html.
180
-         *
181
-         * @since 1.0.0
182
-         */
183
-        include('custom_field_html.php');
184
-
185
-    }
155
+	/**
156
+	 * Adds admin html for custom fields.
157
+	 *
158
+	 * @since 1.0.0
159
+	 * @package GeoDirectory
160
+	 * @global object $wpdb WordPress Database object.
161
+	 * @param string $field_type The form field type.
162
+	 * @param object|int $result_str The custom field results object or row id.
163
+	 * @param string $field_ins_upd When set to "submit" displays form.
164
+	 * @param bool $default when set to true field will be for admin use only.
165
+	 */
166
+	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
167
+	{
168
+		global $wpdb;
169
+		$cf = $result_str;
170
+		if (!is_object($cf)) {
171
+
172
+			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
173
+
174
+		} else {
175
+			$field_info = $cf;
176
+			$result_str = $cf->id;
177
+		}
178
+		/**
179
+		 * Contains custom field html.
180
+		 *
181
+		 * @since 1.0.0
182
+		 */
183
+		include('custom_field_html.php');
184
+
185
+	}
186 186
 }
187 187
 
188 188
 if (!function_exists('geodir_custom_field_delete')) {
189
-    /**
190
-     * Delete custom field using field id.
191
-     *
192
-     * @since 1.0.0
193
-     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
194
-     * @package GeoDirectory
195
-     * @global object $wpdb WordPress Database object.
196
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
197
-     * @param string $field_id The custom field ID.
198
-     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
199
-     */
200
-    function geodir_custom_field_delete($field_id = '') {
201
-        global $wpdb, $plugin_prefix;
202
-
203
-        if ($field_id != '') {
204
-            $cf = trim($field_id, '_');
205
-
206
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
207
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
208
-
209
-                $post_type = $field->post_type;
210
-                $htmlvar_name = $field->htmlvar_name;
211
-
212
-                if ($post_type != '' && $htmlvar_name != '') {
213
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214
-                }
215
-
216
-                /**
217
-                 * Called after a custom field is deleted.
218
-                 *
219
-                 * @since 1.0.0
220
-                 * @param string $cf The fields ID.
221
-                 * @param string $field->htmlvar_name The html variable name for the field.
222
-                 * @param string $post_type The post type the field belongs to.
223
-                 */
224
-                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
225
-
226
-                if ($field->field_type == 'address') {
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
235
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
236
-                } else {
237
-                    if ($field->field_type != 'fieldset') {
238
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
239
-                    }
240
-                }
241
-
242
-                return $field_id;
243
-            } else
244
-                return 0;
245
-        } else
246
-            return 0;
247
-    }
189
+	/**
190
+	 * Delete custom field using field id.
191
+	 *
192
+	 * @since 1.0.0
193
+	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
194
+	 * @package GeoDirectory
195
+	 * @global object $wpdb WordPress Database object.
196
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
197
+	 * @param string $field_id The custom field ID.
198
+	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
199
+	 */
200
+	function geodir_custom_field_delete($field_id = '') {
201
+		global $wpdb, $plugin_prefix;
202
+
203
+		if ($field_id != '') {
204
+			$cf = trim($field_id, '_');
205
+
206
+			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
207
+				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
208
+
209
+				$post_type = $field->post_type;
210
+				$htmlvar_name = $field->htmlvar_name;
211
+
212
+				if ($post_type != '' && $htmlvar_name != '') {
213
+					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214
+				}
215
+
216
+				/**
217
+				 * Called after a custom field is deleted.
218
+				 *
219
+				 * @since 1.0.0
220
+				 * @param string $cf The fields ID.
221
+				 * @param string $field->htmlvar_name The html variable name for the field.
222
+				 * @param string $post_type The post type the field belongs to.
223
+				 */
224
+				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
225
+
226
+				if ($field->field_type == 'address') {
227
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
228
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
229
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
230
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
231
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
232
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
233
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
234
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
235
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
236
+				} else {
237
+					if ($field->field_type != 'fieldset') {
238
+						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
239
+					}
240
+				}
241
+
242
+				return $field_id;
243
+			} else
244
+				return 0;
245
+		} else
246
+			return 0;
247
+	}
248 248
 }
249 249
 
250 250
 if (!function_exists('geodir_custom_field_save')) {
251
-    /**
252
-     * Save or Update custom fields into the database.
253
-     *
254
-     * @since 1.0.0
255
-     * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
256
-     * @package GeoDirectory
257
-     * @global object $wpdb WordPress Database object.
258
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
259
-     * @param array $request_field {
260
-     *    Attributes of the request field array.
261
-     *
262
-     *    @type string $action Ajax Action name. Default "geodir_ajax_action".
263
-     *    @type string $manage_field_type Field type Default "custom_fields".
264
-     *    @type string $create_field Create field Default "true".
265
-     *    @type string $field_ins_upd Field ins upd Default "submit".
266
-     *    @type string $_wpnonce WP nonce value.
267
-     *    @type string $listing_type Listing type Example "gd_place".
268
-     *    @type string $field_type Field type Example "radio".
269
-     *    @type string $field_id Field id Example "12".
270
-     *    @type string $data_type Data type Example "VARCHAR".
271
-     *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
272
-     *    @type array $show_on_pkg Package list to display this field.
273
-     *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
274
-     *    @type string $site_title Section title which you wish to display in frontend.
275
-     *    @type string $admin_desc Section description which will appear in frontend.
276
-     *    @type string $htmlvar_name Html variable name. This should be a unique name.
277
-     *    @type string $clabels Section Title which will appear in backend.
278
-     *    @type string $default_value The default value (for "link" this will be used as the link text).
279
-     *    @type string $sort_order The display order of this field in backend. e.g. 5.
280
-     *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
281
-     *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
282
-     *    @type string $is_required Use "1" to set field as required.
283
-     *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
284
-     *    @type string $show_on_listing Want to show this on listing page?.
285
-     *    @type string $show_in What locations to show the custom field in.
286
-     *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
287
-     *    @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.
288
-     *    @type string $option_values Option Values should be separated by comma.
289
-     *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
290
-     *    @type string $css_class Enter custom css class for field custom style.
291
-     *
292
-     * }
293
-     * @param bool $default Not yet implemented.
294
-     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
295
-     */
296
-    function geodir_custom_field_save($request_field = array(), $default = false)
297
-    {
298
-
299
-        global $wpdb, $plugin_prefix;
300
-
301
-        $old_html_variable = '';
302
-
303
-        $data_type = trim($request_field['data_type']);
304
-
305
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
306
-
307
-        // some servers fail if a POST value is VARCHAR so we change it.
308
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
309
-            $request_field['data_type'] = 'VARCHAR';
310
-        }
311
-
312
-        $cf = trim($result_str, '_');
313
-
314
-
315
-        /*-------- check dublicate validation --------*/
316
-
317
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
318
-        $post_type = $request_field['listing_type'];
319
-
320
-        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
321
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
322
-        }
323
-
324
-        $check_html_variable = $wpdb->get_var(
325
-            $wpdb->prepare(
326
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
327
-                array($cf, $cehhtmlvar_name, $post_type)
328
-            )
329
-        );
330
-
331
-
332
-        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
333
-
334
-            if ($cf != '') {
335
-
336
-                $post_meta_info = $wpdb->get_row(
337
-                    $wpdb->prepare(
338
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
339
-                        array($cf)
340
-                    )
341
-                );
342
-
343
-            }
344
-
345
-            if (!empty($post_meta_info)) {
346
-                $post_val = $post_meta_info;
347
-                $old_html_variable = $post_val->htmlvar_name;
348
-
349
-            }
350
-
351
-
352
-
353
-            if ($post_type == '') $post_type = 'gd_place';
354
-
355
-
356
-            $detail_table = $plugin_prefix . $post_type . '_detail';
357
-
358
-            $admin_title = $request_field['admin_title'];
359
-            $site_title = $request_field['site_title'];
360
-            $data_type = $request_field['data_type'];
361
-            $field_type = $request_field['field_type'];
362
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
-            $admin_desc = $request_field['admin_desc'];
364
-            $clabels = $request_field['clabels'];
365
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
-            $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
-            $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
251
+	/**
252
+	 * Save or Update custom fields into the database.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
256
+	 * @package GeoDirectory
257
+	 * @global object $wpdb WordPress Database object.
258
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
259
+	 * @param array $request_field {
260
+	 *    Attributes of the request field array.
261
+	 *
262
+	 *    @type string $action Ajax Action name. Default "geodir_ajax_action".
263
+	 *    @type string $manage_field_type Field type Default "custom_fields".
264
+	 *    @type string $create_field Create field Default "true".
265
+	 *    @type string $field_ins_upd Field ins upd Default "submit".
266
+	 *    @type string $_wpnonce WP nonce value.
267
+	 *    @type string $listing_type Listing type Example "gd_place".
268
+	 *    @type string $field_type Field type Example "radio".
269
+	 *    @type string $field_id Field id Example "12".
270
+	 *    @type string $data_type Data type Example "VARCHAR".
271
+	 *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
272
+	 *    @type array $show_on_pkg Package list to display this field.
273
+	 *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
274
+	 *    @type string $site_title Section title which you wish to display in frontend.
275
+	 *    @type string $admin_desc Section description which will appear in frontend.
276
+	 *    @type string $htmlvar_name Html variable name. This should be a unique name.
277
+	 *    @type string $clabels Section Title which will appear in backend.
278
+	 *    @type string $default_value The default value (for "link" this will be used as the link text).
279
+	 *    @type string $sort_order The display order of this field in backend. e.g. 5.
280
+	 *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
281
+	 *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
282
+	 *    @type string $is_required Use "1" to set field as required.
283
+	 *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
284
+	 *    @type string $show_on_listing Want to show this on listing page?.
285
+	 *    @type string $show_in What locations to show the custom field in.
286
+	 *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
287
+	 *    @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.
288
+	 *    @type string $option_values Option Values should be separated by comma.
289
+	 *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
290
+	 *    @type string $css_class Enter custom css class for field custom style.
291
+	 *
292
+	 * }
293
+	 * @param bool $default Not yet implemented.
294
+	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
295
+	 */
296
+	function geodir_custom_field_save($request_field = array(), $default = false)
297
+	{
298
+
299
+		global $wpdb, $plugin_prefix;
300
+
301
+		$old_html_variable = '';
302
+
303
+		$data_type = trim($request_field['data_type']);
304
+
305
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
306
+
307
+		// some servers fail if a POST value is VARCHAR so we change it.
308
+		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
309
+			$request_field['data_type'] = 'VARCHAR';
310
+		}
311
+
312
+		$cf = trim($result_str, '_');
313
+
314
+
315
+		/*-------- check dublicate validation --------*/
316
+
317
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
318
+		$post_type = $request_field['listing_type'];
319
+
320
+		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
321
+			$cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
322
+		}
323
+
324
+		$check_html_variable = $wpdb->get_var(
325
+			$wpdb->prepare(
326
+				"select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
327
+				array($cf, $cehhtmlvar_name, $post_type)
328
+			)
329
+		);
330
+
331
+
332
+		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
333
+
334
+			if ($cf != '') {
335
+
336
+				$post_meta_info = $wpdb->get_row(
337
+					$wpdb->prepare(
338
+						"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
339
+						array($cf)
340
+					)
341
+				);
342
+
343
+			}
344
+
345
+			if (!empty($post_meta_info)) {
346
+				$post_val = $post_meta_info;
347
+				$old_html_variable = $post_val->htmlvar_name;
348
+
349
+			}
350
+
351
+
352
+
353
+			if ($post_type == '') $post_type = 'gd_place';
354
+
355
+
356
+			$detail_table = $plugin_prefix . $post_type . '_detail';
357
+
358
+			$admin_title = $request_field['admin_title'];
359
+			$site_title = $request_field['site_title'];
360
+			$data_type = $request_field['data_type'];
361
+			$field_type = $request_field['field_type'];
362
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
+			$admin_desc = $request_field['admin_desc'];
364
+			$clabels = $request_field['clabels'];
365
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
+			$show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
384
-                $show_in = implode(",", $request_field['show_in']);
385
-            }
383
+			if(is_array($show_in)){
384
+				$show_in = implode(",", $request_field['show_in']);
385
+			}
386 386
             
387
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
389
-            }
387
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
389
+			}
390 390
 
391
-            $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
391
+			$option_values = '';
392
+			if (isset($request_field['option_values']))
393
+				$option_values = $request_field['option_values'];
394 394
 
395
-            $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
395
+			$cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 396
 
397
-            $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
397
+			$cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 398
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
402
-                $package_info = array();
399
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
401
+			else {
402
+				$package_info = array();
403 403
 
404
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
405
-                $price_pkg = $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,
@@ -803,308 +803,308 @@  discard block
 block discarded – undo
803 803
 					for_admin_use = %s
804 804
 					where id = %d",
805 805
 
806
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_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
-                    )
806
+						array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_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
+					)
808 808
 
809
-                );
809
+				);
810 810
 
811
-                $lastid = trim($cf);
811
+				$lastid = trim($cf);
812 812
 
813 813
 
814
-                $wpdb->query(
815
-                    $wpdb->prepare(
816
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
814
+				$wpdb->query(
815
+					$wpdb->prepare(
816
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
817 817
 					 	site_title=%s
818 818
 					where post_type = %s and htmlvar_name = %s",
819
-                        array($site_title, $post_type, $htmlvar_name)
820
-                    )
821
-                );
822
-
823
-
824
-                if ($cat_sort == '')
825
-                    $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
-
827
-
828
-                /**
829
-                 * Called after all custom fields are saved for a post.
830
-                 *
831
-                 * @since 1.0.0
832
-                 * @param int $lastid The post ID.
833
-                 */
834
-                do_action('geodir_after_custom_fields_updated', $lastid);
835
-
836
-            } else {
837
-
838
-                switch ($field_type):
839
-
840
-                    case 'address':
841
-
842
-                        $data_type = '';
843
-
844
-                        if ($htmlvar_name != '') {
845
-                            $prefix = $htmlvar_name . '_';
846
-                        }
847
-                        $old_prefix = $old_html_variable;
848
-
849
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
850
-
851
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
852
-                        if ($default_value != '') {
853
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
854
-                        }
855
-
856
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
857
-                        //$wpdb->query($meta_field_add);
858
-
859
-
860
-                        if (!empty($extra_fields)) {
819
+						array($site_title, $post_type, $htmlvar_name)
820
+					)
821
+				);
822
+
823
+
824
+				if ($cat_sort == '')
825
+					$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
+
827
+
828
+				/**
829
+				 * Called after all custom fields are saved for a post.
830
+				 *
831
+				 * @since 1.0.0
832
+				 * @param int $lastid The post ID.
833
+				 */
834
+				do_action('geodir_after_custom_fields_updated', $lastid);
835
+
836
+			} else {
837
+
838
+				switch ($field_type):
839
+
840
+					case 'address':
841
+
842
+						$data_type = '';
843
+
844
+						if ($htmlvar_name != '') {
845
+							$prefix = $htmlvar_name . '_';
846
+						}
847
+						$old_prefix = $old_html_variable;
848
+
849
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
850
+
851
+						$meta_field_add = "VARCHAR( 254 ) NULL";
852
+						if ($default_value != '') {
853
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
854
+						}
855
+
856
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
857
+						//$wpdb->query($meta_field_add);
858
+
859
+
860
+						if (!empty($extra_fields)) {
861 861
 
862
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
863
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
864
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
865
-                                if ($default_value != '') {
866
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
867
-                                }
868
-
869
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
870
-                                //$wpdb->query($meta_field_add);
871
-                            }
872
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
873
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
874
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
875
-                                if ($default_value != '') {
876
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
877
-                                }
878
-
879
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
880
-                                //$wpdb->query($meta_field_add);
881
-                            }
882
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
883
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
884
-
885
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
886
-                                if ($default_value != '') {
887
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
888
-                                }
889
-
890
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
891
-                                //$wpdb->query($meta_field_add);
892
-                            }
893
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
894
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
895
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
896
-                                if ($default_value != '') {
897
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
898
-                                }
899
-
900
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
901
-                                //$wpdb->query($meta_field_add);
902
-                            }
903
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
904
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
905
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
906
-                                if ($default_value != '') {
907
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
908
-                                }
909
-
910
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
911
-                                //$wpdb->query($meta_field_add);
912
-
913
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
914
-
915
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
916
-                                if ($default_value != '') {
917
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
918
-                                }
919
-
920
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
921
-
922
-                                //$wpdb->query($meta_field_add);
923
-                            }
924
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
925
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
926
-
927
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
928
-                                if ($default_value != '') {
929
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
930
-                                }
931
-
932
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
933
-
934
-                                //$wpdb->query($meta_field_add);
935
-                            }
936
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
937
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
938
-
939
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
940
-                                if ($default_value != '') {
941
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
942
-                                }
943
-
944
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
945
-
946
-                                //$wpdb->query($meta_field_add);
947
-                            }
948
-                            // show lat lng
949
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
950
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
951
-
952
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
953
-                                $meta_field_add .= " DEFAULT '1'";
954
-
955
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
956
-                                //$wpdb->query($meta_field_add);
957
-                            }
958
-                        }
959
-
960
-                        break;
961
-
962
-                    case 'checkbox':
963
-                        $data_type = 'TINYINT';
964
-
965
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
966
-                        if ((int)$default_value === 1) {
967
-                            $meta_field_add .= " DEFAULT '1'";
968
-                        }
969
-
970
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
971
-                        if ($add_result === false) {
972
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
973
-                        }
974
-                        break;
975
-                    case 'multiselect':
976
-                    case 'select':
977
-                        $data_type = 'VARCHAR';
978
-                        $op_size = '500';
979
-
980
-                        // only make the field as big as it needs to be.
981
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
982
-                            $option_values_arr = explode(',', $option_values);
983
-
984
-                            if (is_array($option_values_arr)) {
985
-                                $op_max = 0;
986
-
987
-                                foreach ($option_values_arr as $op_val) {
988
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
989
-                                        $op_max = strlen($op_val);
990
-                                    }
991
-                                }
992
-
993
-                                if ($op_max) {
994
-                                    $op_size = $op_max;
995
-                                }
996
-                            }
997
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
998
-                            if (strlen($option_values)) {
999
-                                $op_size =  strlen($option_values);
1000
-                            }
1001
-
1002
-                            if (isset($request_field['multi_display_type'])) {
1003
-                                $extra_fields = $request_field['multi_display_type'];
1004
-                            }
1005
-                        }
1006
-
1007
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1008
-                        if ($default_value != '') {
1009
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1010
-                        }
1011
-
1012
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1013
-                        if ($add_result === false) {
1014
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1015
-                        }
1016
-                        break;
1017
-                    case 'textarea':
1018
-                    case 'html':
1019
-                    case 'url':
1020
-                    case 'file':
1021
-
1022
-                        $data_type = 'TEXT';
1023
-
1024
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1025
-
1026
-                        $meta_field_add = $data_type . " NULL ";
1027
-                        /*if($default_value != '')
862
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
863
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
864
+								$meta_field_add = "VARCHAR( 30 ) NULL";
865
+								if ($default_value != '') {
866
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
867
+								}
868
+
869
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
870
+								//$wpdb->query($meta_field_add);
871
+							}
872
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
873
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
874
+								$meta_field_add = "VARCHAR( 30 ) NULL";
875
+								if ($default_value != '') {
876
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
877
+								}
878
+
879
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
880
+								//$wpdb->query($meta_field_add);
881
+							}
882
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
883
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
884
+
885
+								$meta_field_add = "VARCHAR( 30 ) NULL";
886
+								if ($default_value != '') {
887
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
888
+								}
889
+
890
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
891
+								//$wpdb->query($meta_field_add);
892
+							}
893
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
894
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
895
+								$meta_field_add = "VARCHAR( 15 ) NULL";
896
+								if ($default_value != '') {
897
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
898
+								}
899
+
900
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
901
+								//$wpdb->query($meta_field_add);
902
+							}
903
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
904
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
905
+								$meta_field_add = "VARCHAR( 20 ) NULL";
906
+								if ($default_value != '') {
907
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
908
+								}
909
+
910
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
911
+								//$wpdb->query($meta_field_add);
912
+
913
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
914
+
915
+								$meta_field_add = "VARCHAR( 20 ) NULL";
916
+								if ($default_value != '') {
917
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
918
+								}
919
+
920
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
921
+
922
+								//$wpdb->query($meta_field_add);
923
+							}
924
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
925
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
926
+
927
+								$meta_field_add = "VARCHAR( 15 ) NULL";
928
+								if ($default_value != '') {
929
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
930
+								}
931
+
932
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
933
+
934
+								//$wpdb->query($meta_field_add);
935
+							}
936
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
937
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
938
+
939
+								$meta_field_add = "VARCHAR( 3 ) NULL";
940
+								if ($default_value != '') {
941
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
942
+								}
943
+
944
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
945
+
946
+								//$wpdb->query($meta_field_add);
947
+							}
948
+							// show lat lng
949
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
950
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
951
+
952
+								$meta_field_add = "VARCHAR( 3 ) NULL";
953
+								$meta_field_add .= " DEFAULT '1'";
954
+
955
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
956
+								//$wpdb->query($meta_field_add);
957
+							}
958
+						}
959
+
960
+						break;
961
+
962
+					case 'checkbox':
963
+						$data_type = 'TINYINT';
964
+
965
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
966
+						if ((int)$default_value === 1) {
967
+							$meta_field_add .= " DEFAULT '1'";
968
+						}
969
+
970
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
971
+						if ($add_result === false) {
972
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
973
+						}
974
+						break;
975
+					case 'multiselect':
976
+					case 'select':
977
+						$data_type = 'VARCHAR';
978
+						$op_size = '500';
979
+
980
+						// only make the field as big as it needs to be.
981
+						if (isset($option_values) && $option_values && $field_type == 'select') {
982
+							$option_values_arr = explode(',', $option_values);
983
+
984
+							if (is_array($option_values_arr)) {
985
+								$op_max = 0;
986
+
987
+								foreach ($option_values_arr as $op_val) {
988
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
989
+										$op_max = strlen($op_val);
990
+									}
991
+								}
992
+
993
+								if ($op_max) {
994
+									$op_size = $op_max;
995
+								}
996
+							}
997
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
998
+							if (strlen($option_values)) {
999
+								$op_size =  strlen($option_values);
1000
+							}
1001
+
1002
+							if (isset($request_field['multi_display_type'])) {
1003
+								$extra_fields = $request_field['multi_display_type'];
1004
+							}
1005
+						}
1006
+
1007
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1008
+						if ($default_value != '') {
1009
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1010
+						}
1011
+
1012
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1013
+						if ($add_result === false) {
1014
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1015
+						}
1016
+						break;
1017
+					case 'textarea':
1018
+					case 'html':
1019
+					case 'url':
1020
+					case 'file':
1021
+
1022
+						$data_type = 'TEXT';
1023
+
1024
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1025
+
1026
+						$meta_field_add = $data_type . " NULL ";
1027
+						/*if($default_value != '')
1028 1028
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1029 1029
 
1030
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1031
-                        if ($add_result === false) {
1032
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1033
-                        }
1030
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1031
+						if ($add_result === false) {
1032
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1033
+						}
1034 1034
 
1035
-                        break;
1035
+						break;
1036 1036
 
1037
-                    case 'datepicker':
1037
+					case 'datepicker':
1038 1038
 
1039
-                        $data_type = 'DATE';
1039
+						$data_type = 'DATE';
1040 1040
 
1041
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1041
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042 1042
 
1043
-                        $meta_field_add = $data_type . " NULL ";
1043
+						$meta_field_add = $data_type . " NULL ";
1044 1044
 
1045
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1046
-                        if ($add_result === false) {
1047
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1048
-                        }
1045
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1046
+						if ($add_result === false) {
1047
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1048
+						}
1049 1049
 
1050
-                        break;
1050
+						break;
1051 1051
 
1052
-                    case 'time':
1052
+					case 'time':
1053 1053
 
1054
-                        $data_type = 'TIME';
1054
+						$data_type = 'TIME';
1055 1055
 
1056
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1056
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057 1057
 
1058
-                        $meta_field_add = $data_type . " NULL ";
1058
+						$meta_field_add = $data_type . " NULL ";
1059 1059
 
1060
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1061
-                        if ($add_result === false) {
1062
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1063
-                        }
1060
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1061
+						if ($add_result === false) {
1062
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1063
+						}
1064 1064
 
1065
-                        break;
1065
+						break;
1066 1066
 
1067
-                    default:
1067
+					default:
1068 1068
 
1069
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1070
-                            $meta_field_add = $data_type . " NULL ";
1069
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1070
+							$meta_field_add = $data_type . " NULL ";
1071 1071
 
1072
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1073
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1074
-                            }
1072
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1073
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1074
+							}
1075 1075
 
1076
-                            if (is_numeric($default_value) && $default_value != '') {
1077
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1078
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1079
-                            }
1080
-                        } else {
1081
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1076
+							if (is_numeric($default_value) && $default_value != '') {
1077
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1078
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1079
+							}
1080
+						} else {
1081
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1082 1082
 
1083
-                            if ($default_value != '') {
1084
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1085
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1086
-                            }
1087
-                        }
1083
+							if ($default_value != '') {
1084
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1085
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1086
+							}
1087
+						}
1088 1088
 
1089
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1090
-                        if ($add_result === false) {
1091
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1092
-                        }
1093
-                        break;
1094
-                endswitch;
1089
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1090
+						if ($add_result === false) {
1091
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1092
+						}
1093
+						break;
1094
+				endswitch;
1095 1095
 
1096
-                $extra_field_query = '';
1097
-                if (!empty($extra_fields)) {
1098
-                    $extra_field_query = serialize($extra_fields);
1099
-                }
1096
+				$extra_field_query = '';
1097
+				if (!empty($extra_fields)) {
1098
+					$extra_field_query = serialize($extra_fields);
1099
+				}
1100 1100
 
1101
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1101
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1102 1102
 
1103
-                $wpdb->query(
1103
+				$wpdb->query(
1104 1104
 
1105
-                    $wpdb->prepare(
1105
+					$wpdb->prepare(
1106 1106
 
1107
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1107
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108 1108
 					post_type = %s,
1109 1109
 					admin_title = %s,
1110 1110
 					site_title = %s,
@@ -1136,26 +1136,26 @@  discard block
 block discarded – undo
1136 1136
 					validation_msg = %s,
1137 1137
 					for_admin_use = %s ",
1138 1138
 
1139
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_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)
1139
+						array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_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)
1140 1140
 
1141
-                    )
1141
+					)
1142 1142
 
1143
-                );
1143
+				);
1144 1144
 
1145
-                $lastid = $wpdb->insert_id;
1145
+				$lastid = $wpdb->insert_id;
1146 1146
 
1147
-                $lastid = trim($lastid);
1147
+				$lastid = trim($lastid);
1148 1148
 
1149
-            }
1149
+			}
1150 1150
 
1151
-            return (int)$lastid;
1151
+			return (int)$lastid;
1152 1152
 
1153 1153
 
1154
-        } else {
1155
-            return 'HTML Variable Name should be a unique name';
1156
-        }
1154
+		} else {
1155
+			return 'HTML Variable Name should be a unique name';
1156
+		}
1157 1157
 
1158
-    }
1158
+	}
1159 1159
 }
1160 1160
 
1161 1161
 /**
@@ -1170,30 +1170,30 @@  discard block
 block discarded – undo
1170 1170
 function godir_set_field_order($field_ids = array())
1171 1171
 {
1172 1172
 
1173
-    global $wpdb;
1173
+	global $wpdb;
1174 1174
 
1175
-    $count = 0;
1176
-    if (!empty($field_ids)):
1177
-        $post_meta_info = false;
1178
-        foreach ($field_ids as $id) {
1175
+	$count = 0;
1176
+	if (!empty($field_ids)):
1177
+		$post_meta_info = false;
1178
+		foreach ($field_ids as $id) {
1179 1179
 
1180
-            $cf = trim($id, '_');
1180
+			$cf = trim($id, '_');
1181 1181
 
1182
-            $post_meta_info = $wpdb->query(
1183
-                $wpdb->prepare(
1184
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1182
+			$post_meta_info = $wpdb->query(
1183
+				$wpdb->prepare(
1184
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1185 1185
 															sort_order=%d 
1186 1186
 															where id= %d",
1187
-                    array($count, $cf)
1188
-                )
1189
-            );
1190
-            $count++;
1191
-        }
1192
-
1193
-        return $post_meta_info;
1194
-    else:
1195
-        return false;
1196
-    endif;
1187
+					array($count, $cf)
1188
+				)
1189
+			);
1190
+			$count++;
1191
+		}
1192
+
1193
+		return $post_meta_info;
1194
+	else:
1195
+		return false;
1196
+	endif;
1197 1197
 }
1198 1198
 
1199 1199
 
@@ -1213,140 +1213,140 @@  discard block
 block discarded – undo
1213 1213
  * @param string $post_type Optional. The wordpress post type.
1214 1214
  */
1215 1215
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1216
-    global $is_default, $mapzoom, $gd_session;
1217
-
1218
-    $show_editors = array();
1219
-    $listing_type = $post_type;
1220
-
1221
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1222
-
1223
-    $fieldset_id = '';
1224
-    $fieldset_field_class = 'gd-fieldset-details';
1225
-    foreach ($custom_fields as $key => $val) {
1226
-        $val = stripslashes_deep($val); // strip slashes from labels
1227
-        $name = $val['name'];
1228
-        $site_title = $val['site_title'];
1229
-        $type = $val['type'];
1230
-        $admin_desc = $val['desc'];
1231
-        $option_values = $val['option_values'];
1232
-        $is_required = $val['is_required'];
1233
-        $is_default = $val['is_default'];
1234
-        $is_admin = $val['is_admin'];
1235
-        $required_msg = $val['required_msg'];
1236
-        $extra_fields = unserialize($val['extra_fields']);
1237
-        $value = '';
1238
-
1239
-        /* field available to site admin only for edit */
1240
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1241
-        if ($for_admin_use && !is_super_admin()) {
1242
-            continue;
1243
-        }
1244
-
1245
-        if (is_admin()) {
1246
-            global $post;
1247
-
1248
-            if (isset($_REQUEST['post']))
1249
-                $_REQUEST['pid'] = $_REQUEST['post'];
1250
-        }
1251
-
1252
-        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1253
-            $post = $gd_ses_listing;
1254
-            $value = isset($post[$name]) ? $post[$name] : '';
1255
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1256
-            $value = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1257
-        } else {
1258
-            if ($value == '') {
1259
-                $value = $val['default'];
1260
-            }
1261
-        }
1262
-
1263
-        /**
1264
-         * Called before the custom fields info is output for submitting a post.
1265
-         *
1266
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1267
-         *
1268
-         * @since 1.0.0
1269
-         * @param string $listing_type The post post type.
1270
-         * @param int $package_id The price package ID for the post.
1271
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1272
-         * @see 'geodir_after_custom_form_field_$name'
1273
-         */
1274
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1275
-
1276
-        if ($type == 'fieldset') {
1277
-            $fieldset_id = (int)$val['id'];
1278
-            $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1279
-            ?>
1216
+	global $is_default, $mapzoom, $gd_session;
1217
+
1218
+	$show_editors = array();
1219
+	$listing_type = $post_type;
1220
+
1221
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1222
+
1223
+	$fieldset_id = '';
1224
+	$fieldset_field_class = 'gd-fieldset-details';
1225
+	foreach ($custom_fields as $key => $val) {
1226
+		$val = stripslashes_deep($val); // strip slashes from labels
1227
+		$name = $val['name'];
1228
+		$site_title = $val['site_title'];
1229
+		$type = $val['type'];
1230
+		$admin_desc = $val['desc'];
1231
+		$option_values = $val['option_values'];
1232
+		$is_required = $val['is_required'];
1233
+		$is_default = $val['is_default'];
1234
+		$is_admin = $val['is_admin'];
1235
+		$required_msg = $val['required_msg'];
1236
+		$extra_fields = unserialize($val['extra_fields']);
1237
+		$value = '';
1238
+
1239
+		/* field available to site admin only for edit */
1240
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1241
+		if ($for_admin_use && !is_super_admin()) {
1242
+			continue;
1243
+		}
1244
+
1245
+		if (is_admin()) {
1246
+			global $post;
1247
+
1248
+			if (isset($_REQUEST['post']))
1249
+				$_REQUEST['pid'] = $_REQUEST['post'];
1250
+		}
1251
+
1252
+		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1253
+			$post = $gd_ses_listing;
1254
+			$value = isset($post[$name]) ? $post[$name] : '';
1255
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1256
+			$value = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1257
+		} else {
1258
+			if ($value == '') {
1259
+				$value = $val['default'];
1260
+			}
1261
+		}
1262
+
1263
+		/**
1264
+		 * Called before the custom fields info is output for submitting a post.
1265
+		 *
1266
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1267
+		 *
1268
+		 * @since 1.0.0
1269
+		 * @param string $listing_type The post post type.
1270
+		 * @param int $package_id The price package ID for the post.
1271
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1272
+		 * @see 'geodir_after_custom_form_field_$name'
1273
+		 */
1274
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1275
+
1276
+		if ($type == 'fieldset') {
1277
+			$fieldset_id = (int)$val['id'];
1278
+			$fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1279
+			?>
1280 1280
             <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1281 1281
                 <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1282 1282
             <?php
1283
-        } else if ($type == 'address') {
1284
-            $prefix = $name . '_';
1285
-
1286
-            ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1287
-            ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1288
-            ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1289
-            ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1290
-
1291
-            $address = '';
1292
-            $zip = '';
1293
-            $mapview = '';
1294
-            $mapzoom = '';
1295
-            $lat = '';
1296
-            $lng = '';
1297
-
1298
-            if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1299
-                $post = $gd_ses_listing;
1300
-                $address = $post[$prefix . 'address'];
1301
-                $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1302
-                $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1303
-                $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1304
-                $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1305
-                $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1306
-            } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1307
-                $post_info = (array)$post_info;
1308
-
1309
-                $address = $post_info[$prefix . 'address'];
1310
-                $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1311
-                $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1312
-                $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1313
-                $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1314
-                $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1315
-            }
1316
-
1317
-            $location = geodir_get_default_location();
1318
-            if (empty($city)) $city = isset($location->city) ? $location->city : '';
1319
-            if (empty($region)) $region = isset($location->region) ? $location->region : '';
1320
-            if (empty($country)) $country = isset($location->country) ? $location->country : '';
1321
-
1322
-            $lat_lng_blank = false;
1323
-            if (empty($lat) && empty($lng)) {
1324
-                $lat_lng_blank = true;
1325
-            }
1326
-
1327
-            if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1328
-            if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1329
-
1330
-            /**
1331
-             * Filter the default latitude.
1332
-             *
1333
-             * @since 1.0.0
1334
-             *
1335
-             * @param float $lat Default latitude.
1336
-             * @param bool $is_admin For admin use only?.
1337
-             */
1338
-            $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1339
-            /**
1340
-             * Filter the default longitude.
1341
-             *
1342
-             * @since 1.0.0
1343
-             *
1344
-             * @param float $lat Default longitude.
1345
-             * @param bool $is_admin For admin use only?.
1346
-             */
1347
-            $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1348
-
1349
-            ?>
1283
+		} else if ($type == 'address') {
1284
+			$prefix = $name . '_';
1285
+
1286
+			($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1287
+			($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1288
+			($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1289
+			($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1290
+
1291
+			$address = '';
1292
+			$zip = '';
1293
+			$mapview = '';
1294
+			$mapzoom = '';
1295
+			$lat = '';
1296
+			$lng = '';
1297
+
1298
+			if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1299
+				$post = $gd_ses_listing;
1300
+				$address = $post[$prefix . 'address'];
1301
+				$zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1302
+				$lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1303
+				$lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1304
+				$mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1305
+				$mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1306
+			} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1307
+				$post_info = (array)$post_info;
1308
+
1309
+				$address = $post_info[$prefix . 'address'];
1310
+				$zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1311
+				$lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1312
+				$lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1313
+				$mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1314
+				$mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1315
+			}
1316
+
1317
+			$location = geodir_get_default_location();
1318
+			if (empty($city)) $city = isset($location->city) ? $location->city : '';
1319
+			if (empty($region)) $region = isset($location->region) ? $location->region : '';
1320
+			if (empty($country)) $country = isset($location->country) ? $location->country : '';
1321
+
1322
+			$lat_lng_blank = false;
1323
+			if (empty($lat) && empty($lng)) {
1324
+				$lat_lng_blank = true;
1325
+			}
1326
+
1327
+			if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1328
+			if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1329
+
1330
+			/**
1331
+			 * Filter the default latitude.
1332
+			 *
1333
+			 * @since 1.0.0
1334
+			 *
1335
+			 * @param float $lat Default latitude.
1336
+			 * @param bool $is_admin For admin use only?.
1337
+			 */
1338
+			$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1339
+			/**
1340
+			 * Filter the default longitude.
1341
+			 *
1342
+			 * @since 1.0.0
1343
+			 *
1344
+			 * @param float $lat Default longitude.
1345
+			 * @param bool $is_admin For admin use only?.
1346
+			 */
1347
+			$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1348
+
1349
+			?>
1350 1350
 
1351 1351
             <div id="geodir_<?php echo $prefix . 'address';?>_row"
1352 1352
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
@@ -1365,17 +1365,17 @@  discard block
 block discarded – undo
1365 1365
 
1366 1366
 
1367 1367
             <?php
1368
-            /**
1369
-             * Called after the address input on the add listings.
1370
-             *
1371
-             * This is used by the location manage to add further locations info etc.
1372
-             *
1373
-             * @since 1.0.0
1374
-             * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}.
1375
-             */
1376
-            do_action('geodir_address_extra_listing_fields', $val);
1377
-
1378
-            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1368
+			/**
1369
+			 * Called after the address input on the add listings.
1370
+			 *
1371
+			 * This is used by the location manage to add further locations info etc.
1372
+			 *
1373
+			 * @since 1.0.0
1374
+			 * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}.
1375
+			 */
1376
+			do_action('geodir_address_extra_listing_fields', $val);
1377
+
1378
+			if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1379 1379
 
1380 1380
                 <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1381 1381
                      class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
@@ -1396,22 +1396,22 @@  discard block
 block discarded – undo
1396 1396
 
1397 1397
                 <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1398 1398
                     <?php
1399
-                    /**
1400
-                     * Contains add listing page map functions.
1401
-                     *
1402
-                     * @since 1.0.0
1403
-                     */
1404
-                    include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1405
-                    if ($lat_lng_blank) {
1406
-                        $lat = '';
1407
-                        $lng = '';
1408
-                    }
1409
-                    ?>
1399
+					/**
1400
+					 * Contains add listing page map functions.
1401
+					 *
1402
+					 * @since 1.0.0
1403
+					 */
1404
+					include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1405
+					if ($lat_lng_blank) {
1406
+						$lat = '';
1407
+						$lng = '';
1408
+					}
1409
+					?>
1410 1410
                     <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span>
1411 1411
                 </div>
1412 1412
                 <?php
1413
-                /* show lat lng */
1414
-                $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1413
+				/* show lat lng */
1414
+				$style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1415 1415
                 <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1416 1416
                      class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1417 1417
                     <label>
@@ -1452,27 +1452,27 @@  discard block
 block discarded – undo
1452 1452
                                                             class="gd-checkbox"
1453 1453
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1454 1454
                                                             id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1455
-                            echo 'checked="checked"';
1456
-                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1455
+							echo 'checked="checked"';
1456
+						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1457 1457
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1458 1458
                                                              class="gd-checkbox"
1459 1459
                                                              name="<?php echo $prefix . 'mapview'; ?>"
1460 1460
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1461
-                            echo 'checked="checked"';
1462
-                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1461
+							echo 'checked="checked"';
1462
+						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1463 1463
 
1464 1464
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1465 1465
                                                             class="gd-checkbox"
1466 1466
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1467 1467
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1468
-                            echo 'checked="checked"';
1469
-                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1468
+							echo 'checked="checked"';
1469
+						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1470 1470
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1471 1471
                                                             class="gd-checkbox"
1472 1472
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1473 1473
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1474
-                            echo 'checked="checked"';
1475
-                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1474
+							echo 'checked="checked"';
1475
+						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1476 1476
 
1477 1477
 
1478 1478
                 </div>
@@ -1480,31 +1480,31 @@  discard block
 block discarded – undo
1480 1480
 
1481 1481
             <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1482 1482
                 <input type="hidden" value="<?php if (isset($mapzoom)) {
1483
-                    echo esc_attr($mapzoom);
1484
-                } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1483
+					echo esc_attr($mapzoom);
1484
+				} ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1485 1485
             <?php }?>
1486 1486
         <?php } elseif ($type == 'text') {
1487 1487
 
1488
-            //number and float validation $validation_pattern
1489
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1490
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1491
-            //print_r($val);
1492
-            //validation
1493
-            if(isset($val['validation_pattern']) && $val['validation_pattern']){
1494
-                $validation = 'pattern="'.$val['validation_pattern'].'"';
1495
-            }else{$validation='';}
1496
-
1497
-            // validation message
1498
-            if(isset($val['validation_msg']) && $val['validation_msg']){
1499
-                $validation_msg = 'title="'.$val['validation_msg'].'"';
1500
-            }else{$validation_msg='';}
1501
-            ?>
1488
+			//number and float validation $validation_pattern
1489
+			if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1490
+			elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1491
+			//print_r($val);
1492
+			//validation
1493
+			if(isset($val['validation_pattern']) && $val['validation_pattern']){
1494
+				$validation = 'pattern="'.$val['validation_pattern'].'"';
1495
+			}else{$validation='';}
1496
+
1497
+			// validation message
1498
+			if(isset($val['validation_msg']) && $val['validation_msg']){
1499
+				$validation_msg = 'title="'.$val['validation_msg'].'"';
1500
+			}else{$validation_msg='';}
1501
+			?>
1502 1502
 
1503 1503
             <div id="<?php echo $name;?>_row"
1504 1504
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1505 1505
                 <label>
1506 1506
                     <?php $site_title = __($site_title, 'geodirectory');
1507
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1507
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1508 1508
                     <?php if ($is_required) echo '<span>*</span>';?>
1509 1509
                 </label>
1510 1510
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1516,15 +1516,15 @@  discard block
 block discarded – undo
1516 1516
             </div>
1517 1517
 
1518 1518
         <?php } elseif ($type == 'email') {
1519
-            if ($value == $val['default']) {
1520
-                $value = '';
1521
-            }?>
1519
+			if ($value == $val['default']) {
1520
+				$value = '';
1521
+			}?>
1522 1522
 
1523 1523
             <div id="<?php echo $name;?>_row"
1524 1524
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1525 1525
                 <label>
1526 1526
                     <?php $site_title = __($site_title, 'geodirectory');
1527
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1527
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1528 1528
                     <?php if ($is_required) echo '<span>*</span>';?>
1529 1529
                 </label>
1530 1530
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1536,15 +1536,15 @@  discard block
 block discarded – undo
1536 1536
             </div>
1537 1537
 
1538 1538
         <?php } elseif ($type == 'phone') {
1539
-            if ($value == $val['default']) {
1540
-                $value = '';
1541
-            } ?>
1539
+			if ($value == $val['default']) {
1540
+				$value = '';
1541
+			} ?>
1542 1542
 
1543 1543
             <div id="<?php echo $name;?>_row"
1544 1544
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1545 1545
                 <label>
1546 1546
                     <?php $site_title = __($site_title, 'geodirectory');
1547
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1547
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1548 1548
                     <?php if ($is_required) echo '<span>*</span>';?>
1549 1549
                 </label>
1550 1550
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1556,15 +1556,15 @@  discard block
 block discarded – undo
1556 1556
             </div>
1557 1557
 
1558 1558
         <?php } elseif ($type == 'url') {
1559
-            if ($value == $val['default']) {
1560
-                $value = '';
1561
-            }?>
1559
+			if ($value == $val['default']) {
1560
+				$value = '';
1561
+			}?>
1562 1562
 
1563 1563
             <div id="<?php echo $name;?>_row"
1564 1564
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1565 1565
                 <label>
1566 1566
                     <?php $site_title = __($site_title, 'geodirectory');
1567
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1567
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1568 1568
                     <?php if ($is_required) echo '<span>*</span>';?>
1569 1569
                 </label>
1570 1570
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1583,23 +1583,23 @@  discard block
 block discarded – undo
1583 1583
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1584 1584
                 <label>
1585 1585
                     <?php $site_title = __($site_title, 'geodirectory');
1586
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1586
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1587 1587
                     <?php if ($is_required) echo '<span>*</span>';?>
1588 1588
                 </label>
1589 1589
                 <?php if ($option_values) {
1590
-                    $option_values = geodir_string_values_to_options($option_values, true);
1590
+					$option_values = geodir_string_values_to_options($option_values, true);
1591 1591
 
1592
-                    if (!empty($option_values)) {
1593
-                        foreach ($option_values as $option_value) {
1594
-                            if (empty($option_value['optgroup'])) {
1595
-                                ?>
1592
+					if (!empty($option_values)) {
1593
+						foreach ($option_values as $option_value) {
1594
+							if (empty($option_value['optgroup'])) {
1595
+								?>
1596 1596
                                 <span class="gd-radios"><input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?></span>
1597 1597
                                 <?php
1598
-                            }
1599
-                        }
1600
-                    }
1601
-                }
1602
-                ?>
1598
+							}
1599
+						}
1600
+					}
1601
+				}
1602
+				?>
1603 1603
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1604 1604
                 <?php if ($is_required) { ?>
1605 1605
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
@@ -1612,16 +1612,16 @@  discard block
 block discarded – undo
1612 1612
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1613 1613
                 <label>
1614 1614
                     <?php $site_title = __($site_title, 'geodirectory');
1615
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1615
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1616 1616
                     <?php if ($is_required) echo '<span>*</span>';?>
1617 1617
                 </label>
1618 1618
                 <?php if ($value != '1') {
1619
-                    $value = '0';
1620
-                }?>
1619
+					$value = '0';
1620
+				}?>
1621 1621
                 <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/>
1622 1622
                 <input  <?php if ($value == '1') {
1623
-                    echo 'checked="checked"';
1624
-                }?>  value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"
1623
+					echo 'checked="checked"';
1624
+				}?>  value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"
1625 1625
                      onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
1626 1626
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1627 1627
                 <?php if ($is_required) { ?>
@@ -1630,31 +1630,31 @@  discard block
 block discarded – undo
1630 1630
             </div>
1631 1631
 
1632 1632
         <?php } elseif ($type == 'textarea') {
1633
-            ?>
1633
+			?>
1634 1634
 
1635 1635
             <div id="<?php echo $name;?>_row"
1636 1636
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1637 1637
                 <label>
1638 1638
                     <?php $site_title = __($site_title, 'geodirectory');
1639
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1639
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1640 1640
                     <?php if ($is_required) echo '<span>*</span>';?>
1641 1641
                 </label><?php
1642 1642
 
1643 1643
 
1644
-                if (is_array($extra_fields) && in_array('1', $extra_fields)) {
1644
+				if (is_array($extra_fields) && in_array('1', $extra_fields)) {
1645 1645
 
1646
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
1646
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
1647 1647
 
1648 1648
                 <div class="editor" field_id="<?php echo $name;?>" field_type="editor">
1649 1649
                     <?php wp_editor(stripslashes($value), $name, $editor_settings); ?>
1650 1650
                     </div><?php
1651 1651
 
1652
-                } else {
1652
+				} else {
1653 1653
 
1654
-                    ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"
1654
+					?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"
1655 1655
                                 id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php
1656 1656
 
1657
-                }?>
1657
+				}?>
1658 1658
 
1659 1659
 
1660 1660
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -1668,28 +1668,28 @@  discard block
 block discarded – undo
1668 1668
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1669 1669
                 <label>
1670 1670
                     <?php $site_title = __($site_title, 'geodirectory');
1671
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1671
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1672 1672
                     <?php if ($is_required) echo '<span>*</span>';?>
1673 1673
                 </label>
1674 1674
                 <?php
1675
-                $option_values_arr = geodir_string_values_to_options($option_values, true);
1676
-                $select_options = '';
1677
-                if (!empty($option_values_arr)) {
1678
-                    foreach ($option_values_arr as $option_row) {
1679
-                        if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1680
-                            $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1681
-
1682
-                            $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1683
-                        } else {
1684
-                            $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1685
-                            $option_value = isset($option_row['value']) ? $option_row['value'] : '';
1686
-                            $selected = $option_value == $value ? 'selected="selected"' : '';
1687
-
1688
-                            $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1689
-                        }
1690
-                    }
1691
-                }
1692
-                ?>
1675
+				$option_values_arr = geodir_string_values_to_options($option_values, true);
1676
+				$select_options = '';
1677
+				if (!empty($option_values_arr)) {
1678
+					foreach ($option_values_arr as $option_row) {
1679
+						if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1680
+							$option_label = isset($option_row['label']) ? $option_row['label'] : '';
1681
+
1682
+							$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1683
+						} else {
1684
+							$option_label = isset($option_row['label']) ? $option_row['label'] : '';
1685
+							$option_value = isset($option_row['value']) ? $option_row['value'] : '';
1686
+							$selected = $option_value == $value ? 'selected="selected"' : '';
1687
+
1688
+							$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1689
+						}
1690
+					}
1691
+				}
1692
+				?>
1693 1693
                 <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1694 1694
                         class="geodir_textfield textfield_x chosen_select"
1695 1695
                         data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
@@ -1701,17 +1701,17 @@  discard block
 block discarded – undo
1701 1701
             </div>
1702 1702
 
1703 1703
             <?php
1704
-        } else if ($type == 'multiselect') {
1705
-            $multi_display = 'select';
1706
-            if (!empty($val['extra_fields'])) {
1707
-                $multi_display = unserialize($val['extra_fields']);
1708
-            }
1709
-            ?>
1704
+		} else if ($type == 'multiselect') {
1705
+			$multi_display = 'select';
1706
+			if (!empty($val['extra_fields'])) {
1707
+				$multi_display = unserialize($val['extra_fields']);
1708
+			}
1709
+			?>
1710 1710
             <div id="<?php echo $name; ?>_row"
1711 1711
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1712 1712
                 <label>
1713 1713
                     <?php $site_title = __($site_title, 'geodirectory');
1714
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1714
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1715 1715
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1716 1716
                 </label>
1717 1717
                 <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/>
@@ -1722,55 +1722,55 @@  discard block
 block discarded – undo
1722 1722
                             data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
1723 1723
                             option-ajaxchosen="false">
1724 1724
                         <?php
1725
-                        } else {
1726
-                            echo '<ul class="gd_multi_choice">';
1727
-                        }
1728
-
1729
-                        $option_values_arr = geodir_string_values_to_options($option_values, true);
1730
-                        $select_options = '';
1731
-                        if (!empty($option_values_arr)) {
1732
-                            foreach ($option_values_arr as $option_row) {
1733
-                                if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1734
-                                    $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1735
-
1736
-                                    if ($multi_display == 'select') {
1737
-                                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1738
-                                    } else {
1739
-                                        $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
1740
-                                    }
1741
-                                } else {
1742
-                                    $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1743
-                                    $option_value = isset($option_row['value']) ? $option_row['value'] : '';
1744
-                                    $selected = $option_value == $value ? 'selected="selected"' : '';
1745
-                                    $selected = '';
1746
-                                    $checked = '';
1747
-
1748
-                                    if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
1749
-                                        if (!is_array($value)) {
1750
-                                            $value_array = explode(',', $value);
1751
-                                        } else {
1752
-                                            $value_array = $value;
1753
-                                        }
1754
-
1755
-                                        if (is_array($value_array)) {
1756
-                                            if (in_array($option_value, $value_array)) {
1757
-                                                $selected = 'selected="selected"';
1758
-                                                $checked = 'checked="checked"';
1759
-                                            }
1760
-                                        }
1761
-                                    }
1762
-
1763
-                                    if ($multi_display == 'select') {
1764
-                                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1765
-                                    } else {
1766
-                                        $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
1767
-                                    }
1768
-                                }
1769
-                            }
1770
-                        }
1771
-                        echo $select_options;
1772
-
1773
-                        if ($multi_display == 'select') { ?></select></div>
1725
+						} else {
1726
+							echo '<ul class="gd_multi_choice">';
1727
+						}
1728
+
1729
+						$option_values_arr = geodir_string_values_to_options($option_values, true);
1730
+						$select_options = '';
1731
+						if (!empty($option_values_arr)) {
1732
+							foreach ($option_values_arr as $option_row) {
1733
+								if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1734
+									$option_label = isset($option_row['label']) ? $option_row['label'] : '';
1735
+
1736
+									if ($multi_display == 'select') {
1737
+										$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1738
+									} else {
1739
+										$select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
1740
+									}
1741
+								} else {
1742
+									$option_label = isset($option_row['label']) ? $option_row['label'] : '';
1743
+									$option_value = isset($option_row['value']) ? $option_row['value'] : '';
1744
+									$selected = $option_value == $value ? 'selected="selected"' : '';
1745
+									$selected = '';
1746
+									$checked = '';
1747
+
1748
+									if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
1749
+										if (!is_array($value)) {
1750
+											$value_array = explode(',', $value);
1751
+										} else {
1752
+											$value_array = $value;
1753
+										}
1754
+
1755
+										if (is_array($value_array)) {
1756
+											if (in_array($option_value, $value_array)) {
1757
+												$selected = 'selected="selected"';
1758
+												$checked = 'checked="checked"';
1759
+											}
1760
+										}
1761
+									}
1762
+
1763
+									if ($multi_display == 'select') {
1764
+										$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1765
+									} else {
1766
+										$select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
1767
+									}
1768
+								}
1769
+							}
1770
+						}
1771
+						echo $select_options;
1772
+
1773
+						if ($multi_display == 'select') { ?></select></div>
1774 1774
             <?php } else { ?></ul><?php } ?>
1775 1775
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1776 1776
                 <?php if ($is_required) { ?>
@@ -1778,14 +1778,14 @@  discard block
 block discarded – undo
1778 1778
                 <?php } ?>
1779 1779
             </div>
1780 1780
             <?php
1781
-        } else if ($type == 'html') {
1782
-            ?>
1781
+		} else if ($type == 'html') {
1782
+			?>
1783 1783
 
1784 1784
             <div id="<?php echo $name; ?>_row"
1785 1785
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1786 1786
                 <label>
1787 1787
                     <?php $site_title = __($site_title, 'geodirectory');
1788
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1788
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1789 1789
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1790 1790
                 </label>
1791 1791
 
@@ -1803,44 +1803,44 @@  discard block
 block discarded – undo
1803 1803
             </div>
1804 1804
         <?php } elseif ($type == 'datepicker') {
1805 1805
 
1806
-            if ($extra_fields['date_format'] == '')
1807
-                $extra_fields['date_format'] = 'yy-mm-dd';
1806
+			if ($extra_fields['date_format'] == '')
1807
+				$extra_fields['date_format'] = 'yy-mm-dd';
1808 1808
 
1809
-            $date_format = $extra_fields['date_format'];
1810
-            $jquery_date_format  = $date_format;
1809
+			$date_format = $extra_fields['date_format'];
1810
+			$jquery_date_format  = $date_format;
1811 1811
 
1812 1812
 
1813
-            // check if we need to change the format or not
1814
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
1815
-            if($date_format_len>5){// if greater then 5 then it's the old style format.
1813
+			// check if we need to change the format or not
1814
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
1815
+			if($date_format_len>5){// if greater then 5 then it's the old style format.
1816 1816
 
1817
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
1818
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
1817
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
1818
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
1819 1819
 
1820
-                $date_format = str_replace($search, $replace, $date_format);
1821
-            }else{
1822
-                $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
1823
-            }
1820
+				$date_format = str_replace($search, $replace, $date_format);
1821
+			}else{
1822
+				$jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
1823
+			}
1824 1824
 
1825
-            if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
1826
-            if($value && !isset($_REQUEST['backandedit'])) {
1827
-                $time = strtotime($value);
1828
-                $value = date_i18n($date_format, $time);
1829
-            }
1825
+			if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
1826
+			if($value && !isset($_REQUEST['backandedit'])) {
1827
+				$time = strtotime($value);
1828
+				$value = date_i18n($date_format, $time);
1829
+			}
1830 1830
             
1831
-            ?>
1831
+			?>
1832 1832
             <script type="text/javascript">
1833 1833
 
1834 1834
                 jQuery(function () {
1835 1835
 
1836 1836
                     jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
1837
-                        /**
1838
-                         * Used to add extra option to datepicker per custom field.
1839
-                         *
1840
-                         * @since 1.5.7
1841
-                         * @param string $name The custom field name.
1842
-                         */
1843
-                        echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
1837
+						/**
1838
+						 * Used to add extra option to datepicker per custom field.
1839
+						 *
1840
+						 * @since 1.5.7
1841
+						 * @param string $name The custom field name.
1842
+						 */
1843
+						echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
1844 1844
 
1845 1845
                     jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
1846 1846
 
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
                 <label>
1857 1857
 
1858 1858
                     <?php $site_title = __($site_title, 'geodirectory');
1859
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1859
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1860 1860
                     <?php if ($is_required) echo '<span>*</span>';?>
1861 1861
                 </label>
1862 1862
 
@@ -1871,9 +1871,9 @@  discard block
 block discarded – undo
1871 1871
 
1872 1872
         <?php } elseif ($type == 'time') {
1873 1873
 
1874
-            if ($value != '')
1875
-                $value = date('H:i', strtotime($value));
1876
-            ?>
1874
+			if ($value != '')
1875
+				$value = date('H:i', strtotime($value));
1876
+			?>
1877 1877
             <script type="text/javascript">
1878 1878
                 jQuery(document).ready(function () {
1879 1879
 
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
                 <label>
1890 1890
 
1891 1891
                     <?php $site_title = __($site_title, 'geodirectory');
1892
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1892
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1893 1893
                     <?php if ($is_required) echo '<span>*</span>';?>
1894 1894
                 </label>
1895 1895
                 <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
@@ -1902,110 +1902,110 @@  discard block
 block discarded – undo
1902 1902
             </div>
1903 1903
 
1904 1904
         <?php } elseif ($type == 'taxonomy') {
1905
-            if ($value == $val['default']) {
1906
-                $value = '';
1907
-            } ?>
1905
+			if ($value == $val['default']) {
1906
+				$value = '';
1907
+			} ?>
1908 1908
             <div id="<?php echo $name;?>_row"
1909 1909
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1910 1910
                 <label>
1911 1911
                     <?php $site_title = __($site_title, 'geodirectory');
1912
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1912
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1913 1913
                     <?php if ($is_required) echo '<span>*</span>';?>
1914 1914
                 </label>
1915 1915
 
1916 1916
                 <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1917 1917
                     <?php
1918
-                    global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1918
+					global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1919 1919
 
1920
-                    $exclude_cats = array();
1920
+					$exclude_cats = array();
1921 1921
 
1922
-                    if ($is_admin == '1') {
1922
+					if ($is_admin == '1') {
1923 1923
 
1924
-                        $post_type = get_post_type();
1924
+						$post_type = get_post_type();
1925 1925
 
1926
-                        $package_info = array();
1926
+						$package_info = array();
1927 1927
 
1928
-                        $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1928
+						$package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1929 1929
 
1930
-                        if (!empty($package_info)) {
1930
+						if (!empty($package_info)) {
1931 1931
 
1932
-                            if (isset($package_info['cat']) && $package_info['cat'] != '') {
1932
+							if (isset($package_info['cat']) && $package_info['cat'] != '') {
1933 1933
 
1934
-                                $exclude_cats = explode(',', $package_info['cat']);
1934
+								$exclude_cats = explode(',', $package_info['cat']);
1935 1935
 
1936
-                            }
1937
-                        }
1938
-                    }
1936
+							}
1937
+						}
1938
+					}
1939 1939
 
1940
-                    $cat_display = unserialize($val['extra_fields']);
1940
+					$cat_display = unserialize($val['extra_fields']);
1941 1941
 
1942
-                    if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1942
+					if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1943 1943
 
1944
-                        $post_cat = implode(",", $post_cat[$name]);
1944
+						$post_cat = implode(",", $post_cat[$name]);
1945 1945
 
1946
-                    } else {
1947
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1948
-                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1949
-                    }
1946
+					} else {
1947
+						if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1948
+							$post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1949
+					}
1950 1950
 
1951 1951
 
1952
-                    global $geodir_addon_list;
1953
-                    if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1952
+					global $geodir_addon_list;
1953
+					if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1954 1954
 
1955
-                        $catadd_limit = $wpdb->get_var(
1956
-                            $wpdb->prepare(
1957
-                                "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1958
-                                array($package_id)
1959
-                            )
1960
-                        );
1955
+						$catadd_limit = $wpdb->get_var(
1956
+							$wpdb->prepare(
1957
+								"SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1958
+								array($package_id)
1959
+							)
1960
+						);
1961 1961
 
1962 1962
 
1963
-                    } else {
1964
-                        $catadd_limit = 0;
1965
-                    }
1963
+					} else {
1964
+						$catadd_limit = 0;
1965
+					}
1966 1966
 
1967 1967
 
1968
-                    if ($cat_display != '' && $cat_display != 'ajax_chained') {
1968
+					if ($cat_display != '' && $cat_display != 'ajax_chained') {
1969 1969
 
1970
-                        $required_limit_msg = '';
1971
-                        if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1970
+						$required_limit_msg = '';
1971
+						if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1972 1972
 
1973
-                            $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1973
+							$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1974 1974
 
1975
-                        } else {
1976
-                            $required_limit_msg = $required_msg;
1977
-                        }
1975
+						} else {
1976
+							$required_limit_msg = $required_msg;
1977
+						}
1978 1978
 
1979
-                        echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1979
+						echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1980 1980
 
1981 1981
 
1982
-                        if ($cat_display == 'select' || $cat_display == 'multiselect') {
1982
+						if ($cat_display == 'select' || $cat_display == 'multiselect') {
1983 1983
 
1984
-                            $cat_display == '';
1985
-                            $multiple = '';
1986
-                            if ($cat_display == 'multiselect')
1987
-                                $multiple = 'multiple="multiple"';
1984
+							$cat_display == '';
1985
+							$multiple = '';
1986
+							if ($cat_display == 'multiselect')
1987
+								$multiple = 'multiple="multiple"';
1988 1988
 
1989
-                            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') . '">';
1989
+							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') . '">';
1990 1990
 
1991 1991
 
1992
-                            if ($cat_display == 'select')
1993
-                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1992
+							if ($cat_display == 'select')
1993
+								echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1994 1994
 
1995
-                        }
1995
+						}
1996 1996
 
1997
-                        echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1997
+						echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1998 1998
 
1999
-                        if ($cat_display == 'select' || $cat_display == 'multiselect')
2000
-                            echo '</select>';
1999
+						if ($cat_display == 'select' || $cat_display == 'multiselect')
2000
+							echo '</select>';
2001 2001
 
2002
-                    } else {
2002
+					} else {
2003 2003
 
2004
-                        echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
2004
+						echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
2005 2005
 
2006
-                    }
2006
+					}
2007 2007
 
2008
-                    ?>
2008
+					?>
2009 2009
                 </div>
2010 2010
 
2011 2011
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -2020,46 +2020,46 @@  discard block
 block discarded – undo
2020 2020
 
2021 2021
 
2022 2022
 
2023
-            // adjust values here
2024
-            $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
2023
+			// adjust values here
2024
+			$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
2025 2025
 
2026
-            if ($value != '') {
2026
+			if ($value != '') {
2027 2027
 
2028
-                $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
2028
+				$file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
2029 2029
 
2030
-            } else
2031
-                $file_value = '';
2030
+			} else
2031
+				$file_value = '';
2032 2032
 
2033
-            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
2034
-                $file_multiple = true; // allow multiple files upload
2035
-            else
2036
-                $file_multiple = false;
2033
+			if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
2034
+				$file_multiple = true; // allow multiple files upload
2035
+			else
2036
+				$file_multiple = false;
2037 2037
 
2038
-            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
2039
-                $file_image_limit = $extra_fields['image_limit'];
2040
-            else
2041
-                $file_image_limit = 1;
2038
+			if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
2039
+				$file_image_limit = $extra_fields['image_limit'];
2040
+			else
2041
+				$file_image_limit = 1;
2042 2042
 
2043
-            $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2043
+			$file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2044 2044
 
2045
-            $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2045
+			$file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2046 2046
 
2047
-            if (!empty($file_value)) {
2048
-                $curImages = explode(',', $file_value);
2049
-                if (!empty($curImages))
2050
-                    $file_totImg = count($curImages);
2051
-            }
2047
+			if (!empty($file_value)) {
2048
+				$curImages = explode(',', $file_value);
2049
+				if (!empty($curImages))
2050
+					$file_totImg = count($curImages);
2051
+			}
2052 2052
 
2053
-            $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']) : '';
2054
-            $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2053
+			$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']) : '';
2054
+			$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2055 2055
 
2056
-            ?>
2056
+			?>
2057 2057
             <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
2058 2058
 				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
2059 2059
 				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
2060 2060
 				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
2061 2061
 			</h5>   <?php */
2062
-            ?>
2062
+			?>
2063 2063
 
2064 2064
             <div id="<?php echo $name;?>_row"
2065 2065
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2068 2068
                     <label
2069 2069
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2070
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2070
+						echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2071 2071
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2072 2072
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2073 2073
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2079,17 +2079,17 @@  discard block
 block discarded – undo
2079 2079
                     <?php } ?>
2080 2080
                     <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
2081 2081
                            value="<?php if (isset($file_totImg)) {
2082
-                               echo esc_attr($file_totImg);
2083
-                           } else {
2084
-                               echo '0';
2085
-                           } ?>"/>
2082
+							   echo esc_attr($file_totImg);
2083
+						   } else {
2084
+							   echo '0';
2085
+						   } ?>"/>
2086 2086
 
2087 2087
                     <div style="float:left; width:55%;">
2088 2088
                         <div
2089 2089
                             class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2090 2090
                             id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">
2091 2091
                             <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
2092
-                            ?>
2092
+							?>
2093 2093
                             <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
2094 2094
                                    value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
2095 2095
                                    class="geodir_button" style="margin-top:10px;"/>
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
                             style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">
2109 2109
                         </div>
2110 2110
                         <?php /*?><span id="upload-msg" ><?php _e('Please drag &amp; drop the images to rearrange the order');?></span><?php */
2111
-                        ?>
2111
+						?>
2112 2112
 
2113 2113
                         <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>
2114 2114
 
@@ -2122,357 +2122,357 @@  discard block
 block discarded – undo
2122 2122
 
2123 2123
 
2124 2124
         <?php }
2125
-        /**
2126
-         * Called after the custom fields info is output for submitting a post.
2127
-         *
2128
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
2129
-         *
2130
-         * @since 1.0.0
2131
-         * @param string $listing_type The post post type.
2132
-         * @param int $package_id The price package ID for the post.
2133
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
2134
-         * @see 'geodir_before_custom_form_field_$name'
2135
-         */
2136
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
2137
-
2138
-    }
2125
+		/**
2126
+		 * Called after the custom fields info is output for submitting a post.
2127
+		 *
2128
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
2129
+		 *
2130
+		 * @since 1.0.0
2131
+		 * @param string $listing_type The post post type.
2132
+		 * @param int $package_id The price package ID for the post.
2133
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
2134
+		 * @see 'geodir_before_custom_form_field_$name'
2135
+		 */
2136
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
2137
+
2138
+	}
2139 2139
 
2140 2140
 }
2141 2141
 
2142 2142
 
2143 2143
 if (!function_exists('geodir_get_field_infoby')) {
2144
-    /**
2145
-     * Get custom field using key and value.
2146
-     *
2147
-     * @since 1.0.0
2148
-     * @package GeoDirectory
2149
-     * @global object $wpdb WordPress Database object.
2150
-     * @param string $key The key you want to look for.
2151
-     * @param string $value The value of the key you want to look for.
2152
-     * @param string $geodir_post_type The post type.
2153
-     * @return bool|mixed Returns field info when available. otherwise returns false.
2154
-     */
2155
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2156
-    {
2157
-
2158
-        global $wpdb;
2159
-
2160
-        $filter = $wpdb->get_row(
2161
-            $wpdb->prepare(
2162
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
2163
-                array($geodir_post_type)
2164
-            )
2165
-        );
2166
-
2167
-        if ($filter) {
2168
-            return $filter;
2169
-        } else {
2170
-            return false;
2171
-        }
2172
-
2173
-    }
2144
+	/**
2145
+	 * Get custom field using key and value.
2146
+	 *
2147
+	 * @since 1.0.0
2148
+	 * @package GeoDirectory
2149
+	 * @global object $wpdb WordPress Database object.
2150
+	 * @param string $key The key you want to look for.
2151
+	 * @param string $value The value of the key you want to look for.
2152
+	 * @param string $geodir_post_type The post type.
2153
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
2154
+	 */
2155
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2156
+	{
2157
+
2158
+		global $wpdb;
2159
+
2160
+		$filter = $wpdb->get_row(
2161
+			$wpdb->prepare(
2162
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
2163
+				array($geodir_post_type)
2164
+			)
2165
+		);
2166
+
2167
+		if ($filter) {
2168
+			return $filter;
2169
+		} else {
2170
+			return false;
2171
+		}
2172
+
2173
+	}
2174 2174
 }
2175 2175
 
2176 2176
 
2177 2177
 function geodir_field_icon_proccess($cf){
2178 2178
 
2179 2179
 
2180
-    if (strpos($cf['field_icon'], 'http') !== false) {
2181
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2182
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
2183
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
2184
-    }else{
2185
-        $field_icon = $cf['field_icon'];
2186
-    }
2180
+	if (strpos($cf['field_icon'], 'http') !== false) {
2181
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2182
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
2183
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
2184
+	}else{
2185
+		$field_icon = $cf['field_icon'];
2186
+	}
2187 2187
 
2188
-    return $field_icon;
2188
+	return $field_icon;
2189 2189
 }
2190 2190
 
2191 2191
 if (!function_exists('geodir_show_listing_info')) {
2192
-    /**
2193
-     * Show listing info depending on field location.
2194
-     *
2195
-     * @since 1.0.0
2196
-     * @since 1.5.7 Custom fields option values added to db translation.
2197
-     *              Changes to display url fields title.
2198
-     * @package GeoDirectory
2199
-     * @global object $wpdb WordPress Database object.
2200
-     * @global object $post The current post object.
2201
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
2202
-     *
2203
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2204
-     * @return string Returns listing info html.
2205
-     */
2206
-    function geodir_show_listing_info($fields_location = '') {
2207
-        global $post, $preview, $wpdb, $send_to_friend;
2208
-
2209
-        $payment_info = array();
2210
-        $package_info = array();
2211
-
2212
-        $package_info = geodir_post_package_info($package_info, $post);
2213
-        $post_package_id = $package_info->pid;
2214
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
2215
-        $send_to_friend = false;
2216
-
2217
-        ob_start();
2218
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
2219
-
2220
-        if (!empty($fields_info)) {
2221
-            $post = stripslashes_deep($post); // strip slashes
2192
+	/**
2193
+	 * Show listing info depending on field location.
2194
+	 *
2195
+	 * @since 1.0.0
2196
+	 * @since 1.5.7 Custom fields option values added to db translation.
2197
+	 *              Changes to display url fields title.
2198
+	 * @package GeoDirectory
2199
+	 * @global object $wpdb WordPress Database object.
2200
+	 * @global object $post The current post object.
2201
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
2202
+	 *
2203
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2204
+	 * @return string Returns listing info html.
2205
+	 */
2206
+	function geodir_show_listing_info($fields_location = '') {
2207
+		global $post, $preview, $wpdb, $send_to_friend;
2208
+
2209
+		$payment_info = array();
2210
+		$package_info = array();
2211
+
2212
+		$package_info = geodir_post_package_info($package_info, $post);
2213
+		$post_package_id = $package_info->pid;
2214
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
2215
+		$send_to_friend = false;
2216
+
2217
+		ob_start();
2218
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
2219
+
2220
+		if (!empty($fields_info)) {
2221
+			$post = stripslashes_deep($post); // strip slashes
2222 2222
             
2223
-            //echo '<div class="geodir-company_info field-group">';
2224
-            global $field_set_start;
2225
-            $field_set_start = 0;
2226
-
2227
-
2228
-
2229
-            foreach ($fields_info as $type) {
2230
-                $type = stripslashes_deep($type); // strip slashes
2231
-                $html = '';
2232
-                $html_var = '';
2233
-                $field_icon = geodir_field_icon_proccess($type);
2234
-                $filed_type = $type['type'];
2235
-
2236
-                /**
2237
-                 * Filter the output for custom fields.
2238
-                 *
2239
-                 * Here we can remove or add new functions depending on the field type.
2240
-                 *
2241
-                 * @param string $html The html to be filtered (blank).
2242
-                 * @param string $fields_location The location the field is to be show.
2243
-                 * @param array $type The array of field values.
2244
-                 */
2245
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2246
-
2247
-                $variables_array = array();
2248
-
2249
-                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'))) {
2250
-                    continue;
2251
-                }
2252
-
2253
-                if ($type['type'] != 'fieldset'):
2254
-                    $variables_array['post_id'] = $post->ID;
2255
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
2256
-                    $variables_array['value'] = '';
2257
-                    if (isset($post->{$type['htmlvar_name']}))
2258
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2259
-                endif;
2260
-
2261
-
2262
-
2263
-                if ($html):
2264
-
2265
-                    /**
2266
-                     * Called before a custom fields is output on the frontend.
2267
-                     *
2268
-                     * @since 1.0.0
2269
-                     * @param string $html_var The HTML variable name for the field.
2270
-                     */
2271
-                    do_action("geodir_before_show_{$html_var}");
2272
-                    /**
2273
-                     * Filter custom field output.
2274
-                     *
2275
-                     * @since 1.0.0
2276
-                     *
2277
-                     * @param string $html_var The HTML variable name for the field.
2278
-                     * @param string $html Custom field unfiltered HTML.
2279
-                     * @param array $variables_array Custom field variables array.
2280
-                     */
2281
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
2282
-
2283
-                    /**
2284
-                     * Called after a custom fields is output on the frontend.
2285
-                     *
2286
-                     * @since 1.0.0
2287
-                     * @param string $html_var The HTML variable name for the field.
2288
-                     */
2289
-                    do_action("geodir_after_show_{$html_var}");
2290
-
2291
-                endif;
2292
-
2293
-            }
2294
-
2295
-            //echo '</div>';
2296
-
2297
-        }
2298
-
2299
-
2300
-        return $html = ob_get_clean();
2301
-
2302
-    }
2223
+			//echo '<div class="geodir-company_info field-group">';
2224
+			global $field_set_start;
2225
+			$field_set_start = 0;
2226
+
2227
+
2228
+
2229
+			foreach ($fields_info as $type) {
2230
+				$type = stripslashes_deep($type); // strip slashes
2231
+				$html = '';
2232
+				$html_var = '';
2233
+				$field_icon = geodir_field_icon_proccess($type);
2234
+				$filed_type = $type['type'];
2235
+
2236
+				/**
2237
+				 * Filter the output for custom fields.
2238
+				 *
2239
+				 * Here we can remove or add new functions depending on the field type.
2240
+				 *
2241
+				 * @param string $html The html to be filtered (blank).
2242
+				 * @param string $fields_location The location the field is to be show.
2243
+				 * @param array $type The array of field values.
2244
+				 */
2245
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2246
+
2247
+				$variables_array = array();
2248
+
2249
+				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'))) {
2250
+					continue;
2251
+				}
2252
+
2253
+				if ($type['type'] != 'fieldset'):
2254
+					$variables_array['post_id'] = $post->ID;
2255
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
2256
+					$variables_array['value'] = '';
2257
+					if (isset($post->{$type['htmlvar_name']}))
2258
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2259
+				endif;
2260
+
2261
+
2262
+
2263
+				if ($html):
2264
+
2265
+					/**
2266
+					 * Called before a custom fields is output on the frontend.
2267
+					 *
2268
+					 * @since 1.0.0
2269
+					 * @param string $html_var The HTML variable name for the field.
2270
+					 */
2271
+					do_action("geodir_before_show_{$html_var}");
2272
+					/**
2273
+					 * Filter custom field output.
2274
+					 *
2275
+					 * @since 1.0.0
2276
+					 *
2277
+					 * @param string $html_var The HTML variable name for the field.
2278
+					 * @param string $html Custom field unfiltered HTML.
2279
+					 * @param array $variables_array Custom field variables array.
2280
+					 */
2281
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
2282
+
2283
+					/**
2284
+					 * Called after a custom fields is output on the frontend.
2285
+					 *
2286
+					 * @since 1.0.0
2287
+					 * @param string $html_var The HTML variable name for the field.
2288
+					 */
2289
+					do_action("geodir_after_show_{$html_var}");
2290
+
2291
+				endif;
2292
+
2293
+			}
2294
+
2295
+			//echo '</div>';
2296
+
2297
+		}
2298
+
2299
+
2300
+		return $html = ob_get_clean();
2301
+
2302
+	}
2303 2303
 }
2304 2304
 
2305 2305
 if (!function_exists('geodir_default_date_format')) {
2306
-    /**
2307
-     * Returns default date format.
2308
-     *
2309
-     * @since 1.0.0
2310
-     * @package GeoDirectory
2311
-     * @return mixed|string|void Returns default date format.
2312
-     */
2313
-    function geodir_default_date_format()
2314
-    {
2315
-        if ($format = get_option('date_format'))
2316
-            return $format;
2317
-        else
2318
-            return 'dd-mm-yy';
2319
-    }
2306
+	/**
2307
+	 * Returns default date format.
2308
+	 *
2309
+	 * @since 1.0.0
2310
+	 * @package GeoDirectory
2311
+	 * @return mixed|string|void Returns default date format.
2312
+	 */
2313
+	function geodir_default_date_format()
2314
+	{
2315
+		if ($format = get_option('date_format'))
2316
+			return $format;
2317
+		else
2318
+			return 'dd-mm-yy';
2319
+	}
2320 2320
 }
2321 2321
 
2322 2322
 if (!function_exists('geodir_get_formated_date')) {
2323
-    /**
2324
-     * Returns formatted date.
2325
-     *
2326
-     * @since 1.0.0
2327
-     * @package GeoDirectory
2328
-     * @param string $date Date string to convert.
2329
-     * @return bool|int|string Returns formatted date.
2330
-     */
2331
-    function geodir_get_formated_date($date)
2332
-    {
2333
-        return mysql2date(get_option('date_format'), $date);
2334
-    }
2323
+	/**
2324
+	 * Returns formatted date.
2325
+	 *
2326
+	 * @since 1.0.0
2327
+	 * @package GeoDirectory
2328
+	 * @param string $date Date string to convert.
2329
+	 * @return bool|int|string Returns formatted date.
2330
+	 */
2331
+	function geodir_get_formated_date($date)
2332
+	{
2333
+		return mysql2date(get_option('date_format'), $date);
2334
+	}
2335 2335
 }
2336 2336
 
2337 2337
 if (!function_exists('geodir_get_formated_time')) {
2338
-    /**
2339
-     * Returns formatted time.
2340
-     *
2341
-     * @since 1.0.0
2342
-     * @package GeoDirectory
2343
-     * @param string $time Time string to convert.
2344
-     * @return bool|int|string Returns formatted time.
2345
-     */
2346
-    function geodir_get_formated_time($time)
2347
-    {
2348
-        return mysql2date(get_option('time_format'), $time, $translate = true);
2349
-    }
2338
+	/**
2339
+	 * Returns formatted time.
2340
+	 *
2341
+	 * @since 1.0.0
2342
+	 * @package GeoDirectory
2343
+	 * @param string $time Time string to convert.
2344
+	 * @return bool|int|string Returns formatted time.
2345
+	 */
2346
+	function geodir_get_formated_time($time)
2347
+	{
2348
+		return mysql2date(get_option('time_format'), $time, $translate = true);
2349
+	}
2350 2350
 }
2351 2351
 
2352 2352
 
2353 2353
 if (!function_exists('geodir_save_post_file_fields')) {
2354
-    /**
2355
-     * Save post file fields
2356
-     *
2357
-     * @since 1.0.0
2358
-     * @since 1.4.7 Added `$extra_fields` parameter.
2359
-     * @package GeoDirectory
2360
-     * @global object $wpdb WordPress Database object.
2361
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2362
-     * @global object $current_user Current user object.
2363
-     * @param int $post_id
2364
-     * @param string $field_id
2365
-     * @param array $post_image
2366
-     * @param array $extra_fields Array of extra fields.
2367
-     */
2368
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
2369
-    {
2354
+	/**
2355
+	 * Save post file fields
2356
+	 *
2357
+	 * @since 1.0.0
2358
+	 * @since 1.4.7 Added `$extra_fields` parameter.
2359
+	 * @package GeoDirectory
2360
+	 * @global object $wpdb WordPress Database object.
2361
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2362
+	 * @global object $current_user Current user object.
2363
+	 * @param int $post_id
2364
+	 * @param string $field_id
2365
+	 * @param array $post_image
2366
+	 * @param array $extra_fields Array of extra fields.
2367
+	 */
2368
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
2369
+	{
2370 2370
 
2371
-        global $wpdb, $plugin_prefix, $current_user;
2371
+		global $wpdb, $plugin_prefix, $current_user;
2372 2372
 
2373
-        $post_type = get_post_type($post_id);
2374
-        //echo $field_id; exit;
2375
-        $table = $plugin_prefix . $post_type . '_detail';
2373
+		$post_type = get_post_type($post_id);
2374
+		//echo $field_id; exit;
2375
+		$table = $plugin_prefix . $post_type . '_detail';
2376 2376
 
2377
-        $postcurr_images = array();
2378
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
2379
-        $file_urls = '';
2377
+		$postcurr_images = array();
2378
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
2379
+		$file_urls = '';
2380 2380
 
2381
-        if (!empty($post_image)) {
2381
+		if (!empty($post_image)) {
2382 2382
 
2383
-            $invalid_files = array();
2383
+			$invalid_files = array();
2384 2384
 
2385
-            //Get and remove all old images of post from database to set by new order
2386
-            $geodir_uploaddir = '';
2387
-            $uploads = wp_upload_dir();
2388
-            $uploads_dir = $uploads['path'];
2385
+			//Get and remove all old images of post from database to set by new order
2386
+			$geodir_uploaddir = '';
2387
+			$uploads = wp_upload_dir();
2388
+			$uploads_dir = $uploads['path'];
2389 2389
 
2390
-            $geodir_uploadpath = $uploads['path'];
2391
-            $geodir_uploadurl = $uploads['url'];
2392
-            $sub_dir = $uploads['subdir'];
2390
+			$geodir_uploadpath = $uploads['path'];
2391
+			$geodir_uploadurl = $uploads['url'];
2392
+			$sub_dir = $uploads['subdir'];
2393 2393
 
2394
-            $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'] : '';
2394
+			$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'] : '';
2395 2395
 
2396
-            for ($m = 0; $m < count($post_image); $m++) {
2396
+			for ($m = 0; $m < count($post_image); $m++) {
2397 2397
 
2398
-                /* --------- start ------- */
2398
+				/* --------- start ------- */
2399 2399
 
2400
-                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)))) {
2400
+				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)))) {
2401 2401
 
2402 2402
 
2403
-                    $curr_img_url = $post_image[$m];
2404
-                    $image_name_arr = explode('/', $curr_img_url);
2405
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
2406
-                    $filename = end($image_name_arr);
2407
-                    $img_name_arr = explode('.', $filename);
2403
+					$curr_img_url = $post_image[$m];
2404
+					$image_name_arr = explode('/', $curr_img_url);
2405
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
2406
+					$filename = end($image_name_arr);
2407
+					$img_name_arr = explode('.', $filename);
2408 2408
 
2409
-                    $arr_file_type = wp_check_filetype($filename);
2409
+					$arr_file_type = wp_check_filetype($filename);
2410 2410
 
2411
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2412
-                        continue;
2413
-                    }
2411
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2412
+						continue;
2413
+					}
2414 2414
 
2415
-                    $uploaded_file_type = $arr_file_type['type'];
2416
-                    $uploaded_file_ext = $arr_file_type['ext'];
2415
+					$uploaded_file_type = $arr_file_type['type'];
2416
+					$uploaded_file_ext = $arr_file_type['ext'];
2417 2417
 
2418
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2419
-                        continue; // Invalid file type.
2420
-                    }
2418
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2419
+						continue; // Invalid file type.
2420
+					}
2421 2421
 
2422
-                    // Set an array containing a list of acceptable formats
2423
-                    //$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');
2422
+					// Set an array containing a list of acceptable formats
2423
+					//$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');
2424 2424
 
2425
-                    if (!function_exists('wp_handle_upload'))
2426
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
2425
+					if (!function_exists('wp_handle_upload'))
2426
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
2427 2427
 
2428
-                    if (!is_dir($geodir_uploadpath))
2429
-                        mkdir($geodir_uploadpath);
2428
+					if (!is_dir($geodir_uploadpath))
2429
+						mkdir($geodir_uploadpath);
2430 2430
 
2431
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
2432
-                    $explode_sub_dir = explode("/", $sub_dir);
2433
-                    if ($curr_img_dir == end($explode_sub_dir)) {
2434
-                        $img_path = $geodir_uploadpath . '/' . $filename;
2435
-                        $img_url = $geodir_uploadurl . '/' . $filename;
2436
-                    } else {
2437
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
2438
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
2439
-                    }
2431
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
2432
+					$explode_sub_dir = explode("/", $sub_dir);
2433
+					if ($curr_img_dir == end($explode_sub_dir)) {
2434
+						$img_path = $geodir_uploadpath . '/' . $filename;
2435
+						$img_url = $geodir_uploadurl . '/' . $filename;
2436
+					} else {
2437
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
2438
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
2439
+					}
2440 2440
 
2441
-                    $uploaded_file = '';
2442
-                    if (file_exists($img_path))
2443
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
2441
+					$uploaded_file = '';
2442
+					if (file_exists($img_path))
2443
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
2444 2444
 
2445
-                    if ($curr_img_dir != $geodir_uploaddir) {
2446
-                        if (file_exists($img_path))
2447
-                            unlink($img_path);
2448
-                    }
2445
+					if ($curr_img_dir != $geodir_uploaddir) {
2446
+						if (file_exists($img_path))
2447
+							unlink($img_path);
2448
+					}
2449 2449
 
2450
-                    if (!empty($uploaded_file))
2451
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
2450
+					if (!empty($uploaded_file))
2451
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
2452 2452
 
2453
-                } else {
2454
-                    $file_urls = $post_image[$m];
2455
-                }
2456
-            }
2453
+				} else {
2454
+					$file_urls = $post_image[$m];
2455
+				}
2456
+			}
2457 2457
 
2458 2458
 
2459
-        }
2459
+		}
2460 2460
 
2461
-        //Remove all old attachments and temp images
2462
-        if (!empty($postcurr_images)) {
2461
+		//Remove all old attachments and temp images
2462
+		if (!empty($postcurr_images)) {
2463 2463
 
2464
-            if ($file_urls != $postcurr_images) {
2465
-                $invalid_files[] = (object)array('src' => $postcurr_images);
2466
-                $invalid_files = (object)$invalid_files;
2467
-            }
2468
-        }
2464
+			if ($file_urls != $postcurr_images) {
2465
+				$invalid_files[] = (object)array('src' => $postcurr_images);
2466
+				$invalid_files = (object)$invalid_files;
2467
+			}
2468
+		}
2469 2469
 
2470
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
2470
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
2471 2471
 
2472
-        if (!empty($invalid_files))
2473
-            geodir_remove_attachments($invalid_files);
2472
+		if (!empty($invalid_files))
2473
+			geodir_remove_attachments($invalid_files);
2474 2474
 
2475
-    }
2475
+	}
2476 2476
 }
2477 2477
 
2478 2478
 
@@ -2487,76 +2487,76 @@  discard block
 block discarded – undo
2487 2487
  */
2488 2488
 function geodir_custom_upload_mimes($existing_mimes = array())
2489 2489
 {
2490
-    $existing_mimes['wif'] = 'text/plain';
2491
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
2492
-    $existing_mimes['gif'] = 'image/gif';
2493
-    $existing_mimes['png'] = 'image/png';
2494
-    $existing_mimes['pdf'] = 'application/pdf';
2495
-    $existing_mimes['txt'] = 'text/text';
2496
-    $existing_mimes['csv'] = 'application/octet-stream';
2497
-    $existing_mimes['doc'] = 'application/msword';
2498
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
2499
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
2500
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
2501
-    return $existing_mimes;
2490
+	$existing_mimes['wif'] = 'text/plain';
2491
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
2492
+	$existing_mimes['gif'] = 'image/gif';
2493
+	$existing_mimes['png'] = 'image/png';
2494
+	$existing_mimes['pdf'] = 'application/pdf';
2495
+	$existing_mimes['txt'] = 'text/text';
2496
+	$existing_mimes['csv'] = 'application/octet-stream';
2497
+	$existing_mimes['doc'] = 'application/msword';
2498
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
2499
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
2500
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
2501
+	return $existing_mimes;
2502 2502
 }
2503 2503
 
2504 2504
 if (!function_exists('geodir_plupload_action')) {
2505 2505
 
2506
-    /**
2507
-     * Get upload directory path details
2508
-     *
2509
-     * @since 1.0.0
2510
-     * @package GeoDirectory
2511
-     * @global object $current_user Current user object.
2512
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
2513
-     * @return mixed Returns upload directory details as an array.
2514
-     */
2515
-    function geodir_upload_dir($upload)
2516
-    {
2517
-        global $current_user;
2518
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
2519
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
2520
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
2521
-        return $upload;
2522
-    }
2523
-
2524
-    /**
2525
-     * Handles place file and image upload.
2526
-     *
2527
-     * @since 1.0.0
2528
-     * @package GeoDirectory
2529
-     */
2530
-    function geodir_plupload_action()
2531
-    {
2532
-        // check ajax noonce
2533
-        $imgid = $_POST["imgid"];
2534
-
2535
-        check_ajax_referer($imgid . 'pluploadan');
2536
-
2537
-        // handle custom file uploaddir
2538
-        add_filter('upload_dir', 'geodir_upload_dir');
2539
-
2540
-        // change file orinetation if needed
2541
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
2542
-
2543
-        // handle file upload
2544
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
2545
-        // remove handle custom file uploaddir
2546
-        remove_filter('upload_dir', 'geodir_upload_dir');
2547
-
2548
-        if(!isset($status['url']) && isset($status['error'])){
2549
-            print_r($status);
2550
-        }
2551
-
2552
-        // send the uploaded file url in response
2553
-        if (isset($status['url'])) {
2554
-            echo $status['url'];
2555
-        } else {
2556
-            echo 'x';
2557
-        }
2558
-        exit;
2559
-    }
2506
+	/**
2507
+	 * Get upload directory path details
2508
+	 *
2509
+	 * @since 1.0.0
2510
+	 * @package GeoDirectory
2511
+	 * @global object $current_user Current user object.
2512
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
2513
+	 * @return mixed Returns upload directory details as an array.
2514
+	 */
2515
+	function geodir_upload_dir($upload)
2516
+	{
2517
+		global $current_user;
2518
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
2519
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
2520
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
2521
+		return $upload;
2522
+	}
2523
+
2524
+	/**
2525
+	 * Handles place file and image upload.
2526
+	 *
2527
+	 * @since 1.0.0
2528
+	 * @package GeoDirectory
2529
+	 */
2530
+	function geodir_plupload_action()
2531
+	{
2532
+		// check ajax noonce
2533
+		$imgid = $_POST["imgid"];
2534
+
2535
+		check_ajax_referer($imgid . 'pluploadan');
2536
+
2537
+		// handle custom file uploaddir
2538
+		add_filter('upload_dir', 'geodir_upload_dir');
2539
+
2540
+		// change file orinetation if needed
2541
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
2542
+
2543
+		// handle file upload
2544
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
2545
+		// remove handle custom file uploaddir
2546
+		remove_filter('upload_dir', 'geodir_upload_dir');
2547
+
2548
+		if(!isset($status['url']) && isset($status['error'])){
2549
+			print_r($status);
2550
+		}
2551
+
2552
+		// send the uploaded file url in response
2553
+		if (isset($status['url'])) {
2554
+			echo $status['url'];
2555
+		} else {
2556
+			echo 'x';
2557
+		}
2558
+		exit;
2559
+	}
2560 2560
 }
2561 2561
 
2562 2562
 /**
@@ -2571,17 +2571,17 @@  discard block
 block discarded – undo
2571 2571
  */
2572 2572
 function geodir_get_video($post_id)
2573 2573
 {
2574
-    global $wpdb, $plugin_prefix;
2574
+	global $wpdb, $plugin_prefix;
2575 2575
 
2576
-    $post_type = get_post_type($post_id);
2576
+	$post_type = get_post_type($post_id);
2577 2577
 
2578
-    $table = $plugin_prefix . $post_type . '_detail';
2578
+	$table = $plugin_prefix . $post_type . '_detail';
2579 2579
 
2580
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
2580
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
2581 2581
 
2582
-    if ($results) {
2583
-        return $results[0]->geodir_video;
2584
-    }
2582
+	if ($results) {
2583
+		return $results[0]->geodir_video;
2584
+	}
2585 2585
 
2586 2586
 }
2587 2587
 
@@ -2597,40 +2597,40 @@  discard block
 block discarded – undo
2597 2597
  */
2598 2598
 function geodir_get_special_offers($post_id)
2599 2599
 {
2600
-    global $wpdb, $plugin_prefix;
2600
+	global $wpdb, $plugin_prefix;
2601 2601
 
2602
-    $post_type = get_post_type($post_id);
2602
+	$post_type = get_post_type($post_id);
2603 2603
 
2604
-    $table = $plugin_prefix . $post_type . '_detail';
2604
+	$table = $plugin_prefix . $post_type . '_detail';
2605 2605
 
2606
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
2606
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
2607 2607
 
2608
-    if ($results) {
2609
-        return $results[0]->geodir_special_offers;
2610
-    }
2608
+	if ($results) {
2609
+		return $results[0]->geodir_special_offers;
2610
+	}
2611 2611
 
2612 2612
 }
2613 2613
 
2614 2614
 if (!function_exists('geodir_max_upload_size')) {
2615
-    /**
2616
-     * Get max upload file size
2617
-     *
2618
-     * @since 1.0.0
2619
-     * @package GeoDirectory
2620
-     * @return mixed|void Returns max upload file size.
2621
-     */
2622
-    function geodir_max_upload_size()
2623
-    {
2624
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
2625
-
2626
-        if ($max_filesize > 0 && $max_filesize < 1) {
2627
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
2628
-        } else {
2629
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
2630
-        }
2631
-        /** Filter documented in geodirectory-functions/general_functions.php **/
2632
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
2633
-    }
2615
+	/**
2616
+	 * Get max upload file size
2617
+	 *
2618
+	 * @since 1.0.0
2619
+	 * @package GeoDirectory
2620
+	 * @return mixed|void Returns max upload file size.
2621
+	 */
2622
+	function geodir_max_upload_size()
2623
+	{
2624
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
2625
+
2626
+		if ($max_filesize > 0 && $max_filesize < 1) {
2627
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
2628
+		} else {
2629
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
2630
+		}
2631
+		/** Filter documented in geodirectory-functions/general_functions.php **/
2632
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
2633
+	}
2634 2634
 }
2635 2635
 
2636 2636
 
@@ -2648,33 +2648,33 @@  discard block
 block discarded – undo
2648 2648
  */
2649 2649
 function geodir_add_custom_sort_options($fields, $post_type)
2650 2650
 {
2651
-    global $wpdb;
2651
+	global $wpdb;
2652 2652
 
2653
-    if ($post_type != '') {
2653
+	if ($post_type != '') {
2654 2654
 
2655
-        $all_postypes = geodir_get_posttypes();
2655
+		$all_postypes = geodir_get_posttypes();
2656 2656
 
2657
-        if (in_array($post_type, $all_postypes)) {
2657
+		if (in_array($post_type, $all_postypes)) {
2658 2658
 
2659
-            $custom_fields = $wpdb->get_results(
2660
-                $wpdb->prepare(
2661
-                    "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",
2662
-                    array($post_type)
2663
-                ), 'ARRAY_A'
2664
-            );
2659
+			$custom_fields = $wpdb->get_results(
2660
+				$wpdb->prepare(
2661
+					"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",
2662
+					array($post_type)
2663
+				), 'ARRAY_A'
2664
+			);
2665 2665
 
2666
-            if (!empty($custom_fields)) {
2666
+			if (!empty($custom_fields)) {
2667 2667
 
2668
-                foreach ($custom_fields as $val) {
2669
-                    $fields[] = $val;
2670
-                }
2671
-            }
2668
+				foreach ($custom_fields as $val) {
2669
+					$fields[] = $val;
2670
+				}
2671
+			}
2672 2672
 
2673
-        }
2673
+		}
2674 2674
 
2675
-    }
2675
+	}
2676 2676
 
2677
-    return $fields;
2677
+	return $fields;
2678 2678
 }
2679 2679
 
2680 2680
 
@@ -2690,66 +2690,66 @@  discard block
 block discarded – undo
2690 2690
 function geodir_get_custom_sort_options($post_type = '')
2691 2691
 {
2692 2692
 
2693
-    global $wpdb;
2694
-
2695
-    if ($post_type != '') {
2696
-
2697
-        $all_postypes = geodir_get_posttypes();
2698
-
2699
-        if (!in_array($post_type, $all_postypes))
2700
-            return false;
2701
-
2702
-        $fields = array();
2703
-
2704
-        $fields[] = array(
2705
-            'post_type' => $post_type,
2706
-            'data_type' => '',
2707
-            'field_type' => 'random',
2708
-            'site_title' => 'Random',
2709
-            'htmlvar_name' => 'post_title'
2710
-        );
2711
-
2712
-        $fields[] = array(
2713
-            'post_type' => $post_type,
2714
-            'data_type' => '',
2715
-            'field_type' => 'datetime',
2716
-            'site_title' => __('Add date', 'geodirectory'),
2717
-            'htmlvar_name' => 'post_date'
2718
-        );
2719
-        $fields[] = array(
2720
-            'post_type' => $post_type,
2721
-            'data_type' => '',
2722
-            'field_type' => 'bigint',
2723
-            'site_title' => __('Review', 'geodirectory'),
2724
-            'htmlvar_name' => 'comment_count'
2725
-        );
2726
-        $fields[] = array(
2727
-            'post_type' => $post_type,
2728
-            'data_type' => '',
2729
-            'field_type' => 'float',
2730
-            'site_title' => __('Rating', 'geodirectory'),
2731
-            'htmlvar_name' => 'overall_rating'
2732
-        );
2733
-        $fields[] = array(
2734
-            'post_type' => $post_type,
2735
-            'data_type' => '',
2736
-            'field_type' => 'text',
2737
-            'site_title' => __('Title', 'geodirectory'),
2738
-            'htmlvar_name' => 'post_title'
2739
-        );
2740
-
2741
-        /**
2742
-         * Hook to add custom sort options.
2743
-         *
2744
-         * @since 1.0.0
2745
-         * @param array $fields Unmodified sort options array.
2746
-         * @param string $post_type Post type.
2747
-         */
2748
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
2749
-
2750
-    }
2751
-
2752
-    return false;
2693
+	global $wpdb;
2694
+
2695
+	if ($post_type != '') {
2696
+
2697
+		$all_postypes = geodir_get_posttypes();
2698
+
2699
+		if (!in_array($post_type, $all_postypes))
2700
+			return false;
2701
+
2702
+		$fields = array();
2703
+
2704
+		$fields[] = array(
2705
+			'post_type' => $post_type,
2706
+			'data_type' => '',
2707
+			'field_type' => 'random',
2708
+			'site_title' => 'Random',
2709
+			'htmlvar_name' => 'post_title'
2710
+		);
2711
+
2712
+		$fields[] = array(
2713
+			'post_type' => $post_type,
2714
+			'data_type' => '',
2715
+			'field_type' => 'datetime',
2716
+			'site_title' => __('Add date', 'geodirectory'),
2717
+			'htmlvar_name' => 'post_date'
2718
+		);
2719
+		$fields[] = array(
2720
+			'post_type' => $post_type,
2721
+			'data_type' => '',
2722
+			'field_type' => 'bigint',
2723
+			'site_title' => __('Review', 'geodirectory'),
2724
+			'htmlvar_name' => 'comment_count'
2725
+		);
2726
+		$fields[] = array(
2727
+			'post_type' => $post_type,
2728
+			'data_type' => '',
2729
+			'field_type' => 'float',
2730
+			'site_title' => __('Rating', 'geodirectory'),
2731
+			'htmlvar_name' => 'overall_rating'
2732
+		);
2733
+		$fields[] = array(
2734
+			'post_type' => $post_type,
2735
+			'data_type' => '',
2736
+			'field_type' => 'text',
2737
+			'site_title' => __('Title', 'geodirectory'),
2738
+			'htmlvar_name' => 'post_title'
2739
+		);
2740
+
2741
+		/**
2742
+		 * Hook to add custom sort options.
2743
+		 *
2744
+		 * @since 1.0.0
2745
+		 * @param array $fields Unmodified sort options array.
2746
+		 * @param string $post_type Post type.
2747
+		 */
2748
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
2749
+
2750
+	}
2751
+
2752
+	return false;
2753 2753
 }
2754 2754
 
2755 2755
 
@@ -2765,117 +2765,117 @@  discard block
 block discarded – undo
2765 2765
 function godir_set_sort_field_order($field_ids = array())
2766 2766
 {
2767 2767
 
2768
-    global $wpdb;
2768
+	global $wpdb;
2769 2769
 
2770
-    $count = 0;
2771
-    if (!empty($field_ids)):
2772
-        foreach ($field_ids as $id) {
2770
+	$count = 0;
2771
+	if (!empty($field_ids)):
2772
+		foreach ($field_ids as $id) {
2773 2773
 
2774
-            $cf = trim($id, '_');
2774
+			$cf = trim($id, '_');
2775 2775
 
2776
-            $post_meta_info = $wpdb->query(
2777
-                $wpdb->prepare(
2778
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2776
+			$post_meta_info = $wpdb->query(
2777
+				$wpdb->prepare(
2778
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2779 2779
 															sort_order=%d 
2780 2780
 															where id= %d",
2781
-                    array($count, $cf)
2782
-                )
2783
-            );
2784
-            $count++;
2785
-        }
2786
-
2787
-        return $field_ids;
2788
-    else:
2789
-        return false;
2790
-    endif;
2781
+					array($count, $cf)
2782
+				)
2783
+			);
2784
+			$count++;
2785
+		}
2786
+
2787
+		return $field_ids;
2788
+	else:
2789
+		return false;
2790
+	endif;
2791 2791
 }
2792 2792
 
2793 2793
 
2794 2794
 if (!function_exists('geodir_custom_sort_field_save')) {
2795
-    /**
2796
-     * Save or Update custom sort fields into the database.
2797
-     *
2798
-     * @since 1.0.0
2799
-     * @package GeoDirectory
2800
-     * @global object $wpdb WordPress Database object.
2801
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2802
-     * @param array $request_field {
2803
-     *    Attributes of the Request field.
2804
-     *
2805
-     *    @type string $action Ajax action name.
2806
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
2807
-     *    @type string $create_field Do you want to create this field?.
2808
-     *    @type string $field_ins_upd Field created or updated?.
2809
-     *    @type string $_wpnonce Nonce value.
2810
-     *    @type string $listing_type The Post type.
2811
-     *    @type string $field_type Field Type.
2812
-     *    @type string $field_id Field ID.
2813
-     *    @type string $data_type Data Type.
2814
-     *    @type string $htmlvar_name HTML variable name.
2815
-     *    @type string $site_title Section title which you wish to display in frontend.
2816
-     *    @type string $is_default Is this default sorting?.
2817
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
2818
-     *    @type string $sort_order Sort Order.
2819
-     *
2820
-     * }
2821
-     * @param bool $default Not yet implemented.
2822
-     * @return int Returns the last affected db table row id.
2823
-     */
2824
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2825
-    {
2826
-
2827
-        global $wpdb, $plugin_prefix;
2828
-
2829
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2830
-
2831
-        $cf = trim($result_str, '_');
2832
-
2833
-        /*-------- check dublicate validation --------*/
2834
-
2835
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2836
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2837
-
2838
-        $post_type = $request_field['listing_type'];
2839
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2840
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2841
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2842
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2843
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2844
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2845
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2846
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2847
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2848
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2849
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2850
-
2851
-        $default_order = '';
2852
-        if ($is_default != '') {
2853
-            $default_order = $is_default;
2854
-            $is_default = '1';
2855
-        }
2856
-
2857
-
2858
-        $check_html_variable = $wpdb->get_var(
2859
-            $wpdb->prepare(
2860
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2861
-                array($cehhtmlvar_name, $post_type, $field_type)
2862
-            )
2863
-        );
2864
-
2865
-        if ($is_default == 1) {
2866
-
2867
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2868
-
2869
-        }
2870
-
2871
-
2872
-        if (!$check_html_variable) {
2873
-
2874
-            $wpdb->query(
2875
-
2876
-                $wpdb->prepare(
2877
-
2878
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2795
+	/**
2796
+	 * Save or Update custom sort fields into the database.
2797
+	 *
2798
+	 * @since 1.0.0
2799
+	 * @package GeoDirectory
2800
+	 * @global object $wpdb WordPress Database object.
2801
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2802
+	 * @param array $request_field {
2803
+	 *    Attributes of the Request field.
2804
+	 *
2805
+	 *    @type string $action Ajax action name.
2806
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
2807
+	 *    @type string $create_field Do you want to create this field?.
2808
+	 *    @type string $field_ins_upd Field created or updated?.
2809
+	 *    @type string $_wpnonce Nonce value.
2810
+	 *    @type string $listing_type The Post type.
2811
+	 *    @type string $field_type Field Type.
2812
+	 *    @type string $field_id Field ID.
2813
+	 *    @type string $data_type Data Type.
2814
+	 *    @type string $htmlvar_name HTML variable name.
2815
+	 *    @type string $site_title Section title which you wish to display in frontend.
2816
+	 *    @type string $is_default Is this default sorting?.
2817
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
2818
+	 *    @type string $sort_order Sort Order.
2819
+	 *
2820
+	 * }
2821
+	 * @param bool $default Not yet implemented.
2822
+	 * @return int Returns the last affected db table row id.
2823
+	 */
2824
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2825
+	{
2826
+
2827
+		global $wpdb, $plugin_prefix;
2828
+
2829
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2830
+
2831
+		$cf = trim($result_str, '_');
2832
+
2833
+		/*-------- check dublicate validation --------*/
2834
+
2835
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2836
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2837
+
2838
+		$post_type = $request_field['listing_type'];
2839
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2840
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2841
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2842
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2843
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2844
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2845
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2846
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2847
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2848
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2849
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2850
+
2851
+		$default_order = '';
2852
+		if ($is_default != '') {
2853
+			$default_order = $is_default;
2854
+			$is_default = '1';
2855
+		}
2856
+
2857
+
2858
+		$check_html_variable = $wpdb->get_var(
2859
+			$wpdb->prepare(
2860
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2861
+				array($cehhtmlvar_name, $post_type, $field_type)
2862
+			)
2863
+		);
2864
+
2865
+		if ($is_default == 1) {
2866
+
2867
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2868
+
2869
+		}
2870
+
2871
+
2872
+		if (!$check_html_variable) {
2873
+
2874
+			$wpdb->query(
2875
+
2876
+				$wpdb->prepare(
2877
+
2878
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2879 2879
 				post_type = %s,
2880 2880
 				data_type = %s,
2881 2881
 				field_type = %s,
@@ -2890,23 +2890,23 @@  discard block
 block discarded – undo
2890 2890
 				asc_title = %s,
2891 2891
 				desc_title = %s",
2892 2892
 
2893
-                    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)
2894
-                )
2893
+					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)
2894
+				)
2895 2895
 
2896
-            );
2896
+			);
2897 2897
 
2898 2898
 
2899
-            $lastid = $wpdb->insert_id;
2899
+			$lastid = $wpdb->insert_id;
2900 2900
 
2901
-            $lastid = trim($lastid);
2901
+			$lastid = trim($lastid);
2902 2902
 
2903
-        } else {
2903
+		} else {
2904 2904
 
2905
-            $wpdb->query(
2905
+			$wpdb->query(
2906 2906
 
2907
-                $wpdb->prepare(
2907
+				$wpdb->prepare(
2908 2908
 
2909
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2909
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2910 2910
 				post_type = %s,
2911 2911
 				data_type = %s,
2912 2912
 				field_type = %s,
@@ -2922,115 +2922,115 @@  discard block
 block discarded – undo
2922 2922
 				desc_title = %s
2923 2923
 				where id = %d",
2924 2924
 
2925
-                    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)
2926
-                )
2925
+					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)
2926
+				)
2927 2927
 
2928
-            );
2928
+			);
2929 2929
 
2930
-            $lastid = trim($cf);
2930
+			$lastid = trim($cf);
2931 2931
 
2932
-        }
2932
+		}
2933 2933
 
2934 2934
 
2935
-        return (int)$lastid;
2935
+		return (int)$lastid;
2936 2936
 
2937
-    }
2937
+	}
2938 2938
 }
2939 2939
 
2940 2940
 
2941 2941
 if (!function_exists('geodir_custom_sort_field_delete')) {
2942
-    /**
2943
-     * Delete a custom sort field using field id.
2944
-     * @since 1.0.0
2945
-     * @package GeoDirectory
2946
-     * @global object $wpdb WordPress Database object.
2947
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2948
-     * @param string $field_id The field ID.
2949
-     * @return int|string Returns field id when successful deletion, else returns 0.
2950
-     */
2951
-    function geodir_custom_sort_field_delete($field_id = '')
2952
-    {
2953
-
2954
-        global $wpdb, $plugin_prefix;
2955
-        if ($field_id != '') {
2956
-            $cf = trim($field_id, '_');
2957
-
2958
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2959
-
2960
-            return $field_id;
2961
-
2962
-        } else
2963
-            return 0;
2964
-
2965
-    }
2942
+	/**
2943
+	 * Delete a custom sort field using field id.
2944
+	 * @since 1.0.0
2945
+	 * @package GeoDirectory
2946
+	 * @global object $wpdb WordPress Database object.
2947
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2948
+	 * @param string $field_id The field ID.
2949
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2950
+	 */
2951
+	function geodir_custom_sort_field_delete($field_id = '')
2952
+	{
2953
+
2954
+		global $wpdb, $plugin_prefix;
2955
+		if ($field_id != '') {
2956
+			$cf = trim($field_id, '_');
2957
+
2958
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2959
+
2960
+			return $field_id;
2961
+
2962
+		} else
2963
+			return 0;
2964
+
2965
+	}
2966 2966
 }
2967 2967
 
2968 2968
 
2969 2969
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2970
-    /**
2971
-     * Custom sort field admin html.
2972
-     *
2973
-     * @since 1.0.0
2974
-     * @package GeoDirectory
2975
-     * @global object $wpdb WordPress Database object.
2976
-     * @param string $field_type The form field type.
2977
-     * @param object|int $result_str The custom field results object or row id.
2978
-     * @param string $field_ins_upd When set to "submit" displays form.
2979
-     * @param bool $default when set to true field will be for admin use only.
2980
-     */
2981
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
2982
-    {
2983
-        global $wpdb;
2984
-        $cf = $result_str;
2985
-        if (!is_object($cf)) {
2986
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2987
-        } else {
2988
-            $field_info = $cf;
2989
-            $result_str = $cf->id;
2990
-        }
2991
-
2992
-        $field_info = stripslashes_deep($field_info); // strip slashes
2993
-
2994
-        if (!isset($field_info->post_type)) {
2995
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2996
-        } else {
2997
-            $post_type = $field_info->post_type;
2998
-        }
2999
-
3000
-        $field_types = explode('-_-', $field_type);
3001
-        $field_type = $field_types[0];
3002
-        $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
3003
-
3004
-        $site_title = '';
3005
-        if ($site_title == '')
3006
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
3007
-
3008
-        if ($site_title == '') {
3009
-            $fields = geodir_get_custom_sort_options($post_type);
3010
-
3011
-            foreach ($fields as $val) {
3012
-                $val = stripslashes_deep($val); // strip slashes
3013
-
3014
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
3015
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
3016
-                }
3017
-            }
3018
-        }
3019
-
3020
-        if ($htmlvar_name == '')
3021
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
3022
-
3023
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
3024
-
3025
-        ?>
2970
+	/**
2971
+	 * Custom sort field admin html.
2972
+	 *
2973
+	 * @since 1.0.0
2974
+	 * @package GeoDirectory
2975
+	 * @global object $wpdb WordPress Database object.
2976
+	 * @param string $field_type The form field type.
2977
+	 * @param object|int $result_str The custom field results object or row id.
2978
+	 * @param string $field_ins_upd When set to "submit" displays form.
2979
+	 * @param bool $default when set to true field will be for admin use only.
2980
+	 */
2981
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
2982
+	{
2983
+		global $wpdb;
2984
+		$cf = $result_str;
2985
+		if (!is_object($cf)) {
2986
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2987
+		} else {
2988
+			$field_info = $cf;
2989
+			$result_str = $cf->id;
2990
+		}
2991
+
2992
+		$field_info = stripslashes_deep($field_info); // strip slashes
2993
+
2994
+		if (!isset($field_info->post_type)) {
2995
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2996
+		} else {
2997
+			$post_type = $field_info->post_type;
2998
+		}
2999
+
3000
+		$field_types = explode('-_-', $field_type);
3001
+		$field_type = $field_types[0];
3002
+		$htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
3003
+
3004
+		$site_title = '';
3005
+		if ($site_title == '')
3006
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
3007
+
3008
+		if ($site_title == '') {
3009
+			$fields = geodir_get_custom_sort_options($post_type);
3010
+
3011
+			foreach ($fields as $val) {
3012
+				$val = stripslashes_deep($val); // strip slashes
3013
+
3014
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
3015
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
3016
+				}
3017
+			}
3018
+		}
3019
+
3020
+		if ($htmlvar_name == '')
3021
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
3022
+
3023
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
3024
+
3025
+		?>
3026 3026
         <li class="text" id="licontainer_<?php echo $result_str;?>">
3027 3027
             <div class="title title<?php echo $result_str;?> gt-fieldset"
3028 3028
                  title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
3029 3029
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
3030 3030
                 <?php
3031 3031
 
3032
-                $nonce = wp_create_nonce('custom_fields_' . $result_str);
3033
-                ?>
3032
+				$nonce = wp_create_nonce('custom_fields_' . $result_str);
3033
+				?>
3034 3034
 
3035 3035
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
3036 3036
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -3043,17 +3043,17 @@  discard block
 block discarded – undo
3043 3043
 
3044 3044
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
3045 3045
                  style="display:<?php if ($field_ins_upd == 'submit') {
3046
-                     echo 'block;';
3047
-                 } else {
3048
-                     echo 'none;';
3049
-                 } ?>">
3046
+					 echo 'block;';
3047
+				 } else {
3048
+					 echo 'none;';
3049
+				 } ?>">
3050 3050
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
3051 3051
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
3052 3052
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
3053 3053
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
3054 3054
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
3055
-                    echo $field_info->data_type;
3056
-                }?>"/>
3055
+					echo $field_info->data_type;
3056
+				}?>"/>
3057 3057
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
3058 3058
 
3059 3059
 
@@ -3068,19 +3068,19 @@  discard block
 block discarded – undo
3068 3068
                             <td>
3069 3069
                                 <input type="checkbox" name="asc" id="asc"
3070 3070
                                        value="1" <?php if (isset($field_info->sort_asc) && $field_info->sort_asc == '1') {
3071
-                                    echo 'checked="checked"';
3072
-                                } ?>/>
3071
+									echo 'checked="checked"';
3072
+								} ?>/>
3073 3073
 
3074 3074
                                 <input type="text" name="asc_title" id="asc_title"
3075 3075
                                        placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
3076 3076
                                        value="<?php if (isset($field_info->asc_title)) {
3077
-                                           echo esc_attr($field_info->asc_title);
3078
-                                       } ?>" style="width:45%;"/>
3077
+										   echo esc_attr($field_info->asc_title);
3078
+									   } ?>" style="width:45%;"/>
3079 3079
 
3080 3080
                                 <input type="radio" name="is_default"
3081 3081
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
3082
-                                    echo 'checked="checked"';
3083
-                                } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3082
+									echo 'checked="checked"';
3083
+								} ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3084 3084
 
3085 3085
                                 <br/>
3086 3086
                                 <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
@@ -3092,18 +3092,18 @@  discard block
 block discarded – undo
3092 3092
                             <td>
3093 3093
                                 <input type="checkbox" name="desc" id="desc"
3094 3094
                                        value="1" <?php if (isset($field_info->sort_desc) && $field_info->sort_desc == '1') {
3095
-                                    echo 'checked="checked"';
3096
-                                } ?>/>
3095
+									echo 'checked="checked"';
3096
+								} ?>/>
3097 3097
 
3098 3098
                                 <input type="text" name="desc_title" id="desc_title"
3099 3099
                                        placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
3100 3100
                                        value="<?php if (isset($field_info->desc_title)) {
3101
-                                           echo esc_attr($field_info->desc_title);
3102
-                                       } ?>" style="width:45%;"/>
3101
+										   echo esc_attr($field_info->desc_title);
3102
+									   } ?>" style="width:45%;"/>
3103 3103
                                 <input type="radio" name="is_default"
3104 3104
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
3105
-                                    echo 'checked="checked"';
3106
-                                } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3105
+									echo 'checked="checked"';
3106
+								} ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3107 3107
                                 <br/>
3108 3108
                                 <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
3109 3109
                             </td>
@@ -3126,8 +3126,8 @@  discard block
 block discarded – undo
3126 3126
                             <td align="left">
3127 3127
                                 <input type="checkbox" name="is_default"
3128 3128
                                        value="<?php echo $field_type; ?>"  <?php if (isset($field_info->is_default) && $field_info->is_default == '1') {
3129
-                                    echo 'checked="checked"';
3130
-                                } ?>/>
3129
+									echo 'checked="checked"';
3130
+								} ?>/>
3131 3131
                                 <br/>
3132 3132
                                 <span><?php _e('If field is checked then the field will be use as default sort.', 'geodirectory'); ?></span>
3133 3133
                             </td>
@@ -3141,12 +3141,12 @@  discard block
 block discarded – undo
3141 3141
                             <select name="is_active" id="is_active">
3142 3142
                                 <option
3143 3143
                                     value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
3144
-                                    echo 'selected="selected"';
3145
-                                }?>><?php _e('Yes', 'geodirectory');?></option>
3144
+									echo 'selected="selected"';
3145
+								}?>><?php _e('Yes', 'geodirectory');?></option>
3146 3146
                                 <option
3147 3147
                                     value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
3148
-                                    echo 'selected="selected"';
3149
-                                }?>><?php _e('No', 'geodirectory');?></option>
3148
+									echo 'selected="selected"';
3149
+								}?>><?php _e('No', 'geodirectory');?></option>
3150 3150
                             </select>
3151 3151
                             <br/>
3152 3152
                             <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
@@ -3157,8 +3157,8 @@  discard block
 block discarded – undo
3157 3157
                         <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
3158 3158
                         <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
3159 3159
                                                 value="<?php if (isset($field_info->sort_order)) {
3160
-                                                    echo esc_attr($field_info->sort_order);
3161
-                                                }?>" size="50"/>
3160
+													echo esc_attr($field_info->sort_order);
3161
+												}?>" size="50"/>
3162 3162
                             <br/>
3163 3163
                             <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
3164 3164
                         </td>
@@ -3181,38 +3181,38 @@  discard block
 block discarded – undo
3181 3181
             </div>
3182 3182
         </li> <?php
3183 3183
 
3184
-    }
3184
+	}
3185 3185
 }
3186 3186
 
3187 3187
 if (!function_exists('check_field_visibility')) {
3188
-    /**
3189
-     * Check field visibility as per price package.
3190
-     *
3191
-     * @since 1.0.0
3192
-     * @package GeoDirectory
3193
-     * @global object $wpdb WordPress Database object.
3194
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
3195
-     * @param int|string $package_id The package ID.
3196
-     * @param string $field_name The field name.
3197
-     * @param string $post_type Optional. The wordpress post type.
3198
-     * @return bool Returns true when field visible, otherwise false.
3199
-     */
3200
-    function check_field_visibility($package_id, $field_name, $post_type)
3201
-    {
3202
-        global $wpdb, $geodir_addon_list;
3203
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
3204
-            return true;
3205
-        }
3206
-        if (!$package_id || !$field_name || !$post_type) {
3207
-            return true;
3208
-        }
3209
-        $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));
3210
-
3211
-        if ($wpdb->get_var($sql)) {
3212
-            return true;
3213
-        }
3214
-        return false;
3215
-    }
3188
+	/**
3189
+	 * Check field visibility as per price package.
3190
+	 *
3191
+	 * @since 1.0.0
3192
+	 * @package GeoDirectory
3193
+	 * @global object $wpdb WordPress Database object.
3194
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
3195
+	 * @param int|string $package_id The package ID.
3196
+	 * @param string $field_name The field name.
3197
+	 * @param string $post_type Optional. The wordpress post type.
3198
+	 * @return bool Returns true when field visible, otherwise false.
3199
+	 */
3200
+	function check_field_visibility($package_id, $field_name, $post_type)
3201
+	{
3202
+		global $wpdb, $geodir_addon_list;
3203
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
3204
+			return true;
3205
+		}
3206
+		if (!$package_id || !$field_name || !$post_type) {
3207
+			return true;
3208
+		}
3209
+		$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));
3210
+
3211
+		if ($wpdb->get_var($sql)) {
3212
+			return true;
3213
+		}
3214
+		return false;
3215
+	}
3216 3216
 }
3217 3217
 
3218 3218
 /**
@@ -3227,43 +3227,43 @@  discard block
 block discarded – undo
3227 3227
  */
3228 3228
 function geodir_string_to_options($input = '', $translated = false)
3229 3229
 {
3230
-    $return = array();
3231
-    if ($input != '') {
3232
-        $input = trim($input);
3233
-        $input = rtrim($input, ",");
3234
-        $input = ltrim($input, ",");
3235
-        $input = trim($input);
3236
-    }
3237
-
3238
-    $input_arr = explode(',', $input);
3239
-
3240
-    if (!empty($input_arr)) {
3241
-        foreach ($input_arr as $input_str) {
3242
-            $input_str = trim($input_str);
3243
-
3244
-            if (strpos($input_str, "/") !== false) {
3245
-                $input_str = explode("/", $input_str, 2);
3246
-                $label = trim($input_str[0]);
3247
-                if ($translated && $label != '') {
3248
-                    $label = __($label, 'geodirectory');
3249
-                }
3250
-                $label = ucfirst($label);
3251
-                $value = trim($input_str[1]);
3252
-            } else {
3253
-                if ($translated && $input_str != '') {
3254
-                    $input_str = __($input_str, 'geodirectory');
3255
-                }
3256
-                $label = ucfirst($input_str);
3257
-                $value = $input_str;
3258
-            }
3259
-
3260
-            if ($label != '') {
3261
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
3262
-            }
3263
-        }
3264
-    }
3265
-
3266
-    return $return;
3230
+	$return = array();
3231
+	if ($input != '') {
3232
+		$input = trim($input);
3233
+		$input = rtrim($input, ",");
3234
+		$input = ltrim($input, ",");
3235
+		$input = trim($input);
3236
+	}
3237
+
3238
+	$input_arr = explode(',', $input);
3239
+
3240
+	if (!empty($input_arr)) {
3241
+		foreach ($input_arr as $input_str) {
3242
+			$input_str = trim($input_str);
3243
+
3244
+			if (strpos($input_str, "/") !== false) {
3245
+				$input_str = explode("/", $input_str, 2);
3246
+				$label = trim($input_str[0]);
3247
+				if ($translated && $label != '') {
3248
+					$label = __($label, 'geodirectory');
3249
+				}
3250
+				$label = ucfirst($label);
3251
+				$value = trim($input_str[1]);
3252
+			} else {
3253
+				if ($translated && $input_str != '') {
3254
+					$input_str = __($input_str, 'geodirectory');
3255
+				}
3256
+				$label = ucfirst($input_str);
3257
+				$value = $input_str;
3258
+			}
3259
+
3260
+			if ($label != '') {
3261
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
3262
+			}
3263
+		}
3264
+	}
3265
+
3266
+	return $return;
3267 3267
 }
3268 3268
 
3269 3269
 /**
@@ -3278,51 +3278,51 @@  discard block
 block discarded – undo
3278 3278
  */
3279 3279
 function geodir_string_values_to_options($option_values = '', $translated = false)
3280 3280
 {
3281
-    $options = array();
3282
-    if ($option_values == '') {
3283
-        return NULL;
3284
-    }
3285
-
3286
-    if (strpos($option_values, "{/optgroup}") !== false) {
3287
-        $option_values_arr = explode("{/optgroup}", $option_values);
3288
-
3289
-        foreach ($option_values_arr as $optgroup) {
3290
-            if (strpos($optgroup, "{optgroup}") !== false) {
3291
-                $optgroup_arr = explode("{optgroup}", $optgroup);
3292
-
3293
-                $count = 0;
3294
-                foreach ($optgroup_arr as $optgroup_str) {
3295
-                    $count++;
3296
-                    $optgroup_str = trim($optgroup_str);
3297
-
3298
-                    $optgroup_label = '';
3299
-                    if (strpos($optgroup_str, "|") !== false) {
3300
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
3301
-                        $optgroup_label = trim($optgroup_str_arr[0]);
3302
-                        if ($translated && $optgroup_label != '') {
3303
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
3304
-                        }
3305
-                        $optgroup_label = ucfirst($optgroup_label);
3306
-                        $optgroup_str = $optgroup_str_arr[1];
3307
-                    }
3308
-
3309
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
3310
-
3311
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
3312
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
3313
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
3314
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
3315
-                    }
3316
-                    $options = array_merge($options, $optgroup3);
3317
-                }
3318
-            } else {
3319
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
3320
-                $options = array_merge($options, $optgroup1);
3321
-            }
3322
-        }
3323
-    } else {
3324
-        $options = geodir_string_to_options($option_values, $translated);
3325
-    }
3326
-
3327
-    return $options;
3281
+	$options = array();
3282
+	if ($option_values == '') {
3283
+		return NULL;
3284
+	}
3285
+
3286
+	if (strpos($option_values, "{/optgroup}") !== false) {
3287
+		$option_values_arr = explode("{/optgroup}", $option_values);
3288
+
3289
+		foreach ($option_values_arr as $optgroup) {
3290
+			if (strpos($optgroup, "{optgroup}") !== false) {
3291
+				$optgroup_arr = explode("{optgroup}", $optgroup);
3292
+
3293
+				$count = 0;
3294
+				foreach ($optgroup_arr as $optgroup_str) {
3295
+					$count++;
3296
+					$optgroup_str = trim($optgroup_str);
3297
+
3298
+					$optgroup_label = '';
3299
+					if (strpos($optgroup_str, "|") !== false) {
3300
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
3301
+						$optgroup_label = trim($optgroup_str_arr[0]);
3302
+						if ($translated && $optgroup_label != '') {
3303
+							$optgroup_label = __($optgroup_label, 'geodirectory');
3304
+						}
3305
+						$optgroup_label = ucfirst($optgroup_label);
3306
+						$optgroup_str = $optgroup_str_arr[1];
3307
+					}
3308
+
3309
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
3310
+
3311
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
3312
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
3313
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
3314
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
3315
+					}
3316
+					$options = array_merge($options, $optgroup3);
3317
+				}
3318
+			} else {
3319
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
3320
+				$options = array_merge($options, $optgroup1);
3321
+			}
3322
+		}
3323
+	} else {
3324
+		$options = geodir_string_to_options($option_values, $translated);
3325
+	}
3326
+
3327
+	return $options;
3328 3328
 }
3329 3329
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +389 added lines, -389 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
     );
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $cf = $result_str;
170 170
         if (!is_object($cf)) {
171 171
 
172
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
+            $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
173 173
 
174 174
         } else {
175 175
             $field_info = $cf;
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
         if ($field_id != '') {
204 204
             $cf = trim($field_id, '_');
205 205
 
206
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
207
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
206
+            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
207
+                $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
208 208
 
209 209
                 $post_type = $field->post_type;
210 210
                 $htmlvar_name = $field->htmlvar_name;
211 211
 
212 212
                 if ($post_type != '' && $htmlvar_name != '') {
213
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
+                    $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214 214
                 }
215 215
 
216 216
                 /**
@@ -224,18 +224,18 @@  discard block
 block discarded – undo
224 224
                 do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
225 225
 
226 226
                 if ($field->field_type == 'address') {
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
235
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
227
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
228
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
229
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
230
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
231
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
232
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
233
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
234
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
235
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
236 236
                 } else {
237 237
                     if ($field->field_type != 'fieldset') {
238
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
+                        $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
239 239
                     }
240 240
                 }
241 241
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
306 306
 
307 307
         // some servers fail if a POST value is VARCHAR so we change it.
308
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
+        if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
309 309
             $request_field['data_type'] = 'VARCHAR';
310 310
         }
311 311
 
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
         $post_type = $request_field['listing_type'];
319 319
 
320 320
         if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
321
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
+            $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name;
322 322
         }
323 323
 
324 324
         $check_html_variable = $wpdb->get_var(
325 325
             $wpdb->prepare(
326
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
+                "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ",
327 327
                 array($cf, $cehhtmlvar_name, $post_type)
328 328
             )
329 329
         );
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
                 $post_meta_info = $wpdb->get_row(
337 337
                     $wpdb->prepare(
338
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
+                        "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d",
339 339
                         array($cf)
340 340
                     )
341 341
                 );
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             if ($post_type == '') $post_type = 'gd_place';
354 354
 
355 355
 
356
-            $detail_table = $plugin_prefix . $post_type . '_detail';
356
+            $detail_table = $plugin_prefix.$post_type.'_detail';
357 357
 
358 358
             $admin_title = $request_field['admin_title'];
359 359
             $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,
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 					for_admin_use = %s
804 804
 					where id = %d",
805 805
 
806
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_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)
806
+                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_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 807
                     )
808 808
 
809 809
                 );
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 
814 814
                 $wpdb->query(
815 815
                     $wpdb->prepare(
816
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
816
+                        "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
817 817
 					 	site_title=%s
818 818
 					where post_type = %s and htmlvar_name = %s",
819 819
                         array($site_title, $post_type, $htmlvar_name)
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 
823 823
 
824 824
                 if ($cat_sort == '')
825
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
825
+                    $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 826
 
827 827
 
828 828
                 /**
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                         $data_type = '';
843 843
 
844 844
                         if ($htmlvar_name != '') {
845
-                            $prefix = $htmlvar_name . '_';
845
+                            $prefix = $htmlvar_name.'_';
846 846
                         }
847 847
                         $old_prefix = $old_html_variable;
848 848
 
@@ -850,109 +850,109 @@  discard block
 block discarded – undo
850 850
 
851 851
                         $meta_field_add = "VARCHAR( 254 ) NULL";
852 852
                         if ($default_value != '') {
853
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
853
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
854 854
                         }
855 855
 
856
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
856
+                        geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add);
857 857
                         //$wpdb->query($meta_field_add);
858 858
 
859 859
 
860 860
                         if (!empty($extra_fields)) {
861 861
 
862 862
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
863
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
863
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL";
864 864
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
865 865
                                 if ($default_value != '') {
866
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
866
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
867 867
                                 }
868 868
 
869
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
869
+                                geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
870 870
                                 //$wpdb->query($meta_field_add);
871 871
                             }
872 872
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
873
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
873
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL";
874 874
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
875 875
                                 if ($default_value != '') {
876
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
876
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
877 877
                                 }
878 878
 
879
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
879
+                                geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
880 880
                                 //$wpdb->query($meta_field_add);
881 881
                             }
882 882
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
883
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
883
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL";
884 884
 
885 885
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
886 886
                                 if ($default_value != '') {
887
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
887
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
888 888
                                 }
889 889
 
890
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
890
+                                geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
891 891
                                 //$wpdb->query($meta_field_add);
892 892
                             }
893 893
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
894
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
894
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL";
895 895
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
896 896
                                 if ($default_value != '') {
897
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
897
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
898 898
                                 }
899 899
 
900
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
900
+                                geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
901 901
                                 //$wpdb->query($meta_field_add);
902 902
                             }
903 903
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
904
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
904
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
905 905
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
906 906
                                 if ($default_value != '') {
907
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
907
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
908 908
                                 }
909 909
 
910
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
910
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
911 911
                                 //$wpdb->query($meta_field_add);
912 912
 
913
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
913
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
914 914
 
915 915
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
916 916
                                 if ($default_value != '') {
917
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
917
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
918 918
                                 }
919 919
 
920
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
920
+                                geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
921 921
 
922 922
                                 //$wpdb->query($meta_field_add);
923 923
                             }
924 924
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
925
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
925
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
926 926
 
927 927
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
928 928
                                 if ($default_value != '') {
929
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
929
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
930 930
                                 }
931 931
 
932
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
932
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
933 933
 
934 934
                                 //$wpdb->query($meta_field_add);
935 935
                             }
936 936
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
937
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
937
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
938 938
 
939 939
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
940 940
                                 if ($default_value != '') {
941
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
941
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
942 942
                                 }
943 943
 
944
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
944
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
945 945
 
946 946
                                 //$wpdb->query($meta_field_add);
947 947
                             }
948 948
                             // show lat lng
949 949
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
950
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
950
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
951 951
 
952 952
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
953 953
                                 $meta_field_add .= " DEFAULT '1'";
954 954
 
955
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
955
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
956 956
                                 //$wpdb->query($meta_field_add);
957 957
                             }
958 958
                         }
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
                     case 'checkbox':
963 963
                         $data_type = 'TINYINT';
964 964
 
965
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
966
-                        if ((int)$default_value === 1) {
965
+                        $meta_field_add = $data_type."( 1 ) NOT NULL ";
966
+                        if ((int) $default_value === 1) {
967 967
                             $meta_field_add .= " DEFAULT '1'";
968 968
                         }
969 969
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
                             }
997 997
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
998 998
                             if (strlen($option_values)) {
999
-                                $op_size =  strlen($option_values);
999
+                                $op_size = strlen($option_values);
1000 1000
                             }
1001 1001
 
1002 1002
                             if (isset($request_field['multi_display_type'])) {
@@ -1004,9 +1004,9 @@  discard block
 block discarded – undo
1004 1004
                             }
1005 1005
                         }
1006 1006
 
1007
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1007
+                        $meta_field_add = $data_type."( $op_size ) NULL ";
1008 1008
                         if ($default_value != '') {
1009
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1009
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
1010 1010
                         }
1011 1011
 
1012 1012
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
@@ -1021,9 +1021,9 @@  discard block
 block discarded – undo
1021 1021
 
1022 1022
                         $data_type = 'TEXT';
1023 1023
 
1024
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1024
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1025 1025
 
1026
-                        $meta_field_add = $data_type . " NULL ";
1026
+                        $meta_field_add = $data_type." NULL ";
1027 1027
                         /*if($default_value != '')
1028 1028
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1029 1029
 
@@ -1038,9 +1038,9 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
                         $data_type = 'DATE';
1040 1040
 
1041
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1041
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1042 1042
 
1043
-                        $meta_field_add = $data_type . " NULL ";
1043
+                        $meta_field_add = $data_type." NULL ";
1044 1044
 
1045 1045
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1046 1046
                         if ($add_result === false) {
@@ -1053,9 +1053,9 @@  discard block
 block discarded – undo
1053 1053
 
1054 1054
                         $data_type = 'TIME';
1055 1055
 
1056
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1056
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1057 1057
 
1058
-                        $meta_field_add = $data_type . " NULL ";
1058
+                        $meta_field_add = $data_type." NULL ";
1059 1059
 
1060 1060
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1061 1061
                         if ($add_result === false) {
@@ -1067,22 +1067,22 @@  discard block
 block discarded – undo
1067 1067
                     default:
1068 1068
 
1069 1069
                         if ($data_type != 'VARCHAR' && $data_type != '') {
1070
-                            $meta_field_add = $data_type . " NULL ";
1070
+                            $meta_field_add = $data_type." NULL ";
1071 1071
 
1072 1072
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
1073
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1073
+                                $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL ";
1074 1074
                             }
1075 1075
 
1076 1076
                             if (is_numeric($default_value) && $default_value != '') {
1077
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1078
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1077
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1078
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1079 1079
                             }
1080 1080
                         } else {
1081 1081
                             $meta_field_add = " VARCHAR( 254 ) NULL ";
1082 1082
 
1083 1083
                             if ($default_value != '') {
1084
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1085
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1084
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1085
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1086 1086
                             }
1087 1087
                         }
1088 1088
 
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
                     $wpdb->prepare(
1106 1106
 
1107
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1107
+                        "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1108 1108
 					post_type = %s,
1109 1109
 					admin_title = %s,
1110 1110
 					site_title = %s,
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 					validation_msg = %s,
1137 1137
 					for_admin_use = %s ",
1138 1138
 
1139
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_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)
1139
+                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_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)
1140 1140
 
1141 1141
                     )
1142 1142
 
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 
1149 1149
             }
1150 1150
 
1151
-            return (int)$lastid;
1151
+            return (int) $lastid;
1152 1152
 
1153 1153
 
1154 1154
         } else {
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 
1182 1182
             $post_meta_info = $wpdb->query(
1183 1183
                 $wpdb->prepare(
1184
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1184
+                    "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1185 1185
 															sort_order=%d 
1186 1186
 															where id= %d",
1187 1187
                     array($count, $cf)
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
         $value = '';
1238 1238
 
1239 1239
         /* field available to site admin only for edit */
1240
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1240
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1241 1241
         if ($for_admin_use && !is_super_admin()) {
1242 1242
             continue;
1243 1243
         }
@@ -1271,22 +1271,22 @@  discard block
 block discarded – undo
1271 1271
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1272 1272
          * @see 'geodir_after_custom_form_field_$name'
1273 1273
          */
1274
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1274
+        do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
1275 1275
 
1276 1276
         if ($type == 'fieldset') {
1277
-            $fieldset_id = (int)$val['id'];
1278
-            $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1277
+            $fieldset_id = (int) $val['id'];
1278
+            $fieldset_field_class = 'gd-fieldset-'.$fieldset_id;
1279 1279
             ?>
1280
-            <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1281
-                <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1280
+            <h5 id="geodir_fieldset_<?php echo $fieldset_id; ?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id; ?>"><?php echo $site_title; ?>
1281
+                <?php if ($admin_desc != '') echo '<small>( '.$admin_desc.' )</small>'; ?></h5>
1282 1282
             <?php
1283 1283
         } else if ($type == 'address') {
1284
-            $prefix = $name . '_';
1284
+            $prefix = $name.'_';
1285 1285
 
1286
-            ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1287
-            ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1286
+            ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address');
1287
+            ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code ');
1288 1288
             ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1289
-            ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1289
+            ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview');
1290 1290
 
1291 1291
             $address = '';
1292 1292
             $zip = '';
@@ -1297,21 +1297,21 @@  discard block
 block discarded – undo
1297 1297
 
1298 1298
             if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1299 1299
                 $post = $gd_ses_listing;
1300
-                $address = $post[$prefix . 'address'];
1301
-                $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1302
-                $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1303
-                $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1304
-                $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1305
-                $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1300
+                $address = $post[$prefix.'address'];
1301
+                $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : '';
1302
+                $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : '';
1303
+                $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : '';
1304
+                $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : '';
1305
+                $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : '';
1306 1306
             } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1307
-                $post_info = (array)$post_info;
1308
-
1309
-                $address = $post_info[$prefix . 'address'];
1310
-                $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1311
-                $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1312
-                $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1313
-                $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1314
-                $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1307
+                $post_info = (array) $post_info;
1308
+
1309
+                $address = $post_info[$prefix.'address'];
1310
+                $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : '';
1311
+                $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : '';
1312
+                $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : '';
1313
+                $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : '';
1314
+                $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : '';
1315 1315
             }
1316 1316
 
1317 1317
             $location = geodir_get_default_location();
@@ -1348,16 +1348,16 @@  discard block
 block discarded – undo
1348 1348
 
1349 1349
             ?>
1350 1350
 
1351
-            <div id="geodir_<?php echo $prefix . 'address';?>_row"
1352
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1351
+            <div id="geodir_<?php echo $prefix.'address'; ?>_row"
1352
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1353 1353
                 <label>
1354 1354
                     <?php _e($address_title, 'geodirectory'); ?>
1355
-                    <?php if ($is_required) echo '<span>*</span>';?>
1355
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1356 1356
                 </label>
1357
-                <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1358
-                       id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
1357
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>"
1358
+                       id="<?php echo $prefix.'address'; ?>" class="geodir_textfield"
1359 1359
                        value="<?php echo esc_attr(stripslashes($address)); ?>"/>
1360
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1360
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1361 1361
                 <?php if ($is_required) { ?>
1362 1362
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1363 1363
                 <?php } ?>
@@ -1377,14 +1377,14 @@  discard block
 block discarded – undo
1377 1377
 
1378 1378
             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1379 1379
 
1380
-                <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1381
-                     class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1380
+                <div id="geodir_<?php echo $prefix.'zip'; ?>_row"
1381
+                     class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1382 1382
                     <label>
1383 1383
                         <?php _e($zip_title, 'geodirectory'); ?>
1384 1384
                         <?php /*if($is_required) echo '<span>*</span>';*/ ?>
1385 1385
                     </label>
1386
-                    <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>"
1387
-                           id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill"
1386
+                    <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>"
1387
+                           id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill"
1388 1388
                            value="<?php echo esc_attr(stripslashes($zip)); ?>"/>
1389 1389
                     <?php /*if($is_required) {?>
1390 1390
 					<span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span>
@@ -1394,14 +1394,14 @@  discard block
 block discarded – undo
1394 1394
 
1395 1395
             <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1396 1396
 
1397
-                <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1397
+                <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1398 1398
                     <?php
1399 1399
                     /**
1400 1400
                      * Contains add listing page map functions.
1401 1401
                      *
1402 1402
                      * @since 1.0.0
1403 1403
                      */
1404
-                    include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1404
+                    include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1405 1405
                     if ($lat_lng_blank) {
1406 1406
                         $lat = '';
1407 1407
                         $lng = '';
@@ -1412,14 +1412,14 @@  discard block
 block discarded – undo
1412 1412
                 <?php
1413 1413
                 /* show lat lng */
1414 1414
                 $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1415
-                <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1416
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1415
+                <div id="geodir_<?php echo $prefix.'latitude'; ?>_row"
1416
+                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>>
1417 1417
                     <label>
1418 1418
                         <?php echo PLACE_ADDRESS_LAT; ?>
1419 1419
                         <?php if ($is_required) echo '<span>*</span>'; ?>
1420 1420
                     </label>
1421
-                    <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1422
-                           id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
1421
+                    <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>"
1422
+                           id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield"
1423 1423
                            value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/>
1424 1424
                     <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span>
1425 1425
                     <?php if ($is_required) { ?>
@@ -1427,14 +1427,14 @@  discard block
 block discarded – undo
1427 1427
                     <?php } ?>
1428 1428
                 </div>
1429 1429
 
1430
-                <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1431
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1430
+                <div id="geodir_<?php echo $prefix.'longitude'; ?>_row"
1431
+                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>>
1432 1432
                     <label>
1433 1433
                         <?php echo PLACE_ADDRESS_LNG; ?>
1434 1434
                         <?php if ($is_required) echo '<span>*</span>'; ?>
1435 1435
                     </label>
1436
-                    <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1437
-                           id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
1436
+                    <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>"
1437
+                           id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield"
1438 1438
                            value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/>
1439 1439
                     <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span>
1440 1440
                     <?php if ($is_required) { ?>
@@ -1444,32 +1444,32 @@  discard block
 block discarded – undo
1444 1444
             <?php } ?>
1445 1445
 
1446 1446
             <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1447
-                <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1447
+                <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1448 1448
                     <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1449 1449
 
1450 1450
 
1451 1451
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1452 1452
                                                             class="gd-checkbox"
1453
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1454
-                                                            id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1453
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1454
+                                                            id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1455 1455
                             echo 'checked="checked"';
1456 1456
                         } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1457 1457
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1458 1458
                                                              class="gd-checkbox"
1459
-                                                             name="<?php echo $prefix . 'mapview'; ?>"
1459
+                                                             name="<?php echo $prefix.'mapview'; ?>"
1460 1460
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1461 1461
                             echo 'checked="checked"';
1462 1462
                         } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1463 1463
 
1464 1464
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1465 1465
                                                             class="gd-checkbox"
1466
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1466
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1467 1467
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1468 1468
                             echo 'checked="checked"';
1469 1469
                         } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1470 1470
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1471 1471
                                                             class="gd-checkbox"
1472
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1472
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1473 1473
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1474 1474
                             echo 'checked="checked"';
1475 1475
                         } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
@@ -1481,35 +1481,35 @@  discard block
 block discarded – undo
1481 1481
             <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1482 1482
                 <input type="hidden" value="<?php if (isset($mapzoom)) {
1483 1483
                     echo esc_attr($mapzoom);
1484
-                } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1484
+                } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/>
1485 1485
             <?php }?>
1486 1486
         <?php } elseif ($type == 'text') {
1487 1487
 
1488 1488
             //number and float validation $validation_pattern
1489
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1490
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1489
+            if (isset($val['data_type']) && $val['data_type'] == 'INT') {$type = 'number'; }
1490
+            elseif (isset($val['data_type']) && $val['data_type'] == 'FLOAT') {$type = 'float'; }
1491 1491
             //print_r($val);
1492 1492
             //validation
1493
-            if(isset($val['validation_pattern']) && $val['validation_pattern']){
1493
+            if (isset($val['validation_pattern']) && $val['validation_pattern']) {
1494 1494
                 $validation = 'pattern="'.$val['validation_pattern'].'"';
1495
-            }else{$validation='';}
1495
+            } else {$validation = ''; }
1496 1496
 
1497 1497
             // validation message
1498
-            if(isset($val['validation_msg']) && $val['validation_msg']){
1498
+            if (isset($val['validation_msg']) && $val['validation_msg']) {
1499 1499
                 $validation_msg = 'title="'.$val['validation_msg'].'"';
1500
-            }else{$validation_msg='';}
1500
+            } else {$validation_msg = ''; }
1501 1501
             ?>
1502 1502
 
1503
-            <div id="<?php echo $name;?>_row"
1504
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1503
+            <div id="<?php echo $name; ?>_row"
1504
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1505 1505
                 <label>
1506 1506
                     <?php $site_title = __($site_title, 'geodirectory');
1507 1507
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1508
-                    <?php if ($is_required) echo '<span>*</span>';?>
1508
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1509 1509
                 </label>
1510
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1511
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
1512
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1510
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1511
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
1512
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1513 1513
                 <?php if ($is_required) { ?>
1514 1514
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1515 1515
                 <?php } ?>
@@ -1520,16 +1520,16 @@  discard block
 block discarded – undo
1520 1520
                 $value = '';
1521 1521
             }?>
1522 1522
 
1523
-            <div id="<?php echo $name;?>_row"
1524
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1523
+            <div id="<?php echo $name; ?>_row"
1524
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1525 1525
                 <label>
1526 1526
                     <?php $site_title = __($site_title, 'geodirectory');
1527 1527
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1528
-                    <?php if ($is_required) echo '<span>*</span>';?>
1528
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1529 1529
                 </label>
1530
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1531
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
1532
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1530
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1531
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
1532
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1533 1533
                 <?php if ($is_required) { ?>
1534 1534
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1535 1535
                 <?php } ?>
@@ -1540,16 +1540,16 @@  discard block
 block discarded – undo
1540 1540
                 $value = '';
1541 1541
             } ?>
1542 1542
 
1543
-            <div id="<?php echo $name;?>_row"
1544
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1543
+            <div id="<?php echo $name; ?>_row"
1544
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1545 1545
                 <label>
1546 1546
                     <?php $site_title = __($site_title, 'geodirectory');
1547 1547
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1548
-                    <?php if ($is_required) echo '<span>*</span>';?>
1548
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1549 1549
                 </label>
1550
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1551
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
1552
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1550
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1551
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
1552
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1553 1553
                 <?php if ($is_required) { ?>
1554 1554
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1555 1555
                 <?php } ?>
@@ -1560,31 +1560,31 @@  discard block
 block discarded – undo
1560 1560
                 $value = '';
1561 1561
             }?>
1562 1562
 
1563
-            <div id="<?php echo $name;?>_row"
1564
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1563
+            <div id="<?php echo $name; ?>_row"
1564
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1565 1565
                 <label>
1566 1566
                     <?php $site_title = __($site_title, 'geodirectory');
1567 1567
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1568
-                    <?php if ($is_required) echo '<span>*</span>';?>
1568
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1569 1569
                 </label>
1570
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1571
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
1570
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1571
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
1572 1572
                        oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
1573 1573
                        onchange="try{setCustomValidity('')}catch(e){}"
1574 1574
                 />
1575
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1575
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1576 1576
                 <?php if ($is_required) { ?>
1577 1577
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1578 1578
                 <?php } ?>
1579 1579
             </div>
1580 1580
 
1581 1581
         <?php } elseif ($type == 'radio') { ?>
1582
-            <div id="<?php echo $name;?>_row"
1583
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1582
+            <div id="<?php echo $name; ?>_row"
1583
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1584 1584
                 <label>
1585 1585
                     <?php $site_title = __($site_title, 'geodirectory');
1586 1586
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1587
-                    <?php if ($is_required) echo '<span>*</span>';?>
1587
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1588 1588
                 </label>
1589 1589
                 <?php if ($option_values) {
1590 1590
                     $option_values = geodir_string_values_to_options($option_values, true);
@@ -1593,14 +1593,14 @@  discard block
 block discarded – undo
1593 1593
                         foreach ($option_values as $option_value) {
1594 1594
                             if (empty($option_value['optgroup'])) {
1595 1595
                                 ?>
1596
-                                <span class="gd-radios"><input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?></span>
1596
+                                <span class="gd-radios"><input name="<?php echo $name; ?>" id="<?php echo $name; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type; ?>" type="radio" /><?php echo $option_value['label']; ?></span>
1597 1597
                                 <?php
1598 1598
                             }
1599 1599
                         }
1600 1600
                     }
1601 1601
                 }
1602 1602
                 ?>
1603
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1603
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1604 1604
                 <?php if ($is_required) { ?>
1605 1605
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1606 1606
                 <?php } ?>
@@ -1608,22 +1608,22 @@  discard block
 block discarded – undo
1608 1608
 
1609 1609
         <?php } elseif ($type == 'checkbox') { ?>
1610 1610
 
1611
-            <div id="<?php echo $name;?>_row"
1612
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1611
+            <div id="<?php echo $name; ?>_row"
1612
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1613 1613
                 <label>
1614 1614
                     <?php $site_title = __($site_title, 'geodirectory');
1615 1615
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1616
-                    <?php if ($is_required) echo '<span>*</span>';?>
1616
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1617 1617
                 </label>
1618 1618
                 <?php if ($value != '1') {
1619 1619
                     $value = '0';
1620 1620
                 }?>
1621
-                <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/>
1621
+                <input type="hidden" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>"/>
1622 1622
                 <input  <?php if ($value == '1') {
1623 1623
                     echo 'checked="checked"';
1624
-                }?>  value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"
1625
-                     onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
1626
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1624
+                }?>  value="1" class="gd-checkbox" field_type="<?php echo $type; ?>" type="checkbox"
1625
+                     onchange="if(this.checked){jQuery('#<?php echo $name; ?>').val('1');} else{ jQuery('#<?php echo $name; ?>').val('0');}"/>
1626
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1627 1627
                 <?php if ($is_required) { ?>
1628 1628
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1629 1629
                 <?php } ?>
@@ -1632,44 +1632,44 @@  discard block
 block discarded – undo
1632 1632
         <?php } elseif ($type == 'textarea') {
1633 1633
             ?>
1634 1634
 
1635
-            <div id="<?php echo $name;?>_row"
1636
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1635
+            <div id="<?php echo $name; ?>_row"
1636
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1637 1637
                 <label>
1638 1638
                     <?php $site_title = __($site_title, 'geodirectory');
1639 1639
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1640
-                    <?php if ($is_required) echo '<span>*</span>';?>
1640
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1641 1641
                 </label><?php
1642 1642
 
1643 1643
 
1644 1644
                 if (is_array($extra_fields) && in_array('1', $extra_fields)) {
1645 1645
 
1646
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
1646
+                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
1647 1647
 
1648
-                <div class="editor" field_id="<?php echo $name;?>" field_type="editor">
1648
+                <div class="editor" field_id="<?php echo $name; ?>" field_type="editor">
1649 1649
                     <?php wp_editor(stripslashes($value), $name, $editor_settings); ?>
1650 1650
                     </div><?php
1651 1651
 
1652 1652
                 } else {
1653 1653
 
1654
-                    ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"
1655
-                                id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php
1654
+                    ?><textarea field_type="<?php echo $type; ?>" class="geodir_textarea" name="<?php echo $name; ?>"
1655
+                                id="<?php echo $name; ?>"><?php echo stripslashes($value); ?></textarea><?php
1656 1656
 
1657 1657
                 }?>
1658 1658
 
1659 1659
 
1660
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1660
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1661 1661
                 <?php if ($is_required) { ?>
1662 1662
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1663 1663
                 <?php } ?>
1664 1664
             </div>
1665 1665
 
1666 1666
         <?php } elseif ($type == 'select') { ?>
1667
-            <div id="<?php echo $name;?>_row"
1668
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1667
+            <div id="<?php echo $name; ?>_row"
1668
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class; ?>">
1669 1669
                 <label>
1670 1670
                     <?php $site_title = __($site_title, 'geodirectory');
1671 1671
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1672
-                    <?php if ($is_required) echo '<span>*</span>';?>
1672
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1673 1673
                 </label>
1674 1674
                 <?php
1675 1675
                 $option_values_arr = geodir_string_values_to_options($option_values, true);
@@ -1679,22 +1679,22 @@  discard block
 block discarded – undo
1679 1679
                         if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1680 1680
                             $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1681 1681
 
1682
-                            $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1682
+                            $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
1683 1683
                         } else {
1684 1684
                             $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1685 1685
                             $option_value = isset($option_row['value']) ? $option_row['value'] : '';
1686 1686
                             $selected = $option_value == $value ? 'selected="selected"' : '';
1687 1687
 
1688
-                            $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1688
+                            $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
1689 1689
                         }
1690 1690
                     }
1691 1691
                 }
1692 1692
                 ?>
1693
-                <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1693
+                <select field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1694 1694
                         class="geodir_textfield textfield_x chosen_select"
1695
-                        data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
1696
-                        option-ajaxchosen="false"><?php echo $select_options;?></select>
1697
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1695
+                        data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'&hellip;'; ?>"
1696
+                        option-ajaxchosen="false"><?php echo $select_options; ?></select>
1697
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1698 1698
                 <?php if ($is_required) { ?>
1699 1699
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1700 1700
                 <?php } ?>
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
             }
1709 1709
             ?>
1710 1710
             <div id="<?php echo $name; ?>_row"
1711
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1711
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1712 1712
                 <label>
1713 1713
                     <?php $site_title = __($site_title, 'geodirectory');
1714 1714
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
@@ -1734,9 +1734,9 @@  discard block
 block discarded – undo
1734 1734
                                     $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1735 1735
 
1736 1736
                                     if ($multi_display == 'select') {
1737
-                                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1737
+                                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
1738 1738
                                     } else {
1739
-                                        $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
1739
+                                        $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : '';
1740 1740
                                     }
1741 1741
                                 } else {
1742 1742
                                     $option_label = isset($option_row['label']) ? $option_row['label'] : '';
@@ -1761,9 +1761,9 @@  discard block
 block discarded – undo
1761 1761
                                     }
1762 1762
 
1763 1763
                                     if ($multi_display == 'select') {
1764
-                                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1764
+                                        $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
1765 1765
                                     } else {
1766
-                                        $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
1766
+                                        $select_options .= '<li><input name="'.$name.'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" />&nbsp;'.$option_label.' </li>';
1767 1767
                                     }
1768 1768
                                 }
1769 1769
                             }
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
             ?>
1783 1783
 
1784 1784
             <div id="<?php echo $name; ?>_row"
1785
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1785
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1786 1786
                 <label>
1787 1787
                     <?php $site_title = __($site_title, 'geodirectory');
1788 1788
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
@@ -1807,23 +1807,23 @@  discard block
 block discarded – undo
1807 1807
                 $extra_fields['date_format'] = 'yy-mm-dd';
1808 1808
 
1809 1809
             $date_format = $extra_fields['date_format'];
1810
-            $jquery_date_format  = $date_format;
1810
+            $jquery_date_format = $date_format;
1811 1811
 
1812 1812
 
1813 1813
             // check if we need to change the format or not
1814 1814
             $date_format_len = strlen(str_replace(' ', '', $date_format));
1815
-            if($date_format_len>5){// if greater then 5 then it's the old style format.
1815
+            if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
1816 1816
 
1817
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
1818
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
1817
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
1818
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
1819 1819
 
1820 1820
                 $date_format = str_replace($search, $replace, $date_format);
1821
-            }else{
1822
-                $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
1821
+            } else {
1822
+                $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format);
1823 1823
             }
1824 1824
 
1825
-            if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
1826
-            if($value && !isset($_REQUEST['backandedit'])) {
1825
+            if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
1826
+            if ($value && !isset($_REQUEST['backandedit'])) {
1827 1827
                 $time = strtotime($value);
1828 1828
                 $value = date_i18n($date_format, $time);
1829 1829
             }
@@ -1833,37 +1833,37 @@  discard block
 block discarded – undo
1833 1833
 
1834 1834
                 jQuery(function () {
1835 1835
 
1836
-                    jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
1836
+                    jQuery("#<?php echo $name; ?>").datepicker({changeMonth: true, changeYear: true <?php
1837 1837
                         /**
1838 1838
                          * Used to add extra option to datepicker per custom field.
1839 1839
                          *
1840 1840
                          * @since 1.5.7
1841 1841
                          * @param string $name The custom field name.
1842 1842
                          */
1843
-                        echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
1843
+                        echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
1844 1844
 
1845
-                    jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
1845
+                    jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>');
1846 1846
 
1847
-                    <?php if(!empty($value)){?>
1848
-                    jQuery("#<?php echo $name;?>").datepicker("setDate", "<?php echo $value;?>");
1847
+                    <?php if (!empty($value)) {?>
1848
+                    jQuery("#<?php echo $name; ?>").datepicker("setDate", "<?php echo $value; ?>");
1849 1849
                     <?php } ?>
1850 1850
 
1851 1851
                 });
1852 1852
 
1853 1853
             </script>
1854
-            <div id="<?php echo $name;?>_row"
1855
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1854
+            <div id="<?php echo $name; ?>_row"
1855
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1856 1856
                 <label>
1857 1857
 
1858 1858
                     <?php $site_title = __($site_title, 'geodirectory');
1859 1859
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1860
-                    <?php if ($is_required) echo '<span>*</span>';?>
1860
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1861 1861
                 </label>
1862 1862
 
1863
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1864
-                       value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
1863
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1864
+                       value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
1865 1865
 
1866
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1866
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1867 1867
                 <?php if ($is_required) { ?>
1868 1868
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1869 1869
                 <?php } ?>
@@ -1877,25 +1877,25 @@  discard block
 block discarded – undo
1877 1877
             <script type="text/javascript">
1878 1878
                 jQuery(document).ready(function () {
1879 1879
 
1880
-                    jQuery('#<?php echo $name;?>').timepicker({
1880
+                    jQuery('#<?php echo $name; ?>').timepicker({
1881 1881
                         showPeriod: true,
1882 1882
                         showLeadingZero: true,
1883 1883
                         showPeriod: true,
1884 1884
                     });
1885 1885
                 });
1886 1886
             </script>
1887
-            <div id="<?php echo $name;?>_row"
1888
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1887
+            <div id="<?php echo $name; ?>_row"
1888
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1889 1889
                 <label>
1890 1890
 
1891 1891
                     <?php $site_title = __($site_title, 'geodirectory');
1892 1892
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1893
-                    <?php if ($is_required) echo '<span>*</span>';?>
1893
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1894 1894
                 </label>
1895
-                <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
1896
-                       id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
1895
+                <input readonly="readonly" field_type="<?php echo $type; ?>" name="<?php echo $name; ?>"
1896
+                       id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
1897 1897
 
1898
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1898
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1899 1899
                 <?php if ($is_required) { ?>
1900 1900
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1901 1901
                 <?php } ?>
@@ -1905,15 +1905,15 @@  discard block
 block discarded – undo
1905 1905
             if ($value == $val['default']) {
1906 1906
                 $value = '';
1907 1907
             } ?>
1908
-            <div id="<?php echo $name;?>_row"
1909
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1908
+            <div id="<?php echo $name; ?>_row"
1909
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1910 1910
                 <label>
1911 1911
                     <?php $site_title = __($site_title, 'geodirectory');
1912 1912
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1913
-                    <?php if ($is_required) echo '<span>*</span>';?>
1913
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1914 1914
                 </label>
1915 1915
 
1916
-                <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1916
+                <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1917 1917
                     <?php
1918 1918
                     global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1919 1919
 
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
 
1926 1926
                         $package_info = array();
1927 1927
 
1928
-                        $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1928
+                        $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1929 1929
 
1930 1930
                         if (!empty($package_info)) {
1931 1931
 
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 
1955 1955
                         $catadd_limit = $wpdb->get_var(
1956 1956
                             $wpdb->prepare(
1957
-                                "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1957
+                                "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d",
1958 1958
                                 array($package_id)
1959 1959
                             )
1960 1960
                         );
@@ -1970,13 +1970,13 @@  discard block
 block discarded – undo
1970 1970
                         $required_limit_msg = '';
1971 1971
                         if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1972 1972
 
1973
-                            $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1973
+                            $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
1974 1974
 
1975 1975
                         } else {
1976 1976
                             $required_limit_msg = $required_msg;
1977 1977
                         }
1978 1978
 
1979
-                        echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1979
+                        echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']"  />';
1980 1980
 
1981 1981
 
1982 1982
                         if ($cat_display == 'select' || $cat_display == 'multiselect') {
@@ -1986,11 +1986,11 @@  discard block
 block discarded – undo
1986 1986
                             if ($cat_display == 'multiselect')
1987 1987
                                 $multiple = 'multiple="multiple"';
1988 1988
 
1989
-                            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') . '">';
1989
+                            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').'">';
1990 1990
 
1991 1991
 
1992 1992
                             if ($cat_display == 'select')
1993
-                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1993
+                                echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
1994 1994
 
1995 1995
                         }
1996 1996
 
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
                     ?>
2009 2009
                 </div>
2010 2010
 
2011
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
2011
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
2012 2012
                 <?php if ($is_required) { ?>
2013 2013
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2014 2014
                 <?php } ?>
@@ -2050,8 +2050,8 @@  discard block
 block discarded – undo
2050 2050
                     $file_totImg = count($curImages);
2051 2051
             }
2052 2052
 
2053
-            $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']) : '';
2054
-            $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2053
+            $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']) : '';
2054
+            $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
2055 2055
 
2056 2056
             ?>
2057 2057
             <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -2061,13 +2061,13 @@  discard block
 block discarded – undo
2061 2061
 			</h5>   <?php */
2062 2062
             ?>
2063 2063
 
2064
-            <div id="<?php echo $name;?>_row"
2065
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2064
+            <div id="<?php echo $name; ?>_row"
2065
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
2066 2066
 
2067 2067
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2068 2068
                     <label
2069 2069
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2070
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2070
+                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
2071 2071
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2072 2072
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2073 2073
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
                            id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
2076 2076
                     <?php if ($allowed_file_types != '') { ?>
2077 2077
                         <input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
2078
-                               id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
2078
+                               id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
2079 2079
                     <?php } ?>
2080 2080
                     <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
2081 2081
                            value="<?php if (isset($file_totImg)) {
@@ -2091,10 +2091,10 @@  discard block
 block discarded – undo
2091 2091
                             <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
2092 2092
                             ?>
2093 2093
                             <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
2094
-                                   value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
2094
+                                   value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
2095 2095
                                    class="geodir_button" style="margin-top:10px;"/>
2096 2096
                             <span class="ajaxnonceplu"
2097
-                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
2097
+                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span>
2098 2098
                             <?php if ($file_width && $file_height): ?>
2099 2099
                                 <span class="plupload-resize"></span>
2100 2100
                                 <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span>
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
 
2115 2115
                     </div>
2116 2116
                 </div>
2117
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
2117
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
2118 2118
                 <?php if ($is_required) { ?>
2119 2119
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2120 2120
                 <?php } ?>
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
2134 2134
          * @see 'geodir_before_custom_form_field_$name'
2135 2135
          */
2136
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
2136
+        do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
2137 2137
 
2138 2138
     }
2139 2139
 
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
 
2160 2160
         $filter = $wpdb->get_row(
2161 2161
             $wpdb->prepare(
2162
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
2162
+                "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'",
2163 2163
                 array($geodir_post_type)
2164 2164
             )
2165 2165
         );
@@ -2174,14 +2174,14 @@  discard block
 block discarded – undo
2174 2174
 }
2175 2175
 
2176 2176
 
2177
-function geodir_field_icon_proccess($cf){
2177
+function geodir_field_icon_proccess($cf) {
2178 2178
 
2179 2179
 
2180 2180
     if (strpos($cf['field_icon'], 'http') !== false) {
2181
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2181
+        $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2182 2182
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
2183
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
2184
-    }else{
2183
+        $field_icon = '<i class="'.$cf['field_icon'].'"></i>';
2184
+    } else {
2185 2185
         $field_icon = $cf['field_icon'];
2186 2186
     }
2187 2187
 
@@ -2242,11 +2242,11 @@  discard block
 block discarded – undo
2242 2242
                  * @param string $fields_location The location the field is to be show.
2243 2243
                  * @param array $type The array of field values.
2244 2244
                  */
2245
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2245
+                $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2246 2246
 
2247 2247
                 $variables_array = array();
2248 2248
 
2249
-                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'))) {
2249
+                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'))) {
2250 2250
                     continue;
2251 2251
                 }
2252 2252
 
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 
2373 2373
         $post_type = get_post_type($post_id);
2374 2374
         //echo $field_id; exit;
2375
-        $table = $plugin_prefix . $post_type . '_detail';
2375
+        $table = $plugin_prefix.$post_type.'_detail';
2376 2376
 
2377 2377
         $postcurr_images = array();
2378 2378
         $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
@@ -2391,13 +2391,13 @@  discard block
 block discarded – undo
2391 2391
             $geodir_uploadurl = $uploads['url'];
2392 2392
             $sub_dir = $uploads['subdir'];
2393 2393
 
2394
-            $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'] : '';
2394
+            $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'] : '';
2395 2395
 
2396 2396
             for ($m = 0; $m < count($post_image); $m++) {
2397 2397
 
2398 2398
                 /* --------- start ------- */
2399 2399
 
2400
-                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)))) {
2400
+                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)))) {
2401 2401
 
2402 2402
 
2403 2403
                     $curr_img_url = $post_image[$m];
@@ -2423,24 +2423,24 @@  discard block
 block discarded – undo
2423 2423
                     //$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');
2424 2424
 
2425 2425
                     if (!function_exists('wp_handle_upload'))
2426
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
2426
+                        require_once(ABSPATH.'wp-admin/includes/file.php');
2427 2427
 
2428 2428
                     if (!is_dir($geodir_uploadpath))
2429 2429
                         mkdir($geodir_uploadpath);
2430 2430
 
2431
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
2431
+                    $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1];
2432 2432
                     $explode_sub_dir = explode("/", $sub_dir);
2433 2433
                     if ($curr_img_dir == end($explode_sub_dir)) {
2434
-                        $img_path = $geodir_uploadpath . '/' . $filename;
2435
-                        $img_url = $geodir_uploadurl . '/' . $filename;
2434
+                        $img_path = $geodir_uploadpath.'/'.$filename;
2435
+                        $img_url = $geodir_uploadurl.'/'.$filename;
2436 2436
                     } else {
2437
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
2438
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
2437
+                        $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
2438
+                        $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
2439 2439
                     }
2440 2440
 
2441 2441
                     $uploaded_file = '';
2442 2442
                     if (file_exists($img_path))
2443
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
2443
+                        $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
2444 2444
 
2445 2445
                     if ($curr_img_dir != $geodir_uploaddir) {
2446 2446
                         if (file_exists($img_path))
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
                     }
2449 2449
 
2450 2450
                     if (!empty($uploaded_file))
2451
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
2451
+                        $file_urls = $geodir_uploadurl.'/'.$new_name;
2452 2452
 
2453 2453
                 } else {
2454 2454
                     $file_urls = $post_image[$m];
@@ -2462,8 +2462,8 @@  discard block
 block discarded – undo
2462 2462
         if (!empty($postcurr_images)) {
2463 2463
 
2464 2464
             if ($file_urls != $postcurr_images) {
2465
-                $invalid_files[] = (object)array('src' => $postcurr_images);
2466
-                $invalid_files = (object)$invalid_files;
2465
+                $invalid_files[] = (object) array('src' => $postcurr_images);
2466
+                $invalid_files = (object) $invalid_files;
2467 2467
             }
2468 2468
         }
2469 2469
 
@@ -2515,9 +2515,9 @@  discard block
 block discarded – undo
2515 2515
     function geodir_upload_dir($upload)
2516 2516
     {
2517 2517
         global $current_user;
2518
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
2519
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
2520
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
2518
+        $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID;
2519
+        $upload['path'] = $upload['basedir'].$upload['subdir'];
2520
+        $upload['url'] = $upload['baseurl'].$upload['subdir'];
2521 2521
         return $upload;
2522 2522
     }
2523 2523
 
@@ -2532,20 +2532,20 @@  discard block
 block discarded – undo
2532 2532
         // check ajax noonce
2533 2533
         $imgid = $_POST["imgid"];
2534 2534
 
2535
-        check_ajax_referer($imgid . 'pluploadan');
2535
+        check_ajax_referer($imgid.'pluploadan');
2536 2536
 
2537 2537
         // handle custom file uploaddir
2538 2538
         add_filter('upload_dir', 'geodir_upload_dir');
2539 2539
 
2540 2540
         // change file orinetation if needed
2541
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
2541
+        $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']);
2542 2542
 
2543 2543
         // handle file upload
2544 2544
         $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
2545 2545
         // remove handle custom file uploaddir
2546 2546
         remove_filter('upload_dir', 'geodir_upload_dir');
2547 2547
 
2548
-        if(!isset($status['url']) && isset($status['error'])){
2548
+        if (!isset($status['url']) && isset($status['error'])) {
2549 2549
             print_r($status);
2550 2550
         }
2551 2551
 
@@ -2575,9 +2575,9 @@  discard block
 block discarded – undo
2575 2575
 
2576 2576
     $post_type = get_post_type($post_id);
2577 2577
 
2578
-    $table = $plugin_prefix . $post_type . '_detail';
2578
+    $table = $plugin_prefix.$post_type.'_detail';
2579 2579
 
2580
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
2580
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
2581 2581
 
2582 2582
     if ($results) {
2583 2583
         return $results[0]->geodir_video;
@@ -2601,9 +2601,9 @@  discard block
 block discarded – undo
2601 2601
 
2602 2602
     $post_type = get_post_type($post_id);
2603 2603
 
2604
-    $table = $plugin_prefix . $post_type . '_detail';
2604
+    $table = $plugin_prefix.$post_type.'_detail';
2605 2605
 
2606
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
2606
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
2607 2607
 
2608 2608
     if ($results) {
2609 2609
         return $results[0]->geodir_special_offers;
@@ -2621,12 +2621,12 @@  discard block
 block discarded – undo
2621 2621
      */
2622 2622
     function geodir_max_upload_size()
2623 2623
     {
2624
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
2624
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
2625 2625
 
2626 2626
         if ($max_filesize > 0 && $max_filesize < 1) {
2627
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
2627
+            $max_filesize = (int) ($max_filesize * 1024).'kb';
2628 2628
         } else {
2629
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
2629
+            $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
2630 2630
         }
2631 2631
         /** Filter documented in geodirectory-functions/general_functions.php **/
2632 2632
         return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
 
2659 2659
             $custom_fields = $wpdb->get_results(
2660 2660
                 $wpdb->prepare(
2661
-                    "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",
2661
+                    "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",
2662 2662
                     array($post_type)
2663 2663
                 ), 'ARRAY_A'
2664 2664
             );
@@ -2775,7 +2775,7 @@  discard block
 block discarded – undo
2775 2775
 
2776 2776
             $post_meta_info = $wpdb->query(
2777 2777
                 $wpdb->prepare(
2778
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2778
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2779 2779
 															sort_order=%d 
2780 2780
 															where id= %d",
2781 2781
                     array($count, $cf)
@@ -2857,14 +2857,14 @@  discard block
 block discarded – undo
2857 2857
 
2858 2858
         $check_html_variable = $wpdb->get_var(
2859 2859
             $wpdb->prepare(
2860
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2860
+                "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ",
2861 2861
                 array($cehhtmlvar_name, $post_type, $field_type)
2862 2862
             )
2863 2863
         );
2864 2864
 
2865 2865
         if ($is_default == 1) {
2866 2866
 
2867
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2867
+            $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
2868 2868
 
2869 2869
         }
2870 2870
 
@@ -2875,7 +2875,7 @@  discard block
 block discarded – undo
2875 2875
 
2876 2876
                 $wpdb->prepare(
2877 2877
 
2878
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2878
+                    "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2879 2879
 				post_type = %s,
2880 2880
 				data_type = %s,
2881 2881
 				field_type = %s,
@@ -2906,7 +2906,7 @@  discard block
 block discarded – undo
2906 2906
 
2907 2907
                 $wpdb->prepare(
2908 2908
 
2909
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2909
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2910 2910
 				post_type = %s,
2911 2911
 				data_type = %s,
2912 2912
 				field_type = %s,
@@ -2932,7 +2932,7 @@  discard block
 block discarded – undo
2932 2932
         }
2933 2933
 
2934 2934
 
2935
-        return (int)$lastid;
2935
+        return (int) $lastid;
2936 2936
 
2937 2937
     }
2938 2938
 }
@@ -2955,7 +2955,7 @@  discard block
 block discarded – undo
2955 2955
         if ($field_id != '') {
2956 2956
             $cf = trim($field_id, '_');
2957 2957
 
2958
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2958
+            $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
2959 2959
 
2960 2960
             return $field_id;
2961 2961
 
@@ -2983,7 +2983,7 @@  discard block
 block discarded – undo
2983 2983
         global $wpdb;
2984 2984
         $cf = $result_str;
2985 2985
         if (!is_object($cf)) {
2986
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2986
+            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
2987 2987
         } else {
2988 2988
             $field_info = $cf;
2989 2989
             $result_str = $cf->id;
@@ -3020,41 +3020,41 @@  discard block
 block discarded – undo
3020 3020
         if ($htmlvar_name == '')
3021 3021
             $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
3022 3022
 
3023
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
3023
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
3024 3024
 
3025 3025
         ?>
3026
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
3027
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
3028
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
3029
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
3026
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
3027
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
3028
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
3029
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
3030 3030
                 <?php
3031 3031
 
3032
-                $nonce = wp_create_nonce('custom_fields_' . $result_str);
3032
+                $nonce = wp_create_nonce('custom_fields_'.$result_str);
3033 3033
                 ?>
3034 3034
 
3035
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
3036
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
3035
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
3036
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
3037 3037
                      class="handlediv close"></div>
3038 3038
 
3039 3039
                 <b style="cursor:pointer;"
3040
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
3040
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
3041 3041
 
3042 3042
             </div>
3043 3043
 
3044
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
3044
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
3045 3045
                  style="display:<?php if ($field_ins_upd == 'submit') {
3046 3046
                      echo 'block;';
3047 3047
                  } else {
3048 3048
                      echo 'none;';
3049 3049
                  } ?>">
3050 3050
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
3051
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
3052
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
3053
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
3051
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
3052
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
3053
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
3054 3054
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
3055 3055
                     echo $field_info->data_type;
3056 3056
                 }?>"/>
3057
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
3057
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
3058 3058
 
3059 3059
 
3060 3060
                 <table class="widefat post fixed" border="0" style="width:100%;">
@@ -3078,7 +3078,7 @@  discard block
 block discarded – undo
3078 3078
                                        } ?>" style="width:45%;"/>
3079 3079
 
3080 3080
                                 <input type="radio" name="is_default"
3081
-                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
3081
+                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
3082 3082
                                     echo 'checked="checked"';
3083 3083
                                 } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3084 3084
 
@@ -3101,7 +3101,7 @@  discard block
 block discarded – undo
3101 3101
                                            echo esc_attr($field_info->desc_title);
3102 3102
                                        } ?>" style="width:45%;"/>
3103 3103
                                 <input type="radio" name="is_default"
3104
-                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
3104
+                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
3105 3105
                                     echo 'checked="checked"';
3106 3106
                                 } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3107 3107
                                 <br/>
@@ -3136,42 +3136,42 @@  discard block
 block discarded – undo
3136 3136
                     <?php } ?>
3137 3137
 
3138 3138
                     <tr>
3139
-                        <td><strong><?php _e('Is active :', 'geodirectory');?></strong></td>
3139
+                        <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
3140 3140
                         <td align="left">
3141 3141
                             <select name="is_active" id="is_active">
3142 3142
                                 <option
3143 3143
                                     value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
3144 3144
                                     echo 'selected="selected"';
3145
-                                }?>><?php _e('Yes', 'geodirectory');?></option>
3145
+                                }?>><?php _e('Yes', 'geodirectory'); ?></option>
3146 3146
                                 <option
3147 3147
                                     value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
3148 3148
                                     echo 'selected="selected"';
3149
-                                }?>><?php _e('No', 'geodirectory');?></option>
3149
+                                }?>><?php _e('No', 'geodirectory'); ?></option>
3150 3150
                             </select>
3151 3151
                             <br/>
3152
-                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
3152
+                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory'); ?></span>
3153 3153
                         </td>
3154 3154
                     </tr>
3155 3155
 
3156 3156
                     <tr>
3157
-                        <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
3157
+                        <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
3158 3158
                         <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
3159 3159
                                                 value="<?php if (isset($field_info->sort_order)) {
3160 3160
                                                     echo esc_attr($field_info->sort_order);
3161 3161
                                                 }?>" size="50"/>
3162 3162
                             <br/>
3163
-                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
3163
+                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
3164 3164
                         </td>
3165 3165
                     </tr>
3166 3166
 
3167 3167
                     <tr>
3168 3168
                         <td>&nbsp;</td>
3169 3169
                         <td align="left">
3170
-                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory');?>"
3171
-                                   onclick="save_sort_field('<?php echo $result_str;?>')"/>
3170
+                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory'); ?>"
3171
+                                   onclick="save_sort_field('<?php echo $result_str; ?>')"/>
3172 3172
 
3173
-                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory');?>"
3174
-                                                                onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
3173
+                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory'); ?>"
3174
+                                                                onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
3175 3175
                                                                 class="button_n"/></a>
3176 3176
 
3177 3177
                         </td>
@@ -3206,7 +3206,7 @@  discard block
 block discarded – undo
3206 3206
         if (!$package_id || !$field_name || !$post_type) {
3207 3207
             return true;
3208 3208
         }
3209
-        $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));
3209
+        $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));
3210 3210
 
3211 3211
         if ($wpdb->get_var($sql)) {
3212 3212
             return true;
Please login to merge, or discard this patch.
Braces   +303 added lines, -140 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{
@@ -240,10 +242,12 @@  discard block
 block discarded – undo
240 242
                 }
241 243
 
242 244
                 return $field_id;
243
-            } else
244
-                return 0;
245
-        } else
246
-            return 0;
245
+            } else {
246
+                            return 0;
247
+            }
248
+        } else {
249
+                    return 0;
250
+        }
247 251
     }
248 252
 }
249 253
 
@@ -350,7 +354,9 @@  discard block
 block discarded – undo
350 354
 
351 355
 
352 356
 
353
-            if ($post_type == '') $post_type = 'gd_place';
357
+            if ($post_type == '') {
358
+            	$post_type = 'gd_place';
359
+            }
354 360
 
355 361
 
356 362
             $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
 
@@ -821,8 +838,9 @@  discard block
 block discarded – undo
821 838
                 );
822 839
 
823 840
 
824
-                if ($cat_sort == '')
825
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
841
+                if ($cat_sort == '') {
842
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
843
+                }
826 844
 
827 845
 
828 846
                 /**
@@ -1191,8 +1209,10 @@  discard block
 block discarded – undo
1191 1209
         }
1192 1210
 
1193 1211
         return $post_meta_info;
1194
-    else:
1195
-        return false;
1212
+    else {
1213
+    	:
1214
+        return false;
1215
+    }
1196 1216
     endif;
1197 1217
 }
1198 1218
 
@@ -1245,8 +1265,9 @@  discard block
 block discarded – undo
1245 1265
         if (is_admin()) {
1246 1266
             global $post;
1247 1267
 
1248
-            if (isset($_REQUEST['post']))
1249
-                $_REQUEST['pid'] = $_REQUEST['post'];
1268
+            if (isset($_REQUEST['post'])) {
1269
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1270
+            }
1250 1271
         }
1251 1272
 
1252 1273
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1278,7 +1299,10 @@  discard block
 block discarded – undo
1278 1299
             $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1279 1300
             ?>
1280 1301
             <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1281
-                <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1302
+                <?php if ($admin_desc != '') {
1303
+	echo '<small>( ' . $admin_desc . ' )</small>';
1304
+}
1305
+?></h5>
1282 1306
             <?php
1283 1307
         } else if ($type == 'address') {
1284 1308
             $prefix = $name . '_';
@@ -1315,17 +1339,27 @@  discard block
 block discarded – undo
1315 1339
             }
1316 1340
 
1317 1341
             $location = geodir_get_default_location();
1318
-            if (empty($city)) $city = isset($location->city) ? $location->city : '';
1319
-            if (empty($region)) $region = isset($location->region) ? $location->region : '';
1320
-            if (empty($country)) $country = isset($location->country) ? $location->country : '';
1342
+            if (empty($city)) {
1343
+            	$city = isset($location->city) ? $location->city : '';
1344
+            }
1345
+            if (empty($region)) {
1346
+            	$region = isset($location->region) ? $location->region : '';
1347
+            }
1348
+            if (empty($country)) {
1349
+            	$country = isset($location->country) ? $location->country : '';
1350
+            }
1321 1351
 
1322 1352
             $lat_lng_blank = false;
1323 1353
             if (empty($lat) && empty($lng)) {
1324 1354
                 $lat_lng_blank = true;
1325 1355
             }
1326 1356
 
1327
-            if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1328
-            if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1357
+            if (empty($lat)) {
1358
+            	$lat = isset($location->city_latitude) ? $location->city_latitude : '';
1359
+            }
1360
+            if (empty($lng)) {
1361
+            	$lng = isset($location->city_longitude) ? $location->city_longitude : '';
1362
+            }
1329 1363
 
1330 1364
             /**
1331 1365
              * Filter the default latitude.
@@ -1349,10 +1383,16 @@  discard block
 block discarded – undo
1349 1383
             ?>
1350 1384
 
1351 1385
             <div id="geodir_<?php echo $prefix . 'address';?>_row"
1352
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1386
+                 class="<?php if ($is_required) {
1387
+	echo 'required_field';
1388
+}
1389
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1353 1390
                 <label>
1354 1391
                     <?php _e($address_title, 'geodirectory'); ?>
1355
-                    <?php if ($is_required) echo '<span>*</span>';?>
1392
+                    <?php if ($is_required) {
1393
+	echo '<span>*</span>';
1394
+}
1395
+?>
1356 1396
                 </label>
1357 1397
                 <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1358 1398
                        id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
@@ -1413,10 +1453,16 @@  discard block
 block discarded – undo
1413 1453
                 /* show lat lng */
1414 1454
                 $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1415 1455
                 <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1416
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1456
+                     class="<?php if ($is_required) {
1457
+	echo 'required_field';
1458
+}
1459
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1417 1460
                     <label>
1418 1461
                         <?php echo PLACE_ADDRESS_LAT; ?>
1419
-                        <?php if ($is_required) echo '<span>*</span>'; ?>
1462
+                        <?php if ($is_required) {
1463
+	echo '<span>*</span>';
1464
+}
1465
+?>
1420 1466
                     </label>
1421 1467
                     <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1422 1468
                            id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1428,10 +1474,16 @@  discard block
 block discarded – undo
1428 1474
                 </div>
1429 1475
 
1430 1476
                 <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1431
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1477
+                     class="<?php if ($is_required) {
1478
+	echo 'required_field';
1479
+}
1480
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1432 1481
                     <label>
1433 1482
                         <?php echo PLACE_ADDRESS_LNG; ?>
1434
-                        <?php if ($is_required) echo '<span>*</span>'; ?>
1483
+                        <?php if ($is_required) {
1484
+	echo '<span>*</span>';
1485
+}
1486
+?>
1435 1487
                     </label>
1436 1488
                     <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1437 1489
                            id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1486,26 +1538,31 @@  discard block
 block discarded – undo
1486 1538
         <?php } elseif ($type == 'text') {
1487 1539
 
1488 1540
             //number and float validation $validation_pattern
1489
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1490
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1541
+            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';} elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1491 1542
             //print_r($val);
1492 1543
             //validation
1493 1544
             if(isset($val['validation_pattern']) && $val['validation_pattern']){
1494 1545
                 $validation = 'pattern="'.$val['validation_pattern'].'"';
1495
-            }else{$validation='';}
1546
+            } else{$validation='';}
1496 1547
 
1497 1548
             // validation message
1498 1549
             if(isset($val['validation_msg']) && $val['validation_msg']){
1499 1550
                 $validation_msg = 'title="'.$val['validation_msg'].'"';
1500
-            }else{$validation_msg='';}
1551
+            } else{$validation_msg='';}
1501 1552
             ?>
1502 1553
 
1503 1554
             <div id="<?php echo $name;?>_row"
1504
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1555
+                 class="<?php if ($is_required) {
1556
+	echo 'required_field';
1557
+}
1558
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1505 1559
                 <label>
1506 1560
                     <?php $site_title = __($site_title, 'geodirectory');
1507 1561
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1508
-                    <?php if ($is_required) echo '<span>*</span>';?>
1562
+                    <?php if ($is_required) {
1563
+	echo '<span>*</span>';
1564
+}
1565
+?>
1509 1566
                 </label>
1510 1567
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1511 1568
                        value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -1521,11 +1578,17 @@  discard block
 block discarded – undo
1521 1578
             }?>
1522 1579
 
1523 1580
             <div id="<?php echo $name;?>_row"
1524
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1581
+                 class="<?php if ($is_required) {
1582
+	echo 'required_field';
1583
+}
1584
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1525 1585
                 <label>
1526 1586
                     <?php $site_title = __($site_title, 'geodirectory');
1527 1587
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1528
-                    <?php if ($is_required) echo '<span>*</span>';?>
1588
+                    <?php if ($is_required) {
1589
+	echo '<span>*</span>';
1590
+}
1591
+?>
1529 1592
                 </label>
1530 1593
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1531 1594
                        value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -1541,11 +1604,17 @@  discard block
 block discarded – undo
1541 1604
             } ?>
1542 1605
 
1543 1606
             <div id="<?php echo $name;?>_row"
1544
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1607
+                 class="<?php if ($is_required) {
1608
+	echo 'required_field';
1609
+}
1610
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1545 1611
                 <label>
1546 1612
                     <?php $site_title = __($site_title, 'geodirectory');
1547 1613
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1548
-                    <?php if ($is_required) echo '<span>*</span>';?>
1614
+                    <?php if ($is_required) {
1615
+	echo '<span>*</span>';
1616
+}
1617
+?>
1549 1618
                 </label>
1550 1619
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1551 1620
                        value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -1561,11 +1630,17 @@  discard block
 block discarded – undo
1561 1630
             }?>
1562 1631
 
1563 1632
             <div id="<?php echo $name;?>_row"
1564
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1633
+                 class="<?php if ($is_required) {
1634
+	echo 'required_field';
1635
+}
1636
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1565 1637
                 <label>
1566 1638
                     <?php $site_title = __($site_title, 'geodirectory');
1567 1639
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1568
-                    <?php if ($is_required) echo '<span>*</span>';?>
1640
+                    <?php if ($is_required) {
1641
+	echo '<span>*</span>';
1642
+}
1643
+?>
1569 1644
                 </label>
1570 1645
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1571 1646
                        value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -1580,11 +1655,17 @@  discard block
 block discarded – undo
1580 1655
 
1581 1656
         <?php } elseif ($type == 'radio') { ?>
1582 1657
             <div id="<?php echo $name;?>_row"
1583
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1658
+                 class="<?php if ($is_required) {
1659
+	echo 'required_field';
1660
+}
1661
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1584 1662
                 <label>
1585 1663
                     <?php $site_title = __($site_title, 'geodirectory');
1586 1664
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1587
-                    <?php if ($is_required) echo '<span>*</span>';?>
1665
+                    <?php if ($is_required) {
1666
+	echo '<span>*</span>';
1667
+}
1668
+?>
1588 1669
                 </label>
1589 1670
                 <?php if ($option_values) {
1590 1671
                     $option_values = geodir_string_values_to_options($option_values, true);
@@ -1609,11 +1690,17 @@  discard block
 block discarded – undo
1609 1690
         <?php } elseif ($type == 'checkbox') { ?>
1610 1691
 
1611 1692
             <div id="<?php echo $name;?>_row"
1612
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1693
+                 class="<?php if ($is_required) {
1694
+	echo 'required_field';
1695
+}
1696
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1613 1697
                 <label>
1614 1698
                     <?php $site_title = __($site_title, 'geodirectory');
1615 1699
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1616
-                    <?php if ($is_required) echo '<span>*</span>';?>
1700
+                    <?php if ($is_required) {
1701
+	echo '<span>*</span>';
1702
+}
1703
+?>
1617 1704
                 </label>
1618 1705
                 <?php if ($value != '1') {
1619 1706
                     $value = '0';
@@ -1633,11 +1720,17 @@  discard block
 block discarded – undo
1633 1720
             ?>
1634 1721
 
1635 1722
             <div id="<?php echo $name;?>_row"
1636
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1723
+                 class="<?php if ($is_required) {
1724
+	echo 'required_field';
1725
+}
1726
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1637 1727
                 <label>
1638 1728
                     <?php $site_title = __($site_title, 'geodirectory');
1639 1729
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1640
-                    <?php if ($is_required) echo '<span>*</span>';?>
1730
+                    <?php if ($is_required) {
1731
+	echo '<span>*</span>';
1732
+}
1733
+?>
1641 1734
                 </label><?php
1642 1735
 
1643 1736
 
@@ -1665,11 +1758,17 @@  discard block
 block discarded – undo
1665 1758
 
1666 1759
         <?php } elseif ($type == 'select') { ?>
1667 1760
             <div id="<?php echo $name;?>_row"
1668
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1761
+                 class="<?php if ($is_required) {
1762
+	echo 'required_field';
1763
+}
1764
+?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1669 1765
                 <label>
1670 1766
                     <?php $site_title = __($site_title, 'geodirectory');
1671 1767
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1672
-                    <?php if ($is_required) echo '<span>*</span>';?>
1768
+                    <?php if ($is_required) {
1769
+	echo '<span>*</span>';
1770
+}
1771
+?>
1673 1772
                 </label>
1674 1773
                 <?php
1675 1774
                 $option_values_arr = geodir_string_values_to_options($option_values, true);
@@ -1708,11 +1807,17 @@  discard block
 block discarded – undo
1708 1807
             }
1709 1808
             ?>
1710 1809
             <div id="<?php echo $name; ?>_row"
1711
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1810
+                 class="<?php if ($is_required) {
1811
+	echo 'required_field';
1812
+}
1813
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1712 1814
                 <label>
1713 1815
                     <?php $site_title = __($site_title, 'geodirectory');
1714 1816
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1715
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1817
+                    <?php if ($is_required) {
1818
+	echo '<span>*</span>';
1819
+}
1820
+?>
1716 1821
                 </label>
1717 1822
                 <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/>
1718 1823
                 <?php if ($multi_display == 'select') { ?>
@@ -1782,11 +1887,17 @@  discard block
 block discarded – undo
1782 1887
             ?>
1783 1888
 
1784 1889
             <div id="<?php echo $name; ?>_row"
1785
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1890
+                 class="<?php if ($is_required) {
1891
+	echo 'required_field';
1892
+}
1893
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1786 1894
                 <label>
1787 1895
                     <?php $site_title = __($site_title, 'geodirectory');
1788 1896
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1789
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1897
+                    <?php if ($is_required) {
1898
+	echo '<span>*</span>';
1899
+}
1900
+?>
1790 1901
                 </label>
1791 1902
 
1792 1903
                 <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -1803,8 +1914,9 @@  discard block
 block discarded – undo
1803 1914
             </div>
1804 1915
         <?php } elseif ($type == 'datepicker') {
1805 1916
 
1806
-            if ($extra_fields['date_format'] == '')
1807
-                $extra_fields['date_format'] = 'yy-mm-dd';
1917
+            if ($extra_fields['date_format'] == '') {
1918
+                            $extra_fields['date_format'] = 'yy-mm-dd';
1919
+            }
1808 1920
 
1809 1921
             $date_format = $extra_fields['date_format'];
1810 1922
             $jquery_date_format  = $date_format;
@@ -1818,7 +1930,7 @@  discard block
 block discarded – undo
1818 1930
                 $replace = array('d','j','l','m','n','F','Y');//PHP date format
1819 1931
 
1820 1932
                 $date_format = str_replace($search, $replace, $date_format);
1821
-            }else{
1933
+            } else{
1822 1934
                 $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
1823 1935
             }
1824 1936
 
@@ -1852,12 +1964,18 @@  discard block
 block discarded – undo
1852 1964
 
1853 1965
             </script>
1854 1966
             <div id="<?php echo $name;?>_row"
1855
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1967
+                 class="<?php if ($is_required) {
1968
+	echo 'required_field';
1969
+}
1970
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1856 1971
                 <label>
1857 1972
 
1858 1973
                     <?php $site_title = __($site_title, 'geodirectory');
1859 1974
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1860
-                    <?php if ($is_required) echo '<span>*</span>';?>
1975
+                    <?php if ($is_required) {
1976
+	echo '<span>*</span>';
1977
+}
1978
+?>
1861 1979
                 </label>
1862 1980
 
1863 1981
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1871,8 +1989,9 @@  discard block
 block discarded – undo
1871 1989
 
1872 1990
         <?php } elseif ($type == 'time') {
1873 1991
 
1874
-            if ($value != '')
1875
-                $value = date('H:i', strtotime($value));
1992
+            if ($value != '') {
1993
+                            $value = date('H:i', strtotime($value));
1994
+            }
1876 1995
             ?>
1877 1996
             <script type="text/javascript">
1878 1997
                 jQuery(document).ready(function () {
@@ -1885,12 +2004,18 @@  discard block
 block discarded – undo
1885 2004
                 });
1886 2005
             </script>
1887 2006
             <div id="<?php echo $name;?>_row"
1888
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2007
+                 class="<?php if ($is_required) {
2008
+	echo 'required_field';
2009
+}
2010
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1889 2011
                 <label>
1890 2012
 
1891 2013
                     <?php $site_title = __($site_title, 'geodirectory');
1892 2014
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1893
-                    <?php if ($is_required) echo '<span>*</span>';?>
2015
+                    <?php if ($is_required) {
2016
+	echo '<span>*</span>';
2017
+}
2018
+?>
1894 2019
                 </label>
1895 2020
                 <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
1896 2021
                        id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1906,11 +2031,17 @@  discard block
 block discarded – undo
1906 2031
                 $value = '';
1907 2032
             } ?>
1908 2033
             <div id="<?php echo $name;?>_row"
1909
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2034
+                 class="<?php if ($is_required) {
2035
+	echo 'required_field';
2036
+}
2037
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1910 2038
                 <label>
1911 2039
                     <?php $site_title = __($site_title, 'geodirectory');
1912 2040
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1913
-                    <?php if ($is_required) echo '<span>*</span>';?>
2041
+                    <?php if ($is_required) {
2042
+	echo '<span>*</span>';
2043
+}
2044
+?>
1914 2045
                 </label>
1915 2046
 
1916 2047
                 <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1944,8 +2075,9 @@  discard block
 block discarded – undo
1944 2075
                         $post_cat = implode(",", $post_cat[$name]);
1945 2076
 
1946 2077
                     } else {
1947
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1948
-                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
2078
+                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2079
+                                                    $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
2080
+                        }
1949 2081
                     }
1950 2082
 
1951 2083
 
@@ -1983,21 +2115,24 @@  discard block
 block discarded – undo
1983 2115
 
1984 2116
                             $cat_display == '';
1985 2117
                             $multiple = '';
1986
-                            if ($cat_display == 'multiselect')
1987
-                                $multiple = 'multiple="multiple"';
2118
+                            if ($cat_display == 'multiselect') {
2119
+                                                            $multiple = 'multiple="multiple"';
2120
+                            }
1988 2121
 
1989 2122
                             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') . '">';
1990 2123
 
1991 2124
 
1992
-                            if ($cat_display == 'select')
1993
-                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
2125
+                            if ($cat_display == 'select') {
2126
+                                                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
2127
+                            }
1994 2128
 
1995 2129
                         }
1996 2130
 
1997 2131
                         echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1998 2132
 
1999
-                        if ($cat_display == 'select' || $cat_display == 'multiselect')
2000
-                            echo '</select>';
2133
+                        if ($cat_display == 'select' || $cat_display == 'multiselect') {
2134
+                                                    echo '</select>';
2135
+                        }
2001 2136
 
2002 2137
                     } else {
2003 2138
 
@@ -2027,18 +2162,23 @@  discard block
 block discarded – undo
2027 2162
 
2028 2163
                 $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
2029 2164
 
2030
-            } else
2031
-                $file_value = '';
2165
+            } else {
2166
+                            $file_value = '';
2167
+            }
2032 2168
 
2033
-            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
2034
-                $file_multiple = true; // allow multiple files upload
2035
-            else
2036
-                $file_multiple = false;
2169
+            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
2170
+                            $file_multiple = true;
2171
+            }
2172
+            // allow multiple files upload
2173
+            else {
2174
+                            $file_multiple = false;
2175
+            }
2037 2176
 
2038
-            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
2039
-                $file_image_limit = $extra_fields['image_limit'];
2040
-            else
2041
-                $file_image_limit = 1;
2177
+            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
2178
+                            $file_image_limit = $extra_fields['image_limit'];
2179
+            } else {
2180
+                            $file_image_limit = 1;
2181
+            }
2042 2182
 
2043 2183
             $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2044 2184
 
@@ -2046,8 +2186,9 @@  discard block
 block discarded – undo
2046 2186
 
2047 2187
             if (!empty($file_value)) {
2048 2188
                 $curImages = explode(',', $file_value);
2049
-                if (!empty($curImages))
2050
-                    $file_totImg = count($curImages);
2189
+                if (!empty($curImages)) {
2190
+                                    $file_totImg = count($curImages);
2191
+                }
2051 2192
             }
2052 2193
 
2053 2194
             $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']) : '';
@@ -2062,12 +2203,18 @@  discard block
 block discarded – undo
2062 2203
             ?>
2063 2204
 
2064 2205
             <div id="<?php echo $name;?>_row"
2065
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2206
+                 class="<?php if ($is_required) {
2207
+	echo 'required_field';
2208
+}
2209
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2066 2210
 
2067 2211
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2068 2212
                     <label
2069 2213
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2070
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2214
+                        echo $site_title; ?><?php if ($is_required) {
2215
+                        	echo '<span>*</span>';
2216
+                        }
2217
+                        ?></label>
2071 2218
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2072 2219
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2073 2220
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2181,7 +2328,7 @@  discard block
 block discarded – undo
2181 2328
         $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2182 2329
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
2183 2330
         $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
2184
-    }else{
2331
+    } else{
2185 2332
         $field_icon = $cf['field_icon'];
2186 2333
     }
2187 2334
 
@@ -2254,8 +2401,9 @@  discard block
 block discarded – undo
2254 2401
                     $variables_array['post_id'] = $post->ID;
2255 2402
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
2256 2403
                     $variables_array['value'] = '';
2257
-                    if (isset($post->{$type['htmlvar_name']}))
2258
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2404
+                    if (isset($post->{$type['htmlvar_name']})) {
2405
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
2406
+                    }
2259 2407
                 endif;
2260 2408
 
2261 2409
 
@@ -2278,7 +2426,9 @@  discard block
 block discarded – undo
2278 2426
                      * @param string $html Custom field unfiltered HTML.
2279 2427
                      * @param array $variables_array Custom field variables array.
2280 2428
                      */
2281
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
2429
+                    if ($html) {
2430
+                    	echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
2431
+                    }
2282 2432
 
2283 2433
                     /**
2284 2434
                      * Called after a custom fields is output on the frontend.
@@ -2312,10 +2462,11 @@  discard block
 block discarded – undo
2312 2462
      */
2313 2463
     function geodir_default_date_format()
2314 2464
     {
2315
-        if ($format = get_option('date_format'))
2316
-            return $format;
2317
-        else
2318
-            return 'dd-mm-yy';
2465
+        if ($format = get_option('date_format')) {
2466
+                    return $format;
2467
+        } else {
2468
+                    return 'dd-mm-yy';
2469
+        }
2319 2470
     }
2320 2471
 }
2321 2472
 
@@ -2422,11 +2573,13 @@  discard block
 block discarded – undo
2422 2573
                     // Set an array containing a list of acceptable formats
2423 2574
                     //$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');
2424 2575
 
2425
-                    if (!function_exists('wp_handle_upload'))
2426
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
2576
+                    if (!function_exists('wp_handle_upload')) {
2577
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
2578
+                    }
2427 2579
 
2428
-                    if (!is_dir($geodir_uploadpath))
2429
-                        mkdir($geodir_uploadpath);
2580
+                    if (!is_dir($geodir_uploadpath)) {
2581
+                                            mkdir($geodir_uploadpath);
2582
+                    }
2430 2583
 
2431 2584
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
2432 2585
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -2439,16 +2592,19 @@  discard block
 block discarded – undo
2439 2592
                     }
2440 2593
 
2441 2594
                     $uploaded_file = '';
2442
-                    if (file_exists($img_path))
2443
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
2595
+                    if (file_exists($img_path)) {
2596
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
2597
+                    }
2444 2598
 
2445 2599
                     if ($curr_img_dir != $geodir_uploaddir) {
2446
-                        if (file_exists($img_path))
2447
-                            unlink($img_path);
2600
+                        if (file_exists($img_path)) {
2601
+                                                    unlink($img_path);
2602
+                        }
2448 2603
                     }
2449 2604
 
2450
-                    if (!empty($uploaded_file))
2451
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
2605
+                    if (!empty($uploaded_file)) {
2606
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
2607
+                    }
2452 2608
 
2453 2609
                 } else {
2454 2610
                     $file_urls = $post_image[$m];
@@ -2469,8 +2625,9 @@  discard block
 block discarded – undo
2469 2625
 
2470 2626
         geodir_save_post_meta($post_id, $field_id, $file_urls);
2471 2627
 
2472
-        if (!empty($invalid_files))
2473
-            geodir_remove_attachments($invalid_files);
2628
+        if (!empty($invalid_files)) {
2629
+                    geodir_remove_attachments($invalid_files);
2630
+        }
2474 2631
 
2475 2632
     }
2476 2633
 }
@@ -2696,8 +2853,9 @@  discard block
 block discarded – undo
2696 2853
 
2697 2854
         $all_postypes = geodir_get_posttypes();
2698 2855
 
2699
-        if (!in_array($post_type, $all_postypes))
2700
-            return false;
2856
+        if (!in_array($post_type, $all_postypes)) {
2857
+                    return false;
2858
+        }
2701 2859
 
2702 2860
         $fields = array();
2703 2861
 
@@ -2785,8 +2943,10 @@  discard block
 block discarded – undo
2785 2943
         }
2786 2944
 
2787 2945
         return $field_ids;
2788
-    else:
2789
-        return false;
2946
+    else {
2947
+    	:
2948
+        return false;
2949
+    }
2790 2950
     endif;
2791 2951
 }
2792 2952
 
@@ -2959,8 +3119,9 @@  discard block
 block discarded – undo
2959 3119
 
2960 3120
             return $field_id;
2961 3121
 
2962
-        } else
2963
-            return 0;
3122
+        } else {
3123
+                    return 0;
3124
+        }
2964 3125
 
2965 3126
     }
2966 3127
 }
@@ -3002,8 +3163,9 @@  discard block
 block discarded – undo
3002 3163
         $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
3003 3164
 
3004 3165
         $site_title = '';
3005
-        if ($site_title == '')
3006
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
3166
+        if ($site_title == '') {
3167
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
3168
+        }
3007 3169
 
3008 3170
         if ($site_title == '') {
3009 3171
             $fields = geodir_get_custom_sort_options($post_type);
@@ -3017,8 +3179,9 @@  discard block
 block discarded – undo
3017 3179
             }
3018 3180
         }
3019 3181
 
3020
-        if ($htmlvar_name == '')
3021
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
3182
+        if ($htmlvar_name == '') {
3183
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
3184
+        }
3022 3185
 
3023 3186
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
3024 3187
 
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.
geodirectory_hooks_actions.php 1 patch
Indentation   +1504 added lines, -1504 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,32 +335,32 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
350
-                'geodir_share_this_button',
351
-                'geodir_detail_page_google_analytics',
352
-                'geodir_edit_post_link',
353
-                'geodir_detail_page_review_rating',
354
-                'geodir_detail_page_more_info'
355
-            ) // end of array 
356
-        ); // end of apply filter
357
-    if (!empty($arr_detail_page_sidebar_content)) {
358
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
359
-            if (function_exists($content_function)) {
360
-                add_action('geodir_detail_page_sidebar', $content_function);
361
-            }
362
-        }
363
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
350
+				'geodir_share_this_button',
351
+				'geodir_detail_page_google_analytics',
352
+				'geodir_edit_post_link',
353
+				'geodir_detail_page_review_rating',
354
+				'geodir_detail_page_more_info'
355
+			) // end of array 
356
+		); // end of apply filter
357
+	if (!empty($arr_detail_page_sidebar_content)) {
358
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
359
+			if (function_exists($content_function)) {
360
+				add_action('geodir_detail_page_sidebar', $content_function);
361
+			}
362
+		}
363
+	}
364 364
 }
365 365
 
366 366
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function geodir_add_to_favourite_link()
377 377
 {
378
-    global $post, $preview;
379
-    if (!$preview && geodir_is_page('detail')) {
380
-        ?>
378
+	global $post, $preview;
379
+	if (!$preview && geodir_is_page('detail')) {
380
+		?>
381 381
         <p class="edit_link">
382 382
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
383 383
         </p>
384 384
     <?php
385
-    }
385
+	}
386 386
 }
387 387
 
388 388
 /**
@@ -396,41 +396,41 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function geodir_social_sharing_buttons()
398 398
 {
399
-    global $preview;
400
-    ob_start(); // Start  buffering;
401
-    /**
402
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
-     *
404
-     * @since 1.0.0
405
-     */
406
-    do_action('geodir_before_social_sharing_buttons');
407
-    if (!$preview) {
408
-        ?>
399
+	global $preview;
400
+	ob_start(); // Start  buffering;
401
+	/**
402
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
+	 *
404
+	 * @since 1.0.0
405
+	 */
406
+	do_action('geodir_before_social_sharing_buttons');
407
+	if (!$preview) {
408
+		?>
409 409
         <div class="likethis">
410 410
             <?php geodir_twitter_tweet_button(); ?>
411 411
             <?php geodir_fb_like_button(); ?>
412 412
             <?php geodir_google_plus_button(); ?>
413 413
         </div>
414 414
     <?php
415
-    }// end of if, if its a preview or not
416
-
417
-    /**
418
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
-     *
420
-     * @since 1.0.0
421
-     */
422
-    do_action('geodir_after_social_sharing_buttons');
423
-    $content_html = ob_get_clean();
424
-    if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
-        /**
428
-         * Filter the geodir_social_sharing_buttons() function content.
429
-         *
430
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
-         */
432
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
-    }
415
+	}// end of if, if its a preview or not
416
+
417
+	/**
418
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
+	 *
420
+	 * @since 1.0.0
421
+	 */
422
+	do_action('geodir_after_social_sharing_buttons');
423
+	$content_html = ob_get_clean();
424
+	if (trim($content_html) != '')
425
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
+		/**
428
+		 * Filter the geodir_social_sharing_buttons() function content.
429
+		 *
430
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
+		 */
432
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
+	}
434 434
 
435 435
 
436 436
 }
@@ -446,39 +446,39 @@  discard block
 block discarded – undo
446 446
  */
447 447
 function geodir_share_this_button()
448 448
 {
449
-    global $preview;
450
-    ob_start(); // Start buffering;
451
-    /**
452
-     * This is called before the share this html in the function geodir_share_this_button()
453
-     *
454
-     * @since 1.0.0
455
-     */
456
-    do_action('geodir_before_share_this_button');
457
-    if (!$preview) {
458
-        ?>
449
+	global $preview;
450
+	ob_start(); // Start buffering;
451
+	/**
452
+	 * This is called before the share this html in the function geodir_share_this_button()
453
+	 *
454
+	 * @since 1.0.0
455
+	 */
456
+	do_action('geodir_before_share_this_button');
457
+	if (!$preview) {
458
+		?>
459 459
         <div class="share clearfix">
460 460
             <?php geodir_share_this_button_code(); ?>
461 461
         </div>
462 462
     <?php
463
-    }// end of if, if its a preview or not
464
-    /**
465
-     * This is called after the share this html in the function geodir_share_this_button()
466
-     *
467
-     * @since 1.0.0
468
-     */
469
-    do_action('geodir_after_share_this_button');
470
-    $content_html = ob_get_clean();
471
-    if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
-        /**
475
-         * Filter the geodir_share_this_button() function content.
476
-         *
477
-         * @param string $content_html The output html of the geodir_share_this_button() function.
478
-         * @since 1.0.0
479
-         */
480
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
-    }
463
+	}// end of if, if its a preview or not
464
+	/**
465
+	 * This is called after the share this html in the function geodir_share_this_button()
466
+	 *
467
+	 * @since 1.0.0
468
+	 */
469
+	do_action('geodir_after_share_this_button');
470
+	$content_html = ob_get_clean();
471
+	if (trim($content_html) != '')
472
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
+		/**
475
+		 * Filter the geodir_share_this_button() function content.
476
+		 *
477
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
478
+		 * @since 1.0.0
479
+		 */
480
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
+	}
482 482
 
483 483
 }
484 484
 
@@ -494,46 +494,46 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_edit_post_link()
496 496
 {
497
-    global $post, $preview;
498
-    ob_start(); // Start buffering;
499
-    /**
500
-     * This is called before the edit post link html in the function geodir_edit_post_link()
501
-     *
502
-     * @since 1.0.0
503
-     */
504
-    do_action('geodir_before_edit_post_link');
505
-    if (!$preview) {
506
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
497
+	global $post, $preview;
498
+	ob_start(); // Start buffering;
499
+	/**
500
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
501
+	 *
502
+	 * @since 1.0.0
503
+	 */
504
+	do_action('geodir_before_edit_post_link');
505
+	if (!$preview) {
506
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
507 507
         
508
-        if ($is_current_user_owner) {
509
-            $post_id = $post->ID;
508
+		if ($is_current_user_owner) {
509
+			$post_id = $post->ID;
510 510
             
511
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
513
-            }
511
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
+				$post_id = (int)$_REQUEST['pid'];
513
+			}
514 514
 
515
-            $postlink = get_permalink(geodir_add_listing_page_id());
516
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
-        }
519
-    }// end of if, if its a preview or not
520
-    /**
521
-     * This is called after the edit post link html in the function geodir_edit_post_link()
522
-     *
523
-     * @since 1.0.0
524
-     */
525
-    do_action('geodir_after_edit_post_link');
526
-    $content_html = ob_get_clean();
527
-    if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
-        /**
531
-         * Filter the geodir_edit_post_link() function content.
532
-         *
533
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
534
-         */
535
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
-    }
515
+			$postlink = get_permalink(geodir_add_listing_page_id());
516
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
+		}
519
+	}// end of if, if its a preview or not
520
+	/**
521
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
522
+	 *
523
+	 * @since 1.0.0
524
+	 */
525
+	do_action('geodir_after_edit_post_link');
526
+	$content_html = ob_get_clean();
527
+	if (trim($content_html) != '')
528
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
+		/**
531
+		 * Filter the geodir_edit_post_link() function content.
532
+		 *
533
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
534
+		 */
535
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
+	}
537 537
 }
538 538
 
539 539
 /**
@@ -547,41 +547,41 @@  discard block
 block discarded – undo
547 547
  */
548 548
 function geodir_detail_page_google_analytics()
549 549
 {
550
-    global $post;
551
-    $package_info = array();
552
-    $package_info = geodir_post_package_info($package_info, $post);
550
+	global $post;
551
+	$package_info = array();
552
+	$package_info = geodir_post_package_info($package_info, $post);
553 553
 
554
-    $id = trim(get_option('geodir_ga_id'));
554
+	$id = trim(get_option('geodir_ga_id'));
555 555
 
556
-    if (!$id) {
557
-        return; //if no Google Analytics ID then bail.
558
-    }
556
+	if (!$id) {
557
+		return; //if no Google Analytics ID then bail.
558
+	}
559 559
 
560
-    ob_start(); // Start buffering;
561
-    /**
562
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
-     *
564
-     * @since 1.0.0
565
-     */
566
-    do_action('geodir_before_google_analytics');
560
+	ob_start(); // Start buffering;
561
+	/**
562
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
+	 *
564
+	 * @since 1.0.0
565
+	 */
566
+	do_action('geodir_before_google_analytics');
567 567
     
568
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
569
-    /**
570
-     * Filter the time interval to check & refresh new users results.
571
-     *
572
-     * @since 1.5.9
573
-     *
574
-     * @param int $refresh_time Time interval to check & refresh new users results.
575
-     */
576
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
-    $refresh_time = absint($refresh_time * 1000);
568
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
569
+	/**
570
+	 * Filter the time interval to check & refresh new users results.
571
+	 *
572
+	 * @since 1.5.9
573
+	 *
574
+	 * @param int $refresh_time Time interval to check & refresh new users results.
575
+	 */
576
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
+	$refresh_time = absint($refresh_time * 1000);
578 578
     
579
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
579
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
584
-        ?>
581
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
584
+		?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587 587
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
834 834
 
835 835
                     <?php
836
-                    // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
844
-                    ?>
836
+					// Here we list the shorthand days of the week so it can be used in translation.
837
+					__("Mon",'geodirectory');
838
+					__("Tue",'geodirectory');
839
+					__("Wed",'geodirectory');
840
+					__("Thu",'geodirectory');
841
+					__("Fri",'geodirectory');
842
+					__("Sat",'geodirectory');
843
+					__("Sun",'geodirectory');
844
+					?>
845 845
 
846 846
                     labels = [
847 847
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1090,24 +1090,24 @@  discard block
 block discarded – undo
1090 1090
         </span>
1091 1091
 
1092 1092
     <?php
1093
-    }
1094
-    /**
1095
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
-     *
1097
-     * @since 1.0.0
1098
-     */
1099
-    do_action('geodir_after_google_analytics');
1100
-    $content_html = ob_get_clean();
1101
-    if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
-        /**
1105
-         * Filter the geodir_edit_post_link() function content.
1106
-         *
1107
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
-         */
1109
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
-    }
1093
+	}
1094
+	/**
1095
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
+	 *
1097
+	 * @since 1.0.0
1098
+	 */
1099
+	do_action('geodir_after_google_analytics');
1100
+	$content_html = ob_get_clean();
1101
+	if (trim($content_html) != '')
1102
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
+		/**
1105
+		 * Filter the geodir_edit_post_link() function content.
1106
+		 *
1107
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
+		 */
1109
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
+	}
1111 1111
 }
1112 1112
 
1113 1113
 /**
@@ -1123,90 +1123,90 @@  discard block
 block discarded – undo
1123 1123
  */
1124 1124
 function geodir_detail_page_review_rating()
1125 1125
 {
1126
-    global $post, $preview, $post_images;
1127
-    ob_start(); // Start  buffering;
1128
-    /**
1129
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
-     *
1131
-     * This is called outside the check for an actual rating and the check for preview page.
1132
-     *
1133
-     * @since 1.0.0
1134
-     */
1135
-    do_action('geodir_before_detail_page_review_rating');
1136
-
1137
-    $comment_count = geodir_get_review_count_total($post->ID);
1138
-    $post_avgratings = geodir_get_post_rating($post->ID);
1139
-
1140
-    if ($post_avgratings != 0 && !$preview) {
1141
-        /**
1142
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
-         *
1144
-         * This is called inside the check for an actual rating and the check for preview page.
1145
-         *
1146
-         * @since 1.0.0
1147
-         * @param float $post_avgratings Average rating for the surrent post.
1148
-         * @param int $post->ID Current post ID.
1149
-         */
1150
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
-
1152
-        $html = '<p style=" float:left;">';
1153
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1126
+	global $post, $preview, $post_images;
1127
+	ob_start(); // Start  buffering;
1128
+	/**
1129
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
+	 *
1131
+	 * This is called outside the check for an actual rating and the check for preview page.
1132
+	 *
1133
+	 * @since 1.0.0
1134
+	 */
1135
+	do_action('geodir_before_detail_page_review_rating');
1136
+
1137
+	$comment_count = geodir_get_review_count_total($post->ID);
1138
+	$post_avgratings = geodir_get_post_rating($post->ID);
1139
+
1140
+	if ($post_avgratings != 0 && !$preview) {
1141
+		/**
1142
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
+		 *
1144
+		 * This is called inside the check for an actual rating and the check for preview page.
1145
+		 *
1146
+		 * @since 1.0.0
1147
+		 * @param float $post_avgratings Average rating for the surrent post.
1148
+		 * @param int $post->ID Current post ID.
1149
+		 */
1150
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
+
1152
+		$html = '<p style=" float:left;">';
1153
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159 1159
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1160 1160
 
1161
-        $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1161
+		$html .= '<span class="item">';
1162
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1163 1163
 
1164
-        if ($post_images) {
1165
-            foreach ($post_images as $img) {
1166
-                $post_img = $img->src;
1167
-                break;
1168
-            }
1169
-        }
1170
-
1171
-        if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
-        }
1174
-
1175
-        $html .= '</span>';
1176
-
1177
-        echo $html .= '</div>';
1178
-        /**
1179
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
-         *
1181
-         * This is called inside the check for an actual rating and the check for preview page.
1182
-         *
1183
-         * @since 1.0.0
1184
-         * @param float $post_avgratings Average rating for the surrent post.
1185
-         * @param int $post->ID Current post ID.
1186
-         */
1187
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
-    }
1189
-    /**
1190
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
-     *
1192
-     * This is called outside the check for an actual rating and the check for preview page.
1193
-     *
1194
-     * @since 1.0.0
1195
-     */
1196
-    do_action('geodir_after_detail_page_review_rating');
1197
-    $content_html = ob_get_clean();
1198
-    if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
-    }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
-        /**
1203
-         * Filter the geodir_detail_page_review_rating() function content.
1204
-         *
1205
-         * @since 1.0.0
1206
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
-         */
1208
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
-    }
1164
+		if ($post_images) {
1165
+			foreach ($post_images as $img) {
1166
+				$post_img = $img->src;
1167
+				break;
1168
+			}
1169
+		}
1170
+
1171
+		if (isset($post_img) && $post_img) {
1172
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
+		}
1174
+
1175
+		$html .= '</span>';
1176
+
1177
+		echo $html .= '</div>';
1178
+		/**
1179
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
+		 *
1181
+		 * This is called inside the check for an actual rating and the check for preview page.
1182
+		 *
1183
+		 * @since 1.0.0
1184
+		 * @param float $post_avgratings Average rating for the surrent post.
1185
+		 * @param int $post->ID Current post ID.
1186
+		 */
1187
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
+	}
1189
+	/**
1190
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
+	 *
1192
+	 * This is called outside the check for an actual rating and the check for preview page.
1193
+	 *
1194
+	 * @since 1.0.0
1195
+	 */
1196
+	do_action('geodir_after_detail_page_review_rating');
1197
+	$content_html = ob_get_clean();
1198
+	if (trim($content_html) != '') {
1199
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
+	}
1201
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
+		/**
1203
+		 * Filter the geodir_detail_page_review_rating() function content.
1204
+		 *
1205
+		 * @since 1.0.0
1206
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
+		 */
1208
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
+	}
1210 1210
 }
1211 1211
 
1212 1212
 /**
@@ -1218,35 +1218,35 @@  discard block
 block discarded – undo
1218 1218
  */
1219 1219
 function geodir_detail_page_more_info()
1220 1220
 {
1221
-    ob_start(); // Start  buffering;
1222
-    /**
1223
-     * This is called before the info section html.
1224
-     *
1225
-     * @since 1.0.0
1226
-     */
1227
-    do_action('geodir_before_detail_page_more_info');
1228
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1229
-        echo $geodir_post_detail_fields;
1230
-    }
1231
-    /**
1232
-     * This is called after the info section html.
1233
-     *
1234
-     * @since 1.0.0
1235
-     */
1236
-    do_action('geodir_after_detail_page_more_info');
1237
-
1238
-    $content_html = ob_get_clean();
1239
-    if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
-        /**
1243
-         * Filter the output html for function geodir_detail_page_more_info().
1244
-         *
1245
-         * @since 1.0.0
1246
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
-         */
1248
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
-    }
1221
+	ob_start(); // Start  buffering;
1222
+	/**
1223
+	 * This is called before the info section html.
1224
+	 *
1225
+	 * @since 1.0.0
1226
+	 */
1227
+	do_action('geodir_before_detail_page_more_info');
1228
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1229
+		echo $geodir_post_detail_fields;
1230
+	}
1231
+	/**
1232
+	 * This is called after the info section html.
1233
+	 *
1234
+	 * @since 1.0.0
1235
+	 */
1236
+	do_action('geodir_after_detail_page_more_info');
1237
+
1238
+	$content_html = ob_get_clean();
1239
+	if (trim($content_html) != '')
1240
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
+		/**
1243
+		 * Filter the output html for function geodir_detail_page_more_info().
1244
+		 *
1245
+		 * @since 1.0.0
1246
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
+		 */
1248
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
+	}
1250 1250
 }
1251 1251
 
1252 1252
 
@@ -1260,15 +1260,15 @@  discard block
 block discarded – undo
1260 1260
  */
1261 1261
 function geodir_localize_all_js_msg()
1262 1262
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1263
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
-        $ajax_url = admin_url('admin-ajax.php');
1265
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
-        $ajax_url = admin_url('admin-ajax.php');
1267
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
-    }
1263
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
+		$ajax_url = admin_url('admin-ajax.php');
1265
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
+		$ajax_url = admin_url('admin-ajax.php');
1267
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
+	}
1272 1272
 	
1273 1273
 	/**
1274 1274
 	 * Filter the allowed image type extensions for post images.
@@ -1278,60 +1278,60 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1280 1280
 	
1281
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1282
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
-    $default_marker_width = $default_marker_size['w'];
1284
-    $default_marker_height = $default_marker_size['h'];
1281
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1282
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
+	$default_marker_width = $default_marker_size['w'];
1284
+	$default_marker_height = $default_marker_size['h'];
1285 1285
     
1286
-    $arr_alert_msg = array(
1287
-        'geodir_plugin_url' => geodir_plugin_url(),
1288
-        'geodir_admin_ajax_url' => $ajax_url,
1289
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
-        //start not show alert msg
1294
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
-        // end not show alert msg
1300
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
-        'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1302
-        //start not show alert msg
1303
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1304
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1305
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1306
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1307
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1308
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1309
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1310
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1311
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1312
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1313
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1314
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1315
-        'geodir_default_marker_icon' => $default_marker_icon,
1316
-        'geodir_default_marker_w' => $default_marker_width,
1317
-        'geodir_default_marker_h' => $default_marker_height,
1318
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1319
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1320
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1321
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1322
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1323
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1324
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1325
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1326
-        /* on/off dragging for phone devices */
1327
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1328
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1329
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1330
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1331
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1332
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1333
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1334
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1286
+	$arr_alert_msg = array(
1287
+		'geodir_plugin_url' => geodir_plugin_url(),
1288
+		'geodir_admin_ajax_url' => $ajax_url,
1289
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
+		//start not show alert msg
1294
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
+		// end not show alert msg
1300
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
+		'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1302
+		//start not show alert msg
1303
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1304
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1305
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1306
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1307
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1308
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1309
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1310
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1311
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1312
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1313
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1314
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1315
+		'geodir_default_marker_icon' => $default_marker_icon,
1316
+		'geodir_default_marker_w' => $default_marker_width,
1317
+		'geodir_default_marker_h' => $default_marker_height,
1318
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1319
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1320
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1321
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1322
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1323
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1324
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1325
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1326
+		/* on/off dragging for phone devices */
1327
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1328
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1329
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1330
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1331
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1332
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1333
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1334
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1335 1335
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1336 1336
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1337 1337
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1339,29 +1339,29 @@  discard block
 block discarded – undo
1339 1339
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1340 1340
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1341 1341
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1342
-        'geodir_map_name' => geodir_map_name(),
1343
-    );
1344
-
1345
-    /**
1346
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1347
-     *
1348
-     * With this filter you can add, remove or change translated JS strings.
1349
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1350
-     *
1351
-     * @since 1.0.0
1352
-     */
1353
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1354
-
1355
-    foreach ($arr_alert_msg as $key => $value) {
1356
-        if (!is_scalar($value))
1357
-            continue;
1358
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1359
-    }
1342
+		'geodir_map_name' => geodir_map_name(),
1343
+	);
1344
+
1345
+	/**
1346
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1347
+	 *
1348
+	 * With this filter you can add, remove or change translated JS strings.
1349
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1350
+	 *
1351
+	 * @since 1.0.0
1352
+	 */
1353
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1354
+
1355
+	foreach ($arr_alert_msg as $key => $value) {
1356
+		if (!is_scalar($value))
1357
+			continue;
1358
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1359
+	}
1360 1360
 
1361
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1362
-    echo '<script>';
1363
-    echo $script;
1364
-    echo '</script>';
1361
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1362
+	echo '<script>';
1363
+	echo $script;
1364
+	echo '</script>';
1365 1365
 }
1366 1366
 
1367 1367
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1377,11 +1377,11 @@  discard block
 block discarded – undo
1377 1377
  */
1378 1378
 function geodir_admin_bar_site_menu($wp_admin_bar)
1379 1379
 {
1380
-    if (get_option("geodir_installed")) {
1381
-        if (current_user_can('manage_options')) {
1382
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1383
-        }
1384
-    }
1380
+	if (get_option("geodir_installed")) {
1381
+		if (current_user_can('manage_options')) {
1382
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1383
+		}
1384
+	}
1385 1385
 }
1386 1386
 
1387 1387
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1407,25 +1407,25 @@  discard block
 block discarded – undo
1407 1407
  */
1408 1408
 function geodir_store_sidebars()
1409 1409
 {
1410
-    global $geodir_sidebars;
1411
-    global $sidebars_widgets;
1412
-
1413
-    if (!is_array($sidebars_widgets))
1414
-        $sidebars_widgets = wp_get_sidebars_widgets();
1415
-    $geodir_old_sidebars = array();
1416
-
1417
-    if (is_array($geodir_sidebars)) {
1418
-        foreach ($geodir_sidebars as $val) {
1419
-            if (is_array($sidebars_widgets)) {
1420
-                if (array_key_exists($val, $sidebars_widgets))
1421
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1422
-                else
1423
-                    $geodir_old_sidebars[$val] = array();
1424
-            }
1425
-        }
1426
-    }
1427
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1428
-    geodir_option_version_backup('geodir_sidebars');
1410
+	global $geodir_sidebars;
1411
+	global $sidebars_widgets;
1412
+
1413
+	if (!is_array($sidebars_widgets))
1414
+		$sidebars_widgets = wp_get_sidebars_widgets();
1415
+	$geodir_old_sidebars = array();
1416
+
1417
+	if (is_array($geodir_sidebars)) {
1418
+		foreach ($geodir_sidebars as $val) {
1419
+			if (is_array($sidebars_widgets)) {
1420
+				if (array_key_exists($val, $sidebars_widgets))
1421
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1422
+				else
1423
+					$geodir_old_sidebars[$val] = array();
1424
+			}
1425
+		}
1426
+	}
1427
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1428
+	geodir_option_version_backup('geodir_sidebars');
1429 1429
 
1430 1430
 }
1431 1431
 
@@ -1439,28 +1439,28 @@  discard block
 block discarded – undo
1439 1439
  */
1440 1440
 function geodir_restore_sidebars()
1441 1441
 {
1442
-    global $sidebars_widgets;
1443
-
1444
-    if (!is_array($sidebars_widgets))
1445
-        $sidebars_widgets = wp_get_sidebars_widgets();
1446
-
1447
-    if (is_array($sidebars_widgets)) {
1448
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1449
-        if (is_array($geodir_old_sidebars)) {
1450
-            foreach ($geodir_old_sidebars as $key => $val) {
1451
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1452
-                {
1453
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1454
-                }
1442
+	global $sidebars_widgets;
1455 1443
 
1444
+	if (!is_array($sidebars_widgets))
1445
+		$sidebars_widgets = wp_get_sidebars_widgets();
1456 1446
 
1457
-            }
1458
-        }
1447
+	if (is_array($sidebars_widgets)) {
1448
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1449
+		if (is_array($geodir_old_sidebars)) {
1450
+			foreach ($geodir_old_sidebars as $key => $val) {
1451
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1452
+				{
1453
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1454
+				}
1459 1455
 
1460
-    }
1461 1456
 
1462
-    update_option('sidebars_widgets', $sidebars_widgets);
1463
-    update_option('geodir_sidebars', '');
1457
+			}
1458
+		}
1459
+
1460
+	}
1461
+
1462
+	update_option('sidebars_widgets', $sidebars_widgets);
1463
+	update_option('geodir_sidebars', '');
1464 1464
 }
1465 1465
 
1466 1466
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1473,9 +1473,9 @@  discard block
 block discarded – undo
1473 1473
  */
1474 1474
 function geodir_after_listing_post_gridview()
1475 1475
 {
1476
-    global $gridview_columns;
1476
+	global $gridview_columns;
1477 1477
 
1478
-    $gridview_columns = '';
1478
+	$gridview_columns = '';
1479 1479
 
1480 1480
 }
1481 1481
 
@@ -1503,11 +1503,11 @@  discard block
 block discarded – undo
1503 1503
  */
1504 1504
 function so_handle_038($url, $original_url, $_context)
1505 1505
 {
1506
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1507
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1508
-    }
1506
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1507
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1508
+	}
1509 1509
 
1510
-    return $url;
1510
+	return $url;
1511 1511
 }
1512 1512
 
1513 1513
 
@@ -1523,34 +1523,34 @@  discard block
 block discarded – undo
1523 1523
 function geodir_after_main_form_fields() {
1524 1524
 	global $gd_session;
1525 1525
 	
1526
-    if (get_option('geodir_accept_term_condition')) {
1527
-        global $post;
1528
-        $term_condition = '';
1529
-        if (isset($_REQUEST['backandedit'])) {
1530
-            $post = (object)$gd_session->get('listing');
1531
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1532
-        }
1533
-
1534
-        ?>
1526
+	if (get_option('geodir_accept_term_condition')) {
1527
+		global $post;
1528
+		$term_condition = '';
1529
+		if (isset($_REQUEST['backandedit'])) {
1530
+			$post = (object)$gd_session->get('listing');
1531
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1532
+		}
1533
+
1534
+		?>
1535 1535
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1536 1536
             <label>&nbsp;</label>
1537 1537
 
1538 1538
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1539 1539
 				<span style="display:block"> 
1540 1540
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1541
-                    echo 'checked="checked"';
1542
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1541
+					echo 'checked="checked"';
1542
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1543 1543
                        class="geodir_textfield" value="1"
1544 1544
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1545 1545
 				</span>
1546 1546
             </div>
1547 1547
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1548
-                    _e($required_msg, 'geodirectory');
1549
-                } ?></span>
1548
+					_e($required_msg, 'geodirectory');
1549
+				} ?></span>
1550 1550
         </div>
1551 1551
     <?php
1552 1552
 
1553
-    }
1553
+	}
1554 1554
 }
1555 1555
 
1556 1556
 
@@ -1575,42 +1575,42 @@  discard block
 block discarded – undo
1575 1575
  */
1576 1576
 function geodir_detail_page_tab_is_display($is_display, $tab)
1577 1577
 {
1578
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1578
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1579 1579
 
1580
-    if ($tab == 'post_profile') {
1581
-        /** This action is documented in geodirectory_template_actions.php */
1582
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1580
+	if ($tab == 'post_profile') {
1581
+		/** This action is documented in geodirectory_template_actions.php */
1582
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1583 1583
         
1584
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1585
-            $is_display = false;
1586
-        }
1587
-    }
1584
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1585
+			$is_display = false;
1586
+		}
1587
+	}
1588 1588
     
1589
-    if ($tab == 'post_info')
1590
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1589
+	if ($tab == 'post_info')
1590
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1591 1591
     
1592
-    if ($tab == 'post_images')
1593
-        $is_display = (!empty($post_images)) ? true : false;
1592
+	if ($tab == 'post_images')
1593
+		$is_display = (!empty($post_images)) ? true : false;
1594 1594
 
1595
-    if ($tab == 'post_video')
1596
-        $is_display = (!empty($video)) ? true : false;
1595
+	if ($tab == 'post_video')
1596
+		$is_display = (!empty($video)) ? true : false;
1597 1597
 
1598
-    if ($tab == 'special_offers')
1599
-        $is_display = (!empty($special_offers)) ? true : false;
1598
+	if ($tab == 'special_offers')
1599
+		$is_display = (!empty($special_offers)) ? true : false;
1600 1600
 
1601
-    if ($tab == 'reviews')
1602
-        $is_display = (geodir_is_page('detail')) ? true : false;
1601
+	if ($tab == 'reviews')
1602
+		$is_display = (geodir_is_page('detail')) ? true : false;
1603 1603
 
1604
-    if ($tab == 'related_listing') {
1605
-       $message = __('No listings found which match your selection.', 'geodirectory');
1604
+	if ($tab == 'related_listing') {
1605
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1606 1606
        
1607
-       /** This action is documented in geodirectory-functions/template_functions.php */
1608
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1607
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1608
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1609 1609
        
1610
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1611
-    }
1610
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1611
+	}
1612 1612
 
1613
-    return $is_display;
1613
+	return $is_display;
1614 1614
 }
1615 1615
 
1616 1616
 
@@ -1626,69 +1626,69 @@  discard block
 block discarded – undo
1626 1626
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1627 1627
  */
1628 1628
 function geodir_changes_in_custom_fields_table() {
1629
-    global $wpdb, $plugin_prefix;
1629
+	global $wpdb, $plugin_prefix;
1630 1630
 	
1631 1631
 	// Remove unused virtual page
1632 1632
 	$listings_page_id = (int)get_option('geodir_listing_page');
1633 1633
 	if ($listings_page_id) {
1634 1634
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1635
-        delete_option('geodir_listing_page');
1635
+		delete_option('geodir_listing_page');
1636 1636
 	}
1637 1637
 
1638
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1639
-        $wpdb->query(
1640
-            $wpdb->prepare(
1641
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1642
-                array('1', '1', 'admin')
1643
-            )
1644
-        );
1638
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1639
+		$wpdb->query(
1640
+			$wpdb->prepare(
1641
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1642
+				array('1', '1', 'admin')
1643
+			)
1644
+		);
1645 1645
 
1646 1646
 
1647
-        /* --- terms meta value set --- */
1647
+		/* --- terms meta value set --- */
1648 1648
 
1649
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1649
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1650 1650
 
1651
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1651
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1652 1652
 
1653
-        if (!empty($options_data)) {
1653
+		if (!empty($options_data)) {
1654 1654
 
1655
-            foreach ($options_data as $optobj) {
1655
+			foreach ($options_data as $optobj) {
1656 1656
 
1657
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1657
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1658 1658
 
1659
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1659
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1660 1660
 
1661
-                if (!empty($taxonomies_data)) {
1661
+				if (!empty($taxonomies_data)) {
1662 1662
 
1663
-                    foreach ($taxonomies_data as $taxobj) {
1663
+					foreach ($taxonomies_data as $taxobj) {
1664 1664
 
1665
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1666
-                        $post_type = $taxObject->object_type[0];
1665
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1666
+						$post_type = $taxObject->object_type[0];
1667 1667
 
1668
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1668
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1669 1669
 
1670
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1670
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1671 1671
 
1672
-                        if ($duplicate_data) {
1672
+						if ($duplicate_data) {
1673 1673
 
1674
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1674
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1675 1675
 
1676
-                        } else {
1676
+						} else {
1677 1677
 
1678
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1678
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1679 1679
 
1680
-                        }
1680
+						}
1681 1681
 
1682
-                    }
1682
+					}
1683 1683
 
1684
-                }
1684
+				}
1685 1685
 
1686
-            }
1687
-        }
1686
+			}
1687
+		}
1688 1688
 
1689
-        update_option('geodir_changes_in_custom_fields_table', '1');
1689
+		update_option('geodir_changes_in_custom_fields_table', '1');
1690 1690
 
1691
-    }
1691
+	}
1692 1692
 
1693 1693
 }
1694 1694
 
@@ -1707,24 +1707,24 @@  discard block
 block discarded – undo
1707 1707
 function geodir_location_slug_check($slug)
1708 1708
 {
1709 1709
 
1710
-    global $wpdb, $table_prefix;
1710
+	global $wpdb, $table_prefix;
1711 1711
 
1712
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1712
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1713 1713
 
1714
-    if ($slug_exists) {
1714
+	if ($slug_exists) {
1715 1715
 
1716
-        $suffix = 1;
1717
-        do {
1718
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1719
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1720
-            $suffix++;
1721
-        } while ($location_slug_check && $suffix < 100);
1716
+		$suffix = 1;
1717
+		do {
1718
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1719
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1720
+			$suffix++;
1721
+		} while ($location_slug_check && $suffix < 100);
1722 1722
 
1723
-        $slug = $alt_location_name;
1723
+		$slug = $alt_location_name;
1724 1724
 
1725
-    }
1725
+	}
1726 1726
 
1727
-    return $slug;
1727
+	return $slug;
1728 1728
 
1729 1729
 }
1730 1730
 
@@ -1749,42 +1749,42 @@  discard block
 block discarded – undo
1749 1749
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1750 1750
 {
1751 1751
 
1752
-    global $wpdb, $plugin_prefix, $table_prefix;
1752
+	global $wpdb, $plugin_prefix, $table_prefix;
1753 1753
 
1754
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1754
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1755 1755
 
1756
-    $slug = $tern_data->slug;
1756
+	$slug = $tern_data->slug;
1757 1757
 
1758
-    /**
1759
-     * Filter if a term slug exists.
1760
-     *
1761
-     * @since 1.0.0
1762
-     * @package GeoDirectory
1763
-     * @param bool $bool Default: false.
1764
-     * @param string $slug The term slug.
1765
-     * @param int $term_id The term ID.
1766
-     */
1767
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1758
+	/**
1759
+	 * Filter if a term slug exists.
1760
+	 *
1761
+	 * @since 1.0.0
1762
+	 * @package GeoDirectory
1763
+	 * @param bool $bool Default: false.
1764
+	 * @param string $slug The term slug.
1765
+	 * @param int $term_id The term ID.
1766
+	 */
1767
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1768 1768
 
1769
-    if ($slug_exists) {
1769
+	if ($slug_exists) {
1770 1770
 
1771
-        $suffix = 1;
1772
-        do {
1773
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1771
+		$suffix = 1;
1772
+		do {
1773
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1774 1774
 
1775
-            /** This action is documented in geodirectory_hooks_actions.php */
1776
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1775
+			/** This action is documented in geodirectory_hooks_actions.php */
1776
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1777 1777
 
1778
-            $suffix++;
1779
-        } while ($term_slug_check && $suffix < 100);
1778
+			$suffix++;
1779
+		} while ($term_slug_check && $suffix < 100);
1780 1780
 
1781
-        $slug = $new_slug;
1781
+		$slug = $new_slug;
1782 1782
 
1783
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1783
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1784 1784
 
1785
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1785
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1786 1786
 
1787
-    }
1787
+	}
1788 1788
 	
1789 1789
 	// Update tag in detail table.
1790 1790
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1825,21 +1825,21 @@  discard block
 block discarded – undo
1825 1825
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1826 1826
 {
1827 1827
 
1828
-    global $wpdb, $table_prefix;
1828
+	global $wpdb, $table_prefix;
1829 1829
 
1830
-    $default_location = geodir_get_default_location();
1830
+	$default_location = geodir_get_default_location();
1831 1831
 
1832
-    $country_slug = $default_location->country_slug;
1833
-    $region_slug = $default_location->region_slug;
1834
-    $city_slug = $default_location->city_slug;
1832
+	$country_slug = $default_location->country_slug;
1833
+	$region_slug = $default_location->region_slug;
1834
+	$city_slug = $default_location->city_slug;
1835 1835
 
1836
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1837
-        return $slug_exists = true;
1836
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1837
+		return $slug_exists = true;
1838 1838
 
1839
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1840
-        return $slug_exists = true;
1839
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1840
+		return $slug_exists = true;
1841 1841
 
1842
-    return $slug_exists;
1842
+	return $slug_exists;
1843 1843
 }
1844 1844
 
1845 1845
 
@@ -1858,75 +1858,75 @@  discard block
 block discarded – undo
1858 1858
  */
1859 1859
 function geodir_custom_page_title($title = '', $sep = '')
1860 1860
 {
1861
-    global $wp;
1862
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1863
-        return $title;
1864
-    }
1861
+	global $wp;
1862
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1863
+		return $title;
1864
+	}
1865 1865
 
1866
-    if ($sep == '') {
1867
-        /**
1868
-         * Filter the page title separator.
1869
-         *
1870
-         * @since 1.0.0
1871
-         * @package GeoDirectory
1872
-         * @param string $sep The separator, default: `|`.
1873
-         */
1874
-        $sep = apply_filters('geodir_page_title_separator', '|');
1875
-    }
1866
+	if ($sep == '') {
1867
+		/**
1868
+		 * Filter the page title separator.
1869
+		 *
1870
+		 * @since 1.0.0
1871
+		 * @package GeoDirectory
1872
+		 * @param string $sep The separator, default: `|`.
1873
+		 */
1874
+		$sep = apply_filters('geodir_page_title_separator', '|');
1875
+	}
1876 1876
 
1877 1877
 
1878
-    $gd_page = '';
1879
-    if(geodir_is_page('home')){
1880
-        $gd_page = 'home';
1881
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1882
-    }
1883
-    elseif(geodir_is_page('detail')){
1884
-        $gd_page = 'detail';
1885
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1886
-    }
1887
-    elseif(geodir_is_page('pt')){
1888
-        $gd_page = 'pt';
1889
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1890
-    }
1891
-    elseif(geodir_is_page('listing')){
1892
-        $gd_page = 'listing';
1893
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1894
-    }
1895
-    elseif(geodir_is_page('location')){
1896
-        $gd_page = 'location';
1897
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1898
-    }
1899
-    elseif(geodir_is_page('search')){
1900
-        $gd_page = 'search';
1901
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1902
-    }
1903
-    elseif(geodir_is_page('add-listing')){
1904
-        $gd_page = 'add-listing';
1905
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1906
-    }
1907
-    elseif(geodir_is_page('author')){
1908
-        $gd_page = 'author';
1909
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1910
-    }
1911
-    elseif(geodir_is_page('login')){
1912
-        $gd_page = 'login';
1913
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1914
-    }
1915
-    elseif(geodir_is_page('listing-success')){
1916
-        $gd_page = 'listing-success';
1917
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1918
-    }
1878
+	$gd_page = '';
1879
+	if(geodir_is_page('home')){
1880
+		$gd_page = 'home';
1881
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1882
+	}
1883
+	elseif(geodir_is_page('detail')){
1884
+		$gd_page = 'detail';
1885
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1886
+	}
1887
+	elseif(geodir_is_page('pt')){
1888
+		$gd_page = 'pt';
1889
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1890
+	}
1891
+	elseif(geodir_is_page('listing')){
1892
+		$gd_page = 'listing';
1893
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1894
+	}
1895
+	elseif(geodir_is_page('location')){
1896
+		$gd_page = 'location';
1897
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1898
+	}
1899
+	elseif(geodir_is_page('search')){
1900
+		$gd_page = 'search';
1901
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1902
+	}
1903
+	elseif(geodir_is_page('add-listing')){
1904
+		$gd_page = 'add-listing';
1905
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1906
+	}
1907
+	elseif(geodir_is_page('author')){
1908
+		$gd_page = 'author';
1909
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1910
+	}
1911
+	elseif(geodir_is_page('login')){
1912
+		$gd_page = 'login';
1913
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1914
+	}
1915
+	elseif(geodir_is_page('listing-success')){
1916
+		$gd_page = 'listing-success';
1917
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1918
+	}
1919 1919
 
1920 1920
 
1921
-    /**
1922
-     * Filter page meta title to replace variables.
1923
-     *
1924
-     * @since 1.5.4
1925
-     * @param string $title The page title including variables.
1926
-     * @param string $gd_page The GeoDirectory page type if any.
1927
-     * @param string $sep The title separator symbol.
1928
-     */
1929
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1921
+	/**
1922
+	 * Filter page meta title to replace variables.
1923
+	 *
1924
+	 * @since 1.5.4
1925
+	 * @param string $title The page title including variables.
1926
+	 * @param string $gd_page The GeoDirectory page type if any.
1927
+	 * @param string $sep The title separator symbol.
1928
+	 */
1929
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1930 1930
 
1931 1931
 }
1932 1932
 
@@ -1942,36 +1942,36 @@  discard block
 block discarded – undo
1942 1942
 function geodir_set_post_attachment()
1943 1943
 {
1944 1944
 
1945
-    if (!get_option('geodir_set_post_attachments')) {
1945
+	if (!get_option('geodir_set_post_attachments')) {
1946 1946
 
1947
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1948
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1947
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1948
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1949 1949
 
1950
-        $all_postypes = geodir_get_posttypes();
1950
+		$all_postypes = geodir_get_posttypes();
1951 1951
 
1952
-        foreach($all_postypes as $post_type){
1953
-            $args = array(
1954
-                'posts_per_page' => -1,
1955
-                'post_type' => $post_type,
1956
-                'post_status' => 'publish');
1952
+		foreach($all_postypes as $post_type){
1953
+			$args = array(
1954
+				'posts_per_page' => -1,
1955
+				'post_type' => $post_type,
1956
+				'post_status' => 'publish');
1957 1957
 
1958
-            $posts_array = get_posts($args);
1958
+			$posts_array = get_posts($args);
1959 1959
 
1960
-            if (!empty($posts_array)) {
1960
+			if (!empty($posts_array)) {
1961 1961
 
1962
-                foreach ($posts_array as $post) {
1962
+				foreach ($posts_array as $post) {
1963 1963
 
1964
-                    geodir_set_wp_featured_image($post->ID);
1964
+					geodir_set_wp_featured_image($post->ID);
1965 1965
 
1966
-                }
1966
+				}
1967 1967
 
1968
-            }
1969
-        }
1968
+			}
1969
+		}
1970 1970
 
1971 1971
 
1972
-        update_option('geodir_set_post_attachments', '1');
1972
+		update_option('geodir_set_post_attachments', '1');
1973 1973
 
1974
-    }
1974
+	}
1975 1975
 
1976 1976
 }
1977 1977
 
@@ -1988,19 +1988,19 @@  discard block
 block discarded – undo
1988 1988
 function geodir_remove_url_seperator()
1989 1989
 {
1990 1990
 
1991
-    if (!get_option('geodir_remove_url_seperator')) {
1991
+	if (!get_option('geodir_remove_url_seperator')) {
1992 1992
 
1993
-        if (get_option('geodir_listingurl_separator'))
1994
-            delete_option('geodir_listingurl_separator');
1993
+		if (get_option('geodir_listingurl_separator'))
1994
+			delete_option('geodir_listingurl_separator');
1995 1995
 
1996
-        if (get_option('geodir_detailurl_separator'))
1997
-            delete_option('geodir_detailurl_separator');
1996
+		if (get_option('geodir_detailurl_separator'))
1997
+			delete_option('geodir_detailurl_separator');
1998 1998
 
1999
-        flush_rewrite_rules(false);
1999
+		flush_rewrite_rules(false);
2000 2000
 
2001
-        update_option('geodir_remove_url_seperator', '1');
2001
+		update_option('geodir_remove_url_seperator', '1');
2002 2002
 
2003
-    }
2003
+	}
2004 2004
 
2005 2005
 }
2006 2006
 
@@ -2016,19 +2016,19 @@  discard block
 block discarded – undo
2016 2016
  */
2017 2017
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2018 2018
 {
2019
-    foreach ($permalink_arr as $key => $value) {
2019
+	foreach ($permalink_arr as $key => $value) {
2020 2020
 
2021
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2022
-            unset($permalink_arr[$key]);
2021
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2022
+			unset($permalink_arr[$key]);
2023 2023
 
2024
-    }
2024
+	}
2025 2025
 
2026
-    return $permalink_arr;
2026
+	return $permalink_arr;
2027 2027
 
2028 2028
 }
2029 2029
 
2030 2030
 if (!is_admin()) {
2031
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2031
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2032 2032
 }
2033 2033
 /**
2034 2034
  * Set status from draft to publish.
@@ -2041,16 +2041,16 @@  discard block
 block discarded – undo
2041 2041
  */
2042 2042
 function geodir_set_status_draft_to_publish_for_own_post($post)
2043 2043
 {
2044
-    $user_id = get_current_user_id();
2044
+	$user_id = get_current_user_id();
2045 2045
 
2046
-    if(!$user_id){return $post;}
2046
+	if(!$user_id){return $post;}
2047 2047
 
2048
-    $gd_post_types = geodir_get_posttypes();
2048
+	$gd_post_types = geodir_get_posttypes();
2049 2049
 
2050
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2051
-        $post[0]->post_status = 'publish';
2052
-    }
2053
-    return $post;
2050
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2051
+		$post[0]->post_status = 'publish';
2052
+	}
2053
+	return $post;
2054 2054
 }
2055 2055
 
2056 2056
 
@@ -2142,33 +2142,33 @@  discard block
 block discarded – undo
2142 2142
  */
2143 2143
 function geodir_detail_page_tab_headings_change($tabs_arr)
2144 2144
 {
2145
-    global $wpdb;
2145
+	global $wpdb;
2146 2146
 
2147
-    $post_type = geodir_get_current_posttype();
2147
+	$post_type = geodir_get_current_posttype();
2148 2148
 
2149
-    $all_postypes = geodir_get_posttypes();
2149
+	$all_postypes = geodir_get_posttypes();
2150 2150
 
2151
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2151
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2152 2152
 
2153
-        if (array_key_exists('post_video', $tabs_arr)) {
2153
+		if (array_key_exists('post_video', $tabs_arr)) {
2154 2154
 
2155
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2155
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2156 2156
 
2157
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2158
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2159
-        }
2157
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2158
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2159
+		}
2160 2160
 
2161
-        if (array_key_exists('special_offers', $tabs_arr)) {
2161
+		if (array_key_exists('special_offers', $tabs_arr)) {
2162 2162
 
2163
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2163
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2164 2164
 
2165
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2166
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2167
-        }
2165
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2166
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2167
+		}
2168 2168
 
2169
-    }
2169
+	}
2170 2170
 
2171
-    return $tabs_arr;
2171
+	return $tabs_arr;
2172 2172
 
2173 2173
 }
2174 2174
 
@@ -2181,10 +2181,10 @@  discard block
 block discarded – undo
2181 2181
  */
2182 2182
 function geodir_remove_template_redirect_actions()
2183 2183
 {
2184
-    if (geodir_is_page('login')){
2185
-        remove_all_actions('template_redirect');
2186
-        remove_action('init', 'avia_modify_front', 10);
2187
-    }
2184
+	if (geodir_is_page('login')){
2185
+		remove_all_actions('template_redirect');
2186
+		remove_action('init', 'avia_modify_front', 10);
2187
+	}
2188 2188
 }
2189 2189
 
2190 2190
 
@@ -2206,51 +2206,51 @@  discard block
 block discarded – undo
2206 2206
 function geodirectory_before_featured_image_delete($attachment_id)
2207 2207
 {
2208 2208
 
2209
-    global $wpdb, $plugin_prefix;
2209
+	global $wpdb, $plugin_prefix;
2210 2210
 
2211
-    $post_id = get_post_field('post_parent', $attachment_id);
2211
+	$post_id = get_post_field('post_parent', $attachment_id);
2212 2212
 
2213
-    $attachment_url = wp_get_attachment_url($attachment_id);
2213
+	$attachment_url = wp_get_attachment_url($attachment_id);
2214 2214
 
2215
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2215
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2216 2216
 
2217
-        $post_type = get_post_type($post_id);
2217
+		$post_type = get_post_type($post_id);
2218 2218
 
2219
-        $all_postypes = geodir_get_posttypes();
2219
+		$all_postypes = geodir_get_posttypes();
2220 2220
 
2221
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2222
-            return false;
2221
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2222
+			return false;
2223 2223
 
2224
-        $uploads = wp_upload_dir();
2224
+		$uploads = wp_upload_dir();
2225 2225
 
2226
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2226
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2227 2227
 
2228
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2228
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2229 2229
 
2230
-        $wpdb->query(
2231
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2232
-                array($post_id, $split_img_file_path)
2233
-            )
2234
-        );
2230
+		$wpdb->query(
2231
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2232
+				array($post_id, $split_img_file_path)
2233
+			)
2234
+		);
2235 2235
 
2236
-        $attachment_data = $wpdb->get_row(
2237
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2238
-                array($post_id)
2239
-            )
2240
-        );
2236
+		$attachment_data = $wpdb->get_row(
2237
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2238
+				array($post_id)
2239
+			)
2240
+		);
2241 2241
 
2242
-        if (!empty($attachment_data)) {
2243
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2244
-        }
2242
+		if (!empty($attachment_data)) {
2243
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2244
+		}
2245 2245
 
2246 2246
 
2247
-        $table_name = $plugin_prefix . $post_type . '_detail';
2247
+		$table_name = $plugin_prefix . $post_type . '_detail';
2248 2248
 
2249
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2249
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2250 2250
 
2251
-        geodir_set_wp_featured_image($post_id);
2251
+		geodir_set_wp_featured_image($post_id);
2252 2252
 
2253
-    }
2253
+	}
2254 2254
 
2255 2255
 }
2256 2256
 
@@ -2268,79 +2268,79 @@  discard block
 block discarded – undo
2268 2268
 function geodir_temp_set_post_attachment()
2269 2269
 {
2270 2270
 
2271
-    global $wpdb, $plugin_prefix;
2271
+	global $wpdb, $plugin_prefix;
2272 2272
 
2273
-    $all_postypes = geodir_get_posttypes();
2273
+	$all_postypes = geodir_get_posttypes();
2274 2274
 
2275
-    foreach ($all_postypes as $posttype) {
2275
+	foreach ($all_postypes as $posttype) {
2276 2276
 
2277
-        $tablename = $plugin_prefix . $posttype . '_detail';
2277
+		$tablename = $plugin_prefix . $posttype . '_detail';
2278 2278
 
2279
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2279
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2280 2280
 
2281
-        if (!empty($get_post_data)) {
2281
+		if (!empty($get_post_data)) {
2282 2282
 
2283
-            foreach ($get_post_data as $data) {
2283
+			foreach ($get_post_data as $data) {
2284 2284
 
2285
-                $post_id = $data->post_id;
2285
+				$post_id = $data->post_id;
2286 2286
 
2287
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2287
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2288 2288
 
2289
-                if (!empty($attachment_data)) {
2289
+				if (!empty($attachment_data)) {
2290 2290
 
2291
-                    foreach ($attachment_data as $attach) {
2291
+					foreach ($attachment_data as $attach) {
2292 2292
 
2293
-                        $file_info = pathinfo($attach->file);
2293
+						$file_info = pathinfo($attach->file);
2294 2294
 
2295
-                        $sub_dir = '';
2296
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2297
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2295
+						$sub_dir = '';
2296
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2297
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2298 2298
 
2299
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2300
-                        $uploads_path = $uploads['basedir'];
2299
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2300
+						$uploads_path = $uploads['basedir'];
2301 2301
 
2302
-                        $file_name = $file_info['basename'];
2302
+						$file_name = $file_info['basename'];
2303 2303
 
2304
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2304
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2305 2305
 
2306
-                        if (!file_exists($img_arr['path'])) {
2306
+						if (!file_exists($img_arr['path'])) {
2307 2307
 
2308
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2308
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2309 2309
 
2310
-                        }
2310
+						}
2311 2311
 
2312
-                    }
2312
+					}
2313 2313
 
2314
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2314
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2315 2315
 
2316
-                    if (!empty($attachment_data)) {
2316
+					if (!empty($attachment_data)) {
2317 2317
 
2318
-                        if ($attachment_data->ID)
2319
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2318
+						if ($attachment_data->ID)
2319
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2320 2320
 
2321
-                    } else {
2321
+					} else {
2322 2322
 
2323
-                        if (has_post_thumbnail($post_id)) {
2323
+						if (has_post_thumbnail($post_id)) {
2324 2324
 
2325
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2325
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2326 2326
 
2327
-                            wp_delete_attachment($post_thumbnail_id);
2327
+							wp_delete_attachment($post_thumbnail_id);
2328 2328
 
2329
-                        }
2329
+						}
2330 2330
 
2331
-                    }
2331
+					}
2332 2332
 
2333
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2333
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2334 2334
 
2335
-                    geodir_set_wp_featured_image($post_id);
2335
+					geodir_set_wp_featured_image($post_id);
2336 2336
 
2337
-                }
2337
+				}
2338 2338
 
2339
-            }
2339
+			}
2340 2340
 
2341
-        }
2341
+		}
2342 2342
 
2343
-    }
2343
+	}
2344 2344
 
2345 2345
 }
2346 2346
 
@@ -2358,9 +2358,9 @@  discard block
 block discarded – undo
2358 2358
 function geodir_default_rating_star_icon()
2359 2359
 {
2360 2360
 
2361
-    if (!get_option('geodir_default_rating_star_icon')) {
2362
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2363
-    }
2361
+	if (!get_option('geodir_default_rating_star_icon')) {
2362
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2363
+	}
2364 2364
 
2365 2365
 }
2366 2366
 
@@ -2378,27 +2378,27 @@  discard block
 block discarded – undo
2378 2378
  */
2379 2379
 function geodir_user_post_listing_count($user_id=null)
2380 2380
 {
2381
-    global $wpdb, $plugin_prefix, $current_user;
2382
-    if(!$user_id){
2383
-        $user_id = $current_user->ID;
2384
-    }
2381
+	global $wpdb, $plugin_prefix, $current_user;
2382
+	if(!$user_id){
2383
+		$user_id = $current_user->ID;
2384
+	}
2385 2385
 
2386
-    $user_id = $current_user->ID;
2387
-    $all_postypes = geodir_get_posttypes();
2388
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2386
+	$user_id = $current_user->ID;
2387
+	$all_postypes = geodir_get_posttypes();
2388
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2389 2389
 
2390
-    $user_listing = array();
2391
-    if (is_array($all_posts) && !empty($all_posts)) {
2392
-        foreach ($all_posts as $ptype) {
2393
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2390
+	$user_listing = array();
2391
+	if (is_array($all_posts) && !empty($all_posts)) {
2392
+		foreach ($all_posts as $ptype) {
2393
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2394 2394
 
2395
-            if ($total_posts > 0) {
2396
-                $user_listing[$ptype] = $total_posts;
2397
-            }
2398
-        }
2399
-    }
2395
+			if ($total_posts > 0) {
2396
+				$user_listing[$ptype] = $total_posts;
2397
+			}
2398
+		}
2399
+	}
2400 2400
 
2401
-    return $user_listing;
2401
+	return $user_listing;
2402 2402
 }
2403 2403
 
2404 2404
 
@@ -2418,593 +2418,593 @@  discard block
 block discarded – undo
2418 2418
  */
2419 2419
 function geodir_detail_page_custom_field_tab($tabs_arr)
2420 2420
 {
2421
-    global $post;
2422
-
2423
-    $post_type = geodir_get_current_posttype();
2424
-    $all_postypes = geodir_get_posttypes();
2425
-
2426
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2427
-        $package_info = array();
2428
-        $package_info = geodir_post_package_info($package_info, $post);
2429
-        $post_package_id = $package_info->pid;
2430
-        $fields_location = 'detail';
2431
-
2432
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2433
-        if (!empty($custom_fields)) {
2434
-            $parse_custom_fields = array();
2435
-            foreach ($custom_fields as $field) {
2436
-                $field = stripslashes_deep($field); // strip slashes
2421
+	global $post;
2422
+
2423
+	$post_type = geodir_get_current_posttype();
2424
+	$all_postypes = geodir_get_posttypes();
2425
+
2426
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2427
+		$package_info = array();
2428
+		$package_info = geodir_post_package_info($package_info, $post);
2429
+		$post_package_id = $package_info->pid;
2430
+		$fields_location = 'detail';
2431
+
2432
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2433
+		if (!empty($custom_fields)) {
2434
+			$parse_custom_fields = array();
2435
+			foreach ($custom_fields as $field) {
2436
+				$field = stripslashes_deep($field); // strip slashes
2437 2437
                 
2438
-                $type = $field;
2439
-                $field_name = $field['htmlvar_name'];
2440
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2441
-                    $post->{$field_name} = $_REQUEST[$field_name];
2442
-                }
2443
-
2444
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2445
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2446
-                        continue;
2447
-                    }
2448
-
2449
-                    $parse_custom_fields[] = $field;
2450
-                }
2451
-            }
2452
-            $custom_fields = $parse_custom_fields;
2453
-        }
2438
+				$type = $field;
2439
+				$field_name = $field['htmlvar_name'];
2440
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2441
+					$post->{$field_name} = $_REQUEST[$field_name];
2442
+				}
2443
+
2444
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2445
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2446
+						continue;
2447
+					}
2448
+
2449
+					$parse_custom_fields[] = $field;
2450
+				}
2451
+			}
2452
+			$custom_fields = $parse_custom_fields;
2453
+		}
2454 2454
 
2455
-        if (!empty($custom_fields)) {
2456
-            $post = stripslashes_deep($post); // strip slashes
2455
+		if (!empty($custom_fields)) {
2456
+			$post = stripslashes_deep($post); // strip slashes
2457 2457
             
2458
-            $field_set_start = 0;
2459
-            $fieldset_count = 0;
2460
-            $fieldset = '';
2461
-            $total_fields = count($custom_fields);
2462
-            $count_field = 0;
2463
-            $fieldset_arr = array();
2464
-            $i = 0;
2465
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2466
-
2467
-            foreach ($custom_fields as $field) {
2468
-                $count_field++;
2469
-                $field_name = $field['htmlvar_name'];
2470
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2471
-                    $post->{$field_name} = $_REQUEST[$field_name];
2472
-                }
2473
-
2474
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2475
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2476
-                    $site_title = trim($field['site_title']);
2477
-                    $type = $field;
2478
-                    $html = '';
2479
-                    $html_var = $field_name;
2480
-                    $field_icon = '';
2481
-                    $variables_array = array();
2482
-
2483
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2484
-                        continue;
2485
-                    }
2486
-
2487
-                    if ($type['type'] != 'fieldset') {
2488
-                        $i++;
2489
-                        $variables_array['post_id'] = $post->ID;
2490
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2491
-                        $variables_array['value'] = '';
2492
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2493
-                    }
2494
-
2495
-                    if (strpos($type['field_icon'], 'http') !== false) {
2496
-                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2497
-                    } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2498
-                        $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2499
-                    }
2500
-
2501
-                    switch ($type['type']) {
2502
-                        case 'fieldset': {
2503
-                            $i = 0;
2504
-                            $fieldset_count++;
2505
-                            $field_set_start = 1;
2506
-                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2507
-                            $fieldset_arr[$fieldset_count]['label'] = $label;
2508
-                        }
2509
-                            break;
2510
-                        case 'url': {
2511
-                            if (strpos($field_icon, 'http') !== false) {
2512
-                                $field_icon_af = '';
2513
-                            } elseif ($field_icon == '') {
2514
-
2515
-                                if ($type['name'] == 'geodir_facebook') {
2516
-                                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
2517
-                                } elseif ($type['name'] == 'geodir_twitter') {
2518
-                                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
2519
-                                } else {
2520
-                                    $field_icon_af = '<i class="fa fa-link"></i>';
2521
-                                }
2522
-
2523
-                            } else {
2524
-                                $field_icon_af = $field_icon;
2525
-                                $field_icon = '';
2526
-                            }
2458
+			$field_set_start = 0;
2459
+			$fieldset_count = 0;
2460
+			$fieldset = '';
2461
+			$total_fields = count($custom_fields);
2462
+			$count_field = 0;
2463
+			$fieldset_arr = array();
2464
+			$i = 0;
2465
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2466
+
2467
+			foreach ($custom_fields as $field) {
2468
+				$count_field++;
2469
+				$field_name = $field['htmlvar_name'];
2470
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2471
+					$post->{$field_name} = $_REQUEST[$field_name];
2472
+				}
2473
+
2474
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2475
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2476
+					$site_title = trim($field['site_title']);
2477
+					$type = $field;
2478
+					$html = '';
2479
+					$html_var = $field_name;
2480
+					$field_icon = '';
2481
+					$variables_array = array();
2482
+
2483
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2484
+						continue;
2485
+					}
2486
+
2487
+					if ($type['type'] != 'fieldset') {
2488
+						$i++;
2489
+						$variables_array['post_id'] = $post->ID;
2490
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2491
+						$variables_array['value'] = '';
2492
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2493
+					}
2494
+
2495
+					if (strpos($type['field_icon'], 'http') !== false) {
2496
+						$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2497
+					} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2498
+						$field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2499
+					}
2500
+
2501
+					switch ($type['type']) {
2502
+						case 'fieldset': {
2503
+							$i = 0;
2504
+							$fieldset_count++;
2505
+							$field_set_start = 1;
2506
+							$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2507
+							$fieldset_arr[$fieldset_count]['label'] = $label;
2508
+						}
2509
+							break;
2510
+						case 'url': {
2511
+							if (strpos($field_icon, 'http') !== false) {
2512
+								$field_icon_af = '';
2513
+							} elseif ($field_icon == '') {
2514
+
2515
+								if ($type['name'] == 'geodir_facebook') {
2516
+									$field_icon_af = '<i class="fa fa-facebook-square"></i>';
2517
+								} elseif ($type['name'] == 'geodir_twitter') {
2518
+									$field_icon_af = '<i class="fa fa-twitter-square"></i>';
2519
+								} else {
2520
+									$field_icon_af = '<i class="fa fa-link"></i>';
2521
+								}
2522
+
2523
+							} else {
2524
+								$field_icon_af = $field_icon;
2525
+								$field_icon = '';
2526
+							}
2527 2527
                             
2528
-                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2529
-
2530
-                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2531
-                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2532
-                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2533
-
2534
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2535
-
2536
-                            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2537
-                            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2538
-
2539
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2540
-                                /**
2541
-                                 * Filer the custom field website name.
2542
-                                 *
2543
-                                 * @since 1.0.0
2544
-                                 * @param string $title The field name default: "Website".
2545
-                                 * @param string $website The website address.
2546
-                                 * @param int $post->ID The post ID.
2547
-                                 */
2548
-                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2549
-                        }
2550
-                            break;
2551
-                        case 'phone': {
2552
-                            if (strpos($field_icon, 'http') !== false) {
2553
-                                $field_icon_af = '';
2554
-                            } elseif ($field_icon == '') {
2555
-                                $field_icon_af = '<i class="fa fa-phone"></i>';
2556
-                            } else {
2557
-                                $field_icon_af = $field_icon;
2558
-                                $field_icon = '';
2559
-                            }
2560
-
2561
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2562
-
2563
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2564
-                            if ($field_set_start == 1 && $site_title != '') {
2565
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2566
-                            }
2567
-                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2568
-                        }
2569
-                            break;
2570
-                        case 'time': {
2571
-                            $value = '';
2572
-                            if ($post->{$type['htmlvar_name']} != '')
2573
-                                $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2574
-
2575
-                            if (strpos($field_icon, 'http') !== false) {
2576
-                                $field_icon_af = '';
2577
-                            } elseif ($field_icon == '') {
2578
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2579
-                            } else {
2580
-                                $field_icon_af = $field_icon;
2581
-                                $field_icon = '';
2582
-                            }
2583
-
2584
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2585
-
2586
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2587
-                            if ($field_set_start == 1 && $site_title != '') {
2588
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2589
-                            }
2590
-                            $html .= ' </span>' . $value . '</div>';
2591
-                        }
2592
-                            break;
2593
-                        case 'datepicker': {
2594
-                            $date_format = geodir_default_date_format();
2595
-                            if ($type['extra_fields'] != '') {
2596
-                                $date_format = unserialize($type['extra_fields']);
2597
-                                $date_format = $date_format['date_format'];
2598
-                            }
2599
-
2600
-                            // check if we need to change the format or not
2601
-                            $date_format_len = strlen(str_replace(' ', '', $date_format));
2602
-                            if($date_format_len>5){// if greater then 5 then it's the old style format.
2603
-
2604
-                                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2605
-                                $replace = array('d','j','l','m','n','F','Y');//PHP date format
2606
-
2607
-                                $date_format = str_replace($search, $replace, $date_format);
2608
-
2609
-                                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2610
-                            }else{
2611
-                                $post_htmlvar_value = $post->{$type['htmlvar_name']};
2612
-                            }
2613
-
2614
-                            $value = '';
2615
-                            if ($post->{$type['htmlvar_name']} != '')
2616
-                                $value = date_i18n($date_format, strtotime($post_htmlvar_value));
2617
-
2618
-                            if (strpos($field_icon, 'http') !== false) {
2619
-                                $field_icon_af = '';
2620
-                            } elseif ($field_icon == '') {
2621
-                                $field_icon_af = '<i class="fa fa-calendar"></i>';
2622
-                            } else {
2623
-                                $field_icon_af = $field_icon;
2624
-                                $field_icon = '';
2625
-                            }
2626
-
2627
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2628
-
2629
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2630
-                            if ($field_set_start == 1 && $site_title != '') {
2631
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2632
-                            }
2633
-                            $html .= ' </span>' . $value . '</div>';
2634
-                        }
2635
-                            break;
2636
-                        case 'text': {
2637
-                            if (strpos($field_icon, 'http') !== false) {
2638
-                                $field_icon_af = '';
2639
-                            } elseif ($field_icon == '') {
2640
-                                $field_icon_af = '';
2641
-                            } else {
2642
-                                $field_icon_af = $field_icon;
2643
-                                $field_icon = '';
2644
-                            }
2645
-
2646
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2647
-
2648
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2649
-                            if ($field_set_start == 1 && $site_title != '') {
2650
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2651
-                            }
2652
-                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2653
-                        }
2654
-                            break;
2655
-                        case 'radio': {
2656
-
2657
-                            if ($post->{$type['htmlvar_name']} != '') {
2658
-                                if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2659
-                                    $html_val = __('No', 'geodirectory');
2660
-                                } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2661
-                                    $html_val = __('Yes', 'geodirectory');
2662
-                                } else {
2663
-                                    $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2528
+							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2529
+
2530
+							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2531
+							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2532
+							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2533
+
2534
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2535
+
2536
+							// all search engines that use the nofollow value exclude links that use it from their ranking calculation
2537
+							$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2538
+
2539
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2540
+								/**
2541
+								 * Filer the custom field website name.
2542
+								 *
2543
+								 * @since 1.0.0
2544
+								 * @param string $title The field name default: "Website".
2545
+								 * @param string $website The website address.
2546
+								 * @param int $post->ID The post ID.
2547
+								 */
2548
+								apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2549
+						}
2550
+							break;
2551
+						case 'phone': {
2552
+							if (strpos($field_icon, 'http') !== false) {
2553
+								$field_icon_af = '';
2554
+							} elseif ($field_icon == '') {
2555
+								$field_icon_af = '<i class="fa fa-phone"></i>';
2556
+							} else {
2557
+								$field_icon_af = $field_icon;
2558
+								$field_icon = '';
2559
+							}
2560
+
2561
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2562
+
2563
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2564
+							if ($field_set_start == 1 && $site_title != '') {
2565
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2566
+							}
2567
+							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2568
+						}
2569
+							break;
2570
+						case 'time': {
2571
+							$value = '';
2572
+							if ($post->{$type['htmlvar_name']} != '')
2573
+								$value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2574
+
2575
+							if (strpos($field_icon, 'http') !== false) {
2576
+								$field_icon_af = '';
2577
+							} elseif ($field_icon == '') {
2578
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2579
+							} else {
2580
+								$field_icon_af = $field_icon;
2581
+								$field_icon = '';
2582
+							}
2583
+
2584
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2585
+
2586
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2587
+							if ($field_set_start == 1 && $site_title != '') {
2588
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2589
+							}
2590
+							$html .= ' </span>' . $value . '</div>';
2591
+						}
2592
+							break;
2593
+						case 'datepicker': {
2594
+							$date_format = geodir_default_date_format();
2595
+							if ($type['extra_fields'] != '') {
2596
+								$date_format = unserialize($type['extra_fields']);
2597
+								$date_format = $date_format['date_format'];
2598
+							}
2599
+
2600
+							// check if we need to change the format or not
2601
+							$date_format_len = strlen(str_replace(' ', '', $date_format));
2602
+							if($date_format_len>5){// if greater then 5 then it's the old style format.
2603
+
2604
+								$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2605
+								$replace = array('d','j','l','m','n','F','Y');//PHP date format
2606
+
2607
+								$date_format = str_replace($search, $replace, $date_format);
2608
+
2609
+								$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2610
+							}else{
2611
+								$post_htmlvar_value = $post->{$type['htmlvar_name']};
2612
+							}
2613
+
2614
+							$value = '';
2615
+							if ($post->{$type['htmlvar_name']} != '')
2616
+								$value = date_i18n($date_format, strtotime($post_htmlvar_value));
2617
+
2618
+							if (strpos($field_icon, 'http') !== false) {
2619
+								$field_icon_af = '';
2620
+							} elseif ($field_icon == '') {
2621
+								$field_icon_af = '<i class="fa fa-calendar"></i>';
2622
+							} else {
2623
+								$field_icon_af = $field_icon;
2624
+								$field_icon = '';
2625
+							}
2626
+
2627
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2628
+
2629
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2630
+							if ($field_set_start == 1 && $site_title != '') {
2631
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2632
+							}
2633
+							$html .= ' </span>' . $value . '</div>';
2634
+						}
2635
+							break;
2636
+						case 'text': {
2637
+							if (strpos($field_icon, 'http') !== false) {
2638
+								$field_icon_af = '';
2639
+							} elseif ($field_icon == '') {
2640
+								$field_icon_af = '';
2641
+							} else {
2642
+								$field_icon_af = $field_icon;
2643
+								$field_icon = '';
2644
+							}
2645
+
2646
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2647
+
2648
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2649
+							if ($field_set_start == 1 && $site_title != '') {
2650
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2651
+							}
2652
+							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2653
+						}
2654
+							break;
2655
+						case 'radio': {
2656
+
2657
+							if ($post->{$type['htmlvar_name']} != '') {
2658
+								if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2659
+									$html_val = __('No', 'geodirectory');
2660
+								} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2661
+									$html_val = __('Yes', 'geodirectory');
2662
+								} else {
2663
+									$html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2664 2664
                                     
2665
-                                    if (!empty($type['option_values'])) {
2666
-                                        $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2665
+									if (!empty($type['option_values'])) {
2666
+										$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2667 2667
                                         
2668
-                                        if (!empty($cf_option_values)) {
2669
-                                            foreach ($cf_option_values as $cf_option_value) {
2670
-                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2671
-                                                    $html_val = $cf_option_value['label'];
2672
-                                                }
2673
-                                            }
2674
-                                        }
2675
-                                    }
2676
-                                }
2677
-
2678
-                                if (strpos($field_icon, 'http') !== false) {
2679
-                                    $field_icon_af = '';
2680
-                                } else if ($field_icon == '') {
2681
-                                    $field_icon_af = '';
2682
-                                } else {
2683
-                                    $field_icon_af = $field_icon;
2684
-                                    $field_icon = '';
2685
-                                }
2686
-
2687
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2688
-
2689
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2690
-
2691
-                                if ($field_set_start == 1 && $site_title != '') {
2692
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2693
-                                }
2694
-
2695
-                                $html .= ' </span>' . $html_val . '</div>';
2696
-                            }
2697
-                        }
2698
-                            break;
2699
-                        case 'checkbox': {
2700
-                            $html_var = $type['htmlvar_name'];
2701
-                            $html_val = $type['htmlvar_name'];
2702
-
2703
-                            if ((int)$post->{$html_var} == 1) {
2704
-
2705
-                                if ($post->{$type['htmlvar_name']} == '1') {
2706
-                                    $html_val = __('Yes', 'geodirectory');
2707
-                                } else {
2708
-                                    $html_val = __('No', 'geodirectory');
2709
-                                }
2710
-
2711
-                                if (strpos($field_icon, 'http') !== false) {
2712
-                                    $field_icon_af = '';
2713
-                                } else if ($field_icon == '') {
2714
-                                    $field_icon_af = '';
2715
-                                } else {
2716
-                                    $field_icon_af = $field_icon;
2717
-                                    $field_icon = '';
2718
-                                }
2719
-
2720
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2721
-
2722
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2723
-
2724
-                                if ($field_set_start == 1 && $site_title != '') {
2725
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2726
-                                }
2727
-
2728
-                                $html .= ' </span>' . $html_val . '</div>';
2729
-                            }
2730
-                        }
2731
-                            break;
2732
-                        case 'select': {
2733
-                            if (strpos($field_icon, 'http') !== false) {
2734
-                                $field_icon_af = '';
2735
-                            } elseif ($field_icon == '') {
2736
-                                $field_icon_af = '';
2737
-                            } else {
2738
-                                $field_icon_af = $field_icon;
2739
-                                $field_icon = '';
2740
-                            }
2668
+										if (!empty($cf_option_values)) {
2669
+											foreach ($cf_option_values as $cf_option_value) {
2670
+												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2671
+													$html_val = $cf_option_value['label'];
2672
+												}
2673
+											}
2674
+										}
2675
+									}
2676
+								}
2677
+
2678
+								if (strpos($field_icon, 'http') !== false) {
2679
+									$field_icon_af = '';
2680
+								} else if ($field_icon == '') {
2681
+									$field_icon_af = '';
2682
+								} else {
2683
+									$field_icon_af = $field_icon;
2684
+									$field_icon = '';
2685
+								}
2686
+
2687
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2688
+
2689
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2690
+
2691
+								if ($field_set_start == 1 && $site_title != '') {
2692
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2693
+								}
2694
+
2695
+								$html .= ' </span>' . $html_val . '</div>';
2696
+							}
2697
+						}
2698
+							break;
2699
+						case 'checkbox': {
2700
+							$html_var = $type['htmlvar_name'];
2701
+							$html_val = $type['htmlvar_name'];
2702
+
2703
+							if ((int)$post->{$html_var} == 1) {
2704
+
2705
+								if ($post->{$type['htmlvar_name']} == '1') {
2706
+									$html_val = __('Yes', 'geodirectory');
2707
+								} else {
2708
+									$html_val = __('No', 'geodirectory');
2709
+								}
2710
+
2711
+								if (strpos($field_icon, 'http') !== false) {
2712
+									$field_icon_af = '';
2713
+								} else if ($field_icon == '') {
2714
+									$field_icon_af = '';
2715
+								} else {
2716
+									$field_icon_af = $field_icon;
2717
+									$field_icon = '';
2718
+								}
2719
+
2720
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2721
+
2722
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2723
+
2724
+								if ($field_set_start == 1 && $site_title != '') {
2725
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2726
+								}
2727
+
2728
+								$html .= ' </span>' . $html_val . '</div>';
2729
+							}
2730
+						}
2731
+							break;
2732
+						case 'select': {
2733
+							if (strpos($field_icon, 'http') !== false) {
2734
+								$field_icon_af = '';
2735
+							} elseif ($field_icon == '') {
2736
+								$field_icon_af = '';
2737
+							} else {
2738
+								$field_icon_af = $field_icon;
2739
+								$field_icon = '';
2740
+							}
2741 2741
                             
2742
-                            $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2742
+							$field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2743 2743
                             
2744
-                            if (!empty($type['option_values'])) {
2745
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2744
+							if (!empty($type['option_values'])) {
2745
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2746 2746
                                 
2747
-                                if (!empty($cf_option_values)) {
2748
-                                    foreach ($cf_option_values as $cf_option_value) {
2749
-                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2750
-                                            $field_value = $cf_option_value['label'];
2751
-                                        }
2752
-                                    }
2753
-                                }
2754
-                            }
2755
-
2756
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2757
-
2758
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2759
-                            if ($field_set_start == 1 && $site_title != '') {
2760
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2761
-                            }
2762
-                            $html .= ' </span>' . $field_value . '</div>';
2763
-                        }
2764
-                            break;
2765
-                        case 'multiselect': {
2766
-                            if (is_array($post->{$type['htmlvar_name']})) {
2767
-                                $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2768
-                            }
2769
-
2770
-                            if (strpos($field_icon, 'http') !== false) {
2771
-                                $field_icon_af = '';
2772
-                            } elseif ($field_icon == '') {
2773
-                                $field_icon_af = '';
2774
-                            } else {
2775
-                                $field_icon_af = $field_icon;
2776
-                                $field_icon = '';
2777
-                            }
2778
-
2779
-                            $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2780
-
2781
-                            $option_values = array();
2782
-                            if (!empty($type['option_values'])) {
2783
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2747
+								if (!empty($cf_option_values)) {
2748
+									foreach ($cf_option_values as $cf_option_value) {
2749
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2750
+											$field_value = $cf_option_value['label'];
2751
+										}
2752
+									}
2753
+								}
2754
+							}
2755
+
2756
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2757
+
2758
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2759
+							if ($field_set_start == 1 && $site_title != '') {
2760
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2761
+							}
2762
+							$html .= ' </span>' . $field_value . '</div>';
2763
+						}
2764
+							break;
2765
+						case 'multiselect': {
2766
+							if (is_array($post->{$type['htmlvar_name']})) {
2767
+								$post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2768
+							}
2769
+
2770
+							if (strpos($field_icon, 'http') !== false) {
2771
+								$field_icon_af = '';
2772
+							} elseif ($field_icon == '') {
2773
+								$field_icon_af = '';
2774
+							} else {
2775
+								$field_icon_af = $field_icon;
2776
+								$field_icon = '';
2777
+							}
2778
+
2779
+							$field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2780
+
2781
+							$option_values = array();
2782
+							if (!empty($type['option_values'])) {
2783
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2784 2784
                                 
2785
-                                if (!empty($cf_option_values)) {
2786
-                                    foreach ($cf_option_values as $cf_option_value) {
2787
-                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2788
-                                            $option_values[] = $cf_option_value['label'];
2789
-                                        }
2790
-                                    }
2791
-                                }
2792
-                            }
2793
-
2794
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2795
-
2796
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2797
-                            if ($field_set_start == 1 && $site_title != '') {
2798
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2799
-                            }
2800
-                            $html .= ' </span>';
2801
-
2802
-                            $html .= ' <span class="gd-multiselect-value-output gd-val-'.$type['htmlvar_name'].'" >';
2803
-
2804
-                            if (count($option_values) > 1) {
2805
-                                $html .= "<span>".implode('</span>, <span>',$option_values)."</span>";
2806
-                            } else {
2807
-                                $vals = explode(",",$post->{$type['htmlvar_name']});
2808
-                                $html .= "<span>".implode('</span>, <span>', $vals)."</span>";
2809
-                            }
2810
-
2811
-                            $html .= ' </span>';
2812
-
2813
-
2814
-
2815
-
2816
-                            $html .= '</div>';
2817
-                        }
2818
-                            break;
2819
-                        case 'email': {
2820
-                            if (strpos($field_icon, 'http') !== false) {
2821
-                                $field_icon_af = '';
2822
-                            } elseif ($field_icon == '') {
2823
-                                $field_icon_af = '<i class="fa fa-envelope"></i>';
2824
-                            } else {
2825
-                                $field_icon_af = $field_icon;
2826
-                                $field_icon = '';
2827
-                            }
2828
-
2829
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2830
-
2831
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2832
-                            if ($field_set_start == 1 && $site_title != '') {
2833
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2834
-                            }
2835
-                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2836
-                        }
2837
-                            break;
2838
-                        case 'textarea': {
2839
-                            if (strpos($field_icon, 'http') !== false) {
2840
-                                $field_icon_af = '';
2841
-                            } elseif ($field_icon == '') {
2842
-                                $field_icon_af = '';
2843
-                            } else {
2844
-                                $field_icon_af = $field_icon;
2845
-                                $field_icon = '';
2846
-                            }
2847
-
2848
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2849
-
2850
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2851
-                            if ($field_set_start == 1 && $site_title != '') {
2852
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2853
-                            }
2854
-                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
2855
-                        }
2856
-                            break;
2857
-                        case 'html': {
2858
-                            if (strpos($field_icon, 'http') !== false) {
2859
-                                $field_icon_af = '';
2860
-                            } elseif ($field_icon == '') {
2861
-                                $field_icon_af = '';
2862
-                            } else {
2863
-                                $field_icon_af = $field_icon;
2864
-                                $field_icon = '';
2865
-                            }
2866
-
2867
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2868
-
2869
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2870
-                            if ($field_set_start == 1 && $site_title != '') {
2871
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2872
-                            }
2873
-                            $html .= ' </span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
2874
-                        }
2875
-                        break;
2876
-                        case 'file': {
2877
-                            $html_var = $type['htmlvar_name'];
2878
-
2879
-                            if (!empty($post->{$type['htmlvar_name']})) {
2880
-                                $files = explode(",", $post->{$type['htmlvar_name']});
2881
-
2882
-                                if (!empty($files)) {
2883
-                                    $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2884
-                                    $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'] : '';
2785
+								if (!empty($cf_option_values)) {
2786
+									foreach ($cf_option_values as $cf_option_value) {
2787
+										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2788
+											$option_values[] = $cf_option_value['label'];
2789
+										}
2790
+									}
2791
+								}
2792
+							}
2793
+
2794
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2795
+
2796
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2797
+							if ($field_set_start == 1 && $site_title != '') {
2798
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2799
+							}
2800
+							$html .= ' </span>';
2801
+
2802
+							$html .= ' <span class="gd-multiselect-value-output gd-val-'.$type['htmlvar_name'].'" >';
2803
+
2804
+							if (count($option_values) > 1) {
2805
+								$html .= "<span>".implode('</span>, <span>',$option_values)."</span>";
2806
+							} else {
2807
+								$vals = explode(",",$post->{$type['htmlvar_name']});
2808
+								$html .= "<span>".implode('</span>, <span>', $vals)."</span>";
2809
+							}
2810
+
2811
+							$html .= ' </span>';
2812
+
2813
+
2814
+
2815
+
2816
+							$html .= '</div>';
2817
+						}
2818
+							break;
2819
+						case 'email': {
2820
+							if (strpos($field_icon, 'http') !== false) {
2821
+								$field_icon_af = '';
2822
+							} elseif ($field_icon == '') {
2823
+								$field_icon_af = '<i class="fa fa-envelope"></i>';
2824
+							} else {
2825
+								$field_icon_af = $field_icon;
2826
+								$field_icon = '';
2827
+							}
2828
+
2829
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2830
+
2831
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2832
+							if ($field_set_start == 1 && $site_title != '') {
2833
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2834
+							}
2835
+							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2836
+						}
2837
+							break;
2838
+						case 'textarea': {
2839
+							if (strpos($field_icon, 'http') !== false) {
2840
+								$field_icon_af = '';
2841
+							} elseif ($field_icon == '') {
2842
+								$field_icon_af = '';
2843
+							} else {
2844
+								$field_icon_af = $field_icon;
2845
+								$field_icon = '';
2846
+							}
2847
+
2848
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2849
+
2850
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2851
+							if ($field_set_start == 1 && $site_title != '') {
2852
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2853
+							}
2854
+							$html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
2855
+						}
2856
+							break;
2857
+						case 'html': {
2858
+							if (strpos($field_icon, 'http') !== false) {
2859
+								$field_icon_af = '';
2860
+							} elseif ($field_icon == '') {
2861
+								$field_icon_af = '';
2862
+							} else {
2863
+								$field_icon_af = $field_icon;
2864
+								$field_icon = '';
2865
+							}
2866
+
2867
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2868
+
2869
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2870
+							if ($field_set_start == 1 && $site_title != '') {
2871
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2872
+							}
2873
+							$html .= ' </span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
2874
+						}
2875
+						break;
2876
+						case 'file': {
2877
+							$html_var = $type['htmlvar_name'];
2878
+
2879
+							if (!empty($post->{$type['htmlvar_name']})) {
2880
+								$files = explode(",", $post->{$type['htmlvar_name']});
2881
+
2882
+								if (!empty($files)) {
2883
+									$extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2884
+									$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'] : '';
2885 2885
                                
2886
-                                    $file_paths = '';
2887
-                                    foreach ($files as $file) {
2888
-                                        if (!empty($file)) {
2889
-                                            $image_name_arr = explode('/', $file);
2890
-                                            $filename = end($image_name_arr);
2891
-
2892
-                                            $arr_file_type = wp_check_filetype($filename);
2893
-                                            if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2894
-                                                continue;
2895
-                                            }
2896
-                                            $uploaded_file_type = $arr_file_type['type'];
2897
-                                            $uploaded_file_ext = $arr_file_type['ext'];
2886
+									$file_paths = '';
2887
+									foreach ($files as $file) {
2888
+										if (!empty($file)) {
2889
+											$image_name_arr = explode('/', $file);
2890
+											$filename = end($image_name_arr);
2891
+
2892
+											$arr_file_type = wp_check_filetype($filename);
2893
+											if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2894
+												continue;
2895
+											}
2896
+											$uploaded_file_type = $arr_file_type['type'];
2897
+											$uploaded_file_ext = $arr_file_type['ext'];
2898 2898
                                             
2899
-                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2900
-                                                continue; // Invalid file type.
2901
-                                            }
2902
-
2903
-                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2904
-
2905
-                                            // If the uploaded file is image
2906
-                                            if (in_array($uploaded_file_type, $image_file_types)) {
2907
-                                                $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2908
-                                                $file_paths .= '<a href="'.$file.'">';
2909
-                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2910
-                                                $file_paths .= '</a>';
2911
-                                                $file_paths .= '</div>';
2912
-                                            } else {
2913
-                                                $ext_path = '_' . $html_var . '_';
2914
-                                                $filename = explode($ext_path, $filename);
2915
-                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2916
-                                            }
2917
-                                        }
2918
-                                    }
2919
-
2920
-                                    if (strpos($field_icon, 'http') !== false) {
2921
-                                        $field_icon_af = '';
2922
-                                    } else if ($field_icon == '') {
2923
-                                        $field_icon_af = '';
2924
-                                    } else {
2925
-                                        $field_icon_af = $field_icon;
2926
-                                        $field_icon = '';
2927
-                                    }
2928
-
2929
-                                    $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2930
-
2931
-
2932
-                                    $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2933
-
2934
-                                    if ($field_set_start == 1 && $site_title != '') {
2935
-                                        $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2936
-                                    }
2937
-
2938
-                                    $html .= ' </span>' . $file_paths . '</div>';
2939
-                                }
2940
-                            }
2941
-                        }
2942
-                            break;
2943
-                    }
2944
-
2945
-
2946
-                    /**
2947
-                     * Filter custom field output in tab.
2948
-                     *
2949
-                     * @since 1.5.6
2950
-                     *
2951
-                     * @param string $html_var The HTML variable name for the field.
2952
-                     * @param string $html Custom field unfiltered HTML.
2953
-                     * @param array $variables_array Custom field variables array.
2954
-                     */
2955
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2956
-
2957
-                    $fieldset_html = '';
2958
-                    if ($field_set_start == 1) {
2959
-                        $add_html = false;
2960
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2961
-                            if ($fieldset != '') {
2962
-                                $add_html = true;
2963
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2964
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2965
-                            }
2966
-                            $fieldset_html = $fieldset;
2967
-                            $fieldset = '';
2968
-                        } else {
2969
-                            $fieldset .= $html;
2970
-                            if ($total_fields == $count_field && $fieldset != '') {
2971
-                                $add_html = true;
2972
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2973
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2974
-                                $fieldset_html = $fieldset;
2975
-                            }
2976
-                        }
2977
-
2978
-                        if ($add_html) {
2979
-                            $tabs_arr[$htmlvar_name] = array(
2980
-                                'heading_text' => __($label, 'geodirectory'),
2981
-                                'is_active_tab' => false,
2982
-                                /**
2983
-                                 * Filter if a custom field should be displayed on the details page tab.
2984
-                                 *
2985
-                                 * @since 1.0.0
2986
-                                 * @param string $htmlvar_name The field HTML var name.
2987
-                                 */
2988
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2989
-                                'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2990
-                            );
2991
-                        }
2992
-                    } else {
2993
-                        if ($html != '') {
2994
-                            $tabs_arr[$field['htmlvar_name']] = array(
2995
-                                'heading_text' => __($label, 'geodirectory'),
2996
-                                'is_active_tab' => false,
2997
-                                /** This action is documented in geodirectory_hooks_actions.php */
2998
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2999
-                                'tab_content' => $html
3000
-                            );
3001
-                        }
3002
-                    }
3003
-                }
3004
-            }
3005
-        }
3006
-    }
3007
-    return $tabs_arr;
2899
+											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2900
+												continue; // Invalid file type.
2901
+											}
2902
+
2903
+											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2904
+
2905
+											// If the uploaded file is image
2906
+											if (in_array($uploaded_file_type, $image_file_types)) {
2907
+												$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2908
+												$file_paths .= '<a href="'.$file.'">';
2909
+												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2910
+												$file_paths .= '</a>';
2911
+												$file_paths .= '</div>';
2912
+											} else {
2913
+												$ext_path = '_' . $html_var . '_';
2914
+												$filename = explode($ext_path, $filename);
2915
+												$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2916
+											}
2917
+										}
2918
+									}
2919
+
2920
+									if (strpos($field_icon, 'http') !== false) {
2921
+										$field_icon_af = '';
2922
+									} else if ($field_icon == '') {
2923
+										$field_icon_af = '';
2924
+									} else {
2925
+										$field_icon_af = $field_icon;
2926
+										$field_icon = '';
2927
+									}
2928
+
2929
+									$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2930
+
2931
+
2932
+									$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2933
+
2934
+									if ($field_set_start == 1 && $site_title != '') {
2935
+										$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2936
+									}
2937
+
2938
+									$html .= ' </span>' . $file_paths . '</div>';
2939
+								}
2940
+							}
2941
+						}
2942
+							break;
2943
+					}
2944
+
2945
+
2946
+					/**
2947
+					 * Filter custom field output in tab.
2948
+					 *
2949
+					 * @since 1.5.6
2950
+					 *
2951
+					 * @param string $html_var The HTML variable name for the field.
2952
+					 * @param string $html Custom field unfiltered HTML.
2953
+					 * @param array $variables_array Custom field variables array.
2954
+					 */
2955
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2956
+
2957
+					$fieldset_html = '';
2958
+					if ($field_set_start == 1) {
2959
+						$add_html = false;
2960
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2961
+							if ($fieldset != '') {
2962
+								$add_html = true;
2963
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2964
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2965
+							}
2966
+							$fieldset_html = $fieldset;
2967
+							$fieldset = '';
2968
+						} else {
2969
+							$fieldset .= $html;
2970
+							if ($total_fields == $count_field && $fieldset != '') {
2971
+								$add_html = true;
2972
+								$label = $fieldset_arr[$fieldset_count]['label'];
2973
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2974
+								$fieldset_html = $fieldset;
2975
+							}
2976
+						}
2977
+
2978
+						if ($add_html) {
2979
+							$tabs_arr[$htmlvar_name] = array(
2980
+								'heading_text' => __($label, 'geodirectory'),
2981
+								'is_active_tab' => false,
2982
+								/**
2983
+								 * Filter if a custom field should be displayed on the details page tab.
2984
+								 *
2985
+								 * @since 1.0.0
2986
+								 * @param string $htmlvar_name The field HTML var name.
2987
+								 */
2988
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2989
+								'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2990
+							);
2991
+						}
2992
+					} else {
2993
+						if ($html != '') {
2994
+							$tabs_arr[$field['htmlvar_name']] = array(
2995
+								'heading_text' => __($label, 'geodirectory'),
2996
+								'is_active_tab' => false,
2997
+								/** This action is documented in geodirectory_hooks_actions.php */
2998
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2999
+								'tab_content' => $html
3000
+							);
3001
+						}
3002
+					}
3003
+				}
3004
+			}
3005
+		}
3006
+	}
3007
+	return $tabs_arr;
3008 3008
 }
3009 3009
 
3010 3010
 /* display add listing page for wpml */
@@ -3028,37 +3028,37 @@  discard block
 block discarded – undo
3028 3028
  */
3029 3029
 function geodir_add_post_status_author_page()
3030 3030
 {
3031
-    global $wpdb, $post;
3032
-
3033
-    $html = '';
3034
-    if (get_current_user_id()) {
3035
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3036
-
3037
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3038
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3039
-            $status = "<strong>(";
3040
-            $status_icon = '<i class="fa fa-play"></i>';
3041
-            if ($real_status == 'publish') {
3042
-                $status .= __('Published', 'geodirectory');
3043
-            } else {
3044
-                $status .= __('Not published', 'geodirectory');
3045
-                $status_icon = '<i class="fa fa-pause"></i>';
3046
-            }
3047
-            $status .= ")</strong>";
3031
+	global $wpdb, $post;
3032
+
3033
+	$html = '';
3034
+	if (get_current_user_id()) {
3035
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3036
+
3037
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3038
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3039
+			$status = "<strong>(";
3040
+			$status_icon = '<i class="fa fa-play"></i>';
3041
+			if ($real_status == 'publish') {
3042
+				$status .= __('Published', 'geodirectory');
3043
+			} else {
3044
+				$status .= __('Not published', 'geodirectory');
3045
+				$status_icon = '<i class="fa fa-pause"></i>';
3046
+			}
3047
+			$status .= ")</strong>";
3048 3048
 
3049
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3050
-        }
3051
-    }
3049
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3050
+		}
3051
+	}
3052 3052
 
3053
-    if ($html != '') {
3054
-        /**
3055
-         * Filter the post status text on the author page.
3056
-         *
3057
-         * @since 1.0.0
3058
-         * @param string $html The HTML of the status.
3059
-         */
3060
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3061
-    }
3053
+	if ($html != '') {
3054
+		/**
3055
+		 * Filter the post status text on the author page.
3056
+		 *
3057
+		 * @since 1.0.0
3058
+		 * @param string $html The HTML of the status.
3059
+		 */
3060
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3061
+	}
3062 3062
 
3063 3063
 
3064 3064
 }
@@ -3072,21 +3072,21 @@  discard block
 block discarded – undo
3072 3072
  */
3073 3073
 function geodir_init_no_rating()
3074 3074
 {
3075
-    if (get_option('geodir_disable_rating')) {
3076
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3077
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3078
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3079
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3080
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3081
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3082
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3083
-
3084
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3085
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3086
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3087
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3088
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3089
-    }
3075
+	if (get_option('geodir_disable_rating')) {
3076
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3077
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3078
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3079
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3080
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3081
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3082
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3083
+
3084
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3085
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3086
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3087
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3088
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3089
+	}
3090 3090
 }
3091 3091
 
3092 3092
 /**
@@ -3098,20 +3098,20 @@  discard block
 block discarded – undo
3098 3098
  */
3099 3099
 function geodir_no_rating_rating_fields()
3100 3100
 {
3101
-    global $post;
3101
+	global $post;
3102 3102
 
3103
-    $post_types = geodir_get_posttypes();
3103
+	$post_types = geodir_get_posttypes();
3104 3104
 
3105
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3106
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3107
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3108
-            if (get_option('geodir_reviewrating_enable_images')) {
3109
-                geodir_reviewrating_rating_img_html();
3110
-            }
3111
-        } else {
3112
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3113
-        }
3114
-    }
3105
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3106
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3107
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3108
+			if (get_option('geodir_reviewrating_enable_images')) {
3109
+				geodir_reviewrating_rating_img_html();
3110
+			}
3111
+		} else {
3112
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3113
+		}
3114
+	}
3115 3115
 }
3116 3116
 
3117 3117
 /**
@@ -3125,11 +3125,11 @@  discard block
 block discarded – undo
3125 3125
  */
3126 3126
 function geodir_no_rating_comment_text($content, $comment = '')
3127 3127
 {
3128
-    if (!is_admin()) {
3129
-        return '<div class="description">' . $content . '</div>';
3130
-    } else {
3131
-        return $content;
3132
-    }
3128
+	if (!is_admin()) {
3129
+		return '<div class="description">' . $content . '</div>';
3130
+	} else {
3131
+		return $content;
3132
+	}
3133 3133
 }
3134 3134
 
3135 3135
 /**
@@ -3142,7 +3142,7 @@  discard block
 block discarded – undo
3142 3142
  */
3143 3143
 function geodir_no_rating_review_rating_html($content = '')
3144 3144
 {
3145
-    return NULL;
3145
+	return NULL;
3146 3146
 }
3147 3147
 
3148 3148
 /**
@@ -3156,19 +3156,19 @@  discard block
 block discarded – undo
3156 3156
  */
3157 3157
 function geodir_no_rating_get_sort_options($options, $post_type = '')
3158 3158
 {
3159
-    $new_options = array();
3160
-    if (!empty($options)) {
3161
-        foreach ($options as $option) {
3162
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3163
-                continue;
3164
-            }
3165
-            $new_options[] = $option;
3166
-        }
3159
+	$new_options = array();
3160
+	if (!empty($options)) {
3161
+		foreach ($options as $option) {
3162
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3163
+				continue;
3164
+			}
3165
+			$new_options[] = $option;
3166
+		}
3167 3167
 
3168
-        $options = $new_options;
3169
-    }
3168
+		$options = $new_options;
3169
+	}
3170 3170
 
3171
-    return $options;
3171
+	return $options;
3172 3172
 }
3173 3173
 
3174 3174
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -3182,11 +3182,11 @@  discard block
 block discarded – undo
3182 3182
  */
3183 3183
 function geodir_all_js_msg_no_rating($msg = array())
3184 3184
 {
3185
-    if (get_option('geodir_disable_rating')) {
3186
-        $msg['gd_cmt_no_rating'] = true;
3187
-    }
3185
+	if (get_option('geodir_disable_rating')) {
3186
+		$msg['gd_cmt_no_rating'] = true;
3187
+	}
3188 3188
 
3189
-    return $msg;
3189
+	return $msg;
3190 3190
 }
3191 3191
 
3192 3192
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -3200,13 +3200,13 @@  discard block
 block discarded – undo
3200 3200
  */
3201 3201
 function geodir_body_class_no_rating($classes = array())
3202 3202
 {
3203
-    if (get_option('geodir_disable_rating')) {
3204
-        $classes[] = 'gd-no-rating';
3205
-    }
3203
+	if (get_option('geodir_disable_rating')) {
3204
+		$classes[] = 'gd-no-rating';
3205
+	}
3206 3206
     
3207
-    $classes[] = 'gd-map-' . geodir_map_name();
3207
+	$classes[] = 'gd-map-' . geodir_map_name();
3208 3208
 
3209
-    return $classes;
3209
+	return $classes;
3210 3210
 }
3211 3211
 
3212 3212
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -3220,13 +3220,13 @@  discard block
 block discarded – undo
3220 3220
  */
3221 3221
 function geodir_admin_body_class_no_rating($class = '')
3222 3222
 {
3223
-    if (get_option('geodir_disable_rating')) {
3224
-        $class .= ' gd-no-rating';
3225
-    }
3223
+	if (get_option('geodir_disable_rating')) {
3224
+		$class .= ' gd-no-rating';
3225
+	}
3226 3226
     
3227
-    $class .= ' gd-map-' . geodir_map_name();
3227
+	$class .= ' gd-map-' . geodir_map_name();
3228 3228
 
3229
-    return $class;
3229
+	return $class;
3230 3230
 }
3231 3231
 
3232 3232
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -3239,10 +3239,10 @@  discard block
 block discarded – undo
3239 3239
  */
3240 3240
 function geodir_wp_head_no_rating()
3241 3241
 {
3242
-    if (get_option('geodir_disable_rating')) {
3243
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3244
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3245
-    }
3242
+	if (get_option('geodir_disable_rating')) {
3243
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3244
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3245
+	}
3246 3246
 }
3247 3247
 
3248 3248
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -3259,36 +3259,36 @@  discard block
 block discarded – undo
3259 3259
  * @return array Translation texts.
3260 3260
  */
3261 3261
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3262
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3263
-
3264
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3265
-
3266
-    /**
3267
-     * Filters the geodirectory option names that requires to add for translation.
3268
-     *
3269
-     * @since 1.5.7
3270
-     * @package GeoDirectory
3271
-     *
3272
-     * @param  array $gd_options Array of option names.
3273
-     */
3274
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3275
-    $gd_options = array_unique($gd_options);
3276
-
3277
-    if (!empty($gd_options)) {
3278
-        foreach ($gd_options as $gd_option) {
3279
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
3280
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3262
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3263
+
3264
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3265
+
3266
+	/**
3267
+	 * Filters the geodirectory option names that requires to add for translation.
3268
+	 *
3269
+	 * @since 1.5.7
3270
+	 * @package GeoDirectory
3271
+	 *
3272
+	 * @param  array $gd_options Array of option names.
3273
+	 */
3274
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3275
+	$gd_options = array_unique($gd_options);
3276
+
3277
+	if (!empty($gd_options)) {
3278
+		foreach ($gd_options as $gd_option) {
3279
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
3280
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3281 3281
                 
3282
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3283
-                    $translation_texts[] = stripslashes_deep($option_value);
3284
-                }
3285
-            }
3286
-        }
3287
-    }
3282
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3283
+					$translation_texts[] = stripslashes_deep($option_value);
3284
+				}
3285
+			}
3286
+		}
3287
+	}
3288 3288
 
3289
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3289
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3290 3290
 
3291
-    return $translation_texts;
3291
+	return $translation_texts;
3292 3292
 }
3293 3293
 
3294 3294
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -3302,15 +3302,15 @@  discard block
 block discarded – undo
3302 3302
 
3303 3303
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
3304 3304
 function gd_get_comments_link($comments_link, $post_id) {
3305
-    $post_type = get_post_type($post_id);
3305
+	$post_type = get_post_type($post_id);
3306 3306
 
3307
-    $all_postypes = geodir_get_posttypes();
3308
-    if (in_array($post_type, $all_postypes)) {
3309
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
3310
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
3311
-    }
3307
+	$all_postypes = geodir_get_posttypes();
3308
+	if (in_array($post_type, $all_postypes)) {
3309
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
3310
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
3311
+	}
3312 3312
 
3313
-    return $comments_link;
3313
+	return $comments_link;
3314 3314
 }
3315 3315
 
3316 3316
 
@@ -3328,11 +3328,11 @@  discard block
 block discarded – undo
3328 3328
 function geodir_add_nav_menu_class( $args )
3329 3329
 {
3330 3330
 
3331
-        if(isset($args['menu_class'])){
3332
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
3333
-        }
3331
+		if(isset($args['menu_class'])){
3332
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
3333
+		}
3334 3334
     
3335
-    return $args;
3335
+	return $args;
3336 3336
 }
3337 3337
 
3338 3338
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
3339 3339
\ No newline at end of file
Please login to merge, or discard this patch.
upgrade.php 3 patches
Indentation   +542 added lines, -542 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,80 +260,80 @@  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 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
-            $id = $cf->id;
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
-            $show_in_arr = array();
303
+			$show_in_arr = array();
304 304
 
305
-            if($cf->is_default){
306
-                $show_in_arr[] = "[detail]";
307
-            }
305
+			if($cf->is_default){
306
+				$show_in_arr[] = "[detail]";
307
+			}
308 308
 
309
-            if($cf->show_on_detail){
310
-                $show_in_arr[] = "[moreinfo]";
311
-            }
309
+			if($cf->show_on_detail){
310
+				$show_in_arr[] = "[moreinfo]";
311
+			}
312 312
 
313
-            if($cf->show_on_listing){
314
-                $show_in_arr[] = "[listing]";
315
-            }
313
+			if($cf->show_on_listing){
314
+				$show_in_arr[] = "[listing]";
315
+			}
316 316
 
317
-            if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
318
-                $show_in_arr[] = "[owntab]";
319
-            }
317
+			if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
318
+				$show_in_arr[] = "[owntab]";
319
+			}
320 320
 
321
-            if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
322
-                $show_in_arr[] = "[mapbubble]";
323
-            }
321
+			if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
322
+				$show_in_arr[] = "[mapbubble]";
323
+			}
324 324
 
325
-            if(!empty($show_in_arr )){
326
-                $show_in_arr = implode(',',$show_in_arr);
327
-            }else{
328
-                $show_in_arr = '';
329
-            }
325
+			if(!empty($show_in_arr )){
326
+				$show_in_arr = implode(',',$show_in_arr);
327
+			}else{
328
+				$show_in_arr = '';
329
+			}
330 330
 
331
-            $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
331
+			$wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
332 332
 
333
-        }
333
+		}
334 334
 
335
-        update_option('gd_convert_custom_field_display',1);
336
-    }
335
+		update_option('gd_convert_custom_field_display',1);
336
+	}
337 337
 }
338 338
 
339 339
 ############################################
@@ -349,367 +349,367 @@  discard block
 block discarded – undo
349 349
  */
350 350
 function gd_install_theme_compat()
351 351
 {
352
-    global $wpdb;
352
+	global $wpdb;
353 353
 
354
-    $theme_compat = array();
355
-    $theme_compat = get_option('gd_theme_compats');
354
+	$theme_compat = array();
355
+	$theme_compat = get_option('gd_theme_compats');
356 356
 //GDF
357
-    $theme_compat['GeoDirectory_Framework'] = array(
358
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
359
-        'geodir_wrapper_open_class' => '',
360
-        'geodir_wrapper_open_replace' => '',
361
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
362
-        'geodir_wrapper_content_open_id' => 'geodir_content',
363
-        'geodir_wrapper_content_open_class' => '',
364
-        'geodir_wrapper_content_open_replace' => '',
365
-        'geodir_wrapper_content_close_replace' => '',
366
-        'geodir_article_open_id' => '',
367
-        'geodir_article_open_class' => '',
368
-        'geodir_article_open_replace' => '',
369
-        'geodir_article_close_replace' => '',
370
-        'geodir_sidebar_right_open_id' => '',
371
-        'geodir_sidebar_right_open_class' => '',
372
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
373
-        'geodir_sidebar_right_close_replace' => '',
374
-        'geodir_sidebar_left_open_id' => '',
375
-        'geodir_sidebar_left_open_class' => '',
376
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
377
-        'geodir_sidebar_left_close_replace' => '',
378
-        'geodir_main_content_open_id' => '',
379
-        'geodir_main_content_open_class' => '',
380
-        'geodir_main_content_open_replace' => '<!-- removed -->',
381
-        'geodir_main_content_close_replace' => '<!-- removed -->',
382
-        'geodir_top_content_add' => '',
383
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
384
-        'geodir_before_widget_filter' => '',
385
-        'geodir_after_widget_filter' => '',
386
-        'geodir_theme_compat_css' => '',
387
-        'geodir_theme_compat_js' => '',
388
-        'geodir_theme_compat_default_options' => '',
389
-        'geodir_theme_compat_code' => ''
390
-    );
357
+	$theme_compat['GeoDirectory_Framework'] = array(
358
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
359
+		'geodir_wrapper_open_class' => '',
360
+		'geodir_wrapper_open_replace' => '',
361
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
362
+		'geodir_wrapper_content_open_id' => 'geodir_content',
363
+		'geodir_wrapper_content_open_class' => '',
364
+		'geodir_wrapper_content_open_replace' => '',
365
+		'geodir_wrapper_content_close_replace' => '',
366
+		'geodir_article_open_id' => '',
367
+		'geodir_article_open_class' => '',
368
+		'geodir_article_open_replace' => '',
369
+		'geodir_article_close_replace' => '',
370
+		'geodir_sidebar_right_open_id' => '',
371
+		'geodir_sidebar_right_open_class' => '',
372
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
373
+		'geodir_sidebar_right_close_replace' => '',
374
+		'geodir_sidebar_left_open_id' => '',
375
+		'geodir_sidebar_left_open_class' => '',
376
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
377
+		'geodir_sidebar_left_close_replace' => '',
378
+		'geodir_main_content_open_id' => '',
379
+		'geodir_main_content_open_class' => '',
380
+		'geodir_main_content_open_replace' => '<!-- removed -->',
381
+		'geodir_main_content_close_replace' => '<!-- removed -->',
382
+		'geodir_top_content_add' => '',
383
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
384
+		'geodir_before_widget_filter' => '',
385
+		'geodir_after_widget_filter' => '',
386
+		'geodir_theme_compat_css' => '',
387
+		'geodir_theme_compat_js' => '',
388
+		'geodir_theme_compat_default_options' => '',
389
+		'geodir_theme_compat_code' => ''
390
+	);
391 391
 
392 392
 //Directory Theme
393
-    $theme_compat['Directory_Starter'] = array(
394
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
395
-        'geodir_wrapper_open_class' => '',
396
-        'geodir_wrapper_open_replace' => '',
397
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
398
-        'geodir_wrapper_content_open_id' => 'geodir_content',
399
-        'geodir_wrapper_content_open_class' => '',
400
-        'geodir_wrapper_content_open_replace' => '',
401
-        'geodir_wrapper_content_close_replace' => '',
402
-        'geodir_article_open_id' => '',
403
-        'geodir_article_open_class' => '',
404
-        'geodir_article_open_replace' => '',
405
-        'geodir_article_close_replace' => '',
406
-        'geodir_sidebar_right_open_id' => '',
407
-        'geodir_sidebar_right_open_class' => '',
408
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
409
-        'geodir_sidebar_right_close_replace' => '',
410
-        'geodir_sidebar_left_open_id' => '',
411
-        'geodir_sidebar_left_open_class' => '',
412
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
413
-        'geodir_sidebar_left_close_replace' => '',
414
-        'geodir_main_content_open_id' => '',
415
-        'geodir_main_content_open_class' => '',
416
-        'geodir_main_content_open_replace' => '<!-- removed -->',
417
-        'geodir_main_content_close_replace' => '<!-- removed -->',
418
-        'geodir_top_content_add' => '',
419
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
420
-        'geodir_before_widget_filter' => '',
421
-        'geodir_after_widget_filter' => '',
422
-        'geodir_theme_compat_css' => '',
423
-        'geodir_theme_compat_js' => '',
424
-        'geodir_theme_compat_default_options' => '',
425
-        'geodir_theme_compat_code' => ''
426
-    );
393
+	$theme_compat['Directory_Starter'] = array(
394
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
395
+		'geodir_wrapper_open_class' => '',
396
+		'geodir_wrapper_open_replace' => '',
397
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
398
+		'geodir_wrapper_content_open_id' => 'geodir_content',
399
+		'geodir_wrapper_content_open_class' => '',
400
+		'geodir_wrapper_content_open_replace' => '',
401
+		'geodir_wrapper_content_close_replace' => '',
402
+		'geodir_article_open_id' => '',
403
+		'geodir_article_open_class' => '',
404
+		'geodir_article_open_replace' => '',
405
+		'geodir_article_close_replace' => '',
406
+		'geodir_sidebar_right_open_id' => '',
407
+		'geodir_sidebar_right_open_class' => '',
408
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
409
+		'geodir_sidebar_right_close_replace' => '',
410
+		'geodir_sidebar_left_open_id' => '',
411
+		'geodir_sidebar_left_open_class' => '',
412
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
413
+		'geodir_sidebar_left_close_replace' => '',
414
+		'geodir_main_content_open_id' => '',
415
+		'geodir_main_content_open_class' => '',
416
+		'geodir_main_content_open_replace' => '<!-- removed -->',
417
+		'geodir_main_content_close_replace' => '<!-- removed -->',
418
+		'geodir_top_content_add' => '',
419
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
420
+		'geodir_before_widget_filter' => '',
421
+		'geodir_after_widget_filter' => '',
422
+		'geodir_theme_compat_css' => '',
423
+		'geodir_theme_compat_js' => '',
424
+		'geodir_theme_compat_default_options' => '',
425
+		'geodir_theme_compat_code' => ''
426
+	);
427 427
 
428 428
 //Jobby
429
-    $theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
429
+	$theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
430 430
 
431 431
 //GeoProperty
432
-    $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
432
+	$theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
433 433
 
434 434
 //Avada
435
-    $theme_compat['Avada'] = array(
436
-        'geodir_wrapper_open_id' => '',
437
-        'geodir_wrapper_open_class' => '',
438
-        'geodir_wrapper_open_replace' => '<!-- removed -->',
439
-        'geodir_wrapper_close_replace' => '<!-- removed -->',
440
-        'geodir_wrapper_content_open_id' => 'content',
441
-        'geodir_wrapper_content_open_class' => '',
442
-        'geodir_wrapper_content_open_replace' => '',
443
-        'geodir_wrapper_content_close_replace' => '',
444
-        'geodir_article_open_id' => '',
445
-        'geodir_article_open_class' => '',
446
-        'geodir_article_open_replace' => '',
447
-        'geodir_article_close_replace' => '',
448
-        'geodir_sidebar_right_open_id' => '',
449
-        'geodir_sidebar_right_open_class' => '',
450
-        'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
451
-        'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
452
-        'geodir_sidebar_left_open_id' => '',
453
-        'geodir_sidebar_left_open_class' => '',
454
-        'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
455
-        'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
456
-        'geodir_main_content_open_id' => '',
457
-        'geodir_main_content_open_class' => '',
458
-        'geodir_main_content_open_replace' => '<!-- removed -->',
459
-        'geodir_main_content_close_replace' => '<!-- removed -->',
460
-        'geodir_top_content_add' => '',
461
-        'geodir_before_main_content_add' => '',
462
-        'geodir_before_widget_filter' => '',
463
-        'geodir_after_widget_filter' => '',
464
-        '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;}'),
465
-        'geodir_theme_compat_js' => '',
466
-        'geodir_theme_compat_default_options' => '',
467
-        'geodir_theme_compat_code' => 'Avada'
468
-    );
435
+	$theme_compat['Avada'] = array(
436
+		'geodir_wrapper_open_id' => '',
437
+		'geodir_wrapper_open_class' => '',
438
+		'geodir_wrapper_open_replace' => '<!-- removed -->',
439
+		'geodir_wrapper_close_replace' => '<!-- removed -->',
440
+		'geodir_wrapper_content_open_id' => 'content',
441
+		'geodir_wrapper_content_open_class' => '',
442
+		'geodir_wrapper_content_open_replace' => '',
443
+		'geodir_wrapper_content_close_replace' => '',
444
+		'geodir_article_open_id' => '',
445
+		'geodir_article_open_class' => '',
446
+		'geodir_article_open_replace' => '',
447
+		'geodir_article_close_replace' => '',
448
+		'geodir_sidebar_right_open_id' => '',
449
+		'geodir_sidebar_right_open_class' => '',
450
+		'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
451
+		'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
452
+		'geodir_sidebar_left_open_id' => '',
453
+		'geodir_sidebar_left_open_class' => '',
454
+		'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
455
+		'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
456
+		'geodir_main_content_open_id' => '',
457
+		'geodir_main_content_open_class' => '',
458
+		'geodir_main_content_open_replace' => '<!-- removed -->',
459
+		'geodir_main_content_close_replace' => '<!-- removed -->',
460
+		'geodir_top_content_add' => '',
461
+		'geodir_before_main_content_add' => '',
462
+		'geodir_before_widget_filter' => '',
463
+		'geodir_after_widget_filter' => '',
464
+		'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;}'),
465
+		'geodir_theme_compat_js' => '',
466
+		'geodir_theme_compat_default_options' => '',
467
+		'geodir_theme_compat_code' => 'Avada'
468
+	);
469 469
 
470 470
 //Enfold
471
-    $theme_compat['Enfold'] = array(
472
-        'geodir_wrapper_open_id' => '',
473
-        'geodir_wrapper_open_class' => '',
474
-        'geodir_wrapper_open_replace' => '',
475
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
476
-        'geodir_wrapper_content_open_id' => '',
477
-        'geodir_wrapper_content_open_class' => '',
478
-        'geodir_wrapper_content_open_replace' => '',
479
-        'geodir_wrapper_content_close_replace' => '</div></main>',
480
-        'geodir_article_open_id' => '',
481
-        'geodir_article_open_class' => '',
482
-        'geodir_article_open_replace' => '',
483
-        'geodir_article_close_replace' => '',
484
-        'geodir_sidebar_right_open_id' => '',
485
-        'geodir_sidebar_right_open_class' => '',
486
-        'geodir_sidebar_right_open_replace' => '',
487
-        'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
488
-        'geodir_sidebar_left_open_id' => '',
489
-        'geodir_sidebar_left_open_class' => '',
490
-        'geodir_sidebar_left_open_replace' => '',
491
-        'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
492
-        'geodir_main_content_open_id' => '',
493
-        'geodir_main_content_open_class' => '',
494
-        'geodir_main_content_open_replace' => '',
495
-        'geodir_main_content_close_replace' => '',
496
-        'geodir_top_content_add' => '',
497
-        'geodir_before_main_content_add' => '',
498
-        'geodir_before_widget_filter' => '',
499
-        'geodir_after_widget_filter' => '',
500
-        '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;}'),
501
-        'geodir_theme_compat_js' => '',
502
-        'geodir_theme_compat_default_options' => '',
503
-        'geodir_theme_compat_code' => 'Enfold'
504
-    );
471
+	$theme_compat['Enfold'] = array(
472
+		'geodir_wrapper_open_id' => '',
473
+		'geodir_wrapper_open_class' => '',
474
+		'geodir_wrapper_open_replace' => '',
475
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
476
+		'geodir_wrapper_content_open_id' => '',
477
+		'geodir_wrapper_content_open_class' => '',
478
+		'geodir_wrapper_content_open_replace' => '',
479
+		'geodir_wrapper_content_close_replace' => '</div></main>',
480
+		'geodir_article_open_id' => '',
481
+		'geodir_article_open_class' => '',
482
+		'geodir_article_open_replace' => '',
483
+		'geodir_article_close_replace' => '',
484
+		'geodir_sidebar_right_open_id' => '',
485
+		'geodir_sidebar_right_open_class' => '',
486
+		'geodir_sidebar_right_open_replace' => '',
487
+		'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
488
+		'geodir_sidebar_left_open_id' => '',
489
+		'geodir_sidebar_left_open_class' => '',
490
+		'geodir_sidebar_left_open_replace' => '',
491
+		'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
492
+		'geodir_main_content_open_id' => '',
493
+		'geodir_main_content_open_class' => '',
494
+		'geodir_main_content_open_replace' => '',
495
+		'geodir_main_content_close_replace' => '',
496
+		'geodir_top_content_add' => '',
497
+		'geodir_before_main_content_add' => '',
498
+		'geodir_before_widget_filter' => '',
499
+		'geodir_after_widget_filter' => '',
500
+		'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;}'),
501
+		'geodir_theme_compat_js' => '',
502
+		'geodir_theme_compat_default_options' => '',
503
+		'geodir_theme_compat_code' => 'Enfold'
504
+	);
505 505
 
506 506
 // X
507
-    $theme_compat['X'] = array(
508
-        'geodir_wrapper_open_id' => '',
509
-        'geodir_wrapper_open_class' => '',
510
-        'geodir_wrapper_open_replace' => '',
511
-        'geodir_wrapper_close_replace' => '',
512
-        'geodir_wrapper_content_open_id' => '',
513
-        'geodir_wrapper_content_open_class' => '',
514
-        'geodir_wrapper_content_open_replace' => '',
515
-        'geodir_wrapper_content_close_replace' => '',
516
-        'geodir_article_open_id' => '',
517
-        'geodir_article_open_class' => '',
518
-        'geodir_article_open_replace' => '',
519
-        'geodir_article_close_replace' => '',
520
-        'geodir_sidebar_right_open_id' => '',
521
-        'geodir_sidebar_right_open_class' => '',
522
-        'geodir_sidebar_right_open_replace' => '',
523
-        'geodir_sidebar_right_close_replace' => '',
524
-        'geodir_sidebar_left_open_id' => '',
525
-        'geodir_sidebar_left_open_class' => '',
526
-        'geodir_sidebar_left_open_replace' => '',
527
-        'geodir_sidebar_left_close_replace' => '',
528
-        'geodir_main_content_open_id' => '',
529
-        'geodir_main_content_open_class' => '',
530
-        'geodir_main_content_open_replace' => '',
531
-        'geodir_main_content_close_replace' => '',
532
-        'geodir_top_content_add' => '',
533
-        'geodir_before_main_content_add' => '',
534
-        'geodir_before_widget_filter' => '',
535
-        'geodir_after_widget_filter' => '',
536
-        '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}'),
537
-        'geodir_theme_compat_js' => '',
538
-        'geodir_theme_compat_default_options' => '',
539
-        'geodir_theme_compat_code' => 'X'
540
-    );
507
+	$theme_compat['X'] = array(
508
+		'geodir_wrapper_open_id' => '',
509
+		'geodir_wrapper_open_class' => '',
510
+		'geodir_wrapper_open_replace' => '',
511
+		'geodir_wrapper_close_replace' => '',
512
+		'geodir_wrapper_content_open_id' => '',
513
+		'geodir_wrapper_content_open_class' => '',
514
+		'geodir_wrapper_content_open_replace' => '',
515
+		'geodir_wrapper_content_close_replace' => '',
516
+		'geodir_article_open_id' => '',
517
+		'geodir_article_open_class' => '',
518
+		'geodir_article_open_replace' => '',
519
+		'geodir_article_close_replace' => '',
520
+		'geodir_sidebar_right_open_id' => '',
521
+		'geodir_sidebar_right_open_class' => '',
522
+		'geodir_sidebar_right_open_replace' => '',
523
+		'geodir_sidebar_right_close_replace' => '',
524
+		'geodir_sidebar_left_open_id' => '',
525
+		'geodir_sidebar_left_open_class' => '',
526
+		'geodir_sidebar_left_open_replace' => '',
527
+		'geodir_sidebar_left_close_replace' => '',
528
+		'geodir_main_content_open_id' => '',
529
+		'geodir_main_content_open_class' => '',
530
+		'geodir_main_content_open_replace' => '',
531
+		'geodir_main_content_close_replace' => '',
532
+		'geodir_top_content_add' => '',
533
+		'geodir_before_main_content_add' => '',
534
+		'geodir_before_widget_filter' => '',
535
+		'geodir_after_widget_filter' => '',
536
+		'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}'),
537
+		'geodir_theme_compat_js' => '',
538
+		'geodir_theme_compat_default_options' => '',
539
+		'geodir_theme_compat_code' => 'X'
540
+	);
541 541
 
542 542
 // Divi
543
-    $theme_compat['Divi'] = array(
544
-        'geodir_wrapper_open_id' => 'main-content',
545
-        'geodir_wrapper_open_class' => '',
546
-        'geodir_wrapper_open_replace' => '',
547
-        'geodir_wrapper_close_replace' => '',
548
-        'geodir_wrapper_content_open_id' => 'left-area',
549
-        'geodir_wrapper_content_open_class' => '',
550
-        'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
551
-        'geodir_wrapper_content_close_replace' => '',
552
-        'geodir_article_open_id' => '',
553
-        'geodir_article_open_class' => '',
554
-        'geodir_article_open_replace' => '',
555
-        'geodir_article_close_replace' => '',
556
-        'geodir_sidebar_right_open_id' => 'sidebar',
557
-        'geodir_sidebar_right_open_class' => '',
558
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
559
-        'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
560
-        'geodir_sidebar_left_open_id' => 'sidebar',
561
-        'geodir_sidebar_left_open_class' => '',
562
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
563
-        'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
564
-        'geodir_main_content_open_id' => '',
565
-        'geodir_main_content_open_class' => '',
566
-        'geodir_main_content_open_replace' => '',
567
-        'geodir_main_content_close_replace' => '',
568
-        'geodir_top_content_add' => '',
569
-        'geodir_before_main_content_add' => '',
570
-        'geodir_before_widget_filter' => '',
571
-        'geodir_after_widget_filter' => '',
572
-        '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}'),
573
-        'geodir_theme_compat_js' => '',
574
-        'geodir_theme_compat_default_options' => '',
575
-        'geodir_theme_compat_code' => 'Divi'
576
-    );
543
+	$theme_compat['Divi'] = array(
544
+		'geodir_wrapper_open_id' => 'main-content',
545
+		'geodir_wrapper_open_class' => '',
546
+		'geodir_wrapper_open_replace' => '',
547
+		'geodir_wrapper_close_replace' => '',
548
+		'geodir_wrapper_content_open_id' => 'left-area',
549
+		'geodir_wrapper_content_open_class' => '',
550
+		'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
551
+		'geodir_wrapper_content_close_replace' => '',
552
+		'geodir_article_open_id' => '',
553
+		'geodir_article_open_class' => '',
554
+		'geodir_article_open_replace' => '',
555
+		'geodir_article_close_replace' => '',
556
+		'geodir_sidebar_right_open_id' => 'sidebar',
557
+		'geodir_sidebar_right_open_class' => '',
558
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
559
+		'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
560
+		'geodir_sidebar_left_open_id' => 'sidebar',
561
+		'geodir_sidebar_left_open_class' => '',
562
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
563
+		'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
564
+		'geodir_main_content_open_id' => '',
565
+		'geodir_main_content_open_class' => '',
566
+		'geodir_main_content_open_replace' => '',
567
+		'geodir_main_content_close_replace' => '',
568
+		'geodir_top_content_add' => '',
569
+		'geodir_before_main_content_add' => '',
570
+		'geodir_before_widget_filter' => '',
571
+		'geodir_after_widget_filter' => '',
572
+		'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}'),
573
+		'geodir_theme_compat_js' => '',
574
+		'geodir_theme_compat_default_options' => '',
575
+		'geodir_theme_compat_code' => 'Divi'
576
+	);
577 577
 
578 578
 // Genesis
579
-    $theme_compat['Genesis'] = array(
580
-        'geodir_wrapper_open_id' => '',
581
-        'geodir_wrapper_open_class' => 'content-sidebar-wrap',
582
-        'geodir_wrapper_open_replace' => '',
583
-        'geodir_wrapper_close_replace' => '',
584
-        'geodir_wrapper_content_open_id' => '',
585
-        'geodir_wrapper_content_open_class' => 'content',
586
-        'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
587
-        'geodir_wrapper_content_close_replace' => '',
588
-        'geodir_article_open_id' => '',
589
-        'geodir_article_open_class' => '',
590
-        'geodir_article_open_replace' => '',
591
-        'geodir_article_close_replace' => '',
592
-        'geodir_sidebar_right_open_id' => '',
593
-        'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
594
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
595
-        'geodir_sidebar_right_close_replace' => '',
596
-        'geodir_sidebar_left_open_id' => '',
597
-        'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
598
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
599
-        'geodir_sidebar_left_close_replace' => '',
600
-        'geodir_main_content_open_id' => '',
601
-        'geodir_main_content_open_class' => '',
602
-        'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
603
-        'geodir_main_content_close_replace' => '',
604
-        'geodir_top_content_add' => '',
605
-        'geodir_before_main_content_add' => '',
606
-        'geodir_before_widget_filter' => '',
607
-        'geodir_after_widget_filter' => '',
608
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
609
-        '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}'),
610
-        'geodir_theme_compat_js' => '',
611
-        'geodir_theme_compat_default_options' => '',
612
-        'geodir_theme_compat_code' => 'Genesis'
613
-    );
579
+	$theme_compat['Genesis'] = array(
580
+		'geodir_wrapper_open_id' => '',
581
+		'geodir_wrapper_open_class' => 'content-sidebar-wrap',
582
+		'geodir_wrapper_open_replace' => '',
583
+		'geodir_wrapper_close_replace' => '',
584
+		'geodir_wrapper_content_open_id' => '',
585
+		'geodir_wrapper_content_open_class' => 'content',
586
+		'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
587
+		'geodir_wrapper_content_close_replace' => '',
588
+		'geodir_article_open_id' => '',
589
+		'geodir_article_open_class' => '',
590
+		'geodir_article_open_replace' => '',
591
+		'geodir_article_close_replace' => '',
592
+		'geodir_sidebar_right_open_id' => '',
593
+		'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
594
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
595
+		'geodir_sidebar_right_close_replace' => '',
596
+		'geodir_sidebar_left_open_id' => '',
597
+		'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
598
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
599
+		'geodir_sidebar_left_close_replace' => '',
600
+		'geodir_main_content_open_id' => '',
601
+		'geodir_main_content_open_class' => '',
602
+		'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
603
+		'geodir_main_content_close_replace' => '',
604
+		'geodir_top_content_add' => '',
605
+		'geodir_before_main_content_add' => '',
606
+		'geodir_before_widget_filter' => '',
607
+		'geodir_after_widget_filter' => '',
608
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
609
+		'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}'),
610
+		'geodir_theme_compat_js' => '',
611
+		'geodir_theme_compat_default_options' => '',
612
+		'geodir_theme_compat_code' => 'Genesis'
613
+	);
614 614
 
615 615
 // Jupiter
616
-    $theme_compat['Jupiter'] = array(
617
-        'geodir_wrapper_open_id' => '',
618
-        'geodir_wrapper_open_class' => '',
619
-        '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">',
620
-        'geodir_wrapper_close_replace' => '</div></div></div>',
621
-        'geodir_wrapper_content_open_id' => '',
622
-        'geodir_wrapper_content_open_class' => '',
623
-        'geodir_wrapper_content_open_replace' => '',
624
-        'geodir_wrapper_content_close_replace' => '',
625
-        'geodir_article_open_id' => '',
626
-        'geodir_article_open_class' => '',
627
-        'geodir_article_open_replace' => '',
628
-        'geodir_article_close_replace' => '',
629
-        'geodir_sidebar_right_open_id' => 'mk-sidebar',
630
-        'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
631
-        'geodir_sidebar_right_open_replace' => '',
632
-        'geodir_sidebar_right_close_replace' => '',
633
-        'geodir_sidebar_left_open_id' => 'mk-sidebar',
634
-        'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
635
-        'geodir_sidebar_left_open_replace' => '',
636
-        'geodir_sidebar_left_close_replace' => '',
637
-        'geodir_main_content_open_id' => '',
638
-        'geodir_main_content_open_class' => '',
639
-        'geodir_main_content_open_replace' => '',
640
-        'geodir_main_content_close_replace' => '',
641
-        'geodir_top_content_add' => '',
642
-        'geodir_before_main_content_add' => '',
643
-        'geodir_before_widget_filter' => '',
644
-        'geodir_after_widget_filter' => '',
645
-        'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
646
-        'geodir_after_title_filter' => '',
647
-        'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
648
-        'geodir_sub_menu_ul_class_filter' => '',
649
-        'geodir_sub_menu_li_class_filter' => '',
650
-        'geodir_menu_a_class_filter' => 'menu-item-link',
651
-        'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
652
-        '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',
653
-        'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
654
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
655
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
656
-        '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}'),
657
-        'geodir_theme_compat_js' => '',
658
-        'geodir_theme_compat_default_options' => '',
659
-        'geodir_theme_compat_code' => 'Jupiter'
660
-    );
616
+	$theme_compat['Jupiter'] = array(
617
+		'geodir_wrapper_open_id' => '',
618
+		'geodir_wrapper_open_class' => '',
619
+		'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">',
620
+		'geodir_wrapper_close_replace' => '</div></div></div>',
621
+		'geodir_wrapper_content_open_id' => '',
622
+		'geodir_wrapper_content_open_class' => '',
623
+		'geodir_wrapper_content_open_replace' => '',
624
+		'geodir_wrapper_content_close_replace' => '',
625
+		'geodir_article_open_id' => '',
626
+		'geodir_article_open_class' => '',
627
+		'geodir_article_open_replace' => '',
628
+		'geodir_article_close_replace' => '',
629
+		'geodir_sidebar_right_open_id' => 'mk-sidebar',
630
+		'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
631
+		'geodir_sidebar_right_open_replace' => '',
632
+		'geodir_sidebar_right_close_replace' => '',
633
+		'geodir_sidebar_left_open_id' => 'mk-sidebar',
634
+		'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
635
+		'geodir_sidebar_left_open_replace' => '',
636
+		'geodir_sidebar_left_close_replace' => '',
637
+		'geodir_main_content_open_id' => '',
638
+		'geodir_main_content_open_class' => '',
639
+		'geodir_main_content_open_replace' => '',
640
+		'geodir_main_content_close_replace' => '',
641
+		'geodir_top_content_add' => '',
642
+		'geodir_before_main_content_add' => '',
643
+		'geodir_before_widget_filter' => '',
644
+		'geodir_after_widget_filter' => '',
645
+		'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
646
+		'geodir_after_title_filter' => '',
647
+		'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
648
+		'geodir_sub_menu_ul_class_filter' => '',
649
+		'geodir_sub_menu_li_class_filter' => '',
650
+		'geodir_menu_a_class_filter' => 'menu-item-link',
651
+		'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
652
+		'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',
653
+		'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
654
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
655
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
656
+		'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}'),
657
+		'geodir_theme_compat_js' => '',
658
+		'geodir_theme_compat_default_options' => '',
659
+		'geodir_theme_compat_code' => 'Jupiter'
660
+	);
661 661
 
662 662
 // Multi News
663
-    $theme_compat['Multi_News'] = array(
664
-        'geodir_wrapper_open_id' => '',
665
-        'geodir_wrapper_open_class' => 'main-container clearfix',
666
-        'geodir_wrapper_open_replace' => '',
667
-        'geodir_wrapper_close_replace' => '',
668
-        'geodir_wrapper_content_open_id' => '',
669
-        'geodir_wrapper_content_open_class' => '',
670
-        'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
671
-        'geodir_wrapper_content_close_replace' => '</div></div></div>',
672
-        'geodir_article_open_id' => '',
673
-        'geodir_article_open_class' => '',
674
-        'geodir_article_open_replace' => '',
675
-        'geodir_article_close_replace' => '',
676
-        'geodir_sidebar_right_open_id' => '',
677
-        'geodir_sidebar_right_open_class' => '',
678
-        'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
679
-        'geodir_sidebar_right_close_replace' => '',
680
-        'geodir_sidebar_left_open_id' => '',
681
-        'geodir_sidebar_left_open_class' => '',
682
-        'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
683
-        'geodir_sidebar_left_close_replace' => '',
684
-        'geodir_main_content_open_id' => '',
685
-        'geodir_main_content_open_class' => '',
686
-        'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
687
-        'geodir_main_content_close_replace' => '</div>',
688
-        'geodir_top_content_add' => '',
689
-        'geodir_before_main_content_add' => '',
690
-        'geodir_full_page_class_filter' => 'section full-width-section',
691
-        'geodir_before_widget_filter' => '',
692
-        'geodir_after_widget_filter' => '',
693
-        'geodir_before_title_filter' => '<div class="widget-title"><h2>',
694
-        'geodir_after_title_filter' => '</h2></div>',
695
-        'geodir_menu_li_class_filter' => '',
696
-        'geodir_sub_menu_ul_class_filter' => '',
697
-        'geodir_sub_menu_li_class_filter' => '',
698
-        'geodir_menu_a_class_filter' => '',
699
-        'geodir_sub_menu_a_class_filter' => '',
700
-        'geodir_location_switcher_menu_li_class_filter' => '',
701
-        'geodir_location_switcher_menu_a_class_filter' => '',
702
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
703
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
704
-        '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}'),
705
-        '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"})});',
706
-        'geodir_theme_compat_default_options' => '',
707
-        'geodir_theme_compat_code' => 'Multi_News'
708
-    );
709
-
710
-    update_option('gd_theme_compats', $theme_compat);
711
-
712
-    gd_set_theme_compat();// set the compat pack if avail
663
+	$theme_compat['Multi_News'] = array(
664
+		'geodir_wrapper_open_id' => '',
665
+		'geodir_wrapper_open_class' => 'main-container clearfix',
666
+		'geodir_wrapper_open_replace' => '',
667
+		'geodir_wrapper_close_replace' => '',
668
+		'geodir_wrapper_content_open_id' => '',
669
+		'geodir_wrapper_content_open_class' => '',
670
+		'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
671
+		'geodir_wrapper_content_close_replace' => '</div></div></div>',
672
+		'geodir_article_open_id' => '',
673
+		'geodir_article_open_class' => '',
674
+		'geodir_article_open_replace' => '',
675
+		'geodir_article_close_replace' => '',
676
+		'geodir_sidebar_right_open_id' => '',
677
+		'geodir_sidebar_right_open_class' => '',
678
+		'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
679
+		'geodir_sidebar_right_close_replace' => '',
680
+		'geodir_sidebar_left_open_id' => '',
681
+		'geodir_sidebar_left_open_class' => '',
682
+		'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
683
+		'geodir_sidebar_left_close_replace' => '',
684
+		'geodir_main_content_open_id' => '',
685
+		'geodir_main_content_open_class' => '',
686
+		'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
687
+		'geodir_main_content_close_replace' => '</div>',
688
+		'geodir_top_content_add' => '',
689
+		'geodir_before_main_content_add' => '',
690
+		'geodir_full_page_class_filter' => 'section full-width-section',
691
+		'geodir_before_widget_filter' => '',
692
+		'geodir_after_widget_filter' => '',
693
+		'geodir_before_title_filter' => '<div class="widget-title"><h2>',
694
+		'geodir_after_title_filter' => '</h2></div>',
695
+		'geodir_menu_li_class_filter' => '',
696
+		'geodir_sub_menu_ul_class_filter' => '',
697
+		'geodir_sub_menu_li_class_filter' => '',
698
+		'geodir_menu_a_class_filter' => '',
699
+		'geodir_sub_menu_a_class_filter' => '',
700
+		'geodir_location_switcher_menu_li_class_filter' => '',
701
+		'geodir_location_switcher_menu_a_class_filter' => '',
702
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
703
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
704
+		'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}'),
705
+		'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"})});',
706
+		'geodir_theme_compat_default_options' => '',
707
+		'geodir_theme_compat_code' => 'Multi_News'
708
+	);
709
+
710
+	update_option('gd_theme_compats', $theme_compat);
711
+
712
+	gd_set_theme_compat();// set the compat pack if avail
713 713
 }
714 714
 
715 715
 
@@ -721,61 +721,61 @@  discard block
 block discarded – undo
721 721
  * @global object $wpdb WordPress Database object.
722 722
  */
723 723
 function gd_convert_virtual_pages(){
724
-    global $wpdb;
725
-
726
-    // Update the add listing page settings
727
-    $add_listing_page = $wpdb->get_var(
728
-        $wpdb->prepare(
729
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
730
-            array('add-listing')
731
-        )
732
-    );
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);
737
-    }
738
-
739
-    // Update the listing preview page settings
740
-    $listing_preview_page = $wpdb->get_var(
741
-        $wpdb->prepare(
742
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
743
-            array('listing-preview')
744
-        )
745
-    );
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);
750
-    }
751
-
752
-    // Update the listing success page settings
753
-    $listing_success_page = $wpdb->get_var(
754
-        $wpdb->prepare(
755
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
756
-            array('listing-success')
757
-        )
758
-    );
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);
763
-    }
764
-
765
-    // Update the listing success page settings
766
-    $location_page = $wpdb->get_var(
767
-        $wpdb->prepare(
768
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
769
-            array('location')
770
-        )
771
-    );
772
-
773
-    if($location_page){
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);
778
-    }
724
+	global $wpdb;
725
+
726
+	// Update the add listing page settings
727
+	$add_listing_page = $wpdb->get_var(
728
+		$wpdb->prepare(
729
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
730
+			array('add-listing')
731
+		)
732
+	);
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);
737
+	}
738
+
739
+	// Update the listing preview page settings
740
+	$listing_preview_page = $wpdb->get_var(
741
+		$wpdb->prepare(
742
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
743
+			array('listing-preview')
744
+		)
745
+	);
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);
750
+	}
751
+
752
+	// Update the listing success page settings
753
+	$listing_success_page = $wpdb->get_var(
754
+		$wpdb->prepare(
755
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
756
+			array('listing-success')
757
+		)
758
+	);
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);
763
+	}
764
+
765
+	// Update the listing success page settings
766
+	$location_page = $wpdb->get_var(
767
+		$wpdb->prepare(
768
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
769
+			array('location')
770
+		)
771
+	);
772
+
773
+	if($location_page){
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);
778
+	}
779 779
 
780 780
 }
781 781
 
@@ -789,31 +789,31 @@  discard block
 block discarded – undo
789 789
 function gd_fix_cpt_rewrite_slug()
790 790
 {
791 791
 
792
-    $alt_post_types = array();
793
-    $post_types = get_option('geodir_post_types');
792
+	$alt_post_types = array();
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
-        foreach ($post_types as $post_type => $args) {
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']);
803
-            }
801
+			if(isset($args['rewrite']['slug'])){
802
+				$args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
803
+			}
804 804
 
805
-                $alt_post_types[$post_type] = $args;
805
+				$alt_post_types[$post_type] = $args;
806 806
 
807
-        }
808
-    }
807
+		}
808
+	}
809 809
 
810
-    if(!empty($alt_post_types)) {
811
-        update_option('geodir_post_types',$alt_post_types);
812
-        }
810
+	if(!empty($alt_post_types)) {
811
+		update_option('geodir_post_types',$alt_post_types);
812
+		}
813 813
 
814 814
 
815
-    // flush the rewrite rules
816
-    flush_rewrite_rules();
815
+	// flush the rewrite rules
816
+	flush_rewrite_rules();
817 817
 }
818 818
 
819 819
 
@@ -826,18 +826,18 @@  discard block
 block discarded – undo
826 826
  */
827 827
 function gd_fix_address_detail_table_limit()
828 828
 {
829
-    global $wpdb;
830
-
831
-    $all_postypes = geodir_get_posttypes();
832
-
833
-    if (!empty($all_postypes)) {
834
-        foreach ($all_postypes as $key) {
835
-            // update each GD CTP
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() );
840
-            }
841
-        }
842
-    }
829
+	global $wpdb;
830
+
831
+	$all_postypes = geodir_get_posttypes();
832
+
833
+	if (!empty($all_postypes)) {
834
+		foreach ($all_postypes as $key) {
835
+			// update each GD CTP
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() );
840
+			}
841
+		}
842
+	}
843 843
 }
Please login to merge, or discard this patch.
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.
geodirectory-functions/post_functions.php 1 patch
Indentation   +2212 added lines, -2212 removed lines patch added patch discarded remove patch
@@ -20,479 +20,479 @@  discard block
 block discarded – undo
20 20
 function geodir_set_postcat_structure($post_id, $taxonomy, $default_cat = '', $category_str = '')
21 21
 {
22 22
 
23
-    $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
-    if (!empty($post_cat_ids))
25
-        $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
-
27
-    if (!isset($default_cat) || empty($default_cat)) {
28
-        $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
31
-            $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
34
-            }
35
-        }
23
+	$post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
+	if (!empty($post_cat_ids))
25
+		$post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+
27
+	if (!isset($default_cat) || empty($default_cat)) {
28
+		$default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
+	}else{
30
+		if(!is_int($default_cat)){
31
+			$category = get_term_by('name', $default_cat, $taxonomy);
32
+			if(isset($category->term_id)){
33
+				$default_cat =  $category->term_id;
34
+			}
35
+		}
36 36
 
37
-    }
37
+	}
38 38
 
39 39
 
40
-    geodir_save_post_meta($post_id, 'default_category', $default_cat);
40
+	geodir_save_post_meta($post_id, 'default_category', $default_cat);
41 41
 
42
-    if (isset($category_str) && empty($category_str)) {
42
+	if (isset($category_str) && empty($category_str)) {
43 43
 
44
-        $post_cat_str = '';
45
-        $post_categories = array();
46
-        if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
-            $post_cat_str = implode(",y:#", $post_cat_array);
48
-            $post_cat_str .= ",y:";
49
-            $post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
-        }
51
-        $post_categories[$taxonomy] = $post_cat_str;
52
-        $category_str = $post_categories;
53
-    }
44
+		$post_cat_str = '';
45
+		$post_categories = array();
46
+		if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
+			$post_cat_str = implode(",y:#", $post_cat_array);
48
+			$post_cat_str .= ",y:";
49
+			$post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
+		}
51
+		$post_categories[$taxonomy] = $post_cat_str;
52
+		$category_str = $post_categories;
53
+	}
54 54
 
55
-    $change_cat_str = $category_str[$taxonomy];
55
+	$change_cat_str = $category_str[$taxonomy];
56 56
 
57
-    $default_pos = strpos($change_cat_str, 'd:');
57
+	$default_pos = strpos($change_cat_str, 'd:');
58 58
 
59
-    if ($default_pos === false) {
59
+	if ($default_pos === false) {
60 60
 
61
-        $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
61
+		$change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
62 62
 
63
-    }
63
+	}
64 64
 
65
-    $category_str[$taxonomy] = $change_cat_str;
65
+	$category_str[$taxonomy] = $change_cat_str;
66 66
 
67
-    update_post_meta($post_id, 'post_categories', $category_str);
67
+	update_post_meta($post_id, 'post_categories', $category_str);
68 68
 
69 69
 }
70 70
 
71 71
 
72 72
 if (!function_exists('geodir_save_listing')) {
73
-    /**
74
-     * Saves listing in the database using given information.
75
-     *
76
-     * @since 1.0.0
77
-     * @since 1.5.4 New parameter $wp_error added.
78
-     * @package GeoDirectory
79
-     * @global object $wpdb WordPress Database object.
80
-     * @global object $post The current post object.
81
-     * @global object $current_user Current user object.
73
+	/**
74
+	 * Saves listing in the database using given information.
75
+	 *
76
+	 * @since 1.0.0
77
+	 * @since 1.5.4 New parameter $wp_error added.
78
+	 * @package GeoDirectory
79
+	 * @global object $wpdb WordPress Database object.
80
+	 * @global object $post The current post object.
81
+	 * @global object $current_user Current user object.
82 82
 	 * @global object $gd_session GeoDirectory Session object.
83
-     * @param array $request_info {
84
-     *    Array of request info arguments.
85
-     *
86
-     *    @type string $action                                  Ajax action name.
87
-     *    @type string $geodir_ajax                             Ajax type.
88
-     *    @type string $ajax_action                             Ajax action.
89
-     *    @type string $listing_type                            Listing type.
90
-     *    @type string $pid                                     Default Post ID.
91
-     *    @type string $preview                                 Todo Desc needed.
92
-     *    @type string $add_listing_page_id                     Add listing page ID.
93
-     *    @type string $post_title                              Listing title.
94
-     *    @type string $post_desc                               Listing Description.
95
-     *    @type string $post_tags                               Listing tags.
96
-     *    @type array  $cat_limit                               Category limit.
97
-     *    @type array  $post_category                           Category IDs.
98
-     *    @type array  $post_category_str                       Category string.
99
-     *    @type string $post_default_category                   Default category ID.
100
-     *    @type string $post_address                            Listing address.
101
-     *    @type string $geodir_location_add_listing_country_val Add listing country value.
102
-     *    @type string $post_country                            Listing country.
103
-     *    @type string $geodir_location_add_listing_region_val  Add listing region value.
104
-     *    @type string $post_region                             Listing region.
105
-     *    @type string $geodir_location_add_listing_city_val    Add listing city value.
106
-     *    @type string $post_city                               Listing city.
107
-     *    @type string $post_zip                                Listing zip.
108
-     *    @type string $post_latitude                           Listing latitude.
109
-     *    @type string $post_longitude                          Listing longitude.
110
-     *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
111
-     *    @type string $post_mapzoom                            Listing mapzoom Default "9".
112
-     *    @type string $geodir_timing                           Business timing info.
113
-     *    @type string $geodir_contact                          Contact number.
114
-     *    @type string $geodir_email                            Business contact email.
115
-     *    @type string $geodir_website                          Business website.
116
-     *    @type string $geodir_twitter                          Twitter link.
117
-     *    @type string $geodir_facebook                         Facebook link.
118
-     *    @type string $geodir_video                            Video link.
119
-     *    @type string $geodir_special_offers                   Speacial offers.
120
-     *    @type string $post_images                             Post image urls.
121
-     *    @type string $post_imagesimage_limit                  Post images limit.
122
-     *    @type string $post_imagestotImg                       Todo Desc needed.
123
-     *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
124
-     *    @type string $geodir_spamblocker                      Todo Desc needed.
125
-     *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
126
-     *
127
-     * }
128
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
129
-     * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
130
-     * @return int|string|WP_Error Created post id or WP_Error on failure.
131
-     */
132
-    function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
133
-    {
134
-        global $wpdb, $current_user, $gd_session;
135
-
136
-        $last_post_id = '';
137
-
138
-        if ($gd_session->get('listing') && !$dummy) {
139
-            $request_info = array();
140
-            $request_session = $gd_session->get('listing');
141
-            $request_info = array_merge($_REQUEST, $request_session);
142
-        } else if (!$gd_session->get('listing') && !$dummy) {
143
-            global $post;
144
-            $request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
145
-            $request_info['post_title'] = $request_info['post_title'];
146
-            $request_info['listing_type'] = $post->post_type;
147
-            $request_info['post_desc'] = $request_info['content'];
148
-        } else if (!$dummy) {
149
-            return false;
150
-        }
151
-
152
-        /**
153
-         * Filter the request_info array.
154
-         *
155
-         * You can use this filter to modify request_info array.
156
-         *
157
-         * @since 1.0.0
158
-         * @package GeoDirectory
159
-         * @param array $request_info See {@see geodir_save_listing()} for accepted args.
160
-         */
161
-        $request_info = apply_filters('geodir_action_get_request_info', $request_info);
162
-
163
-        // Check if we need to save post location as new location
164
-        $location_result = geodir_get_default_location();
165
-
166
-        if ($location_result->location_id > 0) {
167
-            if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
168
-                $request_info['post_location'] = array(
169
-                    'city' => $request_info['post_city'],
170
-                    'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
171
-                    'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
172
-                    'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
173
-                    'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
174
-                );
175
-
176
-                $post_location_info = $request_info['post_location'];
177
-
178
-                if ($location_id = geodir_add_new_location($post_location_info)) {
179
-                    $post_location_id = $location_id;
180
-                }
181
-            } else {
182
-                $post_location_id = $location_result->location_id;
183
-            }
184
-        } else {
185
-            $post_location_id = $location_result->location_id;
186
-        }
187
-
188
-        if ($dummy) {
189
-            $post_status = 'publish';
190
-        } else {
191
-            $post_status = geodir_new_post_default_status();
192
-        }
193
-
194
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
195
-            $post_status = get_post_status($request_info['pid']);
196
-        }
197
-
198
-        /* fix change of slug on every title edit */
199
-        if (!isset($request_info['post_name'])) {
200
-            $request_info['post_name'] = $request_info['post_title'];
201
-
202
-            if (!empty($request_info['pid'])) {
203
-                $post_info = get_post($request_info['pid']);
204
-
205
-                if (!empty($post_info) && isset($post_info->post_name)) {
206
-                    $request_info['post_name'] = $post_info->post_name;
207
-                }
208
-            }
209
-        }
210
-
211
-        $post = array(
212
-            'post_content' => $request_info['post_desc'],
213
-            'post_status' => $post_status,
214
-            'post_title' => $request_info['post_title'],
215
-            'post_name' => $request_info['post_name'],
216
-            'post_type' => $request_info['listing_type']
217
-        );
218
-
219
-        /**
220
-         * Called before a listing is saved to the database.
221
-         *
222
-         * @since 1.0.0
223
-         * @param object $post The post object.
224
-         */
225
-        do_action_ref_array('geodir_before_save_listing', $post);
83
+	 * @param array $request_info {
84
+	 *    Array of request info arguments.
85
+	 *
86
+	 *    @type string $action                                  Ajax action name.
87
+	 *    @type string $geodir_ajax                             Ajax type.
88
+	 *    @type string $ajax_action                             Ajax action.
89
+	 *    @type string $listing_type                            Listing type.
90
+	 *    @type string $pid                                     Default Post ID.
91
+	 *    @type string $preview                                 Todo Desc needed.
92
+	 *    @type string $add_listing_page_id                     Add listing page ID.
93
+	 *    @type string $post_title                              Listing title.
94
+	 *    @type string $post_desc                               Listing Description.
95
+	 *    @type string $post_tags                               Listing tags.
96
+	 *    @type array  $cat_limit                               Category limit.
97
+	 *    @type array  $post_category                           Category IDs.
98
+	 *    @type array  $post_category_str                       Category string.
99
+	 *    @type string $post_default_category                   Default category ID.
100
+	 *    @type string $post_address                            Listing address.
101
+	 *    @type string $geodir_location_add_listing_country_val Add listing country value.
102
+	 *    @type string $post_country                            Listing country.
103
+	 *    @type string $geodir_location_add_listing_region_val  Add listing region value.
104
+	 *    @type string $post_region                             Listing region.
105
+	 *    @type string $geodir_location_add_listing_city_val    Add listing city value.
106
+	 *    @type string $post_city                               Listing city.
107
+	 *    @type string $post_zip                                Listing zip.
108
+	 *    @type string $post_latitude                           Listing latitude.
109
+	 *    @type string $post_longitude                          Listing longitude.
110
+	 *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
111
+	 *    @type string $post_mapzoom                            Listing mapzoom Default "9".
112
+	 *    @type string $geodir_timing                           Business timing info.
113
+	 *    @type string $geodir_contact                          Contact number.
114
+	 *    @type string $geodir_email                            Business contact email.
115
+	 *    @type string $geodir_website                          Business website.
116
+	 *    @type string $geodir_twitter                          Twitter link.
117
+	 *    @type string $geodir_facebook                         Facebook link.
118
+	 *    @type string $geodir_video                            Video link.
119
+	 *    @type string $geodir_special_offers                   Speacial offers.
120
+	 *    @type string $post_images                             Post image urls.
121
+	 *    @type string $post_imagesimage_limit                  Post images limit.
122
+	 *    @type string $post_imagestotImg                       Todo Desc needed.
123
+	 *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
124
+	 *    @type string $geodir_spamblocker                      Todo Desc needed.
125
+	 *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
126
+	 *
127
+	 * }
128
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
129
+	 * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
130
+	 * @return int|string|WP_Error Created post id or WP_Error on failure.
131
+	 */
132
+	function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
133
+	{
134
+		global $wpdb, $current_user, $gd_session;
135
+
136
+		$last_post_id = '';
137
+
138
+		if ($gd_session->get('listing') && !$dummy) {
139
+			$request_info = array();
140
+			$request_session = $gd_session->get('listing');
141
+			$request_info = array_merge($_REQUEST, $request_session);
142
+		} else if (!$gd_session->get('listing') && !$dummy) {
143
+			global $post;
144
+			$request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
145
+			$request_info['post_title'] = $request_info['post_title'];
146
+			$request_info['listing_type'] = $post->post_type;
147
+			$request_info['post_desc'] = $request_info['content'];
148
+		} else if (!$dummy) {
149
+			return false;
150
+		}
151
+
152
+		/**
153
+		 * Filter the request_info array.
154
+		 *
155
+		 * You can use this filter to modify request_info array.
156
+		 *
157
+		 * @since 1.0.0
158
+		 * @package GeoDirectory
159
+		 * @param array $request_info See {@see geodir_save_listing()} for accepted args.
160
+		 */
161
+		$request_info = apply_filters('geodir_action_get_request_info', $request_info);
162
+
163
+		// Check if we need to save post location as new location
164
+		$location_result = geodir_get_default_location();
165
+
166
+		if ($location_result->location_id > 0) {
167
+			if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
168
+				$request_info['post_location'] = array(
169
+					'city' => $request_info['post_city'],
170
+					'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
171
+					'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
172
+					'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
173
+					'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
174
+				);
175
+
176
+				$post_location_info = $request_info['post_location'];
177
+
178
+				if ($location_id = geodir_add_new_location($post_location_info)) {
179
+					$post_location_id = $location_id;
180
+				}
181
+			} else {
182
+				$post_location_id = $location_result->location_id;
183
+			}
184
+		} else {
185
+			$post_location_id = $location_result->location_id;
186
+		}
226 187
 
227
-        $send_post_submit_mail = false;
188
+		if ($dummy) {
189
+			$post_status = 'publish';
190
+		} else {
191
+			$post_status = geodir_new_post_default_status();
192
+		}
228 193
 
229
-        // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
194
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
195
+			$post_status = get_post_status($request_info['pid']);
196
+		}
231 197
 
232
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
-            $post['ID'] = $request_info['pid'];
198
+		/* fix change of slug on every title edit */
199
+		if (!isset($request_info['post_name'])) {
200
+			$request_info['post_name'] = $request_info['post_title'];
234 201
 
235
-            $last_post_id = wp_update_post($post, $wp_error);
236
-        } else {
237
-            $last_post_id = wp_insert_post($post, $wp_error);
202
+			if (!empty($request_info['pid'])) {
203
+				$post_info = get_post($request_info['pid']);
238 204
 
239
-            if (!$dummy && $last_post_id) {
240
-                $send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
241
-                //geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
242
-            }
243
-        }
205
+				if (!empty($post_info) && isset($post_info->post_name)) {
206
+					$request_info['post_name'] = $post_info->post_name;
207
+				}
208
+			}
209
+		}
210
+
211
+		$post = array(
212
+			'post_content' => $request_info['post_desc'],
213
+			'post_status' => $post_status,
214
+			'post_title' => $request_info['post_title'],
215
+			'post_name' => $request_info['post_name'],
216
+			'post_type' => $request_info['listing_type']
217
+		);
218
+
219
+		/**
220
+		 * Called before a listing is saved to the database.
221
+		 *
222
+		 * @since 1.0.0
223
+		 * @param object $post The post object.
224
+		 */
225
+		do_action_ref_array('geodir_before_save_listing', $post);
226
+
227
+		$send_post_submit_mail = false;
228
+
229
+		// unhook this function so it doesn't loop infinitely
230
+		remove_action('save_post', 'geodir_post_information_save',10,2);
231
+
232
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
+			$post['ID'] = $request_info['pid'];
234
+
235
+			$last_post_id = wp_update_post($post, $wp_error);
236
+		} else {
237
+			$last_post_id = wp_insert_post($post, $wp_error);
238
+
239
+			if (!$dummy && $last_post_id) {
240
+				$send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
241
+				//geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
242
+			}
243
+		}
244 244
 
245
-        if ($wp_error && is_wp_error($last_post_id)) {
246
-            return $last_post_id; // Return WP_Error on save failure.
247
-        }
245
+		if ($wp_error && is_wp_error($last_post_id)) {
246
+			return $last_post_id; // Return WP_Error on save failure.
247
+		}
248 248
 
249
-        if (!$last_post_id) {
250
-            return false; // Save failure.
251
-        }
249
+		if (!$last_post_id) {
250
+			return false; // Save failure.
251
+		}
252 252
 
253
-        // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
253
+		// re-hook this function
254
+		add_action('save_post', 'geodir_post_information_save',10,2);
255 255
 
256
-        $post_tags = '';
257
-        if (!isset($request_info['post_tags'])) {
256
+		$post_tags = '';
257
+		if (!isset($request_info['post_tags'])) {
258 258
 
259
-            $post_type = $request_info['listing_type'];
260
-            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
259
+			$post_type = $request_info['listing_type'];
260
+			$post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
261 261
 
262
-        }
262
+		}
263 263
 
264
-        $gd_post_info = array(
265
-            "post_title" => $request_info['post_title'],
266
-            "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
267
-            "post_status" => $post_status,
268
-            "post_location_id" => $post_location_id,
269
-            "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
270
-            "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
271
-            "submit_time" => time(),
272
-            "submit_ip" => $_SERVER['REMOTE_ADDR'],
273
-        );
264
+		$gd_post_info = array(
265
+			"post_title" => $request_info['post_title'],
266
+			"post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
267
+			"post_status" => $post_status,
268
+			"post_location_id" => $post_location_id,
269
+			"claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
270
+			"businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
271
+			"submit_time" => time(),
272
+			"submit_ip" => $_SERVER['REMOTE_ADDR'],
273
+		);
274 274
 
275
-        $payment_info = array();
276
-        $package_info = array();
275
+		$payment_info = array();
276
+		$package_info = array();
277 277
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
278
+		$package_info = (array)geodir_post_package_info($package_info, $post);
279 279
 
280
-        $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
280
+		$post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
281 281
 
282
-        if (!empty($package_info) && !$post_package_id) {
283
-            if (isset($package_info['days']) && $package_info['days'] != 0) {
284
-                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
285
-            } else {
286
-                $payment_info['expire_date'] = 'Never';
287
-            }
282
+		if (!empty($package_info) && !$post_package_id) {
283
+			if (isset($package_info['days']) && $package_info['days'] != 0) {
284
+				$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
285
+			} else {
286
+				$payment_info['expire_date'] = 'Never';
287
+			}
288 288
 
289
-            $payment_info['package_id'] = $package_info['pid'];
290
-            $payment_info['alive_days'] = $package_info['days'];
291
-            $payment_info['is_featured'] = $package_info['is_featured'];
289
+			$payment_info['package_id'] = $package_info['pid'];
290
+			$payment_info['alive_days'] = $package_info['days'];
291
+			$payment_info['is_featured'] = $package_info['is_featured'];
292 292
 
293
-            $gd_post_info = array_merge($gd_post_info, $payment_info);
294
-        }
293
+			$gd_post_info = array_merge($gd_post_info, $payment_info);
294
+		}
295 295
 
296
-        $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
296
+		$custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
297 297
 
298
-        foreach ($custom_metaboxes as $key => $val):
298
+		foreach ($custom_metaboxes as $key => $val):
299 299
 
300
-            $name = $val['name'];
301
-            $type = $val['type'];
302
-            $extrafields = $val['extra_fields'];
300
+			$name = $val['name'];
301
+			$type = $val['type'];
302
+			$extrafields = $val['extra_fields'];
303 303
 
304
-            if (trim($type) == 'address') {
305
-                $prefix = $name . '_';
306
-                $address = $prefix . 'address';
304
+			if (trim($type) == 'address') {
305
+				$prefix = $name . '_';
306
+				$address = $prefix . 'address';
307 307
 
308
-                if (isset($request_info[$address]) && $request_info[$address] != '') {
309
-                    $gd_post_info[$address] = wp_slash($request_info[$address]);
310
-                }
308
+				if (isset($request_info[$address]) && $request_info[$address] != '') {
309
+					$gd_post_info[$address] = wp_slash($request_info[$address]);
310
+				}
311 311
 
312
-                if ($extrafields != '') {
313
-                    $extrafields = unserialize($extrafields);
312
+				if ($extrafields != '') {
313
+					$extrafields = unserialize($extrafields);
314 314
 
315 315
 
316
-                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
316
+					if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
317 317
 
318
-                        $location_result = geodir_get_default_location();
318
+						$location_result = geodir_get_default_location();
319 319
 
320
-                        $gd_post_info[$prefix . 'city'] = $location_result->city;
321
-                        $gd_post_info[$prefix . 'region'] = $location_result->region;
322
-                        $gd_post_info[$prefix . 'country'] = $location_result->country;
320
+						$gd_post_info[$prefix . 'city'] = $location_result->city;
321
+						$gd_post_info[$prefix . 'region'] = $location_result->region;
322
+						$gd_post_info[$prefix . 'country'] = $location_result->country;
323 323
 
324
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
324
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
325 325
 
326
-                    } else {
326
+					} else {
327 327
 
328
-                        $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
-                        $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
-                        $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
328
+						$gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
329
+						$gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
330
+						$gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
331 331
 
332
-                        //----------set post locations when import dummy data-------
333
-                        $location_result = geodir_get_default_location();
332
+						//----------set post locations when import dummy data-------
333
+						$location_result = geodir_get_default_location();
334 334
 
335
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
-                        //-----------------------------------------------------------------
335
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
+						//-----------------------------------------------------------------
337 337
 
338
-                    }
338
+					}
339 339
 
340 340
 
341
-                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
-                        $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
343
-                    }
341
+					if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
342
+						$gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
343
+					}
344 344
 
345 345
 
346
-                    if (isset($extrafields['show_map']) && $extrafields['show_map']) {
346
+					if (isset($extrafields['show_map']) && $extrafields['show_map']) {
347 347
 
348
-                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
-                            $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
-                        }
348
+						if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
+							$gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
+						}
351 351
 
352
-                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
-                            $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
-                        }
352
+						if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
+							$gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
+						}
355 355
 
356
-                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
-                            $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
-                        }
356
+						if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
+							$gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
+						}
359 359
 
360
-                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
-                            $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
-                        }
360
+						if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
+							$gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
+						}
363 363
 
364
-                    }
364
+					}
365 365
 
366
-                    // show lat lng
367
-                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
-                        $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
369
-                    }
370
-                }
366
+					// show lat lng
367
+					if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
368
+						$gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
369
+					}
370
+				}
371 371
 
372
-            } elseif (trim($type) == 'file') {
373
-                if (isset($request_info[$name])) {
374
-                    $request_files = array();
375
-                    if ($request_info[$name] != '')
376
-                        $request_files = explode(",", $request_info[$name]);
372
+			} elseif (trim($type) == 'file') {
373
+				if (isset($request_info[$name])) {
374
+					$request_files = array();
375
+					if ($request_info[$name] != '')
376
+						$request_files = explode(",", $request_info[$name]);
377 377
 
378
-                    $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
-                    geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
378
+					$extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
+					geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
380 380
 
381
-                }
382
-            } elseif (trim($type) == 'datepicker') {
383
-                $datetime = '';
384
-                if (isset($request_info[$name]) && $request_info[$name] != '') {
385
-                    $date_format = geodir_default_date_format();
386
-                    if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
387
-                        $extra_fields = unserialize($val['extra_fields']);
388
-                        $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
389
-                    }
381
+				}
382
+			} elseif (trim($type) == 'datepicker') {
383
+				$datetime = '';
384
+				if (isset($request_info[$name]) && $request_info[$name] != '') {
385
+					$date_format = geodir_default_date_format();
386
+					if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
387
+						$extra_fields = unserialize($val['extra_fields']);
388
+						$date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
389
+					}
390 390
 
391
-                    // check if we need to change the format or not
392
-                    $date_format_len = strlen(str_replace(' ', '', $date_format));
393
-                    if($date_format_len>5){// if greater then 5 then it's the old style format.
391
+					// check if we need to change the format or not
392
+					$date_format_len = strlen(str_replace(' ', '', $date_format));
393
+					if($date_format_len>5){// if greater then 5 then it's the old style format.
394 394
 
395
-                        $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
396
-                        $replace = array('d','j','l','m','n','F','Y');//PHP date format
395
+						$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
396
+						$replace = array('d','j','l','m','n','F','Y');//PHP date format
397 397
 
398
-                        $date_format = str_replace($search, $replace, $date_format);
398
+						$date_format = str_replace($search, $replace, $date_format);
399 399
 
400
-                        $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
400
+						$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
401 401
 
402
-                    }else{
403
-                        $post_htmlvar_value = $request_info[$name];
404
-                    }
402
+					}else{
403
+						$post_htmlvar_value = $request_info[$name];
404
+					}
405 405
 
406
-                    $post_htmlvar_value =  geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated
406
+					$post_htmlvar_value =  geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated
407 407
 
408
-                    $datetime = date("Y-m-d", strtotime($post_htmlvar_value)); // save as sql format Y-m-d
408
+					$datetime = date("Y-m-d", strtotime($post_htmlvar_value)); // save as sql format Y-m-d
409 409
 
410
-                }
411
-                $gd_post_info[$name] = $datetime;
412
-            } else if ($type == 'multiselect') {
413
-                if (isset($request_info[$name])) {
414
-                    $gd_post_info[$name] = $request_info[$name];
415
-                } else {
416
-                    if (isset($request_info['gd_field_' . $name])) {
417
-                        $gd_post_info[$name] = ''; /* fix de-select for multiselect */
418
-                    }
419
-                }
420
-            } else if (isset($request_info[$name])) {
421
-                $gd_post_info[$name] = $request_info[$name];
422
-            }
410
+				}
411
+				$gd_post_info[$name] = $datetime;
412
+			} else if ($type == 'multiselect') {
413
+				if (isset($request_info[$name])) {
414
+					$gd_post_info[$name] = $request_info[$name];
415
+				} else {
416
+					if (isset($request_info['gd_field_' . $name])) {
417
+						$gd_post_info[$name] = ''; /* fix de-select for multiselect */
418
+					}
419
+				}
420
+			} else if (isset($request_info[$name])) {
421
+				$gd_post_info[$name] = $request_info[$name];
422
+			}
423 423
 
424
-        endforeach;
424
+		endforeach;
425 425
 
426
-        if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
427
-            $gd_post_info['post_dummy'] = $request_info['post_dummy'];
428
-        }
426
+		if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
427
+			$gd_post_info['post_dummy'] = $request_info['post_dummy'];
428
+		}
429 429
 
430
-        // Save post detail info in detail table
431
-        if (!empty($gd_post_info)) {
432
-            geodir_save_post_info($last_post_id, $gd_post_info);
433
-        }
430
+		// Save post detail info in detail table
431
+		if (!empty($gd_post_info)) {
432
+			geodir_save_post_info($last_post_id, $gd_post_info);
433
+		}
434 434
 
435 435
 
436
-        // Set categories to the listing
437
-        if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
438
-            $post_category = array();
436
+		// Set categories to the listing
437
+		if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
438
+			$post_category = array();
439 439
 
440
-            foreach ($request_info['post_category'] as $taxonomy => $cat) {
440
+			foreach ($request_info['post_category'] as $taxonomy => $cat) {
441 441
 
442
-                if ($dummy)
443
-                    $post_category = $cat;
444
-                else {
442
+				if ($dummy)
443
+					$post_category = $cat;
444
+				else {
445 445
 
446
-                    if (!is_array($cat) && strstr($cat, ','))
447
-                        $cat = explode(',', $cat);
446
+					if (!is_array($cat) && strstr($cat, ','))
447
+						$cat = explode(',', $cat);
448 448
 
449
-                    if (!empty($cat) && is_array($cat))
450
-                        $post_category = array_map('intval', $cat);
451
-                }
449
+					if (!empty($cat) && is_array($cat))
450
+						$post_category = array_map('intval', $cat);
451
+				}
452 452
 
453
-                wp_set_object_terms($last_post_id, $post_category, $taxonomy);
454
-            }
453
+				wp_set_object_terms($last_post_id, $post_category, $taxonomy);
454
+			}
455 455
 
456
-            $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
456
+			$post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
457 457
 
458
-            $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
459
-            geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
458
+			$post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
459
+			geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
460 460
 
461
-        }
461
+		}
462 462
 
463
-        $post_tags = '';
464
-        // Set tags to the listing
465
-        if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
466
-            $post_tags = explode(",", $request_info['post_tags']);
467
-        } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
468
-            if ($dummy)
469
-                $post_tags = $request_info['post_tags'];
470
-        } else {
471
-            if ($dummy)
472
-                $post_tags = array($request_info['post_title']);
473
-        }
463
+		$post_tags = '';
464
+		// Set tags to the listing
465
+		if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
466
+			$post_tags = explode(",", $request_info['post_tags']);
467
+		} elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
468
+			if ($dummy)
469
+				$post_tags = $request_info['post_tags'];
470
+		} else {
471
+			if ($dummy)
472
+				$post_tags = array($request_info['post_title']);
473
+		}
474 474
 
475
-        if (is_array($post_tags)) {
476
-            $taxonomy = $request_info['listing_type'] . '_tags';
477
-            wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
478
-        }
475
+		if (is_array($post_tags)) {
476
+			$taxonomy = $request_info['listing_type'] . '_tags';
477
+			wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
478
+		}
479 479
 
480 480
 
481
-        // Insert attechment
481
+		// Insert attechment
482 482
 
483
-        if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
484
-            if (!$dummy) {
485
-                $tmpimgArr = trim($request_info['post_images'], ",");
486
-                $tmpimgArr = explode(",", $tmpimgArr);
487
-                geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
488
-            } else{
489
-                geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
490
-            }
483
+		if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
484
+			if (!$dummy) {
485
+				$tmpimgArr = trim($request_info['post_images'], ",");
486
+				$tmpimgArr = explode(",", $tmpimgArr);
487
+				geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
488
+			} else{
489
+				geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
490
+			}
491 491
 
492 492
 
493
-        } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
493
+		} elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
494 494
 
495
-            /* Delete Attachments
495
+			/* Delete Attachments
496 496
 			$postcurr_images = geodir_get_images($last_post_id);
497 497
 
498 498
 			$wpdb->query(
@@ -508,34 +508,34 @@  discard block
 block discarded – undo
508 508
 			geodir_save_post_info($last_post_id, $gd_post_featured_img);
509 509
 			*/
510 510
 
511
-        }
511
+		}
512 512
 
513
-        geodir_remove_temp_images();
514
-        geodir_set_wp_featured_image($last_post_id);
513
+		geodir_remove_temp_images();
514
+		geodir_set_wp_featured_image($last_post_id);
515 515
 
516
-        /**
517
-         * Called after a listing is saved to the database and before any email have been sent.
518
-         *
519
-         * @since 1.0.0
520
-         * @param int $last_post_id The saved post ID.
521
-         * @param array $request_info The post details in an array.
522
-         * @see 'geodir_after_save_listinginfo'
523
-         */
524
-        do_action('geodir_after_save_listing', $last_post_id, $request_info);
516
+		/**
517
+		 * Called after a listing is saved to the database and before any email have been sent.
518
+		 *
519
+		 * @since 1.0.0
520
+		 * @param int $last_post_id The saved post ID.
521
+		 * @param array $request_info The post details in an array.
522
+		 * @see 'geodir_after_save_listinginfo'
523
+		 */
524
+		do_action('geodir_after_save_listing', $last_post_id, $request_info);
525 525
 
526
-        //die;
526
+		//die;
527 527
 
528
-        if ($send_post_submit_mail) { // if new post send out email
529
-            $to_name = geodir_get_client_name($current_user->ID);
530
-            geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
531
-        }
532
-        /*
528
+		if ($send_post_submit_mail) { // if new post send out email
529
+			$to_name = geodir_get_client_name($current_user->ID);
530
+			geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
531
+		}
532
+		/*
533 533
          * Unset the session so we don't loop.
534 534
          */
535
-        $gd_session->un_set('listing');
536
-        return $last_post_id;
535
+		$gd_session->un_set('listing');
536
+		return $last_post_id;
537 537
 
538
-    }
538
+	}
539 539
 
540 540
 }
541 541
 
@@ -554,585 +554,585 @@  discard block
 block discarded – undo
554 554
 function geodir_get_post_info($post_id = '')
555 555
 {
556 556
 
557
-    global $wpdb, $plugin_prefix, $post, $post_info;
557
+	global $wpdb, $plugin_prefix, $post, $post_info;
558 558
 
559
-    if ($post_id == '' && !empty($post))
560
-        $post_id = $post->ID;
559
+	if ($post_id == '' && !empty($post))
560
+		$post_id = $post->ID;
561 561
 
562
-    $post_type = get_post_type($post_id);
562
+	$post_type = get_post_type($post_id);
563 563
 
564
-    $all_postypes = geodir_get_posttypes();
564
+	$all_postypes = geodir_get_posttypes();
565 565
 
566
-    if (!in_array($post_type, $all_postypes))
567
-        return false;
566
+	if (!in_array($post_type, $all_postypes))
567
+		return false;
568 568
 
569
-    $table = $plugin_prefix . $post_type . '_detail';
569
+	$table = $plugin_prefix . $post_type . '_detail';
570 570
 
571
-    /**
572
-     * Apply Filter to change Post info
573
-     *
574
-     * You can use this filter to change Post info.
575
-     *
576
-     * @since 1.0.0
577
-     * @package GeoDirectory
578
-     */
579
-    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
571
+	/**
572
+	 * Apply Filter to change Post info
573
+	 *
574
+	 * You can use this filter to change Post info.
575
+	 *
576
+	 * @since 1.0.0
577
+	 * @package GeoDirectory
578
+	 */
579
+	$query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
580 580
 			  WHERE p.ID = pd.post_id
581 581
 			  AND post_id = " . $post_id);
582 582
 
583
-    $post_detail = $wpdb->get_row($query);
583
+	$post_detail = $wpdb->get_row($query);
584 584
 
585
-    return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
585
+	return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
586 586
 
587 587
 }
588 588
 
589 589
 
590 590
 if (!function_exists('geodir_save_post_info')) {
591
-    /**
592
-     * Saves post detail info in detail table.
593
-     *
594
-     * @since 1.0.0
595
-     * @package GeoDirectory
596
-     * @global object $wpdb WordPress Database object.
597
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
598
-     * @param int $post_id The post ID.
599
-     * @param array $postinfo_array {
600
-     *    Post info that needs to be saved in detail table.
601
-     *
602
-     *    @type string $post_title              Listing title.
603
-     *    @type string $post_tags               Listing tags.
604
-     *    @type string $post_status             Listing post status.
605
-     *    @type string $post_location_id        Listing location ID.
606
-     *    @type string $claimed                 Todo Desc needed.
607
-     *    @type string $businesses              Todo Desc needed.
608
-     *    @type int    $submit_time             Submitted time in unix timestamp.
609
-     *    @type string $submit_ip               Submitted IP.
610
-     *    @type string $expire_date             Listing expiration date.
611
-     *    @type int    $package_id              Listing package ID.
612
-     *    @type int    $alive_days              Todo Desc needed.
613
-     *    @type int    $is_featured             Is this a featured listing?.
614
-     *    @type string $post_address            Listing address.
615
-     *    @type string $post_city               Listing city.
616
-     *    @type string $post_region             Listing region.
617
-     *    @type string $post_country            Listing country.
618
-     *    @type string $post_locations          Listing locations.
619
-     *    @type string $post_zip                Listing zip.
620
-     *    @type string $post_latitude           Listing latitude.
621
-     *    @type string $post_longitude          Listing longitude.
622
-     *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
623
-     *    @type string $post_mapzoom            Listing mapzoom Default "9".
624
-     *    @type string $geodir_timing           Business timing info.
625
-     *    @type string $geodir_contact          Contact number.
626
-     *    @type string $geodir_email            Business contact email.
627
-     *    @type string $geodir_website          Business website.
628
-     *    @type string $geodir_twitter          Twitter link.
629
-     *    @type string $geodir_facebook         Facebook link.
630
-     *    @type string $geodir_video            Video link.
631
-     *    @type string $geodir_special_offers   Speacial offers.
632
-     *
633
-     * }
634
-     * @return bool
635
-     */
636
-    function geodir_save_post_info($post_id, $postinfo_array = array())
637
-    {
638
-        global $wpdb, $plugin_prefix;
639
-
640
-        $post_type = get_post_type($post_id);
641
-
642
-        $table = $plugin_prefix . $post_type . '_detail';
643
-
644
-        /**
645
-         * Filter to change Post info
646
-         *
647
-         * You can use this filter to change Post info.
648
-         *
649
-         * @since 1.0.0
650
-         * @package GeoDirectory
651
-         * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
652
-         * @param int $post_id The post ID.
653
-         */
654
-        $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
591
+	/**
592
+	 * Saves post detail info in detail table.
593
+	 *
594
+	 * @since 1.0.0
595
+	 * @package GeoDirectory
596
+	 * @global object $wpdb WordPress Database object.
597
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
598
+	 * @param int $post_id The post ID.
599
+	 * @param array $postinfo_array {
600
+	 *    Post info that needs to be saved in detail table.
601
+	 *
602
+	 *    @type string $post_title              Listing title.
603
+	 *    @type string $post_tags               Listing tags.
604
+	 *    @type string $post_status             Listing post status.
605
+	 *    @type string $post_location_id        Listing location ID.
606
+	 *    @type string $claimed                 Todo Desc needed.
607
+	 *    @type string $businesses              Todo Desc needed.
608
+	 *    @type int    $submit_time             Submitted time in unix timestamp.
609
+	 *    @type string $submit_ip               Submitted IP.
610
+	 *    @type string $expire_date             Listing expiration date.
611
+	 *    @type int    $package_id              Listing package ID.
612
+	 *    @type int    $alive_days              Todo Desc needed.
613
+	 *    @type int    $is_featured             Is this a featured listing?.
614
+	 *    @type string $post_address            Listing address.
615
+	 *    @type string $post_city               Listing city.
616
+	 *    @type string $post_region             Listing region.
617
+	 *    @type string $post_country            Listing country.
618
+	 *    @type string $post_locations          Listing locations.
619
+	 *    @type string $post_zip                Listing zip.
620
+	 *    @type string $post_latitude           Listing latitude.
621
+	 *    @type string $post_longitude          Listing longitude.
622
+	 *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
623
+	 *    @type string $post_mapzoom            Listing mapzoom Default "9".
624
+	 *    @type string $geodir_timing           Business timing info.
625
+	 *    @type string $geodir_contact          Contact number.
626
+	 *    @type string $geodir_email            Business contact email.
627
+	 *    @type string $geodir_website          Business website.
628
+	 *    @type string $geodir_twitter          Twitter link.
629
+	 *    @type string $geodir_facebook         Facebook link.
630
+	 *    @type string $geodir_video            Video link.
631
+	 *    @type string $geodir_special_offers   Speacial offers.
632
+	 *
633
+	 * }
634
+	 * @return bool
635
+	 */
636
+	function geodir_save_post_info($post_id, $postinfo_array = array())
637
+	{
638
+		global $wpdb, $plugin_prefix;
639
+
640
+		$post_type = get_post_type($post_id);
641
+
642
+		$table = $plugin_prefix . $post_type . '_detail';
643
+
644
+		/**
645
+		 * Filter to change Post info
646
+		 *
647
+		 * You can use this filter to change Post info.
648
+		 *
649
+		 * @since 1.0.0
650
+		 * @package GeoDirectory
651
+		 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
652
+		 * @param int $post_id The post ID.
653
+		 */
654
+		$postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
655
+
656
+		if (!empty($postmeta) && $post_id) {
657
+			$post_meta_set_query = '';
658
+
659
+			foreach ($postmeta as $mkey => $mval) {
660
+				if (geodir_column_exist($table, $mkey)) {
661
+					if (is_array($mval)) {
662
+						$mval = implode(",", $mval);
663
+					}
664
+
665
+					$post_meta_set_query .= $mkey . " = '" . $mval . "', ";
666
+				}
667
+			}
655 668
 
656
-        if (!empty($postmeta) && $post_id) {
657
-            $post_meta_set_query = '';
669
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
658 670
 
659
-            foreach ($postmeta as $mkey => $mval) {
660
-                if (geodir_column_exist($table, $mkey)) {
661
-                    if (is_array($mval)) {
662
-                        $mval = implode(",", $mval);
663
-                    }
671
+			$post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
664 672
 
665
-                    $post_meta_set_query .= $mkey . " = '" . $mval . "', ";
666
-                }
667
-            }
673
+			/**
674
+			 * Called before saving the listing info.
675
+			 *
676
+			 * @since 1.0.0
677
+			 * @package GeoDirectory
678
+			 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
679
+			 * @param int $post_id The post ID.
680
+			 */
681
+			do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
668 682
 
669
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
683
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
670 684
 
671
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
685
+				$wpdb->query(
686
+					$wpdb->prepare(
687
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
688
+						array($post_id)
689
+					)
690
+				);
672 691
 
673
-            /**
674
-             * Called before saving the listing info.
675
-             *
676
-             * @since 1.0.0
677
-             * @package GeoDirectory
678
-             * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
679
-             * @param int $post_id The post ID.
680
-             */
681
-            do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
682 692
 
683
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
693
+			} else {
684 694
 
685
-                $wpdb->query(
686
-                    $wpdb->prepare(
687
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
688
-                        array($post_id)
689
-                    )
690
-                );
695
+				$wpdb->query(
696
+					$wpdb->prepare(
697
+						"INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
698
+						array($post_id)
699
+					)
700
+				);
691 701
 
702
+			}
692 703
 
693
-            } else {
704
+			/**
705
+			 * Called after saving the listing info.
706
+			 *
707
+			 * @since 1.0.0
708
+			 * @package GeoDirectory
709
+			 * @param array $postinfo_array Post info that needs to be saved in detail table.
710
+			 * @param int $post_id The post ID.
711
+			 * @see 'geodir_after_save_listing'
712
+			 */
713
+			do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
714
+
715
+			return true;
716
+		} else
717
+			return false;
694 718
 
695
-                $wpdb->query(
696
-                    $wpdb->prepare(
697
-                        "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
698
-                        array($post_id)
699
-                    )
700
-                );
719
+	}
720
+}
701 721
 
702
-            }
703 722
 
704
-            /**
705
-             * Called after saving the listing info.
706
-             *
707
-             * @since 1.0.0
708
-             * @package GeoDirectory
709
-             * @param array $postinfo_array Post info that needs to be saved in detail table.
710
-             * @param int $post_id The post ID.
711
-             * @see 'geodir_after_save_listing'
712
-             */
713
-            do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
723
+if (!function_exists('geodir_save_post_meta')) {
724
+	/**
725
+	 * Save or update post custom fields.
726
+	 *
727
+	 * @since 1.0.0
728
+	 * @package GeoDirectory
729
+	 * @global object $wpdb WordPress Database object.
730
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
731
+	 * @param int $post_id The post ID.
732
+	 * @param string $postmeta Detail table column name.
733
+	 * @param string $meta_value Detail table column value.
734
+	 * @return void|bool
735
+	 */
736
+	function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
737
+	{
738
+
739
+		global $wpdb, $plugin_prefix;
740
+
741
+		$post_type = get_post_type($post_id);
742
+
743
+		$table = $plugin_prefix . $post_type . '_detail';
744
+
745
+		if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
746
+
747
+			if (is_array($meta_value)) {
748
+				$meta_value = implode(",", $meta_value);
749
+			}
714 750
 
715
-            return true;
716
-        } else
717
-            return false;
751
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
718 752
 
719
-    }
720
-}
753
+				$wpdb->query(
754
+					$wpdb->prepare(
755
+						"UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
756
+						array($post_id)
757
+					)
758
+				);
721 759
 
760
+			} else {
722 761
 
723
-if (!function_exists('geodir_save_post_meta')) {
724
-    /**
725
-     * Save or update post custom fields.
726
-     *
727
-     * @since 1.0.0
728
-     * @package GeoDirectory
729
-     * @global object $wpdb WordPress Database object.
730
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
731
-     * @param int $post_id The post ID.
732
-     * @param string $postmeta Detail table column name.
733
-     * @param string $meta_value Detail table column value.
734
-     * @return void|bool
735
-     */
736
-    function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
737
-    {
738
-
739
-        global $wpdb, $plugin_prefix;
740
-
741
-        $post_type = get_post_type($post_id);
742
-
743
-        $table = $plugin_prefix . $post_type . '_detail';
744
-
745
-        if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
746
-
747
-            if (is_array($meta_value)) {
748
-                $meta_value = implode(",", $meta_value);
749
-            }
750
-
751
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
752
-
753
-                $wpdb->query(
754
-                    $wpdb->prepare(
755
-                        "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
756
-                        array($post_id)
757
-                    )
758
-                );
759
-
760
-            } else {
761
-
762
-                $wpdb->query(
763
-                    $wpdb->prepare(
764
-                        "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
765
-                        array($post_id)
766
-                    )
767
-                );
768
-            }
769
-
770
-
771
-        } else
772
-            return false;
773
-    }
762
+				$wpdb->query(
763
+					$wpdb->prepare(
764
+						"INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
765
+						array($post_id)
766
+					)
767
+				);
768
+			}
769
+
770
+
771
+		} else
772
+			return false;
773
+	}
774 774
 }
775 775
 
776 776
 if (!function_exists('geodir_delete_post_meta')) {
777
-    /**
778
-     * Delete post custom fields.
779
-     *
780
-     * @since 1.0.0
781
-     * @package GeoDirectory
782
-     * @global object $wpdb WordPress Database object.
783
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
784
-     * @param int $post_id The post ID.
785
-     * @param string $postmeta Detail table column name.
786
-     * @todo check if this is depreciated
787
-     * @todo Fix unknown variable mval
788
-     * @return bool
789
-     */
790
-    function geodir_delete_post_meta($post_id, $postmeta)
791
-    {
792
-
793
-        global $wpdb, $plugin_prefix;
794
-
795
-        $post_type = get_post_type($post_id);
796
-
797
-        $table = $plugin_prefix . $post_type . '_detail';
798
-
799
-        if (is_array($postmeta) && !empty($postmeta) && $post_id) {
800
-            $post_meta_set_query = '';
801
-
802
-            foreach ($postmeta as $mkey) {
803
-                if ($mval != '')
804
-                    $post_meta_set_query .= $mkey . " = '', ";
805
-            }
806
-
807
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
808
-
809
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
810
-
811
-                $wpdb->query(
812
-                    $wpdb->prepare(
813
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
814
-                        array($post_id)
815
-                    )
816
-                );
817
-
818
-                return true;
819
-            }
820
-
821
-        } elseif ($postmeta != '' && $post_id) {
822
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
823
-
824
-                $wpdb->query(
825
-                    $wpdb->prepare(
826
-                        "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
827
-                        array($post_id)
828
-                    )
829
-                );
830
-
831
-                return true;
832
-            }
833
-
834
-        } else
835
-            return false;
836
-    }
777
+	/**
778
+	 * Delete post custom fields.
779
+	 *
780
+	 * @since 1.0.0
781
+	 * @package GeoDirectory
782
+	 * @global object $wpdb WordPress Database object.
783
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
784
+	 * @param int $post_id The post ID.
785
+	 * @param string $postmeta Detail table column name.
786
+	 * @todo check if this is depreciated
787
+	 * @todo Fix unknown variable mval
788
+	 * @return bool
789
+	 */
790
+	function geodir_delete_post_meta($post_id, $postmeta)
791
+	{
792
+
793
+		global $wpdb, $plugin_prefix;
794
+
795
+		$post_type = get_post_type($post_id);
796
+
797
+		$table = $plugin_prefix . $post_type . '_detail';
798
+
799
+		if (is_array($postmeta) && !empty($postmeta) && $post_id) {
800
+			$post_meta_set_query = '';
801
+
802
+			foreach ($postmeta as $mkey) {
803
+				if ($mval != '')
804
+					$post_meta_set_query .= $mkey . " = '', ";
805
+			}
806
+
807
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
808
+
809
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
810
+
811
+				$wpdb->query(
812
+					$wpdb->prepare(
813
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
814
+						array($post_id)
815
+					)
816
+				);
817
+
818
+				return true;
819
+			}
820
+
821
+		} elseif ($postmeta != '' && $post_id) {
822
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
823
+
824
+				$wpdb->query(
825
+					$wpdb->prepare(
826
+						"UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
827
+						array($post_id)
828
+					)
829
+				);
830
+
831
+				return true;
832
+			}
833
+
834
+		} else
835
+			return false;
836
+	}
837 837
 }
838 838
 
839 839
 
840 840
 if (!function_exists('geodir_get_post_meta')) {
841
-    /**
842
-     * Get post custom meta.
843
-     *
844
-     * @since 1.0.0
845
-     * @package GeoDirectory
846
-     * @global object $wpdb WordPress Database object.
847
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
848
-     * @param int $post_id The post ID.
849
-     * @param string $meta_key The meta key to retrieve.
850
-     * @param bool $single Optional. Whether to return a single value. Default false.
851
-     * @todo single variable not yet implemented.
852
-     * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
853
-     */
854
-    function geodir_get_post_meta($post_id, $meta_key, $single = false)
855
-    {
856
-        if (!$post_id) {
857
-            return false;
858
-        }
859
-        global $wpdb, $plugin_prefix;
860
-
861
-        $all_postypes = geodir_get_posttypes();
862
-
863
-        $post_type = get_post_type($post_id);
864
-
865
-        if (!in_array($post_type, $all_postypes))
866
-            return false;
867
-
868
-        $table = $plugin_prefix . $post_type . '_detail';
869
-
870
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
871
-            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
841
+	/**
842
+	 * Get post custom meta.
843
+	 *
844
+	 * @since 1.0.0
845
+	 * @package GeoDirectory
846
+	 * @global object $wpdb WordPress Database object.
847
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
848
+	 * @param int $post_id The post ID.
849
+	 * @param string $meta_key The meta key to retrieve.
850
+	 * @param bool $single Optional. Whether to return a single value. Default false.
851
+	 * @todo single variable not yet implemented.
852
+	 * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
853
+	 */
854
+	function geodir_get_post_meta($post_id, $meta_key, $single = false)
855
+	{
856
+		if (!$post_id) {
857
+			return false;
858
+		}
859
+		global $wpdb, $plugin_prefix;
860
+
861
+		$all_postypes = geodir_get_posttypes();
862
+
863
+		$post_type = get_post_type($post_id);
864
+
865
+		if (!in_array($post_type, $all_postypes))
866
+			return false;
867
+
868
+		$table = $plugin_prefix . $post_type . '_detail';
869
+
870
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
871
+			$meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
872 872
             
873
-            if ($meta_value && $meta_value !== '') {
874
-                return maybe_serialize($meta_value);
875
-            } else
876
-                return $meta_value;
877
-        } else {
878
-            return false;
879
-        }
880
-    }
873
+			if ($meta_value && $meta_value !== '') {
874
+				return maybe_serialize($meta_value);
875
+			} else
876
+				return $meta_value;
877
+		} else {
878
+			return false;
879
+		}
880
+	}
881 881
 }
882 882
 
883 883
 
884 884
 if (!function_exists('geodir_save_post_images')) {
885
-    /**
886
-     * Save post attachments.
887
-     *
888
-     * @since 1.0.0
889
-     * @package GeoDirectory
890
-     * @global object $wpdb WordPress Database object.
891
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
892
-     * @global object $current_user Current user object.
893
-     * @param int $post_id The post ID.
894
-     * @param array $post_image Post image urls as an array.
895
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
896
-     */
897
-    function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
898
-    {
899
-
885
+	/**
886
+	 * Save post attachments.
887
+	 *
888
+	 * @since 1.0.0
889
+	 * @package GeoDirectory
890
+	 * @global object $wpdb WordPress Database object.
891
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
892
+	 * @global object $current_user Current user object.
893
+	 * @param int $post_id The post ID.
894
+	 * @param array $post_image Post image urls as an array.
895
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
896
+	 */
897
+	function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
898
+	{
900 899
 
901
-        global $wpdb, $plugin_prefix, $current_user;
902 900
 
903
-        $post_type = get_post_type($post_id);
901
+		global $wpdb, $plugin_prefix, $current_user;
904 902
 
905
-        $table = $plugin_prefix . $post_type . '_detail';
903
+		$post_type = get_post_type($post_id);
906 904
 
907
-        $post_images = geodir_get_images($post_id);
905
+		$table = $plugin_prefix . $post_type . '_detail';
908 906
 
909
-        $wpdb->query(
910
-            $wpdb->prepare(
911
-                "UPDATE " . $table . " SET featured_image = '' where post_id =%d",
912
-                array($post_id)
913
-            )
914
-        );
907
+		$post_images = geodir_get_images($post_id);
915 908
 
916
-        $invalid_files = $post_images;
917
-        $valid_file_ids = array();
918
-        $valid_files_condition = '';
919
-        $geodir_uploaddir = '';
909
+		$wpdb->query(
910
+			$wpdb->prepare(
911
+				"UPDATE " . $table . " SET featured_image = '' where post_id =%d",
912
+				array($post_id)
913
+			)
914
+		);
920 915
 
921
-        $remove_files = array();
916
+		$invalid_files = $post_images;
917
+		$valid_file_ids = array();
918
+		$valid_files_condition = '';
919
+		$geodir_uploaddir = '';
922 920
 
923
-        if (!empty($post_image)) {
921
+		$remove_files = array();
924 922
 
925
-            $uploads = wp_upload_dir();
926
-            $uploads_dir = $uploads['path'];
923
+		if (!empty($post_image)) {
927 924
 
928
-            $geodir_uploadpath = $uploads['path'];
929
-            $geodir_uploadurl = $uploads['url'];
930
-            $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
925
+			$uploads = wp_upload_dir();
926
+			$uploads_dir = $uploads['path'];
931 927
 
932
-            $invalid_files = array();
933
-            $postcurr_images = array();
928
+			$geodir_uploadpath = $uploads['path'];
929
+			$geodir_uploadurl = $uploads['url'];
930
+			$sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
934 931
 
935
-            for ($m = 0; $m < count($post_image); $m++) {
936
-                $menu_order = $m + 1;
932
+			$invalid_files = array();
933
+			$postcurr_images = array();
937 934
 
938
-                $file_path = '';
939
-                /* --------- start ------- */
935
+			for ($m = 0; $m < count($post_image); $m++) {
936
+				$menu_order = $m + 1;
940 937
 
941
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
938
+				$file_path = '';
939
+				/* --------- start ------- */
942 940
 
943
-                $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
941
+				$split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
944 942
 
943
+				$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
945 944
 
946
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
947 945
 
948
-                    /* --------- end ------- */
949
-                    $curr_img_url = $post_image[$m];
946
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
950 947
 
951
-                    $image_name_arr = explode('/', $curr_img_url);
948
+					/* --------- end ------- */
949
+					$curr_img_url = $post_image[$m];
952 950
 
953
-                    $count_image_name_arr = count($image_name_arr) - 2;
951
+					$image_name_arr = explode('/', $curr_img_url);
954 952
 
955
-                    $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
953
+					$count_image_name_arr = count($image_name_arr) - 2;
956 954
 
957
-                    $curr_img_dir = $image_name_arr[$count_image_name_arr];
955
+					$count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
958 956
 
959
-                    $filename = end($image_name_arr);
960
-                    if (strpos($filename, '?') !== false) {
961
-                        list($filename) = explode('?', $filename);
962
-                    }
957
+					$curr_img_dir = $image_name_arr[$count_image_name_arr];
963 958
 
964
-                    $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
965
-                    $curr_img_dir = str_replace($filename, "", $curr_img_dir);
959
+					$filename = end($image_name_arr);
960
+					if (strpos($filename, '?') !== false) {
961
+						list($filename) = explode('?', $filename);
962
+					}
966 963
 
967
-                    $img_name_arr = explode('.', $filename);
964
+					$curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
965
+					$curr_img_dir = str_replace($filename, "", $curr_img_dir);
968 966
 
969
-                    $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
970
-                    if (!empty($img_name_arr) && count($img_name_arr) > 2) {
971
-                        $new_img_name_arr = $img_name_arr;
972
-                        if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
973
-                            unset($new_img_name_arr[count($img_name_arr) - 1]);
974
-                            $file_title = implode('.', $new_img_name_arr);
975
-                        }
976
-                    }
977
-                    $file_title = sanitize_file_name($file_title);
978
-                    $file_name = sanitize_file_name($filename);
967
+					$img_name_arr = explode('.', $filename);
979 968
 
980
-                    $arr_file_type = wp_check_filetype($filename);
969
+					$file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
970
+					if (!empty($img_name_arr) && count($img_name_arr) > 2) {
971
+						$new_img_name_arr = $img_name_arr;
972
+						if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
973
+							unset($new_img_name_arr[count($img_name_arr) - 1]);
974
+							$file_title = implode('.', $new_img_name_arr);
975
+						}
976
+					}
977
+					$file_title = sanitize_file_name($file_title);
978
+					$file_name = sanitize_file_name($filename);
981 979
 
982
-                    $uploaded_file_type = $arr_file_type['type'];
980
+					$arr_file_type = wp_check_filetype($filename);
983 981
 
984
-                    // Set an array containing a list of acceptable formats
985
-                    $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
982
+					$uploaded_file_type = $arr_file_type['type'];
986 983
 
987
-                    // If the uploaded file is the right format
988
-                    if (in_array($uploaded_file_type, $allowed_file_types)) {
989
-                        if (!function_exists('wp_handle_upload')) {
990
-                            require_once(ABSPATH . 'wp-admin/includes/file.php');
991
-                        }
984
+					// Set an array containing a list of acceptable formats
985
+					$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
992 986
 
993
-                        if (!is_dir($geodir_uploadpath)) {
994
-                            mkdir($geodir_uploadpath);
995
-                        }
987
+					// If the uploaded file is the right format
988
+					if (in_array($uploaded_file_type, $allowed_file_types)) {
989
+						if (!function_exists('wp_handle_upload')) {
990
+							require_once(ABSPATH . 'wp-admin/includes/file.php');
991
+						}
996 992
 
997
-                        $external_img = false;
998
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
999
-                        } else {
1000
-                            $external_img = true;
1001
-                        }
993
+						if (!is_dir($geodir_uploadpath)) {
994
+							mkdir($geodir_uploadpath);
995
+						}
1002 996
 
1003
-                        if ($dummy || $external_img) {
1004
-                            $uploaded_file = array();
1005
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
997
+						$external_img = false;
998
+						if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
999
+						} else {
1000
+							$external_img = true;
1001
+						}
1006 1002
 
1007
-                            if (isset($uploaded['error']) && empty($uploaded['error'])) {
1008
-                                $new_name = basename($uploaded['file']);
1009
-                                $uploaded_file = $uploaded;
1010
-                            }else{
1011
-                                print_r($uploaded);exit;
1012
-                            }
1013
-                            $external_img = false;
1014
-                        } else {
1015
-                            $new_name = $post_id . '_' . $file_name;
1003
+						if ($dummy || $external_img) {
1004
+							$uploaded_file = array();
1005
+							$uploaded = (array)fetch_remote_file($curr_img_url);
1016 1006
 
1017
-                            if ($curr_img_dir == $sub_dir) {
1018
-                                $img_path = $geodir_uploadpath . '/' . $filename;
1019
-                                $img_url = $geodir_uploadurl . '/' . $filename;
1020
-                            } else {
1021
-                                $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1022
-                                $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1023
-                            }
1007
+							if (isset($uploaded['error']) && empty($uploaded['error'])) {
1008
+								$new_name = basename($uploaded['file']);
1009
+								$uploaded_file = $uploaded;
1010
+							}else{
1011
+								print_r($uploaded);exit;
1012
+							}
1013
+							$external_img = false;
1014
+						} else {
1015
+							$new_name = $post_id . '_' . $file_name;
1024 1016
 
1025
-                            $uploaded_file = '';
1017
+							if ($curr_img_dir == $sub_dir) {
1018
+								$img_path = $geodir_uploadpath . '/' . $filename;
1019
+								$img_url = $geodir_uploadurl . '/' . $filename;
1020
+							} else {
1021
+								$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1022
+								$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1023
+							}
1026 1024
 
1027
-                            if (file_exists($img_path)) {
1028
-                                $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1029
-                                $file_path = '';
1030
-                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1031
-                                $uploaded_file = true;
1032
-                                $file_path = $curr_img_dir . '/' . $filename;
1033
-                            }
1025
+							$uploaded_file = '';
1034 1026
 
1035
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1036
-                                unlink($img_path);
1037
-                        }
1027
+							if (file_exists($img_path)) {
1028
+								$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1029
+								$file_path = '';
1030
+							} else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1031
+								$uploaded_file = true;
1032
+								$file_path = $curr_img_dir . '/' . $filename;
1033
+							}
1038 1034
 
1039
-                        if (!empty($uploaded_file)) {
1040
-                            if (!isset($file_path) || !$file_path) {
1041
-                                $file_path = $sub_dir . '/' . $new_name;
1042
-                            }
1035
+							if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1036
+								unlink($img_path);
1037
+						}
1043 1038
 
1044
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1039
+						if (!empty($uploaded_file)) {
1040
+							if (!isset($file_path) || !$file_path) {
1041
+								$file_path = $sub_dir . '/' . $new_name;
1042
+							}
1045 1043
 
1046
-                            if ($menu_order == 1) {
1044
+							$postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1047 1045
 
1048
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1046
+							if ($menu_order == 1) {
1049 1047
 
1050
-                            }
1048
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1051 1049
 
1052
-                            // Set up options array to add this file as an attachment
1053
-                            $attachment = array();
1054
-                            $attachment['post_id'] = $post_id;
1055
-                            $attachment['title'] = $file_title;
1056
-                            $attachment['content'] = '';
1057
-                            $attachment['file'] = $file_path;
1058
-                            $attachment['mime_type'] = $uploaded_file_type;
1059
-                            $attachment['menu_order'] = $menu_order;
1060
-                            $attachment['is_featured'] = 0;
1050
+							}
1061 1051
 
1062
-                            $attachment_set = '';
1052
+							// Set up options array to add this file as an attachment
1053
+							$attachment = array();
1054
+							$attachment['post_id'] = $post_id;
1055
+							$attachment['title'] = $file_title;
1056
+							$attachment['content'] = '';
1057
+							$attachment['file'] = $file_path;
1058
+							$attachment['mime_type'] = $uploaded_file_type;
1059
+							$attachment['menu_order'] = $menu_order;
1060
+							$attachment['is_featured'] = 0;
1063 1061
 
1064
-                            foreach ($attachment as $key => $val) {
1065
-                                if ($val != '')
1066
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1067
-                            }
1062
+							$attachment_set = '';
1068 1063
 
1069
-                            $attachment_set = trim($attachment_set, ", ");
1064
+							foreach ($attachment as $key => $val) {
1065
+								if ($val != '')
1066
+									$attachment_set .= $key . " = '" . $val . "', ";
1067
+							}
1070 1068
 
1071
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1069
+							$attachment_set = trim($attachment_set, ", ");
1070
+
1071
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1072 1072
 
1073
-                            $valid_file_ids[] = $wpdb->insert_id;
1074
-                        }
1073
+							$valid_file_ids[] = $wpdb->insert_id;
1074
+						}
1075 1075
 
1076
-                    }
1076
+					}
1077 1077
 
1078 1078
 
1079
-                } else {
1080
-                    $valid_file_ids[] = $find_image;
1079
+				} else {
1080
+					$valid_file_ids[] = $find_image;
1081 1081
 
1082
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1082
+					$postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1083 1083
 
1084
-                    $wpdb->query(
1085
-                        $wpdb->prepare(
1086
-                            "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1087
-                            array($menu_order, $split_img_path[1], $post_id)
1088
-                        )
1089
-                    );
1084
+					$wpdb->query(
1085
+						$wpdb->prepare(
1086
+							"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1087
+							array($menu_order, $split_img_path[1], $post_id)
1088
+						)
1089
+					);
1090 1090
 
1091
-                    if ($menu_order == 1)
1092
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1091
+					if ($menu_order == 1)
1092
+						$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1093 1093
 
1094
-                }
1094
+				}
1095 1095
 
1096 1096
 
1097
-            }
1097
+			}
1098 1098
 
1099
-            if (!empty($valid_file_ids)) {
1099
+			if (!empty($valid_file_ids)) {
1100 1100
 
1101
-                $remove_files = $valid_file_ids;
1101
+				$remove_files = $valid_file_ids;
1102 1102
 
1103
-                $remove_files_length = count($remove_files);
1104
-                $remove_files_format = array_fill(0, $remove_files_length, '%d');
1105
-                $format = implode(',', $remove_files_format);
1106
-                $valid_files_condition = " ID NOT IN ($format) AND ";
1103
+				$remove_files_length = count($remove_files);
1104
+				$remove_files_format = array_fill(0, $remove_files_length, '%d');
1105
+				$format = implode(',', $remove_files_format);
1106
+				$valid_files_condition = " ID NOT IN ($format) AND ";
1107 1107
 
1108
-            }
1108
+			}
1109 1109
 
1110
-            //Get and remove all old images of post from database to set by new order
1110
+			//Get and remove all old images of post from database to set by new order
1111 1111
 
1112
-            if (!empty($post_images)) {
1112
+			if (!empty($post_images)) {
1113 1113
 
1114
-                foreach ($post_images as $img) {
1114
+				foreach ($post_images as $img) {
1115 1115
 
1116
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1116
+					if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1117 1117
 
1118
-                        $invalid_files[] = (object)array('src' => $img->src);
1118
+						$invalid_files[] = (object)array('src' => $img->src);
1119 1119
 
1120
-                    }
1120
+					}
1121 1121
 
1122
-                }
1122
+				}
1123 1123
 
1124
-            }
1124
+			}
1125 1125
 
1126
-            $invalid_files = (object)$invalid_files;
1127
-        }
1126
+			$invalid_files = (object)$invalid_files;
1127
+		}
1128 1128
 
1129
-        $remove_files[] = $post_id;
1129
+		$remove_files[] = $post_id;
1130 1130
 
1131
-        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1131
+		$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1132 1132
 
1133
-        if (!empty($invalid_files))
1134
-            geodir_remove_attachments($invalid_files);
1135
-    }
1133
+		if (!empty($invalid_files))
1134
+			geodir_remove_attachments($invalid_files);
1135
+	}
1136 1136
 
1137 1137
 }
1138 1138
 
@@ -1146,12 +1146,12 @@  discard block
 block discarded – undo
1146 1146
 function geodir_remove_temp_images()
1147 1147
 {
1148 1148
 
1149
-    global $current_user;
1149
+	global $current_user;
1150 1150
 
1151
-    $uploads = wp_upload_dir();
1152
-    $uploads_dir = $uploads['path'];
1151
+	$uploads = wp_upload_dir();
1152
+	$uploads_dir = $uploads['path'];
1153 1153
 
1154
-    /*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1154
+	/*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1155 1155
 
1156 1156
 			$dirPath = $uploads_dir.'/temp_'.$current_user->data->ID;
1157 1157
 			if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
@@ -1168,8 +1168,8 @@  discard block
 block discarded – undo
1168 1168
 			rmdir($dirPath);
1169 1169
 	}	*/
1170 1170
 
1171
-    $dirname = $uploads_dir . '/temp_' . $current_user->ID;
1172
-    geodir_delete_directory($dirname);
1171
+	$dirname = $uploads_dir . '/temp_' . $current_user->ID;
1172
+	geodir_delete_directory($dirname);
1173 1173
 }
1174 1174
 
1175 1175
 
@@ -1183,116 +1183,116 @@  discard block
 block discarded – undo
1183 1183
  */
1184 1184
 function geodir_delete_directory($dirname)
1185 1185
 {
1186
-    $dir_handle = '';
1187
-    if (is_dir($dirname))
1188
-        $dir_handle = opendir($dirname);
1189
-    if (!$dir_handle)
1190
-        return false;
1191
-    while ($file = readdir($dir_handle)) {
1192
-        if ($file != "." && $file != "..") {
1193
-            if (!is_dir($dirname . "/" . $file))
1194
-                unlink($dirname . "/" . $file);
1195
-            else
1196
-                geodir_delete_directory($dirname . '/' . $file);
1197
-        }
1198
-    }
1199
-    closedir($dir_handle);
1200
-    rmdir($dirname);
1201
-    return true;
1186
+	$dir_handle = '';
1187
+	if (is_dir($dirname))
1188
+		$dir_handle = opendir($dirname);
1189
+	if (!$dir_handle)
1190
+		return false;
1191
+	while ($file = readdir($dir_handle)) {
1192
+		if ($file != "." && $file != "..") {
1193
+			if (!is_dir($dirname . "/" . $file))
1194
+				unlink($dirname . "/" . $file);
1195
+			else
1196
+				geodir_delete_directory($dirname . '/' . $file);
1197
+		}
1198
+	}
1199
+	closedir($dir_handle);
1200
+	rmdir($dirname);
1201
+	return true;
1202 1202
 
1203 1203
 }
1204 1204
 
1205 1205
 
1206 1206
 if (!function_exists('geodir_remove_attachments')) {
1207
-    /**
1208
-     * Remove post attachments.
1209
-     *
1210
-     * @since 1.0.0
1211
-     * @package GeoDirectory
1212
-     * @param array $postcurr_images Array of image objects.
1213
-     */
1214
-    function geodir_remove_attachments($postcurr_images = array())
1215
-    {
1216
-        // Unlink all past images of post
1217
-        if (!empty($postcurr_images)) {
1218
-
1219
-            $uploads = wp_upload_dir();
1220
-            $uploads_dir = $uploads['path'];
1221
-
1222
-            foreach ($postcurr_images as $postimg) {
1223
-                $image_name_arr = explode('/', $postimg->src);
1224
-                $filename = end($image_name_arr);
1225
-                if (file_exists($uploads_dir . '/' . $filename))
1226
-                    unlink($uploads_dir . '/' . $filename);
1227
-            }
1228
-
1229
-        } // endif
1230
-        // Unlink all past images of post end
1231
-    }
1207
+	/**
1208
+	 * Remove post attachments.
1209
+	 *
1210
+	 * @since 1.0.0
1211
+	 * @package GeoDirectory
1212
+	 * @param array $postcurr_images Array of image objects.
1213
+	 */
1214
+	function geodir_remove_attachments($postcurr_images = array())
1215
+	{
1216
+		// Unlink all past images of post
1217
+		if (!empty($postcurr_images)) {
1218
+
1219
+			$uploads = wp_upload_dir();
1220
+			$uploads_dir = $uploads['path'];
1221
+
1222
+			foreach ($postcurr_images as $postimg) {
1223
+				$image_name_arr = explode('/', $postimg->src);
1224
+				$filename = end($image_name_arr);
1225
+				if (file_exists($uploads_dir . '/' . $filename))
1226
+					unlink($uploads_dir . '/' . $filename);
1227
+			}
1228
+
1229
+		} // endif
1230
+		// Unlink all past images of post end
1231
+	}
1232 1232
 }
1233 1233
 
1234 1234
 if (!function_exists('geodir_get_featured_image')) {
1235
-    /**
1236
-     * Gets the post featured image.
1237
-     *
1238
-     * @since 1.0.0
1239
-     * @package GeoDirectory
1240
-     * @global object $wpdb WordPress Database object.
1241
-     * @global object $post The current post object.
1242
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1243
-     * @param int|string $post_id The post ID.
1244
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1245
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1246
-     * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1247
-     * @return bool|object Image details as an object.
1248
-     */
1249
-    function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1250
-    {
1251
-
1252
-        /*$img_arr['src'] = get_the_post_thumbnail_url( $post_id,  'medium');//medium/thumbnail
1235
+	/**
1236
+	 * Gets the post featured image.
1237
+	 *
1238
+	 * @since 1.0.0
1239
+	 * @package GeoDirectory
1240
+	 * @global object $wpdb WordPress Database object.
1241
+	 * @global object $post The current post object.
1242
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1243
+	 * @param int|string $post_id The post ID.
1244
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1245
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1246
+	 * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1247
+	 * @return bool|object Image details as an object.
1248
+	 */
1249
+	function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1250
+	{
1251
+
1252
+		/*$img_arr['src'] = get_the_post_thumbnail_url( $post_id,  'medium');//medium/thumbnail
1253 1253
         $img_arr['path'] = '';
1254 1254
         $img_arr['width'] = '';
1255 1255
         $img_arr['height'] = '';
1256 1256
         $img_arr['title'] = '';
1257 1257
         return (object)$img_arr;*/
1258
-        global $wpdb, $plugin_prefix, $post;
1258
+		global $wpdb, $plugin_prefix, $post;
1259 1259
 
1260
-        if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1261
-            $post_type = $post->post_type;
1262
-        } else {
1263
-            $post_type = get_post_type($post_id);
1264
-        }
1260
+		if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1261
+			$post_type = $post->post_type;
1262
+		} else {
1263
+			$post_type = get_post_type($post_id);
1264
+		}
1265 1265
 
1266
-        if (!in_array($post_type, geodir_get_posttypes())) {
1267
-            return false;// if not a GD CPT return;
1268
-        }
1266
+		if (!in_array($post_type, geodir_get_posttypes())) {
1267
+			return false;// if not a GD CPT return;
1268
+		}
1269 1269
 
1270
-        $table = $plugin_prefix . $post_type . '_detail';
1270
+		$table = $plugin_prefix . $post_type . '_detail';
1271 1271
 
1272
-        if (!$file) {
1273
-            if (isset($post->featured_image)) {
1274
-                $file = $post->featured_image;
1275
-            } else {
1276
-                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1277
-            }
1278
-        }
1272
+		if (!$file) {
1273
+			if (isset($post->featured_image)) {
1274
+				$file = $post->featured_image;
1275
+			} else {
1276
+				$file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1277
+			}
1278
+		}
1279 1279
 
1280
-        if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1281
-            $img_arr = array();
1280
+		if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1281
+			$img_arr = array();
1282 1282
 
1283
-            $file_info = pathinfo($file);
1284
-            $sub_dir = '';
1285
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1286
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1283
+			$file_info = pathinfo($file);
1284
+			$sub_dir = '';
1285
+			if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1286
+				$sub_dir = stripslashes_deep($file_info['dirname']);
1287 1287
 
1288
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1289
-            $uploads_baseurl = $uploads['baseurl'];
1290
-            $uploads_path = $uploads['path'];
1288
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1289
+			$uploads_baseurl = $uploads['baseurl'];
1290
+			$uploads_path = $uploads['path'];
1291 1291
 
1292
-            $file_name = $file_info['basename'];
1292
+			$file_name = $file_info['basename'];
1293 1293
 
1294
-            $uploads_url = $uploads_baseurl . $sub_dir;
1295
-            /*
1294
+			$uploads_url = $uploads_baseurl . $sub_dir;
1295
+			/*
1296 1296
              * Allows the filter of image src for such things as CDN change.
1297 1297
              *
1298 1298
              * @since 1.5.7
@@ -1301,158 +1301,158 @@  discard block
 block discarded – undo
1301 1301
              * @param string $uploads_url The server upload directory url.
1302 1302
              * @param string $uploads_baseurl The uploads dir base url.
1303 1303
              */
1304
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1305
-            $img_arr['path'] = $uploads_path . '/' . $file_name;
1306
-            $width = 0;
1307
-            $height = 0;
1308
-            if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1309
-                $imagesize = getimagesize($img_arr['path']);
1310
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1311
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1312
-            }
1313
-            $img_arr['width'] = $width;
1314
-            $img_arr['height'] = $height;
1315
-            $img_arr['title'] = '';
1316
-        } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1317
-            foreach ($post_images as $image) {
1318
-                return $image;
1319
-            }
1320
-        } else if ($no_image) {
1321
-            $img_arr = array();
1322
-
1323
-            $default_img = '';
1324
-            if (isset($post->default_category) && $post->default_category) {
1325
-                $default_cat = $post->default_category;
1326
-            } else {
1327
-                $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1328
-            }
1329
-
1330
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1331
-                $default_img = $default_catimg['src'];
1332
-            elseif ($no_image) {
1333
-                $default_img = get_option('geodir_listing_no_img');
1334
-            }
1335
-
1336
-            if (!empty($default_img)) {
1337
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1338
-                $uploads_baseurl = $uploads['baseurl'];
1339
-                $uploads_path = $uploads['path'];
1340
-
1341
-                $img_arr = array();
1342
-
1343
-                $file_info = pathinfo($default_img);
1344
-
1345
-                $file_name = $file_info['basename'];
1346
-
1347
-                $img_arr['src'] = $default_img;
1348
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1349
-
1350
-                $width = 0;
1351
-                $height = 0;
1352
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1353
-                    $imagesize = getimagesize($img_arr['path']);
1354
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1355
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1356
-                }
1357
-                $img_arr['width'] = $width;
1358
-                $img_arr['height'] = $height;
1359
-
1360
-                $img_arr['title'] = ''; // add the title to the array
1361
-            }
1362
-        }
1363
-
1364
-        if (!empty($img_arr))
1365
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1366
-        else
1367
-            return false;
1368
-    }
1304
+			$img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1305
+			$img_arr['path'] = $uploads_path . '/' . $file_name;
1306
+			$width = 0;
1307
+			$height = 0;
1308
+			if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1309
+				$imagesize = getimagesize($img_arr['path']);
1310
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1311
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1312
+			}
1313
+			$img_arr['width'] = $width;
1314
+			$img_arr['height'] = $height;
1315
+			$img_arr['title'] = '';
1316
+		} elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1317
+			foreach ($post_images as $image) {
1318
+				return $image;
1319
+			}
1320
+		} else if ($no_image) {
1321
+			$img_arr = array();
1322
+
1323
+			$default_img = '';
1324
+			if (isset($post->default_category) && $post->default_category) {
1325
+				$default_cat = $post->default_category;
1326
+			} else {
1327
+				$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1328
+			}
1329
+
1330
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1331
+				$default_img = $default_catimg['src'];
1332
+			elseif ($no_image) {
1333
+				$default_img = get_option('geodir_listing_no_img');
1334
+			}
1335
+
1336
+			if (!empty($default_img)) {
1337
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1338
+				$uploads_baseurl = $uploads['baseurl'];
1339
+				$uploads_path = $uploads['path'];
1340
+
1341
+				$img_arr = array();
1342
+
1343
+				$file_info = pathinfo($default_img);
1344
+
1345
+				$file_name = $file_info['basename'];
1346
+
1347
+				$img_arr['src'] = $default_img;
1348
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1349
+
1350
+				$width = 0;
1351
+				$height = 0;
1352
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1353
+					$imagesize = getimagesize($img_arr['path']);
1354
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1355
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1356
+				}
1357
+				$img_arr['width'] = $width;
1358
+				$img_arr['height'] = $height;
1359
+
1360
+				$img_arr['title'] = ''; // add the title to the array
1361
+			}
1362
+		}
1363
+
1364
+		if (!empty($img_arr))
1365
+			return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1366
+		else
1367
+			return false;
1368
+	}
1369 1369
 }
1370 1370
 
1371 1371
 if (!function_exists('geodir_show_featured_image')) {
1372
-    /**
1373
-     * Gets the post featured image.
1374
-     *
1375
-     * @since 1.0.0
1376
-     * @package GeoDirectory
1377
-     * @param int|string $post_id The post ID.
1378
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1379
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1380
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1381
-     * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1382
-     * @return bool|string Returns image html.
1383
-     */
1384
-    function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1385
-    {
1386
-        $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1387
-
1388
-        $html = geodir_show_image($image, $size, $no_image, false);
1389
-
1390
-        if (!empty($html) && $echo) {
1391
-            echo $html;
1392
-        } elseif (!empty($html)) {
1393
-            return $html;
1394
-        } else
1395
-            return false;
1396
-    }
1372
+	/**
1373
+	 * Gets the post featured image.
1374
+	 *
1375
+	 * @since 1.0.0
1376
+	 * @package GeoDirectory
1377
+	 * @param int|string $post_id The post ID.
1378
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1379
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1380
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1381
+	 * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1382
+	 * @return bool|string Returns image html.
1383
+	 */
1384
+	function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1385
+	{
1386
+		$image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1387
+
1388
+		$html = geodir_show_image($image, $size, $no_image, false);
1389
+
1390
+		if (!empty($html) && $echo) {
1391
+			echo $html;
1392
+		} elseif (!empty($html)) {
1393
+			return $html;
1394
+		} else
1395
+			return false;
1396
+	}
1397 1397
 }
1398 1398
 
1399 1399
 if (!function_exists('geodir_get_images')) {
1400
-    /**
1401
-     * Gets the post images.
1402
-     *
1403
-     * @since 1.0.0
1404
-     * @package GeoDirectory
1405
-     * @global object $wpdb WordPress Database object.
1406
-     * @param int $post_id The post ID.
1407
-     * @param string $img_size Optional. Thumbnail size.
1408
-     * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1409
-     * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1410
-     * @param int|string $limit Optional. Number of images.
1411
-     * @return array|bool Returns images as an array. Each item is an object.
1412
-     */
1413
-    function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1414
-    {
1415
-        global $wpdb;
1416
-        if ($limit) {
1417
-            $limit_q = " LIMIT $limit ";
1418
-        } else {
1419
-            $limit_q = '';
1420
-        }
1421
-        $not_featured = '';
1422
-        $sub_dir = '';
1423
-        if (!$add_featured)
1424
-            $not_featured = " AND is_featured = 0 ";
1425
-
1426
-        $arrImages = $wpdb->get_results(
1427
-            $wpdb->prepare(
1428
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1429
-                array('%image%', $post_id)
1430
-            )
1431
-        );
1432
-
1433
-        $counter = 0;
1434
-        $return_arr = array();
1435
-
1436
-        if (!empty($arrImages)) {
1437
-            foreach ($arrImages as $attechment) {
1438
-
1439
-                $img_arr = array();
1440
-                $img_arr['id'] = $attechment->ID;
1441
-                $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1442
-
1443
-                $file_info = pathinfo($attechment->file);
1444
-
1445
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1446
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1447
-
1448
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1449
-                $uploads_baseurl = $uploads['baseurl'];
1450
-                $uploads_path = $uploads['path'];
1451
-
1452
-                $file_name = $file_info['basename'];
1453
-
1454
-                $uploads_url = $uploads_baseurl . $sub_dir;
1455
-                /*
1400
+	/**
1401
+	 * Gets the post images.
1402
+	 *
1403
+	 * @since 1.0.0
1404
+	 * @package GeoDirectory
1405
+	 * @global object $wpdb WordPress Database object.
1406
+	 * @param int $post_id The post ID.
1407
+	 * @param string $img_size Optional. Thumbnail size.
1408
+	 * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1409
+	 * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1410
+	 * @param int|string $limit Optional. Number of images.
1411
+	 * @return array|bool Returns images as an array. Each item is an object.
1412
+	 */
1413
+	function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1414
+	{
1415
+		global $wpdb;
1416
+		if ($limit) {
1417
+			$limit_q = " LIMIT $limit ";
1418
+		} else {
1419
+			$limit_q = '';
1420
+		}
1421
+		$not_featured = '';
1422
+		$sub_dir = '';
1423
+		if (!$add_featured)
1424
+			$not_featured = " AND is_featured = 0 ";
1425
+
1426
+		$arrImages = $wpdb->get_results(
1427
+			$wpdb->prepare(
1428
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1429
+				array('%image%', $post_id)
1430
+			)
1431
+		);
1432
+
1433
+		$counter = 0;
1434
+		$return_arr = array();
1435
+
1436
+		if (!empty($arrImages)) {
1437
+			foreach ($arrImages as $attechment) {
1438
+
1439
+				$img_arr = array();
1440
+				$img_arr['id'] = $attechment->ID;
1441
+				$img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1442
+
1443
+				$file_info = pathinfo($attechment->file);
1444
+
1445
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1446
+					$sub_dir = stripslashes_deep($file_info['dirname']);
1447
+
1448
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1449
+				$uploads_baseurl = $uploads['baseurl'];
1450
+				$uploads_path = $uploads['path'];
1451
+
1452
+				$file_name = $file_info['basename'];
1453
+
1454
+				$uploads_url = $uploads_baseurl . $sub_dir;
1455
+				/*
1456 1456
                 * Allows the filter of image src for such things as CDN change.
1457 1457
                 *
1458 1458
                 * @since 1.5.7
@@ -1461,516 +1461,516 @@  discard block
 block discarded – undo
1461 1461
                 * @param string $uploads_url The server upload directory url.
1462 1462
                 * @param string $uploads_baseurl The uploads dir base url.
1463 1463
                 */
1464
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1465
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1466
-                $width = 0;
1467
-                $height = 0;
1468
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1469
-                    $imagesize = getimagesize($img_arr['path']);
1470
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1471
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1472
-                }
1473
-                $img_arr['width'] = $width;
1474
-                $img_arr['height'] = $height;
1475
-
1476
-                $img_arr['file'] = $file_name; // add the title to the array
1477
-                $img_arr['title'] = $attechment->title; // add the title to the array
1478
-                $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1479
-                $img_arr['content'] = $attechment->content; // add the description to the array
1480
-                $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1481
-
1482
-                $return_arr[] = (object)$img_arr;
1483
-
1484
-                $counter++;
1485
-            }
1486
-            return (object)$return_arr;
1487
-        } else if ($no_images) {
1488
-            $default_img = '';
1489
-            $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1490
-            $post_type = get_post_type($post_id);
1491
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1492
-                $default_img = $default_catimg['src'];
1493
-            elseif ($no_images) {
1494
-                $default_img = get_option('geodir_listing_no_img');
1495
-            }
1496
-
1497
-            if (!empty($default_img)) {
1498
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1464
+				$img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1465
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1466
+				$width = 0;
1467
+				$height = 0;
1468
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1469
+					$imagesize = getimagesize($img_arr['path']);
1470
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1471
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1472
+				}
1473
+				$img_arr['width'] = $width;
1474
+				$img_arr['height'] = $height;
1475
+
1476
+				$img_arr['file'] = $file_name; // add the title to the array
1477
+				$img_arr['title'] = $attechment->title; // add the title to the array
1478
+				$img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1479
+				$img_arr['content'] = $attechment->content; // add the description to the array
1480
+				$img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1481
+
1482
+				$return_arr[] = (object)$img_arr;
1483
+
1484
+				$counter++;
1485
+			}
1486
+			return (object)$return_arr;
1487
+		} else if ($no_images) {
1488
+			$default_img = '';
1489
+			$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1490
+			$post_type = get_post_type($post_id);
1491
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1492
+				$default_img = $default_catimg['src'];
1493
+			elseif ($no_images) {
1494
+				$default_img = get_option('geodir_listing_no_img');
1495
+			}
1496
+
1497
+			if (!empty($default_img)) {
1498
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1499 1499
                 
1500
-                $image_path = $default_img;
1501
-                if (!path_is_absolute($image_path)) {
1502
-                    $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1503
-                }
1504
-
1505
-                $file_info = pathinfo($default_img);
1506
-                $file_name = $file_info['basename'];
1507
-
1508
-                $width = '';
1509
-                $height = '';
1510
-                if (is_file($image_path) && file_exists($image_path)) {
1511
-                    $imagesize = getimagesize($image_path);
1512
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1513
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1514
-                }
1500
+				$image_path = $default_img;
1501
+				if (!path_is_absolute($image_path)) {
1502
+					$image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1503
+				}
1504
+
1505
+				$file_info = pathinfo($default_img);
1506
+				$file_name = $file_info['basename'];
1507
+
1508
+				$width = '';
1509
+				$height = '';
1510
+				if (is_file($image_path) && file_exists($image_path)) {
1511
+					$imagesize = getimagesize($image_path);
1512
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1513
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1514
+				}
1515 1515
                 
1516
-                $img_arr = array();
1517
-                $img_arr['src'] = $default_img;
1518
-                $img_arr['path'] = $image_path;
1519
-                $img_arr['width'] = $width;
1520
-                $img_arr['height'] = $height;
1521
-                $img_arr['file'] = $file_name; // add the title to the array
1522
-                $img_arr['title'] = $file_info['filename']; // add the title to the array
1523
-                $img_arr['content'] = $file_info['filename']; // add the description to the array
1524
-
1525
-                $return_arr[] = (object)$img_arr;
1526
-
1527
-                return $return_arr;
1528
-            } else
1529
-                return false;
1530
-        }
1531
-    }
1516
+				$img_arr = array();
1517
+				$img_arr['src'] = $default_img;
1518
+				$img_arr['path'] = $image_path;
1519
+				$img_arr['width'] = $width;
1520
+				$img_arr['height'] = $height;
1521
+				$img_arr['file'] = $file_name; // add the title to the array
1522
+				$img_arr['title'] = $file_info['filename']; // add the title to the array
1523
+				$img_arr['content'] = $file_info['filename']; // add the description to the array
1524
+
1525
+				$return_arr[] = (object)$img_arr;
1526
+
1527
+				return $return_arr;
1528
+			} else
1529
+				return false;
1530
+		}
1531
+	}
1532 1532
 }
1533 1533
 
1534 1534
 if (!function_exists('geodir_show_image')) {
1535
-    /**
1536
-     * Show image using image details.
1537
-     *
1538
-     * @since 1.0.0
1539
-     * @package GeoDirectory
1540
-     * @param array|object $request Image info either as an array or object.
1541
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1542
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1543
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1544
-     * @return bool|string Returns image html.
1545
-     */
1546
-    function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1547
-    {
1548
-        $image = new stdClass();
1549
-
1550
-        $html = '';
1551
-        if (!empty($request)) {
1552
-            if (!is_object($request)){
1553
-                $request = (object)$request;
1554
-            }
1555
-
1556
-            if (isset($request->src) && !isset($request->path)) {
1557
-                $request->path = $request->src;
1558
-            }
1559
-
1560
-            /*
1535
+	/**
1536
+	 * Show image using image details.
1537
+	 *
1538
+	 * @since 1.0.0
1539
+	 * @package GeoDirectory
1540
+	 * @param array|object $request Image info either as an array or object.
1541
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1542
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1543
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1544
+	 * @return bool|string Returns image html.
1545
+	 */
1546
+	function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1547
+	{
1548
+		$image = new stdClass();
1549
+
1550
+		$html = '';
1551
+		if (!empty($request)) {
1552
+			if (!is_object($request)){
1553
+				$request = (object)$request;
1554
+			}
1555
+
1556
+			if (isset($request->src) && !isset($request->path)) {
1557
+				$request->path = $request->src;
1558
+			}
1559
+
1560
+			/*
1561 1561
              * getimagesize() works faster from path than url so we try and get path if we can.
1562 1562
              */
1563
-            $upload_dir = wp_upload_dir();
1564
-            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1565
-            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1566
-            if (strpos($img_no_http, $upload_no_http) !== false) {
1567
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1568
-            }
1563
+			$upload_dir = wp_upload_dir();
1564
+			$img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1565
+			$upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1566
+			if (strpos($img_no_http, $upload_no_http) !== false) {
1567
+				$request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1568
+			}
1569 1569
             
1570
-            $width = 0;
1571
-            $height = 0;
1572
-            if (is_file($request->path) && file_exists($request->path)) {
1573
-                $imagesize = getimagesize($request->path);
1574
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1575
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1576
-            }
1577
-
1578
-            $image->src = $request->src;
1579
-            $image->width = $width;
1580
-            $image->height = $height;
1581
-
1582
-            $max_size = (object)geodir_get_imagesize($size);
1583
-
1584
-            if (!is_wp_error($max_size)) {
1585
-                if ($image->width) {
1586
-                    if ($image->height >= $image->width) {
1587
-                        $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1588
-                    } else if ($image->width < ($max_size->h)) {
1589
-                        $width_per = round((($image->width / $max_size->w) * 100), 2);
1590
-                    } else
1591
-                        $width_per = 100;
1592
-                }
1593
-
1594
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1595
-                    $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1596
-                } else {
1597
-                    if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1598
-                        $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1599
-                    }else{
1600
-                        //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1601
-                        //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1602
-                        $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1603
-
1604
-                    }
1605
-
1606
-                }
1607
-            }
1608
-        }
1609
-
1610
-        if (!empty($html) && $echo) {
1611
-            echo $html;
1612
-        } elseif (!empty($html)) {
1613
-            return $html;
1614
-        } else
1615
-            return false;
1616
-    }
1617
-}
1570
+			$width = 0;
1571
+			$height = 0;
1572
+			if (is_file($request->path) && file_exists($request->path)) {
1573
+				$imagesize = getimagesize($request->path);
1574
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1575
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1576
+			}
1618 1577
 
1619
-if (!function_exists('geodir_set_post_terms')) {
1620
-    /**
1621
-     * Set post Categories.
1622
-     *
1623
-     * @since 1.0.0
1624
-     * @package GeoDirectory
1625
-     * @global object $wpdb WordPress Database object.
1626
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1627
-     * @param int $post_id The post ID.
1628
-     * @param array $terms An array of term objects.
1629
-     * @param array $tt_ids An array of term taxonomy IDs.
1630
-     * @param string $taxonomy Taxonomy slug.
1631
-     */
1632
-    function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1633
-    {
1634
-        global $wpdb, $plugin_prefix;
1578
+			$image->src = $request->src;
1579
+			$image->width = $width;
1580
+			$image->height = $height;
1635 1581
 
1636
-        $post_type = get_post_type($post_id);
1582
+			$max_size = (object)geodir_get_imagesize($size);
1637 1583
 
1638
-        $table = $plugin_prefix . $post_type . '_detail';
1584
+			if (!is_wp_error($max_size)) {
1585
+				if ($image->width) {
1586
+					if ($image->height >= $image->width) {
1587
+						$width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1588
+					} else if ($image->width < ($max_size->h)) {
1589
+						$width_per = round((($image->width / $max_size->w) * 100), 2);
1590
+					} else
1591
+						$width_per = 100;
1592
+				}
1593
+
1594
+				if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1595
+					$html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1596
+				} else {
1597
+					if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1598
+						$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1599
+					}else{
1600
+						//$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1601
+						//$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1602
+						$html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1603
+
1604
+					}
1639 1605
 
1640
-        if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1606
+				}
1607
+			}
1608
+		}
1609
+
1610
+		if (!empty($html) && $echo) {
1611
+			echo $html;
1612
+		} elseif (!empty($html)) {
1613
+			return $html;
1614
+		} else
1615
+			return false;
1616
+	}
1617
+}
1641 1618
 
1642
-            if ($taxonomy == $post_type . '_tags') {
1643
-                if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1644
-                    geodir_save_post_meta($post_id, 'post_tags', $terms);
1645
-                }
1646
-            } elseif ($taxonomy == $post_type . 'category') {
1647
-                $srcharr = array('"', '\\');
1648
-                $replarr = array("&quot;", '');
1619
+if (!function_exists('geodir_set_post_terms')) {
1620
+	/**
1621
+	 * Set post Categories.
1622
+	 *
1623
+	 * @since 1.0.0
1624
+	 * @package GeoDirectory
1625
+	 * @global object $wpdb WordPress Database object.
1626
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1627
+	 * @param int $post_id The post ID.
1628
+	 * @param array $terms An array of term objects.
1629
+	 * @param array $tt_ids An array of term taxonomy IDs.
1630
+	 * @param string $taxonomy Taxonomy slug.
1631
+	 */
1632
+	function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1633
+	{
1634
+		global $wpdb, $plugin_prefix;
1635
+
1636
+		$post_type = get_post_type($post_id);
1637
+
1638
+		$table = $plugin_prefix . $post_type . '_detail';
1639
+
1640
+		if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1641
+
1642
+			if ($taxonomy == $post_type . '_tags') {
1643
+				if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1644
+					geodir_save_post_meta($post_id, 'post_tags', $terms);
1645
+				}
1646
+			} elseif ($taxonomy == $post_type . 'category') {
1647
+				$srcharr = array('"', '\\');
1648
+				$replarr = array("&quot;", '');
1649 1649
 
1650
-                $post_obj = get_post($post_id);
1650
+				$post_obj = get_post($post_id);
1651 1651
 
1652
-                $cat_ids = array('0');
1653
-                if (is_array($tt_ids))
1654
-                    $cat_ids = $tt_ids;
1652
+				$cat_ids = array('0');
1653
+				if (is_array($tt_ids))
1654
+					$cat_ids = $tt_ids;
1655 1655
 
1656 1656
 
1657
-                if (!empty($cat_ids)) {
1658
-                    $cat_ids_array = $cat_ids;
1659
-                    $cat_ids_length = count($cat_ids_array);
1660
-                    $cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1661
-                    $format = implode(',', $cat_ids_format);
1657
+				if (!empty($cat_ids)) {
1658
+					$cat_ids_array = $cat_ids;
1659
+					$cat_ids_length = count($cat_ids_array);
1660
+					$cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1661
+					$format = implode(',', $cat_ids_format);
1662 1662
 
1663
-                    $cat_ids_array_del = $cat_ids_array;
1664
-                    $cat_ids_array_del[] = $post_id;
1663
+					$cat_ids_array_del = $cat_ids_array;
1664
+					$cat_ids_array_del[] = $post_id;
1665 1665
 
1666
-                    $wpdb->get_var(
1667
-                        $wpdb->prepare(
1668
-                            "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1669
-                            $cat_ids_array_del
1670
-                        )
1671
-                    );
1666
+					$wpdb->get_var(
1667
+						$wpdb->prepare(
1668
+							"DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1669
+							$cat_ids_array_del
1670
+						)
1671
+					);
1672 1672
 
1673 1673
 
1674
-                    $post_term = $wpdb->get_col(
1675
-                        $wpdb->prepare(
1676
-                            "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1677
-                            $cat_ids_array
1678
-                        )
1679
-                    );
1674
+					$post_term = $wpdb->get_col(
1675
+						$wpdb->prepare(
1676
+							"SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1677
+							$cat_ids_array
1678
+						)
1679
+					);
1680 1680
 
1681
-                }
1681
+				}
1682 1682
 
1683
-                $post_marker_json = '';
1683
+				$post_marker_json = '';
1684 1684
 
1685
-                if (!empty($post_term)):
1685
+				if (!empty($post_term)):
1686 1686
 
1687
-                    foreach ($post_term as $cat_id):
1687
+					foreach ($post_term as $cat_id):
1688 1688
 
1689
-                        $term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1690
-                        $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1689
+						$term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1690
+						$term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1691 1691
 
1692
-                        $post_title = $post_obj->title;
1693
-                        $title = str_replace($srcharr, $replarr, $post_title);
1692
+						$post_title = $post_obj->title;
1693
+						$title = str_replace($srcharr, $replarr, $post_title);
1694 1694
 
1695
-                        $lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1696
-                        $lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1695
+						$lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1696
+						$lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1697 1697
 
1698
-                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1699
-                        $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1698
+						$timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1699
+						$timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1700 1700
 
1701
-                        $json = '{';
1702
-                        $json .= '"id":"' . $post_id . '",';
1703
-                        $json .= '"lat_pos": "' . $lat . '",';
1704
-                        $json .= '"long_pos": "' . $lng . '",';
1705
-                        $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1706
-                        $json .= '"icon":"' . $term_icon . '",';
1707
-                        $json .= '"group":"catgroup' . $cat_id . '"';
1708
-                        $json .= '}';
1701
+						$json = '{';
1702
+						$json .= '"id":"' . $post_id . '",';
1703
+						$json .= '"lat_pos": "' . $lat . '",';
1704
+						$json .= '"long_pos": "' . $lng . '",';
1705
+						$json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1706
+						$json .= '"icon":"' . $term_icon . '",';
1707
+						$json .= '"group":"catgroup' . $cat_id . '"';
1708
+						$json .= '}';
1709 1709
 
1710 1710
 
1711
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1712
-                            $post_marker_json = $json;
1711
+						if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1712
+							$post_marker_json = $json;
1713 1713
 
1714 1714
 
1715
-                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1715
+						if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1716 1716
 
1717
-                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1717
+							$json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1718 1718
 										post_title = %s,
1719 1719
 										json = %s
1720 1720
 										WHERE post_id = %d AND cat_id = %d ",
1721
-                                array($post_title, $json, $post_id, $cat_id));
1721
+								array($post_title, $json, $post_id, $cat_id));
1722 1722
 
1723
-                        } else {
1723
+						} else {
1724 1724
 
1725
-                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1725
+							$json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1726 1726
 										post_id = %d,
1727 1727
 										post_title = %s,
1728 1728
 										cat_id = %d,
1729 1729
 										json = %s",
1730
-                                array($post_id, $post_title, $cat_id, $json));
1730
+								array($post_id, $post_title, $cat_id, $json));
1731 1731
 
1732
-                        }
1732
+						}
1733 1733
 
1734
-                        $wpdb->query($json_query);
1734
+						$wpdb->query($json_query);
1735 1735
 
1736
-                    endforeach;
1736
+					endforeach;
1737 1737
 
1738
-                endif;
1738
+				endif;
1739 1739
 
1740
-                if (!empty($post_term) && is_array($post_term)) {
1741
-                    $categories = implode(',', $post_term);
1740
+				if (!empty($post_term) && is_array($post_term)) {
1741
+					$categories = implode(',', $post_term);
1742 1742
 
1743
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1743
+					if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1744 1744
 
1745
-                    if (empty($post_marker_json))
1746
-                        $post_marker_json = isset($json) ? $json : '';
1745
+					if (empty($post_marker_json))
1746
+						$post_marker_json = isset($json) ? $json : '';
1747 1747
 
1748
-                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1748
+					if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1749 1749
 
1750
-                        $wpdb->query(
1751
-                            $wpdb->prepare(
1752
-                                "UPDATE " . $table . " SET
1750
+						$wpdb->query(
1751
+							$wpdb->prepare(
1752
+								"UPDATE " . $table . " SET
1753 1753
 								" . $taxonomy . " = %s,
1754 1754
 								marker_json = %s
1755 1755
 								where post_id = %d",
1756
-                                array($categories, $post_marker_json, $post_id)
1757
-                            )
1758
-                        );
1756
+								array($categories, $post_marker_json, $post_id)
1757
+							)
1758
+						);
1759 1759
 
1760
-                        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1760
+						if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1761 1761
 
1762
-                            $categories = trim($categories, ',');
1762
+							$categories = trim($categories, ',');
1763 1763
 
1764
-                            if ($categories) {
1764
+							if ($categories) {
1765 1765
 
1766
-                                $categories = explode(',', $categories);
1766
+								$categories = explode(',', $categories);
1767 1767
 
1768
-                                $default_category = geodir_get_post_meta($post_id, 'default_category', true);
1768
+								$default_category = geodir_get_post_meta($post_id, 'default_category', true);
1769 1769
 
1770
-                                if (!in_array($default_category, $categories)) {
1770
+								if (!in_array($default_category, $categories)) {
1771 1771
 
1772
-                                    $wpdb->query(
1773
-                                        $wpdb->prepare(
1774
-                                            "UPDATE " . $table . " SET
1772
+									$wpdb->query(
1773
+										$wpdb->prepare(
1774
+											"UPDATE " . $table . " SET
1775 1775
 											default_category = %s
1776 1776
 											where post_id = %d",
1777
-                                            array($categories[0], $post_id)
1778
-                                        )
1779
-                                    );
1777
+											array($categories[0], $post_id)
1778
+										)
1779
+									);
1780 1780
 
1781
-                                    $default_category = $categories[0];
1781
+									$default_category = $categories[0];
1782 1782
 
1783
-                                }
1783
+								}
1784 1784
 
1785
-                                if ($default_category == '')
1786
-                                    $default_category = $categories[0];
1785
+								if ($default_category == '')
1786
+									$default_category = $categories[0];
1787 1787
 
1788
-                                geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1788
+								geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1789 1789
 
1790
-                            }
1790
+							}
1791 1791
 
1792
-                        }
1792
+						}
1793 1793
 
1794 1794
 
1795
-                    } else {
1795
+					} else {
1796 1796
 
1797
-                        $wpdb->query(
1798
-                            $wpdb->prepare(
1799
-                                "INSERT INTO " . $table . " SET
1797
+						$wpdb->query(
1798
+							$wpdb->prepare(
1799
+								"INSERT INTO " . $table . " SET
1800 1800
 								post_id = %d,
1801 1801
 								" . $taxonomy . " = %s,
1802 1802
 								marker_json = %s ",
1803 1803
 
1804
-                                array($post_id, $categories, $post_marker_json)
1805
-                            )
1806
-                        );
1807
-                    }
1808
-                }
1809
-            }
1810
-        }
1811
-    }
1804
+								array($post_id, $categories, $post_marker_json)
1805
+							)
1806
+						);
1807
+					}
1808
+				}
1809
+			}
1810
+		}
1811
+	}
1812 1812
 }
1813 1813
 
1814 1814
 if (!function_exists('geodir_get_infowindow_html')) {
1815
-    /**
1816
-     * Set post Map Marker info html.
1817
-     *
1818
-     * @since 1.0.0
1819
-     * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1820
-     * @package GeoDirectory
1821
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
1822
-     * @global object $gd_session GeoDirectory Session object.
1823
-     * @param object $postinfo_obj The post details object.
1824
-     * @param string $post_preview Is this a post preview?.
1825
-     * @return mixed|string|void
1826
-     */
1827
-    function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1828
-    {
1829
-        global $preview, $gd_session;
1830
-        $srcharr = array("'", "/", "-", '"', '\\');
1831
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1832
-
1833
-        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1834
-            $ID = '';
1835
-            $plink = '';
1836
-
1837
-            if (isset($postinfo_obj->pid)) {
1838
-                $ID = $postinfo_obj->pid;
1839
-                $plink = get_permalink($ID);
1840
-            }
1841
-
1842
-            $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1843
-            $lat = $postinfo_obj->post_latitude;
1844
-            $lng = $postinfo_obj->post_longitude;
1845
-        } else {
1846
-            $ID = $postinfo_obj->post_id;
1847
-            $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1848
-            $plink = get_permalink($ID);
1849
-            $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1850
-            $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1851
-        }
1852
-
1853
-        // filter field as per price package
1854
-        global $geodir_addon_list;
1855
-        if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1856
-            $post_type = get_post_type($ID);
1857
-            $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1858
-            $field_name = 'geodir_contact';
1859
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1860
-                $contact = '';
1861
-            }
1862
-
1863
-            $field_name = 'geodir_timing';
1864
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1865
-                $timing = '';
1866
-            }
1867
-        }
1868
-
1869
-        if ($lat && $lng) {
1870
-            ob_start(); ?>
1815
+	/**
1816
+	 * Set post Map Marker info html.
1817
+	 *
1818
+	 * @since 1.0.0
1819
+	 * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1820
+	 * @package GeoDirectory
1821
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
1822
+	 * @global object $gd_session GeoDirectory Session object.
1823
+	 * @param object $postinfo_obj The post details object.
1824
+	 * @param string $post_preview Is this a post preview?.
1825
+	 * @return mixed|string|void
1826
+	 */
1827
+	function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1828
+	{
1829
+		global $preview, $gd_session;
1830
+		$srcharr = array("'", "/", "-", '"', '\\');
1831
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1832
+
1833
+		if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1834
+			$ID = '';
1835
+			$plink = '';
1836
+
1837
+			if (isset($postinfo_obj->pid)) {
1838
+				$ID = $postinfo_obj->pid;
1839
+				$plink = get_permalink($ID);
1840
+			}
1841
+
1842
+			$title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1843
+			$lat = $postinfo_obj->post_latitude;
1844
+			$lng = $postinfo_obj->post_longitude;
1845
+		} else {
1846
+			$ID = $postinfo_obj->post_id;
1847
+			$title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1848
+			$plink = get_permalink($ID);
1849
+			$lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1850
+			$lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1851
+		}
1852
+
1853
+		// filter field as per price package
1854
+		global $geodir_addon_list;
1855
+		if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1856
+			$post_type = get_post_type($ID);
1857
+			$package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1858
+			$field_name = 'geodir_contact';
1859
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1860
+				$contact = '';
1861
+			}
1862
+
1863
+			$field_name = 'geodir_timing';
1864
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1865
+				$timing = '';
1866
+			}
1867
+		}
1868
+
1869
+		if ($lat && $lng) {
1870
+			ob_start(); ?>
1871 1871
             <div class="gd-bubble" style="">
1872 1872
                 <div class="gd-bubble-inside">
1873 1873
                     <?php
1874
-                    $comment_count = '';
1875
-                    $rating_star = '';
1876
-                    if ($ID != '') {
1877
-                        $rating_star = '';
1878
-                        $comment_count = geodir_get_review_count_total($ID);
1879
-
1880
-                        if (!$preview) {
1881
-                            $post_avgratings = geodir_get_post_rating($ID);
1882
-
1883
-                            $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1884
-
1885
-                            /**
1886
-                             * Filter to change rating stars
1887
-                             *
1888
-                             * You can use this filter to change Rating stars.
1889
-                             *
1890
-                             * @since 1.0.0
1891
-                             * @package GeoDirectory
1892
-                             * @param string $rating_star Rating stars.
1893
-                             * @param float $post_avgratings Average ratings of the post.
1894
-                             * @param int $ID The post ID.
1895
-                             */
1896
-                            $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1897
-                        }
1898
-                    }
1899
-                    ?>
1874
+					$comment_count = '';
1875
+					$rating_star = '';
1876
+					if ($ID != '') {
1877
+						$rating_star = '';
1878
+						$comment_count = geodir_get_review_count_total($ID);
1879
+
1880
+						if (!$preview) {
1881
+							$post_avgratings = geodir_get_post_rating($ID);
1882
+
1883
+							$rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1884
+
1885
+							/**
1886
+							 * Filter to change rating stars
1887
+							 *
1888
+							 * You can use this filter to change Rating stars.
1889
+							 *
1890
+							 * @since 1.0.0
1891
+							 * @package GeoDirectory
1892
+							 * @param string $rating_star Rating stars.
1893
+							 * @param float $post_avgratings Average ratings of the post.
1894
+							 * @param int $ID The post ID.
1895
+							 */
1896
+							$rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1897
+						}
1898
+					}
1899
+					?>
1900 1900
                     <div class="geodir-bubble_desc">
1901 1901
                         <h4>
1902 1902
                             <a href="<?php if ($plink != '') {
1903
-                                echo $plink;
1904
-                            } else {
1905
-                                echo 'javascript:void(0);';
1906
-                            } ?>"><?php echo $title; ?></a>
1903
+								echo $plink;
1904
+							} else {
1905
+								echo 'javascript:void(0);';
1906
+							} ?>"><?php echo $title; ?></a>
1907 1907
                         </h4>
1908 1908
                         <?php
1909
-                        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1910
-                            $post_images = array();
1911
-                            if (!empty($postinfo_obj->post_images)) {
1912
-                                $post_images = explode(",", $postinfo_obj->post_images);
1913
-                            }
1914
-
1915
-                            if (!empty($post_images)) {
1916
-                                ?>
1909
+						if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1910
+							$post_images = array();
1911
+							if (!empty($postinfo_obj->post_images)) {
1912
+								$post_images = explode(",", $postinfo_obj->post_images);
1913
+							}
1914
+
1915
+							if (!empty($post_images)) {
1916
+								?>
1917 1917
                                 <div class="geodir-bubble_image"><a href="<?php if ($plink != '') {
1918
-                                        echo $plink;
1919
-                                    } else {
1920
-                                        echo 'javascript:void(0);';
1921
-                                    } ?>"><img alt="bubble image" style="max-height:50px;"
1918
+										echo $plink;
1919
+									} else {
1920
+										echo 'javascript:void(0);';
1921
+									} ?>"><img alt="bubble image" style="max-height:50px;"
1922 1922
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1923 1923
                             <?php
1924
-                            }else{
1925
-                                echo '<div class="geodir-bubble_image"></div>';
1926
-                            }
1927
-                        } else {
1928
-                            if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1929
-                                ?>
1924
+							}else{
1925
+								echo '<div class="geodir-bubble_image"></div>';
1926
+							}
1927
+						} else {
1928
+							if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1929
+								?>
1930 1930
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1931 1931
                             <?php
1932
-                            }else{
1933
-                                echo '<div class="geodir-bubble_image"></div>';
1934
-                            }
1935
-                        }
1936
-                        ?>
1932
+							}else{
1933
+								echo '<div class="geodir-bubble_image"></div>';
1934
+							}
1935
+						}
1936
+						?>
1937 1937
                         <div class="geodir-bubble-meta-side">
1938 1938
                             <?php
1939
-                            /**
1940
-                             * Fires before the meta info in the map info window.
1941
-                             *
1942
-                             * This can be used to add more info to the map info window before the normal meta info.
1943
-                             *
1944
-                             * @since 1.5.4
1945
-                             * @param int $ID The post id.
1946
-                             * @param object $postinfo_obj The posts info as an object.
1947
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1948
-                             */
1949
-                            do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1950
-
1951
-
1952
-                            echo geodir_show_listing_info('mapbubble');
1939
+							/**
1940
+							 * Fires before the meta info in the map info window.
1941
+							 *
1942
+							 * This can be used to add more info to the map info window before the normal meta info.
1943
+							 *
1944
+							 * @since 1.5.4
1945
+							 * @param int $ID The post id.
1946
+							 * @param object $postinfo_obj The posts info as an object.
1947
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1948
+							 */
1949
+							do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1950
+
1951
+
1952
+							echo geodir_show_listing_info('mapbubble');
1953 1953
                             
1954 1954
                                                       
1955 1955
 
1956
-                            /**
1957
-                             * Fires after the meta info in the map info window.
1958
-                             *
1959
-                             * This can be used to add more info to the map info window after the normal meta info.
1960
-                             *
1961
-                             * @since 1.4.2
1962
-                             * @param object $postinfo_obj The posts info as an object.
1963
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1964
-                             */
1965
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1966
-                            ?>
1956
+							/**
1957
+							 * Fires after the meta info in the map info window.
1958
+							 *
1959
+							 * This can be used to add more info to the map info window after the normal meta info.
1960
+							 *
1961
+							 * @since 1.4.2
1962
+							 * @param object $postinfo_obj The posts info as an object.
1963
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1964
+							 */
1965
+							do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1966
+							?>
1967 1967
                         </div>
1968 1968
                         <?php
1969 1969
 
1970
-                        if ($ID) {
1970
+						if ($ID) {
1971 1971
 
1972
-                            $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1973
-                            ?>
1972
+							$post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1973
+							?>
1974 1974
                             <div class="geodir-bubble-meta-fade"></div>
1975 1975
 
1976 1976
                             <div class="geodir-bubble-meta-bottom">
@@ -1990,69 +1990,69 @@  discard block
 block discarded – undo
1990 1990
                 </div>
1991 1991
             </div>
1992 1992
             <?php
1993
-            $html = ob_get_clean();
1994
-            /**
1995
-             * Filter to change infowindow html
1996
-             *
1997
-             * You can use this filter to change infowindow html.
1998
-             *
1999
-             * @since 1.0.0
2000
-             * @package GeoDirectory
2001
-             * @param string $html Infowindow html.
2002
-             * @param object $postinfo_obj The Post object.
2003
-             * @param bool|string $post_preview Is this a post preview?
2004
-             */
2005
-            $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
2006
-            return $html;
2007
-        }
2008
-    }
1993
+			$html = ob_get_clean();
1994
+			/**
1995
+			 * Filter to change infowindow html
1996
+			 *
1997
+			 * You can use this filter to change infowindow html.
1998
+			 *
1999
+			 * @since 1.0.0
2000
+			 * @package GeoDirectory
2001
+			 * @param string $html Infowindow html.
2002
+			 * @param object $postinfo_obj The Post object.
2003
+			 * @param bool|string $post_preview Is this a post preview?
2004
+			 */
2005
+			$html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
2006
+			return $html;
2007
+		}
2008
+	}
2009 2009
 }
2010 2010
 
2011 2011
 
2012 2012
 if (!function_exists('geodir_new_post_default_status')) {
2013
-    /**
2014
-     * Default post status for new posts.
2015
-     *
2016
-     * @since 1.0.0
2017
-     * @package GeoDirectory
2018
-     * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2019
-     */
2020
-    function geodir_new_post_default_status()
2021
-    {
2022
-        if (get_option('geodir_new_post_default_status'))
2023
-            return get_option('geodir_new_post_default_status');
2024
-        else
2025
-            return 'publish';
2026
-
2027
-    }
2013
+	/**
2014
+	 * Default post status for new posts.
2015
+	 *
2016
+	 * @since 1.0.0
2017
+	 * @package GeoDirectory
2018
+	 * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2019
+	 */
2020
+	function geodir_new_post_default_status()
2021
+	{
2022
+		if (get_option('geodir_new_post_default_status'))
2023
+			return get_option('geodir_new_post_default_status');
2024
+		else
2025
+			return 'publish';
2026
+
2027
+	}
2028 2028
 }
2029 2029
 
2030 2030
 if (!function_exists('geodir_change_post_status')) {
2031
-    /**
2032
-     * Change post status of a post.
2033
-     *
2034
-     * @global object $wpdb WordPress Database object.
2035
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2036
-     * @param int|string $post_id The post ID.
2037
-     * @param string $status New post status. Ex: draft, publish etc.
2038
-     */
2039
-    function geodir_change_post_status($post_id = '', $status = '')
2040
-    {
2041
-        global $wpdb, $plugin_prefix;
2042
-
2043
-        $post_type = get_post_type($post_id);
2044
-
2045
-        $table = $plugin_prefix . $post_type . '_detail';
2046
-
2047
-        $wpdb->query(
2048
-            $wpdb->prepare(
2049
-                "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2050
-                array($status, $post_id)
2051
-            )
2052
-        );
2053
-
2054
-
2055
-    }
2031
+	/**
2032
+	 * Change post status of a post.
2033
+	 *
2034
+	 * @global object $wpdb WordPress Database object.
2035
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2036
+	 * @param int|string $post_id The post ID.
2037
+	 * @param string $status New post status. Ex: draft, publish etc.
2038
+	 */
2039
+	function geodir_change_post_status($post_id = '', $status = '')
2040
+	{
2041
+		global $wpdb, $plugin_prefix;
2042
+
2043
+		$post_type = get_post_type($post_id);
2044
+
2045
+		$table = $plugin_prefix . $post_type . '_detail';
2046
+
2047
+		$wpdb->query(
2048
+			$wpdb->prepare(
2049
+				"UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2050
+				array($status, $post_id)
2051
+			)
2052
+		);
2053
+
2054
+
2055
+	}
2056 2056
 }
2057 2057
 
2058 2058
 /**
@@ -2066,13 +2066,13 @@  discard block
 block discarded – undo
2066 2066
  */
2067 2067
 function geodir_set_post_status($pid, $status)
2068 2068
 {
2069
-    if ($pid) {
2070
-        global $wpdb;
2071
-        $my_post = array();
2072
-        $my_post['post_status'] = $status;
2073
-        $my_post['ID'] = $pid;
2074
-        $last_postid = wp_update_post($my_post);
2075
-    }
2069
+	if ($pid) {
2070
+		global $wpdb;
2071
+		$my_post = array();
2072
+		$my_post['post_status'] = $status;
2073
+		$my_post['ID'] = $pid;
2074
+		$last_postid = wp_update_post($my_post);
2075
+	}
2076 2076
 }
2077 2077
 
2078 2078
 
@@ -2088,384 +2088,384 @@  discard block
 block discarded – undo
2088 2088
  */
2089 2089
 function geodir_update_poststatus($new_status, $old_status, $post)
2090 2090
 {
2091
-    global $wpdb;
2091
+	global $wpdb;
2092 2092
 
2093
-    $geodir_posttypes = geodir_get_posttypes();
2093
+	$geodir_posttypes = geodir_get_posttypes();
2094 2094
 
2095
-    if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2095
+	if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2096 2096
 
2097
-        geodir_change_post_status($post->ID, $new_status);
2098
-    }
2097
+		geodir_change_post_status($post->ID, $new_status);
2098
+	}
2099 2099
 }
2100 2100
 
2101 2101
 
2102 2102
 if (!function_exists('geodir_update_listing_info')) {
2103
-    /**
2104
-     * Update post info.
2105
-     *
2106
-     * @since 1.0.0
2107
-     * @package GeoDirectory
2108
-     * @global object $wpdb WordPress Database object.
2109
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2110
-     * @param int $updatingpost The updating post ID.
2111
-     * @param int $temppost The temporary post ID.
2112
-     * @todo fix post_id variable
2113
-     */
2114
-    function geodir_update_listing_info($updatingpost, $temppost)
2115
-    {
2116
-
2117
-        global $wpdb, $plugin_prefix;
2118
-
2119
-        $post_type = get_post_type($post_id);
2120
-
2121
-        $table = $plugin_prefix . $post_type . '_detail';
2122
-
2123
-        $wpdb->query(
2124
-            $wpdb->prepare(
2125
-                "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2126
-                array($updatingpost, $temppost)
2127
-            )
2128
-        );
2129
-
2130
-        $wpdb->query(
2131
-            $wpdb->prepare(
2132
-                "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2133
-                array($updatingpost, $temppost)
2134
-            )
2135
-        );
2136
-
2137
-        /* Update Attachments*/
2138
-
2139
-        $wpdb->query(
2140
-            $wpdb->prepare(
2141
-                "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2142
-                array($updatingpost, $temppost)
2143
-            )
2144
-        );
2145
-
2146
-    }
2103
+	/**
2104
+	 * Update post info.
2105
+	 *
2106
+	 * @since 1.0.0
2107
+	 * @package GeoDirectory
2108
+	 * @global object $wpdb WordPress Database object.
2109
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2110
+	 * @param int $updatingpost The updating post ID.
2111
+	 * @param int $temppost The temporary post ID.
2112
+	 * @todo fix post_id variable
2113
+	 */
2114
+	function geodir_update_listing_info($updatingpost, $temppost)
2115
+	{
2116
+
2117
+		global $wpdb, $plugin_prefix;
2118
+
2119
+		$post_type = get_post_type($post_id);
2120
+
2121
+		$table = $plugin_prefix . $post_type . '_detail';
2122
+
2123
+		$wpdb->query(
2124
+			$wpdb->prepare(
2125
+				"UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2126
+				array($updatingpost, $temppost)
2127
+			)
2128
+		);
2129
+
2130
+		$wpdb->query(
2131
+			$wpdb->prepare(
2132
+				"UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2133
+				array($updatingpost, $temppost)
2134
+			)
2135
+		);
2136
+
2137
+		/* Update Attachments*/
2138
+
2139
+		$wpdb->query(
2140
+			$wpdb->prepare(
2141
+				"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2142
+				array($updatingpost, $temppost)
2143
+			)
2144
+		);
2145
+
2146
+	}
2147 2147
 }
2148 2148
 
2149 2149
 
2150 2150
 if (!function_exists('geodir_delete_listing_info')) {
2151
-    /**
2152
-     * Delete Listing info from details table for the given post id.
2153
-     *
2154
-     * @since 1.0.0
2155
-     * @package GeoDirectory
2156
-     * @global object $wpdb WordPress Database object.
2157
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2158
-     * @param int $deleted_postid The post ID.
2159
-     * @param bool $force Optional. Do you want to force delete it? Default: false.
2160
-     * @return bool|void
2161
-     */
2162
-    function geodir_delete_listing_info($deleted_postid, $force = false)
2163
-    {
2164
-        global $wpdb, $plugin_prefix;
2165
-
2166
-        // check for multisite deletions
2167
-        if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2168
-        } else {
2169
-            return;
2170
-        }
2171
-
2172
-        $post_type = get_post_type($deleted_postid);
2173
-
2174
-        $all_postypes = geodir_get_posttypes();
2175
-
2176
-        if (!in_array($post_type, $all_postypes))
2177
-            return false;
2178
-
2179
-        $table = $plugin_prefix . $post_type . '_detail';
2180
-
2181
-        /* Delete custom post meta*/
2182
-        $wpdb->query(
2183
-            $wpdb->prepare(
2184
-                "DELETE FROM " . $table . " WHERE `post_id` = %d",
2185
-                array($deleted_postid)
2186
-            )
2187
-        );
2188
-
2189
-        /* Delete post map icons*/
2190
-
2191
-        $wpdb->query(
2192
-            $wpdb->prepare(
2193
-                "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2194
-                array($deleted_postid)
2195
-            )
2196
-        );
2197
-
2198
-        /* Delete Attachments*/
2199
-        $postcurr_images = geodir_get_images($deleted_postid);
2200
-
2201
-        $wpdb->query(
2202
-            $wpdb->prepare(
2203
-                "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2204
-                array($deleted_postid)
2205
-            )
2206
-        );
2207
-        geodir_remove_attachments($postcurr_images);
2208
-
2209
-    }
2151
+	/**
2152
+	 * Delete Listing info from details table for the given post id.
2153
+	 *
2154
+	 * @since 1.0.0
2155
+	 * @package GeoDirectory
2156
+	 * @global object $wpdb WordPress Database object.
2157
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2158
+	 * @param int $deleted_postid The post ID.
2159
+	 * @param bool $force Optional. Do you want to force delete it? Default: false.
2160
+	 * @return bool|void
2161
+	 */
2162
+	function geodir_delete_listing_info($deleted_postid, $force = false)
2163
+	{
2164
+		global $wpdb, $plugin_prefix;
2165
+
2166
+		// check for multisite deletions
2167
+		if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2168
+		} else {
2169
+			return;
2170
+		}
2171
+
2172
+		$post_type = get_post_type($deleted_postid);
2173
+
2174
+		$all_postypes = geodir_get_posttypes();
2175
+
2176
+		if (!in_array($post_type, $all_postypes))
2177
+			return false;
2178
+
2179
+		$table = $plugin_prefix . $post_type . '_detail';
2180
+
2181
+		/* Delete custom post meta*/
2182
+		$wpdb->query(
2183
+			$wpdb->prepare(
2184
+				"DELETE FROM " . $table . " WHERE `post_id` = %d",
2185
+				array($deleted_postid)
2186
+			)
2187
+		);
2188
+
2189
+		/* Delete post map icons*/
2190
+
2191
+		$wpdb->query(
2192
+			$wpdb->prepare(
2193
+				"DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2194
+				array($deleted_postid)
2195
+			)
2196
+		);
2197
+
2198
+		/* Delete Attachments*/
2199
+		$postcurr_images = geodir_get_images($deleted_postid);
2200
+
2201
+		$wpdb->query(
2202
+			$wpdb->prepare(
2203
+				"DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2204
+				array($deleted_postid)
2205
+			)
2206
+		);
2207
+		geodir_remove_attachments($postcurr_images);
2208
+
2209
+	}
2210 2210
 }
2211 2211
 
2212 2212
 
2213 2213
 if (!function_exists('geodir_add_to_favorite')) {
2214
-    /**
2215
-     * This function would add listing to favorite listing.
2216
-     *
2217
-     * @since 1.0.0
2218
-     * @package GeoDirectory
2219
-     * @global object $current_user Current user object.
2220
-     * @param int $post_id The post ID.
2221
-     */
2222
-    function geodir_add_to_favorite($post_id)
2223
-    {
2224
-
2225
-        global $current_user;
2226
-
2227
-        /**
2228
-         * Filter to modify "Unfavorite" text
2229
-         *
2230
-         * You can use this filter to rename "Unfavorite" text to something else.
2231
-         *
2232
-         * @since 1.0.0
2233
-         * @package GeoDirectory
2234
-         */
2235
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2236
-
2237
-        /**
2238
-         * Filter to modify "Remove from Favorites" text
2239
-         *
2240
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2241
-         *
2242
-         * @since 1.0.0
2243
-         * @package GeoDirectory
2244
-         */
2245
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2246
-
2247
-        /**
2248
-         * Filter to modify "fa fa-heart" icon
2249
-         *
2250
-         * You can use this filter to change "fa fa-heart" icon to something else.
2251
-         *
2252
-         * @since 1.0.0
2253
-         * @package GeoDirectory
2254
-         */
2255
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2256
-
2257
-        $user_meta_data = array();
2258
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2214
+	/**
2215
+	 * This function would add listing to favorite listing.
2216
+	 *
2217
+	 * @since 1.0.0
2218
+	 * @package GeoDirectory
2219
+	 * @global object $current_user Current user object.
2220
+	 * @param int $post_id The post ID.
2221
+	 */
2222
+	function geodir_add_to_favorite($post_id)
2223
+	{
2224
+
2225
+		global $current_user;
2226
+
2227
+		/**
2228
+		 * Filter to modify "Unfavorite" text
2229
+		 *
2230
+		 * You can use this filter to rename "Unfavorite" text to something else.
2231
+		 *
2232
+		 * @since 1.0.0
2233
+		 * @package GeoDirectory
2234
+		 */
2235
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2236
+
2237
+		/**
2238
+		 * Filter to modify "Remove from Favorites" text
2239
+		 *
2240
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2241
+		 *
2242
+		 * @since 1.0.0
2243
+		 * @package GeoDirectory
2244
+		 */
2245
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2246
+
2247
+		/**
2248
+		 * Filter to modify "fa fa-heart" icon
2249
+		 *
2250
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2251
+		 *
2252
+		 * @since 1.0.0
2253
+		 * @package GeoDirectory
2254
+		 */
2255
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2256
+
2257
+		$user_meta_data = array();
2258
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2259
+
2260
+		if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2261
+			$user_meta_data[] = $post_id;
2262
+		}
2263
+
2264
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2265
+
2266
+		/**
2267
+		 * Called before adding the post from favourites.
2268
+		 *
2269
+		 * @since 1.0.0
2270
+		 * @package GeoDirectory
2271
+		 * @param int $post_id The post ID.
2272
+		 */
2273
+		do_action('geodir_before_add_from_favorite', $post_id);
2274
+
2275
+		echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2276
+
2277
+		/**
2278
+		 * Called after adding the post from favourites.
2279
+		 *
2280
+		 * @since 1.0.0
2281
+		 * @package GeoDirectory
2282
+		 * @param int $post_id The post ID.
2283
+		 */
2284
+		do_action('geodir_after_add_from_favorite', $post_id);
2259 2285
 
2260
-        if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2261
-            $user_meta_data[] = $post_id;
2262
-        }
2263
-
2264
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2265
-
2266
-        /**
2267
-         * Called before adding the post from favourites.
2268
-         *
2269
-         * @since 1.0.0
2270
-         * @package GeoDirectory
2271
-         * @param int $post_id The post ID.
2272
-         */
2273
-        do_action('geodir_before_add_from_favorite', $post_id);
2274
-
2275
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2276
-
2277
-        /**
2278
-         * Called after adding the post from favourites.
2279
-         *
2280
-         * @since 1.0.0
2281
-         * @package GeoDirectory
2282
-         * @param int $post_id The post ID.
2283
-         */
2284
-        do_action('geodir_after_add_from_favorite', $post_id);
2285
-
2286
-    }
2286
+	}
2287 2287
 }
2288 2288
 
2289 2289
 if (!function_exists('geodir_remove_from_favorite')) {
2290
-    /**
2291
-     * This function would remove the favourited property earlier.
2292
-     *
2293
-     * @since 1.0.0
2294
-     * @package GeoDirectory
2295
-     * @global object $current_user Current user object.
2296
-     * @param int $post_id The post ID.
2297
-     */
2298
-    function geodir_remove_from_favorite($post_id)
2299
-    {
2300
-        global $current_user;
2301
-
2302
-        /**
2303
-         * Filter to modify "Add to Favorites" text
2304
-         *
2305
-         * You can use this filter to rename "Add to Favorites" text to something else.
2306
-         *
2307
-         * @since 1.0.0
2308
-         * @package GeoDirectory
2309
-         */
2310
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2311
-
2312
-        /**
2313
-         * Filter to modify "Favourite" text
2314
-         *
2315
-         * You can use this filter to rename "Favourite" text to something else.
2316
-         *
2317
-         * @since 1.0.0
2318
-         * @package GeoDirectory
2319
-         */
2320
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2321
-
2322
-        /**
2323
-         * Filter to modify "fa fa-heart" icon
2324
-         *
2325
-         * You can use this filter to change "fa fa-heart" icon to something else.
2326
-         *
2327
-         * @since 1.0.0
2328
-         * @package GeoDirectory
2329
-         */
2330
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2331
-
2332
-        $user_meta_data = array();
2333
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2334
-
2335
-        if (!empty($user_meta_data)) {
2336
-
2337
-            if (($key = array_search($post_id, $user_meta_data)) !== false) {
2338
-                unset($user_meta_data[$key]);
2339
-            }
2290
+	/**
2291
+	 * This function would remove the favourited property earlier.
2292
+	 *
2293
+	 * @since 1.0.0
2294
+	 * @package GeoDirectory
2295
+	 * @global object $current_user Current user object.
2296
+	 * @param int $post_id The post ID.
2297
+	 */
2298
+	function geodir_remove_from_favorite($post_id)
2299
+	{
2300
+		global $current_user;
2301
+
2302
+		/**
2303
+		 * Filter to modify "Add to Favorites" text
2304
+		 *
2305
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2306
+		 *
2307
+		 * @since 1.0.0
2308
+		 * @package GeoDirectory
2309
+		 */
2310
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2311
+
2312
+		/**
2313
+		 * Filter to modify "Favourite" text
2314
+		 *
2315
+		 * You can use this filter to rename "Favourite" text to something else.
2316
+		 *
2317
+		 * @since 1.0.0
2318
+		 * @package GeoDirectory
2319
+		 */
2320
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2321
+
2322
+		/**
2323
+		 * Filter to modify "fa fa-heart" icon
2324
+		 *
2325
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2326
+		 *
2327
+		 * @since 1.0.0
2328
+		 * @package GeoDirectory
2329
+		 */
2330
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2331
+
2332
+		$user_meta_data = array();
2333
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2334
+
2335
+		if (!empty($user_meta_data)) {
2336
+
2337
+			if (($key = array_search($post_id, $user_meta_data)) !== false) {
2338
+				unset($user_meta_data[$key]);
2339
+			}
2340 2340
 
2341
-        }
2341
+		}
2342 2342
 
2343
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2343
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2344 2344
 
2345
-        /**
2346
-         * Called before removing the post from favourites.
2347
-         *
2348
-         * @since 1.0.0
2349
-         * @package GeoDirectory
2350
-         * @param int $post_id The post ID.
2351
-         */
2352
-        do_action('geodir_before_remove_from_favorite', $post_id);
2345
+		/**
2346
+		 * Called before removing the post from favourites.
2347
+		 *
2348
+		 * @since 1.0.0
2349
+		 * @package GeoDirectory
2350
+		 * @param int $post_id The post ID.
2351
+		 */
2352
+		do_action('geodir_before_remove_from_favorite', $post_id);
2353 2353
 
2354
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2354
+		echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2355 2355
 
2356
-        /**
2357
-         * Called after removing the post from favourites.
2358
-         *
2359
-         * @since 1.0.0
2360
-         * @package GeoDirectory
2361
-         * @param int $post_id The post ID.
2362
-         */
2363
-        do_action('geodir_after_remove_from_favorite', $post_id);
2356
+		/**
2357
+		 * Called after removing the post from favourites.
2358
+		 *
2359
+		 * @since 1.0.0
2360
+		 * @package GeoDirectory
2361
+		 * @param int $post_id The post ID.
2362
+		 */
2363
+		do_action('geodir_after_remove_from_favorite', $post_id);
2364 2364
 
2365
-    }
2365
+	}
2366 2366
 }
2367 2367
 
2368 2368
 if (!function_exists('geodir_favourite_html')) {
2369
-    /**
2370
-     * This function would display the html content for add to favorite or remove from favorite.
2371
-     *
2372
-     * @since 1.0.0
2373
-     * @package GeoDirectory
2374
-     * @global object $current_user Current user object.
2375
-     * @global object $post The current post object.
2376
-     * @param int $user_id The user ID.
2377
-     * @param int $post_id The post ID.
2378
-     */
2379
-    function geodir_favourite_html($user_id, $post_id)
2380
-    {
2381
-
2382
-        global $current_user, $post;
2383
-
2384
-        /**
2385
-         * Filter to modify "Add to Favorites" text
2386
-         *
2387
-         * You can use this filter to rename "Add to Favorites" text to something else.
2388
-         *
2389
-         * @since 1.0.0
2390
-         * @package GeoDirectory
2391
-         */
2392
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2393
-
2394
-        /**
2395
-         * Filter to modify "Favourite" text
2396
-         *
2397
-         * You can use this filter to rename "Favourite" text to something else.
2398
-         *
2399
-         * @since 1.0.0
2400
-         * @package GeoDirectory
2401
-         */
2402
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2403
-
2404
-        /**
2405
-         * Filter to modify "Unfavorite" text
2406
-         *
2407
-         * You can use this filter to rename "Unfavorite" text to something else.
2408
-         *
2409
-         * @since 1.0.0
2410
-         * @package GeoDirectory
2411
-         */
2412
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2413
-
2414
-        /**
2415
-         * Filter to modify "Remove from Favorites" text
2416
-         *
2417
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2418
-         *
2419
-         * @since 1.0.0
2420
-         * @package GeoDirectory
2421
-         */
2422
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2423
-
2424
-        /**
2425
-         * Filter to modify "fa fa-heart" icon
2426
-         *
2427
-         * You can use this filter to change "fa fa-heart" icon to something else.
2428
-         *
2429
-         * @since 1.0.0
2430
-         * @package GeoDirectory
2431
-         */
2432
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2433
-
2434
-        /**
2435
-         * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2436
-         *
2437
-         * You can use this filter to change "fa fa-heart" icon to something else.
2438
-         *
2439
-         * @since 1.0.0
2440
-         * @package GeoDirectory
2441
-         */
2442
-        $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2443
-
2444
-        $user_meta_data = '';
2445
-        if (isset($current_user->data->ID))
2446
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2447
-
2448
-        if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2449
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2369
+	/**
2370
+	 * This function would display the html content for add to favorite or remove from favorite.
2371
+	 *
2372
+	 * @since 1.0.0
2373
+	 * @package GeoDirectory
2374
+	 * @global object $current_user Current user object.
2375
+	 * @global object $post The current post object.
2376
+	 * @param int $user_id The user ID.
2377
+	 * @param int $post_id The post ID.
2378
+	 */
2379
+	function geodir_favourite_html($user_id, $post_id)
2380
+	{
2381
+
2382
+		global $current_user, $post;
2383
+
2384
+		/**
2385
+		 * Filter to modify "Add to Favorites" text
2386
+		 *
2387
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2388
+		 *
2389
+		 * @since 1.0.0
2390
+		 * @package GeoDirectory
2391
+		 */
2392
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2393
+
2394
+		/**
2395
+		 * Filter to modify "Favourite" text
2396
+		 *
2397
+		 * You can use this filter to rename "Favourite" text to something else.
2398
+		 *
2399
+		 * @since 1.0.0
2400
+		 * @package GeoDirectory
2401
+		 */
2402
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2403
+
2404
+		/**
2405
+		 * Filter to modify "Unfavorite" text
2406
+		 *
2407
+		 * You can use this filter to rename "Unfavorite" text to something else.
2408
+		 *
2409
+		 * @since 1.0.0
2410
+		 * @package GeoDirectory
2411
+		 */
2412
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2413
+
2414
+		/**
2415
+		 * Filter to modify "Remove from Favorites" text
2416
+		 *
2417
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2418
+		 *
2419
+		 * @since 1.0.0
2420
+		 * @package GeoDirectory
2421
+		 */
2422
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2423
+
2424
+		/**
2425
+		 * Filter to modify "fa fa-heart" icon
2426
+		 *
2427
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2428
+		 *
2429
+		 * @since 1.0.0
2430
+		 * @package GeoDirectory
2431
+		 */
2432
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2433
+
2434
+		/**
2435
+		 * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2436
+		 *
2437
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2438
+		 *
2439
+		 * @since 1.0.0
2440
+		 * @package GeoDirectory
2441
+		 */
2442
+		$unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2443
+
2444
+		$user_meta_data = '';
2445
+		if (isset($current_user->data->ID))
2446
+			$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2447
+
2448
+		if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2449
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2450 2450
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2451 2451
                 onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2452 2452
                 title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2453 2453
             </a>   </span><?php
2454 2454
 
2455
-        } else {
2455
+		} else {
2456 2456
 
2457
-            if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2458
-                $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2459
-            } else
2460
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2457
+			if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2458
+				$script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2459
+			} else
2460
+				$script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2461 2461
 
2462
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2462
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2463 2463
                                                                                         href="javascript:void(0);"
2464 2464
                                                                                         onclick="<?php echo $script_text;?>"
2465 2465
                                                                                         title="<?php echo $add_favourite_text;?>"><i
2466 2466
                     class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2467 2467
         <?php }
2468
-    }
2468
+	}
2469 2469
 }
2470 2470
 
2471 2471
 
@@ -2482,54 +2482,54 @@  discard block
 block discarded – undo
2482 2482
 function geodir_get_cat_postcount($term = array())
2483 2483
 {
2484 2484
 
2485
-    if (!empty($term)) {
2485
+	if (!empty($term)) {
2486 2486
 
2487
-        global $wpdb, $plugin_prefix;
2487
+		global $wpdb, $plugin_prefix;
2488 2488
 
2489
-        $where = '';
2490
-        $join = '';
2491
-        if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2492
-            $taxonomy_obj = get_taxonomy($term->taxonomy);
2489
+		$where = '';
2490
+		$join = '';
2491
+		if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2492
+			$taxonomy_obj = get_taxonomy($term->taxonomy);
2493 2493
 
2494
-            $post_type = $taxonomy_obj->object_type[0];
2494
+			$post_type = $taxonomy_obj->object_type[0];
2495 2495
 
2496
-            $table = $plugin_prefix . $post_type . '_detail';
2496
+			$table = $plugin_prefix . $post_type . '_detail';
2497 2497
 
2498
-            /**
2499
-             * Filter to modify the 'join' query
2500
-             *
2501
-             * @since 1.0.0
2502
-             * @package GeoDirectory
2503
-             * @param object|array $term category / term object that need to be processed.
2504
-             * @param string $join The join query.
2505
-             */
2506
-            $join = apply_filters('geodir_cat_post_count_join', $join, $term);
2498
+			/**
2499
+			 * Filter to modify the 'join' query
2500
+			 *
2501
+			 * @since 1.0.0
2502
+			 * @package GeoDirectory
2503
+			 * @param object|array $term category / term object that need to be processed.
2504
+			 * @param string $join The join query.
2505
+			 */
2506
+			$join = apply_filters('geodir_cat_post_count_join', $join, $term);
2507 2507
 
2508
-            /**
2509
-             * Filter to modify the 'where' query
2510
-             *
2511
-             * @since 1.0.0
2512
-             * @package GeoDirectory
2513
-             * @param object|array $term category / term object that need to be processed.
2514
-             * @param string $where The where query.
2515
-             */
2516
-            $where = apply_filters('geodir_cat_post_count_where', $where, $term);
2508
+			/**
2509
+			 * Filter to modify the 'where' query
2510
+			 *
2511
+			 * @since 1.0.0
2512
+			 * @package GeoDirectory
2513
+			 * @param object|array $term category / term object that need to be processed.
2514
+			 * @param string $where The where query.
2515
+			 */
2516
+			$where = apply_filters('geodir_cat_post_count_where', $where, $term);
2517 2517
 
2518
-            $count_query = "SELECT count(post_id) FROM
2518
+			$count_query = "SELECT count(post_id) FROM
2519 2519
 							" . $table . " as pd " . $join . "
2520 2520
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2521 2521
 
2522
-            $cat_post_count = $wpdb->get_var($count_query);
2523
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2524
-                $cat_post_count = 0;
2522
+			$cat_post_count = $wpdb->get_var($count_query);
2523
+			if (empty($cat_post_count) || is_wp_error($cat_post_count))
2524
+				$cat_post_count = 0;
2525 2525
 
2526
-            return $cat_post_count;
2526
+			return $cat_post_count;
2527 2527
 
2528
-        } else
2528
+		} else
2529 2529
 
2530
-            return $term->count;
2531
-    }
2532
-    return false;
2530
+			return $term->count;
2531
+	}
2532
+	return false;
2533 2533
 
2534 2534
 }
2535 2535
 
@@ -2542,17 +2542,17 @@  discard block
 block discarded – undo
2542 2542
  */
2543 2543
 function geodir_allow_post_type_frontend()
2544 2544
 {
2545
-    $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2545
+	$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2546 2546
 
2547
-    if (!is_admin() && isset($_REQUEST['listing_type'])
2548
-        && !empty($geodir_allow_posttype_frontend)
2549
-        && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2550
-    ) {
2547
+	if (!is_admin() && isset($_REQUEST['listing_type'])
2548
+		&& !empty($geodir_allow_posttype_frontend)
2549
+		&& !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2550
+	) {
2551 2551
 
2552
-        wp_redirect(home_url());
2553
-        exit;
2552
+		wp_redirect(home_url());
2553
+		exit;
2554 2554
 
2555
-    }
2555
+	}
2556 2556
 
2557 2557
 }
2558 2558
 
@@ -2569,20 +2569,20 @@  discard block
 block discarded – undo
2569 2569
  */
2570 2570
 function geodir_excerpt_length($length)
2571 2571
 {
2572
-    global $wp_query, $geodir_is_widget_listing;
2572
+	global $wp_query, $geodir_is_widget_listing;
2573 2573
 	if ($geodir_is_widget_listing) {
2574 2574
 		return $length;
2575 2575
 	}
2576 2576
 	
2577
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2578
-        $length = get_option('geodir_desc_word_limit');
2579
-    elseif (get_query_var('excerpt_length'))
2580
-        $length = get_query_var('excerpt_length');
2577
+	if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2578
+		$length = get_option('geodir_desc_word_limit');
2579
+	elseif (get_query_var('excerpt_length'))
2580
+		$length = get_query_var('excerpt_length');
2581 2581
 
2582
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2583
-        $length = get_option('geodir_author_desc_word_limit');
2582
+	if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2583
+		$length = get_option('geodir_author_desc_word_limit');
2584 2584
 
2585
-    return $length;
2585
+	return $length;
2586 2586
 }
2587 2587
 
2588 2588
 /**
@@ -2597,13 +2597,13 @@  discard block
 block discarded – undo
2597 2597
  */
2598 2598
 function geodir_excerpt_more($more)
2599 2599
 {
2600
-    global $post;
2601
-    $all_postypes = geodir_get_posttypes();
2602
-    if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2603
-        return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2604
-    }
2600
+	global $post;
2601
+	$all_postypes = geodir_get_posttypes();
2602
+	if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2603
+		return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2604
+	}
2605 2605
 
2606
-    return $more;
2606
+	return $more;
2607 2607
 }
2608 2608
 
2609 2609
 
@@ -2620,63 +2620,63 @@  discard block
 block discarded – undo
2620 2620
  */
2621 2621
 function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy)
2622 2622
 {
2623
-    global $plugin_prefix, $wpdb;
2623
+	global $plugin_prefix, $wpdb;
2624 2624
 
2625
-    $gd_taxonomies = geodir_get_taxonomies();
2625
+	$gd_taxonomies = geodir_get_taxonomies();
2626 2626
 
2627
-    if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2627
+	if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2628 2628
 
2629
-        $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2630
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
2629
+		$geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2630
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
2631 2631
 
2632
-        $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2633
-        $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2632
+		$path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2633
+		$term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2634 2634
 
2635
-        $posts = $wpdb->get_results(
2636
-            $wpdb->prepare(
2637
-                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2638
-                array($term_id, $taxonomy)
2639
-            )
2640
-        );
2635
+		$posts = $wpdb->get_results(
2636
+			$wpdb->prepare(
2637
+				"SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2638
+				array($term_id, $taxonomy)
2639
+			)
2640
+		);
2641 2641
 
2642
-        if (!empty($posts)):
2643
-            foreach ($posts as $post_obj) {
2642
+		if (!empty($posts)):
2643
+			foreach ($posts as $post_obj) {
2644 2644
 
2645
-                $lat = $post_obj->post_latitude;
2646
-                $lng = $post_obj->post_longitude;
2645
+				$lat = $post_obj->post_latitude;
2646
+				$lng = $post_obj->post_longitude;
2647 2647
 
2648
-                $json = '{';
2649
-                $json .= '"id":"' . $post_obj->post_id . '",';
2650
-                $json .= '"lat_pos": "' . $lat . '",';
2651
-                $json .= '"long_pos": "' . $lng . '",';
2652
-                $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2653
-                $json .= '"icon":"' . $term_icon . '",';
2654
-                $json .= '"group":"catgroup' . $term_id . '"';
2655
-                $json .= '}';
2648
+				$json = '{';
2649
+				$json .= '"id":"' . $post_obj->post_id . '",';
2650
+				$json .= '"lat_pos": "' . $lat . '",';
2651
+				$json .= '"long_pos": "' . $lng . '",';
2652
+				$json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2653
+				$json .= '"icon":"' . $term_icon . '",';
2654
+				$json .= '"group":"catgroup' . $term_id . '"';
2655
+				$json .= '}';
2656 2656
 
2657
-                if ($post_obj->default_category == $term_id) {
2657
+				if ($post_obj->default_category == $term_id) {
2658 2658
 
2659
-                    $wpdb->query(
2660
-                        $wpdb->prepare(
2661
-                            "UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2662
-                            array($json, $post_obj->post_id)
2663
-                        )
2664
-                    );
2665
-                }
2659
+					$wpdb->query(
2660
+						$wpdb->prepare(
2661
+							"UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2662
+							array($json, $post_obj->post_id)
2663
+						)
2664
+					);
2665
+				}
2666 2666
 
2667
-                $wpdb->query(
2668
-                    $wpdb->prepare(
2669
-                        "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2670
-                        array($json, $post_obj->post_id, $term_id)
2671
-                    )
2672
-                );
2667
+				$wpdb->query(
2668
+					$wpdb->prepare(
2669
+						"UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2670
+						array($json, $post_obj->post_id, $term_id)
2671
+					)
2672
+				);
2673 2673
 
2674
-            }
2674
+			}
2675 2675
 
2676 2676
 
2677
-        endif;
2677
+		endif;
2678 2678
 
2679
-    }
2679
+	}
2680 2680
 
2681 2681
 }
2682 2682
 
@@ -2690,14 +2690,14 @@  discard block
 block discarded – undo
2690 2690
  */
2691 2691
 function geodir_get_listing_author($listing_id = '')
2692 2692
 {
2693
-    if ($listing_id == '') {
2694
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2695
-            $listing_id = $_REQUEST['pid'];
2696
-        }
2697
-    }
2698
-    $listing = get_post(strip_tags($listing_id));
2699
-    $listing_author_id = $listing->post_author;
2700
-    return $listing_author_id;
2693
+	if ($listing_id == '') {
2694
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2695
+			$listing_id = $_REQUEST['pid'];
2696
+		}
2697
+	}
2698
+	$listing = get_post(strip_tags($listing_id));
2699
+	$listing_author_id = $listing->post_author;
2700
+	return $listing_author_id;
2701 2701
 }
2702 2702
 
2703 2703
 
@@ -2712,11 +2712,11 @@  discard block
 block discarded – undo
2712 2712
  */
2713 2713
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2714 2714
 {
2715
-    $listing_author_id = geodir_get_listing_author($listing_id);
2716
-    if ($listing_author_id == $user_id)
2717
-        return true;
2718
-    else
2719
-        return false;
2715
+	$listing_author_id = geodir_get_listing_author($listing_id);
2716
+	if ($listing_author_id == $user_id)
2717
+		return true;
2718
+	else
2719
+		return false;
2720 2720
 
2721 2721
 }
2722 2722
 
@@ -2732,17 +2732,17 @@  discard block
 block discarded – undo
2732 2732
  */
2733 2733
 function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true)
2734 2734
 {
2735
-    global $current_user;
2736
-    if ($exclude_admin) {
2737
-        foreach ($current_user->caps as $key => $caps) {
2738
-            if (geodir_strtolower($key) == 'administrator') {
2739
-                return true;
2740
-                break;
2741
-            }
2742
-        }
2743
-    }
2744
-
2745
-    return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2735
+	global $current_user;
2736
+	if ($exclude_admin) {
2737
+		foreach ($current_user->caps as $key => $caps) {
2738
+			if (geodir_strtolower($key) == 'administrator') {
2739
+				return true;
2740
+				break;
2741
+			}
2742
+		}
2743
+	}
2744
+
2745
+	return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2746 2746
 }
2747 2747
 
2748 2748
 
@@ -2758,17 +2758,17 @@  discard block
 block discarded – undo
2758 2758
 function geodir_only_supportable_attachments_remove($file)
2759 2759
 {
2760 2760
 
2761
-    global $wpdb;
2761
+	global $wpdb;
2762 2762
 
2763
-    $matches = array();
2763
+	$matches = array();
2764 2764
 
2765
-    $pattern = '/-\d+x\d+\./';
2766
-    preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2765
+	$pattern = '/-\d+x\d+\./';
2766
+	preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2767 2767
 
2768
-    if (empty($matches))
2769
-        return '';
2770
-    else
2771
-        return $file;
2768
+	if (empty($matches))
2769
+		return '';
2770
+	else
2771
+		return $file;
2772 2772
 
2773 2773
 }
2774 2774
 
@@ -2785,78 +2785,78 @@  discard block
 block discarded – undo
2785 2785
 function geodir_set_wp_featured_image($post_id)
2786 2786
 {
2787 2787
 
2788
-    global $wpdb, $plugin_prefix;
2789
-    $uploads = wp_upload_dir();
2788
+	global $wpdb, $plugin_prefix;
2789
+	$uploads = wp_upload_dir();
2790 2790
 //	print_r($uploads ) ;
2791
-    $post_first_image = $wpdb->get_results(
2792
-        $wpdb->prepare(
2793
-            "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2794
-        )
2795
-    );
2791
+	$post_first_image = $wpdb->get_results(
2792
+		$wpdb->prepare(
2793
+			"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2794
+		)
2795
+	);
2796 2796
 
2797
-    $old_attachment_name = '';
2798
-    $post_thumbnail_id = '';
2799
-    if (has_post_thumbnail($post_id)) {
2797
+	$old_attachment_name = '';
2798
+	$post_thumbnail_id = '';
2799
+	if (has_post_thumbnail($post_id)) {
2800 2800
 
2801
-        if (has_post_thumbnail($post_id)) {
2801
+		if (has_post_thumbnail($post_id)) {
2802 2802
 
2803
-            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2803
+			$post_thumbnail_id = get_post_thumbnail_id($post_id);
2804 2804
 
2805
-            $old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2805
+			$old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2806 2806
 
2807
-        }
2808
-    }
2809
-
2810
-    if (!empty($post_first_image)) {
2807
+		}
2808
+	}
2811 2809
 
2812
-        $post_type = get_post_type($post_id);
2810
+	if (!empty($post_first_image)) {
2813 2811
 
2814
-        $table_name = $plugin_prefix . $post_type . '_detail';
2812
+		$post_type = get_post_type($post_id);
2815 2813
 
2816
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2814
+		$table_name = $plugin_prefix . $post_type . '_detail';
2817 2815
 
2818
-        $new_attachment_name = basename($post_first_image[0]->file);
2816
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2819 2817
 
2820
-        if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2818
+		$new_attachment_name = basename($post_first_image[0]->file);
2821 2819
 
2822
-            if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2820
+		if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2823 2821
 
2824
-                add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2822
+			if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2825 2823
 
2826
-                wp_delete_attachment($post_thumbnail_id);
2824
+				add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2827 2825
 
2828
-            }
2829
-            $filename = $uploads['basedir'] . $post_first_image[0]->file;
2826
+				wp_delete_attachment($post_thumbnail_id);
2830 2827
 
2831
-            $attachment = array(
2832
-                'post_mime_type' => $post_first_image[0]->mime_type,
2833
-                'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2834
-                'post_parent' => $post_id,
2835
-                'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2836
-                'post_content' => ''
2837
-            );
2828
+			}
2829
+			$filename = $uploads['basedir'] . $post_first_image[0]->file;
2830
+
2831
+			$attachment = array(
2832
+				'post_mime_type' => $post_first_image[0]->mime_type,
2833
+				'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2834
+				'post_parent' => $post_id,
2835
+				'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2836
+				'post_content' => ''
2837
+			);
2838 2838
 
2839 2839
 
2840
-            $id = wp_insert_attachment($attachment, $filename, $post_id);
2840
+			$id = wp_insert_attachment($attachment, $filename, $post_id);
2841 2841
 
2842
-            if (!is_wp_error($id)) {
2842
+			if (!is_wp_error($id)) {
2843 2843
 
2844
-                set_post_thumbnail($post_id, $id);
2844
+				set_post_thumbnail($post_id, $id);
2845 2845
 
2846
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
2847
-                wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2846
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
2847
+				wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2848 2848
 
2849
-            }
2849
+			}
2850 2850
 
2851
-        }
2851
+		}
2852 2852
 
2853
-    } else {
2854
-        //set_post_thumbnail($post_id,-1);
2853
+	} else {
2854
+		//set_post_thumbnail($post_id,-1);
2855 2855
 
2856
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2857
-            wp_delete_attachment($post_thumbnail_id);
2856
+		if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2857
+			wp_delete_attachment($post_thumbnail_id);
2858 2858
 
2859
-    }
2859
+	}
2860 2860
 }
2861 2861
 
2862 2862
 
@@ -2871,53 +2871,53 @@  discard block
 block discarded – undo
2871 2871
  */
2872 2872
 function gd_copy_original_translation()
2873 2873
 {
2874
-    if (function_exists('icl_object_id')) {
2875
-        global $wpdb, $table_prefix, $plugin_prefix;
2876
-        $post_id = absint($_POST['post_id']);
2877
-        $upload_dir = wp_upload_dir();
2878
-        $post_type = get_post_type($_POST['post_id']);
2879
-        $table = $plugin_prefix . $post_type . '_detail';
2880
-
2881
-        $post_arr = $wpdb->get_results($wpdb->prepare(
2882
-            "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2883
-            array($post_id)
2884
-        )
2885
-            , ARRAY_A);
2886
-
2887
-        $arrImages = $wpdb->get_results(
2888
-            $wpdb->prepare(
2889
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2890
-                array('%image%', $post_id)
2891
-            )
2892
-        );
2893
-        if ($arrImages) {
2894
-            $image_arr = array();
2895
-            foreach ($arrImages as $img) {
2896
-                $image_arr[] = $upload_dir['baseurl'] . $img->file;
2897
-            }
2898
-            $comma_separated = implode(",", $image_arr);
2899
-            $post_arr[0]['post_images'] = $comma_separated;
2900
-        }
2901
-
2902
-
2903
-        $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2904
-        $cat_arr = array_filter(explode(",", $cats));
2905
-        $trans_cat = array();
2906
-        foreach ($cat_arr as $cat) {
2907
-            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2908
-        }
2909
-
2910
-
2911
-        $post_arr[0]['categories'] = array_filter($trans_cat);
2874
+	if (function_exists('icl_object_id')) {
2875
+		global $wpdb, $table_prefix, $plugin_prefix;
2876
+		$post_id = absint($_POST['post_id']);
2877
+		$upload_dir = wp_upload_dir();
2878
+		$post_type = get_post_type($_POST['post_id']);
2879
+		$table = $plugin_prefix . $post_type . '_detail';
2880
+
2881
+		$post_arr = $wpdb->get_results($wpdb->prepare(
2882
+			"SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2883
+			array($post_id)
2884
+		)
2885
+			, ARRAY_A);
2886
+
2887
+		$arrImages = $wpdb->get_results(
2888
+			$wpdb->prepare(
2889
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2890
+				array('%image%', $post_id)
2891
+			)
2892
+		);
2893
+		if ($arrImages) {
2894
+			$image_arr = array();
2895
+			foreach ($arrImages as $img) {
2896
+				$image_arr[] = $upload_dir['baseurl'] . $img->file;
2897
+			}
2898
+			$comma_separated = implode(",", $image_arr);
2899
+			$post_arr[0]['post_images'] = $comma_separated;
2900
+		}
2901
+
2902
+
2903
+		$cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2904
+		$cat_arr = array_filter(explode(",", $cats));
2905
+		$trans_cat = array();
2906
+		foreach ($cat_arr as $cat) {
2907
+			$trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2908
+		}
2909
+
2910
+
2911
+		$post_arr[0]['categories'] = array_filter($trans_cat);
2912 2912
 //print_r($image_arr);
2913
-        //print_r($arrImages);
2914
-        //echo $_REQUEST['lang'];
2913
+		//print_r($arrImages);
2914
+		//echo $_REQUEST['lang'];
2915 2915
 //print_r($post_arr);
2916 2916
 //print_r($trans_cat);
2917
-        echo json_encode($post_arr[0]);
2917
+		echo json_encode($post_arr[0]);
2918 2918
 
2919
-    }
2920
-    die();
2919
+	}
2920
+	die();
2921 2921
 }
2922 2922
 
2923 2923
 
@@ -2937,54 +2937,54 @@  discard block
 block discarded – undo
2937 2937
 function geodir_get_custom_fields_type($listing_type = '')
2938 2938
 {
2939 2939
 
2940
-    global $wpdb;
2940
+	global $wpdb;
2941 2941
 
2942
-    if ($listing_type == '')
2943
-        $listing_type = 'gd_place';
2942
+	if ($listing_type == '')
2943
+		$listing_type = 'gd_place';
2944 2944
 
2945
-    $fields_info = array();
2945
+	$fields_info = array();
2946 2946
 
2947
-    $get_data = $wpdb->get_results(
2948
-        $wpdb->prepare(
2949
-            "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2950
-            array($listing_type)
2951
-        )
2952
-    );
2947
+	$get_data = $wpdb->get_results(
2948
+		$wpdb->prepare(
2949
+			"SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2950
+			array($listing_type)
2951
+		)
2952
+	);
2953 2953
 
2954
-    if (!empty($get_data)) {
2954
+	if (!empty($get_data)) {
2955 2955
 
2956
-        foreach ($get_data as $data) {
2956
+		foreach ($get_data as $data) {
2957 2957
 
2958
-            if ($data->field_type == 'address') {
2958
+			if ($data->field_type == 'address') {
2959 2959
 
2960
-                $extra_fields = unserialize($data->extra_fields);
2960
+				$extra_fields = unserialize($data->extra_fields);
2961 2961
 
2962
-                $prefix = $data->htmlvar_name . '_';
2962
+				$prefix = $data->htmlvar_name . '_';
2963 2963
 
2964
-                $fields_info[$prefix . 'address'] = $data->field_type;
2964
+				$fields_info[$prefix . 'address'] = $data->field_type;
2965 2965
 
2966
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2967
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2966
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2967
+					$fields_info[$prefix . 'zip'] = $data->field_type;
2968 2968
 
2969
-            } else {
2969
+			} else {
2970 2970
 
2971
-                $fields_info[$data->htmlvar_name] = $data->field_type;
2971
+				$fields_info[$data->htmlvar_name] = $data->field_type;
2972 2972
 
2973
-            }
2973
+			}
2974 2974
 
2975
-        }
2975
+		}
2976 2976
 
2977
-    }
2977
+	}
2978 2978
 
2979
-    /**
2980
-     * Filter to modify custom fields info using listing post type.
2981
-     *
2982
-     * @since 1.0.0
2983
-     * @package GeoDirectory
2984
-     * @return array $fields_info Custom fields info.
2985
-     * @param string $listing_type The listing post type.
2986
-     */
2987
-    return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2979
+	/**
2980
+	 * Filter to modify custom fields info using listing post type.
2981
+	 *
2982
+	 * @since 1.0.0
2983
+	 * @package GeoDirectory
2984
+	 * @return array $fields_info Custom fields info.
2985
+	 * @param string $listing_type The listing post type.
2986
+	 */
2987
+	return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2988 2988
 }
2989 2989
 
2990 2990
 
@@ -2999,58 +2999,58 @@  discard block
 block discarded – undo
2999 2999
  */
3000 3000
 function geodir_function_post_updated($post_ID, $post_after, $post_before)
3001 3001
 {
3002
-    $post_type = get_post_type($post_ID);
3002
+	$post_type = get_post_type($post_ID);
3003 3003
 
3004
-    if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
3005
-        // send notification to client when post moves from draft to publish
3006
-        if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
3007
-            $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
3008
-            $post_author_data = get_userdata($post_author_id);
3004
+	if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
3005
+		// send notification to client when post moves from draft to publish
3006
+		if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
3007
+			$post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
3008
+			$post_author_data = get_userdata($post_author_id);
3009 3009
 
3010
-            $to_name = geodir_get_client_name($post_author_id);
3010
+			$to_name = geodir_get_client_name($post_author_id);
3011 3011
 
3012
-            $from_email = geodir_get_site_email_id();
3013
-            $from_name = get_site_emailName();
3014
-            $to_email = $post_author_data->user_email;
3012
+			$from_email = geodir_get_site_email_id();
3013
+			$from_name = get_site_emailName();
3014
+			$to_email = $post_author_data->user_email;
3015 3015
 
3016
-            if (!is_email($to_email) && !empty($post_author_data->user_email)) {
3017
-                $to_email = $post_author_data->user_email;
3018
-            }
3016
+			if (!is_email($to_email) && !empty($post_author_data->user_email)) {
3017
+				$to_email = $post_author_data->user_email;
3018
+			}
3019 3019
 
3020
-            $message_type = 'listing_published';
3020
+			$message_type = 'listing_published';
3021 3021
 
3022
-            if (get_option('geodir_post_published_email_subject') == '') {
3023
-                update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3024
-            }
3022
+			if (get_option('geodir_post_published_email_subject') == '') {
3023
+				update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3024
+			}
3025 3025
 
3026
-            if (get_option('geodir_post_published_email_content') == '') {
3027
-                update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
3028
-            }
3026
+			if (get_option('geodir_post_published_email_content') == '') {
3027
+				update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
3028
+			}
3029 3029
 
3030
-            /**
3031
-             * Called before sending the email when listing gets published.
3032
-             *
3033
-             * @since 1.0.0
3034
-             * @package GeoDirectory
3035
-             * @param object $post_after The post object after update.
3036
-             * @param object $post_before The post object before update.
3037
-             */
3038
-            do_action('geodir_before_listing_published_email', $post_after, $post_before);
3039
-            if (is_email($to_email)) {
3040
-                geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3041
-            }
3030
+			/**
3031
+			 * Called before sending the email when listing gets published.
3032
+			 *
3033
+			 * @since 1.0.0
3034
+			 * @package GeoDirectory
3035
+			 * @param object $post_after The post object after update.
3036
+			 * @param object $post_before The post object before update.
3037
+			 */
3038
+			do_action('geodir_before_listing_published_email', $post_after, $post_before);
3039
+			if (is_email($to_email)) {
3040
+				geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3041
+			}
3042 3042
 
3043
-            /**
3044
-             * Called after sending the email when listing gets published.
3045
-             *
3046
-             * @since 1.0.0
3047
-             * @package GeoDirectory
3048
-             * @param object $post_after The post object after update.
3049
-             * @param object $post_before The post object before update.
3050
-             */
3051
-            do_action('geodir_after_listing_published_email', $post_after, $post_before);
3052
-        }
3053
-    }
3043
+			/**
3044
+			 * Called after sending the email when listing gets published.
3045
+			 *
3046
+			 * @since 1.0.0
3047
+			 * @package GeoDirectory
3048
+			 * @param object $post_after The post object after update.
3049
+			 * @param object $post_before The post object before update.
3050
+			 */
3051
+			do_action('geodir_after_listing_published_email', $post_after, $post_before);
3052
+		}
3053
+	}
3054 3054
 }
3055 3055
 
3056 3056
 add_action('wp_head', 'geodir_fb_like_thumbnail');
@@ -3064,14 +3064,14 @@  discard block
 block discarded – undo
3064 3064
  */
3065 3065
 function geodir_fb_like_thumbnail(){
3066 3066
 
3067
-    // return if not a single post
3068
-    if(!is_single()){return;}
3067
+	// return if not a single post
3068
+	if(!is_single()){return;}
3069 3069
 
3070
-    global $post;
3071
-    if(isset($post->featured_image) && $post->featured_image){
3072
-        $upload_dir = wp_upload_dir();
3073
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3074
-        echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3070
+	global $post;
3071
+	if(isset($post->featured_image) && $post->featured_image){
3072
+		$upload_dir = wp_upload_dir();
3073
+		$thumb = $upload_dir['baseurl'].$post->featured_image;
3074
+		echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3075 3075
 
3076
-    }
3076
+	}
3077 3077
 }
3078 3078
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 1 patch
Indentation   +1442 added lines, -1442 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * @global object $gd_session GeoDirectory Session object.
18 18
  */
19 19
 function geodir_list_view_select() {
20
-    global $gd_session;
20
+	global $gd_session;
21 21
 	?>
22 22
     <script type="text/javascript">
23 23
 	function geodir_list_view_select(list) {
@@ -86,63 +86,63 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function geodir_max_excerpt($charlength)
88 88
 {
89
-    global $post;
90
-    if ($charlength == '0') {
91
-        return;
92
-    }
93
-    $out = '';
89
+	global $post;
90
+	if ($charlength == '0') {
91
+		return;
92
+	}
93
+	$out = '';
94 94
 	
95 95
 	$temp_post = $post;
96 96
 	$excerpt = get_the_excerpt();
97 97
 
98
-    $charlength++;
99
-    $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
100
-    if (mb_strlen($excerpt) > $charlength) {
101
-        if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
102
-            $excut = -(mb_strlen($excerpt_more));
103
-            $subex = mb_substr($excerpt, 0, $excut);
104
-            if ($charlength > 0 && mb_strlen($subex) > $charlength) {
105
-                $subex = mb_substr($subex, 0, $charlength);
106
-            }
107
-            $out .= $subex;
108
-        } else {
109
-            $subex = mb_substr($excerpt, 0, $charlength - 5);
110
-            $exwords = explode(' ', $subex);
111
-            $excut = -(mb_strlen($exwords[count($exwords) - 1]));
112
-            if ($excut < 0) {
113
-                $out .= mb_substr($subex, 0, $excut);
114
-            } else {
115
-                $out .= $subex;
116
-            }
117
-        }
118
-        $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
119
-        /**
120
-         * Filter excerpt read more text.
121
-         *
122
-         * @since 1.0.0
123
-         */
124
-        $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
125
-        $out .= '</a>';
126
-
127
-    } else {
128
-        if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
129
-            $excut = -(mb_strlen($excerpt_more));
130
-            $out .= mb_substr($excerpt, 0, $excut);
131
-            $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
132
-            /**
133
-             * Filter excerpt read more text.
134
-             *
135
-             * @since 1.0.0
136
-             */
137
-            $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
138
-            $out .= '</a>';
139
-        } else {
140
-            $out .= $excerpt;
141
-        }
142
-    }
98
+	$charlength++;
99
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
100
+	if (mb_strlen($excerpt) > $charlength) {
101
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
102
+			$excut = -(mb_strlen($excerpt_more));
103
+			$subex = mb_substr($excerpt, 0, $excut);
104
+			if ($charlength > 0 && mb_strlen($subex) > $charlength) {
105
+				$subex = mb_substr($subex, 0, $charlength);
106
+			}
107
+			$out .= $subex;
108
+		} else {
109
+			$subex = mb_substr($excerpt, 0, $charlength - 5);
110
+			$exwords = explode(' ', $subex);
111
+			$excut = -(mb_strlen($exwords[count($exwords) - 1]));
112
+			if ($excut < 0) {
113
+				$out .= mb_substr($subex, 0, $excut);
114
+			} else {
115
+				$out .= $subex;
116
+			}
117
+		}
118
+		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
119
+		/**
120
+		 * Filter excerpt read more text.
121
+		 *
122
+		 * @since 1.0.0
123
+		 */
124
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
125
+		$out .= '</a>';
126
+
127
+	} else {
128
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
129
+			$excut = -(mb_strlen($excerpt_more));
130
+			$out .= mb_substr($excerpt, 0, $excut);
131
+			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
132
+			/**
133
+			 * Filter excerpt read more text.
134
+			 *
135
+			 * @since 1.0.0
136
+			 */
137
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
138
+			$out .= '</a>';
139
+		} else {
140
+			$out .= $excerpt;
141
+		}
142
+	}
143 143
 	$post = $temp_post;
144 144
 
145
-    return $out;
145
+	return $out;
146 146
 }
147 147
 
148 148
 /**
@@ -157,34 +157,34 @@  discard block
 block discarded – undo
157 157
  */
158 158
 function geodir_post_package_info($package_info, $post = '', $post_type = '')
159 159
 {
160
-    $package_info['pid'] = 0;
161
-    $package_info['days'] = 0;
162
-    $package_info['amount'] = 0;
163
-    $package_info['is_featured'] = 0;
164
-    $package_info['image_limit'] = '';
165
-    $package_info['google_analytics'] = 1;
166
-    $package_info['sendtofriend'] = 1;
167
-
168
-    /**
169
-     * Filter listing package info.
170
-     *
171
-     * @since 1.0.0
172
-     * @param array $package_info {
173
-     *    Attributes of the package_info.
174
-     *
175
-     *    @type int $pid Package ID. Default 0.
176
-     *    @type int $days Package validity in Days. Default 0.
177
-     *    @type int $amount Package amount. Default 0.
178
-     *    @type int $is_featured Is this featured package? Default 0.
179
-     *    @type string $image_limit Image limit for this package. Default "".
180
-     *    @type int $google_analytics Add analytics to this package. Default 1.
181
-     *    @type int $sendtofriend Send to friend. Default 1.
182
-     *
183
-     * }
184
-     * @param object|string $post The post object.
185
-     * @param string $post_type The post type.
186
-     */
187
-    return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
160
+	$package_info['pid'] = 0;
161
+	$package_info['days'] = 0;
162
+	$package_info['amount'] = 0;
163
+	$package_info['is_featured'] = 0;
164
+	$package_info['image_limit'] = '';
165
+	$package_info['google_analytics'] = 1;
166
+	$package_info['sendtofriend'] = 1;
167
+
168
+	/**
169
+	 * Filter listing package info.
170
+	 *
171
+	 * @since 1.0.0
172
+	 * @param array $package_info {
173
+	 *    Attributes of the package_info.
174
+	 *
175
+	 *    @type int $pid Package ID. Default 0.
176
+	 *    @type int $days Package validity in Days. Default 0.
177
+	 *    @type int $amount Package amount. Default 0.
178
+	 *    @type int $is_featured Is this featured package? Default 0.
179
+	 *    @type string $image_limit Image limit for this package. Default "".
180
+	 *    @type int $google_analytics Add analytics to this package. Default 1.
181
+	 *    @type int $sendtofriend Send to friend. Default 1.
182
+	 *
183
+	 * }
184
+	 * @param object|string $post The post object.
185
+	 * @param string $post_type The post type.
186
+	 */
187
+	return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
188 188
 
189 189
 }
190 190
 
@@ -212,127 +212,127 @@  discard block
 block discarded – undo
212 212
  */
213 213
 function geodir_send_inquiry($request)
214 214
 {
215
-    global $wpdb;
216
-
217
-    // strip slashes from text
218
-    $request = !empty($request) ? stripslashes_deep($request) : $request;
219
-
220
-    $yourname = $request['inq_name'];
221
-    $youremail = $request['inq_email'];
222
-    $inq_phone = $request['inq_phone'];
223
-    $frnd_comments = $request['inq_msg'];
224
-    $pid = $request['pid'];
225
-
226
-    $author_id = '';
227
-    $post_title = '';
228
-
229
-    if ($request['pid']) {
230
-
231
-        $productinfosql = $wpdb->prepare(
232
-            "select ID,post_author,post_title from $wpdb->posts where ID =%d",
233
-            array($request['pid'])
234
-        );
235
-        $productinfo = $wpdb->get_row($productinfosql);
236
-
237
-        $author_id = $productinfo->post_author;
238
-        $post_title = $productinfo->post_title;
239
-    }
240
-
241
-    $post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>';
242
-
243
-    $user_info = get_userdata($author_id);
244
-    $to_email = geodir_get_post_meta($pid, 'geodir_email', true);
245
-    $to_name = geodir_get_client_name($author_id);
246
-
247
-    if ($to_email == '') {
248
-        $to_email = get_option('admin_email');
249
-    }
250
-
251
-    /**
252
-     * Called after the send enquiry var have been set but before the email has been sent.
253
-     *
254
-     * @since 1.0.0
255
-     * @param array $request {
256
-     *    The submitted form fields as an array.
257
-     *
258
-     *    @type string $sendact Enquiry type. Default "send_inqury".
259
-     *    @type string $pid Post ID.
260
-     *    @type string $inq_name Sender name.
261
-     *    @type string $inq_email Sender mail.
262
-     *    @type string $inq_phone Sender phone.
263
-     *    @type string $inq_msg Email message.
264
-     *
265
-     * }
266
-     * @param string $type The form type, default: `Enquiry`.
267
-     */
268
-    do_action('geodir_after_send_enquiry', $request, 'Enquiry');
269
-
270
-    $client_message = $frnd_comments;
271
-    $client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
272
-    /**
273
-     * Filter client message text.
274
-     *
275
-     * @since 1.0.0
276
-     * @param string $client_message Client message text.
277
-     */
278
-    $client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
279
-
280
-    /**
281
-     * Called before the send enquiry email is sent.
282
-     *
283
-     * @since 1.0.0
284
-     * @param array $request {
285
-     *    The submitted form fields as an array.
286
-     *
287
-     *    @type string $sendact Enquiry type. Default "send_inqury".
288
-     *    @type string $pid Post ID.
289
-     *    @type string $inq_name Sender name.
290
-     *    @type string $inq_email Sender mail.
291
-     *    @type string $inq_phone Sender phone.
292
-     *    @type string $inq_msg Email message.
293
-     *
294
-     * }
295
-     */
296
-    do_action('geodir_before_send_enquiry_email', $request);
297
-    if ($to_email) {
298
-        // strip slashes message
299
-        $client_message = stripslashes_deep($client_message);
300
-
301
-        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
302
-    }
303
-
304
-    /**
305
-     * Called after the send enquiry email is sent.
306
-     *
307
-     * @since 1.0.0
308
-     * @param array $request {
309
-     *    The submitted form fields as an array.
310
-     *
311
-     *    @type string $sendact Enquiry type. Default "send_inqury".
312
-     *    @type string $pid Post ID.
313
-     *    @type string $inq_name Sender name.
314
-     *    @type string $inq_email Sender mail.
315
-     *    @type string $inq_phone Sender phone.
316
-     *    @type string $inq_msg Email message.
317
-     *
318
-     * }
319
-     */
320
-    do_action('geodir_after_send_enquiry_email', $request);
321
-    $url = get_permalink($pid);
322
-    if (strstr($url, '?')) {
323
-        $url = $url . "&send_inquiry=success";
324
-    } else {
325
-        $url = $url . "?send_inquiry=success";
326
-    }
327
-    /**
328
-     * Filter redirect url after the send enquiry email is sent.
329
-     *
330
-     * @since 1.0.0
331
-     * @param string $url Redirect url.
332
-     */
333
-    $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
334
-    wp_redirect($url);
335
-    gd_die();
215
+	global $wpdb;
216
+
217
+	// strip slashes from text
218
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
219
+
220
+	$yourname = $request['inq_name'];
221
+	$youremail = $request['inq_email'];
222
+	$inq_phone = $request['inq_phone'];
223
+	$frnd_comments = $request['inq_msg'];
224
+	$pid = $request['pid'];
225
+
226
+	$author_id = '';
227
+	$post_title = '';
228
+
229
+	if ($request['pid']) {
230
+
231
+		$productinfosql = $wpdb->prepare(
232
+			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
233
+			array($request['pid'])
234
+		);
235
+		$productinfo = $wpdb->get_row($productinfosql);
236
+
237
+		$author_id = $productinfo->post_author;
238
+		$post_title = $productinfo->post_title;
239
+	}
240
+
241
+	$post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>';
242
+
243
+	$user_info = get_userdata($author_id);
244
+	$to_email = geodir_get_post_meta($pid, 'geodir_email', true);
245
+	$to_name = geodir_get_client_name($author_id);
246
+
247
+	if ($to_email == '') {
248
+		$to_email = get_option('admin_email');
249
+	}
250
+
251
+	/**
252
+	 * Called after the send enquiry var have been set but before the email has been sent.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @param array $request {
256
+	 *    The submitted form fields as an array.
257
+	 *
258
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
259
+	 *    @type string $pid Post ID.
260
+	 *    @type string $inq_name Sender name.
261
+	 *    @type string $inq_email Sender mail.
262
+	 *    @type string $inq_phone Sender phone.
263
+	 *    @type string $inq_msg Email message.
264
+	 *
265
+	 * }
266
+	 * @param string $type The form type, default: `Enquiry`.
267
+	 */
268
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
269
+
270
+	$client_message = $frnd_comments;
271
+	$client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
272
+	/**
273
+	 * Filter client message text.
274
+	 *
275
+	 * @since 1.0.0
276
+	 * @param string $client_message Client message text.
277
+	 */
278
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
279
+
280
+	/**
281
+	 * Called before the send enquiry email is sent.
282
+	 *
283
+	 * @since 1.0.0
284
+	 * @param array $request {
285
+	 *    The submitted form fields as an array.
286
+	 *
287
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
288
+	 *    @type string $pid Post ID.
289
+	 *    @type string $inq_name Sender name.
290
+	 *    @type string $inq_email Sender mail.
291
+	 *    @type string $inq_phone Sender phone.
292
+	 *    @type string $inq_msg Email message.
293
+	 *
294
+	 * }
295
+	 */
296
+	do_action('geodir_before_send_enquiry_email', $request);
297
+	if ($to_email) {
298
+		// strip slashes message
299
+		$client_message = stripslashes_deep($client_message);
300
+
301
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
302
+	}
303
+
304
+	/**
305
+	 * Called after the send enquiry email is sent.
306
+	 *
307
+	 * @since 1.0.0
308
+	 * @param array $request {
309
+	 *    The submitted form fields as an array.
310
+	 *
311
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
312
+	 *    @type string $pid Post ID.
313
+	 *    @type string $inq_name Sender name.
314
+	 *    @type string $inq_email Sender mail.
315
+	 *    @type string $inq_phone Sender phone.
316
+	 *    @type string $inq_msg Email message.
317
+	 *
318
+	 * }
319
+	 */
320
+	do_action('geodir_after_send_enquiry_email', $request);
321
+	$url = get_permalink($pid);
322
+	if (strstr($url, '?')) {
323
+		$url = $url . "&send_inquiry=success";
324
+	} else {
325
+		$url = $url . "?send_inquiry=success";
326
+	}
327
+	/**
328
+	 * Filter redirect url after the send enquiry email is sent.
329
+	 *
330
+	 * @since 1.0.0
331
+	 * @param string $url Redirect url.
332
+	 */
333
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
334
+	wp_redirect($url);
335
+	gd_die();
336 336
 
337 337
 }
338 338
 
@@ -361,85 +361,85 @@  discard block
 block discarded – undo
361 361
  */
362 362
 function geodir_send_friend($request)
363 363
 {
364
-    global $wpdb;
365
-
366
-    // strip slashes from text
367
-    $request = !empty($request) ? stripslashes_deep($request) : $request;
368
-
369
-    $yourname = $request['yourname'];
370
-    $youremail = $request['youremail'];
371
-    $frnd_subject = $request['frnd_subject'];
372
-    $frnd_comments = $request['frnd_comments'];
373
-    $pid = $request['pid'];
374
-    $to_email = $request['to_email'];
375
-    $to_name = $request['to_name'];
376
-    if ($request['pid']) {
377
-        $productinfosql = $wpdb->prepare(
378
-            "select ID,post_title from $wpdb->posts where ID =%d",
379
-            array($request['pid'])
380
-        );
381
-        $productinfo = $wpdb->get_results($productinfosql);
382
-        foreach ($productinfo as $productinfoObj) {
383
-            $post_title = $productinfoObj->post_title;
384
-        }
385
-    }
386
-
387
-    /**
388
-     * Called before the send to friend email is sent.
389
-     *
390
-     * @since 1.0.0
391
-     * @param array $request {
392
-     *    The submitted form fields as an array.
393
-     *
394
-     *    @type string $sendact Enquiry type. Default "email_frnd".
395
-     *    @type string $pid Post ID.
396
-     *    @type string $to_name Friend name.
397
-     *    @type string $to_email Friend email.
398
-     *    @type string $yourname Sender name.
399
-     *    @type string $youremail Sender email.
400
-     *    @type string $frnd_subject Email subject.
401
-     *    @type string $frnd_comments Email Message.
402
-     *
403
-     * }
404
-     */
405
-    do_action('geodir_before_send_to_friend_email', $request);
406
-    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
407
-
408
-    /**
409
-     * Called after the send to friend email is sent.
410
-     *
411
-     * @since 1.0.0
412
-     * @param array $request {
413
-     *    The submitted form fields as an array.
414
-     *
415
-     *    @type string $sendact Enquiry type. Default "email_frnd".
416
-     *    @type string $pid Post ID.
417
-     *    @type string $to_name Friend name.
418
-     *    @type string $to_email Friend email.
419
-     *    @type string $yourname Sender name.
420
-     *    @type string $youremail Sender email.
421
-     *    @type string $frnd_subject Email subject.
422
-     *    @type string $frnd_comments Email Message.
423
-     *
424
-     * }
425
-     */
426
-    do_action('geodir_after_send_to_friend_email', $request);
427
-
428
-    $url = get_permalink($pid);
429
-    if (strstr($url, '?')) {
430
-        $url = $url . "&sendtofrnd=success";
431
-    } else {
432
-        $url = $url . "?sendtofrnd=success";
433
-    }
434
-    /**
435
-     * Filter redirect url after the send to friend email is sent.
436
-     *
437
-     * @since 1.0.0
438
-     * @param string $url Redirect url.
439
-     */
440
-    $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
441
-    wp_redirect($url);
442
-    gd_die();
364
+	global $wpdb;
365
+
366
+	// strip slashes from text
367
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
368
+
369
+	$yourname = $request['yourname'];
370
+	$youremail = $request['youremail'];
371
+	$frnd_subject = $request['frnd_subject'];
372
+	$frnd_comments = $request['frnd_comments'];
373
+	$pid = $request['pid'];
374
+	$to_email = $request['to_email'];
375
+	$to_name = $request['to_name'];
376
+	if ($request['pid']) {
377
+		$productinfosql = $wpdb->prepare(
378
+			"select ID,post_title from $wpdb->posts where ID =%d",
379
+			array($request['pid'])
380
+		);
381
+		$productinfo = $wpdb->get_results($productinfosql);
382
+		foreach ($productinfo as $productinfoObj) {
383
+			$post_title = $productinfoObj->post_title;
384
+		}
385
+	}
386
+
387
+	/**
388
+	 * Called before the send to friend email is sent.
389
+	 *
390
+	 * @since 1.0.0
391
+	 * @param array $request {
392
+	 *    The submitted form fields as an array.
393
+	 *
394
+	 *    @type string $sendact Enquiry type. Default "email_frnd".
395
+	 *    @type string $pid Post ID.
396
+	 *    @type string $to_name Friend name.
397
+	 *    @type string $to_email Friend email.
398
+	 *    @type string $yourname Sender name.
399
+	 *    @type string $youremail Sender email.
400
+	 *    @type string $frnd_subject Email subject.
401
+	 *    @type string $frnd_comments Email Message.
402
+	 *
403
+	 * }
404
+	 */
405
+	do_action('geodir_before_send_to_friend_email', $request);
406
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
407
+
408
+	/**
409
+	 * Called after the send to friend email is sent.
410
+	 *
411
+	 * @since 1.0.0
412
+	 * @param array $request {
413
+	 *    The submitted form fields as an array.
414
+	 *
415
+	 *    @type string $sendact Enquiry type. Default "email_frnd".
416
+	 *    @type string $pid Post ID.
417
+	 *    @type string $to_name Friend name.
418
+	 *    @type string $to_email Friend email.
419
+	 *    @type string $yourname Sender name.
420
+	 *    @type string $youremail Sender email.
421
+	 *    @type string $frnd_subject Email subject.
422
+	 *    @type string $frnd_comments Email Message.
423
+	 *
424
+	 * }
425
+	 */
426
+	do_action('geodir_after_send_to_friend_email', $request);
427
+
428
+	$url = get_permalink($pid);
429
+	if (strstr($url, '?')) {
430
+		$url = $url . "&sendtofrnd=success";
431
+	} else {
432
+		$url = $url . "?sendtofrnd=success";
433
+	}
434
+	/**
435
+	 * Filter redirect url after the send to friend email is sent.
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @param string $url Redirect url.
439
+	 */
440
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
441
+	wp_redirect($url);
442
+	gd_die();
443 443
 }
444 444
 
445 445
 /**
@@ -453,28 +453,28 @@  discard block
 block discarded – undo
453 453
  */
454 454
 function geodir_before_tab_content($hash_key)
455 455
 {
456
-    switch ($hash_key) {
457
-        case 'post_info' :
458
-            echo '<div class="geodir-company_info field-group">';
459
-            break;
460
-        case 'post_images' :
461
-            /**
462
-             * Filter post gallery HTML id.
463
-             *
464
-             * @since 1.0.0
465
-             */
466
-            echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
467
-            break;
468
-        case 'reviews' :
469
-            echo '<div id="reviews-wrap" class="clearfix"> ';
470
-            break;
471
-        case 'post_video':
472
-            echo ' <div id="post_video-wrap" class="clearfix">';
473
-            break;
474
-        case 'special_offers':
475
-            echo '<div id="special_offers-wrap" class="clearfix">';
476
-            break;
477
-    }
456
+	switch ($hash_key) {
457
+		case 'post_info' :
458
+			echo '<div class="geodir-company_info field-group">';
459
+			break;
460
+		case 'post_images' :
461
+			/**
462
+			 * Filter post gallery HTML id.
463
+			 *
464
+			 * @since 1.0.0
465
+			 */
466
+			echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
467
+			break;
468
+		case 'reviews' :
469
+			echo '<div id="reviews-wrap" class="clearfix"> ';
470
+			break;
471
+		case 'post_video':
472
+			echo ' <div id="post_video-wrap" class="clearfix">';
473
+			break;
474
+		case 'special_offers':
475
+			echo '<div id="special_offers-wrap" class="clearfix">';
476
+			break;
477
+	}
478 478
 }
479 479
 
480 480
 /**
@@ -488,23 +488,23 @@  discard block
 block discarded – undo
488 488
  */
489 489
 function geodir_after_tab_content($hash_key)
490 490
 {
491
-    switch ($hash_key) {
492
-        case 'post_info' :
493
-            echo '</div>';
494
-            break;
495
-        case 'post_images' :
496
-            echo '</div>';
497
-            break;
498
-        case 'reviews' :
499
-            echo '</div>';
500
-            break;
501
-        case 'post_video':
502
-            echo '</div>';
503
-            break;
504
-        case 'special_offers':
505
-            echo '</div>';
506
-            break;
507
-    }
491
+	switch ($hash_key) {
492
+		case 'post_info' :
493
+			echo '</div>';
494
+			break;
495
+		case 'post_images' :
496
+			echo '</div>';
497
+			break;
498
+		case 'reviews' :
499
+			echo '</div>';
500
+			break;
501
+		case 'post_video':
502
+			echo '</div>';
503
+			break;
504
+		case 'special_offers':
505
+			echo '</div>';
506
+			break;
507
+	}
508 508
 }
509 509
 
510 510
 
@@ -520,21 +520,21 @@  discard block
 block discarded – undo
520 520
 function geodir_get_posts_default_sort($post_type)
521 521
 {
522 522
 
523
-    global $wpdb;
523
+	global $wpdb;
524 524
 
525
-    if ($post_type != '') {
525
+	if ($post_type != '') {
526 526
 
527
-        $all_postypes = geodir_get_posttypes();
527
+		$all_postypes = geodir_get_posttypes();
528 528
 
529
-        if (!in_array($post_type, $all_postypes))
530
-            return false;
529
+		if (!in_array($post_type, $all_postypes))
530
+			return false;
531 531
 
532
-        $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
532
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
533 533
 
534
-        if (!empty($sort_field_info))
535
-            return $sort_field_info;
534
+		if (!empty($sort_field_info))
535
+			return $sort_field_info;
536 536
 
537
-    }
537
+	}
538 538
 
539 539
 }
540 540
 
@@ -549,24 +549,24 @@  discard block
 block discarded – undo
549 549
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
550 550
  */
551 551
 function geodir_get_sort_options($post_type) {
552
-    global $wpdb;
553
-
554
-    if ($post_type != '') {
555
-        $all_postypes = geodir_get_posttypes();
556
-
557
-        if (!in_array($post_type, $all_postypes))
558
-            return false;
559
-
560
-        $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561
-        /**
562
-         * Filter post sort options.
563
-         *
564
-         * @since 1.0.0
565
-         * @param array $sort_field_info Unfiltered sort field array.
566
-         * @param string $post_type Post type.
567
-         */
568
-        return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
569
-    }
552
+	global $wpdb;
553
+
554
+	if ($post_type != '') {
555
+		$all_postypes = geodir_get_posttypes();
556
+
557
+		if (!in_array($post_type, $all_postypes))
558
+			return false;
559
+
560
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561
+		/**
562
+		 * Filter post sort options.
563
+		 *
564
+		 * @since 1.0.0
565
+		 * @param array $sort_field_info Unfiltered sort field array.
566
+		 * @param string $post_type Post type.
567
+		 */
568
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
569
+	}
570 570
 
571 571
 }
572 572
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
  */
581 581
 function geodir_display_sort_options()
582 582
 {
583
-    global $wp_query;
583
+	global $wp_query;
584 584
 	
585 585
 	/**
586 586
 	 * On search pages there should be no sort options, sorting is done by search criteria.
@@ -591,57 +591,57 @@  discard block
 block discarded – undo
591 591
 		return;
592 592
 	}
593 593
 
594
-    $sort_by = '';
594
+	$sort_by = '';
595 595
 
596
-    if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
596
+	if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
597 597
 
598
-    $gd_post_type = geodir_get_current_posttype();
598
+	$gd_post_type = geodir_get_current_posttype();
599 599
 
600
-    $sort_options = geodir_get_sort_options($gd_post_type);
600
+	$sort_options = geodir_get_sort_options($gd_post_type);
601 601
 
602 602
 
603
-    $sort_field_options = '';
603
+	$sort_field_options = '';
604 604
 
605
-    if (!empty($sort_options)) {
606
-        foreach ($sort_options as $sort) {
605
+	if (!empty($sort_options)) {
606
+		foreach ($sort_options as $sort) {
607 607
 			$sort = stripslashes_deep($sort); // strip slashes
608 608
 
609
-            $label = __($sort->site_title, 'geodirectory');
609
+			$label = __($sort->site_title, 'geodirectory');
610 610
 
611
-            if ($sort->field_type == 'random') {
612
-                $key = $sort->field_type;
613
-                ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
614
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
615
-            }
611
+			if ($sort->field_type == 'random') {
612
+				$key = $sort->field_type;
613
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
614
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
615
+			}
616 616
 
617
-            if ($sort->htmlvar_name == 'comment_count') {
618
-                $sort->htmlvar_name = 'rating_count';
619
-            }
617
+			if ($sort->htmlvar_name == 'comment_count') {
618
+				$sort->htmlvar_name = 'rating_count';
619
+			}
620 620
 
621
-            if ($sort->sort_asc) {
622
-                $key = $sort->htmlvar_name . '_asc';
623
-                $label = $sort->site_title;
624
-                if ($sort->asc_title)
625
-                    $label = $sort->asc_title;
626
-                ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
628
-            }
621
+			if ($sort->sort_asc) {
622
+				$key = $sort->htmlvar_name . '_asc';
623
+				$label = $sort->site_title;
624
+				if ($sort->asc_title)
625
+					$label = $sort->asc_title;
626
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
628
+			}
629 629
 
630
-            if ($sort->sort_desc) {
631
-                $key = $sort->htmlvar_name . '_desc';
632
-                $label = $sort->site_title;
633
-                if ($sort->desc_title)
634
-                    $label = $sort->desc_title;
635
-                ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
637
-            }
630
+			if ($sort->sort_desc) {
631
+				$key = $sort->htmlvar_name . '_desc';
632
+				$label = $sort->site_title;
633
+				if ($sort->desc_title)
634
+					$label = $sort->desc_title;
635
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
637
+			}
638 638
 
639
-        }
640
-    }
639
+		}
640
+	}
641 641
 
642
-    if ($sort_field_options != '') {
642
+	if ($sort_field_options != '') {
643 643
 
644
-        ?>
644
+		?>
645 645
 
646 646
         <div class="geodir-tax-sort">
647 647
 
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
                 <option
651 651
                     value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
652 652
 
653
-                echo $sort_field_options;?>
653
+				echo $sort_field_options;?>
654 654
 
655 655
             </select>
656 656
 
657 657
         </div>
658 658
     <?php
659 659
 
660
-    }
660
+	}
661 661
 
662 662
 }
663 663
 
@@ -677,10 +677,10 @@  discard block
 block discarded – undo
677 677
 function geodir_advance_customfields_heading($title, $field_type)
678 678
 {
679 679
 
680
-    if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
681
-        $title = '';
682
-    }
683
-    return $title;
680
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
681
+		$title = '';
682
+	}
683
+	return $title;
684 684
 }
685 685
 
686 686
 
@@ -697,81 +697,81 @@  discard block
 block discarded – undo
697 697
  * @return string Returns related posts html.
698 698
  */
699 699
 function geodir_related_posts_display($request) {
700
-    if (!empty($request)) {
701
-        $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
702
-        $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
703
-
704
-        $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
705
-        $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
706
-        $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
707
-        $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
708
-        $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
709
-        $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
710
-        $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
711
-        $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
712
-
713
-        global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
714
-        $related_parent_lat = $post->post_latitude;
715
-        $related_parent_lon = $post->post_longitude;
716
-        $arr_detail_page_tabs = geodir_detail_page_tabs_list();
717
-
718
-        $related_listing_array = array();
719
-        if (get_option('geodir_add_related_listing_posttypes'))
720
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
721
-        if (in_array($post->post_type, $related_listing_array)) {
722
-            $arr_detail_page_tabs['related_listing']['is_display'] = true;
723
-        }
700
+	if (!empty($request)) {
701
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
702
+		$after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
703
+
704
+		$title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
705
+		$post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
706
+		$relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
707
+		$layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
708
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
709
+		$listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
710
+		$list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
711
+		$character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
712
+
713
+		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
714
+		$related_parent_lat = $post->post_latitude;
715
+		$related_parent_lon = $post->post_longitude;
716
+		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
717
+
718
+		$related_listing_array = array();
719
+		if (get_option('geodir_add_related_listing_posttypes'))
720
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
721
+		if (in_array($post->post_type, $related_listing_array)) {
722
+			$arr_detail_page_tabs['related_listing']['is_display'] = true;
723
+		}
724 724
 
725
-        $is_display = $arr_detail_page_tabs['related_listing']['is_display'];
726
-        $origi_post = $post;
727
-        $post_type = '';
728
-        $post_id = '';
729
-        $category_taxonomy = '';
730
-        $tax_field = 'id';
731
-        $category = array();
732
-
733
-        if (isset($_REQUEST['backandedit'])) {
734
-            $post = (object)$gd_session->get('listing');
735
-            $post_type = $post->listing_type;
736
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
737
-                $post_id = $_REQUEST['pid'];
738
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
739
-            $post = geodir_get_post_info($_REQUEST['pid']);
740
-            $post_type = $post->post_type;
741
-            $post_id = $_REQUEST['pid'];
742
-        } elseif (isset($post->post_type) && $post->post_type != '') {
743
-            $post_type = $post->post_type;
744
-            $post_id = $post->ID;
745
-        }
725
+		$is_display = $arr_detail_page_tabs['related_listing']['is_display'];
726
+		$origi_post = $post;
727
+		$post_type = '';
728
+		$post_id = '';
729
+		$category_taxonomy = '';
730
+		$tax_field = 'id';
731
+		$category = array();
732
+
733
+		if (isset($_REQUEST['backandedit'])) {
734
+			$post = (object)$gd_session->get('listing');
735
+			$post_type = $post->listing_type;
736
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
737
+				$post_id = $_REQUEST['pid'];
738
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
739
+			$post = geodir_get_post_info($_REQUEST['pid']);
740
+			$post_type = $post->post_type;
741
+			$post_id = $_REQUEST['pid'];
742
+		} elseif (isset($post->post_type) && $post->post_type != '') {
743
+			$post_type = $post->post_type;
744
+			$post_id = $post->ID;
745
+		}
746 746
 
747
-        if ($relate_to == 'category') {
747
+		if ($relate_to == 'category') {
748 748
 
749
-            $category_taxonomy = $post_type . $relate_to;
750
-            if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
751
-                $category = explode(',', trim($post->{$category_taxonomy}, ','));
749
+			$category_taxonomy = $post_type . $relate_to;
750
+			if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
751
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
752 752
 
753
-        } elseif ($relate_to == 'tags') {
753
+		} elseif ($relate_to == 'tags') {
754 754
 
755
-            $category_taxonomy = $post_type . '_' . $relate_to;
756
-            if ($post->post_tags != '')
757
-                $category = explode(',', trim($post->post_tags, ','));
758
-            $tax_field = 'name';
759
-        }
755
+			$category_taxonomy = $post_type . '_' . $relate_to;
756
+			if ($post->post_tags != '')
757
+				$category = explode(',', trim($post->post_tags, ','));
758
+			$tax_field = 'name';
759
+		}
760 760
 
761
-        /* --- return false in invalid request --- */
762
-        if (empty($category))
763
-            return false;
761
+		/* --- return false in invalid request --- */
762
+		if (empty($category))
763
+			return false;
764 764
 
765
-        $all_postypes = geodir_get_posttypes();
765
+		$all_postypes = geodir_get_posttypes();
766 766
 
767
-        if (!in_array($post_type, $all_postypes))
768
-            return false;
767
+		if (!in_array($post_type, $all_postypes))
768
+			return false;
769 769
 
770
-        /* --- return false in invalid request --- */
770
+		/* --- return false in invalid request --- */
771 771
 
772
-       $location_url = '';
773
-        if ($add_location_filter != '0') {
774
-            $location_url = array();
772
+	   $location_url = '';
773
+		if ($add_location_filter != '0') {
774
+			$location_url = array();
775 775
 			$geodir_show_location_url = get_option('geodir_show_location_url');
776 776
 			
777 777
 			$gd_city = get_query_var('gd_city');
@@ -779,13 +779,13 @@  discard block
 block discarded – undo
779 779
 			if ($gd_city) {
780 780
 				$gd_country = get_query_var('gd_country');
781 781
 				$gd_region = get_query_var('gd_region');
782
-            } else {
783
-                $location = geodir_get_default_location();
782
+			} else {
783
+				$location = geodir_get_default_location();
784 784
 				
785 785
 				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
786 786
 				$gd_region = isset($location->region_slug) ? $location->region_slug : '';
787 787
 				$gd_city = isset($location->city_slug) ? $location->city_slug : '';
788
-            }
788
+			}
789 789
 			
790 790
 			if ($geodir_show_location_url == 'all') {
791 791
 				$location_url[] = $gd_country;
@@ -798,99 +798,99 @@  discard block
 block discarded – undo
798 798
 			
799 799
 			$location_url[] = $gd_city;
800 800
 
801
-            $location_url = implode('/', $location_url);
802
-        }
801
+			$location_url = implode('/', $location_url);
802
+		}
803 803
 
804 804
 
805
-        if (!empty($category)) {
806
-            global $geodir_add_location_url;
807
-            $geodir_add_location_url = '0';
808
-            if ($add_location_filter != '0') {
809
-                $geodir_add_location_url = '1';
810
-            }
811
-            $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
812
-            $geodir_add_location_url = NULL;
813
-        }
814
-        ob_start();
815
-        ?>
805
+		if (!empty($category)) {
806
+			global $geodir_add_location_url;
807
+			$geodir_add_location_url = '0';
808
+			if ($add_location_filter != '0') {
809
+				$geodir_add_location_url = '1';
810
+			}
811
+			$viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
812
+			$geodir_add_location_url = NULL;
813
+		}
814
+		ob_start();
815
+		?>
816 816
 
817 817
 
818 818
         <div class="geodir_locations geodir_location_listing">
819 819
 
820 820
             <?php
821
-            if (isset($request['is_widget']) && $request['is_widget'] == '1') {
822
-                /** geodir_before_title filter Documented in geodirectory_widgets.php */
823
-                $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
824
-                /** geodir_after_title filter Documented in geodirectory_widgets.php */
825
-                $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
826
-                ?>
821
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
822
+				/** geodir_before_title filter Documented in geodirectory_widgets.php */
823
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
824
+				/** geodir_after_title filter Documented in geodirectory_widgets.php */
825
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
826
+				?>
827 827
                 <div class="location_list_heading clearfix">
828 828
                     <?php echo $before_title . $title . $after_title; ?>
829 829
                 </div>
830 830
             <?php
831
-            }
832
-            $query_args = array(
833
-                'posts_per_page' => $post_number,
834
-                'is_geodir_loop' => true,
835
-                'gd_location' => ($add_location_filter) ? true : false,
836
-                'post_type' => $post_type,
837
-                'order_by' => $list_sort,
838
-                'post__not_in' => array($post_id),
839
-                'excerpt_length' => $character_count,
840
-                'related_listings' => $is_display
841
-            );
842
-
843
-            $tax_query = array('taxonomy' => $category_taxonomy,
844
-                'field' => $tax_field,
845
-                'terms' => $category
846
-            );
847
-
848
-            $query_args['tax_query'] = array($tax_query);
849
-
850
-            global $gridview_columns, $post;
851
-
852
-
853
-            query_posts($query_args);
854
-
855
-            if (strstr($layout, 'gridview')) {
856
-                $listing_view_exp = explode('_', $layout);
857
-                $gridview_columns = $layout;
858
-                $layout = $listing_view_exp[0];
859
-            } else if ($layout == 'list') {
860
-                $gridview_columns = '';
861
-            }
862
-            $related_posts = true;
831
+			}
832
+			$query_args = array(
833
+				'posts_per_page' => $post_number,
834
+				'is_geodir_loop' => true,
835
+				'gd_location' => ($add_location_filter) ? true : false,
836
+				'post_type' => $post_type,
837
+				'order_by' => $list_sort,
838
+				'post__not_in' => array($post_id),
839
+				'excerpt_length' => $character_count,
840
+				'related_listings' => $is_display
841
+			);
842
+
843
+			$tax_query = array('taxonomy' => $category_taxonomy,
844
+				'field' => $tax_field,
845
+				'terms' => $category
846
+			);
847
+
848
+			$query_args['tax_query'] = array($tax_query);
849
+
850
+			global $gridview_columns, $post;
851
+
852
+
853
+			query_posts($query_args);
854
+
855
+			if (strstr($layout, 'gridview')) {
856
+				$listing_view_exp = explode('_', $layout);
857
+				$gridview_columns = $layout;
858
+				$layout = $listing_view_exp[0];
859
+			} else if ($layout == 'list') {
860
+				$gridview_columns = '';
861
+			}
862
+			$related_posts = true;
863 863
 
864
-            $related_nearest = false;
865
-            if ($list_sort == 'nearest') {
866
-                $related_nearest = true;
867
-            }
864
+			$related_nearest = false;
865
+			if ($list_sort == 'nearest') {
866
+				$related_nearest = true;
867
+			}
868 868
 
869 869
 
870
-            /**
871
-             * Filters related listing listview template.
872
-             *
873
-             * @since 1.0.0
874
-             */
875
-            $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
870
+			/**
871
+			 * Filters related listing listview template.
872
+			 *
873
+			 * @since 1.0.0
874
+			 */
875
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
876 876
 
877
-            /**
878
-             * Includes related listing listview template.
879
-             *
880
-             * @since 1.0.0
881
-             */
882
-            include($template);
877
+			/**
878
+			 * Includes related listing listview template.
879
+			 *
880
+			 * @since 1.0.0
881
+			 */
882
+			include($template);
883 883
 
884
-            wp_reset_query();
885
-            $post = $origi_post;
886
-            $related_nearest = false;
887
-            ?>
884
+			wp_reset_query();
885
+			$post = $origi_post;
886
+			$related_nearest = false;
887
+			?>
888 888
 
889 889
         </div>
890 890
         <?php
891
-        return $html = ob_get_clean();
891
+		return $html = ob_get_clean();
892 892
 
893
-    }
893
+	}
894 894
 
895 895
 }
896 896
 
@@ -906,17 +906,17 @@  discard block
 block discarded – undo
906 906
  */
907 907
 function geodir_category_count_script()
908 908
 {
909
-    global $geodir_post_category_str;
909
+	global $geodir_post_category_str;
910 910
 
911
-    if (!empty($geodir_post_category_str)) {
912
-        $geodir_post_category_str = serialize($geodir_post_category_str);
913
-    }
911
+	if (!empty($geodir_post_category_str)) {
912
+		$geodir_post_category_str = serialize($geodir_post_category_str);
913
+	}
914 914
 
915
-    $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
916
-    $script = "var post_category_array = " . json_encode($all_var) . ';';
917
-    echo '<script>';
918
-    echo $script;
919
-    echo '</script>';
915
+	$all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
916
+	$script = "var post_category_array = " . json_encode($all_var) . ';';
917
+	echo '<script>';
918
+	echo $script;
919
+	echo '</script>';
920 920
 
921 921
 }
922 922
 
@@ -929,16 +929,16 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_map_default_language()
931 931
 {
932
-    $geodir_default_map_language = get_option('geodir_default_map_language');
933
-    if (empty($geodir_default_map_language))
934
-        $geodir_default_map_language = 'en';
935
-    /**
936
-     * Filter default map language.
937
-     *
938
-     * @since 1.0.0
939
-     * @param string $geodir_default_map_language Default map language.
940
-     */
941
-    return apply_filters('geodir_default_map_language', $geodir_default_map_language);
932
+	$geodir_default_map_language = get_option('geodir_default_map_language');
933
+	if (empty($geodir_default_map_language))
934
+		$geodir_default_map_language = 'en';
935
+	/**
936
+	 * Filter default map language.
937
+	 *
938
+	 * @since 1.0.0
939
+	 * @param string $geodir_default_map_language Default map language.
940
+	 */
941
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
942 942
 }
943 943
 
944 944
 /**
@@ -950,14 +950,14 @@  discard block
 block discarded – undo
950 950
  */
951 951
 function geodir_get_map_api_key()
952 952
 {
953
-    $key = get_option('geodir_google_api_key');
954
-    /**
955
-     * Filter Google maps api key.
956
-     *
957
-     * @since 1.6.4
958
-     * @param string $key Google maps api key.
959
-     */
960
-    return apply_filters('geodir_google_api_key', $key);
953
+	$key = get_option('geodir_google_api_key');
954
+	/**
955
+	 * Filter Google maps api key.
956
+	 *
957
+	 * @since 1.6.4
958
+	 * @param string $key Google maps api key.
959
+	 */
960
+	return apply_filters('geodir_google_api_key', $key);
961 961
 }
962 962
 
963 963
 
@@ -974,12 +974,12 @@  discard block
 block discarded – undo
974 974
  */
975 975
 function geodir_add_meta_keywords()
976 976
 {
977
-    global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
977
+	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
978 978
 
979
-    $is_geodir_page = geodir_is_geodir_page();
980
-    if (!$is_geodir_page) {
981
-        return;
982
-    }// if non GD page, bail
979
+	$is_geodir_page = geodir_is_geodir_page();
980
+	if (!$is_geodir_page) {
981
+		return;
982
+	}// if non GD page, bail
983 983
 
984 984
 	$use_gd_meta = true;
985 985
 	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
@@ -994,249 +994,249 @@  discard block
 block discarded – undo
994 994
 		return;
995 995
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
996 996
 
997
-    $current_term = $wp_query->get_queried_object();
998
-
999
-    $all_postypes = geodir_get_posttypes();
1000
-
1001
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1002
-
1003
-    $meta_desc = '';
1004
-    $meta_key = '';
1005
-    if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1006
-        /**
1007
-         * Filter SEO meta location description.
1008
-         *
1009
-         * @since 1.0.0
1010
-         */
1011
-        $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1012
-        $meta_desc .= '';
1013
-    }
1014
-    if (have_posts() && is_single() OR is_page()) {
1015
-        while (have_posts()) {
1016
-            the_post();
1017
-
1018
-            if (has_excerpt()) {
1019
-                $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1020
-                if (empty($out_excerpt)) {
1021
-                    $out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1022
-                }
1023
-                $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1024
-            } else {
1025
-                $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1026
-                $out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1027
-                if (empty($out_excerpt)) {
1028
-                    $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1029
-                }
1030
-                $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1031
-            }
997
+	$current_term = $wp_query->get_queried_object();
1032 998
 
1033
-            $meta_desc .= $out_excerpt;
1034
-        }
1035
-    } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1036
-        if (is_category()) {
1037
-            $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
1038
-        } elseif (is_tag()) {
1039
-            $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
1040
-        }
1041
-    } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1042
-        $meta_desc .= isset($current_term->description) ? $current_term->description : '';
1043
-    }
1044
-
1045
-
1046
-    $geodir_post_type = geodir_get_current_posttype();
1047
-    $geodir_post_type_info = get_post_type_object($geodir_post_type);
1048
-    $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1049
-
1050
-    $category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1051
-    $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true);
1052
-
1053
-    $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1054
-    $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1055
-
1056
-    $geodir_is_search = geodir_is_page('search') ? true : false;
1057
-    $geodir_is_location = geodir_is_page('location') ? true : false;
1058
-    $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1059
-    $godir_location_terms = geodir_get_current_location_terms('query_vars');
1060
-    $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL;
1061
-    $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL;
1062
-    $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL;
1063
-    $replace_location = __('Everywhere', 'geodirectory');
1064
-    $location_id = NULL;
1065
-    if ($geodir_location_manager) {
1066
-        $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1067
-        $location_id = (int)$wpdb->get_var($sql);
1068
-        $location_type = geodir_what_is_current_location();
1069
-        if ($location_type == 'city') {
1070
-            $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1071
-        } elseif ($location_type == 'region') {
1072
-            $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1073
-        } elseif ($location_type == 'country') {
1074
-            $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1075
-            $replace_location = __($replace_location, 'geodirectory');
1076
-        }
1077
-        $country = get_query_var('gd_country');
1078
-        $region = get_query_var('gd_region');
1079
-        $city = get_query_var('gd_city');
1080
-        $current_location = '';
1081
-        if ($country != '') {
1082
-            $current_location = get_actual_location_name('country', $country, true);
1083
-        }
1084
-        if ($region != '') {
1085
-            $current_location = get_actual_location_name('region', $region);
1086
-        }
1087
-        if ($city != '') {
1088
-            $current_location = get_actual_location_name('city', $city);
1089
-        }
1090
-        $replace_location = $current_location != '' ? $current_location : $replace_location;
1091
-    }
1092
-
1093
-    $geodir_meta_keys = '';
1094
-    $geodir_meta_desc = '';
1095
-    if ($is_geodir_page && !empty($geodir_post_type_info)) {
1096
-        if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1097
-            $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1098
-
1099
-            $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1100
-            $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1101
-
1102
-            if ($geodir_is_category) {
1103
-                $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
1104
-                if (isset($category->term_id) && !empty($category->term_id)) {
1105
-                    $category_id = $category->term_id;
1106
-                    $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1107
-                    if ($location_id) {
1108
-                        $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1109
-                        $cat_loc_option = get_option($option_name);
1110
-
1111
-                        $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1112
-                        if (!$gd_cat_loc_default) {
1113
-                            $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1114
-                            $option = get_option($option_name);
1115
-                            $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1116
-                        }
1117
-                    }
1118
-                    $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
1119
-                }
1120
-            } else if ($geodir_is_tag) {
1121
-                $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
1122
-            }
1123
-        }
1124
-    }
1125
-
1126
-
1127
-    $gd_page = '';
1128
-    if(geodir_is_page('home')){
1129
-        $gd_page = 'home';
1130
-        $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1131
-    }
1132
-    elseif(geodir_is_page('detail')){
1133
-        $gd_page = 'detail';
1134
-        $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1135
-    }
1136
-    elseif(geodir_is_page('pt')){
1137
-        $gd_page = 'pt';
1138
-        $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1139
-    }
1140
-    elseif(geodir_is_page('listing')){
1141
-        $gd_page = 'listing';
1142
-        $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1143
-    }
1144
-    elseif(geodir_is_page('location')){
1145
-        $gd_page = 'location';
1146
-        $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1147
-        $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1148
-
1149
-    }
1150
-    elseif(geodir_is_page('search')){
1151
-        $gd_page = 'search';
1152
-        $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1153
-    }
1154
-    elseif(geodir_is_page('add-listing')){
1155
-        $gd_page = 'add-listing';
1156
-        $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1157
-    }
1158
-    elseif(geodir_is_page('author')){
1159
-        $gd_page = 'author';
1160
-        $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1161
-    }
1162
-    elseif(geodir_is_page('login')){
1163
-        $gd_page = 'login';
1164
-        $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1165
-    }
1166
-    elseif(geodir_is_page('listing-success')){
1167
-        $gd_page = 'listing-success';
1168
-        $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1169
-    }
1170
-
1171
-
1172
-    if ($meta_desc) {
1173
-        $meta_desc = stripslashes_deep($meta_desc);
1174
-        /**
1175
-         * Filter page description to replace variables.
1176
-         *
1177
-         * @since 1.5.4
1178
-         * @param string $title The page description including variables.
1179
-         * @param string $gd_page The GeoDirectory page type if any.
1180
-         */
1181
-        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1182
-
1183
-        /**
1184
-         * Filter SEO meta description.
1185
-         *
1186
-         * @since 1.0.0
1187
-         * @param string $meta_desc Meta description content.
1188
-         */
1189
-        echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
1190
-    }
1191
-
1192
-    // meta keywords
1193
-    if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1194
-        $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1195
-        $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1196
-
1197
-        $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1198
-    } else {
1199
-        $posttags = get_the_tags();
1200
-        if ($posttags) {
1201
-            foreach ($posttags as $tag) {
1202
-                $meta_key .= $tag->name . ' ';
1203
-            }
1204
-        } else {
1205
-            $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1206
-            $xt = 1;
999
+	$all_postypes = geodir_get_posttypes();
1207 1000
 
1208
-            foreach ($tags as $tag) {
1209
-                if ($xt <= 20) {
1210
-                    $meta_key .= $tag->name . ", ";
1211
-                }
1001
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1212 1002
 
1213
-                $xt++;
1214
-            }
1215
-        }
1216
-    }
1217
-
1218
-    $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1219
-    $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1220
-    if ($geodir_meta_keys != '') {
1221
-        $geodir_meta_keys = strip_tags($geodir_meta_keys);
1222
-        $geodir_meta_keys = esc_html($geodir_meta_keys);
1223
-        $geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1224
-        $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1225
-        $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1226
-
1227
-        $meta_key = rtrim(trim($geodir_meta_keys), ",");
1228
-    }
1229
-
1230
-    if ($meta_key) {
1231
-        $meta_key = stripslashes_deep($meta_key);
1232
-        /**
1233
-         * Filter SEO meta keywords.
1234
-         *
1235
-         * @since 1.0.0
1236
-         * @param string $meta_desc Meta keywords.
1237
-         */
1238
-        echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
1239
-    }
1003
+	$meta_desc = '';
1004
+	$meta_key = '';
1005
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1006
+		/**
1007
+		 * Filter SEO meta location description.
1008
+		 *
1009
+		 * @since 1.0.0
1010
+		 */
1011
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1012
+		$meta_desc .= '';
1013
+	}
1014
+	if (have_posts() && is_single() OR is_page()) {
1015
+		while (have_posts()) {
1016
+			the_post();
1017
+
1018
+			if (has_excerpt()) {
1019
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1020
+				if (empty($out_excerpt)) {
1021
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1022
+				}
1023
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1024
+			} else {
1025
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1026
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1027
+				if (empty($out_excerpt)) {
1028
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1029
+				}
1030
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1031
+			}
1032
+
1033
+			$meta_desc .= $out_excerpt;
1034
+		}
1035
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1036
+		if (is_category()) {
1037
+			$meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
1038
+		} elseif (is_tag()) {
1039
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
1040
+		}
1041
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1042
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1043
+	}
1044
+
1045
+
1046
+	$geodir_post_type = geodir_get_current_posttype();
1047
+	$geodir_post_type_info = get_post_type_object($geodir_post_type);
1048
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1049
+
1050
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1051
+	$tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true);
1052
+
1053
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1054
+	$geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1055
+
1056
+	$geodir_is_search = geodir_is_page('search') ? true : false;
1057
+	$geodir_is_location = geodir_is_page('location') ? true : false;
1058
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1059
+	$godir_location_terms = geodir_get_current_location_terms('query_vars');
1060
+	$gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL;
1061
+	$gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL;
1062
+	$gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL;
1063
+	$replace_location = __('Everywhere', 'geodirectory');
1064
+	$location_id = NULL;
1065
+	if ($geodir_location_manager) {
1066
+		$sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1067
+		$location_id = (int)$wpdb->get_var($sql);
1068
+		$location_type = geodir_what_is_current_location();
1069
+		if ($location_type == 'city') {
1070
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1071
+		} elseif ($location_type == 'region') {
1072
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1073
+		} elseif ($location_type == 'country') {
1074
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1075
+			$replace_location = __($replace_location, 'geodirectory');
1076
+		}
1077
+		$country = get_query_var('gd_country');
1078
+		$region = get_query_var('gd_region');
1079
+		$city = get_query_var('gd_city');
1080
+		$current_location = '';
1081
+		if ($country != '') {
1082
+			$current_location = get_actual_location_name('country', $country, true);
1083
+		}
1084
+		if ($region != '') {
1085
+			$current_location = get_actual_location_name('region', $region);
1086
+		}
1087
+		if ($city != '') {
1088
+			$current_location = get_actual_location_name('city', $city);
1089
+		}
1090
+		$replace_location = $current_location != '' ? $current_location : $replace_location;
1091
+	}
1092
+
1093
+	$geodir_meta_keys = '';
1094
+	$geodir_meta_desc = '';
1095
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1096
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1097
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1098
+
1099
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1100
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1101
+
1102
+			if ($geodir_is_category) {
1103
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
1104
+				if (isset($category->term_id) && !empty($category->term_id)) {
1105
+					$category_id = $category->term_id;
1106
+					$category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1107
+					if ($location_id) {
1108
+						$option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1109
+						$cat_loc_option = get_option($option_name);
1110
+
1111
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1112
+						if (!$gd_cat_loc_default) {
1113
+							$option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1114
+							$option = get_option($option_name);
1115
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1116
+						}
1117
+					}
1118
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
1119
+				}
1120
+			} else if ($geodir_is_tag) {
1121
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
1122
+			}
1123
+		}
1124
+	}
1125
+
1126
+
1127
+	$gd_page = '';
1128
+	if(geodir_is_page('home')){
1129
+		$gd_page = 'home';
1130
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1131
+	}
1132
+	elseif(geodir_is_page('detail')){
1133
+		$gd_page = 'detail';
1134
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1135
+	}
1136
+	elseif(geodir_is_page('pt')){
1137
+		$gd_page = 'pt';
1138
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1139
+	}
1140
+	elseif(geodir_is_page('listing')){
1141
+		$gd_page = 'listing';
1142
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1143
+	}
1144
+	elseif(geodir_is_page('location')){
1145
+		$gd_page = 'location';
1146
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1147
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1148
+
1149
+	}
1150
+	elseif(geodir_is_page('search')){
1151
+		$gd_page = 'search';
1152
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1153
+	}
1154
+	elseif(geodir_is_page('add-listing')){
1155
+		$gd_page = 'add-listing';
1156
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1157
+	}
1158
+	elseif(geodir_is_page('author')){
1159
+		$gd_page = 'author';
1160
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1161
+	}
1162
+	elseif(geodir_is_page('login')){
1163
+		$gd_page = 'login';
1164
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1165
+	}
1166
+	elseif(geodir_is_page('listing-success')){
1167
+		$gd_page = 'listing-success';
1168
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1169
+	}
1170
+
1171
+
1172
+	if ($meta_desc) {
1173
+		$meta_desc = stripslashes_deep($meta_desc);
1174
+		/**
1175
+		 * Filter page description to replace variables.
1176
+		 *
1177
+		 * @since 1.5.4
1178
+		 * @param string $title The page description including variables.
1179
+		 * @param string $gd_page The GeoDirectory page type if any.
1180
+		 */
1181
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1182
+
1183
+		/**
1184
+		 * Filter SEO meta description.
1185
+		 *
1186
+		 * @since 1.0.0
1187
+		 * @param string $meta_desc Meta description content.
1188
+		 */
1189
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
1190
+	}
1191
+
1192
+	// meta keywords
1193
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1194
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1195
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1196
+
1197
+		$meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1198
+	} else {
1199
+		$posttags = get_the_tags();
1200
+		if ($posttags) {
1201
+			foreach ($posttags as $tag) {
1202
+				$meta_key .= $tag->name . ' ';
1203
+			}
1204
+		} else {
1205
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1206
+			$xt = 1;
1207
+
1208
+			foreach ($tags as $tag) {
1209
+				if ($xt <= 20) {
1210
+					$meta_key .= $tag->name . ", ";
1211
+				}
1212
+
1213
+				$xt++;
1214
+			}
1215
+		}
1216
+	}
1217
+
1218
+	$meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1219
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1220
+	if ($geodir_meta_keys != '') {
1221
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1222
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1223
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1224
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1225
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1226
+
1227
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1228
+	}
1229
+
1230
+	if ($meta_key) {
1231
+		$meta_key = stripslashes_deep($meta_key);
1232
+		/**
1233
+		 * Filter SEO meta keywords.
1234
+		 *
1235
+		 * @since 1.0.0
1236
+		 * @param string $meta_desc Meta keywords.
1237
+		 */
1238
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
1239
+	}
1240 1240
 
1241 1241
 }
1242 1242
 
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
  */
1252 1252
 function geodir_detail_page_tabs_key_value_array()
1253 1253
 {
1254
-    $geodir_detail_page_tabs_key_value_array = array();
1254
+	$geodir_detail_page_tabs_key_value_array = array();
1255 1255
 
1256
-    $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1256
+	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1257 1257
 
1258
-    foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1259
-        $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1260
-    }
1261
-    return $geodir_detail_page_tabs_key_value_array;
1258
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1259
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1260
+	}
1261
+	return $geodir_detail_page_tabs_key_value_array;
1262 1262
 }
1263 1263
 
1264 1264
 /**
@@ -1271,73 +1271,73 @@  discard block
 block discarded – undo
1271 1271
 function geodir_detail_page_tabs_array()
1272 1272
 {
1273 1273
 
1274
-    $arr_tabs = array();
1275
-    /**
1276
-     * Filter detail page tab display.
1277
-     *
1278
-     * @since 1.0.0
1279
-     */
1280
-    $arr_tabs['post_profile'] = array(
1281
-        'heading_text' => __('Profile', 'geodirectory'),
1282
-        'is_active_tab' => true,
1283
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1284
-        'tab_content' => ''
1285
-    );
1286
-    $arr_tabs['post_info'] = array(
1287
-        'heading_text' => __('More Info', 'geodirectory'),
1288
-        'is_active_tab' => false,
1289
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1290
-        'tab_content' => ''
1291
-    );
1292
-
1293
-    $arr_tabs['post_images'] = array(
1294
-        'heading_text' => __('Photo', 'geodirectory'),
1295
-        'is_active_tab' => false,
1296
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1297
-        'tab_content' => ''
1298
-    );
1299
-
1300
-    $arr_tabs['post_video'] = array(
1301
-        'heading_text' => __('Video', 'geodirectory'),
1302
-        'is_active_tab' => false,
1303
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1304
-        'tab_content' => ''
1305
-    );
1306
-
1307
-    $arr_tabs['special_offers'] = array(
1308
-        'heading_text' => __('Special Offers', 'geodirectory'),
1309
-        'is_active_tab' => false,
1310
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1311
-        'tab_content' => ''
1312
-    );
1313
-
1314
-    $arr_tabs['post_map'] = array(
1315
-        'heading_text' => __('Map', 'geodirectory'),
1316
-        'is_active_tab' => false,
1317
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1318
-        'tab_content' => ''
1319
-    );
1320
-
1321
-    $arr_tabs['reviews'] = array(
1322
-        'heading_text' => __('Reviews', 'geodirectory'),
1323
-        'is_active_tab' => false,
1324
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1325
-        'tab_content' => 'review display'
1326
-    );
1327
-
1328
-    $arr_tabs['related_listing'] = array(
1329
-        'heading_text' => __('Related Listing', 'geodirectory'),
1330
-        'is_active_tab' => false,
1331
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1332
-        'tab_content' => ''
1333
-    );
1334
-
1335
-    /**
1336
-     * Filter the tabs array.
1337
-     *
1338
-     * @since 1.0.0
1339
-     */
1340
-    return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1274
+	$arr_tabs = array();
1275
+	/**
1276
+	 * Filter detail page tab display.
1277
+	 *
1278
+	 * @since 1.0.0
1279
+	 */
1280
+	$arr_tabs['post_profile'] = array(
1281
+		'heading_text' => __('Profile', 'geodirectory'),
1282
+		'is_active_tab' => true,
1283
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1284
+		'tab_content' => ''
1285
+	);
1286
+	$arr_tabs['post_info'] = array(
1287
+		'heading_text' => __('More Info', 'geodirectory'),
1288
+		'is_active_tab' => false,
1289
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1290
+		'tab_content' => ''
1291
+	);
1292
+
1293
+	$arr_tabs['post_images'] = array(
1294
+		'heading_text' => __('Photo', 'geodirectory'),
1295
+		'is_active_tab' => false,
1296
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1297
+		'tab_content' => ''
1298
+	);
1299
+
1300
+	$arr_tabs['post_video'] = array(
1301
+		'heading_text' => __('Video', 'geodirectory'),
1302
+		'is_active_tab' => false,
1303
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1304
+		'tab_content' => ''
1305
+	);
1306
+
1307
+	$arr_tabs['special_offers'] = array(
1308
+		'heading_text' => __('Special Offers', 'geodirectory'),
1309
+		'is_active_tab' => false,
1310
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1311
+		'tab_content' => ''
1312
+	);
1313
+
1314
+	$arr_tabs['post_map'] = array(
1315
+		'heading_text' => __('Map', 'geodirectory'),
1316
+		'is_active_tab' => false,
1317
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1318
+		'tab_content' => ''
1319
+	);
1320
+
1321
+	$arr_tabs['reviews'] = array(
1322
+		'heading_text' => __('Reviews', 'geodirectory'),
1323
+		'is_active_tab' => false,
1324
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1325
+		'tab_content' => 'review display'
1326
+	);
1327
+
1328
+	$arr_tabs['related_listing'] = array(
1329
+		'heading_text' => __('Related Listing', 'geodirectory'),
1330
+		'is_active_tab' => false,
1331
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1332
+		'tab_content' => ''
1333
+	);
1334
+
1335
+	/**
1336
+	 * Filter the tabs array.
1337
+	 *
1338
+	 * @since 1.0.0
1339
+	 */
1340
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1341 1341
 
1342 1342
 
1343 1343
 }
@@ -1352,15 +1352,15 @@  discard block
 block discarded – undo
1352 1352
  */
1353 1353
 function geodir_detail_page_tabs_list()
1354 1354
 {
1355
-    $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1356
-    $tabs_array = geodir_detail_page_tabs_array();
1357
-    if (!empty($tabs_excluded)) {
1358
-        foreach ($tabs_excluded as $tab) {
1359
-            if (array_key_exists($tab, $tabs_array))
1360
-                unset($tabs_array[$tab]);
1361
-        }
1362
-    }
1363
-    return $tabs_array;
1355
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1356
+	$tabs_array = geodir_detail_page_tabs_array();
1357
+	if (!empty($tabs_excluded)) {
1358
+		foreach ($tabs_excluded as $tab) {
1359
+			if (array_key_exists($tab, $tabs_array))
1360
+				unset($tabs_array[$tab]);
1361
+		}
1362
+	}
1363
+	return $tabs_array;
1364 1364
 }
1365 1365
 
1366 1366
 
@@ -1378,162 +1378,162 @@  discard block
 block discarded – undo
1378 1378
  */
1379 1379
 function geodir_show_detail_page_tabs()
1380 1380
 {
1381
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1381
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1382 1382
 
1383
-    $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1384
-    $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1385
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1383
+	$post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1384
+	$request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1385
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1386 1386
 
1387
-    if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1388
-        $post = geodir_get_post_info($request_post_id);
1389
-        setup_postdata($post);
1390
-    }
1387
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1388
+		$post = geodir_get_post_info($request_post_id);
1389
+		setup_postdata($post);
1390
+	}
1391 1391
 
1392
-    $geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1392
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1393 1393
 
1394 1394
 
1395
-    if (geodir_is_page('detail')) {
1396
-        $video = geodir_get_video($post->ID);
1397
-        $special_offers = geodir_get_special_offers($post->ID);
1398
-        $related_listing_array = array();
1399
-        if (get_option('geodir_add_related_listing_posttypes'))
1400
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1395
+	if (geodir_is_page('detail')) {
1396
+		$video = geodir_get_video($post->ID);
1397
+		$special_offers = geodir_get_special_offers($post->ID);
1398
+		$related_listing_array = array();
1399
+		if (get_option('geodir_add_related_listing_posttypes'))
1400
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1401 1401
 
1402 1402
 
1403
-        $excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1404
-        if(!$excluded_tabs){$excluded_tabs = array();}
1403
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1404
+		if(!$excluded_tabs){$excluded_tabs = array();}
1405 1405
 
1406
-        $related_listing = '';
1407
-        if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1408
-            $request = array('post_number' => get_option('geodir_related_post_count'),
1409
-                'relate_to' => get_option('geodir_related_post_relate_to'),
1410
-                'layout' => get_option('geodir_related_post_listing_view'),
1411
-                'add_location_filter' => get_option('geodir_related_post_location_filter'),
1412
-                'list_sort' => get_option('geodir_related_post_sortby'),
1413
-                'character_count' => get_option('geodir_related_post_excerpt'));
1406
+		$related_listing = '';
1407
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1408
+			$request = array('post_number' => get_option('geodir_related_post_count'),
1409
+				'relate_to' => get_option('geodir_related_post_relate_to'),
1410
+				'layout' => get_option('geodir_related_post_listing_view'),
1411
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1412
+				'list_sort' => get_option('geodir_related_post_sortby'),
1413
+				'character_count' => get_option('geodir_related_post_excerpt'));
1414 1414
 
1415
-            if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1416
-                $related_listing = geodir_get_detail_page_related_events($request);
1417
-            } else {
1418
-                $related_listing = geodir_related_posts_display($request);
1419
-            }
1415
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1416
+				$related_listing = geodir_get_detail_page_related_events($request);
1417
+			} else {
1418
+				$related_listing = geodir_related_posts_display($request);
1419
+			}
1420 1420
 
1421
-        }
1421
+		}
1422 1422
 
1423
-        $post_images = geodir_get_images($post->ID, 'thumbnail');
1424
-        $thumb_image = '';
1425
-        if (!empty($post_images)) {
1426
-            foreach ($post_images as $image) {
1427
-                $caption = (!empty($image->caption)) ? $image->caption : '';
1428
-                $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1429
-                $thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1430
-                $thumb_image .= '</a>';
1431
-            }
1432
-        }
1423
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1424
+		$thumb_image = '';
1425
+		if (!empty($post_images)) {
1426
+			foreach ($post_images as $image) {
1427
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1428
+				$thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1429
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1430
+				$thumb_image .= '</a>';
1431
+			}
1432
+		}
1433 1433
 
1434
-        $map_args = array();
1435
-        $map_args['map_canvas_name'] = 'detail_page_map_canvas';
1436
-        $map_args['width'] = '600';
1437
-        $map_args['height'] = '300';
1438
-        if ($post->post_mapzoom) {
1439
-            $map_args['zoom'] = '' . $post->post_mapzoom . '';
1440
-        }
1441
-        $map_args['autozoom'] = false;
1442
-        $map_args['scrollwheel'] = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1443
-        $map_args['child_collapse'] = '0';
1444
-        $map_args['enable_cat_filters'] = false;
1445
-        $map_args['enable_text_search'] = false;
1446
-        $map_args['enable_post_type_filters'] = false;
1447
-        $map_args['enable_location_filters'] = false;
1448
-        $map_args['enable_jason_on_load'] = true;
1449
-        $map_args['enable_map_direction'] = true;
1450
-        $map_args['map_class_name'] = 'geodir-map-detail-page';
1451
-        $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1452
-    } else if (geodir_is_page('preview')) {
1453
-        $video = isset($post->geodir_video) ? $post->geodir_video : '';
1454
-        $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1455
-
1456
-        if (isset($post->post_images))
1457
-            $post->post_images = trim($post->post_images, ",");
1458
-
1459
-        if (isset($post->post_images) && !empty($post->post_images))
1460
-            $post_images = explode(",", $post->post_images);
1461
-
1462
-        $thumb_image = '';
1463
-        if (!empty($post_images)) {
1464
-            foreach ($post_images as $image) {
1465
-                if ($image != '') {
1466
-                    $thumb_image .= '<a href="' . $image . '">';
1467
-                    $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1468
-                    $thumb_image .= '</a>';
1469
-                }
1470
-            }
1471
-        }
1434
+		$map_args = array();
1435
+		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1436
+		$map_args['width'] = '600';
1437
+		$map_args['height'] = '300';
1438
+		if ($post->post_mapzoom) {
1439
+			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1440
+		}
1441
+		$map_args['autozoom'] = false;
1442
+		$map_args['scrollwheel'] = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1443
+		$map_args['child_collapse'] = '0';
1444
+		$map_args['enable_cat_filters'] = false;
1445
+		$map_args['enable_text_search'] = false;
1446
+		$map_args['enable_post_type_filters'] = false;
1447
+		$map_args['enable_location_filters'] = false;
1448
+		$map_args['enable_jason_on_load'] = true;
1449
+		$map_args['enable_map_direction'] = true;
1450
+		$map_args['map_class_name'] = 'geodir-map-detail-page';
1451
+		$map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1452
+	} else if (geodir_is_page('preview')) {
1453
+		$video = isset($post->geodir_video) ? $post->geodir_video : '';
1454
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1455
+
1456
+		if (isset($post->post_images))
1457
+			$post->post_images = trim($post->post_images, ",");
1458
+
1459
+		if (isset($post->post_images) && !empty($post->post_images))
1460
+			$post_images = explode(",", $post->post_images);
1461
+
1462
+		$thumb_image = '';
1463
+		if (!empty($post_images)) {
1464
+			foreach ($post_images as $image) {
1465
+				if ($image != '') {
1466
+					$thumb_image .= '<a href="' . $image . '">';
1467
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1468
+					$thumb_image .= '</a>';
1469
+				}
1470
+			}
1471
+		}
1472 1472
 
1473
-        global $map_jason;
1474
-        $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1475
-        $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1476
-        $icon_size = geodir_get_marker_size($marker_icon);
1477
-        $marker_json['w'] = $icon_size['w'];
1478
-        $marker_json['h'] = $icon_size['h'];
1479
-        $map_jason[] = json_encode($marker_json);
1480
-
1481
-        $address_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
1482
-        $address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1483
-        $mapview = isset($post->post_mapview) ? $post->post_mapview : '';
1484
-        $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1485
-        if (!$mapzoom) {
1486
-            $mapzoom = 12;
1487
-        }
1473
+		global $map_jason;
1474
+		$marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1475
+		$marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1476
+		$icon_size = geodir_get_marker_size($marker_icon);
1477
+		$marker_json['w'] = $icon_size['w'];
1478
+		$marker_json['h'] = $icon_size['h'];
1479
+		$map_jason[] = json_encode($marker_json);
1480
+
1481
+		$address_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
1482
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1483
+		$mapview = isset($post->post_mapview) ? $post->post_mapview : '';
1484
+		$mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1485
+		if (!$mapzoom) {
1486
+			$mapzoom = 12;
1487
+		}
1488 1488
 
1489
-        $map_args = array();
1490
-        $map_args['map_canvas_name'] = 'preview_map_canvas';
1491
-        $map_args['width'] = '950';
1492
-        $map_args['height'] = '300';
1493
-        $map_args['child_collapse'] = '0';
1494
-        $map_args['maptype'] = $mapview;
1495
-        $map_args['autozoom'] = false;
1496
-        $map_args['zoom'] = "$mapzoom";
1497
-        $map_args['latitude'] = $address_latitude;
1498
-        $map_args['longitude'] = $address_longitude;
1499
-        $map_args['enable_cat_filters'] = false;
1500
-        $map_args['enable_text_search'] = false;
1501
-        $map_args['enable_post_type_filters'] = false;
1502
-        $map_args['enable_location_filters'] = false;
1503
-        $map_args['enable_jason_on_load'] = true;
1504
-        $map_args['enable_map_direction'] = true;
1505
-        $map_args['map_class_name'] = 'geodir-map-preview-page';
1506
-    }
1507
-
1508
-    $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1509
-
1510
-    $active_tab = '';
1511
-    $active_tab_name = '';
1512
-    $default_tab = '';
1513
-    $default_tab_name = '';
1514
-    foreach($arr_detail_page_tabs as $tab_index => $tabs){
1515
-        if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1516
-            $active_tab = $tab_index;
1517
-            $active_tab_name = __($tabs['heading_text'], 'geodirectory');
1518
-        }
1489
+		$map_args = array();
1490
+		$map_args['map_canvas_name'] = 'preview_map_canvas';
1491
+		$map_args['width'] = '950';
1492
+		$map_args['height'] = '300';
1493
+		$map_args['child_collapse'] = '0';
1494
+		$map_args['maptype'] = $mapview;
1495
+		$map_args['autozoom'] = false;
1496
+		$map_args['zoom'] = "$mapzoom";
1497
+		$map_args['latitude'] = $address_latitude;
1498
+		$map_args['longitude'] = $address_longitude;
1499
+		$map_args['enable_cat_filters'] = false;
1500
+		$map_args['enable_text_search'] = false;
1501
+		$map_args['enable_post_type_filters'] = false;
1502
+		$map_args['enable_location_filters'] = false;
1503
+		$map_args['enable_jason_on_load'] = true;
1504
+		$map_args['enable_map_direction'] = true;
1505
+		$map_args['map_class_name'] = 'geodir-map-preview-page';
1506
+	}
1507
+
1508
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1509
+
1510
+	$active_tab = '';
1511
+	$active_tab_name = '';
1512
+	$default_tab = '';
1513
+	$default_tab_name = '';
1514
+	foreach($arr_detail_page_tabs as $tab_index => $tabs){
1515
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1516
+			$active_tab = $tab_index;
1517
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1518
+		}
1519 1519
         
1520
-        if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1521
-            $default_tab = $tab_index;
1522
-            $default_tab_name = __($tabs['heading_text'], 'geodirectory');
1523
-        }
1524
-    }
1520
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1521
+			$default_tab = $tab_index;
1522
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1523
+		}
1524
+	}
1525 1525
     
1526
-    if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
1527
-        if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1528
-            $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1529
-        }
1526
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
1527
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1528
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1529
+		}
1530 1530
         
1531
-        $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1532
-        $active_tab = $default_tab;
1533
-        $active_tab_name = $default_tab_name;
1534
-    }
1535
-    $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
1536
-    ?>
1531
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1532
+		$active_tab = $default_tab;
1533
+		$active_tab_name = $default_tab_name;
1534
+	}
1535
+	$tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
1536
+	?>
1537 1537
     <div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1538 1538
         <?php if(!$tab_list){ ?>
1539 1539
         <div id="geodir-tab-mobile-menu">
@@ -1543,166 +1543,166 @@  discard block
 block discarded – undo
1543 1543
         </div>
1544 1544
         <dl class="geodir-tab-head">
1545 1545
             <?php
1546
-            }
1547
-            /**
1548
-             * Called before the details page tab list headings, inside the `dl` tag.
1549
-             *
1550
-             * @since 1.0.0
1551
-             * @see 'geodir_after_tab_list'
1552
-             */
1553
-            do_action('geodir_before_tab_list'); ?>
1546
+			}
1547
+			/**
1548
+			 * Called before the details page tab list headings, inside the `dl` tag.
1549
+			 *
1550
+			 * @since 1.0.0
1551
+			 * @see 'geodir_after_tab_list'
1552
+			 */
1553
+			do_action('geodir_before_tab_list'); ?>
1554 1554
             <?php
1555 1555
 
1556
-            foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1557
-                if ($detail_page_tab['is_display']) {
1556
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1557
+				if ($detail_page_tab['is_display']) {
1558 1558
 
1559
-                    if(!$tab_list) {
1560
-                        ?>
1559
+					if(!$tab_list) {
1560
+						?>
1561 1561
                         <dt></dt> <!-- added to comply with validation -->
1562 1562
                         <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php } ?> ><a
1563 1563
                                 data-tab="#<?php echo $tab_index; ?>"
1564 1564
                                 data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1565 1565
                         </dd>
1566 1566
                         <?php
1567
-                    }
1568
-                    ob_start() // start tab content buffering
1569
-                    ?>
1567
+					}
1568
+					ob_start() // start tab content buffering
1569
+					?>
1570 1570
                     <li id="<?php echo $tab_index;?>Tab">
1571 1571
                         <?php if($tab_list){
1572
-                            $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />';
1573
-                            /**
1574
-                             * Filter the tab list title html.
1575
-                             *
1576
-                             * @since 1.6.1
1577
-                             * @param string $tab_title The html for the tab title.
1578
-                             * @param string $tab_index The tab index type.
1579
-                             * @param array $detail_page_tab The array of values including title text.
1580
-                             */
1581
-                            echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
1582
-                        }?>
1572
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />';
1573
+							/**
1574
+							 * Filter the tab list title html.
1575
+							 *
1576
+							 * @since 1.6.1
1577
+							 * @param string $tab_title The html for the tab title.
1578
+							 * @param string $tab_index The tab index type.
1579
+							 * @param array $detail_page_tab The array of values including title text.
1580
+							 */
1581
+							echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
1582
+						}?>
1583 1583
                         <div id="<?php echo $tab_index;?>" class="hash-offset"></div>
1584 1584
                         <?php
1585
-                        /**
1586
-                         * Called before the details tab content is output per tab.
1587
-                         *
1588
-                         * @since 1.0.0
1589
-                         * @param string $tab_index The tab name ID.
1590
-                         */
1591
-                        do_action('geodir_before_tab_content', $tab_index);
1592
-
1593
-                        /**
1594
-                         * Called before the details tab content is output per tab.
1595
-                         *
1596
-                         * Uses dynamic hook name: geodir_before_$tab_index_tab_content
1597
-                         *
1598
-                         * @since 1.0.0
1599
-                         * @todo do we need this if we have the hook above? 'geodir_before_tab_content'
1600
-                         */
1601
-                        do_action('geodir_before_' . $tab_index . '_tab_content');
1602
-                        /// write a code to generate content of each tab
1603
-                        switch ($tab_index) {
1604
-                            case 'post_profile':
1605
-                                /**
1606
-                                 * Called before the listing description content on the details page tab.
1607
-                                 *
1608
-                                 * @since 1.0.0
1609
-                                 */
1610
-                                do_action('geodir_before_description_on_listing_detail');
1611
-                                if (geodir_is_page('detail')) {
1612
-                                    the_content();
1613
-                                } else {
1614
-                                    /** This action is documented in geodirectory_template_actions.php */
1615
-                                    echo apply_filters('the_content', stripslashes($post->post_desc));
1616
-                                }
1617
-
1618
-                                /**
1619
-                                 * Called after the listing description content on the details page tab.
1620
-                                 *
1621
-                                 * @since 1.0.0
1622
-                                 */
1623
-                                do_action('geodir_after_description_on_listing_detail');
1624
-                                break;
1625
-                            case 'post_info':
1626
-                                echo $geodir_post_detail_fields;
1627
-                                break;
1628
-                            case 'post_images':
1629
-                                echo $thumb_image;
1630
-                                break;
1631
-                            case 'post_video':
1632
-                                /** This action is documented in geodirectory_template_actions.php */
1633
-                                echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1634
-                                break;
1635
-                            case 'special_offers':
1636
-                                echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1637
-
1638
-                                break;
1639
-                            case 'post_map':
1640
-                                geodir_draw_map($map_args);
1641
-                                break;
1642
-                            case 'reviews':
1643
-                                comments_template();
1644
-                                break;
1645
-                            case 'related_listing':
1646
-                                echo $related_listing;
1647
-                                break;
1648
-                            default: {
1649
-                                if ((isset($post->{$tab_index}) || (!isset($post->{$tab_index}) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1650
-                                    echo $detail_page_tab['tab_content'];
1651
-                                }
1652
-                            }
1653
-                                break;
1654
-                        }
1655
-
1656
-                        /**
1657
-                         * Called after the details tab content is output per tab.
1658
-                         *
1659
-                         * @since 1.0.0
1660
-                         */
1661
-                        do_action('geodir_after_tab_content', $tab_index);
1662
-
1663
-                        /**
1664
-                         * Called after the details tab content is output per tab.
1665
-                         *
1666
-                         * Uses dynamic hook name: geodir_after_$tab_index_tab_content
1667
-                         *
1668
-                         * @since 1.0.0
1669
-                         * @todo do we need this if we have the hook above? 'geodir_after_tab_content'
1670
-                         */
1671
-                        do_action('geodir_after_' . $tab_index . '_tab_content');
1672
-                        ?> </li>
1585
+						/**
1586
+						 * Called before the details tab content is output per tab.
1587
+						 *
1588
+						 * @since 1.0.0
1589
+						 * @param string $tab_index The tab name ID.
1590
+						 */
1591
+						do_action('geodir_before_tab_content', $tab_index);
1592
+
1593
+						/**
1594
+						 * Called before the details tab content is output per tab.
1595
+						 *
1596
+						 * Uses dynamic hook name: geodir_before_$tab_index_tab_content
1597
+						 *
1598
+						 * @since 1.0.0
1599
+						 * @todo do we need this if we have the hook above? 'geodir_before_tab_content'
1600
+						 */
1601
+						do_action('geodir_before_' . $tab_index . '_tab_content');
1602
+						/// write a code to generate content of each tab
1603
+						switch ($tab_index) {
1604
+							case 'post_profile':
1605
+								/**
1606
+								 * Called before the listing description content on the details page tab.
1607
+								 *
1608
+								 * @since 1.0.0
1609
+								 */
1610
+								do_action('geodir_before_description_on_listing_detail');
1611
+								if (geodir_is_page('detail')) {
1612
+									the_content();
1613
+								} else {
1614
+									/** This action is documented in geodirectory_template_actions.php */
1615
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1616
+								}
1617
+
1618
+								/**
1619
+								 * Called after the listing description content on the details page tab.
1620
+								 *
1621
+								 * @since 1.0.0
1622
+								 */
1623
+								do_action('geodir_after_description_on_listing_detail');
1624
+								break;
1625
+							case 'post_info':
1626
+								echo $geodir_post_detail_fields;
1627
+								break;
1628
+							case 'post_images':
1629
+								echo $thumb_image;
1630
+								break;
1631
+							case 'post_video':
1632
+								/** This action is documented in geodirectory_template_actions.php */
1633
+								echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1634
+								break;
1635
+							case 'special_offers':
1636
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1637
+
1638
+								break;
1639
+							case 'post_map':
1640
+								geodir_draw_map($map_args);
1641
+								break;
1642
+							case 'reviews':
1643
+								comments_template();
1644
+								break;
1645
+							case 'related_listing':
1646
+								echo $related_listing;
1647
+								break;
1648
+							default: {
1649
+								if ((isset($post->{$tab_index}) || (!isset($post->{$tab_index}) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1650
+									echo $detail_page_tab['tab_content'];
1651
+								}
1652
+							}
1653
+								break;
1654
+						}
1655
+
1656
+						/**
1657
+						 * Called after the details tab content is output per tab.
1658
+						 *
1659
+						 * @since 1.0.0
1660
+						 */
1661
+						do_action('geodir_after_tab_content', $tab_index);
1662
+
1663
+						/**
1664
+						 * Called after the details tab content is output per tab.
1665
+						 *
1666
+						 * Uses dynamic hook name: geodir_after_$tab_index_tab_content
1667
+						 *
1668
+						 * @since 1.0.0
1669
+						 * @todo do we need this if we have the hook above? 'geodir_after_tab_content'
1670
+						 */
1671
+						do_action('geodir_after_' . $tab_index . '_tab_content');
1672
+						?> </li>
1673 1673
                     <?php
1674
-                    /**
1675
-                     * Filter the current tab content.
1676
-                     *
1677
-                     * @since 1.0.0
1678
-                     */
1679
-                    $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
1680
-                } // end of if for is_display
1681
-            }// end of foreach
1682
-
1683
-            /**
1684
-             * Called after the details page tab list headings, inside the `dl` tag.
1685
-             *
1686
-             * @since 1.0.0
1687
-             * @see 'geodir_before_tab_list'
1688
-             */
1689
-            do_action('geodir_after_tab_list');
1690
-            ?>
1674
+					/**
1675
+					 * Filter the current tab content.
1676
+					 *
1677
+					 * @since 1.0.0
1678
+					 */
1679
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
1680
+				} // end of if for is_display
1681
+			}// end of foreach
1682
+
1683
+			/**
1684
+			 * Called after the details page tab list headings, inside the `dl` tag.
1685
+			 *
1686
+			 * @since 1.0.0
1687
+			 * @see 'geodir_before_tab_list'
1688
+			 */
1689
+			do_action('geodir_after_tab_list');
1690
+			?>
1691 1691
             <?php if(!$tab_list){?></dl><?php }?>
1692 1692
         <ul class="geodir-tabs-content entry-content <?php if($tab_list){?>geodir-tabs-list<?php }?>" style="position:relative;">
1693 1693
             <?php
1694
-            foreach ($arr_detail_page_tabs as $detail_page_tab) {
1695
-                if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1696
-                    echo $detail_page_tab['tab_content'];
1697
-                }// end of if
1698
-            }// end of foreach
1699
-
1700
-            /**
1701
-             * Called after all the tab content is output in `li` tags, called before the closing `ul` tag.
1702
-             *
1703
-             * @since 1.0.0
1704
-             */
1705
-            do_action('geodir_add_tab_content'); ?>
1694
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1695
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1696
+					echo $detail_page_tab['tab_content'];
1697
+				}// end of if
1698
+			}// end of foreach
1699
+
1700
+			/**
1701
+			 * Called after all the tab content is output in `li` tags, called before the closing `ul` tag.
1702
+			 *
1703
+			 * @since 1.0.0
1704
+			 */
1705
+			do_action('geodir_add_tab_content'); ?>
1706 1706
         </ul>
1707 1707
         <!--gd-tabs-content ul end-->
1708 1708
     </div>
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
         });
1726 1726
     </script>
1727 1727
     <?php
1728
-    }
1728
+	}
1729 1729
 }
1730 1730
 
1731 1731
 /**
@@ -1738,127 +1738,127 @@  discard block
 block discarded – undo
1738 1738
  */
1739 1739
 function geodir_exif($file)
1740 1740
 {
1741
-    if (empty($file) || !is_array($file)) {
1742
-        return $file;
1743
-    }
1741
+	if (empty($file) || !is_array($file)) {
1742
+		return $file;
1743
+	}
1744 1744
     
1745
-    $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1746
-    if (!($file_path && file_exists($file_path))) {
1747
-        return $file;
1748
-    }
1749
-    $file['file'] = $file_path;
1745
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1746
+	if (!($file_path && file_exists($file_path))) {
1747
+		return $file;
1748
+	}
1749
+	$file['file'] = $file_path;
1750 1750
     
1751
-    if (!file_is_valid_image($file_path)) {
1752
-        return $file; // Bail if file is not an image.
1753
-    }
1751
+	if (!file_is_valid_image($file_path)) {
1752
+		return $file; // Bail if file is not an image.
1753
+	}
1754 1754
     
1755
-    if (!function_exists('wp_get_image_editor')) {
1756
-        return $file;
1757
-    }
1755
+	if (!function_exists('wp_get_image_editor')) {
1756
+		return $file;
1757
+	}
1758 1758
    
1759
-    $mime_type = $file['type'];
1760
-    $exif = array();
1761
-    if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1762
-        try {
1763
-            $exif = exif_read_data($file_path);
1764
-        } catch(Exception $e) {
1765
-            $exif = array();
1766
-        }
1767
-    }
1759
+	$mime_type = $file['type'];
1760
+	$exif = array();
1761
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1762
+		try {
1763
+			$exif = exif_read_data($file_path);
1764
+		} catch(Exception $e) {
1765
+			$exif = array();
1766
+		}
1767
+	}
1768 1768
     
1769
-    $rotate = false;
1770
-    $flip = false;
1771
-    $modify = false;
1772
-    $orientation = 0;
1773
-    if (!empty($exif) && isset($exif['Orientation'])) {
1774
-        switch ((int)$exif['Orientation']) {
1775
-            case 1:
1776
-                // do nothing
1777
-                break;
1778
-            case 2:
1779
-                $flip = array(false, true);
1780
-                $modify = true;
1781
-                break;
1782
-            case 3:
1783
-                $orientation = -180;
1784
-                $rotate = true;
1785
-                $modify = true;
1786
-                break;
1787
-            case 4:
1788
-                $flip = array(true, false);
1789
-                $modify = true;
1790
-                break;
1791
-            case 5:
1792
-                $orientation = -90;
1793
-                $rotate = true;
1794
-                $flip = array(false, true);
1795
-                $modify = true;
1796
-                break;
1797
-            case 6:
1798
-                $orientation = -90;
1799
-                $rotate = true;
1800
-                $modify = true;
1801
-                break;
1802
-            case 7:
1803
-                $orientation = -270;
1804
-                $rotate = true;
1805
-                $flip = array(false, true);
1806
-                $modify = true;
1807
-                break;
1808
-            case 8:
1809
-            case 9:
1810
-                $orientation = -270;
1811
-                $rotate = true;
1812
-                $modify = true;
1813
-                break;
1814
-            default:
1815
-                $orientation = 0;
1816
-                $rotate = true;
1817
-                $modify = true;
1818
-                break;
1819
-        }
1820
-    }
1769
+	$rotate = false;
1770
+	$flip = false;
1771
+	$modify = false;
1772
+	$orientation = 0;
1773
+	if (!empty($exif) && isset($exif['Orientation'])) {
1774
+		switch ((int)$exif['Orientation']) {
1775
+			case 1:
1776
+				// do nothing
1777
+				break;
1778
+			case 2:
1779
+				$flip = array(false, true);
1780
+				$modify = true;
1781
+				break;
1782
+			case 3:
1783
+				$orientation = -180;
1784
+				$rotate = true;
1785
+				$modify = true;
1786
+				break;
1787
+			case 4:
1788
+				$flip = array(true, false);
1789
+				$modify = true;
1790
+				break;
1791
+			case 5:
1792
+				$orientation = -90;
1793
+				$rotate = true;
1794
+				$flip = array(false, true);
1795
+				$modify = true;
1796
+				break;
1797
+			case 6:
1798
+				$orientation = -90;
1799
+				$rotate = true;
1800
+				$modify = true;
1801
+				break;
1802
+			case 7:
1803
+				$orientation = -270;
1804
+				$rotate = true;
1805
+				$flip = array(false, true);
1806
+				$modify = true;
1807
+				break;
1808
+			case 8:
1809
+			case 9:
1810
+				$orientation = -270;
1811
+				$rotate = true;
1812
+				$modify = true;
1813
+				break;
1814
+			default:
1815
+				$orientation = 0;
1816
+				$rotate = true;
1817
+				$modify = true;
1818
+				break;
1819
+		}
1820
+	}
1821 1821
     
1822
-    $quality = null;
1823
-    /**
1824
-     * Filter the image quality.
1825
-     *
1826
-     * @since 1.5.7
1827
-     * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1828
-     * @param string $quality Image mime type.
1829
-     */
1830
-    $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1831
-    if ($quality !== null) {
1832
-        $modify = true;
1833
-    }
1834
-
1835
-    if (!$modify) {
1836
-        return $file; // no change
1837
-    }
1838
-
1839
-    $image = wp_get_image_editor($file_path);
1840
-    if (!is_wp_error($image)) {
1841
-        if ($rotate) {
1842
-            $image->rotate($orientation);
1843
-        }
1822
+	$quality = null;
1823
+	/**
1824
+	 * Filter the image quality.
1825
+	 *
1826
+	 * @since 1.5.7
1827
+	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1828
+	 * @param string $quality Image mime type.
1829
+	 */
1830
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1831
+	if ($quality !== null) {
1832
+		$modify = true;
1833
+	}
1834
+
1835
+	if (!$modify) {
1836
+		return $file; // no change
1837
+	}
1838
+
1839
+	$image = wp_get_image_editor($file_path);
1840
+	if (!is_wp_error($image)) {
1841
+		if ($rotate) {
1842
+			$image->rotate($orientation);
1843
+		}
1844 1844
         
1845
-        if (!empty($flip)) {
1846
-            $image->flip($flip[0], $flip[1]);
1847
-        }
1845
+		if (!empty($flip)) {
1846
+			$image->flip($flip[0], $flip[1]);
1847
+		}
1848 1848
         
1849
-        if ($quality !== null) {
1850
-            $image->set_quality((int)$quality);
1851
-        }
1849
+		if ($quality !== null) {
1850
+			$image->set_quality((int)$quality);
1851
+		}
1852 1852
         
1853
-       $result = $image->save($file_path);
1854
-       if (!is_wp_error($result)) {
1855
-           $file['file'] = $result['path'];
1856
-           $file['tmp_name'] = $result['path'];
1857
-       }
1858
-    }
1853
+	   $result = $image->save($file_path);
1854
+	   if (!is_wp_error($result)) {
1855
+		   $file['file'] = $result['path'];
1856
+		   $file['tmp_name'] = $result['path'];
1857
+	   }
1858
+	}
1859 1859
     
1860
-    // The image orientation is fixed, pass it back for further processing
1861
-    return $file;
1860
+	// The image orientation is fixed, pass it back for further processing
1861
+	return $file;
1862 1862
 }
1863 1863
 
1864 1864
 /**
@@ -1877,138 +1877,138 @@  discard block
 block discarded – undo
1877 1877
  * @return string Returns the recent reviews html.
1878 1878
  */
1879 1879
 function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1880
-    global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1881
-    $tablecomments = $wpdb->comments;
1882
-    $tableposts = $wpdb->posts;
1883
-
1884
-    $comments_echo = '';
1885
-    $city_filter = '';
1886
-    $region_filter = '';
1887
-    $country_filter = '';
1888
-
1889
-    if ($gd_session->get('gd_multi_location')) {
1890
-        if ($gd_ses_country = $gd_session->get('gd_country')) {
1891
-            $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1892
-        }
1880
+	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1881
+	$tablecomments = $wpdb->comments;
1882
+	$tableposts = $wpdb->posts;
1883
+
1884
+	$comments_echo = '';
1885
+	$city_filter = '';
1886
+	$region_filter = '';
1887
+	$country_filter = '';
1888
+
1889
+	if ($gd_session->get('gd_multi_location')) {
1890
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1891
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1892
+		}
1893 1893
 
1894
-        if ($gd_ses_region = $gd_session->get('gd_region')) {
1895
-            $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1896
-        }
1894
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1895
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1896
+		}
1897 1897
 
1898
-        if ($gd_ses_city = $gd_session->get('gd_city')) {
1899
-            $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1900
-        }
1901
-    }
1898
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1899
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1900
+		}
1901
+	}
1902 1902
 	
1903
-    $review_table = GEODIR_REVIEW_TABLE;
1904
-    $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1905
-
1906
-    $comments = $wpdb->get_results($request);
1907
-
1908
-    foreach ($comments as $comment) {
1909
-        // Set the extra comment info needed.
1910
-        $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1911
-        //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1912
-        $comment->comment_content = $comment_extra->comment_content;
1913
-        $comment->comment_author = $comment_extra->comment_author;
1914
-        $comment->comment_author_email = $comment_extra->comment_author_email;
1915
-
1916
-        $comment_id = '';
1917
-        $comment_id = $comment->comment_ID;
1918
-        $comment_content = strip_tags($comment->comment_content);
1919
-
1920
-        $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
1921
-
1922
-        $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
1923
-        $comment_author_email = $comment->comment_author_email;
1924
-        $comment_post_ID = $comment->post_id;
1925
-
1926
-        $na = true;
1927
-        if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
1928
-            $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
1929
-            if ($comment_post_ID == $comment_post_ID2) {
1930
-            } else {
1931
-                $na = false;
1932
-            }
1933
-        }
1903
+	$review_table = GEODIR_REVIEW_TABLE;
1904
+	$request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1905
+
1906
+	$comments = $wpdb->get_results($request);
1907
+
1908
+	foreach ($comments as $comment) {
1909
+		// Set the extra comment info needed.
1910
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1911
+		//echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1912
+		$comment->comment_content = $comment_extra->comment_content;
1913
+		$comment->comment_author = $comment_extra->comment_author;
1914
+		$comment->comment_author_email = $comment_extra->comment_author_email;
1915
+
1916
+		$comment_id = '';
1917
+		$comment_id = $comment->comment_ID;
1918
+		$comment_content = strip_tags($comment->comment_content);
1919
+
1920
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
1921
+
1922
+		$permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
1923
+		$comment_author_email = $comment->comment_author_email;
1924
+		$comment_post_ID = $comment->post_id;
1925
+
1926
+		$na = true;
1927
+		if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
1928
+			$comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
1929
+			if ($comment_post_ID == $comment_post_ID2) {
1930
+			} else {
1931
+				$na = false;
1932
+			}
1933
+		}
1934 1934
 
1935
-        $post_title = get_the_title($comment_post_ID);
1936
-        $permalink = get_permalink($comment_post_ID);
1937
-        $comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
1938
-        $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
1935
+		$post_title = get_the_title($comment_post_ID);
1936
+		$permalink = get_permalink($comment_post_ID);
1937
+		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
1938
+		$read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
1939 1939
 
1940
-        $comment_content_length = strlen($comment_content);
1941
-        if ($comment_content_length > $comment_lenth) {
1942
-            $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more;
1943
-        } else {
1944
-            $comment_excerpt = $comment_content;
1945
-        }
1940
+		$comment_content_length = strlen($comment_content);
1941
+		if ($comment_content_length > $comment_lenth) {
1942
+			$comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more;
1943
+		} else {
1944
+			$comment_excerpt = $comment_content;
1945
+		}
1946 1946
 
1947
-        if ($comment->user_id) {
1948
-            $user_profile_url = get_author_posts_url($comment->user_id);
1949
-        } else {
1950
-            $user_profile_url = '';
1951
-        }
1947
+		if ($comment->user_id) {
1948
+			$user_profile_url = get_author_posts_url($comment->user_id);
1949
+		} else {
1950
+			$user_profile_url = '';
1951
+		}
1952 1952
 
1953
-        if ($comment_id && $na) {
1954
-            $comments_echo .= '<li class="clearfix">';
1955
-            $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
1956
-            if (function_exists('get_avatar')) {
1957
-                if (!isset($comment->comment_type)) {
1958
-                    if ($user_profile_url) {
1959
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1960
-                    }
1961
-                    $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1962
-                    if ($user_profile_url) {
1963
-                        $comments_echo .= '</a>';
1964
-                    }
1965
-                } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
1966
-                    if ($user_profile_url) {
1967
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1968
-                    }
1969
-                    $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1970
-                }
1971
-            } elseif (function_exists('gravatar')) {
1972
-                if ($user_profile_url) {
1973
-                    $comments_echo .= '<a href="' . $user_profile_url . '">';
1974
-                }
1975
-                $comments_echo .= "<img src=\"";
1976
-                if ('' == $comment->comment_type) {
1977
-                    $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1978
-                    if ($user_profile_url) {
1979
-                        $comments_echo .= '</a>';
1980
-                    }
1981
-                } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
1982
-                    if ($user_profile_url) {
1983
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1984
-                    }
1985
-                    $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1986
-                    if ($user_profile_url) {
1987
-                        $comments_echo .= '</a>';
1988
-                    }
1989
-                }
1990
-                $comments_echo .= "\" alt=\"\" class=\"avatar\" />";
1991
-            }
1953
+		if ($comment_id && $na) {
1954
+			$comments_echo .= '<li class="clearfix">';
1955
+			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
1956
+			if (function_exists('get_avatar')) {
1957
+				if (!isset($comment->comment_type)) {
1958
+					if ($user_profile_url) {
1959
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1960
+					}
1961
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1962
+					if ($user_profile_url) {
1963
+						$comments_echo .= '</a>';
1964
+					}
1965
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
1966
+					if ($user_profile_url) {
1967
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1968
+					}
1969
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1970
+				}
1971
+			} elseif (function_exists('gravatar')) {
1972
+				if ($user_profile_url) {
1973
+					$comments_echo .= '<a href="' . $user_profile_url . '">';
1974
+				}
1975
+				$comments_echo .= "<img src=\"";
1976
+				if ('' == $comment->comment_type) {
1977
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1978
+					if ($user_profile_url) {
1979
+						$comments_echo .= '</a>';
1980
+					}
1981
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
1982
+					if ($user_profile_url) {
1983
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1984
+					}
1985
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1986
+					if ($user_profile_url) {
1987
+						$comments_echo .= '</a>';
1988
+					}
1989
+				}
1990
+				$comments_echo .= "\" alt=\"\" class=\"avatar\" />";
1991
+			}
1992 1992
 
1993
-            $comments_echo .= "</span>\n";
1994
-
1995
-            $comments_echo .= '<span class="geodir_reviewer_content">';
1996
-            if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1997
-            $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1998
-            if($comment->user_id){$comments_echo .= '</a>';}
1999
-            $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
2000
-            $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2001
-            $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2002
-            $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2003
-            //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2004
-            $comments_echo .= '</p>';
2005
-
2006
-            $comments_echo .= "</span>\n";
2007
-            $comments_echo .= '</li>';
2008
-        }
2009
-    }
1993
+			$comments_echo .= "</span>\n";
1994
+
1995
+			$comments_echo .= '<span class="geodir_reviewer_content">';
1996
+			if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1997
+			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1998
+			if($comment->user_id){$comments_echo .= '</a>';}
1999
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
2000
+			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2001
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2002
+			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2003
+			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2004
+			$comments_echo .= '</p>';
2005
+
2006
+			$comments_echo .= "</span>\n";
2007
+			$comments_echo .= '</li>';
2008
+		}
2009
+	}
2010 2010
 
2011
-    return $comments_echo;
2011
+	return $comments_echo;
2012 2012
 }
2013 2013
 
2014 2014
 /**
@@ -2020,29 +2020,29 @@  discard block
 block discarded – undo
2020 2020
  */
2021 2021
 function geodir_home_map_cats_key_value_array()
2022 2022
 {
2023
-    $post_types = geodir_get_posttypes('object');
2024
-
2025
-    $return = array();
2026
-    if (!empty($post_types)) {
2027
-        foreach ($post_types as $key => $post_type) {
2028
-            $cpt_name = __($post_type->labels->singular_name, 'geodirectory');
2029
-            $post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
2030
-            $taxonomies = geodir_get_taxonomies($key);
2031
-            $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
2032
-            $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
2033
-
2034
-            if (!empty($cat_terms)) {
2035
-                $return['optgroup_start-' . $key] = $post_type_name;
2036
-
2037
-                foreach ($cat_terms as $cat_term) {
2038
-                    $return[$key . '_' . $cat_term->term_id] = $cat_term->name;
2039
-                }
2023
+	$post_types = geodir_get_posttypes('object');
2040 2024
 
2041
-                $return['optgroup_end-' . $key] = $post_type_name;
2042
-            }
2043
-        }
2044
-    }
2045
-    return $return;
2025
+	$return = array();
2026
+	if (!empty($post_types)) {
2027
+		foreach ($post_types as $key => $post_type) {
2028
+			$cpt_name = __($post_type->labels->singular_name, 'geodirectory');
2029
+			$post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
2030
+			$taxonomies = geodir_get_taxonomies($key);
2031
+			$cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
2032
+			$cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
2033
+
2034
+			if (!empty($cat_terms)) {
2035
+				$return['optgroup_start-' . $key] = $post_type_name;
2036
+
2037
+				foreach ($cat_terms as $cat_term) {
2038
+					$return[$key . '_' . $cat_term->term_id] = $cat_term->name;
2039
+				}
2040
+
2041
+				$return['optgroup_end-' . $key] = $post_type_name;
2042
+			}
2043
+		}
2044
+	}
2045
+	return $return;
2046 2046
 }
2047 2047
 
2048 2048
 /**
@@ -2054,7 +2054,7 @@  discard block
 block discarded – undo
2054 2054
  */
2055 2055
 function geodir_twitter_tweet_button()
2056 2056
 {
2057
-    ?>
2057
+	?>
2058 2058
     <a href="http://twitter.com/share"
2059 2059
        class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2060 2060
     <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
@@ -2071,11 +2071,11 @@  discard block
 block discarded – undo
2071 2071
  * @global object $post The current post object.
2072 2072
  */
2073 2073
 function geodir_fb_like_button() {
2074
-    global $post;
2075
-    ?>
2074
+	global $post;
2075
+	?>
2076 2076
     <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2077
-        echo 'allowtransparency="true"';
2078
-    } ?> class="facebook"
2077
+		echo 'allowtransparency="true"';
2078
+	} ?> class="facebook"
2079 2079
          src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2080 2080
          style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2081 2081
     <?php
@@ -2090,7 +2090,7 @@  discard block
 block discarded – undo
2090 2090
  * @package GeoDirectory
2091 2091
  */
2092 2092
 function geodir_google_plus_button() {
2093
-    ?>
2093
+	?>
2094 2094
     <div id="plusone-div" class="g-plusone" data-size="medium"></div>
2095 2095
     <script type="text/javascript">
2096 2096
         (function () {
@@ -2115,8 +2115,8 @@  discard block
 block discarded – undo
2115 2115
  * @global object $post The current post object.
2116 2116
  */
2117 2117
 function geodir_share_this_button_code() {
2118
-    global $post;
2119
-    ?>
2118
+	global $post;
2119
+	?>
2120 2120
     <div class="addthis_toolbox addthis_default_style">
2121 2121
         <span id='st_sharethis'></span>
2122 2122
         <script type="text/javascript">var switchTo5x = false;</script>
@@ -2141,8 +2141,8 @@  discard block
 block discarded – undo
2141 2141
 }
2142 2142
 
2143 2143
 function geodir_listing_bounce_map_pin_on_hover() {
2144
-    if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
2145
-        ?>
2144
+	if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
2145
+		?>
2146 2146
         <script>
2147 2147
             jQuery(function ($) {
2148 2148
                 if (typeof(animate_marker) == 'function') {
@@ -2159,27 +2159,27 @@  discard block
 block discarded – undo
2159 2159
             });
2160 2160
         </script>
2161 2161
         <?php
2162
-    }
2162
+	}
2163 2163
 }
2164 2164
 add_action('geodir_after_listing_listview','geodir_listing_bounce_map_pin_on_hover',10);
2165 2165
 
2166 2166
 add_action('geodir_after_favorite_html','geodir_output_favourite_html_listings',1,1);
2167 2167
 function geodir_output_favourite_html_listings( $post_id){
2168
-    geodir_favourite_html('', $post_id);
2168
+	geodir_favourite_html('', $post_id);
2169 2169
 }
2170 2170
 
2171 2171
 add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2172 2172
 function geodir_output_pinpoint_html_listings( $post_id, $post){
2173
-    global $wp_query;
2173
+	global $wp_query;
2174 2174
 
2175
-    $show_pin_point = $wp_query->is_main_query();
2175
+	$show_pin_point = $wp_query->is_main_query();
2176 2176
     
2177
-    if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2178
-        $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2179
-        $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2180
-        ?>
2177
+	if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2178
+		$term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2179
+		$marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2180
+		?>
2181 2181
         <span class="geodir-pinpoint" style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2182 2182
         <a class="geodir-pinpoint-link" href="javascript:void(0)" onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')" onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')" onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2183 2183
         <?php
2184
-    }
2184
+	}
2185 2185
 }
2186 2186
\ No newline at end of file
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_field_html.php 3 patches
Indentation   +272 added lines, -272 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
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
26 26
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 $field_admin_title = '';
30 30
 if (isset($field_info->admin_title))
31
-    $field_admin_title = $field_info->admin_title;
31
+	$field_admin_title = $field_info->admin_title;
32 32
 
33 33
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
34 34
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
52 52
         <?php
53 53
 
54
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
55
-        ?>
54
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
55
+		?>
56 56
 
57 57
         <?php if ($default): ?>
58 58
             <div title="<?php _e('Drag and drop to sort', 'geodirectory'); ?>" class="handlediv move"></div>
@@ -61,35 +61,35 @@  discard block
 block discarded – undo
61 61
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
62 62
                  class="handlediv close"></div>
63 63
         <?php endif;
64
-        if ($field_type == 'fieldset') {
65
-            ?>
64
+		if ($field_type == 'fieldset') {
65
+			?>
66 66
 
67 67
             <b style="cursor:pointer;"
68 68
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
69 69
         <?php
70
-        } else {
71
-            ?>
70
+		} else {
71
+			?>
72 72
             <b style="cursor:pointer;"
73 73
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
74 74
         <?php
75
-        }
76
-        ?>
75
+		}
76
+		?>
77 77
     </div>
78 78
 
79 79
     <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
80 80
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
81 81
          style="display:<?php if ($field_ins_upd == 'submit') {
82
-             echo 'block;';
83
-         } else {
84
-             echo 'none;';
85
-         } ?>">
82
+			 echo 'block;';
83
+		 } else {
84
+			 echo 'none;';
85
+		 } ?>">
86 86
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
87 87
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
88 88
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
89 89
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
90 90
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
91
-            echo $field_info->data_type;
92
-        } ?>"/>
91
+			echo $field_info->data_type;
92
+		} ?>"/>
93 93
         <input type="hidden" name="is_active" id="is_active" value="1"/>
94 94
 
95 95
         <input type="hidden" name="is_default" value="<?php echo $field_info->is_default;?>" /><?php // show in sidebar value?>
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
             <?php if ($field_type != 'text' || $default) { ?>
102 102
 
103 103
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
104
-                    echo esc_attr($field_info->data_type);
105
-                } ?>"/>
104
+					echo esc_attr($field_info->data_type);
105
+				} ?>"/>
106 106
 
107 107
             <?php } else { ?>
108 108
 
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
                                 onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
115 115
                             <option
116 116
                                 value="XVARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
117
-                                echo 'selected="selected"';
118
-                            } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
117
+								echo 'selected="selected"';
118
+							} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
119 119
                             <option
120 120
                                 value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
121
-                                echo 'selected="selected"';
122
-                            } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
121
+								echo 'selected="selected"';
122
+							} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
123 123
                             <option
124 124
                                 value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
125
-                                echo 'selected="selected"';
126
-                            } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
125
+								echo 'selected="selected"';
126
+							} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
127 127
                         </select>
128 128
                         <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
129 129
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
                         <select name="decimal_point" id="decimal_point">
137 137
                             <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
138 138
                             <?php for ($i = 1; $i <= 10; $i++) {
139
-                                $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
140
-                                $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
139
+								$decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
140
+								$selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
141 141
                                 <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
142 142
                             <?php } ?>
143 143
                         </select>
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
                 <div class="gd-cf-input-wrap">
159 159
                     <input type="text" name="admin_title" id="admin_title"
160 160
                            value="<?php if (isset($field_info->admin_title)) {
161
-                               echo esc_attr($field_info->admin_title);
162
-                           } ?>"/>
161
+							   echo esc_attr($field_info->admin_title);
162
+						   } ?>"/>
163 163
                 </div>
164 164
             </li>
165 165
             <li>
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
                 <div class="gd-cf-input-wrap">
172 172
                     <input type="text" name="site_title" id="site_title"
173 173
                            value="<?php if (isset($field_info->site_title)) {
174
-                               echo esc_attr($field_info->site_title);
175
-                           } ?>"/>
174
+							   echo esc_attr($field_info->site_title);
175
+						   } ?>"/>
176 176
                 </div>
177 177
             </li>
178 178
             <li>
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
                 <div class="gd-cf-input-wrap">
185 185
                     <input type="text" name="admin_desc" id="admin_desc"
186 186
                            value="<?php if (isset($field_info->admin_desc)) {
187
-                               echo esc_attr($field_info->admin_desc);
188
-                           } ?>"/>
187
+							   echo esc_attr($field_info->admin_desc);
188
+						   } ?>"/>
189 189
                 </div>
190 190
             </li>
191 191
             <?php if ($field_type != 'fieldset' && $field_type != 'taxonomy') {
192
-                ?>
192
+				?>
193 193
 
194 194
                 <li>
195 195
                     <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');?>
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
                     <div class="gd-cf-input-wrap">
201 201
                         <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');?>"
202 202
                                value="<?php if (isset($field_info->htmlvar_name)) {
203
-                                   echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1);
204
-                               }?>" <?php if ($default) {
205
-                            echo 'readonly="readonly"';
206
-                        }?> />
203
+								   echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1);
204
+							   }?>" <?php if ($default) {
205
+							echo 'readonly="readonly"';
206
+						}?> />
207 207
                     </div>
208 208
                 </li>
209 209
             <?php } ?>
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
                 </label>
218 218
                 <div class="gd-cf-input-wrap"><input type="text" name="clabels" id="clabels"
219 219
                                         value="<?php if (isset($field_info->clabels)) {
220
-                                            echo esc_attr($field_info->clabels);
221
-                                        } ?>"/>
220
+											echo esc_attr($field_info->clabels);
221
+										} ?>"/>
222 222
                 </div>
223 223
             </li>
224 224
 
@@ -232,20 +232,20 @@  discard block
 block discarded – undo
232 232
 
233 233
                     <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
234 234
                         <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
235
-                            echo 'checked';
236
-                        } ?>/>
235
+							echo 'checked';
236
+						} ?>/>
237 237
                     <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
238 238
 
239 239
                     <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
240 240
                         <?php if ((isset($field_info->is_active) && $field_info->is_active == '0') || !isset($field_info->is_active)) {
241
-                            echo 'checked';
242
-                        } ?>/>
241
+							echo 'checked';
242
+						} ?>/>
243 243
                     <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
244 244
 
245 245
                 </div>
246 246
             </li>
247 247
             <?php if (!$default) { /* field for admin use only */
248
-                $for_admin_use = isset($field_info->for_admin_use) && $field_info->for_admin_use == '1' ? true : false; ?>
248
+				$for_admin_use = isset($field_info->for_admin_use) && $field_info->for_admin_use == '1' ? true : false; ?>
249 249
                 <li>
250 250
                     <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'); ?>
251 251
                         <div class="gdcf-tooltip">
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 
257 257
                         <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
258 258
                             <?php if (isset($for_admin_use) && $for_admin_use == '1') {
259
-                                echo 'checked';
260
-                            } ?>/>
259
+								echo 'checked';
260
+							} ?>/>
261 261
                         <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
262 262
 
263 263
                         <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
264 264
                             <?php if ((isset($for_admin_use) && $for_admin_use == '0') || !isset($for_admin_use)) {
265
-                                echo 'checked';
266
-                            } ?>/>
265
+								echo 'checked';
266
+							} ?>/>
267 267
                         <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
268 268
 
269 269
                     </div>
@@ -279,14 +279,14 @@  discard block
 block discarded – undo
279 279
 				<label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
280 280
                     <div class="gdcf-tooltip">
281 281
                         <?php
282
-                        if ($field_type == 'checkbox') {
283
-                            _e('Should the checkbox be checked by default?', 'geodirectory');
284
-                        } else if ($field_type == 'email') {
285
-                            _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
286
-                        } else {
287
-                            _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
288
-                        }
289
-                        ?>
282
+						if ($field_type == 'checkbox') {
283
+							_e('Should the checkbox be checked by default?', 'geodirectory');
284
+						} else if ($field_type == 'email') {
285
+							_e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
286
+						} else {
287
+							_e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
288
+						}
289
+						?>
290 290
                     </div>
291 291
                 </label>
292 292
 				<div class="gd-cf-input-wrap">
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
                 <label for="sort_order"><?php _e('Display order :', 'geodirectory'); ?></label>
308 308
                 <div class="gd-cf-input-wrap"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
309 309
                                         value="<?php if (isset($field_info->sort_order)) {
310
-                                            echo esc_attr($field_info->sort_order);
311
-                                        } ?>"/>
310
+											echo esc_attr($field_info->sort_order);
311
+										} ?>"/>
312 312
                     <br/>
313 313
                     <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
314 314
                 </div>
@@ -324,41 +324,41 @@  discard block
 block discarded – undo
324 324
 
325 325
                     <?php
326 326
 
327
-                    /*
327
+					/*
328 328
                      * We wrap the key values in [] so we can search the DB easier with a LIKE query.
329 329
                      */
330
-                    $show_in_locations = array(
331
-                        "[detail]" => __("Details page sidebar", 'geodirectory'),
332
-                        "[moreinfo]" => __("More info tab", 'geodirectory'),
333
-                        "[listing]" => __("Listings page", 'geodirectory'),
334
-                        "[owntab]" => __("Details page own tab", 'geodirectory'),
335
-                        "[mapbubble]" => __("Map bubble", 'geodirectory'),
336
-                    );
337
-
338
-                    /**
339
-                     * Filter the locations array for where to display custom fields.
340
-                     *
341
-                     * @since 1.6.6
342
-                     * @param array $show_in_locations The array of locations and descriptions.
343
-                     * @param object $field_info The field being displayed info.
344
-                     */
345
-                    $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info);
346
-
347
-
348
-                    // remove some locations for some field types
349
-
350
-                    // don't show new tab option for some types
351
-
352
-                    if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
353
-                    }else{
354
-                        unset($show_in_locations['[owntab]']);
355
-                    }
330
+					$show_in_locations = array(
331
+						"[detail]" => __("Details page sidebar", 'geodirectory'),
332
+						"[moreinfo]" => __("More info tab", 'geodirectory'),
333
+						"[listing]" => __("Listings page", 'geodirectory'),
334
+						"[owntab]" => __("Details page own tab", 'geodirectory'),
335
+						"[mapbubble]" => __("Map bubble", 'geodirectory'),
336
+					);
337
+
338
+					/**
339
+					 * Filter the locations array for where to display custom fields.
340
+					 *
341
+					 * @since 1.6.6
342
+					 * @param array $show_in_locations The array of locations and descriptions.
343
+					 * @param object $field_info The field being displayed info.
344
+					 */
345
+					$show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info);
346
+
347
+
348
+					// remove some locations for some field types
349
+
350
+					// don't show new tab option for some types
351
+
352
+					if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
353
+					}else{
354
+						unset($show_in_locations['[owntab]']);
355
+					}
356 356
 
357
-                    if(!$display_on_listing){
358
-                        unset($show_in_locations['[listings]']);
359
-                    }
357
+					if(!$display_on_listing){
358
+						unset($show_in_locations['[listings]']);
359
+					}
360 360
 
361
-                    ?>
361
+					?>
362 362
 
363 363
                     <select multiple="multiple" name="show_in[]"
364 364
                             id="show_in"
@@ -368,20 +368,20 @@  discard block
 block discarded – undo
368 368
                             option-ajaxchosen="false">
369 369
                         <?php
370 370
 
371
-                        $show_in_values = explode(',',$field_info->show_in);
371
+						$show_in_values = explode(',',$field_info->show_in);
372 372
 
373
-                        foreach( $show_in_locations as $key => $val){
374
-                            $selected = '';
373
+						foreach( $show_in_locations as $key => $val){
374
+							$selected = '';
375 375
 
376
-                            if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
377
-                                $selected = 'selected';
378
-                            }
376
+							if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
377
+								$selected = 'selected';
378
+							}
379 379
 
380
-                            ?>
380
+							?>
381 381
                             <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
382 382
                         <?php
383
-                        }
384
-                        ?>
383
+						}
384
+						?>
385 385
 
386 386
                     </select>
387 387
 
@@ -401,55 +401,55 @@  discard block
 block discarded – undo
401 401
                 <div class="gd-cf-input-wrap">
402 402
 
403 403
                     <?php
404
-                    $selected = '';
405
-                    if (isset($field_info->extra_fields))
406
-                        $advanced_editor = unserialize($field_info->extra_fields);
404
+					$selected = '';
405
+					if (isset($field_info->extra_fields))
406
+						$advanced_editor = unserialize($field_info->extra_fields);
407 407
 
408
-                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
409
-                        $selected = 'checked="checked"';
410
-                    ?>
408
+					if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
409
+						$selected = 'checked="checked"';
410
+					?>
411 411
 
412 412
                     <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
413 413
                            value="1" <?php echo $selected; ?>/>
414 414
                 </div>
415 415
 
416 416
                 </li><?php
417
-            } ?>
417
+			} ?>
418 418
 
419 419
             <?php
420 420
 
421
-            $pricearr = array();
422
-            if (isset($field_info->packages) && $field_info->packages != '') {
423
-                $pricearr = explode(',', trim($field_info->packages, ','));
424
-            } else {
425
-                $package_info = array();
421
+			$pricearr = array();
422
+			if (isset($field_info->packages) && $field_info->packages != '') {
423
+				$pricearr = explode(',', trim($field_info->packages, ','));
424
+			} else {
425
+				$package_info = array();
426 426
 
427
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
428
-                $pricearr[] = $package_info->pid;
429
-            }
427
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
428
+				$pricearr[] = $package_info->pid;
429
+			}
430 430
 
431
-            ob_start()
432
-            ?>
431
+			ob_start()
432
+			?>
433 433
 
434 434
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
435 435
                 <?php
436
-                if (!empty($pricearr)) {
437
-                    foreach ($pricearr as $val) {
438
-                        ?>
436
+				if (!empty($pricearr)) {
437
+					foreach ($pricearr as $val) {
438
+						?>
439 439
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
440
-                    }
441
-                }
442
-                ?>
440
+					}
441
+				}
442
+				?>
443 443
             </select>
444 444
 
445 445
             <?php
446
-            $html = ob_get_clean();
446
+			$html = ob_get_clean();
447 447
 
448 448
 			/**
449 449
 			 * Filter the price packages list.
450 450
 			 *
451 451
 			 * Filter the price packages list in custom field form in admin
452
-             * custom fields settings.
452
+			 * custom fields settings.
453 453
 			 *
454 454
 			 * @since 1.0.0
455 455
 			 *
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 			 */
459 459
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
460 460
 
461
-            ?>
461
+			?>
462 462
 
463 463
 
464 464
 
@@ -474,14 +474,14 @@  discard block
 block discarded – undo
474 474
 
475 475
                         <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
476 476
                             <?php if (isset($field_info->is_required) && $field_info->is_required == '1') {
477
-                                echo 'checked';
478
-                            } ?>/>
477
+								echo 'checked';
478
+							} ?>/>
479 479
                         <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>
480 480
 
481 481
                         <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
482 482
                             <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {
483
-                                echo 'checked';
484
-                            } ?>/>
483
+								echo 'checked';
484
+							} ?>/>
485 485
                         <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>
486 486
 
487 487
                     </div>
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
                 <div class="gd-cf-input-wrap">
500 500
                     <input type="text" name="required_msg" id="required_msg"
501 501
                            value="<?php if (isset($field_info->required_msg)) {
502
-                               echo esc_attr($field_info->required_msg);
503
-                           } ?>"/>
502
+							   echo esc_attr($field_info->required_msg);
503
+						   } ?>"/>
504 504
                 </div>
505 505
             </li>
506 506
             <?php } ?>
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
                 <div class="gd-cf-input-wrap">
517 517
                     <input type="text" name="validation_pattern" id="validation_pattern"
518 518
                            value="<?php if (isset($field_info->validation_pattern)) {
519
-                               echo esc_attr($field_info->validation_pattern);
520
-                           } ?>"/>
519
+							   echo esc_attr($field_info->validation_pattern);
520
+						   } ?>"/>
521 521
                 </div>
522 522
             </li>
523 523
 
@@ -531,17 +531,17 @@  discard block
 block discarded – undo
531 531
                 <div class="gd-cf-input-wrap">
532 532
                     <input type="text" name="validation_msg" id="validation_msg"
533 533
                            value="<?php if (isset($field_info->validation_msg)) {
534
-                               echo esc_attr($field_info->validation_msg);
535
-                           } ?>"/>
534
+							   echo esc_attr($field_info->validation_msg);
535
+						   } ?>"/>
536 536
                 </div>
537 537
             </li>
538 538
             <?php }
539 539
 
540 540
 
541 541
 
542
-            switch ($field_type):
543
-                case 'taxonomy': {
544
-                    ?>
542
+			switch ($field_type):
543
+				case 'taxonomy': {
544
+					?>
545 545
                     <li style="display: none;">
546 546
                         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
547 547
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -552,15 +552,15 @@  discard block
 block discarded – undo
552 552
                         <div class="gd-cf-input-wrap">
553 553
                             <select name="htmlvar_name" id="htmlvar_name">
554 554
                                 <?php
555
-                                $gd_taxonomy = geodir_get_taxonomies($post_type);
555
+								$gd_taxonomy = geodir_get_taxonomies($post_type);
556 556
 
557
-                                foreach ($gd_taxonomy as $gd_tax) {
558
-                                    ?>
557
+								foreach ($gd_taxonomy as $gd_tax) {
558
+									?>
559 559
                                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
560
-                                        echo 'selected="selected"';
561
-                                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
562
-                                }
563
-                                ?>
560
+										echo 'selected="selected"';
561
+									}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
562
+								}
563
+								?>
564 564
                             </select>
565 565
                         </div>
566 566
                     </li>
@@ -576,39 +576,39 @@  discard block
 block discarded – undo
576 576
 
577 577
                             <select name="cat_display_type" id="cat_display_type">
578 578
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
579
-                                    echo 'selected="selected"';
580
-                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
579
+									echo 'selected="selected"';
580
+								}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
581 581
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
582
-                                    echo 'selected="selected"';
583
-                                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
582
+									echo 'selected="selected"';
583
+								}?> value="select"><?php _e('Select', 'geodirectory');?></option>
584 584
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
585
-                                    echo 'selected="selected"';
586
-                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
585
+									echo 'selected="selected"';
586
+								}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
587 587
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
588
-                                    echo 'selected="selected"';
589
-                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
588
+									echo 'selected="selected"';
589
+								}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
590 590
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
591
-                                    echo 'selected="selected"';
592
-                                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
591
+									echo 'selected="selected"';
592
+								}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
593 593
                             </select>
594 594
                         </div>
595 595
                     </li>
596 596
                 <?php } // end of additional field for taxonomy field type
597
-                    break;
598
-                case 'address': {
599
-                    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
600
-                        $address = unserialize($field_info->extra_fields);
601
-                    }
602
-                    ?>
597
+					break;
598
+				case 'address': {
599
+					if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
600
+						$address = unserialize($field_info->extra_fields);
601
+					}
602
+					?>
603 603
                     <?php
604
-                    /**
605
-                     * Called on the add custom fields settings page before the address field is output.
606
-                     *
607
-                     * @since 1.0.0
608
-                     * @param array $address The address settings array.
609
-                     * @param object $field_info Extra fields info.
610
-                     */
611
-                    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
604
+					/**
605
+					 * Called on the add custom fields settings page before the address field is output.
606
+					 *
607
+					 * @since 1.0.0
608
+					 * @param array $address The address settings array.
609
+					 * @param object $field_info Extra fields info.
610
+					 */
611
+					do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
612 612
 
613 613
                     <li>
614 614
                         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -621,14 +621,14 @@  discard block
 block discarded – undo
621 621
 
622 622
                             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
623 623
                                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
624
-                                    echo 'checked';
625
-                                } ?>/>
624
+									echo 'checked';
625
+								} ?>/>
626 626
                             <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>
627 627
 
628 628
                             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
629 629
                                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
630
-                                    echo 'checked';
631
-                                } ?>/>
630
+									echo 'checked';
631
+								} ?>/>
632 632
                             <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>
633 633
 
634 634
 
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
                         <div class="gd-cf-input-wrap">
646 646
                             <input type="text" name="extra[zip_lable]" id="zip_lable"
647 647
                                    value="<?php if (isset($address['zip_lable'])) {
648
-                                       echo esc_attr($address['zip_lable']);
649
-                                   }?>"/>
648
+									   echo esc_attr($address['zip_lable']);
649
+								   }?>"/>
650 650
                         </div>
651 651
                     </li>
652 652
 
@@ -663,8 +663,8 @@  discard block
 block discarded – undo
663 663
                         <div class="gd-cf-input-wrap">
664 664
                             <input type="text" name="extra[map_lable]" id="map_lable"
665 665
                                    value="<?php if (isset($address['map_lable'])) {
666
-                                       echo esc_attr($address['map_lable']);
667
-                                   }?>"/>
666
+									   echo esc_attr($address['map_lable']);
667
+								   }?>"/>
668 668
                         </div>
669 669
                     </li>
670 670
 
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
 
680 680
                             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
681 681
                                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
682
-                                    echo 'checked';
683
-                                } ?>/>
682
+									echo 'checked';
683
+								} ?>/>
684 684
                             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
685 685
 
686 686
                             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
687 687
                                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
688
-                                    echo 'checked';
689
-                                } ?>/>
688
+									echo 'checked';
689
+								} ?>/>
690 690
                             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
691 691
 
692 692
                         </div>
@@ -703,14 +703,14 @@  discard block
 block discarded – undo
703 703
 
704 704
                             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
705 705
                                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
706
-                                    echo 'checked';
707
-                                } ?>/>
706
+									echo 'checked';
707
+								} ?>/>
708 708
                             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
709 709
 
710 710
                             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
711 711
                                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
712
-                                    echo 'checked';
713
-                                } ?>/>
712
+									echo 'checked';
713
+								} ?>/>
714 714
                             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
715 715
 
716 716
                         </div>
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
                         <div class="gd-cf-input-wrap">
728 728
                             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
729 729
                                    value="<?php if (isset($address['mapview_lable'])) {
730
-                                       echo esc_attr($address['mapview_lable']);
731
-                                   }?>"/>
730
+									   echo esc_attr($address['mapview_lable']);
731
+								   }?>"/>
732 732
                         </div>
733 733
                     </li>
734 734
                     <li>
@@ -742,26 +742,26 @@  discard block
 block discarded – undo
742 742
 
743 743
                             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
744 744
                                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
745
-                                    echo 'checked';
746
-                                } ?>/>
745
+									echo 'checked';
746
+								} ?>/>
747 747
                             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
748 748
 
749 749
                             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
750 750
                                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
751
-                                    echo 'checked';
752
-                                } ?>/>
751
+									echo 'checked';
752
+								} ?>/>
753 753
                             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
754 754
 
755 755
                         </div>
756 756
                     </li>
757 757
                 <?php } // end of extra fields for address field type
758
-                    break;
759
-                case 'select':
760
-                case 'multiselect':
761
-                case 'radio' : {
762
-                    if ($field_type == 'multiselect') {
758
+					break;
759
+				case 'select':
760
+				case 'multiselect':
761
+				case 'radio' : {
762
+					if ($field_type == 'multiselect') {
763 763
 
764
-                        ?>
764
+						?>
765 765
                         <li>
766 766
                             <label for="multi_display_type" class="gd-cf-tooltip-wrap">
767 767
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -773,22 +773,22 @@  discard block
 block discarded – undo
773 773
 
774 774
                                 <select name="multi_display_type" id="multi_display_type">
775 775
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
776
-                                        echo 'selected="selected"';
777
-                                    }?> value="select"><?php _e('Select', 'geodirectory');?></option>
776
+										echo 'selected="selected"';
777
+									}?> value="select"><?php _e('Select', 'geodirectory');?></option>
778 778
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
779
-                                        echo 'selected="selected"';
780
-                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
779
+										echo 'selected="selected"';
780
+									}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
781 781
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
782
-                                        echo 'selected="selected"';
783
-                                    }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
782
+										echo 'selected="selected"';
783
+									}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
784 784
                                 </select>
785 785
 
786 786
                                 <br/>
787 787
                             </div>
788 788
                         </li>
789 789
                     <?php
790
-                    }
791
-                    ?>
790
+					}
791
+					?>
792 792
                     <li>
793 793
                         <label for="option_values" class="gd-cf-tooltip-wrap">
794 794
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -809,20 +809,20 @@  discard block
 block discarded – undo
809 809
                         <div class="gd-cf-input-wrap">
810 810
                             <input type="text" name="option_values" id="option_values"
811 811
                                    value="<?php if (isset($field_info->option_values)) {
812
-                                       echo esc_attr($field_info->option_values);
813
-                                   }?>"/>
812
+									   echo esc_attr($field_info->option_values);
813
+								   }?>"/>
814 814
                             <br/>
815 815
 
816 816
                         </div>
817 817
                     </li>
818 818
                 <?php
819
-                } // end of extra fields for select , multiselect and radio type fields
820
-                    break;
821
-                case 'datepicker': {
822
-                    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
823
-                        $extra = unserialize($field_info->extra_fields);
824
-                    }
825
-                    ?>
819
+				} // end of extra fields for select , multiselect and radio type fields
820
+					break;
821
+				case 'datepicker': {
822
+					if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
823
+						$extra = unserialize($field_info->extra_fields);
824
+					}
825
+					?>
826 826
                     <li>
827 827
                         <label for="date_format" class="gd-cf-tooltip-wrap">
828 828
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -832,40 +832,40 @@  discard block
 block discarded – undo
832 832
                         </label>
833 833
                         <div class="gd-cf-input-wrap" style="overflow:inherit;">
834 834
                             <?php
835
-                            $date_formats = array(
836
-                                'm/d/Y',
837
-                                'd/m/Y',
838
-                                'Y/m/d',
839
-                                'm-d-Y',
840
-                                'd-m-Y',
841
-                                'Y-m-d',
842
-                                'F j, Y',
843
-                            );
844
-                            /**
845
-                             * Filter the custom field date format options.
846
-                             *
847
-                             * @since 1.6.5
848
-                             * @param array $date_formats The PHP date format array.
849
-                             */
850
-                            $date_formats = apply_filters('geodir_date_formats',$date_formats);
851
-                            ?>
835
+							$date_formats = array(
836
+								'm/d/Y',
837
+								'd/m/Y',
838
+								'Y/m/d',
839
+								'm-d-Y',
840
+								'd-m-Y',
841
+								'Y-m-d',
842
+								'F j, Y',
843
+							);
844
+							/**
845
+							 * Filter the custom field date format options.
846
+							 *
847
+							 * @since 1.6.5
848
+							 * @param array $date_formats The PHP date format array.
849
+							 */
850
+							$date_formats = apply_filters('geodir_date_formats',$date_formats);
851
+							?>
852 852
                             <select name="extra[date_format]" id="date_format">
853 853
                                 <?php
854
-                                foreach($date_formats as $format){
855
-                                    $selected = '';
856
-                                    if(esc_attr($extra['date_format'])==$format){
857
-                                        $selected = "selected='selected'";
858
-                                    }
859
-                                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
860
-                                }
861
-                                ?>
854
+								foreach($date_formats as $format){
855
+									$selected = '';
856
+									if(esc_attr($extra['date_format'])==$format){
857
+										$selected = "selected='selected'";
858
+									}
859
+									echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
860
+								}
861
+								?>
862 862
                             </select>
863 863
                             
864 864
                         </div>
865 865
                     </li>
866 866
                 <?php
867
-                }
868
-                    break;
867
+				}
868
+					break;
869 869
 				case 'file': {
870 870
 					$allowed_file_types = geodir_allowed_mime_types();
871 871
 					
@@ -896,9 +896,9 @@  discard block
 block discarded – undo
896 896
 					}
897 897
 					break;
898 898
 
899
-            endswitch;
900
-            if ($field_type != 'fieldset') {
901
-                ?>
899
+			endswitch;
900
+			if ($field_type != 'fieldset') {
901
+				?>
902 902
                 <li>
903 903
                     <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
904 904
 
@@ -913,8 +913,8 @@  discard block
 block discarded – undo
913 913
                     <div class="gd-cf-input-wrap">
914 914
                         <input type="text" name="field_icon" id="field_icon"
915 915
                                value="<?php if (isset($field_info->field_icon)) {
916
-                                   echo $field_info->field_icon;
917
-                               }?>"/>
916
+								   echo $field_info->field_icon;
917
+							   }?>"/>
918 918
                     </div>
919 919
 
920 920
 
@@ -928,22 +928,22 @@  discard block
 block discarded – undo
928 928
                     <div class="gd-cf-input-wrap">
929 929
                         <input type="text" name="css_class" id="css_class"
930 930
                                value="<?php if (isset($field_info->css_class)) {
931
-                                   echo esc_attr($field_info->css_class);
932
-                               }?>"/>
931
+								   echo esc_attr($field_info->css_class);
932
+							   }?>"/>
933 933
                     </div>
934 934
                 </div>
935 935
                 </li>
936 936
             <?php
937
-            }
938
-
939
-            switch ($field_type):
940
-                case 'html':
941
-                case 'file':
942
-                case 'url':
943
-                case 'fieldset':
944
-                    break;
945
-                default:
946
-                    ?>
937
+			}
938
+
939
+			switch ($field_type):
940
+				case 'html':
941
+				case 'file':
942
+				case 'url':
943
+				case 'fieldset':
944
+					break;
945
+				default:
946
+					?>
947 947
                     <li>
948 948
                         <h3><?php
949 949
 								/**
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 								 */
960 960
 								echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
961 961
 
962
-                                ?></h3>
962
+								?></h3>
963 963
 
964 964
 
965 965
                     <?php if (!in_array($field_type, array('multiselect', 'textarea', 'taxonomy')) && $field_type != 'address') { ?>
@@ -975,14 +975,14 @@  discard block
 block discarded – undo
975 975
 
976 976
                             <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
977 977
                                 <?php if (isset($field_info->cat_sort) && $field_info->cat_sort == '1') {
978
-                                    echo 'checked';
979
-                                } ?>/>
978
+									echo 'checked';
979
+								} ?>/>
980 980
                             <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
981 981
 
982 982
                             <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
983 983
                                 <?php if ((isset($field_info->cat_sort) && !$field_info->cat_sort) || !isset($field_info->cat_sort)) {
984
-                                    echo 'checked';
985
-                                } ?>/>
984
+									echo 'checked';
985
+								} ?>/>
986 986
                             <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
987 987
 
988 988
                         </div>
@@ -991,15 +991,15 @@  discard block
 block discarded – undo
991 991
                 <?php } ?>
992 992
 
993 993
                     <?php
994
-                    /**
995
-                     * Called at the end of the advanced custom fields settings page loop.
996
-                     *
997
-                     * Can be used to add or deal with different settings types.
998
-                     *
999
-                     * @since 1.0.0
1000
-                     * @param object $field_info The current fields info.
1001
-                     */
1002
-                    do_action('geodir_advance_custom_fields', $field_info);?>
994
+					/**
995
+					 * Called at the end of the advanced custom fields settings page loop.
996
+					 *
997
+					 * Can be used to add or deal with different settings types.
998
+					 *
999
+					 * @since 1.0.0
1000
+					 * @param object $field_info The current fields info.
1001
+					 */
1002
+					do_action('geodir_advance_custom_fields', $field_info);?>
1003 1003
 
1004 1004
                  
1005 1005
                 <?php endswitch; ?>
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
26 26
 
27
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
27
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
28 28
 
29 29
 $field_admin_title = '';
30 30
 if (isset($field_info->admin_title))
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
52 52
         <?php
53 53
 
54
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
54
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
55 55
         ?>
56 56
 
57 57
         <?php if ($default): ?>
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
             ?>
66 66
 
67 67
             <b style="cursor:pointer;"
68
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
68
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
69 69
         <?php
70 70
         } else {
71 71
             ?>
72 72
             <b style="cursor:pointer;"
73
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
73
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' '.$field_admin_title.' ('.$field_type.')'); ?></b>
74 74
         <?php
75 75
         }
76 76
         ?>
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
         } ?>"/>
93 93
         <input type="hidden" name="is_active" id="is_active" value="1"/>
94 94
 
95
-        <input type="hidden" name="is_default" value="<?php echo $field_info->is_default;?>" /><?php // show in sidebar value?>
96
-        <input type="hidden" name="show_on_listing" value="<?php echo $field_info->show_on_listing;?>" />
97
-        <input type="hidden" name="show_on_detail" value="<?php echo $field_info->show_on_listing;?>" />
98
-        <input type="hidden" name="show_as_tab" value="<?php echo $field_info->show_as_tab;?>" />
95
+        <input type="hidden" name="is_default" value="<?php echo $field_info->is_default; ?>" /><?php // show in sidebar value?>
96
+        <input type="hidden" name="show_on_listing" value="<?php echo $field_info->show_on_listing; ?>" />
97
+        <input type="hidden" name="show_on_detail" value="<?php echo $field_info->show_on_listing; ?>" />
98
+        <input type="hidden" name="show_as_tab" value="<?php echo $field_info->show_as_tab; ?>" />
99 99
 
100 100
         <ul class="widefat post fixed" border="0" style="width:100%;">
101 101
             <?php if ($field_type != 'text' || $default) { ?>
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
                 ?>
193 193
 
194 194
                 <li>
195
-                    <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');?>
195
+                    <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'); ?>
196 196
                         <div class="gdcf-tooltip">
197 197
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
198 198
                         </div>
199 199
                     </label>
200 200
                     <div class="gd-cf-input-wrap">
201
-                        <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');?>"
201
+                        <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'); ?>"
202 202
                                value="<?php if (isset($field_info->htmlvar_name)) {
203 203
                                    echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1);
204 204
                                }?>" <?php if ($default) {
@@ -230,17 +230,17 @@  discard block
 block discarded – undo
230 230
                 </label>
231 231
                 <div class="gd-cf-input-wrap gd-switch">
232 232
 
233
-                    <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
233
+                    <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
234 234
                         <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
235 235
                             echo 'checked';
236 236
                         } ?>/>
237
-                    <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
237
+                    <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
238 238
 
239
-                    <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
239
+                    <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
240 240
                         <?php if ((isset($field_info->is_active) && $field_info->is_active == '0') || !isset($field_info->is_active)) {
241 241
                             echo 'checked';
242 242
                         } ?>/>
243
-                    <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
243
+                    <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
244 244
 
245 245
                 </div>
246 246
             </li>
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
                     </label>
255 255
                     <div class="gd-cf-input-wrap gd-switch">
256 256
 
257
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
257
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
258 258
                             <?php if (isset($for_admin_use) && $for_admin_use == '1') {
259 259
                                 echo 'checked';
260 260
                             } ?>/>
261
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
261
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
262 262
 
263
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
263
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
264 264
                             <?php if ((isset($for_admin_use) && $for_admin_use == '0') || !isset($for_admin_use)) {
265 265
                                 echo 'checked';
266 266
                             } ?>/>
267
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
267
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
268 268
 
269 269
                     </div>
270 270
                 </li>
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 				$default_value = isset($field_info->default_value) ? $field_info->default_value : '';
277 277
 			?>
278 278
 			<li>
279
-				<label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
279
+				<label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
280 280
                     <div class="gdcf-tooltip">
281 281
                         <?php
282 282
                         if ($field_type == 'checkbox') {
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
 				<?php if ($field_type == 'checkbox') { ?>
294 294
 				<select name="default_value" id="default_value">
295 295
 					<option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
296
-					<option value="1" <?php selected(true, (int)$default_value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
296
+					<option value="1" <?php selected(true, (int) $default_value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
297 297
 				</select>
298 298
 				<?php } else if ($field_type == 'email') { ?>
299
-				<input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($default_value);?>" /><br/>
299
+				<input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($default_value); ?>" /><br/>
300 300
 				<?php } else { ?>
301
-				<input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($default_value);?>" /><br/>
301
+				<input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($default_value); ?>" /><br/>
302 302
 				<?php } ?>
303 303
 				</div>
304 304
 			</li>
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                      * @param array $show_in_locations The array of locations and descriptions.
343 343
                      * @param object $field_info The field being displayed info.
344 344
                      */
345
-                    $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info);
345
+                    $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info);
346 346
 
347 347
 
348 348
                     // remove some locations for some field types
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
                     // don't show new tab option for some types
351 351
 
352 352
                     if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
353
-                    }else{
353
+                    } else {
354 354
                         unset($show_in_locations['[owntab]']);
355 355
                     }
356 356
 
357
-                    if(!$display_on_listing){
357
+                    if (!$display_on_listing) {
358 358
                         unset($show_in_locations['[listings]']);
359 359
                     }
360 360
 
@@ -368,17 +368,17 @@  discard block
 block discarded – undo
368 368
                             option-ajaxchosen="false">
369 369
                         <?php
370 370
 
371
-                        $show_in_values = explode(',',$field_info->show_in);
371
+                        $show_in_values = explode(',', $field_info->show_in);
372 372
 
373
-                        foreach( $show_in_locations as $key => $val){
373
+                        foreach ($show_in_locations as $key => $val) {
374 374
                             $selected = '';
375 375
 
376
-                            if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
376
+                            if (is_array($show_in_values) && in_array($key, $show_in_values)) {
377 377
                                 $selected = 'selected';
378 378
                             }
379 379
 
380 380
                             ?>
381
-                            <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
381
+                            <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
382 382
                         <?php
383 383
                         }
384 384
                         ?>
@@ -472,24 +472,24 @@  discard block
 block discarded – undo
472 472
 
473 473
                     <div class="gd-cf-input-wrap gd-switch">
474 474
 
475
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
475
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
476 476
                             <?php if (isset($field_info->is_required) && $field_info->is_required == '1') {
477 477
                                 echo 'checked';
478 478
                             } ?>/>
479
-                        <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>
479
+                        <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>
480 480
 
481
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
481
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
482 482
                             <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {
483 483
                                 echo 'checked';
484 484
                             } ?>/>
485
-                        <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>
485
+                        <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>
486 486
 
487 487
                     </div>
488 488
 
489 489
                 </li>
490 490
             
491 491
 
492
-            <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;'";}?>>
492
+            <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;'"; }?>>
493 493
                 <label for="required_msg" class="gd-cf-tooltip-wrap">
494 494
                     <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
495 495
                     <div class="gdcf-tooltip">
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
             </li>
506 506
             <?php } ?>
507 507
 
508
-            <?php if ($field_type == 'text'){ ?>
508
+            <?php if ($field_type == 'text') { ?>
509 509
             <li>
510 510
                 <label for="validation_pattern" class="gd-cf-tooltip-wrap">
511 511
                     <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
                                     ?>
559 559
                                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
560 560
                                         echo 'selected="selected"';
561
-                                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
561
+                                    }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php
562 562
                                 }
563 563
                                 ?>
564 564
                             </select>
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                         <label for="cat_display_type" class="gd-cf-tooltip-wrap">
570 570
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
571 571
                             <div class="gdcf-tooltip">
572
-                                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
572
+                                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
573 573
                             </div>
574 574
                         </label>
575 575
                         <div class="gd-cf-input-wrap">
@@ -577,19 +577,19 @@  discard block
 block discarded – undo
577 577
                             <select name="cat_display_type" id="cat_display_type">
578 578
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
579 579
                                     echo 'selected="selected"';
580
-                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
580
+                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
581 581
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
582 582
                                     echo 'selected="selected"';
583
-                                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
583
+                                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
584 584
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
585 585
                                     echo 'selected="selected"';
586
-                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
586
+                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
587 587
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
588 588
                                     echo 'selected="selected"';
589
-                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
589
+                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
590 590
                                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
591 591
                                     echo 'selected="selected"';
592
-                                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
592
+                                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
593 593
                             </select>
594 594
                         </div>
595 595
                     </li>
@@ -614,32 +614,32 @@  discard block
 block discarded – undo
614 614
                         <label for="show_zip" class="gd-cf-tooltip-wrap">
615 615
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
616 616
                             <div class="gdcf-tooltip">
617
-                                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
617
+                                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
618 618
                             </div>
619 619
                         </label>
620 620
                         <div class="gd-cf-input-wrap gd-switch">
621 621
 
622
-                            <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
622
+                            <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
623 623
                                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
624 624
                                     echo 'checked';
625 625
                                 } ?>/>
626
-                            <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>
626
+                            <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>
627 627
 
628
-                            <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
628
+                            <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0"
629 629
                                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
630 630
                                     echo 'checked';
631 631
                                 } ?>/>
632
-                            <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>
632
+                            <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>
633 633
 
634 634
 
635 635
                         </div>
636 636
                     </li>
637 637
 
638
-                    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
638
+                    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
639 639
                         <label for="zip_lable" class="gd-cf-tooltip-wrap">
640 640
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
641 641
                             <div class="gdcf-tooltip">
642
-                                <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
642
+                                <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
643 643
                             </div>
644 644
                         </label>
645 645
                         <div class="gd-cf-input-wrap">
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                         <label for="map_lable" class="gd-cf-tooltip-wrap">
658 658
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
659 659
                             <div class="gdcf-tooltip">
660
-                                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
660
+                                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
661 661
                             </div>
662 662
                         </label>
663 663
                         <div class="gd-cf-input-wrap">
@@ -672,22 +672,22 @@  discard block
 block discarded – undo
672 672
                         <label for="show_mapzoom" class="gd-cf-tooltip-wrap">
673 673
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
674 674
                             <div class="gdcf-tooltip">
675
-                                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
675
+                                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
676 676
                             </div>
677 677
                         </label>
678 678
                         <div class="gd-cf-input-wrap gd-switch">
679 679
 
680
-                            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
680
+                            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
681 681
                                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
682 682
                                     echo 'checked';
683 683
                                 } ?>/>
684
-                            <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
684
+                            <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
685 685
 
686
-                            <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
686
+                            <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
687 687
                                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
688 688
                                     echo 'checked';
689 689
                                 } ?>/>
690
-                            <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
690
+                            <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
691 691
 
692 692
                         </div>
693 693
                     </li>
@@ -696,22 +696,22 @@  discard block
 block discarded – undo
696 696
                         <label for="show_mapview" class="gd-cf-tooltip-wrap">
697 697
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
698 698
                             <div class="gdcf-tooltip">
699
-                                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
699
+                                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
700 700
                             </div>
701 701
                         </label>
702 702
                         <div class="gd-cf-input-wrap gd-switch">
703 703
 
704
-                            <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
704
+                            <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
705 705
                                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
706 706
                                     echo 'checked';
707 707
                                 } ?>/>
708
-                            <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
708
+                            <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
709 709
 
710
-                            <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
710
+                            <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
711 711
                                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
712 712
                                     echo 'checked';
713 713
                                 } ?>/>
714
-                            <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
714
+                            <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
715 715
 
716 716
                         </div>
717 717
                     </li>
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
                         <label for="mapview_lable" class="gd-cf-tooltip-wrap">
722 722
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
723 723
                             <div class="gdcf-tooltip">
724
-                                <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
724
+                                <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
725 725
                             </div>
726 726
                         </label>
727 727
                         <div class="gd-cf-input-wrap">
@@ -735,22 +735,22 @@  discard block
 block discarded – undo
735 735
                         <label for="show_latlng" class="gd-cf-tooltip-wrap">
736 736
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
737 737
                             <div class="gdcf-tooltip">
738
-                                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
738
+                                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
739 739
                             </div>
740 740
                         </label>
741 741
                         <div class="gd-cf-input-wrap gd-switch">
742 742
 
743
-                            <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
743
+                            <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
744 744
                                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
745 745
                                     echo 'checked';
746 746
                                 } ?>/>
747
-                            <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
747
+                            <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
748 748
 
749
-                            <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
749
+                            <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
750 750
                                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
751 751
                                     echo 'checked';
752 752
                                 } ?>/>
753
-                            <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
753
+                            <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
754 754
 
755 755
                         </div>
756 756
                     </li>
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
                             <label for="multi_display_type" class="gd-cf-tooltip-wrap">
767 767
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
768 768
                                 <div class="gdcf-tooltip">
769
-                                    <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
769
+                                    <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
770 770
                                 </div>
771 771
                             </label>
772 772
                             <div class="gd-cf-input-wrap">
@@ -774,13 +774,13 @@  discard block
 block discarded – undo
774 774
                                 <select name="multi_display_type" id="multi_display_type">
775 775
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
776 776
                                         echo 'selected="selected"';
777
-                                    }?> value="select"><?php _e('Select', 'geodirectory');?></option>
777
+                                    }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
778 778
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
779 779
                                         echo 'selected="selected"';
780
-                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
780
+                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
781 781
                                     <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
782 782
                                         echo 'selected="selected"';
783
-                                    }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
783
+                                    }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
784 784
                                 </select>
785 785
 
786 786
                                 <br/>
@@ -793,11 +793,11 @@  discard block
 block discarded – undo
793 793
                         <label for="option_values" class="gd-cf-tooltip-wrap">
794 794
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
795 795
                             <div class="gdcf-tooltip">
796
-                                <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
796
+                                <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
797 797
                                 <br/>
798
-                                <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>
798
+                                <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>
799 799
                                 <br/>
800
-                                <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
800
+                                <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
801 801
                                 <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
802 802
                                     <br/>
803 803
                                     <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
                         <label for="date_format" class="gd-cf-tooltip-wrap">
828 828
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
829 829
                             <div class="gdcf-tooltip">
830
-                                <?php _e('Select the date format.', 'geodirectory');?>
830
+                                <?php _e('Select the date format.', 'geodirectory'); ?>
831 831
                             </div>
832 832
                         </label>
833 833
                         <div class="gd-cf-input-wrap" style="overflow:inherit;">
@@ -847,16 +847,16 @@  discard block
 block discarded – undo
847 847
                              * @since 1.6.5
848 848
                              * @param array $date_formats The PHP date format array.
849 849
                              */
850
-                            $date_formats = apply_filters('geodir_date_formats',$date_formats);
850
+                            $date_formats = apply_filters('geodir_date_formats', $date_formats);
851 851
                             ?>
852 852
                             <select name="extra[date_format]" id="date_format">
853 853
                                 <?php
854
-                                foreach($date_formats as $format){
854
+                                foreach ($date_formats as $format) {
855 855
                                     $selected = '';
856
-                                    if(esc_attr($extra['date_format'])==$format){
856
+                                    if (esc_attr($extra['date_format']) == $format) {
857 857
                                         $selected = "selected='selected'";
858 858
                                     }
859
-                                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
859
+                                    echo "<option $selected value='$format'>$format       (".date_i18n($format, time()).")</option>";
860 860
                                 }
861 861
                                 ?>
862 862
                             </select>
@@ -876,16 +876,16 @@  discard block
 block discarded – undo
876 876
                         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
877 877
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
878 878
                             <div class="gdcf-tooltip">
879
-                                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
879
+                                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
880 880
                             </div>
881 881
                         </label>
882 882
 						<div class="gd-cf-input-wrap">
883 883
 							<select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">
884
-								<option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
885
-								<?php foreach ( $allowed_file_types as $format => $types ) { ?>
886
-								<optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
887
-									<?php foreach ( $types as $ext => $type ) { ?>
888
-									<option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>
884
+								<option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
885
+								<?php foreach ($allowed_file_types as $format => $types) { ?>
886
+								<optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
887
+									<?php foreach ($types as $ext => $type) { ?>
888
+									<option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option>
889 889
 									<?php } ?>
890 890
 								</optgroup>
891 891
 								<?php } ?>
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
908 908
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
909 909
                         <div class="gdcf-tooltip">
910
-                            <?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');?>
910
+                            <?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'); ?>
911 911
                         </div>
912 912
                     </label>
913 913
                     <div class="gd-cf-input-wrap">
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
                     <label for="css_class" class="gd-cf-tooltip-wrap">
923 923
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
924 924
                         <div class="gdcf-tooltip">
925
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
925
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
926 926
                         </div>
927 927
                     </label>
928 928
                     <div class="gd-cf-input-wrap">
@@ -967,23 +967,23 @@  discard block
 block discarded – undo
967 967
                         <label for="cat_sort" class="gd-cf-tooltip-wrap">
968 968
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
969 969
                             <div class="gdcf-tooltip">
970
-                                <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
970
+                                <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
971 971
                             </div>
972 972
                         </label>
973 973
 
974 974
                         <div class="gd-cf-input-wrap gd-switch">
975 975
 
976
-                            <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
976
+                            <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
977 977
                                 <?php if (isset($field_info->cat_sort) && $field_info->cat_sort == '1') {
978 978
                                     echo 'checked';
979 979
                                 } ?>/>
980
-                            <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
980
+                            <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
981 981
 
982
-                            <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
982
+                            <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
983 983
                                 <?php if ((isset($field_info->cat_sort) && !$field_info->cat_sort) || !isset($field_info->cat_sort)) {
984 984
                                     echo 'checked';
985 985
                                 } ?>/>
986
-                            <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
986
+                            <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
987 987
 
988 988
                         </div>
989 989
                     </li>
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
                      * @since 1.0.0
1000 1000
                      * @param object $field_info The current fields info.
1001 1001
                      */
1002
-                    do_action('geodir_advance_custom_fields', $field_info);?>
1002
+                    do_action('geodir_advance_custom_fields', $field_info); ?>
1003 1003
 
1004 1004
                  
1005 1005
                 <?php endswitch; ?>
@@ -1009,10 +1009,10 @@  discard block
 block discarded – undo
1009 1009
                     <h3></h3>
1010 1010
                 </label>
1011 1011
                 <div class="gd-cf-input-wrap">
1012
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
1012
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
1013 1013
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
1014 1014
                     <?php if (!$default): ?>
1015
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
1015
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
1016 1016
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
1017 1017
                                                             class="button"/></a>
1018 1018
                     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +18 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,16 +19,18 @@  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
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
26 27
 
27 28
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
28 29
 
29 30
 $field_admin_title = '';
30
-if (isset($field_info->admin_title))
31
-    $field_admin_title = $field_info->admin_title;
31
+if (isset($field_info->admin_title)) {
32
+    $field_admin_title = $field_info->admin_title;
33
+}
32 34
 
33 35
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
34 36
 
@@ -56,8 +58,11 @@  discard block
 block discarded – undo
56 58
 
57 59
         <?php if ($default): ?>
58 60
             <div title="<?php _e('Drag and drop to sort', 'geodirectory'); ?>" class="handlediv move"></div>
59
-        <?php else: ?>
60
-            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
61
+        <?php else {
62
+	: ?>
63
+            <div title="<?php _e('Click to remove field', 'geodirectory');
64
+}
65
+?>"
61 66
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
62 67
                  class="handlediv close"></div>
63 68
         <?php endif;
@@ -350,7 +355,7 @@  discard block
 block discarded – undo
350 355
                     // don't show new tab option for some types
351 356
 
352 357
                     if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
353
-                    }else{
358
+                    } else{
354 359
                         unset($show_in_locations['[owntab]']);
355 360
                     }
356 361
 
@@ -402,11 +407,13 @@  discard block
 block discarded – undo
402 407
 
403 408
                     <?php
404 409
                     $selected = '';
405
-                    if (isset($field_info->extra_fields))
406
-                        $advanced_editor = unserialize($field_info->extra_fields);
410
+                    if (isset($field_info->extra_fields)) {
411
+                                            $advanced_editor = unserialize($field_info->extra_fields);
412
+                    }
407 413
 
408
-                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
409
-                        $selected = 'checked="checked"';
414
+                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
415
+                                            $selected = 'checked="checked"';
416
+                    }
410 417
                     ?>
411 418
 
412 419
                     <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/design_settings_array.php 1 patch
Indentation   +946 added lines, -946 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_post_type_setting_fun()
19 19
 {
20
-    $post_type_arr = array();
20
+	$post_type_arr = array();
21 21
 
22
-    $post_types = geodir_get_posttypes('object');
22
+	$post_types = geodir_get_posttypes('object');
23 23
 
24
-    foreach ($post_types as $key => $post_types_obj) {
25
-        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
-    }
27
-    return $post_type_arr;
24
+	foreach ($post_types as $key => $post_types_obj) {
25
+		$post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
+	}
27
+	return $post_type_arr;
28 28
 }
29 29
 
30 30
 /**
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_theme_location_setting_fun()
37 37
 {
38
-    $post_type_arr = array();
39
-    $geodir_all_nav_locations = get_registered_nav_menus();
40
-    $geodir_active_nav_locations = get_nav_menu_locations();
41
-    if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
-        foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
-            if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
-                $post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
-        }
46
-    }
47
-
48
-    return $post_type_arr;
38
+	$post_type_arr = array();
39
+	$geodir_all_nav_locations = get_registered_nav_menus();
40
+	$geodir_active_nav_locations = get_nav_menu_locations();
41
+	if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
+		foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
+			if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
+				$post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
+		}
46
+	}
47
+
48
+	return $post_type_arr;
49 49
 }
50 50
 /**
51 51
  * Filter GD design settings array.
@@ -55,543 +55,543 @@  discard block
 block discarded – undo
55 55
  */
56 56
 $geodir_settings['design_settings'] = apply_filters('geodir_design_settings', array(
57 57
 
58
-    /* Home Layout Settings start */
59
-    array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
58
+	/* Home Layout Settings start */
59
+	array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
60 60
 
61 61
 
62
-    array('name' => __('Home Top Section Settings', 'geodirectory'),
63
-        'type' => 'sectionstart',
64
-        'desc' => '',
65
-        'id' => 'geodir_home_top_section'),
62
+	array('name' => __('Home Top Section Settings', 'geodirectory'),
63
+		'type' => 'sectionstart',
64
+		'desc' => '',
65
+		'id' => 'geodir_home_top_section'),
66 66
 
67
-    array(
68
-        'name' => __('Geodirectory home page', 'geodirectory'),
69
-        'desc' => __('Set geodirectory home page as your home. <b style="color:red;">This setting has been depreciated and will be removed in the next version, instead please set the GD home page in GD>Permalinks and then set this page to the front page under Settings>Reading>Front Page</b>', 'geodirectory'),
70
-        'id' => 'geodir_set_as_home',
71
-        'type' => 'checkbox',
72
-        'std' => '0' // Default value to show home top section
73
-    ),
67
+	array(
68
+		'name' => __('Geodirectory home page', 'geodirectory'),
69
+		'desc' => __('Set geodirectory home page as your home. <b style="color:red;">This setting has been depreciated and will be removed in the next version, instead please set the GD home page in GD>Permalinks and then set this page to the front page under Settings>Reading>Front Page</b>', 'geodirectory'),
70
+		'id' => 'geodir_set_as_home',
71
+		'type' => 'checkbox',
72
+		'std' => '0' // Default value to show home top section
73
+	),
74 74
 
75
-    array(
76
-        'name' => __('Home top section', 'geodirectory'),
77
-        'desc' => __('Show the top section of home page', 'geodirectory'),
78
-        'id' => 'geodir_show_home_top_section',
79
-        'type' => 'checkbox',
80
-        'std' => '1' // Default value to show home top section
81
-    ),
75
+	array(
76
+		'name' => __('Home top section', 'geodirectory'),
77
+		'desc' => __('Show the top section of home page', 'geodirectory'),
78
+		'id' => 'geodir_show_home_top_section',
79
+		'type' => 'checkbox',
80
+		'std' => '1' // Default value to show home top section
81
+	),
82 82
 
83 83
 
84
-    array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
84
+	array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
85 85
 
86 86
 
87
-    array('name' => __('Home Page Layout Settings', 'geodirectory'),
88
-        'type' => 'sectionstart',
89
-        'desc' => '',
90
-        'id' => 'geodir_home_layout'),
87
+	array('name' => __('Home Page Layout Settings', 'geodirectory'),
88
+		'type' => 'sectionstart',
89
+		'desc' => '',
90
+		'id' => 'geodir_home_layout'),
91 91
 
92
-    array(
93
-        'name' => __('Home right section', 'geodirectory'),
94
-        'desc' => __('Show the right section of home page', 'geodirectory'),
95
-        'id' => 'geodir_show_home_right_section',
96
-        'type' => 'checkbox',
97
-        'std' => '1' // Default value to show home top section
98
-    ),
92
+	array(
93
+		'name' => __('Home right section', 'geodirectory'),
94
+		'desc' => __('Show the right section of home page', 'geodirectory'),
95
+		'id' => 'geodir_show_home_right_section',
96
+		'type' => 'checkbox',
97
+		'std' => '1' // Default value to show home top section
98
+	),
99 99
 
100
-    array(
101
-        'name' => __('Width of home right section', 'geodirectory'),
102
-        'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
103
-        'id' => 'geodir_width_home_right_section',
104
-        'type' => 'text',
105
-        'css' => 'min-width:300px;',
106
-        'std' => '30' // Default value to show home top section
107
-    ),
100
+	array(
101
+		'name' => __('Width of home right section', 'geodirectory'),
102
+		'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
103
+		'id' => 'geodir_width_home_right_section',
104
+		'type' => 'text',
105
+		'css' => 'min-width:300px;',
106
+		'std' => '30' // Default value to show home top section
107
+	),
108 108
 
109
-    array(
110
-        'name' => __('Home content section', 'geodirectory'),
111
-        'desc' => __('Show the content section of home page', 'geodirectory'),
112
-        'id' => 'geodir_show_home_contant_section',
113
-        'type' => 'checkbox',
114
-        'std' => '1' // Default value to show home top section
115
-    ),
109
+	array(
110
+		'name' => __('Home content section', 'geodirectory'),
111
+		'desc' => __('Show the content section of home page', 'geodirectory'),
112
+		'id' => 'geodir_show_home_contant_section',
113
+		'type' => 'checkbox',
114
+		'std' => '1' // Default value to show home top section
115
+	),
116 116
 
117
-    array(
118
-        'name' => __('Width of home content section', 'geodirectory'),
119
-        'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
120
-        'id' => 'geodir_width_home_contant_section',
121
-        'type' => 'text',
122
-        'css' => 'min-width:300px;',
123
-        'std' => '63' // Default value to show home top section
124
-    ),
117
+	array(
118
+		'name' => __('Width of home content section', 'geodirectory'),
119
+		'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
120
+		'id' => 'geodir_width_home_contant_section',
121
+		'type' => 'text',
122
+		'css' => 'min-width:300px;',
123
+		'std' => '63' // Default value to show home top section
124
+	),
125 125
 
126
-    array(
127
-        'name' => __('Home left section', 'geodirectory'),
128
-        'desc' => __('Show the left section of home page', 'geodirectory'),
129
-        'id' => 'geodir_show_home_left_section',
130
-        'type' => 'checkbox',
131
-        'std' => '0' // Default value to show home top section
132
-    ),
126
+	array(
127
+		'name' => __('Home left section', 'geodirectory'),
128
+		'desc' => __('Show the left section of home page', 'geodirectory'),
129
+		'id' => 'geodir_show_home_left_section',
130
+		'type' => 'checkbox',
131
+		'std' => '0' // Default value to show home top section
132
+	),
133 133
 
134
-    array(
135
-        'name' => __('Width of home left section', 'geodirectory'),
136
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
137
-        'id' => 'geodir_width_home_left_section',
138
-        'type' => 'text',
139
-        'css' => 'min-width:300px;',
140
-        'std' => '30' // Default value to show home top section
141
-    ),
134
+	array(
135
+		'name' => __('Width of home left section', 'geodirectory'),
136
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
137
+		'id' => 'geodir_width_home_left_section',
138
+		'type' => 'text',
139
+		'css' => 'min-width:300px;',
140
+		'std' => '30' // Default value to show home top section
141
+	),
142 142
 
143
-    array(
144
-        'name' => __('Home bottom section', 'geodirectory'),
145
-        'desc' => __('Show the bottom section of home page', 'geodirectory'),
146
-        'id' => 'geodir_show_home_bottom_section',
147
-        'type' => 'checkbox',
148
-        'std' => '0' // Default value to show home top section
149
-    ),
150
-    array(
151
-        'name' => __('Resize image large size', 'geodirectory'),
152
-        'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
153
-        'id' => 'geodir_use_wp_media_large_size',
154
-        'type' => 'checkbox',
155
-        'std' => '0'
156
-    ),
143
+	array(
144
+		'name' => __('Home bottom section', 'geodirectory'),
145
+		'desc' => __('Show the bottom section of home page', 'geodirectory'),
146
+		'id' => 'geodir_show_home_bottom_section',
147
+		'type' => 'checkbox',
148
+		'std' => '0' // Default value to show home top section
149
+	),
150
+	array(
151
+		'name' => __('Resize image large size', 'geodirectory'),
152
+		'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
153
+		'id' => 'geodir_use_wp_media_large_size',
154
+		'type' => 'checkbox',
155
+		'std' => '0'
156
+	),
157 157
 
158
-    array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
158
+	array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
159 159
 
160 160
 
161
-    /* Home Layout Settings end */
161
+	/* Home Layout Settings end */
162 162
 
163 163
 
164
-    /* Listing Layout Settings end */
164
+	/* Listing Layout Settings end */
165 165
 
166
-    array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
166
+	array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
167 167
 
168 168
 
169
-    array('name' => __('Listing Page Layout Settings', 'geodirectory'),
170
-        'type' => 'sectionstart',
171
-        'desc' => '',
172
-        'id' => 'geodir_listing_layout'),
169
+	array('name' => __('Listing Page Layout Settings', 'geodirectory'),
170
+		'type' => 'sectionstart',
171
+		'desc' => '',
172
+		'id' => 'geodir_listing_layout'),
173 173
 
174
-    array(
175
-        'name' => __('Listing top section', 'geodirectory'),
176
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
177
-        'id' => 'geodir_show_listing_top_section',
178
-        'type' => 'checkbox',
179
-        'std' => '1' // Default value to show home top section
180
-    ),
174
+	array(
175
+		'name' => __('Listing top section', 'geodirectory'),
176
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
177
+		'id' => 'geodir_show_listing_top_section',
178
+		'type' => 'checkbox',
179
+		'std' => '1' // Default value to show home top section
180
+	),
181 181
 
182
-    array(
183
-        'name' => __('Listing right section', 'geodirectory'),
184
-        'desc' => __('Show the right section of listing page', 'geodirectory'),
185
-        'id' => 'geodir_show_listing_right_section',
186
-        'type' => 'checkbox',
187
-        'std' => '1' // Default value to show home top section
188
-    ),
182
+	array(
183
+		'name' => __('Listing right section', 'geodirectory'),
184
+		'desc' => __('Show the right section of listing page', 'geodirectory'),
185
+		'id' => 'geodir_show_listing_right_section',
186
+		'type' => 'checkbox',
187
+		'std' => '1' // Default value to show home top section
188
+	),
189 189
 
190
-    array(
191
-        'name' => __('Width of listing right section', 'geodirectory'),
192
-        'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
193
-        'id' => 'geodir_width_listing_right_section',
194
-        'type' => 'text',
195
-        'css' => 'min-width:300px;',
196
-        'std' => '30' // Default value to show home top section
197
-    ),
190
+	array(
191
+		'name' => __('Width of listing right section', 'geodirectory'),
192
+		'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
193
+		'id' => 'geodir_width_listing_right_section',
194
+		'type' => 'text',
195
+		'css' => 'min-width:300px;',
196
+		'std' => '30' // Default value to show home top section
197
+	),
198 198
 
199 199
 
200
-    array(
201
-        'name' => __('Listing content section view', 'geodirectory'),
202
-        'desc' => __('Set the listing view of listing page', 'geodirectory'),
203
-        'id' => 'geodir_listing_view',
204
-        'css' => 'min-width:300px;',
205
-        'std' => 'gridview_onehalf',
206
-        'type' => 'select',
207
-        'class' => 'chosen_select',
208
-        'options' => array_unique(array(
209
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
210
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
211
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
212
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
213
-            'listview' => __('List view', 'geodirectory'),
214
-        ))
215
-    ),
200
+	array(
201
+		'name' => __('Listing content section view', 'geodirectory'),
202
+		'desc' => __('Set the listing view of listing page', 'geodirectory'),
203
+		'id' => 'geodir_listing_view',
204
+		'css' => 'min-width:300px;',
205
+		'std' => 'gridview_onehalf',
206
+		'type' => 'select',
207
+		'class' => 'chosen_select',
208
+		'options' => array_unique(array(
209
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
210
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
211
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
212
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
213
+			'listview' => __('List view', 'geodirectory'),
214
+		))
215
+	),
216 216
 
217
-    array(
218
-        'name' => __('Width of listing content section', 'geodirectory'),
219
-        'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
220
-        'id' => 'geodir_width_listing_contant_section',
221
-        'type' => 'text',
222
-        'css' => 'min-width:300px;',
223
-        'std' => '63' // Default value to show home top section
224
-    ),
217
+	array(
218
+		'name' => __('Width of listing content section', 'geodirectory'),
219
+		'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
220
+		'id' => 'geodir_width_listing_contant_section',
221
+		'type' => 'text',
222
+		'css' => 'min-width:300px;',
223
+		'std' => '63' // Default value to show home top section
224
+	),
225 225
 
226
-    array(
227
-        'name' => __('Listing left section', 'geodirectory'),
228
-        'desc' => __('Show the left section of listing page', 'geodirectory'),
229
-        'id' => 'geodir_show_listing_left_section',
230
-        'type' => 'checkbox',
231
-        'std' => '0' // Default value to show home top section
232
-    ),
226
+	array(
227
+		'name' => __('Listing left section', 'geodirectory'),
228
+		'desc' => __('Show the left section of listing page', 'geodirectory'),
229
+		'id' => 'geodir_show_listing_left_section',
230
+		'type' => 'checkbox',
231
+		'std' => '0' // Default value to show home top section
232
+	),
233 233
 
234
-    array(
235
-        'name' => __('Width of listing left section', 'geodirectory'),
236
-        'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
237
-        'id' => 'geodir_width_listing_left_section',
238
-        'type' => 'text',
239
-        'css' => 'min-width:300px;',
240
-        'std' => '30' // Default value to show home top section
241
-    ),
234
+	array(
235
+		'name' => __('Width of listing left section', 'geodirectory'),
236
+		'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
237
+		'id' => 'geodir_width_listing_left_section',
238
+		'type' => 'text',
239
+		'css' => 'min-width:300px;',
240
+		'std' => '30' // Default value to show home top section
241
+	),
242 242
 
243
-    array(
244
-        'name' => __('Listing bottom section', 'geodirectory'),
245
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
246
-        'id' => 'geodir_show_listing_bottom_section',
247
-        'type' => 'checkbox',
248
-        'std' => '0' // Default value to show home top section
249
-    ),
243
+	array(
244
+		'name' => __('Listing bottom section', 'geodirectory'),
245
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
246
+		'id' => 'geodir_show_listing_bottom_section',
247
+		'type' => 'checkbox',
248
+		'std' => '0' // Default value to show home top section
249
+	),
250 250
 
251
-    array(
252
-        'name' => __('Upload listing no image', 'geodirectory'),
253
-        'desc' => '',
254
-        'id' => 'geodir_listing_no_img',
255
-        'type' => 'file',
256
-        'std' => '0' // Default value to show home top section
257
-    ),
251
+	array(
252
+		'name' => __('Upload listing no image', 'geodirectory'),
253
+		'desc' => '',
254
+		'id' => 'geodir_listing_no_img',
255
+		'type' => 'file',
256
+		'std' => '0' // Default value to show home top section
257
+	),
258 258
 
259
-    array(
260
-        'name' => __('Description word limit', 'geodirectory'),
261
-        'desc' => '',
262
-        'id' => 'geodir_desc_word_limit',
263
-        'type' => 'text',
264
-        'css' => 'min-width:300px;',
265
-        'std' => '50' // Default value to show home top section
266
-    ),
259
+	array(
260
+		'name' => __('Description word limit', 'geodirectory'),
261
+		'desc' => '',
262
+		'id' => 'geodir_desc_word_limit',
263
+		'type' => 'text',
264
+		'css' => 'min-width:300px;',
265
+		'std' => '50' // Default value to show home top section
266
+	),
267 267
 
268
-    array(
269
-        'name' => __('Hover listing map animation', 'geodirectory'),
270
-        'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
271
-        'id' => 'geodir_listing_hover_bounce_map_pin',
272
-        'type' => 'checkbox',
273
-        'std' => '1' // Default value to show home top section
274
-    ),
268
+	array(
269
+		'name' => __('Hover listing map animation', 'geodirectory'),
270
+		'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
271
+		'id' => 'geodir_listing_hover_bounce_map_pin',
272
+		'type' => 'checkbox',
273
+		'std' => '1' // Default value to show home top section
274
+	),
275 275
 
276
-    array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
276
+	array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
277 277
 
278 278
 
279
-    array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
279
+	array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
280 280
 
281
-    array(
282
-        'name' => __('New listing default status', 'geodirectory'),
283
-        'desc' => __('Select new listing default status.', 'geodirectory'),
284
-        'tip' => '',
285
-        'id' => 'geodir_new_post_default_status',
286
-        'css' => 'min-width:300px;',
287
-        'std' => 'publish',
288
-        'type' => 'select',
289
-        'class' => 'chosen_select',
290
-        'options' => array_unique(array(
291
-            'publish' => __('publish', 'geodirectory'),
292
-            'draft' => __('draft', 'geodirectory'),
293
-        ))
294
-    ),
281
+	array(
282
+		'name' => __('New listing default status', 'geodirectory'),
283
+		'desc' => __('Select new listing default status.', 'geodirectory'),
284
+		'tip' => '',
285
+		'id' => 'geodir_new_post_default_status',
286
+		'css' => 'min-width:300px;',
287
+		'std' => 'publish',
288
+		'type' => 'select',
289
+		'class' => 'chosen_select',
290
+		'options' => array_unique(array(
291
+			'publish' => __('publish', 'geodirectory'),
292
+			'draft' => __('draft', 'geodirectory'),
293
+		))
294
+	),
295 295
 
296
-    array(
297
-        'name' => __('New listings settings', 'geodirectory'),
298
-        'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
299
-        'id' => 'geodir_listing_new_days',
300
-        'type' => 'text',
301
-        'css' => 'min-width:300px;',
302
-        'std' => '30' // Default value for the page title - changed in settings
303
-    ),
296
+	array(
297
+		'name' => __('New listings settings', 'geodirectory'),
298
+		'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
299
+		'id' => 'geodir_listing_new_days',
300
+		'type' => 'text',
301
+		'css' => 'min-width:300px;',
302
+		'std' => '30' // Default value for the page title - changed in settings
303
+	),
304 304
 
305
-    array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
305
+	array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
306 306
 
307 307
 
308
-    array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
308
+	array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
309 309
 
310
-    array(
311
-        'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
312
-        'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
313
-        'id' => 'geodir_accept_term_condition',
314
-        'type' => 'checkbox',
315
-        'std' => '1' // Default value to show home top section
316
-    ),
310
+	array(
311
+		'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
312
+		'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
313
+		'id' => 'geodir_accept_term_condition',
314
+		'type' => 'checkbox',
315
+		'std' => '1' // Default value to show home top section
316
+	),
317 317
 
318 318
 
319
-    array(
320
-        'name' => __('Show description field as editor', 'geodirectory'),
321
-        'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
322
-        'tip' => '',
323
-        'id' => 'geodir_tiny_editor_on_add_listing',
324
-        'css' => 'min-width:300px;',
325
-        'std' => array(),
326
-        'type' => 'multiselect',
327
-        'placeholder_text' => __('Select post types', 'geodirectory'),
328
-        'class' => 'chosen_select',
329
-        'options' => array_unique(geodir_post_type_setting_fun())
330
-    ),
319
+	array(
320
+		'name' => __('Show description field as editor', 'geodirectory'),
321
+		'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
322
+		'tip' => '',
323
+		'id' => 'geodir_tiny_editor_on_add_listing',
324
+		'css' => 'min-width:300px;',
325
+		'std' => array(),
326
+		'type' => 'multiselect',
327
+		'placeholder_text' => __('Select post types', 'geodirectory'),
328
+		'class' => 'chosen_select',
329
+		'options' => array_unique(geodir_post_type_setting_fun())
330
+	),
331 331
 
332
-    array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
333
-    /* Listing Layout Settings end */
332
+	array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
333
+	/* Listing Layout Settings end */
334 334
 
335 335
 
336
-    /* Search Layout Settings end */
336
+	/* Search Layout Settings end */
337 337
 
338
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
338
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
339 339
 
340 340
 
341
-    array('name' => __('Search Page Layout Settings', 'geodirectory'),
342
-        'type' => 'sectionstart',
343
-        'desc' => '',
344
-        'id' => 'geodir_search_layout'),
341
+	array('name' => __('Search Page Layout Settings', 'geodirectory'),
342
+		'type' => 'sectionstart',
343
+		'desc' => '',
344
+		'id' => 'geodir_search_layout'),
345 345
 
346
-    array(
347
-        'name' => __('Search top section', 'geodirectory'),
348
-        'desc' => __('Show the top section of search page', 'geodirectory'),
349
-        'id' => 'geodir_show_search_top_section',
350
-        'type' => 'checkbox',
351
-        'std' => '1' // Default value to show home top section
352
-    ),
346
+	array(
347
+		'name' => __('Search top section', 'geodirectory'),
348
+		'desc' => __('Show the top section of search page', 'geodirectory'),
349
+		'id' => 'geodir_show_search_top_section',
350
+		'type' => 'checkbox',
351
+		'std' => '1' // Default value to show home top section
352
+	),
353 353
 
354
-    array(
355
-        'name' => __('Search right section', 'geodirectory'),
356
-        'desc' => __('Show the right section of search page', 'geodirectory'),
357
-        'id' => 'geodir_show_search_right_section',
358
-        'type' => 'checkbox',
359
-        'std' => '1' // Default value to show home top section
360
-    ),
354
+	array(
355
+		'name' => __('Search right section', 'geodirectory'),
356
+		'desc' => __('Show the right section of search page', 'geodirectory'),
357
+		'id' => 'geodir_show_search_right_section',
358
+		'type' => 'checkbox',
359
+		'std' => '1' // Default value to show home top section
360
+	),
361 361
 
362
-    array(
363
-        'name' => __('Width of search right section', 'geodirectory'),
364
-        'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
365
-        'id' => 'geodir_width_search_right_section',
366
-        'type' => 'text',
367
-        'css' => 'min-width:300px;',
368
-        'std' => '30' // Default value to show home top section
369
-    ),
362
+	array(
363
+		'name' => __('Width of search right section', 'geodirectory'),
364
+		'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
365
+		'id' => 'geodir_width_search_right_section',
366
+		'type' => 'text',
367
+		'css' => 'min-width:300px;',
368
+		'std' => '30' // Default value to show home top section
369
+	),
370 370
 
371 371
 
372
-    array(
373
-        'name' => __('Search content section view', 'geodirectory'),
374
-        'desc' => __('Set the listing view of search page', 'geodirectory'),
375
-        'id' => 'geodir_search_view',
376
-        'css' => 'min-width:300px;',
377
-        'std' => 'gridview_onehalf',
378
-        'type' => 'select',
379
-        'class' => 'chosen_select',
380
-        'options' => array_unique(array(
381
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
382
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
383
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
384
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
385
-            'listview' => __('List view', 'geodirectory'),
386
-        ))
387
-    ),
372
+	array(
373
+		'name' => __('Search content section view', 'geodirectory'),
374
+		'desc' => __('Set the listing view of search page', 'geodirectory'),
375
+		'id' => 'geodir_search_view',
376
+		'css' => 'min-width:300px;',
377
+		'std' => 'gridview_onehalf',
378
+		'type' => 'select',
379
+		'class' => 'chosen_select',
380
+		'options' => array_unique(array(
381
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
382
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
383
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
384
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
385
+			'listview' => __('List view', 'geodirectory'),
386
+		))
387
+	),
388 388
 
389
-    array(
390
-        'name' => __('Width of search content section', 'geodirectory'),
391
-        'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
392
-        'id' => 'geodir_width_search_contant_section',
393
-        'type' => 'text',
394
-        'css' => 'min-width:300px;',
395
-        'std' => '63' // Default value to show home top section
396
-    ),
389
+	array(
390
+		'name' => __('Width of search content section', 'geodirectory'),
391
+		'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
392
+		'id' => 'geodir_width_search_contant_section',
393
+		'type' => 'text',
394
+		'css' => 'min-width:300px;',
395
+		'std' => '63' // Default value to show home top section
396
+	),
397 397
 
398
-    array(
399
-        'name' => __('Search left section', 'geodirectory'),
400
-        'desc' => __('Show the left section of search page', 'geodirectory'),
401
-        'id' => 'geodir_show_search_left_section',
402
-        'type' => 'checkbox',
403
-        'std' => '0' // Default value to show home top section
404
-    ),
398
+	array(
399
+		'name' => __('Search left section', 'geodirectory'),
400
+		'desc' => __('Show the left section of search page', 'geodirectory'),
401
+		'id' => 'geodir_show_search_left_section',
402
+		'type' => 'checkbox',
403
+		'std' => '0' // Default value to show home top section
404
+	),
405 405
 
406
-    array(
407
-        'name' => __('Width of search left section', 'geodirectory'),
408
-        'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
409
-        'id' => 'geodir_width_search_left_section',
410
-        'type' => 'text',
411
-        'css' => 'min-width:300px;',
412
-        'std' => '30' // Default value to show home top section
413
-    ),
406
+	array(
407
+		'name' => __('Width of search left section', 'geodirectory'),
408
+		'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
409
+		'id' => 'geodir_width_search_left_section',
410
+		'type' => 'text',
411
+		'css' => 'min-width:300px;',
412
+		'std' => '30' // Default value to show home top section
413
+	),
414 414
 
415
-    array(
416
-        'name' => __('Search bottom section', 'geodirectory'),
417
-        'desc' => __('Show the bottom section of search page', 'geodirectory'),
418
-        'id' => 'geodir_show_search_bottom_section',
419
-        'type' => 'checkbox',
420
-        'std' => '0' // Default value to show home top section
421
-    ),
415
+	array(
416
+		'name' => __('Search bottom section', 'geodirectory'),
417
+		'desc' => __('Show the bottom section of search page', 'geodirectory'),
418
+		'id' => 'geodir_show_search_bottom_section',
419
+		'type' => 'checkbox',
420
+		'std' => '0' // Default value to show home top section
421
+	),
422 422
 	
423 423
 	array(
424
-        'name' => __('Show advanced pagination details', 'geodirectory'),
425
-        'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
426
-        'id' => 'geodir_pagination_advance_info',
427
-        'css' => 'min-width:300px;',
428
-        'std' => '',
429
-        'type' => 'select',
430
-        'class' => 'chosen_select',
431
-        'options' => array(
424
+		'name' => __('Show advanced pagination details', 'geodirectory'),
425
+		'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
426
+		'id' => 'geodir_pagination_advance_info',
427
+		'css' => 'min-width:300px;',
428
+		'std' => '',
429
+		'type' => 'select',
430
+		'class' => 'chosen_select',
431
+		'options' => array(
432 432
 						'' => __('Never Display', 'geodirectory'),
433 433
 						'after' => __('After Pagination', 'geodirectory'),
434 434
 						'before' => __('Before Pagination', 'geodirectory')
435 435
 					)
436
-    ),
436
+	),
437 437
 
438
-    array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
438
+	array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
439 439
 
440 440
 
441
-    array('name' => __('Search form default text settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
441
+	array('name' => __('Search form default text settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
442 442
 
443
-    array(
444
-        'name' => __('Search field default value', 'geodirectory'),
445
-        'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
446
-        'id' => 'geodir_search_field_default_text',
447
-        'type' => 'text',
448
-        'css' => 'min-width:300px;',
449
-        'std' => 'Search for' // show on the listing page.
450
-    ),
443
+	array(
444
+		'name' => __('Search field default value', 'geodirectory'),
445
+		'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
446
+		'id' => 'geodir_search_field_default_text',
447
+		'type' => 'text',
448
+		'css' => 'min-width:300px;',
449
+		'std' => 'Search for' // show on the listing page.
450
+	),
451 451
 
452
-    array(
453
-        'name' => __('Near field default value', 'geodirectory'),
454
-        'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
455
-        'id' => 'geodir_near_field_default_text',
456
-        'type' => 'text',
457
-        'css' => 'min-width:300px;',
458
-        'std' => 'Near' // show on the listing page.
459
-    ),
452
+	array(
453
+		'name' => __('Near field default value', 'geodirectory'),
454
+		'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
455
+		'id' => 'geodir_near_field_default_text',
456
+		'type' => 'text',
457
+		'css' => 'min-width:300px;',
458
+		'std' => 'Near' // show on the listing page.
459
+	),
460 460
 
461
-    array(
462
-        'name' => __('Search button label', 'geodirectory'),
463
-        'desc' => __('Show the search button label on search form.', 'geodirectory'),
464
-        'id' => 'geodir_search_button_label',
465
-        'type' => 'text',
466
-        'css' => 'min-width:300px;',
467
-        'std' => 'Search' // show on the listing page.
468
-    ),
461
+	array(
462
+		'name' => __('Search button label', 'geodirectory'),
463
+		'desc' => __('Show the search button label on search form.', 'geodirectory'),
464
+		'id' => 'geodir_search_button_label',
465
+		'type' => 'text',
466
+		'css' => 'min-width:300px;',
467
+		'std' => 'Search' // show on the listing page.
468
+	),
469 469
 
470
-    array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
470
+	array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
471 471
 
472
-    /* Listing Layout Settings end */
472
+	/* Listing Layout Settings end */
473 473
 
474 474
 
475
-    /* Detail Layout Settings end */
475
+	/* Detail Layout Settings end */
476 476
 
477
-    array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
477
+	array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
478 478
 
479
-    array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
479
+	array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
480 480
 
481
-    array(
482
-        'name' => __('Detail top section', 'geodirectory'),
483
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
484
-        'id' => 'geodir_show_detail_top_section',
485
-        'type' => 'checkbox',
486
-        'std' => '1' // Default value to show home top section
487
-    ),
481
+	array(
482
+		'name' => __('Detail top section', 'geodirectory'),
483
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
484
+		'id' => 'geodir_show_detail_top_section',
485
+		'type' => 'checkbox',
486
+		'std' => '1' // Default value to show home top section
487
+	),
488 488
 
489
-    array(
490
-        'name' => __('Detail bottom section', 'geodirectory'),
491
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
492
-        'id' => 'geodir_show_detail_bottom_section',
493
-        'type' => 'checkbox',
494
-        'std' => '1' // Default value to show home top section
495
-    ),
496
-    array(
497
-        'name' => __('Detail sidebar section on left side', 'geodirectory'),
498
-        'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
499
-        'id' => 'geodir_detail_sidebar_left_section',
500
-        'type' => 'checkbox',
501
-        'std' => '0'
502
-    ),
503
-    array(
504
-        'name' => __('Disable GD modal', 'geodirectory'),
505
-        'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
506
-        'id' => 'geodir_disable_gb_modal',
507
-        'type' => 'checkbox',
508
-        'std' => '0'
509
-    ),
510
-    array(
511
-        'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
512
-        'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
513
-        'id' => 'geodir_disable_tfg_buttons_section',
514
-        'type' => 'checkbox',
515
-        'std' => '0'
516
-    ),
517
-    array(
518
-        'name' => __('Disable share this button section', 'geodirectory'),
519
-        'desc' => __('Disable share this button section that displays on Detail page sidebar', 'geodirectory'),
520
-        'id' => 'geodir_disable_sharethis_button_section',
521
-        'type' => 'checkbox',
522
-        'std' => '0'
523
-    ),
524
-    array(
525
-        'name' => __('Disable Google Analytics section', 'geodirectory'),
526
-        'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
527
-        'id' => 'geodir_disable_google_analytics_section',
528
-        'type' => 'checkbox',
529
-        'std' => '0'
530
-    ),
531
-    array(
532
-        'name' => __('Disable User Links section', 'geodirectory'),
533
-        'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
534
-        'id' => 'geodir_disable_user_links_section',
535
-        'type' => 'checkbox',
536
-        'std' => '0'
537
-    ),
538
-    array(
539
-        'name' => __('Disable Rating Info section', 'geodirectory'),
540
-        'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
541
-        'id' => 'geodir_disable_rating_info_section',
542
-        'type' => 'checkbox',
543
-        'std' => '0'
544
-    ),
545
-    array(
546
-        'name' => __('Disable Listing Info section', 'geodirectory'),
547
-        'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
548
-        'id' => 'geodir_disable_listing_info_section',
549
-        'type' => 'checkbox',
550
-        'std' => '0'
551
-    ),
489
+	array(
490
+		'name' => __('Detail bottom section', 'geodirectory'),
491
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
492
+		'id' => 'geodir_show_detail_bottom_section',
493
+		'type' => 'checkbox',
494
+		'std' => '1' // Default value to show home top section
495
+	),
496
+	array(
497
+		'name' => __('Detail sidebar section on left side', 'geodirectory'),
498
+		'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
499
+		'id' => 'geodir_detail_sidebar_left_section',
500
+		'type' => 'checkbox',
501
+		'std' => '0'
502
+	),
503
+	array(
504
+		'name' => __('Disable GD modal', 'geodirectory'),
505
+		'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
506
+		'id' => 'geodir_disable_gb_modal',
507
+		'type' => 'checkbox',
508
+		'std' => '0'
509
+	),
510
+	array(
511
+		'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
512
+		'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
513
+		'id' => 'geodir_disable_tfg_buttons_section',
514
+		'type' => 'checkbox',
515
+		'std' => '0'
516
+	),
517
+	array(
518
+		'name' => __('Disable share this button section', 'geodirectory'),
519
+		'desc' => __('Disable share this button section that displays on Detail page sidebar', 'geodirectory'),
520
+		'id' => 'geodir_disable_sharethis_button_section',
521
+		'type' => 'checkbox',
522
+		'std' => '0'
523
+	),
524
+	array(
525
+		'name' => __('Disable Google Analytics section', 'geodirectory'),
526
+		'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
527
+		'id' => 'geodir_disable_google_analytics_section',
528
+		'type' => 'checkbox',
529
+		'std' => '0'
530
+	),
531
+	array(
532
+		'name' => __('Disable User Links section', 'geodirectory'),
533
+		'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
534
+		'id' => 'geodir_disable_user_links_section',
535
+		'type' => 'checkbox',
536
+		'std' => '0'
537
+	),
538
+	array(
539
+		'name' => __('Disable Rating Info section', 'geodirectory'),
540
+		'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
541
+		'id' => 'geodir_disable_rating_info_section',
542
+		'type' => 'checkbox',
543
+		'std' => '0'
544
+	),
545
+	array(
546
+		'name' => __('Disable Listing Info section', 'geodirectory'),
547
+		'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
548
+		'id' => 'geodir_disable_listing_info_section',
549
+		'type' => 'checkbox',
550
+		'std' => '0'
551
+	),
552 552
 
553
-    array('type' => 'sectionend', 'id' => 'detail_page_settings'),
553
+	array('type' => 'sectionend', 'id' => 'detail_page_settings'),
554 554
 
555 555
 
556
-    /* ---------- DETAIL PAGE TAB SETTING START*/
556
+	/* ---------- DETAIL PAGE TAB SETTING START*/
557 557
 
558
-    array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
558
+	array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
559 559
 
560
-    array(
561
-        'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
562
-        'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
563
-        'tip' => '',
564
-        'id' => 'geodir_detail_page_tabs_excluded',
565
-        'css' => 'min-width:300px;',
566
-        'std' => geodir_get_posttypes(),
567
-        'type' => 'multiselect',
568
-        'placeholder_text' => __('Select tabs', 'geodirectory'),
569
-        'class' => 'chosen_select',
570
-        'options' => array_unique(geodir_detail_page_tabs_key_value_array())
571
-    ),
560
+	array(
561
+		'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
562
+		'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
563
+		'tip' => '',
564
+		'id' => 'geodir_detail_page_tabs_excluded',
565
+		'css' => 'min-width:300px;',
566
+		'std' => geodir_get_posttypes(),
567
+		'type' => 'multiselect',
568
+		'placeholder_text' => __('Select tabs', 'geodirectory'),
569
+		'class' => 'chosen_select',
570
+		'options' => array_unique(geodir_detail_page_tabs_key_value_array())
571
+	),
572 572
     
573
-    array(
574
-        'name' => __('Show as list', 'geodirectory'),
575
-        'desc' => __('Show as list instead of tabs', 'geodirectory'),
576
-        'id' => 'geodir_disable_tabs',
577
-        'type' => 'checkbox',
578
-        'std' => '0'
579
-    ),
573
+	array(
574
+		'name' => __('Show as list', 'geodirectory'),
575
+		'desc' => __('Show as list instead of tabs', 'geodirectory'),
576
+		'id' => 'geodir_disable_tabs',
577
+		'type' => 'checkbox',
578
+		'std' => '0'
579
+	),
580 580
 
581
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
582
-    /* ---------- DETAIL PAGE TAB SETTING END*/
581
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
582
+	/* ---------- DETAIL PAGE TAB SETTING END*/
583 583
 
584
-    /* START DEFAULT STAR IMAGE*/
585
-    array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
584
+	/* START DEFAULT STAR IMAGE*/
585
+	array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
586 586
 
587
-    array(
588
-        'name' => __('Upload default rating star icon', 'geodirectory'),
589
-        'desc' => '',
590
-        'id' => 'geodir_default_rating_star_icon',
591
-        'type' => 'file',
592
-        'std' => '0',
593
-        'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
594
-    ),
587
+	array(
588
+		'name' => __('Upload default rating star icon', 'geodirectory'),
589
+		'desc' => '',
590
+		'id' => 'geodir_default_rating_star_icon',
591
+		'type' => 'file',
592
+		'std' => '0',
593
+		'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
594
+	),
595 595
 	array(
596 596
 		'name' => __('Enable Font Awesome', 'geodirectory'),
597 597
 		'desc' => __('When enabled all rating images will be using font awesome rating icons as images.', 'geodirectory' ),
@@ -607,369 +607,369 @@  discard block
 block discarded – undo
607 607
 		'std' => '#757575'
608 608
 	),
609 609
 
610
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
610
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
611 611
 
612
-    /* END DEFAULT STAR IMAGE*/
612
+	/* END DEFAULT STAR IMAGE*/
613 613
 
614
-    /* Detail related post settings start */
614
+	/* Detail related post settings start */
615 615
 
616
-    array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
616
+	array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
617 617
 
618
-    array(
619
-        'name' => __('Show related post listing on', 'geodirectory'),
620
-        'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
621
-        'tip' => '',
622
-        'id' => 'geodir_add_related_listing_posttypes',
623
-        'css' => 'min-width:300px;',
624
-        'std' => geodir_get_posttypes(),
625
-        'type' => 'multiselect',
626
-        'placeholder_text' => __('Select post types', 'geodirectory'),
627
-        'class' => 'chosen_select',
628
-        'options' => array_unique(geodir_post_type_setting_fun())
629
-    ),
618
+	array(
619
+		'name' => __('Show related post listing on', 'geodirectory'),
620
+		'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
621
+		'tip' => '',
622
+		'id' => 'geodir_add_related_listing_posttypes',
623
+		'css' => 'min-width:300px;',
624
+		'std' => geodir_get_posttypes(),
625
+		'type' => 'multiselect',
626
+		'placeholder_text' => __('Select post types', 'geodirectory'),
627
+		'class' => 'chosen_select',
628
+		'options' => array_unique(geodir_post_type_setting_fun())
629
+	),
630 630
 
631
-    array(
632
-        'name' => __('Relate to', 'geodirectory'),
633
-        'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
634
-        'id' => 'geodir_related_post_relate_to',
635
-        'css' => 'min-width:300px;',
636
-        'std' => 'category',
637
-        'type' => 'select',
638
-        'class' => 'chosen_select',
639
-        'options' => array_unique(array(
640
-            'category' => __('Categories', 'geodirectory'),
641
-            'tags' => __('Tags', 'geodirectory'),
642
-        ))
643
-    ),
631
+	array(
632
+		'name' => __('Relate to', 'geodirectory'),
633
+		'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
634
+		'id' => 'geodir_related_post_relate_to',
635
+		'css' => 'min-width:300px;',
636
+		'std' => 'category',
637
+		'type' => 'select',
638
+		'class' => 'chosen_select',
639
+		'options' => array_unique(array(
640
+			'category' => __('Categories', 'geodirectory'),
641
+			'tags' => __('Tags', 'geodirectory'),
642
+		))
643
+	),
644 644
 
645
-    array(
646
-        'name' => __('Layout', 'geodirectory'),
647
-        'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
648
-        'id' => 'geodir_related_post_listing_view',
649
-        'css' => 'min-width:300px;',
650
-        'std' => 'gridview_onehalf',
651
-        'type' => 'select',
652
-        'class' => 'chosen_select',
653
-        'options' => array_unique(array(
654
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
655
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
656
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
657
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
658
-            'listview' => __('List view', 'geodirectory'),
659
-        ))
660
-    ),
645
+	array(
646
+		'name' => __('Layout', 'geodirectory'),
647
+		'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
648
+		'id' => 'geodir_related_post_listing_view',
649
+		'css' => 'min-width:300px;',
650
+		'std' => 'gridview_onehalf',
651
+		'type' => 'select',
652
+		'class' => 'chosen_select',
653
+		'options' => array_unique(array(
654
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
655
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
656
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
657
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
658
+			'listview' => __('List view', 'geodirectory'),
659
+		))
660
+	),
661 661
 
662
-    array(
663
-        'name' => __('Sort by', 'geodirectory'),
664
-        'desc' => __('Set the related post listing sort by view', 'geodirectory'),
665
-        'id' => 'geodir_related_post_sortby',
666
-        'css' => 'min-width:300px;',
667
-        'std' => 'latest',
668
-        'type' => 'select',
669
-        'class' => 'chosen_select',
670
-        'options' => array_unique(array(
671
-            'latest' => __('Latest', 'geodirectory'),
672
-            'featured' => __('Featured', 'geodirectory'),
673
-            'high_review' => __('Review', 'geodirectory'),
674
-            'high_rating' => __('Rating', 'geodirectory'),
675
-            'random' => __('Random', 'geodirectory'),
676
-            'nearest' => __('Nearest', 'geodirectory'),
677
-        ))
678
-    ),
662
+	array(
663
+		'name' => __('Sort by', 'geodirectory'),
664
+		'desc' => __('Set the related post listing sort by view', 'geodirectory'),
665
+		'id' => 'geodir_related_post_sortby',
666
+		'css' => 'min-width:300px;',
667
+		'std' => 'latest',
668
+		'type' => 'select',
669
+		'class' => 'chosen_select',
670
+		'options' => array_unique(array(
671
+			'latest' => __('Latest', 'geodirectory'),
672
+			'featured' => __('Featured', 'geodirectory'),
673
+			'high_review' => __('Review', 'geodirectory'),
674
+			'high_rating' => __('Rating', 'geodirectory'),
675
+			'random' => __('Random', 'geodirectory'),
676
+			'nearest' => __('Nearest', 'geodirectory'),
677
+		))
678
+	),
679 679
 
680
-    array(
681
-        'name' => __('Number of posts:', 'geodirectory'),
682
-        'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
683
-        'id' => 'geodir_related_post_count',
684
-        'type' => 'text',
685
-        'css' => 'min-width:300px;',
686
-        'std' => '5' // Default value to show home top section
687
-    ),
680
+	array(
681
+		'name' => __('Number of posts:', 'geodirectory'),
682
+		'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
683
+		'id' => 'geodir_related_post_count',
684
+		'type' => 'text',
685
+		'css' => 'min-width:300px;',
686
+		'std' => '5' // Default value to show home top section
687
+	),
688 688
 
689
-    array(
690
-        'name' => __('Post excerpt', 'geodirectory'),
691
-        'desc' => __('Post content excerpt character count', 'geodirectory'),
692
-        'id' => 'geodir_related_post_excerpt',
693
-        'type' => 'text',
694
-        'css' => 'min-width:300px;',
695
-        'std' => '20' // Default value to show home top section
696
-    ),
689
+	array(
690
+		'name' => __('Post excerpt', 'geodirectory'),
691
+		'desc' => __('Post content excerpt character count', 'geodirectory'),
692
+		'id' => 'geodir_related_post_excerpt',
693
+		'type' => 'text',
694
+		'css' => 'min-width:300px;',
695
+		'std' => '20' // Default value to show home top section
696
+	),
697 697
 
698 698
 
699
-    array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
700
-    /* Detail Layout Settings end */
699
+	array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
700
+	/* Detail Layout Settings end */
701 701
 
702
-    /* Author Layout Settings Start */
702
+	/* Author Layout Settings Start */
703 703
 
704
-    array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
704
+	array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
705 705
 
706 706
 
707
-    array('name' => __('Author Page Layout Settings', 'geodirectory'),
708
-        'type' => 'sectionstart',
709
-        'desc' => '',
710
-        'id' => 'geodir_author_layout'),
707
+	array('name' => __('Author Page Layout Settings', 'geodirectory'),
708
+		'type' => 'sectionstart',
709
+		'desc' => '',
710
+		'id' => 'geodir_author_layout'),
711 711
 
712
-    array(
713
-        'name' => __('Author top section', 'geodirectory'),
714
-        'desc' => __('Show the top section of author page', 'geodirectory'),
715
-        'id' => 'geodir_show_author_top_section',
716
-        'type' => 'checkbox',
717
-        'std' => '1' // Default value to show home top section
718
-    ),
712
+	array(
713
+		'name' => __('Author top section', 'geodirectory'),
714
+		'desc' => __('Show the top section of author page', 'geodirectory'),
715
+		'id' => 'geodir_show_author_top_section',
716
+		'type' => 'checkbox',
717
+		'std' => '1' // Default value to show home top section
718
+	),
719 719
 
720
-    array(
721
-        'name' => __('Author right section', 'geodirectory'),
722
-        'desc' => __('Show the right section of author page', 'geodirectory'),
723
-        'id' => 'geodir_show_author_right_section',
724
-        'type' => 'checkbox',
725
-        'std' => '1' // Default value to show home top section
726
-    ),
720
+	array(
721
+		'name' => __('Author right section', 'geodirectory'),
722
+		'desc' => __('Show the right section of author page', 'geodirectory'),
723
+		'id' => 'geodir_show_author_right_section',
724
+		'type' => 'checkbox',
725
+		'std' => '1' // Default value to show home top section
726
+	),
727 727
 
728
-    array(
729
-        'name' => __('Width of author right section', 'geodirectory'),
730
-        'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
731
-        'id' => 'geodir_width_author_right_section',
732
-        'type' => 'text',
733
-        'css' => 'min-width:300px;',
734
-        'std' => '30' // Default value to show home top section
735
-    ),
728
+	array(
729
+		'name' => __('Width of author right section', 'geodirectory'),
730
+		'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
731
+		'id' => 'geodir_width_author_right_section',
732
+		'type' => 'text',
733
+		'css' => 'min-width:300px;',
734
+		'std' => '30' // Default value to show home top section
735
+	),
736 736
 
737
-    array(
738
-        'name' => __('Author content section view', 'geodirectory'),
739
-        'desc' => __('Set the listing view of author page', 'geodirectory'),
740
-        'id' => 'geodir_author_view',
741
-        'css' => 'min-width:300px;',
742
-        'std' => 'gridview_onehalf',
743
-        'type' => 'select',
744
-        'class' => 'chosen_select',
745
-        'options' => array_unique(array(
746
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
747
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
748
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
749
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
750
-            'listview' => __('List view', 'geodirectory'),
751
-        ))
752
-    ),
737
+	array(
738
+		'name' => __('Author content section view', 'geodirectory'),
739
+		'desc' => __('Set the listing view of author page', 'geodirectory'),
740
+		'id' => 'geodir_author_view',
741
+		'css' => 'min-width:300px;',
742
+		'std' => 'gridview_onehalf',
743
+		'type' => 'select',
744
+		'class' => 'chosen_select',
745
+		'options' => array_unique(array(
746
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
747
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
748
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
749
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
750
+			'listview' => __('List view', 'geodirectory'),
751
+		))
752
+	),
753 753
 
754
-    array(
755
-        'name' => __('Width of author content section', 'geodirectory'),
756
-        'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
757
-        'id' => 'geodir_width_author_contant_section',
758
-        'type' => 'text',
759
-        'css' => 'min-width:300px;',
760
-        'std' => '63' // Default value to show home top section
761
-    ),
754
+	array(
755
+		'name' => __('Width of author content section', 'geodirectory'),
756
+		'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
757
+		'id' => 'geodir_width_author_contant_section',
758
+		'type' => 'text',
759
+		'css' => 'min-width:300px;',
760
+		'std' => '63' // Default value to show home top section
761
+	),
762 762
 
763
-    array(
764
-        'name' => __('Author left section', 'geodirectory'),
765
-        'desc' => __('Show the left section of author page', 'geodirectory'),
766
-        'id' => 'geodir_show_author_left_section',
767
-        'type' => 'checkbox',
768
-        'std' => '0' // Default value to show home top section
769
-    ),
763
+	array(
764
+		'name' => __('Author left section', 'geodirectory'),
765
+		'desc' => __('Show the left section of author page', 'geodirectory'),
766
+		'id' => 'geodir_show_author_left_section',
767
+		'type' => 'checkbox',
768
+		'std' => '0' // Default value to show home top section
769
+	),
770 770
 
771
-    array(
772
-        'name' => __('Width of author left section', 'geodirectory'),
773
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
774
-        'id' => 'geodir_width_author_left_section',
775
-        'type' => 'text',
776
-        'css' => 'min-width:300px;',
777
-        'std' => '30' // Default value to show home top section
778
-    ),
771
+	array(
772
+		'name' => __('Width of author left section', 'geodirectory'),
773
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
774
+		'id' => 'geodir_width_author_left_section',
775
+		'type' => 'text',
776
+		'css' => 'min-width:300px;',
777
+		'std' => '30' // Default value to show home top section
778
+	),
779 779
 
780
-    array(
781
-        'name' => __('Author bottom section', 'geodirectory'),
782
-        'desc' => __('Show the bottom section of author page', 'geodirectory'),
783
-        'id' => 'geodir_show_author_bottom_section',
784
-        'type' => 'checkbox',
785
-        'std' => '0' // Default value to show home top section
786
-    ),
780
+	array(
781
+		'name' => __('Author bottom section', 'geodirectory'),
782
+		'desc' => __('Show the bottom section of author page', 'geodirectory'),
783
+		'id' => 'geodir_show_author_bottom_section',
784
+		'type' => 'checkbox',
785
+		'std' => '0' // Default value to show home top section
786
+	),
787 787
 
788 788
 
789
-    array(
790
-        'name' => __('Description word limit', 'geodirectory'),
791
-        'desc' => '',
792
-        'id' => 'geodir_author_desc_word_limit',
793
-        'type' => 'text',
794
-        'css' => 'min-width:300px;',
795
-        'std' => '50' // Default value to show home top section
796
-    ),
789
+	array(
790
+		'name' => __('Description word limit', 'geodirectory'),
791
+		'desc' => '',
792
+		'id' => 'geodir_author_desc_word_limit',
793
+		'type' => 'text',
794
+		'css' => 'min-width:300px;',
795
+		'std' => '50' // Default value to show home top section
796
+	),
797 797
 
798
-    array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
799
-    /* Author Layout Settings end */
798
+	array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
799
+	/* Author Layout Settings end */
800 800
 
801 801
 
802
-    /* Post Type Navigation Settings Start */
803
-    array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
802
+	/* Post Type Navigation Settings Start */
803
+	array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
804 804
 
805 805
 
806
-    /* Post Type Navigation Settings Start */
806
+	/* Post Type Navigation Settings Start */
807 807
 
808
-    array('name' => __('Navigation Locations', 'geodirectory'),
809
-        'type' => 'sectionstart',
810
-        'desc' => '',
811
-        'id' => 'geodir_navigation_locations'),
808
+	array('name' => __('Navigation Locations', 'geodirectory'),
809
+		'type' => 'sectionstart',
810
+		'desc' => '',
811
+		'id' => 'geodir_navigation_locations'),
812 812
 
813
-    array(
814
-        'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
815
-        'desc' => '',
816
-        'tip' => '',
817
-        'id' => 'geodir_theme_location_nav',
818
-        'css' => 'min-width:300px;',
819
-        'std' => array(),
820
-        'type' => 'multiselect',
821
-        'placeholder_text' => __('Select menu locations', 'geodirectory'),
822
-        'class' => 'chosen_select',
823
-        'options' => array_unique(geodir_theme_location_setting_fun())
824
-    ),
825
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
826
-
827
-
828
-    array('name' => __('Navigation Settings', 'geodirectory'),
829
-        'type' => 'sectionstart',
830
-        'desc' => '',
831
-        'id' => 'geodir_navigation_options'),
813
+	array(
814
+		'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
815
+		'desc' => '',
816
+		'tip' => '',
817
+		'id' => 'geodir_theme_location_nav',
818
+		'css' => 'min-width:300px;',
819
+		'std' => array(),
820
+		'type' => 'multiselect',
821
+		'placeholder_text' => __('Select menu locations', 'geodirectory'),
822
+		'class' => 'chosen_select',
823
+		'options' => array_unique(geodir_theme_location_setting_fun())
824
+	),
825
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
832 826
 
833 827
 
834
-    array(
835
-        'name' => __('Show add listing navigation in menu', 'geodirectory'),
836
-        'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
837
-        'id' => 'geodir_show_addlisting_nav',
838
-        'std' => '1',
839
-        'type' => 'checkbox'
840
-    ),
828
+	array('name' => __('Navigation Settings', 'geodirectory'),
829
+		'type' => 'sectionstart',
830
+		'desc' => '',
831
+		'id' => 'geodir_navigation_options'),
841 832
 
842
-    array(
843
-        'name' => __('Show listings navigation in menu', 'geodirectory'),
844
-        'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
845
-        'id' => 'geodir_show_listing_nav',
846
-        'std' => '1',
847
-        'type' => 'checkbox'
848
-    ),
849 833
 
850
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
834
+	array(
835
+		'name' => __('Show add listing navigation in menu', 'geodirectory'),
836
+		'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
837
+		'id' => 'geodir_show_addlisting_nav',
838
+		'std' => '1',
839
+		'type' => 'checkbox'
840
+	),
851 841
 
842
+	array(
843
+		'name' => __('Show listings navigation in menu', 'geodirectory'),
844
+		'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
845
+		'id' => 'geodir_show_listing_nav',
846
+		'std' => '1',
847
+		'type' => 'checkbox'
848
+	),
852 849
 
853
-    array('name' => __('Post Type Navigation Settings', 'geodirectory'),
854
-        'type' => 'sectionstart',
855
-        'desc' => '',
856
-        'id' => 'geodir_post_type_navigation_layout'),
857
-    array(
858
-        'name' => __('Show listing link in main navigation', 'geodirectory'),
859
-        'desc' => '',
860
-        'tip' => '',
861
-        'id' => 'geodir_add_posttype_in_main_nav',
862
-        'css' => 'min-width:300px;',
863
-        'std' => array(),
864
-        'type' => 'multiselect',
865
-        'placeholder_text' => __('Select post types', 'geodirectory'),
866
-        'class' => 'chosen_select',
867
-        'options' => array_unique(geodir_post_type_setting_fun())
868
-    ),
850
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
869 851
 
870
-    array(
871
-        'name' => __('Show listing link in listing navigation', 'geodirectory'),
872
-        'desc' => '',
873
-        'tip' => '',
874
-        'id' => 'geodir_add_posttype_in_listing_nav',
875
-        'css' => 'min-width:300px;',
876
-        'std' => geodir_get_posttypes(),
877
-        'type' => 'multiselect',
878
-        'placeholder_text' => __('Select post types', 'geodirectory'),
879
-        'class' => 'chosen_select',
880
-        'options' => array_unique(geodir_post_type_setting_fun())
881
-    ),
882 852
 
883
-    array(
884
-        'name' => __('Allow post type to add from frontend', 'geodirectory'),
885
-        'desc' => '',
886
-        'tip' => '',
887
-        'id' => 'geodir_allow_posttype_frontend',
888
-        'css' => 'min-width:300px;',
889
-        'std' => geodir_get_posttypes(),
890
-        'type' => 'multiselect',
891
-        'placeholder_text' => __('Select post types', 'geodirectory'),
892
-        'class' => 'chosen_select',
893
-        'options' => array_unique(geodir_post_type_setting_fun())
894
-    ),
853
+	array('name' => __('Post Type Navigation Settings', 'geodirectory'),
854
+		'type' => 'sectionstart',
855
+		'desc' => '',
856
+		'id' => 'geodir_post_type_navigation_layout'),
857
+	array(
858
+		'name' => __('Show listing link in main navigation', 'geodirectory'),
859
+		'desc' => '',
860
+		'tip' => '',
861
+		'id' => 'geodir_add_posttype_in_main_nav',
862
+		'css' => 'min-width:300px;',
863
+		'std' => array(),
864
+		'type' => 'multiselect',
865
+		'placeholder_text' => __('Select post types', 'geodirectory'),
866
+		'class' => 'chosen_select',
867
+		'options' => array_unique(geodir_post_type_setting_fun())
868
+	),
895 869
 
896
-    array(
897
-        'name' => __('Show add listing link in main navigation', 'geodirectory'),
898
-        'desc' => '',
899
-        'tip' => '',
900
-        'id' => 'geodir_add_listing_link_main_nav',
901
-        'css' => 'min-width:300px;',
902
-        'std' => array(),
903
-        'type' => 'multiselect',
904
-        'placeholder_text' => __('Select post types', 'geodirectory'),
905
-        'class' => 'chosen_select',
906
-        'options' => array_unique(geodir_post_type_setting_fun())
907
-    ),
870
+	array(
871
+		'name' => __('Show listing link in listing navigation', 'geodirectory'),
872
+		'desc' => '',
873
+		'tip' => '',
874
+		'id' => 'geodir_add_posttype_in_listing_nav',
875
+		'css' => 'min-width:300px;',
876
+		'std' => geodir_get_posttypes(),
877
+		'type' => 'multiselect',
878
+		'placeholder_text' => __('Select post types', 'geodirectory'),
879
+		'class' => 'chosen_select',
880
+		'options' => array_unique(geodir_post_type_setting_fun())
881
+	),
908 882
 
909
-    array(
910
-        'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
911
-        'desc' => '',
912
-        'tip' => '',
913
-        'id' => 'geodir_add_listing_link_add_listing_nav',
914
-        'css' => 'min-width:300px;',
915
-        'std' => geodir_get_posttypes(),
916
-        'type' => 'multiselect',
917
-        'class' => 'chosen_select',
918
-        'options' => array_unique(geodir_post_type_setting_fun())
919
-    ),
883
+	array(
884
+		'name' => __('Allow post type to add from frontend', 'geodirectory'),
885
+		'desc' => '',
886
+		'tip' => '',
887
+		'id' => 'geodir_allow_posttype_frontend',
888
+		'css' => 'min-width:300px;',
889
+		'std' => geodir_get_posttypes(),
890
+		'type' => 'multiselect',
891
+		'placeholder_text' => __('Select post types', 'geodirectory'),
892
+		'class' => 'chosen_select',
893
+		'options' => array_unique(geodir_post_type_setting_fun())
894
+	),
920 895
 
921
-    array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
896
+	array(
897
+		'name' => __('Show add listing link in main navigation', 'geodirectory'),
898
+		'desc' => '',
899
+		'tip' => '',
900
+		'id' => 'geodir_add_listing_link_main_nav',
901
+		'css' => 'min-width:300px;',
902
+		'std' => array(),
903
+		'type' => 'multiselect',
904
+		'placeholder_text' => __('Select post types', 'geodirectory'),
905
+		'class' => 'chosen_select',
906
+		'options' => array_unique(geodir_post_type_setting_fun())
907
+	),
922 908
 
909
+	array(
910
+		'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
911
+		'desc' => '',
912
+		'tip' => '',
913
+		'id' => 'geodir_add_listing_link_add_listing_nav',
914
+		'css' => 'min-width:300px;',
915
+		'std' => geodir_get_posttypes(),
916
+		'type' => 'multiselect',
917
+		'class' => 'chosen_select',
918
+		'options' => array_unique(geodir_post_type_setting_fun())
919
+	),
923 920
 
924
-    array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
921
+	array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
925 922
 
926 923
 
927
-    array(
928
-        'name' => __('Show add listing link in user dashboard', 'geodirectory'),
929
-        'desc' => '',
930
-        'tip' => '',
931
-        'id' => 'geodir_add_listing_link_user_dashboard',
932
-        'css' => 'min-width:300px;',
933
-        'std' => geodir_get_posttypes(),
934
-        'type' => 'multiselect',
935
-        'placeholder_text' => __('Select post types', 'geodirectory'),
936
-        'class' => 'chosen_select',
937
-        'options' => array_unique(geodir_post_type_setting_fun())
938
-    ),
924
+	array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
939 925
 
940
-    array(
941
-        'name' => __('Show favorite link in user dashboard', 'geodirectory'),
942
-        'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
943
-        'tip' => '',
944
-        'id' => 'geodir_favorite_link_user_dashboard',
945
-        'css' => 'min-width:300px;',
946
-        'std' => geodir_get_posttypes(),
947
-        'type' => 'multiselect',
948
-        'placeholder_text' => __('Select post types', 'geodirectory'),
949
-        'class' => 'chosen_select',
950
-        'options' => array_unique(geodir_post_type_setting_fun())
951
-    ),
952 926
 
953
-    array(
954
-        'name' => __('Show listing link in user dashboard', 'geodirectory'),
955
-        'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
956
-        'tip' => '',
957
-        'id' => 'geodir_listing_link_user_dashboard',
958
-        'css' => 'min-width:300px;',
959
-        'std' => geodir_get_posttypes(),
960
-        'type' => 'multiselect',
961
-        'placeholder_text' => __('Select post types', 'geodirectory'),
962
-        'class' => 'chosen_select',
963
-        'options' => array_unique(geodir_post_type_setting_fun())
964
-    ),
965
-
966
-    array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
967
-    /* Post Type Navigation Settings End */
968
-
969
-    /* Script Settings Start */
970
-    array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
971
-
972
-    /*
927
+	array(
928
+		'name' => __('Show add listing link in user dashboard', 'geodirectory'),
929
+		'desc' => '',
930
+		'tip' => '',
931
+		'id' => 'geodir_add_listing_link_user_dashboard',
932
+		'css' => 'min-width:300px;',
933
+		'std' => geodir_get_posttypes(),
934
+		'type' => 'multiselect',
935
+		'placeholder_text' => __('Select post types', 'geodirectory'),
936
+		'class' => 'chosen_select',
937
+		'options' => array_unique(geodir_post_type_setting_fun())
938
+	),
939
+
940
+	array(
941
+		'name' => __('Show favorite link in user dashboard', 'geodirectory'),
942
+		'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
943
+		'tip' => '',
944
+		'id' => 'geodir_favorite_link_user_dashboard',
945
+		'css' => 'min-width:300px;',
946
+		'std' => geodir_get_posttypes(),
947
+		'type' => 'multiselect',
948
+		'placeholder_text' => __('Select post types', 'geodirectory'),
949
+		'class' => 'chosen_select',
950
+		'options' => array_unique(geodir_post_type_setting_fun())
951
+	),
952
+
953
+	array(
954
+		'name' => __('Show listing link in user dashboard', 'geodirectory'),
955
+		'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
956
+		'tip' => '',
957
+		'id' => 'geodir_listing_link_user_dashboard',
958
+		'css' => 'min-width:300px;',
959
+		'std' => geodir_get_posttypes(),
960
+		'type' => 'multiselect',
961
+		'placeholder_text' => __('Select post types', 'geodirectory'),
962
+		'class' => 'chosen_select',
963
+		'options' => array_unique(geodir_post_type_setting_fun())
964
+	),
965
+
966
+	array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
967
+	/* Post Type Navigation Settings End */
968
+
969
+	/* Script Settings Start */
970
+	array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
971
+
972
+	/*
973 973
     array( 	'name' => __( 'Add/Remove Scripts', 'geodirectory' ),
974 974
                 'type' => 'sectionstart',
975 975
                 'desc' => '',
@@ -995,190 +995,190 @@  discard block
 block discarded – undo
995 995
 
996 996
     */
997 997
 
998
-    array('name' => __('GD Lazy Load Images', 'geodirectory'),
999
-        'type' => 'sectionstart',
1000
-        'desc' => '',
1001
-        'id' => 'geodir_gdll_settings'),
998
+	array('name' => __('GD Lazy Load Images', 'geodirectory'),
999
+		'type' => 'sectionstart',
1000
+		'desc' => '',
1001
+		'id' => 'geodir_gdll_settings'),
1002 1002
 
1003
-    array(
1004
-        'name' => __('Enable lazy load images?', 'geodirectory'),
1005
-        'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
1006
-        'id' => 'geodir_lazy_load',
1007
-        'type' => 'checkbox',
1008
-        'std' => '1' // Default value to show home top section
1009
-    ),
1010
-    array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
1003
+	array(
1004
+		'name' => __('Enable lazy load images?', 'geodirectory'),
1005
+		'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
1006
+		'id' => 'geodir_lazy_load',
1007
+		'type' => 'checkbox',
1008
+		'std' => '1' // Default value to show home top section
1009
+	),
1010
+	array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
1011 1011
     
1012 1012
 
1013
-    array('name' => __('Script Settings', 'geodirectory'),
1014
-        'type' => 'sectionstart',
1015
-        'desc' => '',
1016
-        'id' => 'geodir_script_settings'),
1013
+	array('name' => __('Script Settings', 'geodirectory'),
1014
+		'type' => 'sectionstart',
1015
+		'desc' => '',
1016
+		'id' => 'geodir_script_settings'),
1017 1017
 
1018
-    array(
1019
-        'name' => __('Custom style css code', 'geodirectory'),
1020
-        'desc' => '',
1021
-        'id' => 'geodir_coustem_css',
1022
-        'type' => 'textarea',
1023
-        'css' => 'min-width:300px;',
1024
-        'std' => '' // Default value for the page title - changed in settings
1025
-    ),
1018
+	array(
1019
+		'name' => __('Custom style css code', 'geodirectory'),
1020
+		'desc' => '',
1021
+		'id' => 'geodir_coustem_css',
1022
+		'type' => 'textarea',
1023
+		'css' => 'min-width:300px;',
1024
+		'std' => '' // Default value for the page title - changed in settings
1025
+	),
1026 1026
 
1027
-    array(
1028
-        'name' => __('Header script code', 'geodirectory'),
1029
-        'desc' => '',
1030
-        'id' => 'geodir_header_scripts',
1031
-        'type' => 'textarea',
1032
-        'css' => 'min-width:300px;',
1033
-        'std' => '' // Default value for the page title - changed in settings
1034
-    ),
1027
+	array(
1028
+		'name' => __('Header script code', 'geodirectory'),
1029
+		'desc' => '',
1030
+		'id' => 'geodir_header_scripts',
1031
+		'type' => 'textarea',
1032
+		'css' => 'min-width:300px;',
1033
+		'std' => '' // Default value for the page title - changed in settings
1034
+	),
1035 1035
 
1036
-    array(
1037
-        'name' => __('Footer script code', 'geodirectory'),
1038
-        'desc' => '',
1039
-        'id' => 'geodir_footer_scripts',
1040
-        'type' => 'textarea',
1041
-        'css' => 'min-width:300px;',
1042
-        'std' => '' // Default value for the page title - changed in settings
1043
-    ),
1036
+	array(
1037
+		'name' => __('Footer script code', 'geodirectory'),
1038
+		'desc' => '',
1039
+		'id' => 'geodir_footer_scripts',
1040
+		'type' => 'textarea',
1041
+		'css' => 'min-width:300px;',
1042
+		'std' => '' // Default value for the page title - changed in settings
1043
+	),
1044 1044
 
1045
-    array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1046
-    /* Script Settings End */
1045
+	array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1046
+	/* Script Settings End */
1047 1047
 
1048
-    /* Map Settings Start */
1049
-    array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1048
+	/* Map Settings Start */
1049
+	array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1050 1050
 
1051 1051
 
1052
-    // Google API key
1053
-    array(
1054
-        'name' => __('Google Maps API KEY', 'geodirectory'),
1055
-        'type' => 'sectionstart',
1056
-        'desc' => '',
1057
-        'id' => 'geodir_google_api_key'
1058
-    ),
1059
-    array(
1060
-        'name' => __('Google Maps API KEY', 'geodirectory'),
1061
-        'desc' => sprintf(
1062
-            __('This is a requirement to use Google Maps, you can get a key from <a href="%s" target="_blank">here</a> OR you can set GD to use Open Street Maps below under Select Maps API setting.   (<a href="%s" target="_blank">How to add a Google API KEY?</a>)', 'geodirectory'),
1063
-            'https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true','https://wpgeodirectory.com/docs/add-google-api-key/' ),
1064
-        'tip' => '',
1065
-        'id' => 'geodir_google_api_key',
1066
-        'css' => 'min-width:300px;',
1067
-        'std' => '',
1068
-        'type' => 'text',
1069
-    ),
1070
-    array(
1071
-        'type' => 'sectionend',
1072
-        'id' => 'geodir_google_api_key'
1073
-    ),
1052
+	// Google API key
1053
+	array(
1054
+		'name' => __('Google Maps API KEY', 'geodirectory'),
1055
+		'type' => 'sectionstart',
1056
+		'desc' => '',
1057
+		'id' => 'geodir_google_api_key'
1058
+	),
1059
+	array(
1060
+		'name' => __('Google Maps API KEY', 'geodirectory'),
1061
+		'desc' => sprintf(
1062
+			__('This is a requirement to use Google Maps, you can get a key from <a href="%s" target="_blank">here</a> OR you can set GD to use Open Street Maps below under Select Maps API setting.   (<a href="%s" target="_blank">How to add a Google API KEY?</a>)', 'geodirectory'),
1063
+			'https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true','https://wpgeodirectory.com/docs/add-google-api-key/' ),
1064
+		'tip' => '',
1065
+		'id' => 'geodir_google_api_key',
1066
+		'css' => 'min-width:300px;',
1067
+		'std' => '',
1068
+		'type' => 'text',
1069
+	),
1070
+	array(
1071
+		'type' => 'sectionend',
1072
+		'id' => 'geodir_google_api_key'
1073
+	),
1074 1074
 
1075
-    /* Untick the category by default on home map */
1076
-    array(
1077
-        'name' => __('Home Map Settings', 'geodirectory'),
1078
-        'type' => 'sectionstart',
1079
-        'desc' => '',
1080
-        'id' => 'geodir_home_map_section'
1081
-    ),
1082
-    array(
1083
-        'name' => __('Select category to untick by default on map', 'geodirectory'),
1084
-        'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1085
-        'tip' => '',
1086
-        'id' => 'geodir_home_map_untick',
1087
-        'css' => 'min-width:300px;',
1088
-        'std' => '',
1089
-        'type' => 'multiselect',
1090
-        'placeholder_text' => __('Select category', 'geodirectory'),
1091
-        'class' => 'chosen_select',
1092
-        'options' => geodir_home_map_cats_key_value_array()
1093
-    ),
1094
-    array(
1095
-        'type' => 'sectionend',
1096
-        'id' => 'geodir_home_map_section'
1097
-    ),
1075
+	/* Untick the category by default on home map */
1076
+	array(
1077
+		'name' => __('Home Map Settings', 'geodirectory'),
1078
+		'type' => 'sectionstart',
1079
+		'desc' => '',
1080
+		'id' => 'geodir_home_map_section'
1081
+	),
1082
+	array(
1083
+		'name' => __('Select category to untick by default on map', 'geodirectory'),
1084
+		'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1085
+		'tip' => '',
1086
+		'id' => 'geodir_home_map_untick',
1087
+		'css' => 'min-width:300px;',
1088
+		'std' => '',
1089
+		'type' => 'multiselect',
1090
+		'placeholder_text' => __('Select category', 'geodirectory'),
1091
+		'class' => 'chosen_select',
1092
+		'options' => geodir_home_map_cats_key_value_array()
1093
+	),
1094
+	array(
1095
+		'type' => 'sectionend',
1096
+		'id' => 'geodir_home_map_section'
1097
+	),
1098 1098
 
1099
-    array(
1100
-        'name' => __('Add Listing Map Settings', 'geodirectory'),
1101
-        'type' => 'sectionstart',
1102
-        'desc' => '',
1103
-        'id' => 'geodir_add_listing_map_section'
1104
-    ),
1105
-    array(
1106
-        'name' => __('Disable mouse scroll on details page map tab', 'geodirectory'),
1107
-        'desc' => __('Stops the mouse scroll zooming the map (home and listings settings set from widget)', 'geodirectory'),
1108
-        'id' => 'geodir_add_listing_mouse_scroll',
1109
-        'type' => 'checkbox',
1110
-        'std' => '0' // Default value to show home top section
1111
-    ),
1112
-    array(
1113
-        'type' => 'sectionend',
1114
-        'id' => 'geodir_add_listing_map_section'
1115
-    ),
1099
+	array(
1100
+		'name' => __('Add Listing Map Settings', 'geodirectory'),
1101
+		'type' => 'sectionstart',
1102
+		'desc' => '',
1103
+		'id' => 'geodir_add_listing_map_section'
1104
+	),
1105
+	array(
1106
+		'name' => __('Disable mouse scroll on details page map tab', 'geodirectory'),
1107
+		'desc' => __('Stops the mouse scroll zooming the map (home and listings settings set from widget)', 'geodirectory'),
1108
+		'id' => 'geodir_add_listing_mouse_scroll',
1109
+		'type' => 'checkbox',
1110
+		'std' => '0' // Default value to show home top section
1111
+	),
1112
+	array(
1113
+		'type' => 'sectionend',
1114
+		'id' => 'geodir_add_listing_map_section'
1115
+	),
1116 1116
 
1117 1117
 
1118
-    array('name' => __('Default map settings', 'geodirectory'),
1119
-        'type' => 'sectionstart',
1120
-        'desc' => '',
1121
-        'id' => 'geodir_map_default_settings'),
1118
+	array('name' => __('Default map settings', 'geodirectory'),
1119
+		'type' => 'sectionstart',
1120
+		'desc' => '',
1121
+		'id' => 'geodir_map_default_settings'),
1122 1122
 
1123
-    array(
1124
-        'name' => '',
1125
-        'desc' => '',
1126
-        'id' => 'map_default_settings',
1127
-        'type' => 'map_default_settings',
1128
-        'css' => 'min-width:300px;',
1129
-        'std' => '' // Default value for the page title - changed in settings
1130
-    ),
1123
+	array(
1124
+		'name' => '',
1125
+		'desc' => '',
1126
+		'id' => 'map_default_settings',
1127
+		'type' => 'map_default_settings',
1128
+		'css' => 'min-width:300px;',
1129
+		'std' => '' // Default value for the page title - changed in settings
1130
+	),
1131 1131
 
1132
-    array(
1133
-        'name' => __('Upload map default marker icon', 'geodirectory'),
1134
-        'desc' => '',
1135
-        'id' => 'geodir_default_marker_icon',
1136
-        'type' => 'file',
1137
-        'std' => '0',
1138
-        'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1139
-    ),
1140
-    // add option that allows enable/disable map dragging to phone devices
1141
-    array(
1142
-        'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1143
-        'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1144
-        'id' => 'geodir_map_onoff_dragging',
1145
-        'type' => 'checkbox',
1146
-        'std' => '0' // Default value to show home top section
1147
-    ),
1148
-    array(
1149
-        'name' => __('Select Maps API', 'geodirectory'),
1150
-        'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
1151
-        'tip' => '',
1152
-        'id' => 'geodir_load_map',
1153
-        'css' => 'min-width:300px;',
1154
-        'std' => 'auto',
1155
-        'type' => 'select',
1156
-        'placeholder_text' => __('Select Map', 'geodirectory'),
1157
-        'options' => array(
1158
-                        'auto' => __('Load Automatic', 'geodirectory'),
1159
-                        'google' => __('Load Google Maps API', 'geodirectory'),
1160
-                        'osm' => __('Load OpenStreetMap API', 'geodirectory'),
1161
-                        'none' => __('Disable Maps', 'geodirectory')
1162
-                    )
1163
-    ),
1164
-
1165
-    array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1166
-
1167
-    array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1168
-        'type' => 'sectionstart',
1169
-        'desc' => '',
1170
-        'id' => 'geodir_map_settings'),
1132
+	array(
1133
+		'name' => __('Upload map default marker icon', 'geodirectory'),
1134
+		'desc' => '',
1135
+		'id' => 'geodir_default_marker_icon',
1136
+		'type' => 'file',
1137
+		'std' => '0',
1138
+		'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1139
+	),
1140
+	// add option that allows enable/disable map dragging to phone devices
1141
+	array(
1142
+		'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1143
+		'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1144
+		'id' => 'geodir_map_onoff_dragging',
1145
+		'type' => 'checkbox',
1146
+		'std' => '0' // Default value to show home top section
1147
+	),
1148
+	array(
1149
+		'name' => __('Select Maps API', 'geodirectory'),
1150
+		'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
1151
+		'tip' => '',
1152
+		'id' => 'geodir_load_map',
1153
+		'css' => 'min-width:300px;',
1154
+		'std' => 'auto',
1155
+		'type' => 'select',
1156
+		'placeholder_text' => __('Select Map', 'geodirectory'),
1157
+		'options' => array(
1158
+						'auto' => __('Load Automatic', 'geodirectory'),
1159
+						'google' => __('Load Google Maps API', 'geodirectory'),
1160
+						'osm' => __('Load OpenStreetMap API', 'geodirectory'),
1161
+						'none' => __('Disable Maps', 'geodirectory')
1162
+					)
1163
+	),
1171 1164
 
1172
-    array(
1173
-        'name' => __('Select Map Category', 'geodirectory'),
1174
-        'desc' => '',
1175
-        'id' => 'geodir_map_settings',
1176
-        'type' => 'map',
1177
-        'css' => 'min-width:300px;',
1178
-        'std' => '' // Default value for the page title - changed in settings
1179
-    ),
1180
-
1181
-    array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1182
-    /* Map Settings End */
1165
+	array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1166
+
1167
+	array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1168
+		'type' => 'sectionstart',
1169
+		'desc' => '',
1170
+		'id' => 'geodir_map_settings'),
1171
+
1172
+	array(
1173
+		'name' => __('Select Map Category', 'geodirectory'),
1174
+		'desc' => '',
1175
+		'id' => 'geodir_map_settings',
1176
+		'type' => 'map',
1177
+		'css' => 'min-width:300px;',
1178
+		'std' => '' // Default value for the page title - changed in settings
1179
+	),
1180
+
1181
+	array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1182
+	/* Map Settings End */
1183 1183
 
1184 1184
 )); // End Design settings
Please login to merge, or discard this patch.