Passed
Pull Request — master (#202)
by
unknown
05:08
created
geodirectory-functions/custom_fields_functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3448,7 +3448,7 @@  discard block
 block discarded – undo
3448 3448
  * @global object $wpdb WordPress Database object.
3449 3449
  * @global string $plugin_prefix Geodirectory plugin table prefix.
3450 3450
  * @param int $post_id The post ID.
3451
- * @return mixed Returns video.
3451
+ * @return string Returns video.
3452 3452
  */
3453 3453
 function geodir_get_video($post_id)
3454 3454
 {
@@ -3474,7 +3474,7 @@  discard block
 block discarded – undo
3474 3474
  * @global object $wpdb WordPress Database object.
3475 3475
  * @global string $plugin_prefix Geodirectory plugin table prefix.
3476 3476
  * @param int $post_id The post ID.
3477
- * @return mixed Returns special offers.
3477
+ * @return string Returns special offers.
3478 3478
  */
3479 3479
 function geodir_get_special_offers($post_id)
3480 3480
 {
@@ -3498,7 +3498,7 @@  discard block
 block discarded – undo
3498 3498
 	 *
3499 3499
 	 * @since 1.0.0
3500 3500
 	 * @package GeoDirectory
3501
-	 * @return mixed|void Returns max upload file size.
3501
+	 * @return string|null Returns max upload file size.
3502 3502
 	 */
3503 3503
 	function geodir_max_upload_size()
3504 3504
     {
Please login to merge, or discard this patch.
Indentation   +330 added lines, -330 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Custom fields functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- * @global object $wpdb WordPress Database object.
8
- * @global string $table_prefix WordPress Database Table prefix.
9
- */
3
+                     * Custom fields functions
4
+                     *
5
+                     * @since 1.0.0
6
+                     * @package GeoDirectory
7
+                     * @global object $wpdb WordPress Database object.
8
+                     * @global string $table_prefix WordPress Database Table prefix.
9
+                     */
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
13
+    /**
14
+     * Check table column exist or not.
15
+     *
16
+     * @since 1.0.0
17
+     * @package GeoDirectory
18 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)
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 24
     {
25 25
         global $wpdb;
26 26
         $exists = false;
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
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
39
+    /**
40
+     * Add column if table column not exist.
41
+     *
42
+     * @since 1.0.0
43
+     * @package GeoDirectory
44 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")
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 50
     {
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
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
155
+    /**
156
+     * Adds admin html for custom fields.
157
+     *
158
+     * @since 1.0.0
159
+     * @package GeoDirectory
160 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)
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 167
     {
168 168
         global $wpdb;
169 169
         $cf = $result_str;
@@ -186,32 +186,32 @@  discard block
 block discarded – undo
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
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 195
      * @global object $wpdb WordPress Database object.
196 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 = '') {
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 201
         global $wpdb, $plugin_prefix;
202 202
         
203
-		if ($field_id != '') {
203
+        if ($field_id != '') {
204 204
             $cf = trim($field_id, '_');
205 205
 
206 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 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
-				$htmlvar_name = $field->htmlvar_name;
210
+                $htmlvar_name = $field->htmlvar_name;
211 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
-				}
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 215
 
216 216
                 /**
217 217
                  * Called after a custom field is deleted.
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
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
251
+    /**
252
+     * Save or Update custom fields into the database.
253
+     *
254
+     * @since 1.0.0
255 255
      * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
256
-	 * @package GeoDirectory
256
+     * @package GeoDirectory
257 257
      * @global object $wpdb WordPress Database object.
258 258
      * @global string $plugin_prefix Geodirectory plugin table prefix.
259
-	 * @param array $request_field {
259
+     * @param array $request_field {
260 260
      *    Attributes of the request field array.
261 261
      *
262 262
      *    @type string $action Ajax Action name. Default "geodir_ajax_action".
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
      *    @type string $css_class Enter custom css class for field custom style.
290 290
      *
291 291
      * }
292
-	 * @param bool $default Not yet implemented.
293
-	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
-	 */
295
-	function geodir_custom_field_save($request_field = array(), $default = false)
292
+     * @param bool $default Not yet implemented.
293
+     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
+     */
295
+    function geodir_custom_field_save($request_field = array(), $default = false)
296 296
     {
297 297
 
298 298
         global $wpdb, $plugin_prefix;
@@ -976,27 +976,27 @@  discard block
 block discarded – undo
976 976
                         if (isset($option_values) && $option_values && $field_type == 'select') {
977 977
                             $option_values_arr = explode(',', $option_values);
978 978
                             
979
-							if (is_array($option_values_arr)) {
979
+                            if (is_array($option_values_arr)) {
980 980
                                 $op_max = 0;
981 981
                                 
982
-								foreach ($option_values_arr as $op_val) {
982
+                                foreach ($option_values_arr as $op_val) {
983 983
                                     if (strlen($op_val) && strlen($op_val) > $op_max) {
984
-										$op_max = strlen($op_val);
985
-									}
984
+                                        $op_max = strlen($op_val);
985
+                                    }
986 986
                                 }
987 987
                                 
988
-								if ($op_max) {
989
-									$op_size = $op_max;
990
-								}
988
+                                if ($op_max) {
989
+                                    $op_size = $op_max;
990
+                                }
991 991
                             }
992 992
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
993 993
                             if (strlen($option_values)) {
994 994
                                 $op_size =  strlen($option_values);
995 995
                             }
996 996
 							
997
-							if (isset($request_field['multi_display_type'])) {
998
-								$extra_fields = $request_field['multi_display_type'];
999
-							}
997
+                            if (isset($request_field['multi_display_type'])) {
998
+                                $extra_fields = $request_field['multi_display_type'];
999
+                            }
1000 1000
                         }
1001 1001
 
1002 1002
                         $meta_field_add = $data_type . "( $op_size ) NULL ";
@@ -1214,10 +1214,10 @@  discard block
 block discarded – undo
1214 1214
     $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1215 1215
 
1216 1216
     $fieldset_id = '';
1217
-	$fieldset_field_class = 'gd-fieldset-details';
1218
-	foreach ($custom_fields as $key => $val) {
1217
+    $fieldset_field_class = 'gd-fieldset-details';
1218
+    foreach ($custom_fields as $key => $val) {
1219 1219
         $val = stripslashes_deep($val); // strip slashes from labels
1220
-		$name = $val['name'];
1220
+        $name = $val['name'];
1221 1221
         $site_title = $val['site_title'];
1222 1222
         $type = $val['type'];
1223 1223
         $admin_desc = $val['desc'];
@@ -1268,8 +1268,8 @@  discard block
 block discarded – undo
1268 1268
 
1269 1269
         if ($type == 'fieldset') {
1270 1270
             $fieldset_id = (int)$val['id'];
1271
-			$fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1272
-			?><h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1271
+            $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1272
+            ?><h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1273 1273
             <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?>
1274 1274
             </h5><?php
1275 1275
 
@@ -1583,15 +1583,15 @@  discard block
 block discarded – undo
1583 1583
 				<?php if ($option_values) {
1584 1584
                     $option_values = geodir_string_values_to_options($option_values, true);
1585 1585
 					
1586
-					if (!empty($option_values)) {
1587
-						foreach ($option_values as $option_value) {
1588
-							if (empty($option_value['optgroup'])) {
1589
-							?>
1586
+                    if (!empty($option_values)) {
1587
+                        foreach ($option_values as $option_value) {
1588
+                            if (empty($option_value['optgroup'])) {
1589
+                            ?>
1590 1590
 							<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']; ?>
1591 1591
 							<?php
1592
-							}
1593
-						}
1594
-					}
1592
+                            }
1593
+                        }
1594
+                    }
1595 1595
                 }
1596 1596
                 ?>
1597 1597
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -2034,8 +2034,8 @@  discard block
 block discarded – undo
2034 2034
                     $file_totImg = count($curImages);
2035 2035
             }
2036 2036
 			
2037
-			$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']) : '';
2038
-			$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2037
+            $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']) : '';
2038
+            $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2039 2039
 
2040 2040
             ?>
2041 2041
             <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -2063,10 +2063,10 @@  discard block
 block discarded – undo
2063 2063
 					<?php } ?>
2064 2064
                     <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
2065 2065
                            value="<?php if (isset($file_totImg)) {
2066
-                               echo esc_attr($file_totImg);
2067
-                           } else {
2068
-                               echo '0';
2069
-                           } ?>"/>
2066
+                                echo esc_attr($file_totImg);
2067
+                            } else {
2068
+                                echo '0';
2069
+                            } ?>"/>
2070 2070
 
2071 2071
                     <div style="float:left; width:55%;">
2072 2072
                         <div
@@ -2125,18 +2125,18 @@  discard block
 block discarded – undo
2125 2125
 
2126 2126
 
2127 2127
 if (!function_exists('geodir_get_field_infoby')) {
2128
-	/**
2129
-	 * Get custom field using key and value.
2130
-	 *
2131
-	 * @since 1.0.0
2132
-	 * @package GeoDirectory
2128
+    /**
2129
+     * Get custom field using key and value.
2130
+     *
2131
+     * @since 1.0.0
2132
+     * @package GeoDirectory
2133 2133
      * @global object $wpdb WordPress Database object.
2134
-	 * @param string $key The key you want to look for.
2135
-	 * @param string $value The value of the key you want to look for.
2136
-	 * @param string $geodir_post_type The post type.
2137
-	 * @return bool|mixed Returns field info when available. otherwise returns false.
2138
-	 */
2139
-	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2134
+     * @param string $key The key you want to look for.
2135
+     * @param string $value The value of the key you want to look for.
2136
+     * @param string $geodir_post_type The post type.
2137
+     * @return bool|mixed Returns field info when available. otherwise returns false.
2138
+     */
2139
+    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2140 2140
     {
2141 2141
 
2142 2142
         global $wpdb;
@@ -2159,21 +2159,21 @@  discard block
 block discarded – undo
2159 2159
 
2160 2160
 
2161 2161
 if (!function_exists('geodir_show_listing_info')) {
2162
-	/**
2163
-	 * Show listing info depending on field location.
2164
-	 *
2165
-	 * @since 1.0.0
2166
-	 * @since 1.5.7 Custom fields option values added to db translation.
2162
+    /**
2163
+     * Show listing info depending on field location.
2164
+     *
2165
+     * @since 1.0.0
2166
+     * @since 1.5.7 Custom fields option values added to db translation.
2167 2167
      *              Changes to display url fields title.
2168
-	 * @package GeoDirectory
2168
+     * @package GeoDirectory
2169 2169
      * @global object $wpdb WordPress Database object.
2170 2170
      * @global object $post The current post object.
2171 2171
      * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
2172 2172
      *
2173
-	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2174
-	 * @return string Returns listing info html.
2175
-	 */
2176
-	function geodir_show_listing_info($fields_location = '') {
2173
+     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2174
+     * @return string Returns listing info html.
2175
+     */
2176
+    function geodir_show_listing_info($fields_location = '') {
2177 2177
         global $post, $preview, $wpdb, $send_to_friend;
2178 2178
 
2179 2179
         $payment_info = array();
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
         $package_info = geodir_post_package_info($package_info, $post);
2183 2183
         $post_package_id = $package_info->pid;
2184 2184
         $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type;
2185
-		$send_to_friend = false;
2185
+        $send_to_friend = false;
2186 2186
 
2187 2187
         ob_start();
2188 2188
         $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location);
@@ -2196,7 +2196,7 @@  discard block
 block discarded – undo
2196 2196
 
2197 2197
                 $i = 1;
2198 2198
             foreach ($fields_info as $type) {
2199
-				$type = stripslashes_deep($type); // strip slashes
2199
+                $type = stripslashes_deep($type); // strip slashes
2200 2200
                 $html = '';
2201 2201
                 $html_var = '';
2202 2202
                 $field_icon = '';
@@ -2401,13 +2401,13 @@  discard block
 block discarded – undo
2401 2401
                                 $field_icon = '';
2402 2402
                             }
2403 2403
 							
2404
-							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2404
+                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2405 2405
 
2406 2406
 
2407
-							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2408
-							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2407
+                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2408
+                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2409 2409
                             if(!empty($type['default_value'])){$title = $type['default_value'];}
2410
-							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2410
+                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2411 2411
 
2412 2412
 
2413 2413
                             $geodir_odd_even = '';
@@ -2625,22 +2625,22 @@  discard block
 block discarded – undo
2625 2625
                         if ($post->{$type['htmlvar_name']} != ''):
2626 2626
 
2627 2627
                             if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2628
-								$html_val = __('No', 'geodirectory');
2629
-							} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2630
-								$html_val = __('Yes', 'geodirectory');
2631
-							} else {								
2632
-								if (!empty($type['option_values'])) {
2633
-									$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2628
+                                $html_val = __('No', 'geodirectory');
2629
+                            } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2630
+                                $html_val = __('Yes', 'geodirectory');
2631
+                            } else {								
2632
+                                if (!empty($type['option_values'])) {
2633
+                                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2634 2634
 									
2635
-									if (!empty($cf_option_values)) {
2636
-										foreach ($cf_option_values as $cf_option_value) {
2637
-											if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2638
-												$html_val = $cf_option_value['label'];
2639
-											}
2640
-										}
2641
-									}
2642
-								}
2643
-							}
2635
+                                    if (!empty($cf_option_values)) {
2636
+                                        foreach ($cf_option_values as $cf_option_value) {
2637
+                                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2638
+                                                $html_val = $cf_option_value['label'];
2639
+                                            }
2640
+                                        }
2641
+                                    }
2642
+                                }
2643
+                            }
2644 2644
 
2645 2645
                             if (strpos($field_icon, 'http') !== false) {
2646 2646
                                 $field_icon_af = '';
@@ -2711,19 +2711,19 @@  discard block
 block discarded – undo
2711 2711
                         $html_var = $type['htmlvar_name'];
2712 2712
 
2713 2713
                         if ($post->{$type['htmlvar_name']}):
2714
-							$field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2714
+                            $field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2715 2715
 							
2716
-							if (!empty($type['option_values'])) {
2717
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2716
+                            if (!empty($type['option_values'])) {
2717
+                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2718 2718
 								
2719
-								if (!empty($cf_option_values)) {
2720
-									foreach ($cf_option_values as $cf_option_value) {
2721
-										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2722
-											$field_value = $cf_option_value['label'];
2723
-										}
2724
-									}
2725
-								}
2726
-							}
2719
+                                if (!empty($cf_option_values)) {
2720
+                                    foreach ($cf_option_values as $cf_option_value) {
2721
+                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2722
+                                            $field_value = $cf_option_value['label'];
2723
+                                        }
2724
+                                    }
2725
+                                }
2726
+                            }
2727 2727
 							
2728 2728
                             if (strpos($field_icon, 'http') !== false) {
2729 2729
                                 $field_icon_af = '';
@@ -2771,19 +2771,19 @@  discard block
 block discarded – undo
2771 2771
                                 $field_icon = '';
2772 2772
                             }
2773 2773
 							
2774
-							$field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2774
+                            $field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2775 2775
 
2776 2776
                             $option_values = array();
2777
-							if (!empty($type['option_values'])) {
2778
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2777
+                            if (!empty($type['option_values'])) {
2778
+                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2779 2779
 								
2780
-								if (!empty($cf_option_values)) {
2781
-									foreach ($cf_option_values as $cf_option_value) {
2782
-										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2783
-											$option_values[] = $cf_option_value['label'];
2784
-										}
2785
-									}
2786
-								}
2780
+                                if (!empty($cf_option_values)) {
2781
+                                    foreach ($cf_option_values as $cf_option_value) {
2782
+                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2783
+                                            $option_values[] = $cf_option_value['label'];
2784
+                                        }
2785
+                                    }
2786
+                                }
2787 2787
                             }
2788 2788
 							
2789 2789
                             $geodir_odd_even = '';
@@ -2803,11 +2803,11 @@  discard block
 block discarded – undo
2803 2803
                             if (count($option_values) > 1) {
2804 2804
                                 $html .= '<ul>';
2805 2805
                                 
2806
-								foreach ($option_values as $val) {
2806
+                                foreach ($option_values as $val) {
2807 2807
                                     $html .= '<li>' . $val . '</li>';
2808 2808
                                 }
2809 2809
                                 
2810
-								$html .= '</ul>';
2810
+                                $html .= '</ul>';
2811 2811
                             } else {
2812 2812
                                 $html .= $post->$type['htmlvar_name'];
2813 2813
                             }
@@ -2816,13 +2816,13 @@  discard block
 block discarded – undo
2816 2816
                         endif;
2817 2817
                         break;
2818 2818
                     case 'email':
2819
-						if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
2820
-							continue; // Remove Send Enquiry | Send To Friend from listings page
2821
-						}
2819
+                        if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
2820
+                            continue; // Remove Send Enquiry | Send To Friend from listings page
2821
+                        }
2822 2822
                        
2823
-					    if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
2824
-						    $send_to_friend = true;
2825
-							$b_send_inquiry = '';
2823
+                        if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
2824
+                            $send_to_friend = true;
2825
+                            $b_send_inquiry = '';
2826 2826
                             $b_sendtofriend = '';
2827 2827
 
2828 2828
                             $html = '';
@@ -2860,7 +2860,7 @@  discard block
 block discarded – undo
2860 2860
 
2861 2861
                             if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
2862 2862
                                 $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
2863
-							}
2863
+                            }
2864 2864
 
2865 2865
                             $html .= '</span></div>';
2866 2866
 
@@ -2933,13 +2933,13 @@  discard block
 block discarded – undo
2933 2933
                             if (!empty($files)):
2934 2934
 
2935 2935
                                $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2936
-							   $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'] : '';
2936
+                                $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'] : '';
2937 2937
 								
2938
-								$file_paths = '';
2938
+                                $file_paths = '';
2939 2939
                                 foreach ($files as $file) {
2940 2940
                                     if (!empty($file)) {
2941 2941
 
2942
-                                       // $filetype = wp_check_filetype($file);
2942
+                                        // $filetype = wp_check_filetype($file);
2943 2943
 
2944 2944
                                         $image_name_arr = explode('/', $file);
2945 2945
                                         $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
@@ -2948,29 +2948,29 @@  discard block
 block discarded – undo
2948 2948
 
2949 2949
                                         $arr_file_type = wp_check_filetype($filename);
2950 2950
                                         if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2951
-											continue;
2952
-										}
2951
+                                            continue;
2952
+                                        }
2953 2953
 										
2954
-										$uploaded_file_type = $arr_file_type['type'];
2955
-										$uploaded_file_ext = $arr_file_type['ext'];
2954
+                                        $uploaded_file_type = $arr_file_type['type'];
2955
+                                        $uploaded_file_ext = $arr_file_type['ext'];
2956 2956
 										
2957
-										if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2958
-											continue; // Invalid file type.
2959
-										}
2957
+                                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2958
+                                            continue; // Invalid file type.
2959
+                                        }
2960 2960
 
2961 2961
                                         //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2962
-										$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2962
+                                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2963 2963
 
2964 2964
                                         // If the uploaded file is image
2965 2965
                                         if (in_array($uploaded_file_type, $image_file_types)) {
2966 2966
                                             $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2967 2967
                                             $file_paths .= '<a href="'.$file.'">';
2968
-											$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2969
-											$file_paths .= '</a>';
2968
+                                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2969
+                                            $file_paths .= '</a>';
2970 2970
                                             //$file_paths .= '<img src="'.$file.'"  />';	
2971 2971
                                             $file_paths .= '</div>';
2972 2972
                                         } else {
2973
-											$ext_path = '_' . $html_var . '_';
2973
+                                            $ext_path = '_' . $html_var . '_';
2974 2974
                                             $filename = explode($ext_path, $filename);
2975 2975
                                             $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2976 2976
                                         }
@@ -3175,14 +3175,14 @@  discard block
 block discarded – undo
3175 3175
 }
3176 3176
 
3177 3177
 if (!function_exists('geodir_default_date_format')) {
3178
-	/**
3179
-	 * Returns default date format.
3180
-	 *
3181
-	 * @since 1.0.0
3182
-	 * @package GeoDirectory
3183
-	 * @return mixed|string|void Returns default date format.
3184
-	 */
3185
-	function geodir_default_date_format()
3178
+    /**
3179
+     * Returns default date format.
3180
+     *
3181
+     * @since 1.0.0
3182
+     * @package GeoDirectory
3183
+     * @return mixed|string|void Returns default date format.
3184
+     */
3185
+    function geodir_default_date_format()
3186 3186
     {
3187 3187
         if ($format = get_option('date_format'))
3188 3188
             return $format;
@@ -3192,30 +3192,30 @@  discard block
 block discarded – undo
3192 3192
 }
3193 3193
 
3194 3194
 if (!function_exists('geodir_get_formated_date')) {
3195
-	/**
3196
-	 * Returns formatted date.
3197
-	 *
3198
-	 * @since 1.0.0
3199
-	 * @package GeoDirectory
3200
-	 * @param string $date Date string to convert.
3201
-	 * @return bool|int|string Returns formatted date.
3202
-	 */
3203
-	function geodir_get_formated_date($date)
3195
+    /**
3196
+     * Returns formatted date.
3197
+     *
3198
+     * @since 1.0.0
3199
+     * @package GeoDirectory
3200
+     * @param string $date Date string to convert.
3201
+     * @return bool|int|string Returns formatted date.
3202
+     */
3203
+    function geodir_get_formated_date($date)
3204 3204
     {
3205 3205
         return mysql2date(get_option('date_format'), $date);
3206 3206
     }
3207 3207
 }
3208 3208
 
3209 3209
 if (!function_exists('geodir_get_formated_time')) {
3210
-	/**
3211
-	 * Returns formatted time.
3212
-	 *
3213
-	 * @since 1.0.0
3214
-	 * @package GeoDirectory
3215
-	 * @param string $time Time string to convert.
3216
-	 * @return bool|int|string Returns formatted time.
3217
-	 */
3218
-	function geodir_get_formated_time($time)
3210
+    /**
3211
+     * Returns formatted time.
3212
+     *
3213
+     * @since 1.0.0
3214
+     * @package GeoDirectory
3215
+     * @param string $time Time string to convert.
3216
+     * @return bool|int|string Returns formatted time.
3217
+     */
3218
+    function geodir_get_formated_time($time)
3219 3219
     {
3220 3220
         return mysql2date(get_option('time_format'), $time, $translate = true);
3221 3221
     }
@@ -3223,21 +3223,21 @@  discard block
 block discarded – undo
3223 3223
 
3224 3224
 
3225 3225
 if (!function_exists('geodir_save_post_file_fields')) {
3226
-	/**
3227
-	 * Save post file fields
3228
-	 *
3229
-	 * @since 1.0.0
3230
-	 * @since 1.4.7 Added `$extra_fields` parameter.
3231
-	 * @package GeoDirectory
3226
+    /**
3227
+     * Save post file fields
3228
+     *
3229
+     * @since 1.0.0
3230
+     * @since 1.4.7 Added `$extra_fields` parameter.
3231
+     * @package GeoDirectory
3232 3232
      * @global object $wpdb WordPress Database object.
3233 3233
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3234 3234
      * @global object $current_user Current user object.
3235
-	 * @param int $post_id
3236
-	 * @param string $field_id
3237
-	 * @param array $post_image
3238
-	 * @param array $extra_fields Array of extra fields.
3239
-	 */
3240
-	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
3235
+     * @param int $post_id
3236
+     * @param string $field_id
3237
+     * @param array $post_image
3238
+     * @param array $extra_fields Array of extra fields.
3239
+     */
3240
+    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
3241 3241
     {
3242 3242
 
3243 3243
         global $wpdb, $plugin_prefix, $current_user;
@@ -3263,7 +3263,7 @@  discard block
 block discarded – undo
3263 3263
             $geodir_uploadurl = $uploads['url'];
3264 3264
             $sub_dir = $uploads['subdir'];
3265 3265
 			
3266
-			$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'] : '';
3266
+            $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'] : '';
3267 3267
 
3268 3268
             for ($m = 0; $m < count($post_image); $m++) {
3269 3269
 
@@ -3280,47 +3280,47 @@  discard block
 block discarded – undo
3280 3280
 
3281 3281
                     $arr_file_type = wp_check_filetype($filename);
3282 3282
 					
3283
-					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
3284
-						continue;
3285
-					}
3283
+                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
3284
+                        continue;
3285
+                    }
3286 3286
 					
3287
-					$uploaded_file_type = $arr_file_type['type'];
3288
-					$uploaded_file_ext = $arr_file_type['ext'];
3287
+                    $uploaded_file_type = $arr_file_type['type'];
3288
+                    $uploaded_file_ext = $arr_file_type['ext'];
3289 3289
 					
3290
-					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
3291
-						continue; // Invalid file type.
3292
-					}
3290
+                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
3291
+                        continue; // Invalid file type.
3292
+                    }
3293 3293
 
3294 3294
                     // Set an array containing a list of acceptable formats
3295 3295
                     //$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');
3296 3296
 
3297
-					if (!function_exists('wp_handle_upload'))
3298
-						require_once(ABSPATH . 'wp-admin/includes/file.php');
3297
+                    if (!function_exists('wp_handle_upload'))
3298
+                        require_once(ABSPATH . 'wp-admin/includes/file.php');
3299 3299
 
3300
-					if (!is_dir($geodir_uploadpath))
3301
-						mkdir($geodir_uploadpath);
3300
+                    if (!is_dir($geodir_uploadpath))
3301
+                        mkdir($geodir_uploadpath);
3302 3302
 
3303
-					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3304
-					$explode_sub_dir = explode("/", $sub_dir);
3305
-					if ($curr_img_dir == end($explode_sub_dir)) {
3306
-						$img_path = $geodir_uploadpath . '/' . $filename;
3307
-						$img_url = $geodir_uploadurl . '/' . $filename;
3308
-					} else {
3309
-						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
3310
-						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
3311
-					}
3303
+                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3304
+                    $explode_sub_dir = explode("/", $sub_dir);
3305
+                    if ($curr_img_dir == end($explode_sub_dir)) {
3306
+                        $img_path = $geodir_uploadpath . '/' . $filename;
3307
+                        $img_url = $geodir_uploadurl . '/' . $filename;
3308
+                    } else {
3309
+                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
3310
+                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
3311
+                    }
3312 3312
 
3313
-					$uploaded_file = '';
3314
-					if (file_exists($img_path))
3315
-						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3313
+                    $uploaded_file = '';
3314
+                    if (file_exists($img_path))
3315
+                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3316 3316
 
3317
-					if ($curr_img_dir != $geodir_uploaddir) {
3318
-						if (file_exists($img_path))
3319
-							unlink($img_path);
3320
-					}
3317
+                    if ($curr_img_dir != $geodir_uploaddir) {
3318
+                        if (file_exists($img_path))
3319
+                            unlink($img_path);
3320
+                    }
3321 3321
 
3322
-					if (!empty($uploaded_file))
3323
-						$file_urls = $geodir_uploadurl . '/' . $new_name;
3322
+                    if (!empty($uploaded_file))
3323
+                        $file_urls = $geodir_uploadurl . '/' . $new_name;
3324 3324
 
3325 3325
                 } else {
3326 3326
                     $file_urls = $post_image[$m];
@@ -3375,16 +3375,16 @@  discard block
 block discarded – undo
3375 3375
 
3376 3376
 if (!function_exists('geodir_plupload_action')) {
3377 3377
 
3378
-	/**
3379
-	 * Get upload directory path details
3380
-	 *
3381
-	 * @since 1.0.0
3382
-	 * @package GeoDirectory
3378
+    /**
3379
+     * Get upload directory path details
3380
+     *
3381
+     * @since 1.0.0
3382
+     * @package GeoDirectory
3383 3383
      * @global object $current_user Current user object.
3384
-	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
3385
-	 * @return mixed Returns upload directory details as an array.
3386
-	 */
3387
-	function geodir_upload_dir($upload)
3384
+     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
3385
+     * @return mixed Returns upload directory details as an array.
3386
+     */
3387
+    function geodir_upload_dir($upload)
3388 3388
     {
3389 3389
         global $current_user;
3390 3390
         $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
@@ -3393,13 +3393,13 @@  discard block
 block discarded – undo
3393 3393
         return $upload;
3394 3394
     }
3395 3395
 
3396
-	/**
3397
-	 * Handles place file and image upload.
3398
-	 *
3399
-	 * @since 1.0.0
3400
-	 * @package GeoDirectory
3401
-	 */
3402
-	function geodir_plupload_action()
3396
+    /**
3397
+     * Handles place file and image upload.
3398
+     *
3399
+     * @since 1.0.0
3400
+     * @package GeoDirectory
3401
+     */
3402
+    function geodir_plupload_action()
3403 3403
     {
3404 3404
 
3405 3405
         // check ajax noonce
@@ -3489,14 +3489,14 @@  discard block
 block discarded – undo
3489 3489
 }
3490 3490
 
3491 3491
 if (!function_exists('geodir_max_upload_size')) {
3492
-	/**
3493
-	 * Get max upload file size
3494
-	 *
3495
-	 * @since 1.0.0
3496
-	 * @package GeoDirectory
3497
-	 * @return mixed|void Returns max upload file size.
3498
-	 */
3499
-	function geodir_max_upload_size()
3492
+    /**
3493
+     * Get max upload file size
3494
+     *
3495
+     * @since 1.0.0
3496
+     * @package GeoDirectory
3497
+     * @return mixed|void Returns max upload file size.
3498
+     */
3499
+    function geodir_max_upload_size()
3500 3500
     {
3501 3501
         $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
3502 3502
 
@@ -3669,14 +3669,14 @@  discard block
 block discarded – undo
3669 3669
 
3670 3670
 
3671 3671
 if (!function_exists('geodir_custom_sort_field_save')) {
3672
-	/**
3673
-	 * Save or Update custom sort fields into the database.
3674
-	 *
3675
-	 * @since 1.0.0
3676
-	 * @package GeoDirectory
3672
+    /**
3673
+     * Save or Update custom sort fields into the database.
3674
+     *
3675
+     * @since 1.0.0
3676
+     * @package GeoDirectory
3677 3677
      * @global object $wpdb WordPress Database object.
3678 3678
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3679
-	 * @param array $request_field {
3679
+     * @param array $request_field {
3680 3680
      *    Attributes of the Request field.
3681 3681
      *
3682 3682
      *    @type string $action Ajax action name.
@@ -3695,10 +3695,10 @@  discard block
 block discarded – undo
3695 3695
      *    @type string $sort_order Sort Order.
3696 3696
      *
3697 3697
      * }
3698
-	 * @param bool $default Not yet implemented.
3699
-	 * @return int Returns the last affected db table row id.
3700
-	 */
3701
-	function geodir_custom_sort_field_save($request_field = array(), $default = false)
3698
+     * @param bool $default Not yet implemented.
3699
+     * @return int Returns the last affected db table row id.
3700
+     */
3701
+    function geodir_custom_sort_field_save($request_field = array(), $default = false)
3702 3702
     {
3703 3703
 
3704 3704
         global $wpdb, $plugin_prefix;
@@ -3816,16 +3816,16 @@  discard block
 block discarded – undo
3816 3816
 
3817 3817
 
3818 3818
 if (!function_exists('geodir_custom_sort_field_delete')) {
3819
-	/**
3820
-	 * Delete a custom sort field using field id.
3821
-	 * @since 1.0.0
3822
-	 * @package GeoDirectory
3819
+    /**
3820
+     * Delete a custom sort field using field id.
3821
+     * @since 1.0.0
3822
+     * @package GeoDirectory
3823 3823
      * @global object $wpdb WordPress Database object.
3824 3824
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3825
-	 * @param string $field_id The field ID.
3826
-	 * @return int|string Returns field id when successful deletion, else returns 0.
3827
-	 */
3828
-	function geodir_custom_sort_field_delete($field_id = '')
3825
+     * @param string $field_id The field ID.
3826
+     * @return int|string Returns field id when successful deletion, else returns 0.
3827
+     */
3828
+    function geodir_custom_sort_field_delete($field_id = '')
3829 3829
     {
3830 3830
 
3831 3831
         global $wpdb, $plugin_prefix;
@@ -3844,18 +3844,18 @@  discard block
 block discarded – undo
3844 3844
 
3845 3845
 
3846 3846
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
3847
-	/**
3848
-	 * Custom sort field admin html.
3849
-	 *
3850
-	 * @since 1.0.0
3851
-	 * @package GeoDirectory
3847
+    /**
3848
+     * Custom sort field admin html.
3849
+     *
3850
+     * @since 1.0.0
3851
+     * @package GeoDirectory
3852 3852
      * @global object $wpdb WordPress Database object.
3853
-	 * @param string $field_type The form field type.
3854
-	 * @param object|int $result_str The custom field results object or row id.
3855
-	 * @param string $field_ins_upd When set to "submit" displays form.
3856
-	 * @param bool $default when set to true field will be for admin use only.
3857
-	 */
3858
-	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
3853
+     * @param string $field_type The form field type.
3854
+     * @param object|int $result_str The custom field results object or row id.
3855
+     * @param string $field_ins_upd When set to "submit" displays form.
3856
+     * @param bool $default when set to true field will be for admin use only.
3857
+     */
3858
+    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
3859 3859
     {
3860 3860
         global $wpdb;
3861 3861
         $cf = $result_str;
@@ -3868,7 +3868,7 @@  discard block
 block discarded – undo
3868 3868
             $result_str = $cf->id;
3869 3869
         }
3870 3870
 		
3871
-		$field_info = stripslashes_deep($field_info); // strip slashes
3871
+        $field_info = stripslashes_deep($field_info); // strip slashes
3872 3872
 
3873 3873
         if (!isset($field_info->post_type)) {
3874 3874
             $post_type = $_REQUEST['listing_type'];
@@ -3889,9 +3889,9 @@  discard block
 block discarded – undo
3889 3889
             $fields = geodir_get_custom_sort_options($post_type);
3890 3890
 
3891 3891
             foreach ($fields as $val) {
3892
-				$val = stripslashes_deep($val); // strip slashes
3892
+                $val = stripslashes_deep($val); // strip slashes
3893 3893
                 
3894
-				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
3894
+                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
3895 3895
                     $site_title = isset($val['site_title']) ? $val['site_title'] : '';
3896 3896
                 }
3897 3897
 
@@ -3925,10 +3925,10 @@  discard block
 block discarded – undo
3925 3925
 
3926 3926
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
3927 3927
                  style="display:<?php if ($field_ins_upd == 'submit') {
3928
-                     echo 'block;';
3929
-                 } else {
3930
-                     echo 'none;';
3931
-                 } ?>">
3928
+                        echo 'block;';
3929
+                    } else {
3930
+                        echo 'none;';
3931
+                    } ?>">
3932 3932
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
3933 3933
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
3934 3934
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
@@ -3956,8 +3956,8 @@  discard block
 block discarded – undo
3956 3956
                                 <input type="text" name="asc_title" id="asc_title"
3957 3957
                                        placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
3958 3958
                                        value="<?php if (isset($field_info->asc_title)) {
3959
-                                           echo esc_attr($field_info->asc_title);
3960
-                                       } ?>" style="width:45%;"/>
3959
+                                            echo esc_attr($field_info->asc_title);
3960
+                                        } ?>" style="width:45%;"/>
3961 3961
 
3962 3962
                                 <input type="radio" name="is_default"
3963 3963
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
@@ -3980,8 +3980,8 @@  discard block
 block discarded – undo
3980 3980
                                 <input type="text" name="desc_title" id="desc_title"
3981 3981
                                        placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
3982 3982
                                        value="<?php if (isset($field_info->desc_title)) {
3983
-                                           echo esc_attr($field_info->desc_title);
3984
-                                       } ?>" style="width:45%;"/>
3983
+                                            echo esc_attr($field_info->desc_title);
3984
+                                        } ?>" style="width:45%;"/>
3985 3985
                                 <input type="radio" name="is_default"
3986 3986
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
3987 3987
                                     echo 'checked="checked"';
@@ -4067,19 +4067,19 @@  discard block
 block discarded – undo
4067 4067
 }
4068 4068
 
4069 4069
 if (!function_exists('check_field_visibility')) {
4070
-	/**
4071
-	 * Check field visibility as per price package.
4072
-	 *
4073
-	 * @since 1.0.0
4074
-	 * @package GeoDirectory
4070
+    /**
4071
+     * Check field visibility as per price package.
4072
+     *
4073
+     * @since 1.0.0
4074
+     * @package GeoDirectory
4075 4075
      * @global object $wpdb WordPress Database object.
4076 4076
      * @global array $geodir_addon_list List of active GeoDirectory extensions.
4077
-	 * @param int|string $package_id The package ID.
4078
-	 * @param string $field_name The field name.
4079
-	 * @param string $post_type Optional. The wordpress post type.
4080
-	 * @return bool Returns true when field visible, otherwise false.
4081
-	 */
4082
-	function check_field_visibility($package_id, $field_name, $post_type)
4077
+     * @param int|string $package_id The package ID.
4078
+     * @param string $field_name The field name.
4079
+     * @param string $post_type Optional. The wordpress post type.
4080
+     * @return bool Returns true when field visible, otherwise false.
4081
+     */
4082
+    function check_field_visibility($package_id, $field_name, $post_type)
4083 4083
     {
4084 4084
         global $wpdb, $geodir_addon_list;
4085 4085
         if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
@@ -4127,15 +4127,15 @@  discard block
 block discarded – undo
4127 4127
                 $input_str = explode("/", $input_str, 2);
4128 4128
                 $label = trim($input_str[0]);
4129 4129
                 if ($translated && $label != '') {
4130
-					$label = __($label, 'geodirectory');
4131
-				}
4132
-				$label = ucfirst($label);
4130
+                    $label = __($label, 'geodirectory');
4131
+                }
4132
+                $label = ucfirst($label);
4133 4133
                 $value = trim($input_str[1]);
4134 4134
             } else {
4135 4135
                 if ($translated && $input_str != '') {
4136
-					$input_str = __($input_str, 'geodirectory');
4137
-				}
4138
-				$label = ucfirst($input_str);
4136
+                    $input_str = __($input_str, 'geodirectory');
4137
+                }
4138
+                $label = ucfirst($input_str);
4139 4139
                 $value = $input_str;
4140 4140
             }
4141 4141
 
@@ -4181,9 +4181,9 @@  discard block
 block discarded – undo
4181 4181
                     if (strpos($optgroup_str, "|") !== false) {
4182 4182
                         $optgroup_str_arr = explode("|", $optgroup_str, 2);
4183 4183
                         $optgroup_label = trim($optgroup_str_arr[0]);
4184
-						if ($translated && $optgroup_label != '') {
4185
-							$optgroup_label = __($optgroup_label, 'geodirectory');
4186
-						}
4184
+                        if ($translated && $optgroup_label != '') {
4185
+                            $optgroup_label = __($optgroup_label, 'geodirectory');
4186
+                        }
4187 4187
                         $optgroup_label = ucfirst($optgroup_label);
4188 4188
                         $optgroup_str = $optgroup_str_arr[1];
4189 4189
                     }
Please login to merge, or discard this patch.
geodirectory-functions/listing_filters.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Contains all function for filtering listing.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Contains all function for filtering listing.
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
  
9 9
 /**
10 10
  * Starts session if not started.
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
     // Filter-Location-Manager to add location table.
236 236
     $fields .= ", " . $table . ".* ";
237 237
     
238
-	if ($snear != '' || $gd_session->get('all_near_me')) {
238
+    if ($snear != '' || $gd_session->get('all_near_me')) {
239 239
         $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
240 240
         
241
-		if ($gd_session->get('all_near_me')) {
241
+        if ($gd_session->get('all_near_me')) {
242 242
             $mylat = $gd_session->get('user_lat');
243 243
             $mylon = $gd_session->get('user_lon');
244 244
         }
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
                 $count = 0;
271 271
                 foreach ($keywords as $keyword) {
272 272
                     $keyword = trim($keyword);
273
-					$count++;
273
+                    $count++;
274 274
                     if ($count < count($keywords)) {
275
-                       // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
276
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
275
+                        // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
276
+                        $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
277 277
                     } else {
278 278
                         //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
279
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
279
+                        $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
280 280
                     }
281 281
                 }
282 282
                 $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             $gd_titlematch_part = "";
286 286
         }
287 287
         //$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title=%s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN " . $wpdb->posts . ".post_content LIKE %s THEN 1 ELSE 0 END AS gd_content", array($s, '%' . $s . '%', '%' . $s . '%'));
288
-		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
288
+        $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
289 289
     }
290 290
     return $fields;
291 291
 }
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             break;
407 407
         case 'high_review':
408 408
         case 'rating_count_desc':
409
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
409
+            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
410 410
             break;
411 411
         case 'low_rating':
412 412
             $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 
527 527
                 default:
528 528
                     if (geodir_column_exist($table, $sort_by)) {
529
-						$orderby = $table . "." . $sort_by . " " . $order . ", ";
530
-					}
529
+                        $orderby = $table . "." . $sort_by . " " . $order . ", ";
530
+                    }
531 531
                     break;
532 532
 
533 533
             endswitch;
@@ -704,14 +704,14 @@  discard block
 block discarded – undo
704 704
     $category_search_range = '';
705 705
 
706 706
     if (is_single() && get_query_var('post_type')) {
707
-		return $where;
708
-	}
707
+        return $where;
708
+    }
709 709
 
710 710
     if (is_tax()) {
711
-		return $where;
712
-	}
711
+        return $where;
712
+    }
713 713
 	
714
-	$s = trim($s);
714
+    $s = trim($s);
715 715
 
716 716
     $where = '';
717 717
 
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
         foreach ($s_SA as $s_term) {
723 723
             //$s_term = esc_attr($s_term);
724 724
             //$better_search[] = " OR $wpdb->posts.post_title LIKE\"%$s_term%\" ";
725
-			$better_search[] = " OR ( $wpdb->posts.post_title LIKE \"$s_term\" OR $wpdb->posts.post_title LIKE \"$s_term%\" OR $wpdb->posts.post_title LIKE \"% $s_term%\" ) ";
725
+            $better_search[] = " OR ( $wpdb->posts.post_title LIKE \"$s_term\" OR $wpdb->posts.post_title LIKE \"$s_term%\" OR $wpdb->posts.post_title LIKE \"% $s_term%\" ) ";
726 726
         }
727 727
     }
728 728
 
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
                 $keyword = trim($keyword);
752 752
                 if ($keyword != '') {
753 753
                     //$better_search_terms .= ' OR ' . $wpdb->posts . '.post_title LIKE "%' . $adv_search_val . '%"';
754
-					$better_search_terms .= ' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )';
754
+                    $better_search_terms .= ' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )';
755 755
                 }
756 756
             }
757 757
         }
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
     }else{$taxonomies='';}
766 766
 
767 767
     $content_where = $terms_where = '';
768
-	if ($s != '') {
768
+    if ($s != '') {
769 769
         /**
770 770
          * Filter the search query content where values.
771 771
          *
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
          * @package GeoDirectory
774 774
          * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
775 775
          */
776
-		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
776
+        $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
777 777
         /**
778 778
          * Filter the search query term values.
779 779
          *
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
          * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
783 783
          */
784 784
         $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
785
-	}
785
+    }
786 786
 		
787 787
     if ($snear != '') {
788 788
         if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
         $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
799 799
         $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
800 800
 
801
-	    $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
801
+        $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
802 802
 			                    $content_where 
803 803
 								OR ($wpdb->posts.ID IN( 
804 804
 										SELECT $wpdb->term_relationships.object_id as post_id 
@@ -837,11 +837,11 @@  discard block
 block discarded – undo
837 837
 				AND ($wpdb->posts.post_status = 'publish') ";
838 838
     }
839 839
 	
840
-	########### WPML ###########
840
+    ########### WPML ###########
841 841
     if ( function_exists( 'icl_object_id' ) ) {       
842
-		$lang_code = ICL_LANGUAGE_CODE;
842
+        $lang_code = ICL_LANGUAGE_CODE;
843 843
 		
844
-		if ($lang_code && $post_types) {
844
+        if ($lang_code && $post_types) {
845 845
             $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
846 846
         }
847 847
     }
Please login to merge, or discard this patch.