Completed
Pull Request — master (#208)
by Kiran
08:04
created
geodirectory_shortcodes.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	// Add marker cluster
203 203
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
204 204
         $map_args['enable_marker_cluster'] = true;
205
-        if(get_option('geodir_marker_cluster_type')) {
205
+        if (get_option('geodir_marker_cluster_type')) {
206 206
             if ($map_args['autozoom']) {
207 207
                 $map_args['enable_marker_cluster_no_reposition'] = false;
208 208
             } else {
209 209
                 $map_args['enable_marker_cluster_no_reposition'] = true;
210 210
             }
211 211
 
212
-            $map_args['enable_marker_cluster_server'] = true ;
212
+            $map_args['enable_marker_cluster_server'] = true;
213 213
 
214 214
         }
215 215
 	} else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
     // if lat and long set in shortcode, hack it so the map is not repositioned
220
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
220
+    if (!empty($params['latitude']) && !empty($params['longitude'])) {
221 221
         $map_args['enable_marker_cluster_no_reposition'] = true;
222 222
     }
223 223
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	
891 891
 	$show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : '';
892 892
 	
893
-	if ($show_adv_search != '' ) {
893
+	if ($show_adv_search != '') {
894 894
 		$show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' ';
895 895
 		if ($show_adv_search == 'searched' && geodir_is_page('search')) {
896 896
 			$show_adv_search = 'search';
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	ob_start();
904 904
 	
905 905
 	//geodir_get_template_part('listing', 'filter-form');
906
-	the_widget('geodir_advance_search_widget', $params, $params );
906
+	the_widget('geodir_advance_search_widget', $params, $params);
907 907
 	
908 908
 	$output = ob_get_contents();
909 909
     ob_end_clean();
@@ -1057,12 +1057,12 @@  discard block
 block discarded – undo
1057 1057
 	);
1058 1058
 	$params = shortcode_atts($defaults, $atts);
1059 1059
 
1060
-	$params['title'] 		= wp_strip_all_tags($params['title']);
1061
-    $params['post_type'] 	= gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1060
+	$params['title'] = wp_strip_all_tags($params['title']);
1061
+    $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1062 1062
 	
1063 1063
 	// Validate the selected category/ies - Grab the current list based on post_type
1064
-    $category_taxonomy 		= geodir_get_taxonomies($params['post_type']);
1065
-    $categories 			= get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1064
+    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
1065
+    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1066 1066
 
1067 1067
     // Make sure we have an array
1068 1068
     if (!(is_array($params['category']))) {
@@ -1071,37 +1071,37 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
     // Array_intersect returns only the items in $params['category'] that are also in our category list
1073 1073
     // Otherwise it becomes empty and later on that will mean "All"
1074
-    $params['category'] 	= array_intersect($params['category'], $categories);
1074
+    $params['category'] = array_intersect($params['category'], $categories);
1075 1075
 	
1076 1076
 	// Post_number needs to be a positive integer
1077
-    $params['post_number'] 	= absint($params['post_number']);
1078
-    $params['post_number']	= $params['post_number'] > 0 ? $params['post_number'] : 10;
1077
+    $params['post_number'] = absint($params['post_number']);
1078
+    $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10;
1079 1079
 	
1080 1080
 	// Validate character_count
1081 1081
     //todo: is this necessary?
1082
-    $params['character_count'] 	= $params['character_count'];
1082
+    $params['character_count'] = $params['character_count'];
1083 1083
 	
1084 1084
 	// Validate our layout choice
1085 1085
     // Outside of the norm, I added some more simple terms to match the existing
1086 1086
     // So now I just run the switch to set it properly.
1087
-    $params['layout'] 			= gdsc_validate_layout_choice($params['layout']);
1087
+    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
1088 1088
 
1089 1089
     // Validate our sorting choice
1090
-    $params['list_sort'] 		= gdsc_validate_sort_choice($params['list_sort']);
1090
+    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
1091 1091
 	
1092 1092
 	// Validate Listing width, used in the template widget-listing-listview.php
1093 1093
     // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1094
-    $params['listing_width'] 	= gdsc_validate_listing_width($params['listing_width']);
1094
+    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1095 1095
 
1096 1096
     // Validate the checkboxes used on the widget
1097
-    $params['add_location_filter'] 	= gdsc_to_bool_val($params['add_location_filter']);
1098
-    $params['show_featured_only'] 	= gdsc_to_bool_val($params['show_featured_only']);
1099
-    $params['show_special_only'] 	= gdsc_to_bool_val($params['show_special_only']);
1100
-    $params['with_pics_only'] 		= gdsc_to_bool_val($params['with_pics_only']);
1101
-    $params['with_videos_only'] 	= gdsc_to_bool_val($params['with_videos_only']);
1102
-	$params['with_pagination'] 		= gdsc_to_bool_val($params['with_pagination']);
1103
-	$params['top_pagination'] 		= gdsc_to_bool_val($params['top_pagination']);
1104
-	$params['bottom_pagination'] 	= gdsc_to_bool_val($params['bottom_pagination']);
1097
+    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
1098
+    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
1099
+    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
1100
+    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
1101
+    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
1102
+	$params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']);
1103
+	$params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']);
1104
+	$params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']);
1105 1105
 	
1106 1106
     /**
1107 1107
      * End of validation
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 		$params['pageno'] = $atts['pageno'];
1115 1115
 		unset($atts['pageno']);
1116 1116
 	}
1117
-	$params['shortcode_atts'] 		= $atts;
1117
+	$params['shortcode_atts'] = $atts;
1118 1118
 
1119 1119
 	$output = geodir_sc_gd_listings_output($params);
1120 1120
 
@@ -1181,8 +1181,8 @@  discard block
 block discarded – undo
1181 1181
 	// Validate the checkboxes used on the widget
1182 1182
     $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1183 1183
     $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1184
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1185
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1184
+    $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']);
1185
+    $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']);
1186 1186
 	
1187 1187
 	if ($params['max_count'] != 'all') {
1188 1188
 		$params['max_count'] = absint($params['max_count']);
Please login to merge, or discard this patch.
Indentation   +591 added lines, -591 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 // If this file is called directly, abort.
9 9
 if (!defined('WPINC')) {
10
-    die;
10
+	die;
11 11
 }
12 12
 require_once('geodirectory-functions/shortcode_functions.php');
13 13
 
@@ -32,48 +32,48 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function geodir_sc_add_listing($atts)
34 34
 {
35
-    ob_start();
36
-    $defaults = array(
37
-        'pid' => '',
38
-        'listing_type' => 'gd_place',
39
-        'login_msg' => __('You must login to post.', 'geodirectory'),
40
-        'show_login' => false,
41
-    );
42
-    $params = shortcode_atts($defaults, $atts);
43
-
44
-    foreach ($params as $key => $value) {
45
-        $_REQUEST[$key] = $value;
46
-    }
47
-
48
-    $user_id = get_current_user_id();
49
-    if (!$user_id) {
50
-        echo $params['login_msg'];
51
-        if ($params['show_login']) {
52
-            echo "<br />";
53
-            $defaults = array(
54
-                'before_widget' => '',
55
-                'after_widget' => '',
56
-                'before_title' => '',
57
-                'after_title' => '',
58
-            );
59
-
60
-            geodir_loginwidget_output($defaults, $defaults);
61
-        }
62
-
63
-
64
-    } else {
65
-        ###### MAIN CONTENT ######
66
-
67
-        /** This action is documented in geodirectory-templates/add-listing.php */
68
-        do_action('geodir_add_listing_page_mandatory');
69
-        /** This action is documented in geodirectory-templates/add-listing.php */
70
-        do_action('geodir_add_listing_form');
71
-    }
72
-    $output = ob_get_contents();
73
-
74
-    ob_end_clean();
75
-
76
-    return $output;
35
+	ob_start();
36
+	$defaults = array(
37
+		'pid' => '',
38
+		'listing_type' => 'gd_place',
39
+		'login_msg' => __('You must login to post.', 'geodirectory'),
40
+		'show_login' => false,
41
+	);
42
+	$params = shortcode_atts($defaults, $atts);
43
+
44
+	foreach ($params as $key => $value) {
45
+		$_REQUEST[$key] = $value;
46
+	}
47
+
48
+	$user_id = get_current_user_id();
49
+	if (!$user_id) {
50
+		echo $params['login_msg'];
51
+		if ($params['show_login']) {
52
+			echo "<br />";
53
+			$defaults = array(
54
+				'before_widget' => '',
55
+				'after_widget' => '',
56
+				'before_title' => '',
57
+				'after_title' => '',
58
+			);
59
+
60
+			geodir_loginwidget_output($defaults, $defaults);
61
+		}
62
+
63
+
64
+	} else {
65
+		###### MAIN CONTENT ######
66
+
67
+		/** This action is documented in geodirectory-templates/add-listing.php */
68
+		do_action('geodir_add_listing_page_mandatory');
69
+		/** This action is documented in geodirectory-templates/add-listing.php */
70
+		do_action('geodir_add_listing_form');
71
+	}
72
+	$output = ob_get_contents();
73
+
74
+	ob_end_clean();
75
+
76
+	return $output;
77 77
 }
78 78
 
79 79
 /**
@@ -101,136 +101,136 @@  discard block
 block discarded – undo
101 101
  */
102 102
 function geodir_sc_home_map($atts)
103 103
 {
104
-    ob_start();
105
-    $defaults = array(
106
-        'width' => '960',
107
-        'height' => '425',
108
-        'maptype' => 'ROADMAP',
109
-        'zoom' => '13',
110
-        'autozoom' => '',
111
-        'child_collapse' => '0',
112
-        'scrollwheel' => '0',
104
+	ob_start();
105
+	$defaults = array(
106
+		'width' => '960',
107
+		'height' => '425',
108
+		'maptype' => 'ROADMAP',
109
+		'zoom' => '13',
110
+		'autozoom' => '',
111
+		'child_collapse' => '0',
112
+		'scrollwheel' => '0',
113 113
 		'marker_cluster' => false,
114
-        'latitude' => '',
115
-        'longitude' => ''
116
-    );
117
-
118
-    $params = shortcode_atts($defaults, $atts);
119
-
120
-    $params = gdsc_validate_map_args($params);
121
-
122
-    $map_args = array(
123
-        'map_canvas_name' => 'gd_home_map',
124
-        'latitude' => $params['latitude'],
125
-        'longitude' => $params['longitude'],
126
-
127
-        /**
128
-         * Filter the widget width of the map on home/listings page.
129
-         *
130
-         * @since 1.0.0
131
-         * @param mixed(string|int|float) $params['width'] The map width.
132
-         */
133
-        'width' => apply_filters('widget_width', $params['width']),
134
-        /**
135
-         * Filter the widget height of the map on home/listings page.
136
-         *
137
-         * @since 1.0.0
138
-         * @param mixed(string|int|float) $params['height'] The map height.
139
-         */
140
-        'height' => apply_filters('widget_heigh', $params['height']),
141
-        /**
142
-         * Filter the widget maptype of the map on home/listings page.
143
-         *
144
-         * @since 1.0.0
114
+		'latitude' => '',
115
+		'longitude' => ''
116
+	);
117
+
118
+	$params = shortcode_atts($defaults, $atts);
119
+
120
+	$params = gdsc_validate_map_args($params);
121
+
122
+	$map_args = array(
123
+		'map_canvas_name' => 'gd_home_map',
124
+		'latitude' => $params['latitude'],
125
+		'longitude' => $params['longitude'],
126
+
127
+		/**
128
+		 * Filter the widget width of the map on home/listings page.
129
+		 *
130
+		 * @since 1.0.0
131
+		 * @param mixed(string|int|float) $params['width'] The map width.
132
+		 */
133
+		'width' => apply_filters('widget_width', $params['width']),
134
+		/**
135
+		 * Filter the widget height of the map on home/listings page.
136
+		 *
137
+		 * @since 1.0.0
138
+		 * @param mixed(string|int|float) $params['height'] The map height.
139
+		 */
140
+		'height' => apply_filters('widget_heigh', $params['height']),
141
+		/**
142
+		 * Filter the widget maptype of the map on home/listings page.
143
+		 *
144
+		 * @since 1.0.0
145 145
 		 * @since 1.5.2 Added TERRAIN map type.
146
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
147
-         */
148
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
149
-        /**
150
-         * Filter the widget scrollwheel value of the map on home/listings page.
151
-         *
152
-         * Should the scrollwheel zoom the map or not.
153
-         *
154
-         * @since 1.0.0
155
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
156
-         */
157
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
158
-        /**
159
-         * Filter the widget zoom level of the map on home/listings page.
160
-         *
161
-         * @since 1.0.0
162
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
163
-         */
164
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
165
-        /**
166
-         * Filter the widget auto zoom value of the map on home/listings page.
167
-         *
168
-         * If the map should autozoom to fit the markers shown.
169
-         *
170
-         * @since 1.0.0
171
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
172
-         */
173
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
174
-        /**
175
-         * Filter the widget child_collapse value of the map on home/listings page.
176
-         *
177
-         * If the map should auto collapse the child categories if the category bar is present.
178
-         *
179
-         * @since 1.0.0
180
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
181
-         */
182
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
183
-        'enable_cat_filters' => true,
184
-        'enable_text_search' => true,
185
-        'enable_post_type_filters' => true,
186
-        /**
187
-         * Filter the widget enable_location_filters value of the map on home/listings page.
188
-         *
189
-         * This is used when the location addon is used.
190
-         *
191
-         * @since 1.0.0
192
-         * @param bool $val True if location filters should be used, false if not.
193
-         */
194
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
195
-        'enable_jason_on_load' => false,
196
-        'enable_marker_cluster' => false,
197
-        'enable_map_resize_button' => true,
198
-        'map_class_name' => 'geodir-map-home-page',
199
-        'is_geodir_home_map_widget' => true,
200
-    );
146
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
147
+		 */
148
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
149
+		/**
150
+		 * Filter the widget scrollwheel value of the map on home/listings page.
151
+		 *
152
+		 * Should the scrollwheel zoom the map or not.
153
+		 *
154
+		 * @since 1.0.0
155
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
156
+		 */
157
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
158
+		/**
159
+		 * Filter the widget zoom level of the map on home/listings page.
160
+		 *
161
+		 * @since 1.0.0
162
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
163
+		 */
164
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
165
+		/**
166
+		 * Filter the widget auto zoom value of the map on home/listings page.
167
+		 *
168
+		 * If the map should autozoom to fit the markers shown.
169
+		 *
170
+		 * @since 1.0.0
171
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
172
+		 */
173
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
174
+		/**
175
+		 * Filter the widget child_collapse value of the map on home/listings page.
176
+		 *
177
+		 * If the map should auto collapse the child categories if the category bar is present.
178
+		 *
179
+		 * @since 1.0.0
180
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
181
+		 */
182
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
183
+		'enable_cat_filters' => true,
184
+		'enable_text_search' => true,
185
+		'enable_post_type_filters' => true,
186
+		/**
187
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
188
+		 *
189
+		 * This is used when the location addon is used.
190
+		 *
191
+		 * @since 1.0.0
192
+		 * @param bool $val True if location filters should be used, false if not.
193
+		 */
194
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
195
+		'enable_jason_on_load' => false,
196
+		'enable_marker_cluster' => false,
197
+		'enable_map_resize_button' => true,
198
+		'map_class_name' => 'geodir-map-home-page',
199
+		'is_geodir_home_map_widget' => true,
200
+	);
201 201
 
202 202
 	// Add marker cluster
203 203
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
204
-        $map_args['enable_marker_cluster'] = true;
205
-        if(get_option('geodir_marker_cluster_type')) {
206
-            if ($map_args['autozoom']) {
207
-                $map_args['enable_marker_cluster_no_reposition'] = false;
208
-            } else {
209
-                $map_args['enable_marker_cluster_no_reposition'] = true;
210
-            }
204
+		$map_args['enable_marker_cluster'] = true;
205
+		if(get_option('geodir_marker_cluster_type')) {
206
+			if ($map_args['autozoom']) {
207
+				$map_args['enable_marker_cluster_no_reposition'] = false;
208
+			} else {
209
+				$map_args['enable_marker_cluster_no_reposition'] = true;
210
+			}
211 211
 
212
-            $map_args['enable_marker_cluster_server'] = true ;
212
+			$map_args['enable_marker_cluster_server'] = true ;
213 213
 
214
-        }
214
+		}
215 215
 	} else {
216 216
 		$map_args['enable_marker_cluster'] = false;
217 217
 	}
218 218
 
219
-    // if lat and long set in shortcode, hack it so the map is not repositioned
220
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
221
-        $map_args['enable_marker_cluster_no_reposition'] = true;
222
-    }
219
+	// if lat and long set in shortcode, hack it so the map is not repositioned
220
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
221
+		$map_args['enable_marker_cluster_no_reposition'] = true;
222
+	}
223 223
 
224 224
 
225
-    geodir_draw_map($map_args);
225
+	geodir_draw_map($map_args);
226 226
 
227
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
227
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
228 228
 
229
-    $output = ob_get_contents();
229
+	$output = ob_get_contents();
230 230
 
231
-    ob_end_clean();
231
+	ob_end_clean();
232 232
 
233
-    return $output;
233
+	return $output;
234 234
 }
235 235
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
236 236
 
@@ -264,77 +264,77 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function geodir_sc_listing_map($atts)
266 266
 {
267
-    ob_start();
268
-    add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
269
-
270
-    add_action('the_post', 'create_list_jsondata'); // Add marker in json array
271
-
272
-    add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
273
-
274
-    $defaults = array(
275
-        'width' => '294',
276
-        'height' => '370',
277
-        'zoom' => '13',
278
-        'autozoom' => '',
279
-        'sticky' => '',
280
-        'showall' => '0',
281
-        'scrollwheel' => '0',
282
-        'maptype' => 'ROADMAP',
283
-        'child_collapse' => 0,
267
+	ob_start();
268
+	add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
269
+
270
+	add_action('the_post', 'create_list_jsondata'); // Add marker in json array
271
+
272
+	add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
273
+
274
+	$defaults = array(
275
+		'width' => '294',
276
+		'height' => '370',
277
+		'zoom' => '13',
278
+		'autozoom' => '',
279
+		'sticky' => '',
280
+		'showall' => '0',
281
+		'scrollwheel' => '0',
282
+		'maptype' => 'ROADMAP',
283
+		'child_collapse' => 0,
284 284
 		'marker_cluster' => false
285
-    );
286
-
287
-    $params = shortcode_atts($defaults, $atts);
288
-
289
-    $params = gdsc_validate_map_args($params);
290
-
291
-    $map_args = array(
292
-        'map_canvas_name' => 'gd_listing_map',
293
-        'width' => $params['width'],
294
-        'height' => $params['height'],
295
-        'zoom' => $params['zoom'],
296
-        'autozoom' => $params['autozoom'],
297
-        'sticky' => $params['sticky'],
298
-        'showall' => $params['showall'],
299
-        'scrollwheel' => $params['scrollwheel'],
300
-        'child_collapse' => 0,
301
-        'enable_cat_filters' => false,
302
-        'enable_text_search' => false,
303
-        'enable_post_type_filters' => false,
304
-        'enable_location_filters' => false,
305
-        'enable_jason_on_load' => true,
306
-    );
307
-
308
-    if (is_single()) {
309
-
310
-        global $post;
311
-        $map_default_lat = $address_latitude = $post->post_latitude;
312
-        $map_default_lng = $address_longitude = $post->post_longitude;
313
-        $mapview = $post->post_mapview;
314
-        $map_args['zoom'] = $post->post_mapzoom;
315
-        $map_args['map_class_name'] = 'geodir-map-listing-page-single';
316
-
317
-    } else {
318
-        $default_location = geodir_get_default_location();
319
-
320
-        $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
321
-        $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
322
-        $map_args['map_class_name'] = 'geodir-map-listing-page';
323
-    }
324
-
325
-    if (empty($mapview)) {
326
-        $mapview = 'ROADMAP';
327
-    }
328
-
329
-    // Set default map options
330
-    $map_args['ajax_url'] = geodir_get_ajax_url();
331
-    $map_args['latitude'] = $map_default_lat;
332
-    $map_args['longitude'] = $map_default_lng;
333
-    $map_args['streetViewControl'] = true;
334
-    $map_args['maptype'] = $mapview;
335
-    $map_args['showPreview'] = '0';
336
-    $map_args['maxZoom'] = 21;
337
-    $map_args['bubble_size'] = 'small';
285
+	);
286
+
287
+	$params = shortcode_atts($defaults, $atts);
288
+
289
+	$params = gdsc_validate_map_args($params);
290
+
291
+	$map_args = array(
292
+		'map_canvas_name' => 'gd_listing_map',
293
+		'width' => $params['width'],
294
+		'height' => $params['height'],
295
+		'zoom' => $params['zoom'],
296
+		'autozoom' => $params['autozoom'],
297
+		'sticky' => $params['sticky'],
298
+		'showall' => $params['showall'],
299
+		'scrollwheel' => $params['scrollwheel'],
300
+		'child_collapse' => 0,
301
+		'enable_cat_filters' => false,
302
+		'enable_text_search' => false,
303
+		'enable_post_type_filters' => false,
304
+		'enable_location_filters' => false,
305
+		'enable_jason_on_load' => true,
306
+	);
307
+
308
+	if (is_single()) {
309
+
310
+		global $post;
311
+		$map_default_lat = $address_latitude = $post->post_latitude;
312
+		$map_default_lng = $address_longitude = $post->post_longitude;
313
+		$mapview = $post->post_mapview;
314
+		$map_args['zoom'] = $post->post_mapzoom;
315
+		$map_args['map_class_name'] = 'geodir-map-listing-page-single';
316
+
317
+	} else {
318
+		$default_location = geodir_get_default_location();
319
+
320
+		$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
321
+		$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
322
+		$map_args['map_class_name'] = 'geodir-map-listing-page';
323
+	}
324
+
325
+	if (empty($mapview)) {
326
+		$mapview = 'ROADMAP';
327
+	}
328
+
329
+	// Set default map options
330
+	$map_args['ajax_url'] = geodir_get_ajax_url();
331
+	$map_args['latitude'] = $map_default_lat;
332
+	$map_args['longitude'] = $map_default_lng;
333
+	$map_args['streetViewControl'] = true;
334
+	$map_args['maptype'] = $mapview;
335
+	$map_args['showPreview'] = '0';
336
+	$map_args['maxZoom'] = 21;
337
+	$map_args['bubble_size'] = 'small';
338 338
 	
339 339
 	// Add marker cluster
340 340
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
 		$map_args['enable_marker_cluster'] = false;
344 344
 	}
345 345
 
346
-    geodir_draw_map($map_args);
346
+	geodir_draw_map($map_args);
347 347
 
348
-    $output = ob_get_contents();
348
+	$output = ob_get_contents();
349 349
 
350
-    ob_end_clean();
350
+	ob_end_clean();
351 351
 
352
-    return $output;
352
+	return $output;
353 353
 }
354 354
 
355 355
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -382,120 +382,120 @@  discard block
 block discarded – undo
382 382
  */
383 383
 function geodir_sc_listing_slider($atts)
384 384
 {
385
-    ob_start();
386
-    $defaults = array(
387
-        'post_type' => 'gd_place',
388
-        'category' => '0',
389
-        'post_number' => '5',
390
-        'slideshow' => '0',
391
-        'animation_loop' => 0,
392
-        'direction_nav' => 0,
393
-        'slideshow_speed' => 5000,
394
-        'animation_speed' => 600,
395
-        'animation' => 'slide',
396
-        'order_by' => 'latest',
397
-        'show_title' => '',
398
-        'show_featured_only' => '',
399
-        'title' => '',
400
-    );
401
-
402
-    $params = shortcode_atts($defaults, $atts);
403
-
404
-
405
-    /*
385
+	ob_start();
386
+	$defaults = array(
387
+		'post_type' => 'gd_place',
388
+		'category' => '0',
389
+		'post_number' => '5',
390
+		'slideshow' => '0',
391
+		'animation_loop' => 0,
392
+		'direction_nav' => 0,
393
+		'slideshow_speed' => 5000,
394
+		'animation_speed' => 600,
395
+		'animation' => 'slide',
396
+		'order_by' => 'latest',
397
+		'show_title' => '',
398
+		'show_featured_only' => '',
399
+		'title' => '',
400
+	);
401
+
402
+	$params = shortcode_atts($defaults, $atts);
403
+
404
+
405
+	/*
406 406
      *
407 407
      * Now we begin the validation of the attributes.
408 408
      */
409
-    // Check we have a valid post_type
410
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
411
-        $params['post_type'] = 'gd_place';
412
-    }
413
-
414
-    // Check we have a valid sort_order
415
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
416
-
417
-    // Match the chosen animation to our options
418
-    $animation_list = array('slide', 'fade');
419
-    if (!(in_array($params['animation'], $animation_list))) {
420
-        $params['animation'] = 'slide';
421
-    }
422
-
423
-    // Post_number needs to be a positive integer
424
-    $params['post_number'] = absint($params['post_number']);
425
-    if (0 == $params['post_number']) {
426
-        $params['post_number'] = 1;
427
-    }
428
-
429
-    // Manage the entered categories
430
-    if (0 != $params['category'] || '' != $params['category']) {
431
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
432
-    }
433
-    // Convert show_title to a bool
434
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
435
-
436
-    // Convert show_featured_only to a bool
437
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
438
-
439
-    /*
409
+	// Check we have a valid post_type
410
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
411
+		$params['post_type'] = 'gd_place';
412
+	}
413
+
414
+	// Check we have a valid sort_order
415
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
416
+
417
+	// Match the chosen animation to our options
418
+	$animation_list = array('slide', 'fade');
419
+	if (!(in_array($params['animation'], $animation_list))) {
420
+		$params['animation'] = 'slide';
421
+	}
422
+
423
+	// Post_number needs to be a positive integer
424
+	$params['post_number'] = absint($params['post_number']);
425
+	if (0 == $params['post_number']) {
426
+		$params['post_number'] = 1;
427
+	}
428
+
429
+	// Manage the entered categories
430
+	if (0 != $params['category'] || '' != $params['category']) {
431
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
432
+	}
433
+	// Convert show_title to a bool
434
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
435
+
436
+	// Convert show_featured_only to a bool
437
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
438
+
439
+	/*
440 440
      * Hopefully all attributes are now valid, and safe to pass forward
441 441
      */
442 442
 
443
-    // redeclare vars after validation
444
-
445
-    if (isset($params['direction_nav'])) {
446
-        $params['directionNav'] = $params['direction_nav'];
447
-    }
448
-    if (isset($params['animation_loop'])) {
449
-        $params['animationLoop'] = $params['animation_loop'];
450
-    }
451
-    if (isset($params['slideshow_speed'])) {
452
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
453
-    }
454
-    if (isset($params['animation_speed'])) {
455
-        $params['animationSpeed'] = $params['animation_speed'];
456
-    }
457
-    if (isset($params['order_by'])) {
458
-        $params['list_sort'] = $params['order_by'];
459
-    }
460
-
461
-    $query_args = array(
462
-        'post_number' => $params['post_number'],
463
-        'is_geodir_loop' => true,
464
-        'post_type' => $params['post_type'],
465
-        'order_by' => $params['order_by']
466
-    );
467
-
468
-    if (1 == $params['show_featured_only']) {
469
-        $query_args['show_featured_only'] = 1;
470
-    }
471
-
472
-    if (0 != $params['category'] && '' != $params['category']) {
473
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
474
-        $tax_query = array(
475
-            'taxonomy' => $category_taxonomy[0],
476
-            'field' => 'id',
477
-            'terms' => $params['category'],
478
-        );
479
-
480
-        $query_args['tax_query'] = array($tax_query);
481
-    }
482
-
483
-    $defaults = array(
484
-        'before_widget' => '',
485
-        'after_widget' => '',
486
-        'before_title' => '',
487
-        'after_title' => '',
488
-    );
489
-
490
-    $query_args = array_merge($query_args, $params);
491
-
492
-    geodir_listing_slider_widget_output($defaults, $query_args);
493
-
494
-    $output = ob_get_contents();
495
-
496
-    ob_end_clean();
497
-
498
-    return $output;
443
+	// redeclare vars after validation
444
+
445
+	if (isset($params['direction_nav'])) {
446
+		$params['directionNav'] = $params['direction_nav'];
447
+	}
448
+	if (isset($params['animation_loop'])) {
449
+		$params['animationLoop'] = $params['animation_loop'];
450
+	}
451
+	if (isset($params['slideshow_speed'])) {
452
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
453
+	}
454
+	if (isset($params['animation_speed'])) {
455
+		$params['animationSpeed'] = $params['animation_speed'];
456
+	}
457
+	if (isset($params['order_by'])) {
458
+		$params['list_sort'] = $params['order_by'];
459
+	}
460
+
461
+	$query_args = array(
462
+		'post_number' => $params['post_number'],
463
+		'is_geodir_loop' => true,
464
+		'post_type' => $params['post_type'],
465
+		'order_by' => $params['order_by']
466
+	);
467
+
468
+	if (1 == $params['show_featured_only']) {
469
+		$query_args['show_featured_only'] = 1;
470
+	}
471
+
472
+	if (0 != $params['category'] && '' != $params['category']) {
473
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
474
+		$tax_query = array(
475
+			'taxonomy' => $category_taxonomy[0],
476
+			'field' => 'id',
477
+			'terms' => $params['category'],
478
+		);
479
+
480
+		$query_args['tax_query'] = array($tax_query);
481
+	}
482
+
483
+	$defaults = array(
484
+		'before_widget' => '',
485
+		'after_widget' => '',
486
+		'before_title' => '',
487
+		'after_title' => '',
488
+	);
489
+
490
+	$query_args = array_merge($query_args, $params);
491
+
492
+	geodir_listing_slider_widget_output($defaults, $query_args);
493
+
494
+	$output = ob_get_contents();
495
+
496
+	ob_end_clean();
497
+
498
+	return $output;
499 499
 }
500 500
 
501 501
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
  */
520 520
 function geodir_sc_login_box($atts)
521 521
 {
522
-    ob_start();
522
+	ob_start();
523 523
 
524
-    $defaults = array(
525
-        'before_widget' => '',
526
-        'after_widget' => '',
527
-        'before_title' => '',
528
-        'after_title' => '',
529
-    );
524
+	$defaults = array(
525
+		'before_widget' => '',
526
+		'after_widget' => '',
527
+		'before_title' => '',
528
+		'after_title' => '',
529
+	);
530 530
 
531
-    geodir_loginwidget_output($defaults, $defaults);
531
+	geodir_loginwidget_output($defaults, $defaults);
532 532
 
533
-    $output = ob_get_contents();
533
+	$output = ob_get_contents();
534 534
 
535
-    ob_end_clean();
535
+	ob_end_clean();
536 536
 
537
-    return $output;
537
+	return $output;
538 538
 }
539 539
 
540 540
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -563,28 +563,28 @@  discard block
 block discarded – undo
563 563
  */
564 564
 function geodir_sc_popular_post_category($atts)
565 565
 {
566
-    ob_start();
567
-    global $geodir_post_category_str;
568
-    $defaults = array(
569
-        'category_limit' => 15,
570
-        'before_widget' => '',
571
-        'after_widget' => '',
572
-        'before_title' => '',
573
-        'after_title' => '',
574
-        'title' => '',
566
+	ob_start();
567
+	global $geodir_post_category_str;
568
+	$defaults = array(
569
+		'category_limit' => 15,
570
+		'before_widget' => '',
571
+		'after_widget' => '',
572
+		'before_title' => '',
573
+		'after_title' => '',
574
+		'title' => '',
575 575
 		'default_post_type' => '',
576
-    );
576
+	);
577 577
 
578
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
579
-    $params['category_limit'] = absint($params['category_limit']);
578
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
579
+	$params['category_limit'] = absint($params['category_limit']);
580 580
 	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
581
-    geodir_popular_post_category_output($params, $params);
581
+	geodir_popular_post_category_output($params, $params);
582 582
 
583
-    $output = ob_get_contents();
583
+	$output = ob_get_contents();
584 584
 
585
-    ob_end_clean();
585
+	ob_end_clean();
586 586
 
587
-    return $output;
587
+	return $output;
588 588
 }
589 589
 
590 590
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -624,97 +624,97 @@  discard block
 block discarded – undo
624 624
  */
625 625
 function geodir_sc_popular_post_view($atts)
626 626
 {
627
-    ob_start();
628
-    $defaults = array(
629
-        'post_type' => 'gd_place',
630
-        'category' => '0',
631
-        'post_number' => '5',
632
-        'layout' => 'gridview_onehalf',
633
-        'add_location_filter' => '0',
634
-        'list_sort' => 'latest',
635
-        'use_viewing_post_type' => '1',
636
-        'character_count' => '20',
637
-        'listing_width' => '',
638
-        'show_featured_only' => '0',
639
-        'show_special_only' => '0',
640
-        'with_pics_only' => '0',
641
-        'with_videos_only' => '0',
642
-        'before_widget' => '',
643
-        'after_widget' => '',
644
-        'before_title' => '<h3 class="widget-title">',
645
-        'after_title' => '</h3>',
646
-        'title' => '',
647
-        'category_title' => '',
648
-    );
649
-
650
-    $params = shortcode_atts($defaults, $atts);
651
-
652
-    /**
653
-     * Validate our incoming params
654
-     */
627
+	ob_start();
628
+	$defaults = array(
629
+		'post_type' => 'gd_place',
630
+		'category' => '0',
631
+		'post_number' => '5',
632
+		'layout' => 'gridview_onehalf',
633
+		'add_location_filter' => '0',
634
+		'list_sort' => 'latest',
635
+		'use_viewing_post_type' => '1',
636
+		'character_count' => '20',
637
+		'listing_width' => '',
638
+		'show_featured_only' => '0',
639
+		'show_special_only' => '0',
640
+		'with_pics_only' => '0',
641
+		'with_videos_only' => '0',
642
+		'before_widget' => '',
643
+		'after_widget' => '',
644
+		'before_title' => '<h3 class="widget-title">',
645
+		'after_title' => '</h3>',
646
+		'title' => '',
647
+		'category_title' => '',
648
+	);
655 649
 
656
-    // Validate the selected post type, default to gd_place on fail
657
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
658
-        $params['post_type'] = 'gd_place';
659
-    }
660
-
661
-    // Validate the selected category/ies - Grab the current list based on post_type
662
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
663
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
664
-
665
-    // Make sure we have an array
666
-    if (!(is_array($params['category']))) {
667
-        $params['category'] = explode(',', $params['category']);
668
-    }
669
-
670
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
671
-    // Otherwise it becomes empty and later on that will mean "All"
672
-    $params['category'] = array_intersect($params['category'], $categories);
673
-
674
-    // Post_number needs to be a positive integer
675
-    $params['post_number'] = absint($params['post_number']);
676
-    if (0 == $params['post_number']) {
677
-        $params['post_number'] = 1;
678
-    }
679
-
680
-    // Validate our layout choice
681
-    // Outside of the norm, I added some more simple terms to match the existing
682
-    // So now I just run the switch to set it properly.
683
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
684
-
685
-    // Validate our sorting choice
686
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
687
-
688
-    // Validate character_count
689
-    $params['character_count'] = absint($params['character_count']);
690
-    if (20 > $params['character_count']) {
691
-        $params['character_count'] = 20;
692
-    }
693
-
694
-    // Validate Listing width, used in the template widget-listing-listview.php
695
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
696
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
697
-
698
-    // Validate the checkboxes used on the widget
699
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
700
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
701
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
702
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
703
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
704
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
705
-
706
-    /**
707
-     * End of validation
708
-     */
650
+	$params = shortcode_atts($defaults, $atts);
709 651
 
710
-    geodir_popular_postview_output($params, $params);
652
+	/**
653
+	 * Validate our incoming params
654
+	 */
711 655
 
656
+	// Validate the selected post type, default to gd_place on fail
657
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
658
+		$params['post_type'] = 'gd_place';
659
+	}
712 660
 
713
-    $output = ob_get_contents();
661
+	// Validate the selected category/ies - Grab the current list based on post_type
662
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
663
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
714 664
 
715
-    ob_end_clean();
665
+	// Make sure we have an array
666
+	if (!(is_array($params['category']))) {
667
+		$params['category'] = explode(',', $params['category']);
668
+	}
669
+
670
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
671
+	// Otherwise it becomes empty and later on that will mean "All"
672
+	$params['category'] = array_intersect($params['category'], $categories);
673
+
674
+	// Post_number needs to be a positive integer
675
+	$params['post_number'] = absint($params['post_number']);
676
+	if (0 == $params['post_number']) {
677
+		$params['post_number'] = 1;
678
+	}
679
+
680
+	// Validate our layout choice
681
+	// Outside of the norm, I added some more simple terms to match the existing
682
+	// So now I just run the switch to set it properly.
683
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
684
+
685
+	// Validate our sorting choice
686
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
687
+
688
+	// Validate character_count
689
+	$params['character_count'] = absint($params['character_count']);
690
+	if (20 > $params['character_count']) {
691
+		$params['character_count'] = 20;
692
+	}
693
+
694
+	// Validate Listing width, used in the template widget-listing-listview.php
695
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
696
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
697
+
698
+	// Validate the checkboxes used on the widget
699
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
700
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
701
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
702
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
703
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
704
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
716 705
 
717
-    return $output;
706
+	/**
707
+	 * End of validation
708
+	 */
709
+
710
+	geodir_popular_postview_output($params, $params);
711
+
712
+
713
+	$output = ob_get_contents();
714
+
715
+	ob_end_clean();
716
+
717
+	return $output;
718 718
 }
719 719
 
720 720
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -736,37 +736,37 @@  discard block
 block discarded – undo
736 736
  * @return string Recent reviews HTML.
737 737
  */
738 738
 function geodir_sc_recent_reviews($atts) {
739
-    ob_start();
740
-    $defaults = array(
739
+	ob_start();
740
+	$defaults = array(
741 741
 		'title' => '',
742 742
 		'count' => 5,
743
-    );
743
+	);
744 744
 
745
-    $params = shortcode_atts($defaults, $atts);
745
+	$params = shortcode_atts($defaults, $atts);
746 746
 
747
-    $count = absint($params['count']);
748
-    if (0 == $count) {
749
-        $count = 1;
750
-    }
747
+	$count = absint($params['count']);
748
+	if (0 == $count) {
749
+		$count = 1;
750
+	}
751 751
 	
752 752
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
753 753
 
754
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
754
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
755 755
 
756
-    if ($comments_li) {
757
-        if ($title != '') { ?>
756
+	if ($comments_li) {
757
+		if ($title != '') { ?>
758 758
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
759 759
 		<?php } ?>
760 760
         <div class="geodir_sc_recent_reviews_section">
761 761
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
762 762
         </div>
763 763
     <?php
764
-    }
765
-    $output = ob_get_contents();
764
+	}
765
+	$output = ob_get_contents();
766 766
 
767
-    ob_end_clean();
767
+	ob_end_clean();
768 768
 
769
-    return $output;
769
+	return $output;
770 770
 }
771 771
 
772 772
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -796,64 +796,64 @@  discard block
 block discarded – undo
796 796
  */
797 797
 function geodir_sc_related_listings($atts)
798 798
 {
799
-    ob_start();
800
-    $defaults = array(
801
-        'post_number' => 5,
802
-        'relate_to' => 'category',
803
-        'layout' => 'gridview_onehalf',
804
-        'add_location_filter' => 0,
805
-        'listing_width' => '',
806
-        'list_sort' => 'latest',
807
-        'character_count' => 20,
808
-        'is_widget' => 1,
809
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
810
-    );
811
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
812
-
813
-    $params = shortcode_atts($defaults, $atts);
814
-
815
-    /**
816
-     * Begin validating parameters
817
-     */
799
+	ob_start();
800
+	$defaults = array(
801
+		'post_number' => 5,
802
+		'relate_to' => 'category',
803
+		'layout' => 'gridview_onehalf',
804
+		'add_location_filter' => 0,
805
+		'listing_width' => '',
806
+		'list_sort' => 'latest',
807
+		'character_count' => 20,
808
+		'is_widget' => 1,
809
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
810
+	);
811
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
818 812
 
819
-    // Validate that post_number is a number and is 1 or higher
820
-    $params['post_number'] = absint($params['post_number']);
821
-    if (0 === $params['post_number']) {
822
-        $params['post_number'] = 1;
823
-    }
813
+	$params = shortcode_atts($defaults, $atts);
824 814
 
825
-    // Validate relate_to - only category or tags
826
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
827
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
828
-        $params['relate_to'] = 'category';
829
-    }
815
+	/**
816
+	 * Begin validating parameters
817
+	 */
830 818
 
831
-    // Validate layout selection
832
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
819
+	// Validate that post_number is a number and is 1 or higher
820
+	$params['post_number'] = absint($params['post_number']);
821
+	if (0 === $params['post_number']) {
822
+		$params['post_number'] = 1;
823
+	}
833 824
 
834
-    // Validate sorting option
835
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
825
+	// Validate relate_to - only category or tags
826
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
827
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
828
+		$params['relate_to'] = 'category';
829
+	}
836 830
 
837
-    // Validate add_location_filter
838
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
831
+	// Validate layout selection
832
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
839 833
 
840
-    // Validate listing_width
841
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
834
+	// Validate sorting option
835
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
842 836
 
843
-    // Validate character_count
844
-    $params['character_count'] = absint($params['character_count']);
845
-    if (20 > $params['character_count']) {
846
-        $params['character_count'] = 20;
847
-    }
837
+	// Validate add_location_filter
838
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
848 839
 
849
-    if ($related_display = geodir_related_posts_display($params)) {
850
-        echo $related_display;
851
-    }
852
-    $output = ob_get_contents();
840
+	// Validate listing_width
841
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
853 842
 
854
-    ob_end_clean();
843
+	// Validate character_count
844
+	$params['character_count'] = absint($params['character_count']);
845
+	if (20 > $params['character_count']) {
846
+		$params['character_count'] = 20;
847
+	}
848
+
849
+	if ($related_display = geodir_related_posts_display($params)) {
850
+		echo $related_display;
851
+	}
852
+	$output = ob_get_contents();
855 853
 
856
-    return $output;
854
+	ob_end_clean();
855
+
856
+	return $output;
857 857
 }
858 858
 
859 859
 /**
@@ -877,12 +877,12 @@  discard block
 block discarded – undo
877 877
  * @return string Advanced search widget HTML.
878 878
  */
879 879
 function geodir_sc_advanced_search($atts) {
880
-    $defaults = array(
880
+	$defaults = array(
881 881
 		'title' => '',
882 882
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advanced_search_widget">',
883
-        'after_widget' => '</section>',
884
-        'before_title' => '<h3 class="widget-title">',
885
-        'after_title' => '</h3>',
883
+		'after_widget' => '</section>',
884
+		'before_title' => '<h3 class="widget-title">',
885
+		'after_title' => '</h3>',
886 886
 		'show_adv_search' => 'default'
887 887
 	);
888 888
 	
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 	the_widget('geodir_advance_search_widget', $params, $params );
907 907
 	
908 908
 	$output = ob_get_contents();
909
-    ob_end_clean();
909
+	ob_end_clean();
910 910
 
911
-    return $output;
911
+	return $output;
912 912
 }
913 913
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
914 914
 
@@ -954,48 +954,48 @@  discard block
 block discarded – undo
954 954
 		'add_location_filter' => '1',
955 955
 		'tab_layout' => 'bestof-tabs-on-top',
956 956
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
957
-        'after_widget' => '</section>',
958
-        'before_title' => '<h3 class="widget-title">',
959
-        'after_title' => '</h3>',
957
+		'after_widget' => '</section>',
958
+		'before_title' => '<h3 class="widget-title">',
959
+		'after_title' => '</h3>',
960 960
 	);
961 961
 	$params = shortcode_atts($defaults, $atts);
962 962
 
963
-    /**
964
-     * Validate our incoming params
965
-     */
963
+	/**
964
+	 * Validate our incoming params
965
+	 */
966 966
 
967
-    // Validate the selected post type, default to gd_place on fail
968
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
969
-        $params['post_type'] = 'gd_place';
970
-    }
967
+	// Validate the selected post type, default to gd_place on fail
968
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
969
+		$params['post_type'] = 'gd_place';
970
+	}
971 971
 	
972 972
 	// Post limit needs to be a positive integer
973
-    $params['post_limit'] = absint($params['post_limit']);
974
-    if (0 == $params['post_limit']) {
975
-        $params['post_limit'] = 5;
976
-    }
973
+	$params['post_limit'] = absint($params['post_limit']);
974
+	if (0 == $params['post_limit']) {
975
+		$params['post_limit'] = 5;
976
+	}
977 977
 	
978 978
 	// Category limit needs to be a positive integer
979
-    $params['categ_limit'] = absint($params['categ_limit']);
980
-    if (0 == $params['categ_limit']) {
981
-        $params['categ_limit'] = 3;
982
-    }
979
+	$params['categ_limit'] = absint($params['categ_limit']);
980
+	if (0 == $params['categ_limit']) {
981
+		$params['categ_limit'] = 3;
982
+	}
983 983
 	
984 984
 	// Tab layout validation
985
-    $params['tab_layout'] = $params['tab_layout'];
986
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
987
-        $params['tab_layout'] = 'bestof-tabs-on-top';
988
-    }
985
+	$params['tab_layout'] = $params['tab_layout'];
986
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
987
+		$params['tab_layout'] = 'bestof-tabs-on-top';
988
+	}
989 989
 	
990 990
 	// Validate character_count
991
-    $params['character_count'] = $params['character_count'];
991
+	$params['character_count'] = $params['character_count'];
992 992
 
993 993
 	ob_start();
994 994
 	the_widget('geodir_bestof_widget', $params, $params);
995
-    $output = ob_get_contents();
996
-    ob_end_clean();
995
+	$output = ob_get_contents();
996
+	ob_end_clean();
997 997
 
998
-    return $output;
998
+	return $output;
999 999
 }
1000 1000
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
1001 1001
 
@@ -1058,54 +1058,54 @@  discard block
 block discarded – undo
1058 1058
 	$params = shortcode_atts($defaults, $atts);
1059 1059
 
1060 1060
 	$params['title'] 		= wp_strip_all_tags($params['title']);
1061
-    $params['post_type'] 	= gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1061
+	$params['post_type'] 	= gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1062 1062
 	
1063 1063
 	// Validate the selected category/ies - Grab the current list based on post_type
1064
-    $category_taxonomy 		= geodir_get_taxonomies($params['post_type']);
1065
-    $categories 			= get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1064
+	$category_taxonomy 		= geodir_get_taxonomies($params['post_type']);
1065
+	$categories 			= get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1066 1066
 
1067
-    // Make sure we have an array
1068
-    if (!(is_array($params['category']))) {
1069
-        $params['category'] = explode(',', $params['category']);
1070
-    }
1067
+	// Make sure we have an array
1068
+	if (!(is_array($params['category']))) {
1069
+		$params['category'] = explode(',', $params['category']);
1070
+	}
1071 1071
 
1072
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1073
-    // Otherwise it becomes empty and later on that will mean "All"
1074
-    $params['category'] 	= array_intersect($params['category'], $categories);
1072
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1073
+	// Otherwise it becomes empty and later on that will mean "All"
1074
+	$params['category'] 	= array_intersect($params['category'], $categories);
1075 1075
 	
1076 1076
 	// Post_number needs to be a positive integer
1077
-    $params['post_number'] 	= absint($params['post_number']);
1078
-    $params['post_number']	= $params['post_number'] > 0 ? $params['post_number'] : 10;
1077
+	$params['post_number'] 	= absint($params['post_number']);
1078
+	$params['post_number']	= $params['post_number'] > 0 ? $params['post_number'] : 10;
1079 1079
 	
1080 1080
 	// Validate character_count
1081
-    //todo: is this necessary?
1082
-    $params['character_count'] 	= $params['character_count'];
1081
+	//todo: is this necessary?
1082
+	$params['character_count'] 	= $params['character_count'];
1083 1083
 	
1084 1084
 	// Validate our layout choice
1085
-    // Outside of the norm, I added some more simple terms to match the existing
1086
-    // So now I just run the switch to set it properly.
1087
-    $params['layout'] 			= gdsc_validate_layout_choice($params['layout']);
1085
+	// Outside of the norm, I added some more simple terms to match the existing
1086
+	// So now I just run the switch to set it properly.
1087
+	$params['layout'] 			= gdsc_validate_layout_choice($params['layout']);
1088 1088
 
1089
-    // Validate our sorting choice
1090
-    $params['list_sort'] 		= gdsc_validate_sort_choice($params['list_sort']);
1089
+	// Validate our sorting choice
1090
+	$params['list_sort'] 		= gdsc_validate_sort_choice($params['list_sort']);
1091 1091
 	
1092 1092
 	// Validate Listing width, used in the template widget-listing-listview.php
1093
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1094
-    $params['listing_width'] 	= gdsc_validate_listing_width($params['listing_width']);
1095
-
1096
-    // Validate the checkboxes used on the widget
1097
-    $params['add_location_filter'] 	= gdsc_to_bool_val($params['add_location_filter']);
1098
-    $params['show_featured_only'] 	= gdsc_to_bool_val($params['show_featured_only']);
1099
-    $params['show_special_only'] 	= gdsc_to_bool_val($params['show_special_only']);
1100
-    $params['with_pics_only'] 		= gdsc_to_bool_val($params['with_pics_only']);
1101
-    $params['with_videos_only'] 	= gdsc_to_bool_val($params['with_videos_only']);
1093
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1094
+	$params['listing_width'] 	= gdsc_validate_listing_width($params['listing_width']);
1095
+
1096
+	// Validate the checkboxes used on the widget
1097
+	$params['add_location_filter'] 	= gdsc_to_bool_val($params['add_location_filter']);
1098
+	$params['show_featured_only'] 	= gdsc_to_bool_val($params['show_featured_only']);
1099
+	$params['show_special_only'] 	= gdsc_to_bool_val($params['show_special_only']);
1100
+	$params['with_pics_only'] 		= gdsc_to_bool_val($params['with_pics_only']);
1101
+	$params['with_videos_only'] 	= gdsc_to_bool_val($params['with_videos_only']);
1102 1102
 	$params['with_pagination'] 		= gdsc_to_bool_val($params['with_pagination']);
1103 1103
 	$params['top_pagination'] 		= gdsc_to_bool_val($params['top_pagination']);
1104 1104
 	$params['bottom_pagination'] 	= gdsc_to_bool_val($params['bottom_pagination']);
1105 1105
 	
1106
-    /**
1107
-     * End of validation
1108
-     */
1106
+	/**
1107
+	 * End of validation
1108
+	 */
1109 1109
 	if (isset($atts['geodir_ajax'])) {
1110 1110
 		$params['geodir_ajax'] = $atts['geodir_ajax'];
1111 1111
 		unset($atts['geodir_ajax']);
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
 	$output = geodir_sc_gd_listings_output($params);
1120 1120
 
1121
-    return $output;
1121
+	return $output;
1122 1122
 }
1123 1123
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1124 1124
 
@@ -1166,23 +1166,23 @@  discard block
 block discarded – undo
1166 1166
 		'max_count' => 'all',
1167 1167
 		'max_level' => '1',
1168 1168
 		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1169
-        'after_widget' => '</section>',
1170
-        'before_title' => '<h3 class="widget-title">',
1171
-        'after_title' => '</h3>',
1169
+		'after_widget' => '</section>',
1170
+		'before_title' => '<h3 class="widget-title">',
1171
+		'after_title' => '</h3>',
1172 1172
 	);
1173 1173
 	$params = shortcode_atts($defaults, $atts);
1174 1174
 
1175
-    /**
1176
-     * Validate our incoming params
1177
-     */
1175
+	/**
1176
+	 * Validate our incoming params
1177
+	 */
1178 1178
 	// Make sure we have an array
1179
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1179
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1180 1180
 	 
1181 1181
 	// Validate the checkboxes used on the widget
1182
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1183
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1184
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1185
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1182
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1183
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1184
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1185
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1186 1186
 	
1187 1187
 	if ($params['max_count'] != 'all') {
1188 1188
 		$params['max_count'] = absint($params['max_count']);
@@ -1196,10 +1196,10 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
 	ob_start();
1198 1198
 	the_widget('geodir_cpt_categories_widget', $params, $params);
1199
-    $output = ob_get_contents();
1200
-    ob_end_clean();
1199
+	$output = ob_get_contents();
1200
+	ob_end_clean();
1201 1201
 
1202
-    return $output;
1202
+	return $output;
1203 1203
 }
1204 1204
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1205 1205
 ?>
1206 1206
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Enfold.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
  * @since 1.0.0
114 114
  * @package GeoDirectory
115 115
  * @param array $classes Class array.
116
- * @return array Modified class array.
116
+ * @return string[] Modified class array.
117 117
  */
118 118
 function geodir_x_body_class($classes)
119 119
 {
Please login to merge, or discard this patch.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -1,100 +1,100 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Enfold theme compatibility functions.
4
- *
5
- * This file lets the GeoDirectory Plugin use the Enfold theme HTML wrappers to fit and work perfectly.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+	 * Enfold theme compatibility functions.
4
+	 *
5
+	 * This file lets the GeoDirectory Plugin use the Enfold theme HTML wrappers to fit and work perfectly.
6
+	 *
7
+	 * @since 1.0.0
8
+	 * @package GeoDirectory
9
+	 */
10 10
 add_action('after_setup_theme', 'enfold_action_calls', 11);
11 11
 /**
12
- * Action calls for enfold theme compatibility.
13
- *
14
- * @since 1.0.0
15
- * @package GeoDirectory
16
- */
12
+	 * Action calls for enfold theme compatibility.
13
+	 *
14
+	 * @since 1.0.0
15
+	 * @package GeoDirectory
16
+	 */
17 17
 function enfold_action_calls()
18 18
 {
19 19
 
20
-    /* ACTIONS
20
+	/* ACTIONS
21 21
     ****************************************************************************************/
22 22
 
23
-    // Add body class for styling purposes
24
-    add_filter('body_class', 'wpgeo_enfold_body_class');
23
+	// Add body class for styling purposes
24
+	add_filter('body_class', 'wpgeo_enfold_body_class');
25 25
 
26
-    // Pages using the page-builder shouldn't redirect on successful payment
27
-    if (isset($_REQUEST['pay_action'])) {
28
-        add_action('init', 'geodir_allow_payment_urls_enfold', 15);
29
-    }
26
+	// Pages using the page-builder shouldn't redirect on successful payment
27
+	if (isset($_REQUEST['pay_action'])) {
28
+		add_action('init', 'geodir_allow_payment_urls_enfold', 15);
29
+	}
30 30
 
31
-    // LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search
32
-    if (function_exists('geodir_location_menu_items')) {
33
-        remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110);
34
-        add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2);
35
-    }
36
-    // GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search
37
-    remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100);
38
-    add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2);
31
+	// LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search
32
+	if (function_exists('geodir_location_menu_items')) {
33
+		remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110);
34
+		add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2);
35
+	}
36
+	// GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search
37
+	remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100);
38
+	add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2);
39 39
 
40
-    // HOME TOP SIDEBAR
41
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
42
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
43
-    //add_action( 'ava_after_main_container', 'enfold_home_sidebar' );
40
+	// HOME TOP SIDEBAR
41
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
42
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
43
+	//add_action( 'ava_after_main_container', 'enfold_home_sidebar' );
44 44
 
45 45
 
46
-    // WRAPPER OPEN ACTIONS
47
-    remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10);
48
-    add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9);
49
-    add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE
46
+	// WRAPPER OPEN ACTIONS
47
+	remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10);
48
+	add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9);
49
+	add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE
50 50
 
51 51
 
52
-    // WRAPPER CONTENT OPEN ACTIONS
53
-    remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10);
54
-    add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3);
52
+	// WRAPPER CONTENT OPEN ACTIONS
53
+	remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10);
54
+	add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3);
55 55
 
56 56
 
57
-    // SIDEBAR RIGHT OPEN ACTIONS
58
-    remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10);
59
-    add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4);
57
+	// SIDEBAR RIGHT OPEN ACTIONS
58
+	remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10);
59
+	add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4);
60 60
 
61
-    // SIDEBAR LEFT OPEN ACTIONS
62
-    remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10);
63
-    add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4);
61
+	// SIDEBAR LEFT OPEN ACTIONS
62
+	remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10);
63
+	add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4);
64 64
 
65 65
 
66
-    // HOME PAGE BREADCRUMBS
67
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
68
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
66
+	// HOME PAGE BREADCRUMBS
67
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
68
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
69 69
 
70
-    // LISTINGS PAGE BREADCRUMBS & TITLES
71
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
72
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
70
+	// LISTINGS PAGE BREADCRUMBS & TITLES
71
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
72
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
73 73
 
74
-    // DETAILS PAGE BREADCRUMBS & TITLES
75
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
76
-    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
74
+	// DETAILS PAGE BREADCRUMBS & TITLES
75
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
76
+	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
77 77
 
78
-    // SEARCH PAGE BREADCRUMBS & TITLES
79
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
80
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
78
+	// SEARCH PAGE BREADCRUMBS & TITLES
79
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
80
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
81 81
 
82
-    // AUTHOR PAGE BREADCRUMBS & TITLES
83
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
84
-    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
82
+	// AUTHOR PAGE BREADCRUMBS & TITLES
83
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
84
+	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
85 85
 
86
-    // DISABLE ENFOLD MAPS CALL
87
-    add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1);
86
+	// DISABLE ENFOLD MAPS CALL
87
+	add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1);
88 88
 
89
-    // make top section wide
90
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
91
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
92
-    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
93
-    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
94
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
95
-    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
89
+	// make top section wide
90
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
91
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
92
+	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
93
+	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
94
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
95
+	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
96 96
 
97
-    add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5);
97
+	add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5);
98 98
 
99 99
 } // Close enfold_action_calls
100 100
 
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 function gd_enfold_compat_add_top_section_back()
109 109
 {
110 110
 
111
-    if (is_page_geodir_home() || geodir_is_page('location')) {
112
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
113
-    } elseif (geodir_is_page('listing')) {
114
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
115
-    } elseif (geodir_is_page('detail')) {
116
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
117
-    } elseif (geodir_is_page('search')) {
118
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
119
-    } elseif (geodir_is_page('author')) {
120
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
121
-    }
111
+	if (is_page_geodir_home() || geodir_is_page('location')) {
112
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
113
+	} elseif (geodir_is_page('listing')) {
114
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
115
+	} elseif (geodir_is_page('detail')) {
116
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
117
+	} elseif (geodir_is_page('search')) {
118
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
119
+	} elseif (geodir_is_page('author')) {
120
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
121
+	}
122 122
 
123 123
 
124 124
 }
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
  */
138 138
 function wpgeo_enfold_body_class($classes)
139 139
 {
140
-    $classes[] = 'wpgeo-enfold';
141
-    return $classes;
140
+	$classes[] = 'wpgeo-enfold';
141
+	return $classes;
142 142
 }
143 143
 
144 144
 /**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function geodir_allow_payment_urls_enfold()
151 151
 {
152
-    global $builder;
153
-    remove_action('template_redirect', array($builder, 'template_redirect'), 1000);
152
+	global $builder;
153
+	remove_action('template_redirect', array($builder, 'template_redirect'), 1000);
154 154
 }
155 155
 
156 156
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function enfold_action_wrapper_open()
164 164
 {
165
-    echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>";
166
-    echo "<div class='container template-blog '>";
165
+	echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>";
166
+	echo "<div class='container template-blog '>";
167 167
 }
168 168
 
169 169
 /**
@@ -177,38 +177,38 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function enfold_detail_title($page, $class)
179 179
 {
180
-    //echo '###'.$page;
181
-    global $wp;
182
-    if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) {
183
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
184
-        echo avia_title();
185
-    } elseif ($page == 'details-page') {
186
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
187
-        echo avia_title();
188
-    } elseif ($page == 'listings-page' || $page == 'search-page') {
189
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
190
-        ob_start(); // Start buffering;
191
-        geodir_action_listings_title();
192
-        $gd_title = ob_get_clean();
193
-        $title_p = explode('">', $gd_title);
194
-        $title = str_replace('</h1></header>', "", $title_p[2]);
195
-        //print_r($title_p);
196
-        echo avia_title(array('title' => $title));
197
-    } elseif ($page == 'author-page') {
198
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
199
-        ob_start(); // Start buffering;
200
-        geodir_action_author_page_title();
201
-        $gd_title = ob_get_clean();
202
-        $gd_title = str_replace('<h1>', "", $gd_title);
203
-        $gd_title = str_replace('</h1>', "", $gd_title);
204
-        echo avia_title(array('title' => $gd_title));
205
-    } elseif ($page == 'add-listing-page') {
206
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
207
-        echo avia_title();
208
-    } elseif ($page == 'add-listing-page') {
209
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
210
-        echo avia_title();
211
-    }
180
+	//echo '###'.$page;
181
+	global $wp;
182
+	if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) {
183
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
184
+		echo avia_title();
185
+	} elseif ($page == 'details-page') {
186
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
187
+		echo avia_title();
188
+	} elseif ($page == 'listings-page' || $page == 'search-page') {
189
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
190
+		ob_start(); // Start buffering;
191
+		geodir_action_listings_title();
192
+		$gd_title = ob_get_clean();
193
+		$title_p = explode('">', $gd_title);
194
+		$title = str_replace('</h1></header>', "", $title_p[2]);
195
+		//print_r($title_p);
196
+		echo avia_title(array('title' => $title));
197
+	} elseif ($page == 'author-page') {
198
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
199
+		ob_start(); // Start buffering;
200
+		geodir_action_author_page_title();
201
+		$gd_title = ob_get_clean();
202
+		$gd_title = str_replace('<h1>', "", $gd_title);
203
+		$gd_title = str_replace('</h1>', "", $gd_title);
204
+		echo avia_title(array('title' => $gd_title));
205
+	} elseif ($page == 'add-listing-page') {
206
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
207
+		echo avia_title();
208
+	} elseif ($page == 'add-listing-page') {
209
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
210
+		echo avia_title();
211
+	}
212 212
 
213 213
 }
214 214
 
@@ -223,22 +223,22 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function enfold_detail_breadcrum($trail, $args)
225 225
 {
226
-    ob_start(); // Start buffering;
227
-    geodir_breadcrumb();
228
-    $gd_crums = ob_get_clean();
229
-    if ($gd_crums) {
230
-        $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums);
231
-        $gd_crums = str_replace('</li></ul></div>', "", $gd_crums);
232
-        $gd_crums = str_replace('&nbsp;>&nbsp;', " > ", $gd_crums);
233
-        $gd_crums = str_replace('</li><li>', "", $gd_crums);
234
-        $gd_crums = explode(" > ", $gd_crums);
235
-        $trail_end = array_pop($gd_crums);
236
-        $gd_crums['trail_end'] = $trail_end;
237
-        //print_r($gd_crums);
238
-        //print_r($trail);
239
-        $trail = $gd_crums;
240
-    }
241
-    return $trail;
226
+	ob_start(); // Start buffering;
227
+	geodir_breadcrumb();
228
+	$gd_crums = ob_get_clean();
229
+	if ($gd_crums) {
230
+		$gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums);
231
+		$gd_crums = str_replace('</li></ul></div>', "", $gd_crums);
232
+		$gd_crums = str_replace('&nbsp;>&nbsp;', " > ", $gd_crums);
233
+		$gd_crums = str_replace('</li><li>', "", $gd_crums);
234
+		$gd_crums = explode(" > ", $gd_crums);
235
+		$trail_end = array_pop($gd_crums);
236
+		$gd_crums['trail_end'] = $trail_end;
237
+		//print_r($gd_crums);
238
+		//print_r($trail);
239
+		$trail = $gd_crums;
240
+	}
241
+	return $trail;
242 242
 }
243 243
 
244 244
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  */
254 254
 function enfold_action_wrapper_content_open($type = '', $id = '', $class = '')
255 255
 {
256
-    if (geodir_is_page('login')) {
257
-        echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
258
-    } else {
259
-        echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
260
-    }
261
-    echo '<div class="entry-content-wrapper">';
256
+	if (geodir_is_page('login')) {
257
+		echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
258
+	} else {
259
+		echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
260
+	}
261
+	echo '<div class="entry-content-wrapper">';
262 262
 }
263 263
 
264 264
 
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function enfold_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
276 276
 {
277
-    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
278
-    echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
279
-    echo "<div class='inner_sidebar extralight-border'>";
277
+	$sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
278
+	echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
279
+	echo "<div class='inner_sidebar extralight-border'>";
280 280
 }
281 281
 
282 282
 /**
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function enfold_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
293 293
 {
294
-    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
295
-    echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
296
-    echo "<div class='inner_sidebar extralight-border'>";
294
+	$sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
295
+	echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
296
+	echo "<div class='inner_sidebar extralight-border'>";
297 297
 }
298 298
 
299 299
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function gd_enfold_remove_maps_api($call)
309 309
 {
310
-    return false;
310
+	return false;
311 311
 }
312 312
 
313 313
 
Please login to merge, or discard this patch.
geodirectory.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * This tries to disable cache on homepage as it can be very dynamic.
101 101
      */
102 102
     define('DONOTCACHEPAGE', TRUE);
103
-    $_SERVER['DONOTCACHEPAGE']= TRUE;
103
+    $_SERVER['DONOTCACHEPAGE'] = TRUE;
104 104
 }
105 105
 
106 106
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
111 111
 
112 112
 // Load geodirectory plugin textdomain.
113
-add_action( 'plugins_loaded', 'geodir_load_textdomain' );
113
+add_action('plugins_loaded', 'geodir_load_textdomain');
114 114
 
115 115
 /*
116 116
  * A function to log GD errors no matter the type given.
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
  * @param mixed $log The thing that should be logged.
122 122
  * @package GeoDirectory
123 123
  */
124
-function geodir_error_log($log){
124
+function geodir_error_log($log) {
125 125
     /*
126 126
      * A filter to override the WP_DEBUG setting for function geodir_error_log().
127 127
      *
128 128
      * @since 1.5.7
129 129
      */
130
-    $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
-    if ( true === $should_log ) {
132
-        if ( is_array( $log ) || is_object( $log ) ) {
133
-            error_log( print_r( $log, true ) );
130
+    $should_log = apply_filters('geodir_log_errors', WP_DEBUG);
131
+    if (true === $should_log) {
132
+        if (is_array($log) || is_object($log)) {
133
+            error_log(print_r($log, true));
134 134
         } else {
135
-            error_log( $log );
135
+            error_log($log);
136 136
         }
137 137
     }
138 138
 }
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
    // if ( 'plugins.php' === $pagenow )
226 226
     {
227 227
         // Better update message
228
-        $file   = basename( __FILE__ );
229
-        $folder = basename( dirname( __FILE__ ) );
228
+        $file   = basename(__FILE__);
229
+        $folder = basename(dirname(__FILE__));
230 230
         $hook = "in_plugin_update_message-{$folder}/{$file}";
231 231
         //echo $hook;
232
-        add_action( 'in_plugin_update_message-geodirectory/geodirectory.php', 'geodire_admin_upgrade_notice', 20, 2 );
232
+        add_action('in_plugin_update_message-geodirectory/geodirectory.php', 'geodire_admin_upgrade_notice', 20, 2);
233 233
     }
234 234
 
235 235
 }
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -32,30 +32,30 @@  discard block
 block discarded – undo
32 32
  * CHECK FOR OLD COMPATIBILITY PACKS AND DISABLE IF THEY ARE ACTIVE
33 33
  */
34 34
 if (is_admin()) {
35
-    /**
36
-     * Include WordPress core file so we can use core functions to check for active plugins.
37
-     */
38
-    include_once(ABSPATH . 'wp-admin/includes/plugin.php');
35
+	/**
36
+	 * Include WordPress core file so we can use core functions to check for active plugins.
37
+	 */
38
+	include_once(ABSPATH . 'wp-admin/includes/plugin.php');
39 39
 
40
-    if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
41
-        deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
42
-    }
40
+	if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
41
+		deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
42
+	}
43 43
 
44
-    if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
45
-        deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
46
-    }
44
+	if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
45
+		deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
46
+	}
47 47
 
48
-    if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
49
-        deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
50
-    }
48
+	if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
49
+		deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
50
+	}
51 51
 
52
-    if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
53
-        deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
54
-    }
52
+	if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
53
+		deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
54
+	}
55 55
 
56
-    if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
57
-        deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
58
-    }
56
+	if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
57
+		deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
58
+	}
59 59
 
60 60
 }
61 61
 
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 
97 97
 
98 98
 if ($_SERVER['REQUEST_URI'] == '' || $_SERVER['REQUEST_URI'] == '/') {
99
-    /**
100
-     * This tries to disable cache on homepage as it can be very dynamic.
101
-     */
102
-    define('DONOTCACHEPAGE', TRUE);
103
-    $_SERVER['DONOTCACHEPAGE']= TRUE;
99
+	/**
100
+	 * This tries to disable cache on homepage as it can be very dynamic.
101
+	 */
102
+	define('DONOTCACHEPAGE', TRUE);
103
+	$_SERVER['DONOTCACHEPAGE']= TRUE;
104 104
 }
105 105
 
106 106
 
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
  * @package GeoDirectory
123 123
  */
124 124
 function geodir_error_log($log){
125
-    /*
125
+	/*
126 126
      * A filter to override the WP_DEBUG setting for function geodir_error_log().
127 127
      *
128 128
      * @since 1.5.7
129 129
      */
130
-    $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
-    if ( true === $should_log ) {
132
-        if ( is_array( $log ) || is_object( $log ) ) {
133
-            error_log( print_r( $log, true ) );
134
-        } else {
135
-            error_log( $log );
136
-        }
137
-    }
130
+	$should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
+	if ( true === $should_log ) {
132
+		if ( is_array( $log ) || is_object( $log ) ) {
133
+			error_log( print_r( $log, true ) );
134
+		} else {
135
+			error_log( $log );
136
+		}
137
+	}
138 138
 }
139 139
 
140 140
 /**
@@ -174,62 +174,62 @@  discard block
 block discarded – undo
174 174
  */
175 175
 if (is_admin()) {
176 176
 
177
-    /**
178
-     * Include functions used in admin area only.
179
-     *
180
-     * @since 1.0.0
181
-     */
182
-    require_once('geodirectory-admin/admin_functions.php');
183
-    /**
184
-     * Most actions/hooks used in admin area only are called from here.
185
-     *
186
-     * @since 1.0.0
187
-     */
188
-    require_once('geodirectory-admin/admin_hooks_actions.php');
189
-    /**
190
-     * Most admin JS and CSS is called from here.
191
-     *
192
-     * @since 1.0.0
193
-     */
194
-    require_once('geodirectory-admin/admin_template_tags.php');
195
-    /**
196
-     * Include any functions needed for upgrades.
197
-     *
198
-     * @since 1.0.0
199
-     */
200
-    require_once(geodir_plugin_path() . '/upgrade.php');
201
-    if (get_option('geodir_installed') != 1) {
202
-        /**
203
-         * Define language constants, here as they are not loaded yet.
204
-         *
205
-         * @since 1.0.0
206
-         */
207
-        require_once(geodir_plugin_path() . '/language.php');
208
-        /**
209
-         * Include the plugin install file that sets up the databases and any options on first run.
210
-         *
211
-         * @since 1.0.0
212
-         */
213
-        require_once('geodirectory-admin/admin_install.php');
214
-        register_activation_hook(__FILE__, 'geodir_activation');
215
-    }
216
-    register_deactivation_hook(__FILE__, 'geodir_deactivation');
217
-    register_uninstall_hook(__FILE__, 'geodir_uninstall');
218
-
219
-    /*
177
+	/**
178
+	 * Include functions used in admin area only.
179
+	 *
180
+	 * @since 1.0.0
181
+	 */
182
+	require_once('geodirectory-admin/admin_functions.php');
183
+	/**
184
+	 * Most actions/hooks used in admin area only are called from here.
185
+	 *
186
+	 * @since 1.0.0
187
+	 */
188
+	require_once('geodirectory-admin/admin_hooks_actions.php');
189
+	/**
190
+	 * Most admin JS and CSS is called from here.
191
+	 *
192
+	 * @since 1.0.0
193
+	 */
194
+	require_once('geodirectory-admin/admin_template_tags.php');
195
+	/**
196
+	 * Include any functions needed for upgrades.
197
+	 *
198
+	 * @since 1.0.0
199
+	 */
200
+	require_once(geodir_plugin_path() . '/upgrade.php');
201
+	if (get_option('geodir_installed') != 1) {
202
+		/**
203
+		 * Define language constants, here as they are not loaded yet.
204
+		 *
205
+		 * @since 1.0.0
206
+		 */
207
+		require_once(geodir_plugin_path() . '/language.php');
208
+		/**
209
+		 * Include the plugin install file that sets up the databases and any options on first run.
210
+		 *
211
+		 * @since 1.0.0
212
+		 */
213
+		require_once('geodirectory-admin/admin_install.php');
214
+		register_activation_hook(__FILE__, 'geodir_activation');
215
+	}
216
+	register_deactivation_hook(__FILE__, 'geodir_deactivation');
217
+	register_uninstall_hook(__FILE__, 'geodir_uninstall');
218
+
219
+	/*
220 220
      * Show a upgrade warning message if applicable.
221 221
      *
222 222
      * @since 1.5.6
223 223
      */
224
-    global $pagenow;
224
+	global $pagenow;
225 225
    // if ( 'plugins.php' === $pagenow )
226
-    {
227
-        // Better update message
228
-        $file   = basename( __FILE__ );
229
-        $folder = basename( dirname( __FILE__ ) );
230
-        $hook = "in_plugin_update_message-{$folder}/{$file}";
231
-        //echo $hook;
232
-        add_action( 'in_plugin_update_message-geodirectory/geodirectory.php', 'geodire_admin_upgrade_notice', 20, 2 );
233
-    }
226
+	{
227
+		// Better update message
228
+		$file   = basename( __FILE__ );
229
+		$folder = basename( dirname( __FILE__ ) );
230
+		$hook = "in_plugin_update_message-{$folder}/{$file}";
231
+		//echo $hook;
232
+		add_action( 'in_plugin_update_message-geodirectory/geodirectory.php', 'geodire_admin_upgrade_notice', 20, 2 );
233
+	}
234 234
 
235 235
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 /**
75 75
  * Do not store any revisions (except the one autosave per post).
76 76
  */
77
-if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 0);
77
+if (!defined('WP_POST_REVISIONS')) {
78
+	define('WP_POST_REVISIONS', 0);
79
+}
78 80
 
79 81
 
80 82
 /*
@@ -82,17 +84,29 @@  discard block
 block discarded – undo
82 84
  */
83 85
 
84 86
 /** Define the database name for the countries table. */
85
-if (!defined('GEODIR_COUNTRIES_TABLE')) define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
87
+if (!defined('GEODIR_COUNTRIES_TABLE')) {
88
+	define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
89
+}
86 90
 /** Define the database name for the custom fields table. */
87
-if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
91
+if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) {
92
+	define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
93
+}
88 94
 /** Define the database name for the icons table. */
89
-if (!defined('GEODIR_ICON_TABLE')) define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
95
+if (!defined('GEODIR_ICON_TABLE')) {
96
+	define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
97
+}
90 98
 /** Define the database name for the attachments table. */
91
-if (!defined('GEODIR_ATTACHMENT_TABLE')) define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
99
+if (!defined('GEODIR_ATTACHMENT_TABLE')) {
100
+	define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
101
+}
92 102
 /** Define the database name for the review table. */
93
-if (!defined('GEODIR_REVIEW_TABLE')) define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
103
+if (!defined('GEODIR_REVIEW_TABLE')) {
104
+	define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
105
+}
94 106
 /** Define the database name for the custom sort fields table. */
95
-if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
107
+if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) {
108
+	define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
109
+}
96 110
 
97 111
 
98 112
 if ($_SERVER['REQUEST_URI'] == '' || $_SERVER['REQUEST_URI'] == '/') {
@@ -107,7 +121,9 @@  discard block
 block discarded – undo
107 121
 /*
108 122
  * Localisation items.
109 123
  */
110
-if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
124
+if (!defined('GEODIRECTORY_TEXTDOMAIN')) {
125
+	define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
126
+}
111 127
 
112 128
 // Load geodirectory plugin textdomain.
113 129
 add_action( 'plugins_loaded', 'geodir_load_textdomain' );
Please login to merge, or discard this patch.
geodirectory-functions/post_functions.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
      * @param int $post_id The post ID.
722 722
      * @param string $postmeta Detail table column name.
723 723
      * @param string $meta_value Detail table column value.
724
-     * @return void|bool
724
+     * @return null|false
725 725
      */
726 726
     function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727 727
     {
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
      * @param string $postmeta Detail table column name.
776 776
      * @todo check if this is depreciated
777 777
      * @todo Fix unknown variable mval
778
-     * @return bool
778
+     * @return boolean|null
779 779
      */
780 780
     function geodir_delete_post_meta($post_id, $postmeta)
781 781
     {
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
      * @global string $plugin_prefix Geodirectory plugin table prefix.
2125 2125
      * @param int $deleted_postid The post ID.
2126 2126
      * @param bool $force Optional. Do you want to force delete it? Default: false.
2127
-     * @return bool|void
2127
+     * @return null|false
2128 2128
      */
2129 2129
     function geodir_delete_listing_info($deleted_postid, $force = false)
2130 2130
     {
@@ -2693,7 +2693,7 @@  discard block
 block discarded – undo
2693 2693
  * @since 1.0.0
2694 2694
  * @package GeoDirectory
2695 2695
  * @global object $current_user Current user object.
2696
- * @param int|string $listing_id The post ID.
2696
+ * @param integer $listing_id The post ID.
2697 2697
  * @param bool $exclude_admin Optional. Do you want to exclude admin from the check?. Default true.
2698 2698
  * @return bool
2699 2699
  */
Please login to merge, or discard this patch.
Indentation   +2213 added lines, -2213 removed lines patch added patch discarded remove patch
@@ -20,468 +20,468 @@  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
+		}
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
+		}
226 197
 
227
-        $send_post_submit_mail = false;
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);
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
+		}
228 244
 
229
-        // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
245
+		if ($wp_error && is_wp_error($last_post_id)) {
246
+			return $last_post_id; // Return WP_Error on save failure.
247
+		}
231 248
 
232
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
233
-            $post['ID'] = $request_info['pid'];
249
+		if (!$last_post_id) {
250
+			return false; // Save failure.
251
+		}
234 252
 
235
-            $last_post_id = wp_update_post($post, $wp_error);
236
-        } else {
237
-            $last_post_id = wp_insert_post($post, $wp_error);
253
+		// re-hook this function
254
+		add_action('save_post', 'geodir_post_information_save',10,2);
238 255
 
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
-        }
256
+		$post_tags = '';
257
+		if (!isset($request_info['post_tags'])) {
244 258
 
245
-        if ($wp_error && is_wp_error($last_post_id)) {
246
-            return $last_post_id; // Return WP_Error on save failure.
247
-        }
259
+			$post_type = $request_info['listing_type'];
260
+			$post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
248 261
 
249
-        if (!$last_post_id) {
250
-            return false; // Save failure.
251
-        }
262
+		}
252 263
 
253
-        // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
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
+		);
255 274
 
256
-        $post_tags = '';
257
-        if (!isset($request_info['post_tags'])) {
275
+		$payment_info = array();
276
+		$package_info = array();
258 277
 
259
-            $post_type = $request_info['listing_type'];
260
-            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
278
+		$package_info = (array)geodir_post_package_info($package_info, $post);
261 279
 
262
-        }
280
+		$post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
263 281
 
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
-        );
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
+			}
274 288
 
275
-        $payment_info = array();
276
-        $package_info = array();
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'];
277 292
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
293
+			$gd_post_info = array_merge($gd_post_info, $payment_info);
294
+		}
279 295
 
280
-        $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
296
+		$custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
281 297
 
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
-            }
298
+		foreach ($custom_metaboxes as $key => $val):
288 299
 
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'];
300
+			$name = $val['name'];
301
+			$type = $val['type'];
302
+			$extrafields = $val['extra_fields'];
292 303
 
293
-            $gd_post_info = array_merge($gd_post_info, $payment_info);
294
-        }
304
+			if (trim($type) == 'address') {
305
+				$prefix = $name . '_';
306
+				$address = $prefix . 'address';
295 307
 
296
-        $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
308
+				if (isset($request_info[$address]) && $request_info[$address] != '') {
309
+					$gd_post_info[$address] = $request_info[$address];
310
+				}
297 311
 
298
-        foreach ($custom_metaboxes as $key => $val):
312
+				if ($extrafields != '') {
313
+					$extrafields = unserialize($extrafields);
299 314
 
300
-            $name = $val['name'];
301
-            $type = $val['type'];
302
-            $extrafields = $val['extra_fields'];
303 315
 
304
-            if (trim($type) == 'address') {
305
-                $prefix = $name . '_';
306
-                $address = $prefix . 'address';
316
+					if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
307 317
 
308
-                if (isset($request_info[$address]) && $request_info[$address] != '') {
309
-                    $gd_post_info[$address] = $request_info[$address];
310
-                }
318
+						$location_result = geodir_get_default_location();
311 319
 
312
-                if ($extrafields != '') {
313
-                    $extrafields = unserialize($extrafields);
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;
314 323
 
324
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
315 325
 
316
-                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
326
+					} else {
317 327
 
318
-                        $location_result = geodir_get_default_location();
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'];
319 331
 
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;
332
+						//----------set post locations when import dummy data-------
333
+						$location_result = geodir_get_default_location();
323 334
 
324
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
335
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
+						//-----------------------------------------------------------------
325 337
 
326
-                    } else {
338
+					}
327 339
 
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 340
 
332
-                        //----------set post locations when import dummy data-------
333
-                        $location_result = geodir_get_default_location();
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
+					}
334 344
 
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 345
 
338
-                    }
346
+					if (isset($extrafields['show_map']) && $extrafields['show_map']) {
339 347
 
348
+						if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
+							$gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
+						}
340 351
 
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
-                    }
352
+						if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
+							$gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
+						}
344 355
 
356
+						if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
+							$gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
+						}
345 359
 
346
-                    if (isset($extrafields['show_map']) && $extrafields['show_map']) {
360
+						if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
+							$gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
+						}
347 363
 
348
-                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
349
-                            $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
350
-                        }
364
+					}
351 365
 
352
-                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
353
-                            $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
354
-                        }
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
+				}
355 371
 
356
-                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
357
-                            $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
358
-                        }
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]);
359 377
 
360
-                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
361
-                            $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
362
-                        }
378
+					$extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
+					geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
363 380
 
364
-                    }
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
+					}
365 390
 
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
-                }
391
+					$search = array('dd', 'mm', 'yy');
392
+					$replace = array('d', 'm', 'Y');
371 393
 
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]);
394
+					$date_format = str_replace($search, $replace, $date_format);
377 395
 
378
-                    $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379
-                    geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
396
+					$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name]; // PHP doesn't work well with dd/mm/yyyy format
380 397
 
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
-                    }
398
+					$datetime = date("Y-m-d", strtotime($post_htmlvar_value));
399
+				}
400
+				$gd_post_info[$name] = $datetime;
401
+			} else if ($type == 'multiselect') {
402
+				if (isset($request_info[$name])) {
403
+					$gd_post_info[$name] = $request_info[$name];
404
+				} else {
405
+					if (isset($request_info['gd_field_' . $name])) {
406
+						$gd_post_info[$name] = ''; /* fix de-select for multiselect */
407
+					}
408
+				}
409
+			} else if (isset($request_info[$name])) {
410
+				$gd_post_info[$name] = $request_info[$name];
411
+			}
390 412
 
391
-                    $search = array('dd', 'mm', 'yy');
392
-                    $replace = array('d', 'm', 'Y');
413
+		endforeach;
393 414
 
394
-                    $date_format = str_replace($search, $replace, $date_format);
415
+		if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
416
+			$gd_post_info['post_dummy'] = $request_info['post_dummy'];
417
+		}
395 418
 
396
-                    $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name]; // PHP doesn't work well with dd/mm/yyyy format
419
+		// Save post detail info in detail table
420
+		if (!empty($gd_post_info)) {
421
+			geodir_save_post_info($last_post_id, $gd_post_info);
422
+		}
397 423
 
398
-                    $datetime = date("Y-m-d", strtotime($post_htmlvar_value));
399
-                }
400
-                $gd_post_info[$name] = $datetime;
401
-            } else if ($type == 'multiselect') {
402
-                if (isset($request_info[$name])) {
403
-                    $gd_post_info[$name] = $request_info[$name];
404
-                } else {
405
-                    if (isset($request_info['gd_field_' . $name])) {
406
-                        $gd_post_info[$name] = ''; /* fix de-select for multiselect */
407
-                    }
408
-                }
409
-            } else if (isset($request_info[$name])) {
410
-                $gd_post_info[$name] = $request_info[$name];
411
-            }
412 424
 
413
-        endforeach;
425
+		// Set categories to the listing
426
+		if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
427
+			$post_category = array();
414 428
 
415
-        if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
416
-            $gd_post_info['post_dummy'] = $request_info['post_dummy'];
417
-        }
429
+			foreach ($request_info['post_category'] as $taxonomy => $cat) {
418 430
 
419
-        // Save post detail info in detail table
420
-        if (!empty($gd_post_info)) {
421
-            geodir_save_post_info($last_post_id, $gd_post_info);
422
-        }
431
+				if ($dummy)
432
+					$post_category = $cat;
433
+				else {
423 434
 
435
+					if (!is_array($cat) && strstr($cat, ','))
436
+						$cat = explode(',', $cat);
424 437
 
425
-        // Set categories to the listing
426
-        if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
427
-            $post_category = array();
438
+					if (!empty($cat) && is_array($cat))
439
+						$post_category = array_map('intval', $cat);
440
+				}
428 441
 
429
-            foreach ($request_info['post_category'] as $taxonomy => $cat) {
442
+				wp_set_object_terms($last_post_id, $post_category, $taxonomy);
443
+			}
430 444
 
431
-                if ($dummy)
432
-                    $post_category = $cat;
433
-                else {
445
+			$post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
434 446
 
435
-                    if (!is_array($cat) && strstr($cat, ','))
436
-                        $cat = explode(',', $cat);
447
+			$post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
448
+			geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
437 449
 
438
-                    if (!empty($cat) && is_array($cat))
439
-                        $post_category = array_map('intval', $cat);
440
-                }
450
+		}
441 451
 
442
-                wp_set_object_terms($last_post_id, $post_category, $taxonomy);
443
-            }
452
+		$post_tags = '';
453
+		// Set tags to the listing
454
+		if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455
+			$post_tags = explode(",", $request_info['post_tags']);
456
+		} elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
+			if ($dummy)
458
+				$post_tags = $request_info['post_tags'];
459
+		} else {
460
+			if ($dummy)
461
+				$post_tags = array($request_info['post_title']);
462
+		}
444 463
 
445
-            $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
464
+		if (is_array($post_tags)) {
465
+			$taxonomy = $request_info['listing_type'] . '_tags';
466
+			wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
467
+		}
446 468
 
447
-            $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
448
-            geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
449
-
450
-        }
451 469
 
452
-        $post_tags = '';
453
-        // Set tags to the listing
454
-        if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455
-            $post_tags = explode(",", $request_info['post_tags']);
456
-        } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
-            if ($dummy)
458
-                $post_tags = $request_info['post_tags'];
459
-        } else {
460
-            if ($dummy)
461
-                $post_tags = array($request_info['post_title']);
462
-        }
470
+		// Insert attechment
463 471
 
464
-        if (is_array($post_tags)) {
465
-            $taxonomy = $request_info['listing_type'] . '_tags';
466
-            wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
467
-        }
468
-
469
-
470
-        // Insert attechment
472
+		if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
473
+			if (!$dummy) {
474
+				$tmpimgArr = trim($request_info['post_images'], ",");
475
+				$tmpimgArr = explode(",", $tmpimgArr);
476
+				geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
+			} else{
478
+				geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479
+			}
471 480
 
472
-        if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
473
-            if (!$dummy) {
474
-                $tmpimgArr = trim($request_info['post_images'], ",");
475
-                $tmpimgArr = explode(",", $tmpimgArr);
476
-                geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
-            } else{
478
-                geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479
-            }
480 481
 
482
+		} elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
481 483
 
482
-        } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
483
-
484
-            /* Delete Attachments
484
+			/* Delete Attachments
485 485
 			$postcurr_images = geodir_get_images($last_post_id);
486 486
 
487 487
 			$wpdb->query(
@@ -497,34 +497,34 @@  discard block
 block discarded – undo
497 497
 			geodir_save_post_info($last_post_id, $gd_post_featured_img);
498 498
 			*/
499 499
 
500
-        }
500
+		}
501 501
 
502
-        geodir_remove_temp_images();
503
-        geodir_set_wp_featured_image($last_post_id);
502
+		geodir_remove_temp_images();
503
+		geodir_set_wp_featured_image($last_post_id);
504 504
 
505
-        /**
506
-         * Called after a listing is saved to the database and before any email have been sent.
507
-         *
508
-         * @since 1.0.0
509
-         * @param int $last_post_id The saved post ID.
510
-         * @param array $request_info The post details in an array.
511
-         * @see 'geodir_after_save_listinginfo'
512
-         */
513
-        do_action('geodir_after_save_listing', $last_post_id, $request_info);
505
+		/**
506
+		 * Called after a listing is saved to the database and before any email have been sent.
507
+		 *
508
+		 * @since 1.0.0
509
+		 * @param int $last_post_id The saved post ID.
510
+		 * @param array $request_info The post details in an array.
511
+		 * @see 'geodir_after_save_listinginfo'
512
+		 */
513
+		do_action('geodir_after_save_listing', $last_post_id, $request_info);
514 514
 
515
-        //die;
515
+		//die;
516 516
 
517
-        if ($send_post_submit_mail) { // if new post send out email
518
-            $to_name = geodir_get_client_name($current_user->ID);
519
-            geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
520
-        }
521
-        /*
517
+		if ($send_post_submit_mail) { // if new post send out email
518
+			$to_name = geodir_get_client_name($current_user->ID);
519
+			geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
520
+		}
521
+		/*
522 522
          * Unset the session so we don't loop.
523 523
          */
524
-        $gd_session->un_set('listing');
525
-        return $last_post_id;
524
+		$gd_session->un_set('listing');
525
+		return $last_post_id;
526 526
 
527
-    }
527
+	}
528 528
 
529 529
 }
530 530
 
@@ -543,586 +543,586 @@  discard block
 block discarded – undo
543 543
 function geodir_get_post_info($post_id = '')
544 544
 {
545 545
 
546
-    global $wpdb, $plugin_prefix, $post, $post_info;
546
+	global $wpdb, $plugin_prefix, $post, $post_info;
547 547
 
548
-    if ($post_id == '' && !empty($post))
549
-        $post_id = $post->ID;
548
+	if ($post_id == '' && !empty($post))
549
+		$post_id = $post->ID;
550 550
 
551
-    $post_type = get_post_type($post_id);
551
+	$post_type = get_post_type($post_id);
552 552
 
553
-    $all_postypes = geodir_get_posttypes();
553
+	$all_postypes = geodir_get_posttypes();
554 554
 
555
-    if (!in_array($post_type, $all_postypes))
556
-        return false;
555
+	if (!in_array($post_type, $all_postypes))
556
+		return false;
557 557
 
558
-    $table = $plugin_prefix . $post_type . '_detail';
558
+	$table = $plugin_prefix . $post_type . '_detail';
559 559
 
560
-    /**
561
-     * Apply Filter to change Post info
562
-     *
563
-     * You can use this filter to change Post info.
564
-     *
565
-     * @since 1.0.0
566
-     * @package GeoDirectory
567
-     */
568
-    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
560
+	/**
561
+	 * Apply Filter to change Post info
562
+	 *
563
+	 * You can use this filter to change Post info.
564
+	 *
565
+	 * @since 1.0.0
566
+	 * @package GeoDirectory
567
+	 */
568
+	$query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
569 569
 			  WHERE p.ID = pd.post_id
570 570
 			  AND post_id = " . $post_id);
571 571
 
572
-    $post_detail = $wpdb->get_row($query);
572
+	$post_detail = $wpdb->get_row($query);
573 573
 
574
-    return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
574
+	return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
575 575
 
576 576
 }
577 577
 
578 578
 
579 579
 if (!function_exists('geodir_save_post_info')) {
580
-    /**
581
-     * Saves post detail info in detail table.
582
-     *
583
-     * @since 1.0.0
584
-     * @package GeoDirectory
585
-     * @global object $wpdb WordPress Database object.
586
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
587
-     * @param int $post_id The post ID.
588
-     * @param array $postinfo_array {
589
-     *    Post info that needs to be saved in detail table.
590
-     *
591
-     *    @type string $post_title              Listing title.
592
-     *    @type string $post_tags               Listing tags.
593
-     *    @type string $post_status             Listing post status.
594
-     *    @type string $post_location_id        Listing location ID.
595
-     *    @type string $claimed                 Todo Desc needed.
596
-     *    @type string $businesses              Todo Desc needed.
597
-     *    @type int    $submit_time             Submitted time in unix timestamp.
598
-     *    @type string $submit_ip               Submitted IP.
599
-     *    @type string $expire_date             Listing expiration date.
600
-     *    @type int    $package_id              Listing package ID.
601
-     *    @type int    $alive_days              Todo Desc needed.
602
-     *    @type int    $is_featured             Is this a featured listing?.
603
-     *    @type string $post_address            Listing address.
604
-     *    @type string $post_city               Listing city.
605
-     *    @type string $post_region             Listing region.
606
-     *    @type string $post_country            Listing country.
607
-     *    @type string $post_locations          Listing locations.
608
-     *    @type string $post_zip                Listing zip.
609
-     *    @type string $post_latitude           Listing latitude.
610
-     *    @type string $post_longitude          Listing longitude.
611
-     *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
612
-     *    @type string $post_mapzoom            Listing mapzoom Default "9".
613
-     *    @type string $geodir_timing           Business timing info.
614
-     *    @type string $geodir_contact          Contact number.
615
-     *    @type string $geodir_email            Business contact email.
616
-     *    @type string $geodir_website          Business website.
617
-     *    @type string $geodir_twitter          Twitter link.
618
-     *    @type string $geodir_facebook         Facebook link.
619
-     *    @type string $geodir_video            Video link.
620
-     *    @type string $geodir_special_offers   Speacial offers.
621
-     *
622
-     * }
623
-     * @return bool
624
-     */
625
-    function geodir_save_post_info($post_id, $postinfo_array = array())
626
-    {
627
-        global $wpdb, $plugin_prefix;
628
-
629
-        $post_type = get_post_type($post_id);
630
-
631
-        $table = $plugin_prefix . $post_type . '_detail';
632
-
633
-        /**
634
-         * Filter to change Post info
635
-         *
636
-         * You can use this filter to change Post info.
637
-         *
638
-         * @since 1.0.0
639
-         * @package GeoDirectory
640
-         * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
641
-         * @param int $post_id The post ID.
642
-         */
580
+	/**
581
+	 * Saves post detail info in detail table.
582
+	 *
583
+	 * @since 1.0.0
584
+	 * @package GeoDirectory
585
+	 * @global object $wpdb WordPress Database object.
586
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
587
+	 * @param int $post_id The post ID.
588
+	 * @param array $postinfo_array {
589
+	 *    Post info that needs to be saved in detail table.
590
+	 *
591
+	 *    @type string $post_title              Listing title.
592
+	 *    @type string $post_tags               Listing tags.
593
+	 *    @type string $post_status             Listing post status.
594
+	 *    @type string $post_location_id        Listing location ID.
595
+	 *    @type string $claimed                 Todo Desc needed.
596
+	 *    @type string $businesses              Todo Desc needed.
597
+	 *    @type int    $submit_time             Submitted time in unix timestamp.
598
+	 *    @type string $submit_ip               Submitted IP.
599
+	 *    @type string $expire_date             Listing expiration date.
600
+	 *    @type int    $package_id              Listing package ID.
601
+	 *    @type int    $alive_days              Todo Desc needed.
602
+	 *    @type int    $is_featured             Is this a featured listing?.
603
+	 *    @type string $post_address            Listing address.
604
+	 *    @type string $post_city               Listing city.
605
+	 *    @type string $post_region             Listing region.
606
+	 *    @type string $post_country            Listing country.
607
+	 *    @type string $post_locations          Listing locations.
608
+	 *    @type string $post_zip                Listing zip.
609
+	 *    @type string $post_latitude           Listing latitude.
610
+	 *    @type string $post_longitude          Listing longitude.
611
+	 *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
612
+	 *    @type string $post_mapzoom            Listing mapzoom Default "9".
613
+	 *    @type string $geodir_timing           Business timing info.
614
+	 *    @type string $geodir_contact          Contact number.
615
+	 *    @type string $geodir_email            Business contact email.
616
+	 *    @type string $geodir_website          Business website.
617
+	 *    @type string $geodir_twitter          Twitter link.
618
+	 *    @type string $geodir_facebook         Facebook link.
619
+	 *    @type string $geodir_video            Video link.
620
+	 *    @type string $geodir_special_offers   Speacial offers.
621
+	 *
622
+	 * }
623
+	 * @return bool
624
+	 */
625
+	function geodir_save_post_info($post_id, $postinfo_array = array())
626
+	{
627
+		global $wpdb, $plugin_prefix;
628
+
629
+		$post_type = get_post_type($post_id);
630
+
631
+		$table = $plugin_prefix . $post_type . '_detail';
632
+
633
+		/**
634
+		 * Filter to change Post info
635
+		 *
636
+		 * You can use this filter to change Post info.
637
+		 *
638
+		 * @since 1.0.0
639
+		 * @package GeoDirectory
640
+		 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
641
+		 * @param int $post_id The post ID.
642
+		 */
643
+
644
+		$postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
645
+
646
+		if (!empty($postmeta) && $post_id) {
647
+			$post_meta_set_query = '';
648
+
649
+			foreach ($postmeta as $mkey => $mval) {
650
+				if (geodir_column_exist($table, $mkey)) {
651
+					if (is_array($mval)) {
652
+						$mval = implode(",", $mval);
653
+					}
654
+
655
+					$post_meta_set_query .= $mkey . " = '" . $mval . "', ";
656
+				}
657
+			}
643 658
 
644
-        $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
659
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
645 660
 
646
-        if (!empty($postmeta) && $post_id) {
647
-            $post_meta_set_query = '';
661
+			$post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
648 662
 
649
-            foreach ($postmeta as $mkey => $mval) {
650
-                if (geodir_column_exist($table, $mkey)) {
651
-                    if (is_array($mval)) {
652
-                        $mval = implode(",", $mval);
653
-                    }
663
+			/**
664
+			 * Called before saving the listing info.
665
+			 *
666
+			 * @since 1.0.0
667
+			 * @package GeoDirectory
668
+			 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
669
+			 * @param int $post_id The post ID.
670
+			 */
671
+			do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
654 672
 
655
-                    $post_meta_set_query .= $mkey . " = '" . $mval . "', ";
656
-                }
657
-            }
673
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
658 674
 
659
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
675
+				$wpdb->query(
676
+					$wpdb->prepare(
677
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
678
+						array($post_id)
679
+					)
680
+				);
660 681
 
661
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
662 682
 
663
-            /**
664
-             * Called before saving the listing info.
665
-             *
666
-             * @since 1.0.0
667
-             * @package GeoDirectory
668
-             * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
669
-             * @param int $post_id The post ID.
670
-             */
671
-            do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
683
+			} else {
672 684
 
673
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
685
+				$wpdb->query(
686
+					$wpdb->prepare(
687
+						"INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
688
+						array($post_id)
689
+					)
690
+				);
674 691
 
675
-                $wpdb->query(
676
-                    $wpdb->prepare(
677
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",
678
-                        array($post_id)
679
-                    )
680
-                );
692
+			}
681 693
 
694
+			/**
695
+			 * Called after saving the listing info.
696
+			 *
697
+			 * @since 1.0.0
698
+			 * @package GeoDirectory
699
+			 * @param array $postinfo_array Post info that needs to be saved in detail table.
700
+			 * @param int $post_id The post ID.
701
+			 * @see 'geodir_after_save_listing'
702
+			 */
703
+			do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
704
+
705
+			return true;
706
+		} else
707
+			return false;
682 708
 
683
-            } else {
709
+	}
710
+}
684 711
 
685
-                $wpdb->query(
686
-                    $wpdb->prepare(
687
-                        "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,
688
-                        array($post_id)
689
-                    )
690
-                );
691 712
 
692
-            }
713
+if (!function_exists('geodir_save_post_meta')) {
714
+	/**
715
+	 * Save or update post custom fields.
716
+	 *
717
+	 * @since 1.0.0
718
+	 * @package GeoDirectory
719
+	 * @global object $wpdb WordPress Database object.
720
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
721
+	 * @param int $post_id The post ID.
722
+	 * @param string $postmeta Detail table column name.
723
+	 * @param string $meta_value Detail table column value.
724
+	 * @return void|bool
725
+	 */
726
+	function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727
+	{
728
+
729
+		global $wpdb, $plugin_prefix;
730
+
731
+		$post_type = get_post_type($post_id);
732
+
733
+		$table = $plugin_prefix . $post_type . '_detail';
734
+
735
+		if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
736
+
737
+			if (is_array($meta_value)) {
738
+				$meta_value = implode(",", $meta_value);
739
+			}
693 740
 
694
-            /**
695
-             * Called after saving the listing info.
696
-             *
697
-             * @since 1.0.0
698
-             * @package GeoDirectory
699
-             * @param array $postinfo_array Post info that needs to be saved in detail table.
700
-             * @param int $post_id The post ID.
701
-             * @see 'geodir_after_save_listing'
702
-             */
703
-            do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
741
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
704 742
 
705
-            return true;
706
-        } else
707
-            return false;
743
+				$wpdb->query(
744
+					$wpdb->prepare(
745
+						"UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
746
+						array($post_id)
747
+					)
748
+				);
708 749
 
709
-    }
710
-}
750
+			} else {
711 751
 
752
+				$wpdb->query(
753
+					$wpdb->prepare(
754
+						"INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
755
+						array($post_id)
756
+					)
757
+				);
758
+			}
712 759
 
713
-if (!function_exists('geodir_save_post_meta')) {
714
-    /**
715
-     * Save or update post custom fields.
716
-     *
717
-     * @since 1.0.0
718
-     * @package GeoDirectory
719
-     * @global object $wpdb WordPress Database object.
720
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
721
-     * @param int $post_id The post ID.
722
-     * @param string $postmeta Detail table column name.
723
-     * @param string $meta_value Detail table column value.
724
-     * @return void|bool
725
-     */
726
-    function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727
-    {
728
-
729
-        global $wpdb, $plugin_prefix;
730
-
731
-        $post_type = get_post_type($post_id);
732
-
733
-        $table = $plugin_prefix . $post_type . '_detail';
734
-
735
-        if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
736
-
737
-            if (is_array($meta_value)) {
738
-                $meta_value = implode(",", $meta_value);
739
-            }
740
-
741
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
742
-
743
-                $wpdb->query(
744
-                    $wpdb->prepare(
745
-                        "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
746
-                        array($post_id)
747
-                    )
748
-                );
749
-
750
-            } else {
751
-
752
-                $wpdb->query(
753
-                    $wpdb->prepare(
754
-                        "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
755
-                        array($post_id)
756
-                    )
757
-                );
758
-            }
759
-
760
-
761
-        } else
762
-            return false;
763
-    }
760
+
761
+		} else
762
+			return false;
763
+	}
764 764
 }
765 765
 
766 766
 if (!function_exists('geodir_delete_post_meta')) {
767
-    /**
768
-     * Delete post custom fields.
769
-     *
770
-     * @since 1.0.0
771
-     * @package GeoDirectory
772
-     * @global object $wpdb WordPress Database object.
773
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
774
-     * @param int $post_id The post ID.
775
-     * @param string $postmeta Detail table column name.
776
-     * @todo check if this is depreciated
777
-     * @todo Fix unknown variable mval
778
-     * @return bool
779
-     */
780
-    function geodir_delete_post_meta($post_id, $postmeta)
781
-    {
782
-
783
-        global $wpdb, $plugin_prefix;
784
-
785
-        $post_type = get_post_type($post_id);
786
-
787
-        $table = $plugin_prefix . $post_type . '_detail';
788
-
789
-        if (is_array($postmeta) && !empty($postmeta) && $post_id) {
790
-            $post_meta_set_query = '';
791
-
792
-            foreach ($postmeta as $mkey) {
793
-                if ($mval != '')
794
-                    $post_meta_set_query .= $mkey . " = '', ";
795
-            }
796
-
797
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
798
-
799
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
800
-
801
-                $wpdb->query(
802
-                    $wpdb->prepare(
803
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
804
-                        array($post_id)
805
-                    )
806
-                );
807
-
808
-                return true;
809
-            }
810
-
811
-        } elseif ($postmeta != '' && $post_id) {
812
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
813
-
814
-                $wpdb->query(
815
-                    $wpdb->prepare(
816
-                        "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
817
-                        array($post_id)
818
-                    )
819
-                );
820
-
821
-                return true;
822
-            }
823
-
824
-        } else
825
-            return false;
826
-    }
767
+	/**
768
+	 * Delete post custom fields.
769
+	 *
770
+	 * @since 1.0.0
771
+	 * @package GeoDirectory
772
+	 * @global object $wpdb WordPress Database object.
773
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
774
+	 * @param int $post_id The post ID.
775
+	 * @param string $postmeta Detail table column name.
776
+	 * @todo check if this is depreciated
777
+	 * @todo Fix unknown variable mval
778
+	 * @return bool
779
+	 */
780
+	function geodir_delete_post_meta($post_id, $postmeta)
781
+	{
782
+
783
+		global $wpdb, $plugin_prefix;
784
+
785
+		$post_type = get_post_type($post_id);
786
+
787
+		$table = $plugin_prefix . $post_type . '_detail';
788
+
789
+		if (is_array($postmeta) && !empty($postmeta) && $post_id) {
790
+			$post_meta_set_query = '';
791
+
792
+			foreach ($postmeta as $mkey) {
793
+				if ($mval != '')
794
+					$post_meta_set_query .= $mkey . " = '', ";
795
+			}
796
+
797
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
798
+
799
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
800
+
801
+				$wpdb->query(
802
+					$wpdb->prepare(
803
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
804
+						array($post_id)
805
+					)
806
+				);
807
+
808
+				return true;
809
+			}
810
+
811
+		} elseif ($postmeta != '' && $post_id) {
812
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
813
+
814
+				$wpdb->query(
815
+					$wpdb->prepare(
816
+						"UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
817
+						array($post_id)
818
+					)
819
+				);
820
+
821
+				return true;
822
+			}
823
+
824
+		} else
825
+			return false;
826
+	}
827 827
 }
828 828
 
829 829
 
830 830
 if (!function_exists('geodir_get_post_meta')) {
831
-    /**
832
-     * Get post custom meta.
833
-     *
834
-     * @since 1.0.0
835
-     * @package GeoDirectory
836
-     * @global object $wpdb WordPress Database object.
837
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
838
-     * @param int $post_id The post ID.
839
-     * @param string $meta_key The meta key to retrieve.
840
-     * @param bool $single Optional. Whether to return a single value. Default false.
841
-     * @todo single variable not yet implemented.
842
-     * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
843
-     */
844
-    function geodir_get_post_meta($post_id, $meta_key, $single = false)
845
-    {
846
-        if (!$post_id) {
847
-            return false;
848
-        }
849
-        global $wpdb, $plugin_prefix;
850
-
851
-        $all_postypes = geodir_get_posttypes();
852
-
853
-        $post_type = get_post_type($post_id);
854
-
855
-        if (!in_array($post_type, $all_postypes))
856
-            return false;
857
-
858
-        $table = $plugin_prefix . $post_type . '_detail';
859
-
860
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
861
-
862
-            if ($meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)))) {
863
-                $meta_value = maybe_serialize($meta_value);
864
-                return $meta_value;
865
-            } else
866
-                return false;
867
-
868
-        } else
869
-            return false;
870
-    }
831
+	/**
832
+	 * Get post custom meta.
833
+	 *
834
+	 * @since 1.0.0
835
+	 * @package GeoDirectory
836
+	 * @global object $wpdb WordPress Database object.
837
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
838
+	 * @param int $post_id The post ID.
839
+	 * @param string $meta_key The meta key to retrieve.
840
+	 * @param bool $single Optional. Whether to return a single value. Default false.
841
+	 * @todo single variable not yet implemented.
842
+	 * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
843
+	 */
844
+	function geodir_get_post_meta($post_id, $meta_key, $single = false)
845
+	{
846
+		if (!$post_id) {
847
+			return false;
848
+		}
849
+		global $wpdb, $plugin_prefix;
850
+
851
+		$all_postypes = geodir_get_posttypes();
852
+
853
+		$post_type = get_post_type($post_id);
854
+
855
+		if (!in_array($post_type, $all_postypes))
856
+			return false;
857
+
858
+		$table = $plugin_prefix . $post_type . '_detail';
859
+
860
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
861
+
862
+			if ($meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)))) {
863
+				$meta_value = maybe_serialize($meta_value);
864
+				return $meta_value;
865
+			} else
866
+				return false;
867
+
868
+		} else
869
+			return false;
870
+	}
871 871
 }
872 872
 
873 873
 
874 874
 if (!function_exists('geodir_save_post_images')) {
875
-    /**
876
-     * Save post attachments.
877
-     *
878
-     * @since 1.0.0
879
-     * @package GeoDirectory
880
-     * @global object $wpdb WordPress Database object.
881
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
882
-     * @global object $current_user Current user object.
883
-     * @param int $post_id The post ID.
884
-     * @param array $post_image Post image urls as an array.
885
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
886
-     */
887
-    function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
888
-    {
875
+	/**
876
+	 * Save post attachments.
877
+	 *
878
+	 * @since 1.0.0
879
+	 * @package GeoDirectory
880
+	 * @global object $wpdb WordPress Database object.
881
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
882
+	 * @global object $current_user Current user object.
883
+	 * @param int $post_id The post ID.
884
+	 * @param array $post_image Post image urls as an array.
885
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
886
+	 */
887
+	function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
888
+	{
889 889
 
890 890
 
891
-        global $wpdb, $plugin_prefix, $current_user;
891
+		global $wpdb, $plugin_prefix, $current_user;
892 892
 
893
-        $post_type = get_post_type($post_id);
893
+		$post_type = get_post_type($post_id);
894 894
 
895
-        $table = $plugin_prefix . $post_type . '_detail';
895
+		$table = $plugin_prefix . $post_type . '_detail';
896 896
 
897
-        $post_images = geodir_get_images($post_id);
897
+		$post_images = geodir_get_images($post_id);
898 898
 
899
-        $wpdb->query(
900
-            $wpdb->prepare(
901
-                "UPDATE " . $table . " SET featured_image = '' where post_id =%d",
902
-                array($post_id)
903
-            )
904
-        );
899
+		$wpdb->query(
900
+			$wpdb->prepare(
901
+				"UPDATE " . $table . " SET featured_image = '' where post_id =%d",
902
+				array($post_id)
903
+			)
904
+		);
905 905
 
906
-        $invalid_files = $post_images;
907
-        $valid_file_ids = array();
908
-        $valid_files_condition = '';
909
-        $geodir_uploaddir = '';
906
+		$invalid_files = $post_images;
907
+		$valid_file_ids = array();
908
+		$valid_files_condition = '';
909
+		$geodir_uploaddir = '';
910 910
 
911
-        $remove_files = array();
911
+		$remove_files = array();
912 912
 
913
-        if (!empty($post_image)) {
913
+		if (!empty($post_image)) {
914 914
 
915
-            $uploads = wp_upload_dir();
916
-            $uploads_dir = $uploads['path'];
915
+			$uploads = wp_upload_dir();
916
+			$uploads_dir = $uploads['path'];
917 917
 
918
-            $geodir_uploadpath = $uploads['path'];
919
-            $geodir_uploadurl = $uploads['url'];
920
-            $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
918
+			$geodir_uploadpath = $uploads['path'];
919
+			$geodir_uploadurl = $uploads['url'];
920
+			$sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
921 921
 
922
-            $invalid_files = array();
923
-            $postcurr_images = array();
922
+			$invalid_files = array();
923
+			$postcurr_images = array();
924 924
 
925
-            for ($m = 0; $m < count($post_image); $m++) {
926
-                $menu_order = $m + 1;
925
+			for ($m = 0; $m < count($post_image); $m++) {
926
+				$menu_order = $m + 1;
927 927
 
928
-                $file_path = '';
929
-                /* --------- start ------- */
928
+				$file_path = '';
929
+				/* --------- start ------- */
930 930
 
931
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
931
+				$split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
932 932
 
933
-                $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
933
+				$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
934 934
 
935 935
 
936
-                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)))) {
936
+				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)))) {
937 937
 
938
-                    /* --------- end ------- */
939
-                    $curr_img_url = $post_image[$m];
938
+					/* --------- end ------- */
939
+					$curr_img_url = $post_image[$m];
940 940
 
941
-                    $image_name_arr = explode('/', $curr_img_url);
941
+					$image_name_arr = explode('/', $curr_img_url);
942 942
 
943
-                    $count_image_name_arr = count($image_name_arr) - 2;
943
+					$count_image_name_arr = count($image_name_arr) - 2;
944 944
 
945
-                    $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
945
+					$count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
946 946
 
947
-                    $curr_img_dir = $image_name_arr[$count_image_name_arr];
947
+					$curr_img_dir = $image_name_arr[$count_image_name_arr];
948 948
 
949
-                    $filename = end($image_name_arr);
950
-                    if (strpos($filename, '?') !== false) {
951
-                        list($filename) = explode('?', $filename);
952
-                    }
949
+					$filename = end($image_name_arr);
950
+					if (strpos($filename, '?') !== false) {
951
+						list($filename) = explode('?', $filename);
952
+					}
953 953
 
954
-                    $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
955
-                    $curr_img_dir = str_replace($filename, "", $curr_img_dir);
954
+					$curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
955
+					$curr_img_dir = str_replace($filename, "", $curr_img_dir);
956 956
 
957
-                    $img_name_arr = explode('.', $filename);
957
+					$img_name_arr = explode('.', $filename);
958 958
 
959
-                    $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
960
-                    if (!empty($img_name_arr) && count($img_name_arr) > 2) {
961
-                        $new_img_name_arr = $img_name_arr;
962
-                        if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
963
-                            unset($new_img_name_arr[count($img_name_arr) - 1]);
964
-                            $file_title = implode('.', $new_img_name_arr);
965
-                        }
966
-                    }
967
-                    $file_title = sanitize_file_name($file_title);
968
-                    $file_name = sanitize_file_name($filename);
959
+					$file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
960
+					if (!empty($img_name_arr) && count($img_name_arr) > 2) {
961
+						$new_img_name_arr = $img_name_arr;
962
+						if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
963
+							unset($new_img_name_arr[count($img_name_arr) - 1]);
964
+							$file_title = implode('.', $new_img_name_arr);
965
+						}
966
+					}
967
+					$file_title = sanitize_file_name($file_title);
968
+					$file_name = sanitize_file_name($filename);
969 969
 
970
-                    $arr_file_type = wp_check_filetype($filename);
970
+					$arr_file_type = wp_check_filetype($filename);
971 971
 
972
-                    $uploaded_file_type = $arr_file_type['type'];
972
+					$uploaded_file_type = $arr_file_type['type'];
973 973
 
974
-                    // Set an array containing a list of acceptable formats
975
-                    $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
974
+					// Set an array containing a list of acceptable formats
975
+					$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
976 976
 
977
-                    // If the uploaded file is the right format
978
-                    if (in_array($uploaded_file_type, $allowed_file_types)) {
979
-                        if (!function_exists('wp_handle_upload')) {
980
-                            require_once(ABSPATH . 'wp-admin/includes/file.php');
981
-                        }
977
+					// If the uploaded file is the right format
978
+					if (in_array($uploaded_file_type, $allowed_file_types)) {
979
+						if (!function_exists('wp_handle_upload')) {
980
+							require_once(ABSPATH . 'wp-admin/includes/file.php');
981
+						}
982 982
 
983
-                        if (!is_dir($geodir_uploadpath)) {
984
-                            mkdir($geodir_uploadpath);
985
-                        }
983
+						if (!is_dir($geodir_uploadpath)) {
984
+							mkdir($geodir_uploadpath);
985
+						}
986 986
 
987
-                        $external_img = false;
988
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
989
-                        } else {
990
-                            $external_img = true;
991
-                        }
987
+						$external_img = false;
988
+						if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
989
+						} else {
990
+							$external_img = true;
991
+						}
992 992
 
993
-                        if ($dummy || $external_img) {
994
-                            $uploaded_file = array();
995
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
993
+						if ($dummy || $external_img) {
994
+							$uploaded_file = array();
995
+							$uploaded = (array)fetch_remote_file($curr_img_url);
996 996
 
997
-                            if (isset($uploaded['error']) && empty($uploaded['error'])) {
998
-                                $new_name = basename($uploaded['file']);
999
-                                $uploaded_file = $uploaded;
1000
-                            }else{
1001
-                                print_r($uploaded);exit;
1002
-                            }
1003
-                            $external_img = false;
1004
-                        } else {
1005
-                            $new_name = $post_id . '_' . $file_name;
997
+							if (isset($uploaded['error']) && empty($uploaded['error'])) {
998
+								$new_name = basename($uploaded['file']);
999
+								$uploaded_file = $uploaded;
1000
+							}else{
1001
+								print_r($uploaded);exit;
1002
+							}
1003
+							$external_img = false;
1004
+						} else {
1005
+							$new_name = $post_id . '_' . $file_name;
1006 1006
 
1007
-                            if ($curr_img_dir == $sub_dir) {
1008
-                                $img_path = $geodir_uploadpath . '/' . $filename;
1009
-                                $img_url = $geodir_uploadurl . '/' . $filename;
1010
-                            } else {
1011
-                                $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1012
-                                $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1013
-                            }
1007
+							if ($curr_img_dir == $sub_dir) {
1008
+								$img_path = $geodir_uploadpath . '/' . $filename;
1009
+								$img_url = $geodir_uploadurl . '/' . $filename;
1010
+							} else {
1011
+								$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1012
+								$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1013
+							}
1014 1014
 
1015
-                            $uploaded_file = '';
1015
+							$uploaded_file = '';
1016 1016
 
1017
-                            if (file_exists($img_path)) {
1018
-                                $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1019
-                                $file_path = '';
1020
-                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1021
-                                $uploaded_file = true;
1022
-                                $file_path = $curr_img_dir . '/' . $filename;
1023
-                            }
1017
+							if (file_exists($img_path)) {
1018
+								$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1019
+								$file_path = '';
1020
+							} else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1021
+								$uploaded_file = true;
1022
+								$file_path = $curr_img_dir . '/' . $filename;
1023
+							}
1024 1024
 
1025
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
-                                unlink($img_path);
1027
-                        }
1025
+							if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
+								unlink($img_path);
1027
+						}
1028 1028
 
1029
-                        if (!empty($uploaded_file)) {
1030
-                            if (!isset($file_path) || !$file_path) {
1031
-                                $file_path = $sub_dir . '/' . $new_name;
1032
-                            }
1029
+						if (!empty($uploaded_file)) {
1030
+							if (!isset($file_path) || !$file_path) {
1031
+								$file_path = $sub_dir . '/' . $new_name;
1032
+							}
1033 1033
 
1034
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1034
+							$postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1035 1035
 
1036
-                            if ($menu_order == 1) {
1036
+							if ($menu_order == 1) {
1037 1037
 
1038
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1038
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1039 1039
 
1040
-                            }
1040
+							}
1041 1041
 
1042
-                            // Set up options array to add this file as an attachment
1043
-                            $attachment = array();
1044
-                            $attachment['post_id'] = $post_id;
1045
-                            $attachment['title'] = $file_title;
1046
-                            $attachment['content'] = '';
1047
-                            $attachment['file'] = $file_path;
1048
-                            $attachment['mime_type'] = $uploaded_file_type;
1049
-                            $attachment['menu_order'] = $menu_order;
1050
-                            $attachment['is_featured'] = 0;
1042
+							// Set up options array to add this file as an attachment
1043
+							$attachment = array();
1044
+							$attachment['post_id'] = $post_id;
1045
+							$attachment['title'] = $file_title;
1046
+							$attachment['content'] = '';
1047
+							$attachment['file'] = $file_path;
1048
+							$attachment['mime_type'] = $uploaded_file_type;
1049
+							$attachment['menu_order'] = $menu_order;
1050
+							$attachment['is_featured'] = 0;
1051 1051
 
1052
-                            $attachment_set = '';
1052
+							$attachment_set = '';
1053 1053
 
1054
-                            foreach ($attachment as $key => $val) {
1055
-                                if ($val != '')
1056
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1057
-                            }
1054
+							foreach ($attachment as $key => $val) {
1055
+								if ($val != '')
1056
+									$attachment_set .= $key . " = '" . $val . "', ";
1057
+							}
1058 1058
 
1059
-                            $attachment_set = trim($attachment_set, ", ");
1059
+							$attachment_set = trim($attachment_set, ", ");
1060
+
1061
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1060 1062
 
1061
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1063
+							$valid_file_ids[] = $wpdb->insert_id;
1064
+						}
1062 1065
 
1063
-                            $valid_file_ids[] = $wpdb->insert_id;
1064
-                        }
1066
+					}
1065 1067
 
1066
-                    }
1067 1068
 
1069
+				} else {
1070
+					$valid_file_ids[] = $find_image;
1068 1071
 
1069
-                } else {
1070
-                    $valid_file_ids[] = $find_image;
1071
-
1072
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1072
+					$postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1073 1073
 
1074
-                    $wpdb->query(
1075
-                        $wpdb->prepare(
1076
-                            "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1077
-                            array($menu_order, $split_img_path[1], $post_id)
1078
-                        )
1079
-                    );
1074
+					$wpdb->query(
1075
+						$wpdb->prepare(
1076
+							"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1077
+							array($menu_order, $split_img_path[1], $post_id)
1078
+						)
1079
+					);
1080 1080
 
1081
-                    if ($menu_order == 1)
1082
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1081
+					if ($menu_order == 1)
1082
+						$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1083 1083
 
1084
-                }
1084
+				}
1085 1085
 
1086 1086
 
1087
-            }
1087
+			}
1088 1088
 
1089
-            if (!empty($valid_file_ids)) {
1089
+			if (!empty($valid_file_ids)) {
1090 1090
 
1091
-                $remove_files = $valid_file_ids;
1091
+				$remove_files = $valid_file_ids;
1092 1092
 
1093
-                $remove_files_length = count($remove_files);
1094
-                $remove_files_format = array_fill(0, $remove_files_length, '%d');
1095
-                $format = implode(',', $remove_files_format);
1096
-                $valid_files_condition = " ID NOT IN ($format) AND ";
1093
+				$remove_files_length = count($remove_files);
1094
+				$remove_files_format = array_fill(0, $remove_files_length, '%d');
1095
+				$format = implode(',', $remove_files_format);
1096
+				$valid_files_condition = " ID NOT IN ($format) AND ";
1097 1097
 
1098
-            }
1098
+			}
1099 1099
 
1100
-            //Get and remove all old images of post from database to set by new order
1100
+			//Get and remove all old images of post from database to set by new order
1101 1101
 
1102
-            if (!empty($post_images)) {
1102
+			if (!empty($post_images)) {
1103 1103
 
1104
-                foreach ($post_images as $img) {
1104
+				foreach ($post_images as $img) {
1105 1105
 
1106
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1106
+					if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1107 1107
 
1108
-                        $invalid_files[] = (object)array('src' => $img->src);
1108
+						$invalid_files[] = (object)array('src' => $img->src);
1109 1109
 
1110
-                    }
1110
+					}
1111 1111
 
1112
-                }
1112
+				}
1113 1113
 
1114
-            }
1114
+			}
1115 1115
 
1116
-            $invalid_files = (object)$invalid_files;
1117
-        }
1116
+			$invalid_files = (object)$invalid_files;
1117
+		}
1118 1118
 
1119
-        $remove_files[] = $post_id;
1119
+		$remove_files[] = $post_id;
1120 1120
 
1121
-        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1121
+		$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1122 1122
 
1123
-        if (!empty($invalid_files))
1124
-            geodir_remove_attachments($invalid_files);
1125
-    }
1123
+		if (!empty($invalid_files))
1124
+			geodir_remove_attachments($invalid_files);
1125
+	}
1126 1126
 
1127 1127
 }
1128 1128
 
@@ -1136,12 +1136,12 @@  discard block
 block discarded – undo
1136 1136
 function geodir_remove_temp_images()
1137 1137
 {
1138 1138
 
1139
-    global $current_user;
1139
+	global $current_user;
1140 1140
 
1141
-    $uploads = wp_upload_dir();
1142
-    $uploads_dir = $uploads['path'];
1141
+	$uploads = wp_upload_dir();
1142
+	$uploads_dir = $uploads['path'];
1143 1143
 
1144
-    /*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1144
+	/*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1145 1145
 
1146 1146
 			$dirPath = $uploads_dir.'/temp_'.$current_user->data->ID;
1147 1147
 			if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
 			rmdir($dirPath);
1159 1159
 	}	*/
1160 1160
 
1161
-    $dirname = $uploads_dir . '/temp_' . $current_user->data->ID;
1162
-    geodir_delete_directory($dirname);
1161
+	$dirname = $uploads_dir . '/temp_' . $current_user->data->ID;
1162
+	geodir_delete_directory($dirname);
1163 1163
 }
1164 1164
 
1165 1165
 
@@ -1173,109 +1173,109 @@  discard block
 block discarded – undo
1173 1173
  */
1174 1174
 function geodir_delete_directory($dirname)
1175 1175
 {
1176
-    $dir_handle = '';
1177
-    if (is_dir($dirname))
1178
-        $dir_handle = opendir($dirname);
1179
-    if (!$dir_handle)
1180
-        return false;
1181
-    while ($file = readdir($dir_handle)) {
1182
-        if ($file != "." && $file != "..") {
1183
-            if (!is_dir($dirname . "/" . $file))
1184
-                unlink($dirname . "/" . $file);
1185
-            else
1186
-                geodir_delete_directory($dirname . '/' . $file);
1187
-        }
1188
-    }
1189
-    closedir($dir_handle);
1190
-    rmdir($dirname);
1191
-    return true;
1176
+	$dir_handle = '';
1177
+	if (is_dir($dirname))
1178
+		$dir_handle = opendir($dirname);
1179
+	if (!$dir_handle)
1180
+		return false;
1181
+	while ($file = readdir($dir_handle)) {
1182
+		if ($file != "." && $file != "..") {
1183
+			if (!is_dir($dirname . "/" . $file))
1184
+				unlink($dirname . "/" . $file);
1185
+			else
1186
+				geodir_delete_directory($dirname . '/' . $file);
1187
+		}
1188
+	}
1189
+	closedir($dir_handle);
1190
+	rmdir($dirname);
1191
+	return true;
1192 1192
 
1193 1193
 }
1194 1194
 
1195 1195
 
1196 1196
 if (!function_exists('geodir_remove_attachments')) {
1197
-    /**
1198
-     * Remove post attachments.
1199
-     *
1200
-     * @since 1.0.0
1201
-     * @package GeoDirectory
1202
-     * @param array $postcurr_images Array of image objects.
1203
-     */
1204
-    function geodir_remove_attachments($postcurr_images = array())
1205
-    {
1206
-        // Unlink all past images of post
1207
-        if (!empty($postcurr_images)) {
1208
-
1209
-            $uploads = wp_upload_dir();
1210
-            $uploads_dir = $uploads['path'];
1211
-
1212
-            foreach ($postcurr_images as $postimg) {
1213
-                $image_name_arr = explode('/', $postimg->src);
1214
-                $filename = end($image_name_arr);
1215
-                if (file_exists($uploads_dir . '/' . $filename))
1216
-                    unlink($uploads_dir . '/' . $filename);
1217
-            }
1218
-
1219
-        } // endif
1220
-        // Unlink all past images of post end
1221
-    }
1197
+	/**
1198
+	 * Remove post attachments.
1199
+	 *
1200
+	 * @since 1.0.0
1201
+	 * @package GeoDirectory
1202
+	 * @param array $postcurr_images Array of image objects.
1203
+	 */
1204
+	function geodir_remove_attachments($postcurr_images = array())
1205
+	{
1206
+		// Unlink all past images of post
1207
+		if (!empty($postcurr_images)) {
1208
+
1209
+			$uploads = wp_upload_dir();
1210
+			$uploads_dir = $uploads['path'];
1211
+
1212
+			foreach ($postcurr_images as $postimg) {
1213
+				$image_name_arr = explode('/', $postimg->src);
1214
+				$filename = end($image_name_arr);
1215
+				if (file_exists($uploads_dir . '/' . $filename))
1216
+					unlink($uploads_dir . '/' . $filename);
1217
+			}
1218
+
1219
+		} // endif
1220
+		// Unlink all past images of post end
1221
+	}
1222 1222
 }
1223 1223
 
1224 1224
 if (!function_exists('geodir_get_featured_image')) {
1225
-    /**
1226
-     * Gets the post featured image.
1227
-     *
1228
-     * @since 1.0.0
1229
-     * @package GeoDirectory
1230
-     * @global object $wpdb WordPress Database object.
1231
-     * @global object $post The current post object.
1232
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1233
-     * @param int|string $post_id The post ID.
1234
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1235
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1236
-     * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1237
-     * @return bool|object Image details as an object.
1238
-     */
1239
-    function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1240
-    {
1241
-        global $wpdb, $plugin_prefix, $post;
1242
-
1243
-        if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1244
-            $post_type = $post->post_type;
1245
-        } else {
1246
-            $post_type = get_post_type($post_id);
1247
-        }
1248
-
1249
-        if (!in_array($post_type, geodir_get_posttypes())) {
1250
-            return false;// if not a GD CPT return;
1251
-        }
1252
-
1253
-        $table = $plugin_prefix . $post_type . '_detail';
1254
-
1255
-        if (!$file) {
1256
-            if (isset($post->featured_image)) {
1257
-                $file = $post->featured_image;
1258
-            } else {
1259
-                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1260
-            }
1261
-        }
1262
-
1263
-        if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1264
-            $img_arr = array();
1265
-
1266
-            $file_info = pathinfo($file);
1267
-            $sub_dir = '';
1268
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1269
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1270
-
1271
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1272
-            $uploads_baseurl = $uploads['baseurl'];
1273
-            $uploads_path = $uploads['path'];
1274
-
1275
-            $file_name = $file_info['basename'];
1276
-
1277
-            $uploads_url = $uploads_baseurl . $sub_dir;
1278
-            /*
1225
+	/**
1226
+	 * Gets the post featured image.
1227
+	 *
1228
+	 * @since 1.0.0
1229
+	 * @package GeoDirectory
1230
+	 * @global object $wpdb WordPress Database object.
1231
+	 * @global object $post The current post object.
1232
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1233
+	 * @param int|string $post_id The post ID.
1234
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1235
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1236
+	 * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1237
+	 * @return bool|object Image details as an object.
1238
+	 */
1239
+	function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1240
+	{
1241
+		global $wpdb, $plugin_prefix, $post;
1242
+
1243
+		if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1244
+			$post_type = $post->post_type;
1245
+		} else {
1246
+			$post_type = get_post_type($post_id);
1247
+		}
1248
+
1249
+		if (!in_array($post_type, geodir_get_posttypes())) {
1250
+			return false;// if not a GD CPT return;
1251
+		}
1252
+
1253
+		$table = $plugin_prefix . $post_type . '_detail';
1254
+
1255
+		if (!$file) {
1256
+			if (isset($post->featured_image)) {
1257
+				$file = $post->featured_image;
1258
+			} else {
1259
+				$file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1260
+			}
1261
+		}
1262
+
1263
+		if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1264
+			$img_arr = array();
1265
+
1266
+			$file_info = pathinfo($file);
1267
+			$sub_dir = '';
1268
+			if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1269
+				$sub_dir = stripslashes_deep($file_info['dirname']);
1270
+
1271
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1272
+			$uploads_baseurl = $uploads['baseurl'];
1273
+			$uploads_path = $uploads['path'];
1274
+
1275
+			$file_name = $file_info['basename'];
1276
+
1277
+			$uploads_url = $uploads_baseurl . $sub_dir;
1278
+			/*
1279 1279
              * Allows the filter of image src for such things as CDN change.
1280 1280
              *
1281 1281
              * @since 1.5.7
@@ -1284,158 +1284,158 @@  discard block
 block discarded – undo
1284 1284
              * @param string $uploads_url The server upload directory url.
1285 1285
              * @param string $uploads_baseurl The uploads dir base url.
1286 1286
              */
1287
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1288
-            $img_arr['path'] = $uploads_path . '/' . $file_name;
1289
-            $width = 0;
1290
-            $height = 0;
1291
-            if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1292
-                $imagesize = getimagesize($img_arr['path']);
1293
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1294
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1295
-            }
1296
-            $img_arr['width'] = $width;
1297
-            $img_arr['height'] = $height;
1298
-            $img_arr['title'] = '';
1299
-        } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1300
-            foreach ($post_images as $image) {
1301
-                return $image;
1302
-            }
1303
-        } else if ($no_image) {
1304
-            $img_arr = array();
1305
-
1306
-            $default_img = '';
1307
-            if (isset($post->default_category) && $post->default_category) {
1308
-                $default_cat = $post->default_category;
1309
-            } else {
1310
-                $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1311
-            }
1312
-
1313
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1314
-                $default_img = $default_catimg['src'];
1315
-            elseif ($no_image) {
1316
-                $default_img = get_option('geodir_listing_no_img');
1317
-            }
1318
-
1319
-            if (!empty($default_img)) {
1320
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1321
-                $uploads_baseurl = $uploads['baseurl'];
1322
-                $uploads_path = $uploads['path'];
1323
-
1324
-                $img_arr = array();
1325
-
1326
-                $file_info = pathinfo($default_img);
1327
-
1328
-                $file_name = $file_info['basename'];
1329
-
1330
-                $img_arr['src'] = $default_img;
1331
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1332
-
1333
-                $width = 0;
1334
-                $height = 0;
1335
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1336
-                    $imagesize = getimagesize($img_arr['path']);
1337
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1338
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1339
-                }
1340
-                $img_arr['width'] = $width;
1341
-                $img_arr['height'] = $height;
1342
-
1343
-                $img_arr['title'] = ''; // add the title to the array
1344
-            }
1345
-        }
1346
-
1347
-        if (!empty($img_arr))
1348
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1349
-        else
1350
-            return false;
1351
-    }
1287
+			$img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1288
+			$img_arr['path'] = $uploads_path . '/' . $file_name;
1289
+			$width = 0;
1290
+			$height = 0;
1291
+			if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1292
+				$imagesize = getimagesize($img_arr['path']);
1293
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1294
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1295
+			}
1296
+			$img_arr['width'] = $width;
1297
+			$img_arr['height'] = $height;
1298
+			$img_arr['title'] = '';
1299
+		} elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1300
+			foreach ($post_images as $image) {
1301
+				return $image;
1302
+			}
1303
+		} else if ($no_image) {
1304
+			$img_arr = array();
1305
+
1306
+			$default_img = '';
1307
+			if (isset($post->default_category) && $post->default_category) {
1308
+				$default_cat = $post->default_category;
1309
+			} else {
1310
+				$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1311
+			}
1312
+
1313
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1314
+				$default_img = $default_catimg['src'];
1315
+			elseif ($no_image) {
1316
+				$default_img = get_option('geodir_listing_no_img');
1317
+			}
1318
+
1319
+			if (!empty($default_img)) {
1320
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1321
+				$uploads_baseurl = $uploads['baseurl'];
1322
+				$uploads_path = $uploads['path'];
1323
+
1324
+				$img_arr = array();
1325
+
1326
+				$file_info = pathinfo($default_img);
1327
+
1328
+				$file_name = $file_info['basename'];
1329
+
1330
+				$img_arr['src'] = $default_img;
1331
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1332
+
1333
+				$width = 0;
1334
+				$height = 0;
1335
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1336
+					$imagesize = getimagesize($img_arr['path']);
1337
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1338
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1339
+				}
1340
+				$img_arr['width'] = $width;
1341
+				$img_arr['height'] = $height;
1342
+
1343
+				$img_arr['title'] = ''; // add the title to the array
1344
+			}
1345
+		}
1346
+
1347
+		if (!empty($img_arr))
1348
+			return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1349
+		else
1350
+			return false;
1351
+	}
1352 1352
 }
1353 1353
 
1354 1354
 if (!function_exists('geodir_show_featured_image')) {
1355
-    /**
1356
-     * Gets the post featured image.
1357
-     *
1358
-     * @since 1.0.0
1359
-     * @package GeoDirectory
1360
-     * @param int|string $post_id The post ID.
1361
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1362
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1363
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1364
-     * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1365
-     * @return bool|string Returns image html.
1366
-     */
1367
-    function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1368
-    {
1369
-        $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1370
-
1371
-        $html = geodir_show_image($image, $size, $no_image, false);
1372
-
1373
-        if (!empty($html) && $echo) {
1374
-            echo $html;
1375
-        } elseif (!empty($html)) {
1376
-            return $html;
1377
-        } else
1378
-            return false;
1379
-    }
1355
+	/**
1356
+	 * Gets the post featured image.
1357
+	 *
1358
+	 * @since 1.0.0
1359
+	 * @package GeoDirectory
1360
+	 * @param int|string $post_id The post ID.
1361
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1362
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1363
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1364
+	 * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1365
+	 * @return bool|string Returns image html.
1366
+	 */
1367
+	function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1368
+	{
1369
+		$image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1370
+
1371
+		$html = geodir_show_image($image, $size, $no_image, false);
1372
+
1373
+		if (!empty($html) && $echo) {
1374
+			echo $html;
1375
+		} elseif (!empty($html)) {
1376
+			return $html;
1377
+		} else
1378
+			return false;
1379
+	}
1380 1380
 }
1381 1381
 
1382 1382
 if (!function_exists('geodir_get_images')) {
1383
-    /**
1384
-     * Gets the post images.
1385
-     *
1386
-     * @since 1.0.0
1387
-     * @package GeoDirectory
1388
-     * @global object $wpdb WordPress Database object.
1389
-     * @param int $post_id The post ID.
1390
-     * @param string $img_size Optional. Thumbnail size.
1391
-     * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1392
-     * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1393
-     * @param int|string $limit Optional. Number of images.
1394
-     * @return array|bool Returns images as an array. Each item is an object.
1395
-     */
1396
-    function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1397
-    {
1398
-        global $wpdb;
1399
-        if ($limit) {
1400
-            $limit_q = " LIMIT $limit ";
1401
-        } else {
1402
-            $limit_q = '';
1403
-        }
1404
-        $not_featured = '';
1405
-        $sub_dir = '';
1406
-        if (!$add_featured)
1407
-            $not_featured = " AND is_featured = 0 ";
1408
-
1409
-        $arrImages = $wpdb->get_results(
1410
-            $wpdb->prepare(
1411
-                "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 ",
1412
-                array('%image%', $post_id)
1413
-            )
1414
-        );
1415
-
1416
-        $counter = 0;
1417
-        $return_arr = array();
1418
-
1419
-        if (!empty($arrImages)) {
1420
-            foreach ($arrImages as $attechment) {
1421
-
1422
-                $img_arr = array();
1423
-                $img_arr['id'] = $attechment->ID;
1424
-                $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1425
-
1426
-                $file_info = pathinfo($attechment->file);
1427
-
1428
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1429
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1430
-
1431
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1432
-                $uploads_baseurl = $uploads['baseurl'];
1433
-                $uploads_path = $uploads['path'];
1434
-
1435
-                $file_name = $file_info['basename'];
1436
-
1437
-                $uploads_url = $uploads_baseurl . $sub_dir;
1438
-                /*
1383
+	/**
1384
+	 * Gets the post images.
1385
+	 *
1386
+	 * @since 1.0.0
1387
+	 * @package GeoDirectory
1388
+	 * @global object $wpdb WordPress Database object.
1389
+	 * @param int $post_id The post ID.
1390
+	 * @param string $img_size Optional. Thumbnail size.
1391
+	 * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1392
+	 * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1393
+	 * @param int|string $limit Optional. Number of images.
1394
+	 * @return array|bool Returns images as an array. Each item is an object.
1395
+	 */
1396
+	function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1397
+	{
1398
+		global $wpdb;
1399
+		if ($limit) {
1400
+			$limit_q = " LIMIT $limit ";
1401
+		} else {
1402
+			$limit_q = '';
1403
+		}
1404
+		$not_featured = '';
1405
+		$sub_dir = '';
1406
+		if (!$add_featured)
1407
+			$not_featured = " AND is_featured = 0 ";
1408
+
1409
+		$arrImages = $wpdb->get_results(
1410
+			$wpdb->prepare(
1411
+				"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 ",
1412
+				array('%image%', $post_id)
1413
+			)
1414
+		);
1415
+
1416
+		$counter = 0;
1417
+		$return_arr = array();
1418
+
1419
+		if (!empty($arrImages)) {
1420
+			foreach ($arrImages as $attechment) {
1421
+
1422
+				$img_arr = array();
1423
+				$img_arr['id'] = $attechment->ID;
1424
+				$img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1425
+
1426
+				$file_info = pathinfo($attechment->file);
1427
+
1428
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1429
+					$sub_dir = stripslashes_deep($file_info['dirname']);
1430
+
1431
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1432
+				$uploads_baseurl = $uploads['baseurl'];
1433
+				$uploads_path = $uploads['path'];
1434
+
1435
+				$file_name = $file_info['basename'];
1436
+
1437
+				$uploads_url = $uploads_baseurl . $sub_dir;
1438
+				/*
1439 1439
                 * Allows the filter of image src for such things as CDN change.
1440 1440
                 *
1441 1441
                 * @since 1.5.7
@@ -1444,515 +1444,515 @@  discard block
 block discarded – undo
1444 1444
                 * @param string $uploads_url The server upload directory url.
1445 1445
                 * @param string $uploads_baseurl The uploads dir base url.
1446 1446
                 */
1447
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1448
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1449
-                $width = 0;
1450
-                $height = 0;
1451
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1452
-                    $imagesize = getimagesize($img_arr['path']);
1453
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1454
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1455
-                }
1456
-                $img_arr['width'] = $width;
1457
-                $img_arr['height'] = $height;
1458
-
1459
-                $img_arr['file'] = $file_name; // add the title to the array
1460
-                $img_arr['title'] = $attechment->title; // add the title to the array
1461
-                $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1462
-                $img_arr['content'] = $attechment->content; // add the description to the array
1463
-                $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1464
-
1465
-                $return_arr[] = (object)$img_arr;
1466
-
1467
-                $counter++;
1468
-            }
1469
-            return (object)$return_arr;
1470
-        } else if ($no_images) {
1471
-            $default_img = '';
1472
-            $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1473
-            $post_type = get_post_type($post_id);
1474
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1475
-                $default_img = $default_catimg['src'];
1476
-            elseif ($no_images) {
1477
-                $default_img = get_option('geodir_listing_no_img');
1478
-            }
1479
-
1480
-            if (!empty($default_img)) {
1481
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1447
+				$img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1448
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1449
+				$width = 0;
1450
+				$height = 0;
1451
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1452
+					$imagesize = getimagesize($img_arr['path']);
1453
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1454
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1455
+				}
1456
+				$img_arr['width'] = $width;
1457
+				$img_arr['height'] = $height;
1458
+
1459
+				$img_arr['file'] = $file_name; // add the title to the array
1460
+				$img_arr['title'] = $attechment->title; // add the title to the array
1461
+				$img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1462
+				$img_arr['content'] = $attechment->content; // add the description to the array
1463
+				$img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1464
+
1465
+				$return_arr[] = (object)$img_arr;
1466
+
1467
+				$counter++;
1468
+			}
1469
+			return (object)$return_arr;
1470
+		} else if ($no_images) {
1471
+			$default_img = '';
1472
+			$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1473
+			$post_type = get_post_type($post_id);
1474
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1475
+				$default_img = $default_catimg['src'];
1476
+			elseif ($no_images) {
1477
+				$default_img = get_option('geodir_listing_no_img');
1478
+			}
1479
+
1480
+			if (!empty($default_img)) {
1481
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1482 1482
                 
1483
-                $image_path = $default_img;
1484
-                if (!path_is_absolute($image_path)) {
1485
-                    $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1486
-                }
1487
-
1488
-                $file_info = pathinfo($default_img);
1489
-                $file_name = $file_info['basename'];
1490
-
1491
-                $width = '';
1492
-                $height = '';
1493
-                if (is_file($image_path) && file_exists($image_path)) {
1494
-                    $imagesize = getimagesize($image_path);
1495
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1496
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1497
-                }
1483
+				$image_path = $default_img;
1484
+				if (!path_is_absolute($image_path)) {
1485
+					$image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1486
+				}
1487
+
1488
+				$file_info = pathinfo($default_img);
1489
+				$file_name = $file_info['basename'];
1490
+
1491
+				$width = '';
1492
+				$height = '';
1493
+				if (is_file($image_path) && file_exists($image_path)) {
1494
+					$imagesize = getimagesize($image_path);
1495
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1496
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1497
+				}
1498 1498
                 
1499
-                $img_arr = array();
1500
-                $img_arr['src'] = $default_img;
1501
-                $img_arr['path'] = $image_path;
1502
-                $img_arr['width'] = $width;
1503
-                $img_arr['height'] = $height;
1504
-                $img_arr['file'] = $file_name; // add the title to the array
1505
-                $img_arr['title'] = $file_info['filename']; // add the title to the array
1506
-                $img_arr['content'] = $file_info['filename']; // add the description to the array
1507
-
1508
-                $return_arr[] = (object)$img_arr;
1509
-
1510
-                return $return_arr;
1511
-            } else
1512
-                return false;
1513
-        }
1514
-    }
1499
+				$img_arr = array();
1500
+				$img_arr['src'] = $default_img;
1501
+				$img_arr['path'] = $image_path;
1502
+				$img_arr['width'] = $width;
1503
+				$img_arr['height'] = $height;
1504
+				$img_arr['file'] = $file_name; // add the title to the array
1505
+				$img_arr['title'] = $file_info['filename']; // add the title to the array
1506
+				$img_arr['content'] = $file_info['filename']; // add the description to the array
1507
+
1508
+				$return_arr[] = (object)$img_arr;
1509
+
1510
+				return $return_arr;
1511
+			} else
1512
+				return false;
1513
+		}
1514
+	}
1515 1515
 }
1516 1516
 
1517 1517
 if (!function_exists('geodir_show_image')) {
1518
-    /**
1519
-     * Show image using image details.
1520
-     *
1521
-     * @since 1.0.0
1522
-     * @package GeoDirectory
1523
-     * @param array|object $request Image info either as an array or object.
1524
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1525
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1526
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1527
-     * @return bool|string Returns image html.
1528
-     */
1529
-    function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1530
-    {
1531
-        $image = new stdClass();
1532
-
1533
-        $html = '';
1534
-        if (!empty($request)) {
1535
-            if (!is_object($request)){
1536
-                $request = (object)$request;
1537
-            }
1538
-
1539
-            if (isset($request->src) && !isset($request->path)) {
1540
-                $request->path = $request->src;
1541
-            }
1542
-
1543
-            /*
1518
+	/**
1519
+	 * Show image using image details.
1520
+	 *
1521
+	 * @since 1.0.0
1522
+	 * @package GeoDirectory
1523
+	 * @param array|object $request Image info either as an array or object.
1524
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1525
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1526
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1527
+	 * @return bool|string Returns image html.
1528
+	 */
1529
+	function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1530
+	{
1531
+		$image = new stdClass();
1532
+
1533
+		$html = '';
1534
+		if (!empty($request)) {
1535
+			if (!is_object($request)){
1536
+				$request = (object)$request;
1537
+			}
1538
+
1539
+			if (isset($request->src) && !isset($request->path)) {
1540
+				$request->path = $request->src;
1541
+			}
1542
+
1543
+			/*
1544 1544
              * getimagesize() works faster from path than url so we try and get path if we can.
1545 1545
              */
1546
-            $upload_dir = wp_upload_dir();
1547
-            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1548
-            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1549
-            if (strpos($img_no_http, $upload_no_http) !== false) {
1550
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1551
-            }
1546
+			$upload_dir = wp_upload_dir();
1547
+			$img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1548
+			$upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1549
+			if (strpos($img_no_http, $upload_no_http) !== false) {
1550
+				$request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1551
+			}
1552 1552
             
1553
-            $width = 0;
1554
-            $height = 0;
1555
-            if (is_file($request->path) && file_exists($request->path)) {
1556
-                $imagesize = getimagesize($request->path);
1557
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1558
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1559
-            }
1560
-
1561
-            $image->src = $request->src;
1562
-            $image->width = $width;
1563
-            $image->height = $height;
1564
-
1565
-            $max_size = (object)geodir_get_imagesize($size);
1566
-
1567
-            if (!is_wp_error($max_size)) {
1568
-                if ($image->width) {
1569
-                    if ($image->height >= $image->width) {
1570
-                        $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1571
-                    } else if ($image->width < ($max_size->h)) {
1572
-                        $width_per = round((($image->width / $max_size->w) * 100), 2);
1573
-                    } else
1574
-                        $width_per = 100;
1575
-                }
1576
-
1577
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1578
-                    $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1579
-                } else {
1580
-                    $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1581
-                }
1582
-            }
1583
-        }
1584
-
1585
-        if (!empty($html) && $echo) {
1586
-            echo $html;
1587
-        } elseif (!empty($html)) {
1588
-            return $html;
1589
-        } else
1590
-            return false;
1591
-    }
1592
-}
1553
+			$width = 0;
1554
+			$height = 0;
1555
+			if (is_file($request->path) && file_exists($request->path)) {
1556
+				$imagesize = getimagesize($request->path);
1557
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1558
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1559
+			}
1593 1560
 
1594
-if (!function_exists('geodir_set_post_terms')) {
1595
-    /**
1596
-     * Set post Categories.
1597
-     *
1598
-     * @since 1.0.0
1599
-     * @package GeoDirectory
1600
-     * @global object $wpdb WordPress Database object.
1601
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1602
-     * @param int $post_id The post ID.
1603
-     * @param array $terms An array of term objects.
1604
-     * @param array $tt_ids An array of term taxonomy IDs.
1605
-     * @param string $taxonomy Taxonomy slug.
1606
-     */
1607
-    function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1608
-    {
1609
-        global $wpdb, $plugin_prefix;
1561
+			$image->src = $request->src;
1562
+			$image->width = $width;
1563
+			$image->height = $height;
1610 1564
 
1611
-        $post_type = get_post_type($post_id);
1565
+			$max_size = (object)geodir_get_imagesize($size);
1612 1566
 
1613
-        $table = $plugin_prefix . $post_type . '_detail';
1567
+			if (!is_wp_error($max_size)) {
1568
+				if ($image->width) {
1569
+					if ($image->height >= $image->width) {
1570
+						$width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1571
+					} else if ($image->width < ($max_size->h)) {
1572
+						$width_per = round((($image->width / $max_size->w) * 100), 2);
1573
+					} else
1574
+						$width_per = 100;
1575
+				}
1614 1576
 
1615
-        if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1577
+				if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1578
+					$html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1579
+				} else {
1580
+					$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1581
+				}
1582
+			}
1583
+		}
1584
+
1585
+		if (!empty($html) && $echo) {
1586
+			echo $html;
1587
+		} elseif (!empty($html)) {
1588
+			return $html;
1589
+		} else
1590
+			return false;
1591
+	}
1592
+}
1616 1593
 
1617
-            if (strstr($taxonomy, 'tag')) {
1618
-                if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1619
-                    geodir_save_post_meta($post_id, 'post_tags', $terms);
1620
-                }
1621
-            } elseif ($taxonomy == $post_type . 'category') {
1622
-                $srcharr = array('"', '\\');
1623
-                $replarr = array("&quot;", '');
1594
+if (!function_exists('geodir_set_post_terms')) {
1595
+	/**
1596
+	 * Set post Categories.
1597
+	 *
1598
+	 * @since 1.0.0
1599
+	 * @package GeoDirectory
1600
+	 * @global object $wpdb WordPress Database object.
1601
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1602
+	 * @param int $post_id The post ID.
1603
+	 * @param array $terms An array of term objects.
1604
+	 * @param array $tt_ids An array of term taxonomy IDs.
1605
+	 * @param string $taxonomy Taxonomy slug.
1606
+	 */
1607
+	function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1608
+	{
1609
+		global $wpdb, $plugin_prefix;
1610
+
1611
+		$post_type = get_post_type($post_id);
1612
+
1613
+		$table = $plugin_prefix . $post_type . '_detail';
1614
+
1615
+		if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1616
+
1617
+			if (strstr($taxonomy, 'tag')) {
1618
+				if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1619
+					geodir_save_post_meta($post_id, 'post_tags', $terms);
1620
+				}
1621
+			} elseif ($taxonomy == $post_type . 'category') {
1622
+				$srcharr = array('"', '\\');
1623
+				$replarr = array("&quot;", '');
1624 1624
 
1625
-                $post_obj = get_post($post_id);
1625
+				$post_obj = get_post($post_id);
1626 1626
 
1627
-                $cat_ids = array('0');
1628
-                if (is_array($tt_ids))
1629
-                    $cat_ids = $tt_ids;
1627
+				$cat_ids = array('0');
1628
+				if (is_array($tt_ids))
1629
+					$cat_ids = $tt_ids;
1630 1630
 
1631 1631
 
1632
-                if (!empty($cat_ids)) {
1633
-                    $cat_ids_array = $cat_ids;
1634
-                    $cat_ids_length = count($cat_ids_array);
1635
-                    $cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1636
-                    $format = implode(',', $cat_ids_format);
1632
+				if (!empty($cat_ids)) {
1633
+					$cat_ids_array = $cat_ids;
1634
+					$cat_ids_length = count($cat_ids_array);
1635
+					$cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1636
+					$format = implode(',', $cat_ids_format);
1637 1637
 
1638
-                    $cat_ids_array_del = $cat_ids_array;
1639
-                    $cat_ids_array_del[] = $post_id;
1638
+					$cat_ids_array_del = $cat_ids_array;
1639
+					$cat_ids_array_del[] = $post_id;
1640 1640
 
1641
-                    $wpdb->get_var(
1642
-                        $wpdb->prepare(
1643
-                            "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1644
-                            $cat_ids_array_del
1645
-                        )
1646
-                    );
1641
+					$wpdb->get_var(
1642
+						$wpdb->prepare(
1643
+							"DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1644
+							$cat_ids_array_del
1645
+						)
1646
+					);
1647 1647
 
1648 1648
 
1649
-                    $post_term = $wpdb->get_col(
1650
-                        $wpdb->prepare(
1651
-                            "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1652
-                            $cat_ids_array
1653
-                        )
1654
-                    );
1649
+					$post_term = $wpdb->get_col(
1650
+						$wpdb->prepare(
1651
+							"SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1652
+							$cat_ids_array
1653
+						)
1654
+					);
1655 1655
 
1656
-                }
1656
+				}
1657 1657
 
1658
-                $post_marker_json = '';
1658
+				$post_marker_json = '';
1659 1659
 
1660
-                if (!empty($post_term)):
1660
+				if (!empty($post_term)):
1661 1661
 
1662
-                    foreach ($post_term as $cat_id):
1662
+					foreach ($post_term as $cat_id):
1663 1663
 
1664
-                        $term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1665
-                        $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1664
+						$term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1665
+						$term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1666 1666
 
1667
-                        $post_title = $post_obj->title;
1668
-                        $title = str_replace($srcharr, $replarr, $post_title);
1667
+						$post_title = $post_obj->title;
1668
+						$title = str_replace($srcharr, $replarr, $post_title);
1669 1669
 
1670
-                        $lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1671
-                        $lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1670
+						$lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1671
+						$lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1672 1672
 
1673
-                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1674
-                        $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1673
+						$timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1674
+						$timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1675 1675
 
1676
-                        $json = '{';
1677
-                        $json .= '"id":"' . $post_id . '",';
1678
-                        $json .= '"lat_pos": "' . $lat . '",';
1679
-                        $json .= '"long_pos": "' . $lng . '",';
1680
-                        $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1681
-                        $json .= '"icon":"' . $term_icon . '",';
1682
-                        $json .= '"group":"catgroup' . $cat_id . '"';
1683
-                        $json .= '}';
1676
+						$json = '{';
1677
+						$json .= '"id":"' . $post_id . '",';
1678
+						$json .= '"lat_pos": "' . $lat . '",';
1679
+						$json .= '"long_pos": "' . $lng . '",';
1680
+						$json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1681
+						$json .= '"icon":"' . $term_icon . '",';
1682
+						$json .= '"group":"catgroup' . $cat_id . '"';
1683
+						$json .= '}';
1684 1684
 
1685 1685
 
1686
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1687
-                            $post_marker_json = $json;
1686
+						if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1687
+							$post_marker_json = $json;
1688 1688
 
1689 1689
 
1690
-                        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)))) {
1690
+						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)))) {
1691 1691
 
1692
-                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1692
+							$json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1693 1693
 										post_title = %s,
1694 1694
 										json = %s
1695 1695
 										WHERE post_id = %d AND cat_id = %d ",
1696
-                                array($post_title, $json, $post_id, $cat_id));
1696
+								array($post_title, $json, $post_id, $cat_id));
1697 1697
 
1698
-                        } else {
1698
+						} else {
1699 1699
 
1700
-                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1700
+							$json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1701 1701
 										post_id = %d,
1702 1702
 										post_title = %s,
1703 1703
 										cat_id = %d,
1704 1704
 										json = %s",
1705
-                                array($post_id, $post_title, $cat_id, $json));
1705
+								array($post_id, $post_title, $cat_id, $json));
1706 1706
 
1707
-                        }
1707
+						}
1708 1708
 
1709
-                        $wpdb->query($json_query);
1709
+						$wpdb->query($json_query);
1710 1710
 
1711
-                    endforeach;
1711
+					endforeach;
1712 1712
 
1713
-                endif;
1713
+				endif;
1714 1714
 
1715
-                if (!empty($post_term) && is_array($post_term)) {
1716
-                    $categories = implode(',', $post_term);
1715
+				if (!empty($post_term) && is_array($post_term)) {
1716
+					$categories = implode(',', $post_term);
1717 1717
 
1718
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1718
+					if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1719 1719
 
1720
-                    if (empty($post_marker_json))
1721
-                        $post_marker_json = isset($json) ? $json : '';
1720
+					if (empty($post_marker_json))
1721
+						$post_marker_json = isset($json) ? $json : '';
1722 1722
 
1723
-                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1723
+					if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1724 1724
 
1725
-                        $wpdb->query(
1726
-                            $wpdb->prepare(
1727
-                                "UPDATE " . $table . " SET
1725
+						$wpdb->query(
1726
+							$wpdb->prepare(
1727
+								"UPDATE " . $table . " SET
1728 1728
 								" . $taxonomy . " = %s,
1729 1729
 								marker_json = %s
1730 1730
 								where post_id = %d",
1731
-                                array($categories, $post_marker_json, $post_id)
1732
-                            )
1733
-                        );
1731
+								array($categories, $post_marker_json, $post_id)
1732
+							)
1733
+						);
1734 1734
 
1735
-                        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1735
+						if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1736 1736
 
1737
-                            $categories = trim($categories, ',');
1737
+							$categories = trim($categories, ',');
1738 1738
 
1739
-                            if ($categories) {
1739
+							if ($categories) {
1740 1740
 
1741
-                                $categories = explode(',', $categories);
1741
+								$categories = explode(',', $categories);
1742 1742
 
1743
-                                $default_category = geodir_get_post_meta($post_id, 'default_category', true);
1743
+								$default_category = geodir_get_post_meta($post_id, 'default_category', true);
1744 1744
 
1745
-                                if (!in_array($default_category, $categories)) {
1745
+								if (!in_array($default_category, $categories)) {
1746 1746
 
1747
-                                    $wpdb->query(
1748
-                                        $wpdb->prepare(
1749
-                                            "UPDATE " . $table . " SET
1747
+									$wpdb->query(
1748
+										$wpdb->prepare(
1749
+											"UPDATE " . $table . " SET
1750 1750
 											default_category = %s
1751 1751
 											where post_id = %d",
1752
-                                            array($categories[0], $post_id)
1753
-                                        )
1754
-                                    );
1752
+											array($categories[0], $post_id)
1753
+										)
1754
+									);
1755 1755
 
1756
-                                    $default_category = $categories[0];
1756
+									$default_category = $categories[0];
1757 1757
 
1758
-                                }
1758
+								}
1759 1759
 
1760
-                                if ($default_category == '')
1761
-                                    $default_category = $categories[0];
1760
+								if ($default_category == '')
1761
+									$default_category = $categories[0];
1762 1762
 
1763
-                                geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1763
+								geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1764 1764
 
1765
-                            }
1765
+							}
1766 1766
 
1767
-                        }
1767
+						}
1768 1768
 
1769 1769
 
1770
-                    } else {
1770
+					} else {
1771 1771
 
1772
-                        $wpdb->query(
1773
-                            $wpdb->prepare(
1774
-                                "INSERT INTO " . $table . " SET
1772
+						$wpdb->query(
1773
+							$wpdb->prepare(
1774
+								"INSERT INTO " . $table . " SET
1775 1775
 								post_id = %d,
1776 1776
 								" . $taxonomy . " = %s,
1777 1777
 								marker_json = %s ",
1778 1778
 
1779
-                                array($post_id, $categories, $post_marker_json)
1780
-                            )
1781
-                        );
1782
-                    }
1783
-                }
1784
-            }
1785
-        }
1786
-    }
1779
+								array($post_id, $categories, $post_marker_json)
1780
+							)
1781
+						);
1782
+					}
1783
+				}
1784
+			}
1785
+		}
1786
+	}
1787 1787
 }
1788 1788
 
1789 1789
 if (!function_exists('geodir_get_infowindow_html')) {
1790
-    /**
1791
-     * Set post Map Marker info html.
1792
-     *
1793
-     * @since 1.0.0
1794
-     * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1795
-     * @package GeoDirectory
1796
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
1797
-     * @global object $gd_session GeoDirectory Session object.
1798
-     * @param object $postinfo_obj The post details object.
1799
-     * @param string $post_preview Is this a post preview?.
1800
-     * @return mixed|string|void
1801
-     */
1802
-    function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1803
-    {
1804
-        global $preview, $gd_session;
1805
-        $srcharr = array("'", "/", "-", '"', '\\');
1806
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1807
-
1808
-        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1809
-            $ID = '';
1810
-            $plink = '';
1811
-
1812
-            if (isset($postinfo_obj->pid)) {
1813
-                $ID = $postinfo_obj->pid;
1814
-                $plink = get_permalink($ID);
1815
-            }
1816
-
1817
-            $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1818
-            $lat = $postinfo_obj->post_latitude;
1819
-            $lng = $postinfo_obj->post_longitude;
1820
-            $address = str_replace($srcharr, $replarr, ($postinfo_obj->post_address));
1821
-            $contact = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_contact));
1822
-            $timing = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_timing));
1823
-        } else {
1824
-            $ID = $postinfo_obj->post_id;
1825
-            $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1826
-            $plink = get_permalink($ID);
1827
-            $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1828
-            $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1829
-            $address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1830
-            $contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));
1831
-            $timing = str_replace($srcharr, $replarr, (geodir_get_post_meta($ID, 'geodir_timing', true)));
1832
-        }
1833
-
1834
-        // filter field as per price package
1835
-        global $geodir_addon_list;
1836
-        if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1837
-            $post_type = get_post_type($ID);
1838
-            $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1839
-            $field_name = 'geodir_contact';
1840
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1841
-                $contact = '';
1842
-            }
1843
-
1844
-            $field_name = 'geodir_timing';
1845
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1846
-                $timing = '';
1847
-            }
1848
-        }
1849
-
1850
-        if ($lat && $lng) {
1851
-            ob_start(); ?>
1790
+	/**
1791
+	 * Set post Map Marker info html.
1792
+	 *
1793
+	 * @since 1.0.0
1794
+	 * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1795
+	 * @package GeoDirectory
1796
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
1797
+	 * @global object $gd_session GeoDirectory Session object.
1798
+	 * @param object $postinfo_obj The post details object.
1799
+	 * @param string $post_preview Is this a post preview?.
1800
+	 * @return mixed|string|void
1801
+	 */
1802
+	function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')
1803
+	{
1804
+		global $preview, $gd_session;
1805
+		$srcharr = array("'", "/", "-", '"', '\\');
1806
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1807
+
1808
+		if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1809
+			$ID = '';
1810
+			$plink = '';
1811
+
1812
+			if (isset($postinfo_obj->pid)) {
1813
+				$ID = $postinfo_obj->pid;
1814
+				$plink = get_permalink($ID);
1815
+			}
1816
+
1817
+			$title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1818
+			$lat = $postinfo_obj->post_latitude;
1819
+			$lng = $postinfo_obj->post_longitude;
1820
+			$address = str_replace($srcharr, $replarr, ($postinfo_obj->post_address));
1821
+			$contact = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_contact));
1822
+			$timing = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_timing));
1823
+		} else {
1824
+			$ID = $postinfo_obj->post_id;
1825
+			$title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1826
+			$plink = get_permalink($ID);
1827
+			$lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1828
+			$lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1829
+			$address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1830
+			$contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));
1831
+			$timing = str_replace($srcharr, $replarr, (geodir_get_post_meta($ID, 'geodir_timing', true)));
1832
+		}
1833
+
1834
+		// filter field as per price package
1835
+		global $geodir_addon_list;
1836
+		if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1837
+			$post_type = get_post_type($ID);
1838
+			$package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1839
+			$field_name = 'geodir_contact';
1840
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1841
+				$contact = '';
1842
+			}
1843
+
1844
+			$field_name = 'geodir_timing';
1845
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1846
+				$timing = '';
1847
+			}
1848
+		}
1849
+
1850
+		if ($lat && $lng) {
1851
+			ob_start(); ?>
1852 1852
             <div class="gd-bubble" style="">
1853 1853
                 <div class="gd-bubble-inside">
1854 1854
                     <?php
1855
-                    $comment_count = '';
1856
-                    $rating_star = '';
1857
-                    if ($ID != '') {
1858
-                        $rating_star = '';
1859
-                        $comment_count = geodir_get_review_count_total($ID);
1860
-
1861
-                        if (!$preview) {
1862
-                            $post_avgratings = geodir_get_post_rating($ID);
1863
-
1864
-                            $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1865
-
1866
-                            /**
1867
-                             * Filter to change rating stars
1868
-                             *
1869
-                             * You can use this filter to change Rating stars.
1870
-                             *
1871
-                             * @since 1.0.0
1872
-                             * @package GeoDirectory
1873
-                             * @param string $rating_star Rating stars.
1874
-                             * @param float $post_avgratings Average ratings of the post.
1875
-                             * @param int $ID The post ID.
1876
-                             */
1877
-                            $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1878
-                        }
1879
-                    }
1880
-                    ?>
1855
+					$comment_count = '';
1856
+					$rating_star = '';
1857
+					if ($ID != '') {
1858
+						$rating_star = '';
1859
+						$comment_count = geodir_get_review_count_total($ID);
1860
+
1861
+						if (!$preview) {
1862
+							$post_avgratings = geodir_get_post_rating($ID);
1863
+
1864
+							$rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1865
+
1866
+							/**
1867
+							 * Filter to change rating stars
1868
+							 *
1869
+							 * You can use this filter to change Rating stars.
1870
+							 *
1871
+							 * @since 1.0.0
1872
+							 * @package GeoDirectory
1873
+							 * @param string $rating_star Rating stars.
1874
+							 * @param float $post_avgratings Average ratings of the post.
1875
+							 * @param int $ID The post ID.
1876
+							 */
1877
+							$rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1878
+						}
1879
+					}
1880
+					?>
1881 1881
                     <div class="geodir-bubble_desc">
1882 1882
                         <h4>
1883 1883
                             <a href="<?php if ($plink != '') {
1884
-                                echo $plink;
1885
-                            } else {
1886
-                                echo 'javascript:void(0);';
1887
-                            } ?>"><?php echo $title; ?></a>
1884
+								echo $plink;
1885
+							} else {
1886
+								echo 'javascript:void(0);';
1887
+							} ?>"><?php echo $title; ?></a>
1888 1888
                         </h4>
1889 1889
                         <?php
1890
-                        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1891
-                            $post_images = array();
1892
-                            if (!empty($postinfo_obj->post_images)) {
1893
-                                $post_images = explode(",", $postinfo_obj->post_images);
1894
-                            }
1895
-
1896
-                            if (!empty($post_images)) {
1897
-                                ?>
1890
+						if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1891
+							$post_images = array();
1892
+							if (!empty($postinfo_obj->post_images)) {
1893
+								$post_images = explode(",", $postinfo_obj->post_images);
1894
+							}
1895
+
1896
+							if (!empty($post_images)) {
1897
+								?>
1898 1898
                                 <div class="geodir-bubble_image"><a href="<?php if ($plink != '') {
1899
-                                        echo $plink;
1900
-                                    } else {
1901
-                                        echo 'javascript:void(0);';
1902
-                                    } ?>"><img alt="bubble image" style="max-height:50px;"
1899
+										echo $plink;
1900
+									} else {
1901
+										echo 'javascript:void(0);';
1902
+									} ?>"><img alt="bubble image" style="max-height:50px;"
1903 1903
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1904 1904
                             <?php
1905
-                            }else{
1906
-                                echo '<div class="geodir-bubble_image"></div>';
1907
-                            }
1908
-                        } else {
1909
-                            if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1910
-                                ?>
1905
+							}else{
1906
+								echo '<div class="geodir-bubble_image"></div>';
1907
+							}
1908
+						} else {
1909
+							if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1910
+								?>
1911 1911
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1912 1912
                             <?php
1913
-                            }else{
1914
-                                echo '<div class="geodir-bubble_image"></div>';
1915
-                            }
1916
-                        }
1917
-                        ?>
1913
+							}else{
1914
+								echo '<div class="geodir-bubble_image"></div>';
1915
+							}
1916
+						}
1917
+						?>
1918 1918
                         <div class="geodir-bubble-meta-side">
1919 1919
                             <?php
1920
-                            /**
1921
-                             * Fires before the meta info in the map info window.
1922
-                             *
1923
-                             * This can be used to add more info to the map info window before the normal meta info.
1924
-                             *
1925
-                             * @since 1.5.4
1926
-                             * @param int $ID The post id.
1927
-                             * @param object $postinfo_obj The posts info as an object.
1928
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1929
-                             */
1930
-                            do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1931
-                            ?>
1920
+							/**
1921
+							 * Fires before the meta info in the map info window.
1922
+							 *
1923
+							 * This can be used to add more info to the map info window before the normal meta info.
1924
+							 *
1925
+							 * @since 1.5.4
1926
+							 * @param int $ID The post id.
1927
+							 * @param object $postinfo_obj The posts info as an object.
1928
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1929
+							 */
1930
+							do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
1931
+							?>
1932 1932
                             <span class="geodir_address"><i class="fa fa-home"></i> <?php echo $address; ?></span>
1933 1933
                             <?php if ($contact) { ?><span class="geodir_contact"><i
1934 1934
                                 class="fa fa-phone"></i> <?php echo $contact; ?></span><?php } ?>
1935 1935
                             <?php if ($timing) { ?><span class="geodir_timing"><i
1936 1936
                                 class="fa fa-clock-o"></i> <?php echo $timing; ?></span><?php }
1937 1937
 
1938
-                            /**
1939
-                             * Fires after the meta info in the map info window.
1940
-                             *
1941
-                             * This can be used to add more info to the map info window after the normal meta info.
1942
-                             *
1943
-                             * @since 1.4.2
1944
-                             * @param object $postinfo_obj The posts info as an object.
1945
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1946
-                             */
1947
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1948
-                            ?>
1938
+							/**
1939
+							 * Fires after the meta info in the map info window.
1940
+							 *
1941
+							 * This can be used to add more info to the map info window after the normal meta info.
1942
+							 *
1943
+							 * @since 1.4.2
1944
+							 * @param object $postinfo_obj The posts info as an object.
1945
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1946
+							 */
1947
+							do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1948
+							?>
1949 1949
                         </div>
1950 1950
                         <?php
1951 1951
 
1952
-                        if ($ID) {
1952
+						if ($ID) {
1953 1953
 
1954
-                            $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1955
-                            ?>
1954
+							$post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
1955
+							?>
1956 1956
                             <div class="geodir-bubble-meta-fade"></div>
1957 1957
 
1958 1958
                             <div class="geodir-bubble-meta-bottom">
@@ -1972,69 +1972,69 @@  discard block
 block discarded – undo
1972 1972
                 </div>
1973 1973
             </div>
1974 1974
             <?php
1975
-            $html = ob_get_clean();
1976
-            /**
1977
-             * Filter to change infowindow html
1978
-             *
1979
-             * You can use this filter to change infowindow html.
1980
-             *
1981
-             * @since 1.0.0
1982
-             * @package GeoDirectory
1983
-             * @param string $html Infowindow html.
1984
-             * @param object $postinfo_obj The Post object.
1985
-             * @param bool|string $post_preview Is this a post preview?
1986
-             */
1987
-            $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
1988
-            return $html;
1989
-        }
1990
-    }
1975
+			$html = ob_get_clean();
1976
+			/**
1977
+			 * Filter to change infowindow html
1978
+			 *
1979
+			 * You can use this filter to change infowindow html.
1980
+			 *
1981
+			 * @since 1.0.0
1982
+			 * @package GeoDirectory
1983
+			 * @param string $html Infowindow html.
1984
+			 * @param object $postinfo_obj The Post object.
1985
+			 * @param bool|string $post_preview Is this a post preview?
1986
+			 */
1987
+			$html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
1988
+			return $html;
1989
+		}
1990
+	}
1991 1991
 }
1992 1992
 
1993 1993
 
1994 1994
 if (!function_exists('geodir_new_post_default_status')) {
1995
-    /**
1996
-     * Default post status for new posts.
1997
-     *
1998
-     * @since 1.0.0
1999
-     * @package GeoDirectory
2000
-     * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2001
-     */
2002
-    function geodir_new_post_default_status()
2003
-    {
2004
-        if (get_option('geodir_new_post_default_status'))
2005
-            return get_option('geodir_new_post_default_status');
2006
-        else
2007
-            return 'publish';
2008
-
2009
-    }
1995
+	/**
1996
+	 * Default post status for new posts.
1997
+	 *
1998
+	 * @since 1.0.0
1999
+	 * @package GeoDirectory
2000
+	 * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2001
+	 */
2002
+	function geodir_new_post_default_status()
2003
+	{
2004
+		if (get_option('geodir_new_post_default_status'))
2005
+			return get_option('geodir_new_post_default_status');
2006
+		else
2007
+			return 'publish';
2008
+
2009
+	}
2010 2010
 }
2011 2011
 
2012 2012
 if (!function_exists('geodir_change_post_status')) {
2013
-    /**
2014
-     * Change post status of a post.
2015
-     *
2016
-     * @global object $wpdb WordPress Database object.
2017
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2018
-     * @param int|string $post_id The post ID.
2019
-     * @param string $status New post status. Ex: draft, publish etc.
2020
-     */
2021
-    function geodir_change_post_status($post_id = '', $status = '')
2022
-    {
2023
-        global $wpdb, $plugin_prefix;
2024
-
2025
-        $post_type = get_post_type($post_id);
2026
-
2027
-        $table = $plugin_prefix . $post_type . '_detail';
2028
-
2029
-        $wpdb->query(
2030
-            $wpdb->prepare(
2031
-                "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2032
-                array($status, $post_id)
2033
-            )
2034
-        );
2035
-
2036
-
2037
-    }
2013
+	/**
2014
+	 * Change post status of a post.
2015
+	 *
2016
+	 * @global object $wpdb WordPress Database object.
2017
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2018
+	 * @param int|string $post_id The post ID.
2019
+	 * @param string $status New post status. Ex: draft, publish etc.
2020
+	 */
2021
+	function geodir_change_post_status($post_id = '', $status = '')
2022
+	{
2023
+		global $wpdb, $plugin_prefix;
2024
+
2025
+		$post_type = get_post_type($post_id);
2026
+
2027
+		$table = $plugin_prefix . $post_type . '_detail';
2028
+
2029
+		$wpdb->query(
2030
+			$wpdb->prepare(
2031
+				"UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2032
+				array($status, $post_id)
2033
+			)
2034
+		);
2035
+
2036
+
2037
+	}
2038 2038
 }
2039 2039
 
2040 2040
 /**
@@ -2048,13 +2048,13 @@  discard block
 block discarded – undo
2048 2048
  */
2049 2049
 function geodir_set_post_status($pid, $status)
2050 2050
 {
2051
-    if ($pid) {
2052
-        global $wpdb;
2053
-        $my_post = array();
2054
-        $my_post['post_status'] = $status;
2055
-        $my_post['ID'] = $pid;
2056
-        $last_postid = wp_update_post($my_post);
2057
-    }
2051
+	if ($pid) {
2052
+		global $wpdb;
2053
+		$my_post = array();
2054
+		$my_post['post_status'] = $status;
2055
+		$my_post['ID'] = $pid;
2056
+		$last_postid = wp_update_post($my_post);
2057
+	}
2058 2058
 }
2059 2059
 
2060 2060
 
@@ -2070,384 +2070,384 @@  discard block
 block discarded – undo
2070 2070
  */
2071 2071
 function geodir_update_poststatus($new_status, $old_status, $post)
2072 2072
 {
2073
-    global $wpdb;
2073
+	global $wpdb;
2074 2074
 
2075
-    $geodir_posttypes = geodir_get_posttypes();
2075
+	$geodir_posttypes = geodir_get_posttypes();
2076 2076
 
2077
-    if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2077
+	if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2078 2078
 
2079
-        geodir_change_post_status($post->ID, $new_status);
2080
-    }
2079
+		geodir_change_post_status($post->ID, $new_status);
2080
+	}
2081 2081
 }
2082 2082
 
2083 2083
 
2084 2084
 if (!function_exists('geodir_update_listing_info')) {
2085
-    /**
2086
-     * Update post info.
2087
-     *
2088
-     * @since 1.0.0
2089
-     * @package GeoDirectory
2090
-     * @global object $wpdb WordPress Database object.
2091
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2092
-     * @param int $updatingpost The updating post ID.
2093
-     * @param int $temppost The temporary post ID.
2094
-     * @todo fix post_id variable
2095
-     */
2096
-    function geodir_update_listing_info($updatingpost, $temppost)
2097
-    {
2098
-
2099
-        global $wpdb, $plugin_prefix;
2100
-
2101
-        $post_type = get_post_type($post_id);
2102
-
2103
-        $table = $plugin_prefix . $post_type . '_detail';
2104
-
2105
-        $wpdb->query(
2106
-            $wpdb->prepare(
2107
-                "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2108
-                array($updatingpost, $temppost)
2109
-            )
2110
-        );
2111
-
2112
-        $wpdb->query(
2113
-            $wpdb->prepare(
2114
-                "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2115
-                array($updatingpost, $temppost)
2116
-            )
2117
-        );
2118
-
2119
-        /* Update Attachments*/
2120
-
2121
-        $wpdb->query(
2122
-            $wpdb->prepare(
2123
-                "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2124
-                array($updatingpost, $temppost)
2125
-            )
2126
-        );
2127
-
2128
-    }
2085
+	/**
2086
+	 * Update post info.
2087
+	 *
2088
+	 * @since 1.0.0
2089
+	 * @package GeoDirectory
2090
+	 * @global object $wpdb WordPress Database object.
2091
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2092
+	 * @param int $updatingpost The updating post ID.
2093
+	 * @param int $temppost The temporary post ID.
2094
+	 * @todo fix post_id variable
2095
+	 */
2096
+	function geodir_update_listing_info($updatingpost, $temppost)
2097
+	{
2098
+
2099
+		global $wpdb, $plugin_prefix;
2100
+
2101
+		$post_type = get_post_type($post_id);
2102
+
2103
+		$table = $plugin_prefix . $post_type . '_detail';
2104
+
2105
+		$wpdb->query(
2106
+			$wpdb->prepare(
2107
+				"UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2108
+				array($updatingpost, $temppost)
2109
+			)
2110
+		);
2111
+
2112
+		$wpdb->query(
2113
+			$wpdb->prepare(
2114
+				"UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2115
+				array($updatingpost, $temppost)
2116
+			)
2117
+		);
2118
+
2119
+		/* Update Attachments*/
2120
+
2121
+		$wpdb->query(
2122
+			$wpdb->prepare(
2123
+				"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2124
+				array($updatingpost, $temppost)
2125
+			)
2126
+		);
2127
+
2128
+	}
2129 2129
 }
2130 2130
 
2131 2131
 
2132 2132
 if (!function_exists('geodir_delete_listing_info')) {
2133
-    /**
2134
-     * Delete Listing info from details table for the given post id.
2135
-     *
2136
-     * @since 1.0.0
2137
-     * @package GeoDirectory
2138
-     * @global object $wpdb WordPress Database object.
2139
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2140
-     * @param int $deleted_postid The post ID.
2141
-     * @param bool $force Optional. Do you want to force delete it? Default: false.
2142
-     * @return bool|void
2143
-     */
2144
-    function geodir_delete_listing_info($deleted_postid, $force = false)
2145
-    {
2146
-        global $wpdb, $plugin_prefix;
2147
-
2148
-        // check for multisite deletions
2149
-        if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2150
-        } else {
2151
-            return;
2152
-        }
2153
-
2154
-        $post_type = get_post_type($deleted_postid);
2155
-
2156
-        $all_postypes = geodir_get_posttypes();
2157
-
2158
-        if (!in_array($post_type, $all_postypes))
2159
-            return false;
2160
-
2161
-        $table = $plugin_prefix . $post_type . '_detail';
2162
-
2163
-        /* Delete custom post meta*/
2164
-        $wpdb->query(
2165
-            $wpdb->prepare(
2166
-                "DELETE FROM " . $table . " WHERE `post_id` = %d",
2167
-                array($deleted_postid)
2168
-            )
2169
-        );
2170
-
2171
-        /* Delete post map icons*/
2172
-
2173
-        $wpdb->query(
2174
-            $wpdb->prepare(
2175
-                "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2176
-                array($deleted_postid)
2177
-            )
2178
-        );
2179
-
2180
-        /* Delete Attachments*/
2181
-        $postcurr_images = geodir_get_images($deleted_postid);
2182
-
2183
-        $wpdb->query(
2184
-            $wpdb->prepare(
2185
-                "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2186
-                array($deleted_postid)
2187
-            )
2188
-        );
2189
-        geodir_remove_attachments($postcurr_images);
2190
-
2191
-    }
2133
+	/**
2134
+	 * Delete Listing info from details table for the given post id.
2135
+	 *
2136
+	 * @since 1.0.0
2137
+	 * @package GeoDirectory
2138
+	 * @global object $wpdb WordPress Database object.
2139
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2140
+	 * @param int $deleted_postid The post ID.
2141
+	 * @param bool $force Optional. Do you want to force delete it? Default: false.
2142
+	 * @return bool|void
2143
+	 */
2144
+	function geodir_delete_listing_info($deleted_postid, $force = false)
2145
+	{
2146
+		global $wpdb, $plugin_prefix;
2147
+
2148
+		// check for multisite deletions
2149
+		if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2150
+		} else {
2151
+			return;
2152
+		}
2153
+
2154
+		$post_type = get_post_type($deleted_postid);
2155
+
2156
+		$all_postypes = geodir_get_posttypes();
2157
+
2158
+		if (!in_array($post_type, $all_postypes))
2159
+			return false;
2160
+
2161
+		$table = $plugin_prefix . $post_type . '_detail';
2162
+
2163
+		/* Delete custom post meta*/
2164
+		$wpdb->query(
2165
+			$wpdb->prepare(
2166
+				"DELETE FROM " . $table . " WHERE `post_id` = %d",
2167
+				array($deleted_postid)
2168
+			)
2169
+		);
2170
+
2171
+		/* Delete post map icons*/
2172
+
2173
+		$wpdb->query(
2174
+			$wpdb->prepare(
2175
+				"DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2176
+				array($deleted_postid)
2177
+			)
2178
+		);
2179
+
2180
+		/* Delete Attachments*/
2181
+		$postcurr_images = geodir_get_images($deleted_postid);
2182
+
2183
+		$wpdb->query(
2184
+			$wpdb->prepare(
2185
+				"DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2186
+				array($deleted_postid)
2187
+			)
2188
+		);
2189
+		geodir_remove_attachments($postcurr_images);
2190
+
2191
+	}
2192 2192
 }
2193 2193
 
2194 2194
 
2195 2195
 if (!function_exists('geodir_add_to_favorite')) {
2196
-    /**
2197
-     * This function would add listing to favorite listing.
2198
-     *
2199
-     * @since 1.0.0
2200
-     * @package GeoDirectory
2201
-     * @global object $current_user Current user object.
2202
-     * @param int $post_id The post ID.
2203
-     */
2204
-    function geodir_add_to_favorite($post_id)
2205
-    {
2206
-
2207
-        global $current_user;
2208
-
2209
-        /**
2210
-         * Filter to modify "Unfavorite" text
2211
-         *
2212
-         * You can use this filter to rename "Unfavorite" text to something else.
2213
-         *
2214
-         * @since 1.0.0
2215
-         * @package GeoDirectory
2216
-         */
2217
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2218
-
2219
-        /**
2220
-         * Filter to modify "Remove from Favorites" text
2221
-         *
2222
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2223
-         *
2224
-         * @since 1.0.0
2225
-         * @package GeoDirectory
2226
-         */
2227
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2228
-
2229
-        /**
2230
-         * Filter to modify "fa fa-heart" icon
2231
-         *
2232
-         * You can use this filter to change "fa fa-heart" icon to something else.
2233
-         *
2234
-         * @since 1.0.0
2235
-         * @package GeoDirectory
2236
-         */
2237
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2238
-
2239
-        $user_meta_data = array();
2240
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2241
-
2242
-        if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2243
-            $user_meta_data[] = $post_id;
2244
-        }
2245
-
2246
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2247
-
2248
-        /**
2249
-         * Called before adding the post from favourites.
2250
-         *
2251
-         * @since 1.0.0
2252
-         * @package GeoDirectory
2253
-         * @param int $post_id The post ID.
2254
-         */
2255
-        do_action('geodir_before_add_from_favorite', $post_id);
2256
-
2257
-        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>';
2196
+	/**
2197
+	 * This function would add listing to favorite listing.
2198
+	 *
2199
+	 * @since 1.0.0
2200
+	 * @package GeoDirectory
2201
+	 * @global object $current_user Current user object.
2202
+	 * @param int $post_id The post ID.
2203
+	 */
2204
+	function geodir_add_to_favorite($post_id)
2205
+	{
2206
+
2207
+		global $current_user;
2208
+
2209
+		/**
2210
+		 * Filter to modify "Unfavorite" text
2211
+		 *
2212
+		 * You can use this filter to rename "Unfavorite" text to something else.
2213
+		 *
2214
+		 * @since 1.0.0
2215
+		 * @package GeoDirectory
2216
+		 */
2217
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2218
+
2219
+		/**
2220
+		 * Filter to modify "Remove from Favorites" text
2221
+		 *
2222
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2223
+		 *
2224
+		 * @since 1.0.0
2225
+		 * @package GeoDirectory
2226
+		 */
2227
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2228
+
2229
+		/**
2230
+		 * Filter to modify "fa fa-heart" icon
2231
+		 *
2232
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2233
+		 *
2234
+		 * @since 1.0.0
2235
+		 * @package GeoDirectory
2236
+		 */
2237
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2238
+
2239
+		$user_meta_data = array();
2240
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2241
+
2242
+		if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2243
+			$user_meta_data[] = $post_id;
2244
+		}
2245
+
2246
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2247
+
2248
+		/**
2249
+		 * Called before adding the post from favourites.
2250
+		 *
2251
+		 * @since 1.0.0
2252
+		 * @package GeoDirectory
2253
+		 * @param int $post_id The post ID.
2254
+		 */
2255
+		do_action('geodir_before_add_from_favorite', $post_id);
2256
+
2257
+		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>';
2258
+
2259
+		/**
2260
+		 * Called after adding the post from favourites.
2261
+		 *
2262
+		 * @since 1.0.0
2263
+		 * @package GeoDirectory
2264
+		 * @param int $post_id The post ID.
2265
+		 */
2266
+		do_action('geodir_after_add_from_favorite', $post_id);
2258 2267
 
2259
-        /**
2260
-         * Called after adding the post from favourites.
2261
-         *
2262
-         * @since 1.0.0
2263
-         * @package GeoDirectory
2264
-         * @param int $post_id The post ID.
2265
-         */
2266
-        do_action('geodir_after_add_from_favorite', $post_id);
2267
-
2268
-    }
2268
+	}
2269 2269
 }
2270 2270
 
2271 2271
 if (!function_exists('geodir_remove_from_favorite')) {
2272
-    /**
2273
-     * This function would remove the favourited property earlier.
2274
-     *
2275
-     * @since 1.0.0
2276
-     * @package GeoDirectory
2277
-     * @global object $current_user Current user object.
2278
-     * @param int $post_id The post ID.
2279
-     */
2280
-    function geodir_remove_from_favorite($post_id)
2281
-    {
2282
-        global $current_user;
2283
-
2284
-        /**
2285
-         * Filter to modify "Add to Favorites" text
2286
-         *
2287
-         * You can use this filter to rename "Add to Favorites" text to something else.
2288
-         *
2289
-         * @since 1.0.0
2290
-         * @package GeoDirectory
2291
-         */
2292
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2293
-
2294
-        /**
2295
-         * Filter to modify "Favourite" text
2296
-         *
2297
-         * You can use this filter to rename "Favourite" text to something else.
2298
-         *
2299
-         * @since 1.0.0
2300
-         * @package GeoDirectory
2301
-         */
2302
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2303
-
2304
-        /**
2305
-         * Filter to modify "fa fa-heart" icon
2306
-         *
2307
-         * You can use this filter to change "fa fa-heart" icon to something else.
2308
-         *
2309
-         * @since 1.0.0
2310
-         * @package GeoDirectory
2311
-         */
2312
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2313
-
2314
-        $user_meta_data = array();
2315
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2316
-
2317
-        if (!empty($user_meta_data)) {
2272
+	/**
2273
+	 * This function would remove the favourited property earlier.
2274
+	 *
2275
+	 * @since 1.0.0
2276
+	 * @package GeoDirectory
2277
+	 * @global object $current_user Current user object.
2278
+	 * @param int $post_id The post ID.
2279
+	 */
2280
+	function geodir_remove_from_favorite($post_id)
2281
+	{
2282
+		global $current_user;
2283
+
2284
+		/**
2285
+		 * Filter to modify "Add to Favorites" text
2286
+		 *
2287
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2288
+		 *
2289
+		 * @since 1.0.0
2290
+		 * @package GeoDirectory
2291
+		 */
2292
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2293
+
2294
+		/**
2295
+		 * Filter to modify "Favourite" text
2296
+		 *
2297
+		 * You can use this filter to rename "Favourite" text to something else.
2298
+		 *
2299
+		 * @since 1.0.0
2300
+		 * @package GeoDirectory
2301
+		 */
2302
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2303
+
2304
+		/**
2305
+		 * Filter to modify "fa fa-heart" icon
2306
+		 *
2307
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2308
+		 *
2309
+		 * @since 1.0.0
2310
+		 * @package GeoDirectory
2311
+		 */
2312
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2313
+
2314
+		$user_meta_data = array();
2315
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2316
+
2317
+		if (!empty($user_meta_data)) {
2318
+
2319
+			if (($key = array_search($post_id, $user_meta_data)) !== false) {
2320
+				unset($user_meta_data[$key]);
2321
+			}
2318 2322
 
2319
-            if (($key = array_search($post_id, $user_meta_data)) !== false) {
2320
-                unset($user_meta_data[$key]);
2321
-            }
2323
+		}
2322 2324
 
2323
-        }
2325
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2324 2326
 
2325
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2327
+		/**
2328
+		 * Called before removing the post from favourites.
2329
+		 *
2330
+		 * @since 1.0.0
2331
+		 * @package GeoDirectory
2332
+		 * @param int $post_id The post ID.
2333
+		 */
2334
+		do_action('geodir_before_remove_from_favorite', $post_id);
2326 2335
 
2327
-        /**
2328
-         * Called before removing the post from favourites.
2329
-         *
2330
-         * @since 1.0.0
2331
-         * @package GeoDirectory
2332
-         * @param int $post_id The post ID.
2333
-         */
2334
-        do_action('geodir_before_remove_from_favorite', $post_id);
2336
+		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>';
2335 2337
 
2336
-        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>';
2338
+		/**
2339
+		 * Called after removing the post from favourites.
2340
+		 *
2341
+		 * @since 1.0.0
2342
+		 * @package GeoDirectory
2343
+		 * @param int $post_id The post ID.
2344
+		 */
2345
+		do_action('geodir_after_remove_from_favorite', $post_id);
2337 2346
 
2338
-        /**
2339
-         * Called after removing the post from favourites.
2340
-         *
2341
-         * @since 1.0.0
2342
-         * @package GeoDirectory
2343
-         * @param int $post_id The post ID.
2344
-         */
2345
-        do_action('geodir_after_remove_from_favorite', $post_id);
2346
-
2347
-    }
2347
+	}
2348 2348
 }
2349 2349
 
2350 2350
 if (!function_exists('geodir_favourite_html')) {
2351
-    /**
2352
-     * This function would display the html content for add to favorite or remove from favorite.
2353
-     *
2354
-     * @since 1.0.0
2355
-     * @package GeoDirectory
2356
-     * @global object $current_user Current user object.
2357
-     * @global object $post The current post object.
2358
-     * @param int $user_id The user ID.
2359
-     * @param int $post_id The post ID.
2360
-     */
2361
-    function geodir_favourite_html($user_id, $post_id)
2362
-    {
2363
-
2364
-        global $current_user, $post;
2365
-
2366
-        /**
2367
-         * Filter to modify "Add to Favorites" text
2368
-         *
2369
-         * You can use this filter to rename "Add to Favorites" text to something else.
2370
-         *
2371
-         * @since 1.0.0
2372
-         * @package GeoDirectory
2373
-         */
2374
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2375
-
2376
-        /**
2377
-         * Filter to modify "Favourite" text
2378
-         *
2379
-         * You can use this filter to rename "Favourite" text to something else.
2380
-         *
2381
-         * @since 1.0.0
2382
-         * @package GeoDirectory
2383
-         */
2384
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2385
-
2386
-        /**
2387
-         * Filter to modify "Unfavorite" text
2388
-         *
2389
-         * You can use this filter to rename "Unfavorite" text to something else.
2390
-         *
2391
-         * @since 1.0.0
2392
-         * @package GeoDirectory
2393
-         */
2394
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2395
-
2396
-        /**
2397
-         * Filter to modify "Remove from Favorites" text
2398
-         *
2399
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2400
-         *
2401
-         * @since 1.0.0
2402
-         * @package GeoDirectory
2403
-         */
2404
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2405
-
2406
-        /**
2407
-         * Filter to modify "fa fa-heart" icon
2408
-         *
2409
-         * You can use this filter to change "fa fa-heart" icon to something else.
2410
-         *
2411
-         * @since 1.0.0
2412
-         * @package GeoDirectory
2413
-         */
2414
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2415
-
2416
-        /**
2417
-         * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2418
-         *
2419
-         * You can use this filter to change "fa fa-heart" icon to something else.
2420
-         *
2421
-         * @since 1.0.0
2422
-         * @package GeoDirectory
2423
-         */
2424
-        $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2425
-
2426
-        $user_meta_data = '';
2427
-        if (isset($current_user->data->ID))
2428
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2429
-
2430
-        if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2431
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2351
+	/**
2352
+	 * This function would display the html content for add to favorite or remove from favorite.
2353
+	 *
2354
+	 * @since 1.0.0
2355
+	 * @package GeoDirectory
2356
+	 * @global object $current_user Current user object.
2357
+	 * @global object $post The current post object.
2358
+	 * @param int $user_id The user ID.
2359
+	 * @param int $post_id The post ID.
2360
+	 */
2361
+	function geodir_favourite_html($user_id, $post_id)
2362
+	{
2363
+
2364
+		global $current_user, $post;
2365
+
2366
+		/**
2367
+		 * Filter to modify "Add to Favorites" text
2368
+		 *
2369
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2370
+		 *
2371
+		 * @since 1.0.0
2372
+		 * @package GeoDirectory
2373
+		 */
2374
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2375
+
2376
+		/**
2377
+		 * Filter to modify "Favourite" text
2378
+		 *
2379
+		 * You can use this filter to rename "Favourite" text to something else.
2380
+		 *
2381
+		 * @since 1.0.0
2382
+		 * @package GeoDirectory
2383
+		 */
2384
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2385
+
2386
+		/**
2387
+		 * Filter to modify "Unfavorite" text
2388
+		 *
2389
+		 * You can use this filter to rename "Unfavorite" text to something else.
2390
+		 *
2391
+		 * @since 1.0.0
2392
+		 * @package GeoDirectory
2393
+		 */
2394
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2395
+
2396
+		/**
2397
+		 * Filter to modify "Remove from Favorites" text
2398
+		 *
2399
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2400
+		 *
2401
+		 * @since 1.0.0
2402
+		 * @package GeoDirectory
2403
+		 */
2404
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2405
+
2406
+		/**
2407
+		 * Filter to modify "fa fa-heart" icon
2408
+		 *
2409
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2410
+		 *
2411
+		 * @since 1.0.0
2412
+		 * @package GeoDirectory
2413
+		 */
2414
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2415
+
2416
+		/**
2417
+		 * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2418
+		 *
2419
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2420
+		 *
2421
+		 * @since 1.0.0
2422
+		 * @package GeoDirectory
2423
+		 */
2424
+		$unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2425
+
2426
+		$user_meta_data = '';
2427
+		if (isset($current_user->data->ID))
2428
+			$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2429
+
2430
+		if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2431
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2432 2432
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2433 2433
                 onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2434 2434
                 title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2435 2435
             </a>   </span><?php
2436 2436
 
2437
-        } else {
2437
+		} else {
2438 2438
 
2439
-            if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2440
-                $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2441
-            } else
2442
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2439
+			if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2440
+				$script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2441
+			} else
2442
+				$script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2443 2443
 
2444
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2444
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2445 2445
                                                                                         href="javascript:void(0);"
2446 2446
                                                                                         onclick="<?php echo $script_text;?>"
2447 2447
                                                                                         title="<?php echo $add_favourite_text;?>"><i
2448 2448
                     class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2449 2449
         <?php }
2450
-    }
2450
+	}
2451 2451
 }
2452 2452
 
2453 2453
 
@@ -2464,54 +2464,54 @@  discard block
 block discarded – undo
2464 2464
 function geodir_get_cat_postcount($term = array())
2465 2465
 {
2466 2466
 
2467
-    if (!empty($term)) {
2467
+	if (!empty($term)) {
2468 2468
 
2469
-        global $wpdb, $plugin_prefix;
2469
+		global $wpdb, $plugin_prefix;
2470 2470
 
2471
-        $where = '';
2472
-        $join = '';
2473
-        if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2474
-            $taxonomy_obj = get_taxonomy($term->taxonomy);
2471
+		$where = '';
2472
+		$join = '';
2473
+		if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2474
+			$taxonomy_obj = get_taxonomy($term->taxonomy);
2475 2475
 
2476
-            $post_type = $taxonomy_obj->object_type[0];
2476
+			$post_type = $taxonomy_obj->object_type[0];
2477 2477
 
2478
-            $table = $plugin_prefix . $post_type . '_detail';
2478
+			$table = $plugin_prefix . $post_type . '_detail';
2479 2479
 
2480
-            /**
2481
-             * Filter to modify the 'join' query
2482
-             *
2483
-             * @since 1.0.0
2484
-             * @package GeoDirectory
2485
-             * @param object|array $term category / term object that need to be processed.
2486
-             * @param string $join The join query.
2487
-             */
2488
-            $join = apply_filters('geodir_cat_post_count_join', $join, $term);
2480
+			/**
2481
+			 * Filter to modify the 'join' query
2482
+			 *
2483
+			 * @since 1.0.0
2484
+			 * @package GeoDirectory
2485
+			 * @param object|array $term category / term object that need to be processed.
2486
+			 * @param string $join The join query.
2487
+			 */
2488
+			$join = apply_filters('geodir_cat_post_count_join', $join, $term);
2489 2489
 
2490
-            /**
2491
-             * Filter to modify the 'where' query
2492
-             *
2493
-             * @since 1.0.0
2494
-             * @package GeoDirectory
2495
-             * @param object|array $term category / term object that need to be processed.
2496
-             * @param string $where The where query.
2497
-             */
2498
-            $where = apply_filters('geodir_cat_post_count_where', $where, $term);
2490
+			/**
2491
+			 * Filter to modify the 'where' query
2492
+			 *
2493
+			 * @since 1.0.0
2494
+			 * @package GeoDirectory
2495
+			 * @param object|array $term category / term object that need to be processed.
2496
+			 * @param string $where The where query.
2497
+			 */
2498
+			$where = apply_filters('geodir_cat_post_count_where', $where, $term);
2499 2499
 
2500
-            $count_query = "SELECT count(post_id) FROM
2500
+			$count_query = "SELECT count(post_id) FROM
2501 2501
 							" . $table . " as pd " . $join . "
2502 2502
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2503 2503
 
2504
-            $cat_post_count = $wpdb->get_var($count_query);
2505
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2506
-                $cat_post_count = 0;
2504
+			$cat_post_count = $wpdb->get_var($count_query);
2505
+			if (empty($cat_post_count) || is_wp_error($cat_post_count))
2506
+				$cat_post_count = 0;
2507 2507
 
2508
-            return $cat_post_count;
2508
+			return $cat_post_count;
2509 2509
 
2510
-        } else
2510
+		} else
2511 2511
 
2512
-            return $term->count;
2513
-    }
2514
-    return false;
2512
+			return $term->count;
2513
+	}
2514
+	return false;
2515 2515
 
2516 2516
 }
2517 2517
 
@@ -2524,17 +2524,17 @@  discard block
 block discarded – undo
2524 2524
  */
2525 2525
 function geodir_allow_post_type_frontend()
2526 2526
 {
2527
-    $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2527
+	$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2528 2528
 
2529
-    if (!is_admin() && isset($_REQUEST['listing_type'])
2530
-        && !empty($geodir_allow_posttype_frontend)
2531
-        && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2532
-    ) {
2529
+	if (!is_admin() && isset($_REQUEST['listing_type'])
2530
+		&& !empty($geodir_allow_posttype_frontend)
2531
+		&& !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2532
+	) {
2533 2533
 
2534
-        wp_redirect(home_url());
2535
-        exit;
2534
+		wp_redirect(home_url());
2535
+		exit;
2536 2536
 
2537
-    }
2537
+	}
2538 2538
 
2539 2539
 }
2540 2540
 
@@ -2551,20 +2551,20 @@  discard block
 block discarded – undo
2551 2551
  */
2552 2552
 function geodir_excerpt_length($length)
2553 2553
 {
2554
-    global $wp_query, $geodir_is_widget_listing;
2554
+	global $wp_query, $geodir_is_widget_listing;
2555 2555
 	if ($geodir_is_widget_listing) {
2556 2556
 		return $length;
2557 2557
 	}
2558 2558
 	
2559
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2560
-        $length = get_option('geodir_desc_word_limit');
2561
-    elseif (get_query_var('excerpt_length'))
2562
-        $length = get_query_var('excerpt_length');
2559
+	if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2560
+		$length = get_option('geodir_desc_word_limit');
2561
+	elseif (get_query_var('excerpt_length'))
2562
+		$length = get_query_var('excerpt_length');
2563 2563
 
2564
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2565
-        $length = get_option('geodir_author_desc_word_limit');
2564
+	if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2565
+		$length = get_option('geodir_author_desc_word_limit');
2566 2566
 
2567
-    return $length;
2567
+	return $length;
2568 2568
 }
2569 2569
 
2570 2570
 /**
@@ -2579,13 +2579,13 @@  discard block
 block discarded – undo
2579 2579
  */
2580 2580
 function geodir_excerpt_more($more)
2581 2581
 {
2582
-    global $post;
2583
-    $all_postypes = geodir_get_posttypes();
2584
-    if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2585
-        return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2586
-    }
2582
+	global $post;
2583
+	$all_postypes = geodir_get_posttypes();
2584
+	if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2585
+		return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2586
+	}
2587 2587
 
2588
-    return $more;
2588
+	return $more;
2589 2589
 }
2590 2590
 
2591 2591
 
@@ -2602,63 +2602,63 @@  discard block
 block discarded – undo
2602 2602
  */
2603 2603
 function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy)
2604 2604
 {
2605
-    global $plugin_prefix, $wpdb;
2605
+	global $plugin_prefix, $wpdb;
2606 2606
 
2607
-    $gd_taxonomies = geodir_get_taxonomies();
2607
+	$gd_taxonomies = geodir_get_taxonomies();
2608 2608
 
2609
-    if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2609
+	if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2610 2610
 
2611
-        $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2612
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
2611
+		$geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2612
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
2613 2613
 
2614
-        $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2615
-        $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2614
+		$path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2615
+		$term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2616 2616
 
2617
-        $posts = $wpdb->get_results(
2618
-            $wpdb->prepare(
2619
-                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2620
-                array($term_id, $taxonomy)
2621
-            )
2622
-        );
2617
+		$posts = $wpdb->get_results(
2618
+			$wpdb->prepare(
2619
+				"SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2620
+				array($term_id, $taxonomy)
2621
+			)
2622
+		);
2623 2623
 
2624
-        if (!empty($posts)):
2625
-            foreach ($posts as $post_obj) {
2624
+		if (!empty($posts)):
2625
+			foreach ($posts as $post_obj) {
2626 2626
 
2627
-                $lat = $post_obj->post_latitude;
2628
-                $lng = $post_obj->post_longitude;
2627
+				$lat = $post_obj->post_latitude;
2628
+				$lng = $post_obj->post_longitude;
2629 2629
 
2630
-                $json = '{';
2631
-                $json .= '"id":"' . $post_obj->post_id . '",';
2632
-                $json .= '"lat_pos": "' . $lat . '",';
2633
-                $json .= '"long_pos": "' . $lng . '",';
2634
-                $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2635
-                $json .= '"icon":"' . $term_icon . '",';
2636
-                $json .= '"group":"catgroup' . $term_id . '"';
2637
-                $json .= '}';
2630
+				$json = '{';
2631
+				$json .= '"id":"' . $post_obj->post_id . '",';
2632
+				$json .= '"lat_pos": "' . $lat . '",';
2633
+				$json .= '"long_pos": "' . $lng . '",';
2634
+				$json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2635
+				$json .= '"icon":"' . $term_icon . '",';
2636
+				$json .= '"group":"catgroup' . $term_id . '"';
2637
+				$json .= '}';
2638 2638
 
2639
-                if ($post_obj->default_category == $term_id) {
2639
+				if ($post_obj->default_category == $term_id) {
2640 2640
 
2641
-                    $wpdb->query(
2642
-                        $wpdb->prepare(
2643
-                            "UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2644
-                            array($json, $post_obj->post_id)
2645
-                        )
2646
-                    );
2647
-                }
2641
+					$wpdb->query(
2642
+						$wpdb->prepare(
2643
+							"UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2644
+							array($json, $post_obj->post_id)
2645
+						)
2646
+					);
2647
+				}
2648 2648
 
2649
-                $wpdb->query(
2650
-                    $wpdb->prepare(
2651
-                        "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2652
-                        array($json, $post_obj->post_id, $term_id)
2653
-                    )
2654
-                );
2649
+				$wpdb->query(
2650
+					$wpdb->prepare(
2651
+						"UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2652
+						array($json, $post_obj->post_id, $term_id)
2653
+					)
2654
+				);
2655 2655
 
2656
-            }
2656
+			}
2657 2657
 
2658 2658
 
2659
-        endif;
2659
+		endif;
2660 2660
 
2661
-    }
2661
+	}
2662 2662
 
2663 2663
 }
2664 2664
 
@@ -2672,14 +2672,14 @@  discard block
 block discarded – undo
2672 2672
  */
2673 2673
 function geodir_get_listing_author($listing_id = '')
2674 2674
 {
2675
-    if ($listing_id == '') {
2676
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2677
-            $listing_id = $_REQUEST['pid'];
2678
-        }
2679
-    }
2680
-    $listing = get_post(strip_tags($listing_id));
2681
-    $listing_author_id = $listing->post_author;
2682
-    return $listing_author_id;
2675
+	if ($listing_id == '') {
2676
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2677
+			$listing_id = $_REQUEST['pid'];
2678
+		}
2679
+	}
2680
+	$listing = get_post(strip_tags($listing_id));
2681
+	$listing_author_id = $listing->post_author;
2682
+	return $listing_author_id;
2683 2683
 }
2684 2684
 
2685 2685
 
@@ -2694,11 +2694,11 @@  discard block
 block discarded – undo
2694 2694
  */
2695 2695
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2696 2696
 {
2697
-    $listing_author_id = geodir_get_listing_author($listing_id);
2698
-    if ($listing_author_id == $user_id)
2699
-        return true;
2700
-    else
2701
-        return false;
2697
+	$listing_author_id = geodir_get_listing_author($listing_id);
2698
+	if ($listing_author_id == $user_id)
2699
+		return true;
2700
+	else
2701
+		return false;
2702 2702
 
2703 2703
 }
2704 2704
 
@@ -2714,17 +2714,17 @@  discard block
 block discarded – undo
2714 2714
  */
2715 2715
 function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true)
2716 2716
 {
2717
-    global $current_user;
2718
-    if ($exclude_admin) {
2719
-        foreach ($current_user->caps as $key => $caps) {
2720
-            if (geodir_strtolower($key) == 'administrator') {
2721
-                return true;
2722
-                break;
2723
-            }
2724
-        }
2725
-    }
2726
-
2727
-    return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2717
+	global $current_user;
2718
+	if ($exclude_admin) {
2719
+		foreach ($current_user->caps as $key => $caps) {
2720
+			if (geodir_strtolower($key) == 'administrator') {
2721
+				return true;
2722
+				break;
2723
+			}
2724
+		}
2725
+	}
2726
+
2727
+	return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2728 2728
 }
2729 2729
 
2730 2730
 
@@ -2740,17 +2740,17 @@  discard block
 block discarded – undo
2740 2740
 function geodir_only_supportable_attachments_remove($file)
2741 2741
 {
2742 2742
 
2743
-    global $wpdb;
2743
+	global $wpdb;
2744 2744
 
2745
-    $matches = array();
2745
+	$matches = array();
2746 2746
 
2747
-    $pattern = '/-\d+x\d+\./';
2748
-    preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2747
+	$pattern = '/-\d+x\d+\./';
2748
+	preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2749 2749
 
2750
-    if (empty($matches))
2751
-        return '';
2752
-    else
2753
-        return $file;
2750
+	if (empty($matches))
2751
+		return '';
2752
+	else
2753
+		return $file;
2754 2754
 
2755 2755
 }
2756 2756
 
@@ -2767,78 +2767,78 @@  discard block
 block discarded – undo
2767 2767
 function geodir_set_wp_featured_image($post_id)
2768 2768
 {
2769 2769
 
2770
-    global $wpdb, $plugin_prefix;
2771
-    $uploads = wp_upload_dir();
2770
+	global $wpdb, $plugin_prefix;
2771
+	$uploads = wp_upload_dir();
2772 2772
 //	print_r($uploads ) ;
2773
-    $post_first_image = $wpdb->get_results(
2774
-        $wpdb->prepare(
2775
-            "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2776
-        )
2777
-    );
2778
-
2779
-    $old_attachment_name = '';
2780
-    $post_thumbnail_id = '';
2781
-    if (has_post_thumbnail($post_id)) {
2773
+	$post_first_image = $wpdb->get_results(
2774
+		$wpdb->prepare(
2775
+			"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2776
+		)
2777
+	);
2782 2778
 
2783
-        if (has_post_thumbnail($post_id)) {
2779
+	$old_attachment_name = '';
2780
+	$post_thumbnail_id = '';
2781
+	if (has_post_thumbnail($post_id)) {
2784 2782
 
2785
-            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2783
+		if (has_post_thumbnail($post_id)) {
2786 2784
 
2787
-            $old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2785
+			$post_thumbnail_id = get_post_thumbnail_id($post_id);
2788 2786
 
2789
-        }
2790
-    }
2787
+			$old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2791 2788
 
2792
-    if (!empty($post_first_image)) {
2789
+		}
2790
+	}
2793 2791
 
2794
-        $post_type = get_post_type($post_id);
2792
+	if (!empty($post_first_image)) {
2795 2793
 
2796
-        $table_name = $plugin_prefix . $post_type . '_detail';
2794
+		$post_type = get_post_type($post_id);
2797 2795
 
2798
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2796
+		$table_name = $plugin_prefix . $post_type . '_detail';
2799 2797
 
2800
-        $new_attachment_name = basename($post_first_image[0]->file);
2798
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2801 2799
 
2802
-        if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2800
+		$new_attachment_name = basename($post_first_image[0]->file);
2803 2801
 
2804
-            if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2802
+		if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2805 2803
 
2806
-                add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2804
+			if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2807 2805
 
2808
-                wp_delete_attachment($post_thumbnail_id);
2806
+				add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2809 2807
 
2810
-            }
2811
-            $filename = $uploads['basedir'] . $post_first_image[0]->file;
2808
+				wp_delete_attachment($post_thumbnail_id);
2812 2809
 
2813
-            $attachment = array(
2814
-                'post_mime_type' => $post_first_image[0]->mime_type,
2815
-                'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2816
-                'post_parent' => $post_id,
2817
-                'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2818
-                'post_content' => ''
2819
-            );
2810
+			}
2811
+			$filename = $uploads['basedir'] . $post_first_image[0]->file;
2812
+
2813
+			$attachment = array(
2814
+				'post_mime_type' => $post_first_image[0]->mime_type,
2815
+				'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2816
+				'post_parent' => $post_id,
2817
+				'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2818
+				'post_content' => ''
2819
+			);
2820 2820
 
2821 2821
 
2822
-            $id = wp_insert_attachment($attachment, $filename, $post_id);
2822
+			$id = wp_insert_attachment($attachment, $filename, $post_id);
2823 2823
 
2824
-            if (!is_wp_error($id)) {
2824
+			if (!is_wp_error($id)) {
2825 2825
 
2826
-                set_post_thumbnail($post_id, $id);
2826
+				set_post_thumbnail($post_id, $id);
2827 2827
 
2828
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
2829
-                wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2828
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
2829
+				wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2830 2830
 
2831
-            }
2831
+			}
2832 2832
 
2833
-        }
2833
+		}
2834 2834
 
2835
-    } else {
2836
-        //set_post_thumbnail($post_id,-1);
2835
+	} else {
2836
+		//set_post_thumbnail($post_id,-1);
2837 2837
 
2838
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2839
-            wp_delete_attachment($post_thumbnail_id);
2838
+		if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2839
+			wp_delete_attachment($post_thumbnail_id);
2840 2840
 
2841
-    }
2841
+	}
2842 2842
 }
2843 2843
 
2844 2844
 
@@ -2853,53 +2853,53 @@  discard block
 block discarded – undo
2853 2853
  */
2854 2854
 function gd_copy_original_translation()
2855 2855
 {
2856
-    if (function_exists('icl_object_id')) {
2857
-        global $wpdb, $table_prefix, $plugin_prefix;
2858
-        $post_id = absint($_POST['post_id']);
2859
-        $upload_dir = wp_upload_dir();
2860
-        $post_type = get_post_type($_POST['post_id']);
2861
-        $table = $plugin_prefix . $post_type . '_detail';
2862
-
2863
-        $post_arr = $wpdb->get_results($wpdb->prepare(
2864
-            "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2865
-            array($post_id)
2866
-        )
2867
-            , ARRAY_A);
2868
-
2869
-        $arrImages = $wpdb->get_results(
2870
-            $wpdb->prepare(
2871
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2872
-                array('%image%', $post_id)
2873
-            )
2874
-        );
2875
-        if ($arrImages) {
2876
-            $image_arr = array();
2877
-            foreach ($arrImages as $img) {
2878
-                $image_arr[] = $upload_dir['baseurl'] . $img->file;
2879
-            }
2880
-            $comma_separated = implode(",", $image_arr);
2881
-            $post_arr[0]['post_images'] = $comma_separated;
2882
-        }
2883
-
2884
-
2885
-        $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2886
-        $cat_arr = array_filter(explode(",", $cats));
2887
-        $trans_cat = array();
2888
-        foreach ($cat_arr as $cat) {
2889
-            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2890
-        }
2891
-
2892
-
2893
-        $post_arr[0]['categories'] = array_filter($trans_cat);
2856
+	if (function_exists('icl_object_id')) {
2857
+		global $wpdb, $table_prefix, $plugin_prefix;
2858
+		$post_id = absint($_POST['post_id']);
2859
+		$upload_dir = wp_upload_dir();
2860
+		$post_type = get_post_type($_POST['post_id']);
2861
+		$table = $plugin_prefix . $post_type . '_detail';
2862
+
2863
+		$post_arr = $wpdb->get_results($wpdb->prepare(
2864
+			"SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2865
+			array($post_id)
2866
+		)
2867
+			, ARRAY_A);
2868
+
2869
+		$arrImages = $wpdb->get_results(
2870
+			$wpdb->prepare(
2871
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2872
+				array('%image%', $post_id)
2873
+			)
2874
+		);
2875
+		if ($arrImages) {
2876
+			$image_arr = array();
2877
+			foreach ($arrImages as $img) {
2878
+				$image_arr[] = $upload_dir['baseurl'] . $img->file;
2879
+			}
2880
+			$comma_separated = implode(",", $image_arr);
2881
+			$post_arr[0]['post_images'] = $comma_separated;
2882
+		}
2883
+
2884
+
2885
+		$cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2886
+		$cat_arr = array_filter(explode(",", $cats));
2887
+		$trans_cat = array();
2888
+		foreach ($cat_arr as $cat) {
2889
+			$trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2890
+		}
2891
+
2892
+
2893
+		$post_arr[0]['categories'] = array_filter($trans_cat);
2894 2894
 //print_r($image_arr);
2895
-        //print_r($arrImages);
2896
-        //echo $_REQUEST['lang'];
2895
+		//print_r($arrImages);
2896
+		//echo $_REQUEST['lang'];
2897 2897
 //print_r($post_arr);
2898 2898
 //print_r($trans_cat);
2899
-        echo json_encode($post_arr[0]);
2899
+		echo json_encode($post_arr[0]);
2900 2900
 
2901
-    }
2902
-    die();
2901
+	}
2902
+	die();
2903 2903
 }
2904 2904
 
2905 2905
 
@@ -2919,54 +2919,54 @@  discard block
 block discarded – undo
2919 2919
 function geodir_get_custom_fields_type($listing_type = '')
2920 2920
 {
2921 2921
 
2922
-    global $wpdb;
2922
+	global $wpdb;
2923 2923
 
2924
-    if ($listing_type == '')
2925
-        $listing_type = 'gd_place';
2924
+	if ($listing_type == '')
2925
+		$listing_type = 'gd_place';
2926 2926
 
2927
-    $fields_info = array();
2927
+	$fields_info = array();
2928 2928
 
2929
-    $get_data = $wpdb->get_results(
2930
-        $wpdb->prepare(
2931
-            "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2932
-            array($listing_type)
2933
-        )
2934
-    );
2929
+	$get_data = $wpdb->get_results(
2930
+		$wpdb->prepare(
2931
+			"SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2932
+			array($listing_type)
2933
+		)
2934
+	);
2935 2935
 
2936
-    if (!empty($get_data)) {
2936
+	if (!empty($get_data)) {
2937 2937
 
2938
-        foreach ($get_data as $data) {
2938
+		foreach ($get_data as $data) {
2939 2939
 
2940
-            if ($data->field_type == 'address') {
2940
+			if ($data->field_type == 'address') {
2941 2941
 
2942
-                $extra_fields = unserialize($data->extra_fields);
2942
+				$extra_fields = unserialize($data->extra_fields);
2943 2943
 
2944
-                $prefix = $data->htmlvar_name . '_';
2944
+				$prefix = $data->htmlvar_name . '_';
2945 2945
 
2946
-                $fields_info[$prefix . 'address'] = $data->field_type;
2946
+				$fields_info[$prefix . 'address'] = $data->field_type;
2947 2947
 
2948
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2949
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2948
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2949
+					$fields_info[$prefix . 'zip'] = $data->field_type;
2950 2950
 
2951
-            } else {
2951
+			} else {
2952 2952
 
2953
-                $fields_info[$data->htmlvar_name] = $data->field_type;
2953
+				$fields_info[$data->htmlvar_name] = $data->field_type;
2954 2954
 
2955
-            }
2955
+			}
2956 2956
 
2957
-        }
2957
+		}
2958 2958
 
2959
-    }
2959
+	}
2960 2960
 
2961
-    /**
2962
-     * Filter to modify custom fields info using listing post type.
2963
-     *
2964
-     * @since 1.0.0
2965
-     * @package GeoDirectory
2966
-     * @return array $fields_info Custom fields info.
2967
-     * @param string $listing_type The listing post type.
2968
-     */
2969
-    return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2961
+	/**
2962
+	 * Filter to modify custom fields info using listing post type.
2963
+	 *
2964
+	 * @since 1.0.0
2965
+	 * @package GeoDirectory
2966
+	 * @return array $fields_info Custom fields info.
2967
+	 * @param string $listing_type The listing post type.
2968
+	 */
2969
+	return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
2970 2970
 }
2971 2971
 
2972 2972
 
@@ -2981,58 +2981,58 @@  discard block
 block discarded – undo
2981 2981
  */
2982 2982
 function geodir_function_post_updated($post_ID, $post_after, $post_before)
2983 2983
 {
2984
-    $post_type = get_post_type($post_ID);
2984
+	$post_type = get_post_type($post_ID);
2985 2985
 
2986
-    if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
2987
-        // send notification to client when post moves from draft to publish
2988
-        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')) {
2989
-            $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
2990
-            $post_author_data = get_userdata($post_author_id);
2986
+	if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
2987
+		// send notification to client when post moves from draft to publish
2988
+		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')) {
2989
+			$post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
2990
+			$post_author_data = get_userdata($post_author_id);
2991 2991
 
2992
-            $to_name = geodir_get_client_name($post_author_id);
2992
+			$to_name = geodir_get_client_name($post_author_id);
2993 2993
 
2994
-            $from_email = geodir_get_site_email_id();
2995
-            $from_name = get_site_emailName();
2996
-            $to_email = $post_author_data->user_email;
2994
+			$from_email = geodir_get_site_email_id();
2995
+			$from_name = get_site_emailName();
2996
+			$to_email = $post_author_data->user_email;
2997 2997
 
2998
-            if (!is_email($to_email) && !empty($post_author_data->user_email)) {
2999
-                $to_email = $post_author_data->user_email;
3000
-            }
2998
+			if (!is_email($to_email) && !empty($post_author_data->user_email)) {
2999
+				$to_email = $post_author_data->user_email;
3000
+			}
3001 3001
 
3002
-            $message_type = 'listing_published';
3002
+			$message_type = 'listing_published';
3003 3003
 
3004
-            if (get_option('geodir_post_published_email_subject') == '') {
3005
-                update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3006
-            }
3004
+			if (get_option('geodir_post_published_email_subject') == '') {
3005
+				update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3006
+			}
3007 3007
 
3008
-            if (get_option('geodir_post_published_email_content') == '') {
3009
-                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'));
3010
-            }
3008
+			if (get_option('geodir_post_published_email_content') == '') {
3009
+				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'));
3010
+			}
3011 3011
 
3012
-            /**
3013
-             * Called before sending the email when listing gets published.
3014
-             *
3015
-             * @since 1.0.0
3016
-             * @package GeoDirectory
3017
-             * @param object $post_after The post object after update.
3018
-             * @param object $post_before The post object before update.
3019
-             */
3020
-            do_action('geodir_before_listing_published_email', $post_after, $post_before);
3021
-            if (is_email($to_email)) {
3022
-                geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3023
-            }
3012
+			/**
3013
+			 * Called before sending the email when listing gets published.
3014
+			 *
3015
+			 * @since 1.0.0
3016
+			 * @package GeoDirectory
3017
+			 * @param object $post_after The post object after update.
3018
+			 * @param object $post_before The post object before update.
3019
+			 */
3020
+			do_action('geodir_before_listing_published_email', $post_after, $post_before);
3021
+			if (is_email($to_email)) {
3022
+				geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3023
+			}
3024 3024
 
3025
-            /**
3026
-             * Called after sending the email when listing gets published.
3027
-             *
3028
-             * @since 1.0.0
3029
-             * @package GeoDirectory
3030
-             * @param object $post_after The post object after update.
3031
-             * @param object $post_before The post object before update.
3032
-             */
3033
-            do_action('geodir_after_listing_published_email', $post_after, $post_before);
3034
-        }
3035
-    }
3025
+			/**
3026
+			 * Called after sending the email when listing gets published.
3027
+			 *
3028
+			 * @since 1.0.0
3029
+			 * @package GeoDirectory
3030
+			 * @param object $post_after The post object after update.
3031
+			 * @param object $post_before The post object before update.
3032
+			 */
3033
+			do_action('geodir_after_listing_published_email', $post_after, $post_before);
3034
+		}
3035
+	}
3036 3036
 }
3037 3037
 
3038 3038
 add_action('wp_head', 'geodir_fb_like_thumbnail');
@@ -3046,14 +3046,14 @@  discard block
 block discarded – undo
3046 3046
  */
3047 3047
 function geodir_fb_like_thumbnail(){
3048 3048
 
3049
-    // return if not a single post
3050
-    if(!is_single()){return;}
3049
+	// return if not a single post
3050
+	if(!is_single()){return;}
3051 3051
 
3052
-    global $post;
3053
-    if(isset($post->featured_image) && $post->featured_image){
3054
-        $upload_dir = wp_upload_dir();
3055
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3056
-        echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3052
+	global $post;
3053
+	if(isset($post->featured_image) && $post->featured_image){
3054
+		$upload_dir = wp_upload_dir();
3055
+		$thumb = $upload_dir['baseurl'].$post->featured_image;
3056
+		echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3057 3057
 
3058
-    }
3058
+	}
3059 3059
 }
3060 3060
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
     if (!isset($default_cat) || empty($default_cat)) {
28 28
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
29
+    } else {
30
+        if (!is_int($default_cat)) {
31 31
             $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
32
+            if (isset($category->term_id)) {
33
+                $default_cat = $category->term_id;
34 34
             }
35 35
         }
36 36
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $send_post_submit_mail = false;
228 228
 
229 229
         // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
230
+        remove_action('save_post', 'geodir_post_information_save', 10, 2);
231 231
 
232 232
         if (isset($request_info['pid']) && $request_info['pid'] != '') {
233 233
             $post['ID'] = $request_info['pid'];
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         }
252 252
 
253 253
         // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
254
+        add_action('save_post', 'geodir_post_information_save', 10, 2);
255 255
 
256 256
         $post_tags = '';
257 257
         if (!isset($request_info['post_tags'])) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $payment_info = array();
276 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 280
         $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
281 281
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                 $tmpimgArr = trim($request_info['post_images'], ",");
475 475
                 $tmpimgArr = explode(",", $tmpimgArr);
476 476
                 geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
-            } else{
477
+            } else {
478 478
                 geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479 479
             }
480 480
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
             $post_meta_set_query = trim($post_meta_set_query, ", ");
660 660
 
661
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
661
+            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query); // escape %
662 662
 
663 663
             /**
664 664
              * Called before saving the listing info.
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                 $file_path = '';
929 929
                 /* --------- start ------- */
930 930
 
931
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
931
+                $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
932 932
 
933 933
                 $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
934 934
 
@@ -985,20 +985,20 @@  discard block
 block discarded – undo
985 985
                         }
986 986
 
987 987
                         $external_img = false;
988
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
988
+                        if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
989 989
                         } else {
990 990
                             $external_img = true;
991 991
                         }
992 992
 
993 993
                         if ($dummy || $external_img) {
994 994
                             $uploaded_file = array();
995
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
995
+                            $uploaded = (array) fetch_remote_file($curr_img_url);
996 996
 
997 997
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
998 998
                                 $new_name = basename($uploaded['file']);
999 999
                                 $uploaded_file = $uploaded;
1000
-                            }else{
1001
-                                print_r($uploaded);exit;
1000
+                            } else {
1001
+                                print_r($uploaded); exit;
1002 1002
                             }
1003 1003
                             $external_img = false;
1004 1004
                         } else {
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
                                 $file_path = $sub_dir . '/' . $new_name;
1032 1032
                             }
1033 1033
 
1034
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1034
+                            $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'] . $file_path);
1035 1035
 
1036 1036
                             if ($menu_order == 1) {
1037 1037
 
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
                 } else {
1070 1070
                     $valid_file_ids[] = $find_image;
1071 1071
 
1072
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1072
+                    $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
1073 1073
 
1074 1074
                     $wpdb->query(
1075 1075
                         $wpdb->prepare(
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
                 foreach ($post_images as $img) {
1105 1105
 
1106
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1106
+                    if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
1107 1107
 
1108
-                        $invalid_files[] = (object)array('src' => $img->src);
1108
+                        $invalid_files[] = (object) array('src' => $img->src);
1109 1109
 
1110 1110
                     }
1111 1111
 
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 
1114 1114
             }
1115 1115
 
1116
-            $invalid_files = (object)$invalid_files;
1116
+            $invalid_files = (object) $invalid_files;
1117 1117
         }
1118 1118
 
1119 1119
         $remove_files[] = $post_id;
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
         }
1248 1248
 
1249 1249
         if (!in_array($post_type, geodir_get_posttypes())) {
1250
-            return false;// if not a GD CPT return;
1250
+            return false; // if not a GD CPT return;
1251 1251
         }
1252 1252
 
1253 1253
         $table = $plugin_prefix . $post_type . '_detail';
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
              * @param string $uploads_url The server upload directory url.
1285 1285
              * @param string $uploads_baseurl The uploads dir base url.
1286 1286
              */
1287
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1287
+            $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url . '/' . $file_name, $file_name, $uploads_url, $uploads_baseurl);
1288 1288
             $img_arr['path'] = $uploads_path . '/' . $file_name;
1289 1289
             $width = 0;
1290 1290
             $height = 0;
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
         }
1346 1346
 
1347 1347
         if (!empty($img_arr))
1348
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1348
+            return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path );
1349 1349
         else
1350 1350
             return false;
1351 1351
     }
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
                 * @param string $uploads_url The server upload directory url.
1445 1445
                 * @param string $uploads_baseurl The uploads dir base url.
1446 1446
                 */
1447
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1447
+                $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url . '/' . $file_name, $file_name, $uploads_url, $uploads_baseurl);
1448 1448
                 $img_arr['path'] = $uploads_path . '/' . $file_name;
1449 1449
                 $width = 0;
1450 1450
                 $height = 0;
@@ -1462,11 +1462,11 @@  discard block
 block discarded – undo
1462 1462
                 $img_arr['content'] = $attechment->content; // add the description to the array
1463 1463
                 $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1464 1464
 
1465
-                $return_arr[] = (object)$img_arr;
1465
+                $return_arr[] = (object) $img_arr;
1466 1466
 
1467 1467
                 $counter++;
1468 1468
             }
1469
-            return (object)$return_arr;
1469
+            return (object) $return_arr;
1470 1470
         } else if ($no_images) {
1471 1471
             $default_img = '';
1472 1472
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
                 $img_arr['title'] = $file_info['filename']; // add the title to the array
1506 1506
                 $img_arr['content'] = $file_info['filename']; // add the description to the array
1507 1507
 
1508
-                $return_arr[] = (object)$img_arr;
1508
+                $return_arr[] = (object) $img_arr;
1509 1509
 
1510 1510
                 return $return_arr;
1511 1511
             } else
@@ -1532,8 +1532,8 @@  discard block
 block discarded – undo
1532 1532
 
1533 1533
         $html = '';
1534 1534
         if (!empty($request)) {
1535
-            if (!is_object($request)){
1536
-                $request = (object)$request;
1535
+            if (!is_object($request)) {
1536
+                $request = (object) $request;
1537 1537
             }
1538 1538
 
1539 1539
             if (isset($request->src) && !isset($request->path)) {
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
             $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1548 1548
             $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1549 1549
             if (strpos($img_no_http, $upload_no_http) !== false) {
1550
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1550
+                $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path);
1551 1551
             }
1552 1552
             
1553 1553
             $width = 0;
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
             $image->width = $width;
1563 1563
             $image->height = $height;
1564 1564
 
1565
-            $max_size = (object)geodir_get_imagesize($size);
1565
+            $max_size = (object) geodir_get_imagesize($size);
1566 1566
 
1567 1567
             if (!is_wp_error($max_size)) {
1568 1568
                 if ($image->width) {
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
                         $width_per = 100;
1575 1575
                 }
1576 1576
 
1577
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1577
+                if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
1578 1578
                     $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1579 1579
                 } else {
1580 1580
                     $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1903 1903
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1904 1904
                             <?php
1905
-                            }else{
1905
+                            } else {
1906 1906
                                 echo '<div class="geodir-bubble_image"></div>';
1907 1907
                             }
1908 1908
                         } else {
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
                                 ?>
1911 1911
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1912 1912
                             <?php
1913
-                            }else{
1913
+                            } else {
1914 1914
                                 echo '<div class="geodir-bubble_image"></div>';
1915 1915
                             }
1916 1916
                         }
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
                              * @param object $postinfo_obj The posts info as an object.
1945 1945
                              * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1946 1946
                              */
1947
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1947
+                            do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
1948 1948
                             ?>
1949 1949
                         </div>
1950 1950
                         <?php
@@ -1956,10 +1956,10 @@  discard block
 block discarded – undo
1956 1956
                             <div class="geodir-bubble-meta-fade"></div>
1957 1957
 
1958 1958
                             <div class="geodir-bubble-meta-bottom">
1959
-                                <span class="geodir-bubble-rating"><?php echo $rating_star;?></span>
1959
+                                <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span>
1960 1960
 
1961 1961
                                 <span
1962
-                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span>
1962
+                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span>
1963 1963
                   <span class="geodir-bubble-reviews"><a href="<?php echo get_comments_link($ID); ?>"
1964 1964
                                                          class="geodir-pcomments"><i class="fa fa-comments"></i>
1965 1965
                           <?php echo get_comments_number($ID); ?>
@@ -2254,7 +2254,7 @@  discard block
 block discarded – undo
2254 2254
          */
2255 2255
         do_action('geodir_before_add_from_favorite', $post_id);
2256 2256
 
2257
-        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>';
2257
+        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>';
2258 2258
 
2259 2259
         /**
2260 2260
          * Called after adding the post from favourites.
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
          */
2334 2334
         do_action('geodir_before_remove_from_favorite', $post_id);
2335 2335
 
2336
-        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>';
2336
+        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>';
2337 2337
 
2338 2338
         /**
2339 2339
          * Called after removing the post from favourites.
@@ -2428,10 +2428,10 @@  discard block
 block discarded – undo
2428 2428
             $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2429 2429
 
2430 2430
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2431
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2431
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"  ><a
2432 2432
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2433
-                onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2434
-                title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2433
+                onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');"
2434
+                title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?>
2435 2435
             </a>   </span><?php
2436 2436
 
2437 2437
         } else {
@@ -2441,11 +2441,11 @@  discard block
 block discarded – undo
2441 2441
             } else
2442 2442
                 $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2443 2443
 
2444
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2444
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon"
2445 2445
                                                                                         href="javascript:void(0);"
2446
-                                                                                        onclick="<?php echo $script_text;?>"
2447
-                                                                                        title="<?php echo $add_favourite_text;?>"><i
2448
-                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2446
+                                                                                        onclick="<?php echo $script_text; ?>"
2447
+                                                                                        title="<?php echo $add_favourite_text; ?>"><i
2448
+                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span>
2449 2449
         <?php }
2450 2450
     }
2451 2451
 }
@@ -3044,15 +3044,15 @@  discard block
 block discarded – undo
3044 3044
  * @since 1.4.9
3045 3045
  * @package GeoDirectory
3046 3046
  */
3047
-function geodir_fb_like_thumbnail(){
3047
+function geodir_fb_like_thumbnail() {
3048 3048
 
3049 3049
     // return if not a single post
3050
-    if(!is_single()){return;}
3050
+    if (!is_single()) {return; }
3051 3051
 
3052 3052
     global $post;
3053
-    if(isset($post->featured_image) && $post->featured_image){
3053
+    if (isset($post->featured_image) && $post->featured_image) {
3054 3054
         $upload_dir = wp_upload_dir();
3055
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3055
+        $thumb = $upload_dir['baseurl'] . $post->featured_image;
3056 3056
         echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3057 3057
 
3058 3058
     }
Please login to merge, or discard this patch.
Braces   +175 added lines, -123 removed lines patch added patch discarded remove patch
@@ -21,12 +21,13 @@  discard block
 block discarded – undo
21 21
 {
22 22
 
23 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, ","));
24
+    if (!empty($post_cat_ids)) {
25
+            $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+    }
26 27
 
27 28
     if (!isset($default_cat) || empty($default_cat)) {
28 29
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
+    } else{
30 31
         if(!is_int($default_cat)){
31 32
             $category = get_term_by('name', $default_cat, $taxonomy);
32 33
             if(isset($category->term_id)){
@@ -372,8 +373,9 @@  discard block
 block discarded – undo
372 373
             } elseif (trim($type) == 'file') {
373 374
                 if (isset($request_info[$name])) {
374 375
                     $request_files = array();
375
-                    if ($request_info[$name] != '')
376
-                        $request_files = explode(",", $request_info[$name]);
376
+                    if ($request_info[$name] != '') {
377
+                                            $request_files = explode(",", $request_info[$name]);
378
+                    }
377 379
 
378 380
                     $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379 381
                     geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
@@ -428,15 +430,17 @@  discard block
 block discarded – undo
428 430
 
429 431
             foreach ($request_info['post_category'] as $taxonomy => $cat) {
430 432
 
431
-                if ($dummy)
432
-                    $post_category = $cat;
433
-                else {
433
+                if ($dummy) {
434
+                                    $post_category = $cat;
435
+                } else {
434 436
 
435
-                    if (!is_array($cat) && strstr($cat, ','))
436
-                        $cat = explode(',', $cat);
437
+                    if (!is_array($cat) && strstr($cat, ',')) {
438
+                                            $cat = explode(',', $cat);
439
+                    }
437 440
 
438
-                    if (!empty($cat) && is_array($cat))
439
-                        $post_category = array_map('intval', $cat);
441
+                    if (!empty($cat) && is_array($cat)) {
442
+                                            $post_category = array_map('intval', $cat);
443
+                    }
440 444
                 }
441 445
 
442 446
                 wp_set_object_terms($last_post_id, $post_category, $taxonomy);
@@ -454,11 +458,13 @@  discard block
 block discarded – undo
454 458
         if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455 459
             $post_tags = explode(",", $request_info['post_tags']);
456 460
         } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
-            if ($dummy)
458
-                $post_tags = $request_info['post_tags'];
461
+            if ($dummy) {
462
+                            $post_tags = $request_info['post_tags'];
463
+            }
459 464
         } else {
460
-            if ($dummy)
461
-                $post_tags = array($request_info['post_title']);
465
+            if ($dummy) {
466
+                            $post_tags = array($request_info['post_title']);
467
+            }
462 468
         }
463 469
 
464 470
         if (is_array($post_tags)) {
@@ -545,15 +551,17 @@  discard block
 block discarded – undo
545 551
 
546 552
     global $wpdb, $plugin_prefix, $post, $post_info;
547 553
 
548
-    if ($post_id == '' && !empty($post))
549
-        $post_id = $post->ID;
554
+    if ($post_id == '' && !empty($post)) {
555
+            $post_id = $post->ID;
556
+    }
550 557
 
551 558
     $post_type = get_post_type($post_id);
552 559
 
553 560
     $all_postypes = geodir_get_posttypes();
554 561
 
555
-    if (!in_array($post_type, $all_postypes))
556
-        return false;
562
+    if (!in_array($post_type, $all_postypes)) {
563
+            return false;
564
+    }
557 565
 
558 566
     $table = $plugin_prefix . $post_type . '_detail';
559 567
 
@@ -703,8 +711,9 @@  discard block
 block discarded – undo
703 711
             do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
704 712
 
705 713
             return true;
706
-        } else
707
-            return false;
714
+        } else {
715
+                    return false;
716
+        }
708 717
 
709 718
     }
710 719
 }
@@ -758,8 +767,9 @@  discard block
 block discarded – undo
758 767
             }
759 768
 
760 769
 
761
-        } else
762
-            return false;
770
+        } else {
771
+                    return false;
772
+        }
763 773
     }
764 774
 }
765 775
 
@@ -790,8 +800,9 @@  discard block
 block discarded – undo
790 800
             $post_meta_set_query = '';
791 801
 
792 802
             foreach ($postmeta as $mkey) {
793
-                if ($mval != '')
794
-                    $post_meta_set_query .= $mkey . " = '', ";
803
+                if ($mval != '') {
804
+                                    $post_meta_set_query .= $mkey . " = '', ";
805
+                }
795 806
             }
796 807
 
797 808
             $post_meta_set_query = trim($post_meta_set_query, ", ");
@@ -821,8 +832,9 @@  discard block
 block discarded – undo
821 832
                 return true;
822 833
             }
823 834
 
824
-        } else
825
-            return false;
835
+        } else {
836
+                    return false;
837
+        }
826 838
     }
827 839
 }
828 840
 
@@ -852,8 +864,9 @@  discard block
 block discarded – undo
852 864
 
853 865
         $post_type = get_post_type($post_id);
854 866
 
855
-        if (!in_array($post_type, $all_postypes))
856
-            return false;
867
+        if (!in_array($post_type, $all_postypes)) {
868
+                    return false;
869
+        }
857 870
 
858 871
         $table = $plugin_prefix . $post_type . '_detail';
859 872
 
@@ -862,11 +875,13 @@  discard block
 block discarded – undo
862 875
             if ($meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)))) {
863 876
                 $meta_value = maybe_serialize($meta_value);
864 877
                 return $meta_value;
865
-            } else
866
-                return false;
878
+            } else {
879
+                            return false;
880
+            }
867 881
 
868
-        } else
869
-            return false;
882
+        } else {
883
+                    return false;
884
+        }
870 885
     }
871 886
 }
872 887
 
@@ -997,7 +1012,7 @@  discard block
 block discarded – undo
997 1012
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
998 1013
                                 $new_name = basename($uploaded['file']);
999 1014
                                 $uploaded_file = $uploaded;
1000
-                            }else{
1015
+                            } else{
1001 1016
                                 print_r($uploaded);exit;
1002 1017
                             }
1003 1018
                             $external_img = false;
@@ -1022,8 +1037,9 @@  discard block
 block discarded – undo
1022 1037
                                 $file_path = $curr_img_dir . '/' . $filename;
1023 1038
                             }
1024 1039
 
1025
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
-                                unlink($img_path);
1040
+                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) {
1041
+                                                            unlink($img_path);
1042
+                            }
1027 1043
                         }
1028 1044
 
1029 1045
                         if (!empty($uploaded_file)) {
@@ -1052,8 +1068,9 @@  discard block
 block discarded – undo
1052 1068
                             $attachment_set = '';
1053 1069
 
1054 1070
                             foreach ($attachment as $key => $val) {
1055
-                                if ($val != '')
1056
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1071
+                                if ($val != '') {
1072
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1073
+                                }
1057 1074
                             }
1058 1075
 
1059 1076
                             $attachment_set = trim($attachment_set, ", ");
@@ -1078,8 +1095,9 @@  discard block
 block discarded – undo
1078 1095
                         )
1079 1096
                     );
1080 1097
 
1081
-                    if ($menu_order == 1)
1082
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1098
+                    if ($menu_order == 1) {
1099
+                                            $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1100
+                    }
1083 1101
 
1084 1102
                 }
1085 1103
 
@@ -1120,8 +1138,9 @@  discard block
 block discarded – undo
1120 1138
 
1121 1139
         $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1122 1140
 
1123
-        if (!empty($invalid_files))
1124
-            geodir_remove_attachments($invalid_files);
1141
+        if (!empty($invalid_files)) {
1142
+                    geodir_remove_attachments($invalid_files);
1143
+        }
1125 1144
     }
1126 1145
 
1127 1146
 }
@@ -1174,16 +1193,19 @@  discard block
 block discarded – undo
1174 1193
 function geodir_delete_directory($dirname)
1175 1194
 {
1176 1195
     $dir_handle = '';
1177
-    if (is_dir($dirname))
1178
-        $dir_handle = opendir($dirname);
1179
-    if (!$dir_handle)
1180
-        return false;
1196
+    if (is_dir($dirname)) {
1197
+            $dir_handle = opendir($dirname);
1198
+    }
1199
+    if (!$dir_handle) {
1200
+            return false;
1201
+    }
1181 1202
     while ($file = readdir($dir_handle)) {
1182 1203
         if ($file != "." && $file != "..") {
1183
-            if (!is_dir($dirname . "/" . $file))
1184
-                unlink($dirname . "/" . $file);
1185
-            else
1186
-                geodir_delete_directory($dirname . '/' . $file);
1204
+            if (!is_dir($dirname . "/" . $file)) {
1205
+                            unlink($dirname . "/" . $file);
1206
+            } else {
1207
+                            geodir_delete_directory($dirname . '/' . $file);
1208
+            }
1187 1209
         }
1188 1210
     }
1189 1211
     closedir($dir_handle);
@@ -1212,8 +1234,9 @@  discard block
 block discarded – undo
1212 1234
             foreach ($postcurr_images as $postimg) {
1213 1235
                 $image_name_arr = explode('/', $postimg->src);
1214 1236
                 $filename = end($image_name_arr);
1215
-                if (file_exists($uploads_dir . '/' . $filename))
1216
-                    unlink($uploads_dir . '/' . $filename);
1237
+                if (file_exists($uploads_dir . '/' . $filename)) {
1238
+                                    unlink($uploads_dir . '/' . $filename);
1239
+                }
1217 1240
             }
1218 1241
 
1219 1242
         } // endif
@@ -1265,8 +1288,9 @@  discard block
 block discarded – undo
1265 1288
 
1266 1289
             $file_info = pathinfo($file);
1267 1290
             $sub_dir = '';
1268
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1269
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1291
+            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1292
+                            $sub_dir = stripslashes_deep($file_info['dirname']);
1293
+            }
1270 1294
 
1271 1295
             $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1272 1296
             $uploads_baseurl = $uploads['baseurl'];
@@ -1310,9 +1334,9 @@  discard block
 block discarded – undo
1310 1334
                 $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1311 1335
             }
1312 1336
 
1313
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1314
-                $default_img = $default_catimg['src'];
1315
-            elseif ($no_image) {
1337
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1338
+                            $default_img = $default_catimg['src'];
1339
+            } elseif ($no_image) {
1316 1340
                 $default_img = get_option('geodir_listing_no_img');
1317 1341
             }
1318 1342
 
@@ -1344,10 +1368,13 @@  discard block
 block discarded – undo
1344 1368
             }
1345 1369
         }
1346 1370
 
1347
-        if (!empty($img_arr))
1348
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1349
-        else
1350
-            return false;
1371
+        if (!empty($img_arr)) {
1372
+                    return (object)$img_arr;
1373
+        }
1374
+        //return (object)array( 'src' => $file_url, 'path' => $file_path );
1375
+        else {
1376
+                    return false;
1377
+        }
1351 1378
     }
1352 1379
 }
1353 1380
 
@@ -1374,8 +1401,9 @@  discard block
 block discarded – undo
1374 1401
             echo $html;
1375 1402
         } elseif (!empty($html)) {
1376 1403
             return $html;
1377
-        } else
1378
-            return false;
1404
+        } else {
1405
+                    return false;
1406
+        }
1379 1407
     }
1380 1408
 }
1381 1409
 
@@ -1403,8 +1431,9 @@  discard block
 block discarded – undo
1403 1431
         }
1404 1432
         $not_featured = '';
1405 1433
         $sub_dir = '';
1406
-        if (!$add_featured)
1407
-            $not_featured = " AND is_featured = 0 ";
1434
+        if (!$add_featured) {
1435
+                    $not_featured = " AND is_featured = 0 ";
1436
+        }
1408 1437
 
1409 1438
         $arrImages = $wpdb->get_results(
1410 1439
             $wpdb->prepare(
@@ -1425,8 +1454,9 @@  discard block
 block discarded – undo
1425 1454
 
1426 1455
                 $file_info = pathinfo($attechment->file);
1427 1456
 
1428
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1429
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1457
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1458
+                                    $sub_dir = stripslashes_deep($file_info['dirname']);
1459
+                }
1430 1460
 
1431 1461
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1432 1462
                 $uploads_baseurl = $uploads['baseurl'];
@@ -1471,9 +1501,9 @@  discard block
 block discarded – undo
1471 1501
             $default_img = '';
1472 1502
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1473 1503
             $post_type = get_post_type($post_id);
1474
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1475
-                $default_img = $default_catimg['src'];
1476
-            elseif ($no_images) {
1504
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1505
+                            $default_img = $default_catimg['src'];
1506
+            } elseif ($no_images) {
1477 1507
                 $default_img = get_option('geodir_listing_no_img');
1478 1508
             }
1479 1509
 
@@ -1508,8 +1538,9 @@  discard block
 block discarded – undo
1508 1538
                 $return_arr[] = (object)$img_arr;
1509 1539
 
1510 1540
                 return $return_arr;
1511
-            } else
1512
-                return false;
1541
+            } else {
1542
+                            return false;
1543
+            }
1513 1544
         }
1514 1545
     }
1515 1546
 }
@@ -1570,8 +1601,9 @@  discard block
 block discarded – undo
1570 1601
                         $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1571 1602
                     } else if ($image->width < ($max_size->h)) {
1572 1603
                         $width_per = round((($image->width / $max_size->w) * 100), 2);
1573
-                    } else
1574
-                        $width_per = 100;
1604
+                    } else {
1605
+                                            $width_per = 100;
1606
+                    }
1575 1607
                 }
1576 1608
 
1577 1609
                 if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
@@ -1586,8 +1618,9 @@  discard block
 block discarded – undo
1586 1618
             echo $html;
1587 1619
         } elseif (!empty($html)) {
1588 1620
             return $html;
1589
-        } else
1590
-            return false;
1621
+        } else {
1622
+                    return false;
1623
+        }
1591 1624
     }
1592 1625
 }
1593 1626
 
@@ -1625,8 +1658,9 @@  discard block
 block discarded – undo
1625 1658
                 $post_obj = get_post($post_id);
1626 1659
 
1627 1660
                 $cat_ids = array('0');
1628
-                if (is_array($tt_ids))
1629
-                    $cat_ids = $tt_ids;
1661
+                if (is_array($tt_ids)) {
1662
+                                    $cat_ids = $tt_ids;
1663
+                }
1630 1664
 
1631 1665
 
1632 1666
                 if (!empty($cat_ids)) {
@@ -1683,8 +1717,9 @@  discard block
 block discarded – undo
1683 1717
                         $json .= '}';
1684 1718
 
1685 1719
 
1686
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1687
-                            $post_marker_json = $json;
1720
+                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) {
1721
+                                                    $post_marker_json = $json;
1722
+                        }
1688 1723
 
1689 1724
 
1690 1725
                         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,10 +1750,13 @@  discard block
 block discarded – undo
1715 1750
                 if (!empty($post_term) && is_array($post_term)) {
1716 1751
                     $categories = implode(',', $post_term);
1717 1752
 
1718
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1753
+                    if ($categories != '' && $categories != 0) {
1754
+                    	$categories = ',' . $categories . ',';
1755
+                    }
1719 1756
 
1720
-                    if (empty($post_marker_json))
1721
-                        $post_marker_json = isset($json) ? $json : '';
1757
+                    if (empty($post_marker_json)) {
1758
+                                            $post_marker_json = isset($json) ? $json : '';
1759
+                    }
1722 1760
 
1723 1761
                     if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1724 1762
 
@@ -1757,8 +1795,9 @@  discard block
 block discarded – undo
1757 1795
 
1758 1796
                                 }
1759 1797
 
1760
-                                if ($default_category == '')
1761
-                                    $default_category = $categories[0];
1798
+                                if ($default_category == '') {
1799
+                                                                    $default_category = $categories[0];
1800
+                                }
1762 1801
 
1763 1802
                                 geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1764 1803
 
@@ -1902,7 +1941,7 @@  discard block
 block discarded – undo
1902 1941
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1903 1942
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1904 1943
                             <?php
1905
-                            }else{
1944
+                            } else{
1906 1945
                                 echo '<div class="geodir-bubble_image"></div>';
1907 1946
                             }
1908 1947
                         } else {
@@ -1910,7 +1949,7 @@  discard block
 block discarded – undo
1910 1949
                                 ?>
1911 1950
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1912 1951
                             <?php
1913
-                            }else{
1952
+                            } else{
1914 1953
                                 echo '<div class="geodir-bubble_image"></div>';
1915 1954
                             }
1916 1955
                         }
@@ -2001,10 +2040,11 @@  discard block
 block discarded – undo
2001 2040
      */
2002 2041
     function geodir_new_post_default_status()
2003 2042
     {
2004
-        if (get_option('geodir_new_post_default_status'))
2005
-            return get_option('geodir_new_post_default_status');
2006
-        else
2007
-            return 'publish';
2043
+        if (get_option('geodir_new_post_default_status')) {
2044
+                    return get_option('geodir_new_post_default_status');
2045
+        } else {
2046
+                    return 'publish';
2047
+        }
2008 2048
 
2009 2049
     }
2010 2050
 }
@@ -2155,8 +2195,9 @@  discard block
 block discarded – undo
2155 2195
 
2156 2196
         $all_postypes = geodir_get_posttypes();
2157 2197
 
2158
-        if (!in_array($post_type, $all_postypes))
2159
-            return false;
2198
+        if (!in_array($post_type, $all_postypes)) {
2199
+                    return false;
2200
+        }
2160 2201
 
2161 2202
         $table = $plugin_prefix . $post_type . '_detail';
2162 2203
 
@@ -2424,8 +2465,9 @@  discard block
 block discarded – undo
2424 2465
         $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2425 2466
 
2426 2467
         $user_meta_data = '';
2427
-        if (isset($current_user->data->ID))
2428
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2468
+        if (isset($current_user->data->ID)) {
2469
+                    $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2470
+        }
2429 2471
 
2430 2472
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2431 2473
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
@@ -2438,8 +2480,9 @@  discard block
 block discarded – undo
2438 2480
 
2439 2481
             if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2440 2482
                 $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2441
-            } else
2442
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2483
+            } else {
2484
+                            $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2485
+            }
2443 2486
 
2444 2487
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2445 2488
                                                                                         href="javascript:void(0);"
@@ -2502,14 +2545,16 @@  discard block
 block discarded – undo
2502 2545
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2503 2546
 
2504 2547
             $cat_post_count = $wpdb->get_var($count_query);
2505
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2506
-                $cat_post_count = 0;
2548
+            if (empty($cat_post_count) || is_wp_error($cat_post_count)) {
2549
+                            $cat_post_count = 0;
2550
+            }
2507 2551
 
2508 2552
             return $cat_post_count;
2509 2553
 
2510
-        } else
2511
-
2512
-            return $term->count;
2554
+        } else {
2555
+        
2556
+            return $term->count;
2557
+        }
2513 2558
     }
2514 2559
     return false;
2515 2560
 
@@ -2556,13 +2601,15 @@  discard block
 block discarded – undo
2556 2601
 		return $length;
2557 2602
 	}
2558 2603
 	
2559
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2560
-        $length = get_option('geodir_desc_word_limit');
2561
-    elseif (get_query_var('excerpt_length'))
2562
-        $length = get_query_var('excerpt_length');
2604
+    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) {
2605
+            $length = get_option('geodir_desc_word_limit');
2606
+    } elseif (get_query_var('excerpt_length')) {
2607
+            $length = get_query_var('excerpt_length');
2608
+    }
2563 2609
 
2564
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2565
-        $length = get_option('geodir_author_desc_word_limit');
2610
+    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) {
2611
+            $length = get_option('geodir_author_desc_word_limit');
2612
+    }
2566 2613
 
2567 2614
     return $length;
2568 2615
 }
@@ -2695,10 +2742,11 @@  discard block
 block discarded – undo
2695 2742
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2696 2743
 {
2697 2744
     $listing_author_id = geodir_get_listing_author($listing_id);
2698
-    if ($listing_author_id == $user_id)
2699
-        return true;
2700
-    else
2701
-        return false;
2745
+    if ($listing_author_id == $user_id) {
2746
+            return true;
2747
+    } else {
2748
+            return false;
2749
+    }
2702 2750
 
2703 2751
 }
2704 2752
 
@@ -2747,10 +2795,11 @@  discard block
 block discarded – undo
2747 2795
     $pattern = '/-\d+x\d+\./';
2748 2796
     preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2749 2797
 
2750
-    if (empty($matches))
2751
-        return '';
2752
-    else
2753
-        return $file;
2798
+    if (empty($matches)) {
2799
+            return '';
2800
+    } else {
2801
+            return $file;
2802
+    }
2754 2803
 
2755 2804
 }
2756 2805
 
@@ -2835,8 +2884,9 @@  discard block
 block discarded – undo
2835 2884
     } else {
2836 2885
         //set_post_thumbnail($post_id,-1);
2837 2886
 
2838
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2839
-            wp_delete_attachment($post_thumbnail_id);
2887
+        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2888
+                    wp_delete_attachment($post_thumbnail_id);
2889
+        }
2840 2890
 
2841 2891
     }
2842 2892
 }
@@ -2921,8 +2971,9 @@  discard block
 block discarded – undo
2921 2971
 
2922 2972
     global $wpdb;
2923 2973
 
2924
-    if ($listing_type == '')
2925
-        $listing_type = 'gd_place';
2974
+    if ($listing_type == '') {
2975
+            $listing_type = 'gd_place';
2976
+    }
2926 2977
 
2927 2978
     $fields_info = array();
2928 2979
 
@@ -2945,8 +2996,9 @@  discard block
 block discarded – undo
2945 2996
 
2946 2997
                 $fields_info[$prefix . 'address'] = $data->field_type;
2947 2998
 
2948
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2949
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
2999
+                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
3000
+                                    $fields_info[$prefix . 'zip'] = $data->field_type;
3001
+                }
2950 3002
 
2951 3003
             } else {
2952 3004
 
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 3 patches
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                          * @param array $tabs The array of tabs to display.
53 53
                          */
54 54
                         $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
55
+                        update_option('geodir_tabs', $tabs); // Important to show settings menu dropdown
56 56
 
57 57
                         foreach ($tabs as $name => $args) :
58 58
                             $label = $args['label'];
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                     jQuery('.geodirectory-nav-tab-wrapper a').click(function () {
223 223
                         if (changed) {
224 224
                             window.onbeforeunload = function () {
225
-                                return '<?php echo __( 'The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
225
+                                return '<?php echo __('The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
226 226
                             }
227 227
                         } else {
228 228
                             window.onbeforeunload = '';
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             ?>
328 328
 
329 329
             <p class="submit">
330
-            <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
330
+            <input <?php echo $hide_save_button; ?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
331 331
             <input type="hidden" name="subtab" id="last_tab" />
332 332
             </p>
333 333
             
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
                     ?>
398 398
 
399
-                    <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
399
+                    <h3><?php _e('Set Default Location', 'geodirectory'); ?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
                         echo $location_result->location_id;
405 405
                     } ?>">
406 406
 
407
-                    <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
407
+                    <input type="hidden" name="address" id="<?php echo $prefix; ?>address" value="">
408 408
 
409 409
                     <table class="form-table default_location_form">
410 410
                         <tbody>
411 411
                         <tr valign="top" class="single_select_page">
412
-                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory');?></th>
412
+                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory'); ?></th>
413 413
                             <td class="forminp">
414 414
                                 <div class="gtd-formfeild required">
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416
-                                           id="<?php echo $prefix;?>city" name="city"
416
+                                           id="<?php echo $prefix; ?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418 418
                                                echo $location_result->city;
419 419
                                            } ?>"/>
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
                             </td>
426 426
                         </tr>
427 427
                         <tr valign="top" class="single_select_page">
428
-                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory');?></th>
428
+                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory'); ?></th>
429 429
                             <td class="forminp">
430 430
                                 <div class="gtd-formfeild required">
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432
-                                           id="<?php echo $prefix;?>region" name="region"
432
+                                           id="<?php echo $prefix; ?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434 434
                                                echo $location_result->region;
435 435
                                            } ?>"/>
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                             </td>
442 442
                         </tr>
443 443
                         <tr valign="top" class="single_select_page">
444
-                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory');?></th>
444
+                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory'); ?></th>
445 445
                             <td class="forminp">
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                                     ?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453
-                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
453
+                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory'); ?>"
454 454
                                             data-addsearchtermonnorecord="1" data-ajaxchosen="0" data-autoredirect="0"
455 455
                                             data-showeverywhere="0">
456 456
                                         <?php geodir_get_country_dl($country, $prefix); ?>
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                         </tr>
468 468
                         <tr valign="top" class="single_select_page">
469 469
                             <th class="titledesc"
470
-                                scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
470
+                                scope="row"><?php _e('Set Location on Map', 'geodirectory'); ?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473 473
                                 /**
@@ -475,15 +475,15 @@  discard block
 block discarded – undo
475 475
                                  *
476 476
                                  * @since 1.0.0
477 477
                                  */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
478
+                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); ?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
482
-                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory');?></th>
482
+                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory'); ?></th>
483 483
                             <td class="forminp">
484 484
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486
-                                           id="<?php echo $prefix;?>latitude" name="latitude"
486
+                                           id="<?php echo $prefix; ?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488 488
                                                echo $location_result->city_latitude;
489 489
                                            } ?>"/>
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
                         </tr>
497 497
                         <tr valign="top" class="single_select_page">
498 498
                             <th class="titledesc"
499
-                                scope="row"><?php _e('City Longitude', 'geodirectory');?></th>
499
+                                scope="row"><?php _e('City Longitude', 'geodirectory'); ?></th>
500 500
                             <td class="forminp">
501 501
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503
-                                           id="<?php echo $prefix;?>longitude" name="longitude"
503
+                                           id="<?php echo $prefix; ?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505 505
                                                echo $location_result->city_longitude;
506 506
                                            } ?>"/>
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
         <div class="gd-content-heading">
777 777
 
778 778
 
779
-            <h3><?php _e('Theme Compatability Settings', 'geodirectory');?></h3>
779
+            <h3><?php _e('Theme Compatability Settings', 'geodirectory'); ?></h3>
780 780
             <style>
781 781
                 .gd-theme-compat-table {
782 782
                     width: 100%;
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
                 </div>
808 808
             <?php }?>
809 809
 
810
-            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory');?></h4>
810
+            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory'); ?></h4>
811 811
 
812 812
             <select name="gd_theme_compat" id="gd_theme_compat">
813
-                <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814
-                <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
813
+                <option value=""><?php _e('Select Theme', 'geodirectory'); ?></option>
814
+                <option value="custom"><?php _e('Custom', 'geodirectory'); ?></option>
815 815
                 <?php
816 816
                 $theme_arr = get_option('gd_theme_compats');
817 817
                 $theme_active = get_option('gd_theme_compat');
@@ -830,20 +830,20 @@  discard block
 block discarded – undo
830 830
                 ?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833
-                    class="button-primary"><?php _e('Export', 'geodirectory');?></button>
833
+                    class="button-primary"><?php _e('Export', 'geodirectory'); ?></button>
834 834
             <button onclick="gd_comp_import();" type="button"
835
-                    class="button-primary"><?php _e('Import', 'geodirectory');?></button>
835
+                    class="button-primary"><?php _e('Import', 'geodirectory'); ?></button>
836 836
 
837 837
             <div class="gd-comp-import-export">
838 838
                 <textarea id="gd-import-export-theme-comp"
839
-                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory');?>"></textarea>
839
+                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory'); ?>"></textarea>
840 840
             </div>
841 841
             <script>
842 842
 
843 843
                 function gd_comp_export() {
844 844
                     theme = jQuery('#gd_theme_compat').val();
845 845
                     if (theme == '' || theme == 'custom') {
846
-                        alert("<?php _e('Please select a theme to export','geodirectory');?>");
846
+                        alert("<?php _e('Please select a theme to export', 'geodirectory'); ?>");
847 847
                         return false;
848 848
                     }
849 849
                     jQuery('.gd-comp-import-export').show();
@@ -877,9 +877,9 @@  discard block
 block discarded – undo
877 877
 
878 878
                     jQuery.post(ajaxurl, data, function (response) {
879 879
                         if (response == '0') {
880
-                            alert("<?php _e('Something went wrong','geodirectory');?>");
880
+                            alert("<?php _e('Something went wrong', 'geodirectory'); ?>");
881 881
                         } else {
882
-                            alert("<?php _e('Theme Compatibility Imported','geodirectory');?>");
882
+                            alert("<?php _e('Theme Compatibility Imported', 'geodirectory'); ?>");
883 883
                             jQuery('#gd-import-export-theme-comp').val('');
884 884
                             jQuery('.gd-comp-import-export').hide();
885 885
                             jQuery('#gd_theme_compat').append(new Option(response, response));
@@ -920,14 +920,14 @@  discard block
 block discarded – undo
920 920
 
921 921
             </script>
922 922
 
923
-            <h4><?php _e('Main Wrapper Actions', 'geodirectory');?></h4>
923
+            <h4><?php _e('Main Wrapper Actions', 'geodirectory'); ?></h4>
924 924
 
925 925
             <table class="form-table gd-theme-compat-table">
926 926
                 <tbody>
927 927
                 <tr>
928
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
929
-                    <td><strong><?php _e('ID', 'geodirectory');?></strong></td>
930
-                    <td><strong><?php _e('Class', 'geodirectory');?></strong></td>
928
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
929
+                    <td><strong><?php _e('ID', 'geodirectory'); ?></strong></td>
930
+                    <td><strong><?php _e('Class', 'geodirectory'); ?></strong></td>
931 931
                 </tr>
932 932
 
933 933
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
947 947
                     <td colspan="3">
948
-                        <span><?php _e('Output:', 'geodirectory');?></span>
948
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951 951
                                 echo $tc['geodir_wrapper_open_replace'];
@@ -959,14 +959,14 @@  discard block
 block discarded – undo
959 959
                         <small>geodir_wrapper_close</small>
960 960
                     </td>
961 961
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_id"
962
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
962
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
963 963
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_class"
964
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
964
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
965 965
                 </tr>
966 966
 
967 967
                 <tr class="gd-theme-comp-out">
968 968
                     <td colspan="3">
969
-                        <span><?php _e('Output:', 'geodirectory');?></span>
969
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972 972
                                 echo $tc['geodir_wrapper_close_replace'];
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
992 992
                     <td colspan="3">
993
-                        <span><?php _e('Output:', 'geodirectory');?></span>
993
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996 996
                                 echo $tc['geodir_wrapper_content_open_replace'];
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
                         <small>geodir_wrapper_content_close</small>
1005 1005
                     </td>
1006 1006
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_id"
1007
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1007
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1008 1008
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_class"
1009
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1009
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1010 1010
                 </tr>
1011 1011
 
1012 1012
                 <tr class="gd-theme-comp-out">
1013 1013
                     <td colspan="3">
1014
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1014
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017 1017
                                 echo $tc['geodir_wrapper_content_close_replace'];
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
1035 1035
                     <td colspan="3">
1036
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1036
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039 1039
                                 echo $tc['geodir_article_open_replace'];
@@ -1046,14 +1046,14 @@  discard block
 block discarded – undo
1046 1046
                         <small>geodir_article_close</small>
1047 1047
                     </td>
1048 1048
                     <td><input disabled="disabled" type="text" name="geodir_article_close_id"
1049
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1049
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1050 1050
                     <td><input disabled="disabled" type="text" name="geodir_article_close_class"
1051
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1051
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1052 1052
                 </tr>
1053 1053
 
1054 1054
                 <tr class="gd-theme-comp-out">
1055 1055
                     <td colspan="3">
1056
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1056
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059 1059
                                 echo $tc['geodir_article_close_replace'];
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
                 <tr class="gd-theme-comp-out">
1078 1078
                     <td colspan="3">
1079
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1079
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082 1082
                                 echo $tc['geodir_sidebar_right_open_replace'];
@@ -1089,14 +1089,14 @@  discard block
 block discarded – undo
1089 1089
                         <small>geodir_sidebar_right_close</small>
1090 1090
                     </td>
1091 1091
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_id"
1092
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1092
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1093 1093
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_class"
1094
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1094
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1095 1095
                 </tr>
1096 1096
 
1097 1097
                 <tr class="gd-theme-comp-out">
1098 1098
                     <td colspan="3">
1099
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1099
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102 1102
                                 echo $tc['geodir_sidebar_right_close_replace'];
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
                 <tr class="gd-theme-comp-out">
1122 1122
                     <td colspan="3">
1123
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1123
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126 1126
                                 echo $tc['geodir_sidebar_left_open_replace'];
@@ -1133,14 +1133,14 @@  discard block
 block discarded – undo
1133 1133
                         <small>geodir_sidebar_left_close</small>
1134 1134
                     </td>
1135 1135
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_id"
1136
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1136
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1137 1137
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_class"
1138
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1138
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1139 1139
                 </tr>
1140 1140
 
1141 1141
                 <tr class="gd-theme-comp-out">
1142 1142
                     <td colspan="3">
1143
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1143
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146 1146
                                 echo $tc['geodir_sidebar_left_close_replace'];
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
1164 1164
                     <td colspan="3">
1165
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1165
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168 1168
                                 echo $tc['geodir_main_content_open_replace'];
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
                         <small>geodir_main_content_close</small>
1176 1176
                     </td>
1177 1177
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_id"
1178
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1178
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1179 1179
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_class"
1180
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1180
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1181 1181
                 </tr>
1182 1182
 
1183 1183
                 <tr class="gd-theme-comp-out">
1184 1184
                     <td colspan="3">
1185
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1185
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188 1188
                                 echo $tc['geodir_main_content_close_replace'];
@@ -1194,13 +1194,13 @@  discard block
 block discarded – undo
1194 1194
                 </tbody>
1195 1195
             </table>
1196 1196
 
1197
-            <h4><?php _e('Other Actions', 'geodirectory');?></h4>
1197
+            <h4><?php _e('Other Actions', 'geodirectory'); ?></h4>
1198 1198
 
1199 1199
             <table class="form-table gd-theme-compat-table">
1200 1200
                 <tbody>
1201 1201
                 <tr>
1202
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
1203
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1202
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
1203
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1204 1204
                 </tr>
1205 1205
 
1206 1206
 
@@ -1229,13 +1229,13 @@  discard block
 block discarded – undo
1229 1229
             </table>
1230 1230
 
1231 1231
 
1232
-            <h4><?php _e('Other Filters', 'geodirectory');?></h4>
1232
+            <h4><?php _e('Other Filters', 'geodirectory'); ?></h4>
1233 1233
 
1234 1234
             <table class="form-table gd-theme-compat-table">
1235 1235
                 <tbody>
1236 1236
                 <tr>
1237
-                    <td><strong><?php _e('Filter', 'geodirectory');?></strong></td>
1238
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1237
+                    <td><strong><?php _e('Filter', 'geodirectory'); ?></strong></td>
1238
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1239 1239
                 </tr>
1240 1240
 
1241 1241
                 <tr>
@@ -1389,13 +1389,13 @@  discard block
 block discarded – undo
1389 1389
                  *
1390 1390
                  * @since 1.4.0
1391 1391
                  */
1392
-                do_action('gd_compat_other_filters');?>
1392
+                do_action('gd_compat_other_filters'); ?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
1396 1396
 
1397 1397
 
1398
-            <h4><?php _e('Required CSS', 'geodirectory');?></h4>
1398
+            <h4><?php _e('Required CSS', 'geodirectory'); ?></h4>
1399 1399
 
1400 1400
             <table class="form-table gd-theme-compat-table">
1401 1401
                 <tbody>
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
                 </tbody>
1411 1411
             </table>
1412 1412
 
1413
-            <h4><?php _e('Required JS', 'geodirectory');?></h4>
1413
+            <h4><?php _e('Required JS', 'geodirectory'); ?></h4>
1414 1414
 
1415 1415
             <table class="form-table gd-theme-compat-table">
1416 1416
                 <tbody>
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 
1429 1429
             <p class="submit">
1430 1430
                 <input name="save" class="button-primary" type="submit"
1431
-                       value="<?php _e('Save changes', 'geodirectory');?>">
1431
+                       value="<?php _e('Save changes', 'geodirectory'); ?>">
1432 1432
             </p>
1433 1433
 
1434 1434
         </div>
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
          * @param string $listing_type Post type.
1463 1463
          */
1464 1464
         ?>
1465
-        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1465
+        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type); ?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
1468 1468
         <div class="general-form-builder-frame">
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
                  * @param string $listing_type Post type.
1478 1478
                  */
1479 1479
                 ?>
1480
-                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1480
+                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type); ?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483 1483
                 /**
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
                  * @param string $listing_type Post type.
1489 1489
                  */
1490 1490
                 ?>
1491
-                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1491
+                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type); ?></p>
1492 1492
 
1493 1493
                 <div class="inside">
1494 1494
 
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
                      * @param string $listing_type Post type.
1523 1523
                      */
1524 1524
                     ?>
1525
-                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1525
+                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type); ?></span>
1526 1526
                 </h3>
1527 1527
                 <?php
1528 1528
                 /**
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
                  * @param string $listing_type Post type.
1534 1534
                  */
1535 1535
                 ?>
1536
-                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1536
+                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type); ?></p>
1537 1537
 
1538 1538
                 <div class="inside">
1539 1539
 
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
         <div class="gd-content-heading">
1575 1575
 
1576 1576
 
1577
-            <h3><?php _e('GD Diagnostic Tools', 'geodirectory');?></h3>
1577
+            <h3><?php _e('GD Diagnostic Tools', 'geodirectory'); ?></h3>
1578 1578
             <style>
1579 1579
                 .gd-tools-table {
1580 1580
                     width: 100%;
@@ -1593,81 +1593,81 @@  discard block
 block discarded – undo
1593 1593
             <table class="form-table gd-tools-table">
1594 1594
                 <tbody>
1595 1595
                 <tr>
1596
-                    <td><strong><?php _e('Tool', 'geodirectory');?></strong></td>
1597
-                    <td><strong><?php _e('Description', 'geodirectory');?></strong></td>
1598
-                    <td><strong><?php _e('Action', 'geodirectory');?></strong></td>
1596
+                    <td><strong><?php _e('Tool', 'geodirectory'); ?></strong></td>
1597
+                    <td><strong><?php _e('Description', 'geodirectory'); ?></strong></td>
1598
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
1599 1599
                 </tr>
1600 1600
 
1601 1601
 
1602 1602
                 <tr>
1603
-                    <td><?php _e('GD pages check', 'geodirectory');?></td>
1603
+                    <td><?php _e('GD pages check', 'geodirectory'); ?></td>
1604 1604
                     <td>
1605
-                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory');?></small>
1605
+                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory'); ?></small>
1606 1606
                     </td>
1607 1607
                     <td>
1608
-                        <input type="button" value="<?php _e('Run', 'geodirectory');?>"
1608
+                        <input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1609 1609
                                class="button-primary geodir_diagnosis_button" data-diagnose="default_pages"/>
1610 1610
                     </td>
1611 1611
                 </tr>
1612 1612
 
1613 1613
 
1614 1614
                 <tr>
1615
-                    <td><?php _e('Multisite DB conversion check', 'geodirectory');?></td>
1615
+                    <td><?php _e('Multisite DB conversion check', 'geodirectory'); ?></td>
1616 1616
                     <td>
1617
-                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory');?></small>
1617
+                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory'); ?></small>
1618 1618
                     </td>
1619
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1619
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1620 1620
                                class="button-primary geodir_diagnosis_button" data-diagnose="multisite_conversion"/>
1621 1621
                     </td>
1622 1622
                 </tr>
1623 1623
 
1624 1624
                 <tr>
1625
-                    <td><?php _e('Ratings check', 'geodirectory');?></td>
1625
+                    <td><?php _e('Ratings check', 'geodirectory'); ?></td>
1626 1626
                     <td>
1627
-                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory');?></small>
1627
+                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory'); ?></small>
1628 1628
                     </td>
1629
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1629
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1630 1630
                                class="button-primary geodir_diagnosis_button" data-diagnose="ratings"/>
1631 1631
                     </td>
1632 1632
                 </tr>
1633 1633
 
1634 1634
                 <tr>
1635
-                    <td><?php _e('Sync GD tags', 'geodirectory');?></td>
1635
+                    <td><?php _e('Sync GD tags', 'geodirectory'); ?></td>
1636 1636
                     <td>
1637
-                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory');?></small>
1637
+                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory'); ?></small>
1638 1638
                     </td>
1639
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1639
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1640 1640
                                class="button-primary geodir_diagnosis_button" data-diagnose="tags_sync"/>
1641 1641
                     </td>
1642 1642
                 </tr>
1643 1643
 
1644 1644
                 <tr>
1645
-                    <td><?php _e('Sync GD Categories', 'geodirectory');?></td>
1645
+                    <td><?php _e('Sync GD Categories', 'geodirectory'); ?></td>
1646 1646
                     <td>
1647
-                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory');?></small>
1647
+                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory'); ?></small>
1648 1648
                     </td>
1649
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1649
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1650 1650
                                class="button-primary geodir_diagnosis_button" data-diagnose="cats_sync"/>
1651 1651
                     </td>
1652 1652
                 </tr>
1653 1653
 
1654 1654
 
1655 1655
                 <tr>
1656
-                    <td><?php _e('Clear all GD version numbers', 'geodirectory');?></td>
1656
+                    <td><?php _e('Clear all GD version numbers', 'geodirectory'); ?></td>
1657 1657
                     <td>
1658
-                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory');?></small>
1658
+                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory'); ?></small>
1659 1659
                     </td>
1660
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1660
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1661 1661
                                class="button-primary geodir_diagnosis_button" data-diagnose="version_clear"/>
1662 1662
                     </td>
1663 1663
                 </tr>
1664 1664
 				<tr>
1665
-					<td><?php _e('Load custom fields translation', 'geodirectory');?></td>
1665
+					<td><?php _e('Load custom fields translation', 'geodirectory'); ?></td>
1666 1666
 					<td>
1667
-						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory');?></small>
1667
+						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory'); ?></small>
1668 1668
 					</td>
1669 1669
 					<td>
1670
-						<input type="button" value="<?php _e('Run', 'geodirectory');?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1670
+						<input type="button" value="<?php _e('Run', 'geodirectory'); ?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1671 1671
 					</td>
1672 1672
 				</tr>
1673 1673
                 <?php
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
                  * Called after the last setting on the GD>Tools page.
1678 1678
                  * @since 1.0.0
1679 1679
                  */
1680
-                do_action('geodir_diagnostic_tool');?>
1680
+                do_action('geodir_diagnostic_tool'); ?>
1681 1681
 
1682 1682
                 </tbody>
1683 1683
             </table>
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,17 +74,20 @@  discard block
 block discarded – undo
74 74
                                 $tab_link = $args['url'];
75 75
                             }
76 76
 
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
77
+                            if (!empty($args['request'])) {
78
+                                                            $tab_link = geodir_getlink($tab_link, $args['request']);
79
+                            }
79 80
 
80 81
                             if (isset($args['target']) && $args['target'] != '') {
81 82
                                 $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
83
+                            } else {
84
+                                                            $tab_target = '';
85
+                            }
84 86
 
85 87
                             $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
+                            if ($current_tab == $name) {
89
+                                                            $tab_active = ' class="tab-active" ';
90
+                            }
88 91
                             /**
89 92
                              * Called before the individual settings tabs are output.
90 93
                              *
@@ -122,8 +125,9 @@  discard block
 block discarded – undo
122 125
 
123 126
                         <?php
124 127
                         unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
128
+                        if (isset($tabs[$current_tab]['subtabs'])) {
129
+                                                    $subtabs = $tabs[$current_tab]['subtabs'];
130
+                        }
127 131
                         $form_action = '';
128 132
 
129 133
                         if (!empty($subtabs)):
@@ -189,7 +193,10 @@  discard block
 block discarded – undo
189 193
                      jQuery('#last_tab').val( jQuery(this).attr('href') );
190 194
                      return false;*/
191 195
                 });
192
-                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery("ul.subsubsub li a[href=#' . sanitize_text_field($_GET['subtab']) . ']").click();'; ?>
196
+                <?php if (isset($_GET['subtab']) && $_GET['subtab']) {
197
+	echo 'jQuery("ul.subsubsub li a[href=#' . sanitize_text_field($_GET['subtab']) . ']").click();';
198
+}
199
+?>
193 200
                 // Countries
194 201
                 jQuery('select#geodirectory_allowed_countries').change(function () {
195 202
                     if (jQuery(this).val() == "specific") {
@@ -312,10 +319,11 @@  discard block
 block discarded – undo
312 319
                 geodir_register_defaults();
313 320
             }*/
314 321
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
322
+            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) {
323
+                            $hide_save_button = "style='display:none;'";
324
+            } else {
325
+                            $hide_save_button = '';
326
+            }
319 327
 
320 328
             /**
321 329
              * Filter weather the default save button in the GD admin settings pages should be shown.
Please login to merge, or discard this patch.
Indentation   +515 added lines, -515 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if (!function_exists('geodir_admin_panel')) {
10
-    /**
11
-     * GeoDirectory Backend Admin Panel.
12
-     *
13
-     * Handles the display of the main GeoDirectory admin panel.
14
-     *
15
-     * @since 1.0.0
16
-     * @package GeoDirectory
17
-     * @global string $current_tab Current tab in geodirectory settings.
18
-     * @global object $geodirectory GeoDirectory plugin object.
19
-     */
20
-    function geodir_admin_panel()
21
-    {
22
-        global $geodirectory;
23
-        global $current_tab;
24
-
25
-
26
-        ?>
10
+	/**
11
+	 * GeoDirectory Backend Admin Panel.
12
+	 *
13
+	 * Handles the display of the main GeoDirectory admin panel.
14
+	 *
15
+	 * @since 1.0.0
16
+	 * @package GeoDirectory
17
+	 * @global string $current_tab Current tab in geodirectory settings.
18
+	 * @global object $geodirectory GeoDirectory plugin object.
19
+	 */
20
+	function geodir_admin_panel()
21
+	{
22
+		global $geodirectory;
23
+		global $current_tab;
24
+
25
+
26
+		?>
27 27
 
28 28
         <div id="gd-wrapper-main" class="wrap geodirectory">
29 29
             <?php
30
-            /**
31
-             * Called just after the opening wrapper div for the GD settings page in the admin area.
32
-             *
33
-             * @since 1.0.0
34
-             */
35
-            do_action('geodir_before_admin_panel');
36
-            ?>
30
+			/**
31
+			 * Called just after the opening wrapper div for the GD settings page in the admin area.
32
+			 *
33
+			 * @since 1.0.0
34
+			 */
35
+			do_action('geodir_before_admin_panel');
36
+			?>
37 37
 
38 38
             <div class="gd-wrapper gd-wrapper-vr clearfix">
39 39
 
@@ -44,75 +44,75 @@  discard block
 block discarded – undo
44 44
                          alt="geo-logo" class="geo-logoalter"/>
45 45
                     <ul>
46 46
                         <?php
47
-                        $tabs = array();
48
-                        /**
49
-                         * Filter the GD admin settings tabs on the left of the admin menu.
50
-                         *
51
-                         * @since 1.0.0
52
-                         * @param array $tabs The array of tabs to display.
53
-                         */
54
-                        $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
-
57
-                        foreach ($tabs as $name => $args) :
58
-                            $label = $args['label'];
59
-
60
-
61
-                            $query_string = '';
62
-                            if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
-
64
-                                $subtabs = $args['subtabs'];
65
-
66
-                                $query_string = '&subtab=' . $subtabs[0]['subtab'];
67
-
68
-                            endif;
69
-
70
-
71
-                            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
-
73
-                            if (isset($args['url']) && $args['url'] != '') {
74
-                                $tab_link = $args['url'];
75
-                            }
76
-
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
79
-
80
-                            if (isset($args['target']) && $args['target'] != '') {
81
-                                $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
84
-
85
-                            $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
-                            /**
89
-                             * Called before the individual settings tabs are output.
90
-                             *
91
-                             * @since 1.0.0
92
-                             * @param string $name The name of the settings tab.
93
-                             * @see 'geodir_after_settings_tabs'
94
-                             */
95
-                            do_action('geodir_before_settings_tabs', $name);
96
-                            echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
97
-                            /**
98
-                             * Called after the individual settings tabs are output.
99
-                             *
100
-                             * @since 1.0.0
101
-                             * @param string $name The name of the settings tab.
102
-                             * @see 'geodir_before_settings_tabs'
103
-                             */
104
-                            do_action('geodir_after_settings_tabs', $name);
105
-                        endforeach;
106
-
107
-                        /**
108
-                         * Called after the GD settings tabs have been output.
109
-                         *
110
-                         * Called before the closing `ul` so can be used to add new settings tab links.
111
-                         *
112
-                         * @since 1.0.0
113
-                         */
114
-                        do_action('geodir_settings_tabs');
115
-                        ?>
47
+						$tabs = array();
48
+						/**
49
+						 * Filter the GD admin settings tabs on the left of the admin menu.
50
+						 *
51
+						 * @since 1.0.0
52
+						 * @param array $tabs The array of tabs to display.
53
+						 */
54
+						$tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
+						update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
+
57
+						foreach ($tabs as $name => $args) :
58
+							$label = $args['label'];
59
+
60
+
61
+							$query_string = '';
62
+							if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
+
64
+								$subtabs = $args['subtabs'];
65
+
66
+								$query_string = '&subtab=' . $subtabs[0]['subtab'];
67
+
68
+							endif;
69
+
70
+
71
+							$tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
+
73
+							if (isset($args['url']) && $args['url'] != '') {
74
+								$tab_link = $args['url'];
75
+							}
76
+
77
+							if (!empty($args['request']))
78
+								$tab_link = geodir_getlink($tab_link, $args['request']);
79
+
80
+							if (isset($args['target']) && $args['target'] != '') {
81
+								$tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
+							} else
83
+								$tab_target = '';
84
+
85
+							$tab_active = '';
86
+							if ($current_tab == $name)
87
+								$tab_active = ' class="tab-active" ';
88
+							/**
89
+							 * Called before the individual settings tabs are output.
90
+							 *
91
+							 * @since 1.0.0
92
+							 * @param string $name The name of the settings tab.
93
+							 * @see 'geodir_after_settings_tabs'
94
+							 */
95
+							do_action('geodir_before_settings_tabs', $name);
96
+							echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
97
+							/**
98
+							 * Called after the individual settings tabs are output.
99
+							 *
100
+							 * @since 1.0.0
101
+							 * @param string $name The name of the settings tab.
102
+							 * @see 'geodir_before_settings_tabs'
103
+							 */
104
+							do_action('geodir_after_settings_tabs', $name);
105
+						endforeach;
106
+
107
+						/**
108
+						 * Called after the GD settings tabs have been output.
109
+						 *
110
+						 * Called before the closing `ul` so can be used to add new settings tab links.
111
+						 *
112
+						 * @since 1.0.0
113
+						 */
114
+						do_action('geodir_settings_tabs');
115
+						?>
116 116
                     </ul>
117 117
                 </div>
118 118
                 <!--gd-left-nav ends here-->
@@ -121,52 +121,52 @@  discard block
 block discarded – undo
121 121
                     <div class="gd-tabs-main">
122 122
 
123 123
                         <?php
124
-                        unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
127
-                        $form_action = '';
124
+						unset($subtabs);
125
+						if (isset($tabs[$current_tab]['subtabs']))
126
+							$subtabs = $tabs[$current_tab]['subtabs'];
127
+						$form_action = '';
128 128
 
129
-                        if (!empty($subtabs)):
130
-                        ?>
129
+						if (!empty($subtabs)):
130
+						?>
131 131
                             <dl class="gd-tab-head">
132 132
                                 <?php
133
-                                foreach ($subtabs as $sub) {
134
-                                    $subtab_active = '';
135
-                                    if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
-                                        $subtab_active = 'class="gd-tab-active"';
137
-                                        $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
-                                    }
139
-
140
-                                    $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
-                                    if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
-                                        $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
-                                    }
144
-                                    echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
-                                }
146
-                                ?>
133
+								foreach ($subtabs as $sub) {
134
+									$subtab_active = '';
135
+									if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
+										$subtab_active = 'class="gd-tab-active"';
137
+										$form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
+									}
139
+
140
+									$sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
+									if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
+										$sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
+									}
144
+									echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
+								}
146
+								?>
147 147
                             </dl>
148 148
 
149 149
                         <?php endif; ?>
150 150
                         <div class="gd-tab-content <?php if (empty($subtabs)) {
151
-                            echo "inner_contet_tabs";
152
-                        } ?>">
151
+							echo "inner_contet_tabs";
152
+						} ?>">
153 153
                             <form method="post" id="mainform"
154 154
                                   class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
155
-                                      echo sanitize_text_field($sub['subtab']);
156
-                                  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
155
+									  echo sanitize_text_field($sub['subtab']);
156
+								  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
158 158
                                        value="<?php if (isset($_REQUEST['active_tab'])) {
159
-                                           echo sanitize_text_field($_REQUEST['active_tab']);
160
-                                       } ?>"/>
159
+										   echo sanitize_text_field($_REQUEST['active_tab']);
160
+									   } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162 162
                                 <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
163 163
                                 <?php
164
-                                /**
165
-                                 * Used to call the content of each GD settings tab page.
166
-                                 *
167
-                                 * @since 1.0.0
168
-                                 */
169
-                                do_action('geodir_admin_option_form', $current_tab); ?>
164
+								/**
165
+								 * Used to call the content of each GD settings tab page.
166
+								 *
167
+								 * @since 1.0.0
168
+								 */
169
+								do_action('geodir_admin_option_form', $current_tab); ?>
170 170
                             </form>
171 171
                         </div>
172 172
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         </script>
268 268
     <?php
269 269
 
270
-    }
270
+	}
271 271
 }
272 272
 
273 273
 
@@ -283,48 +283,48 @@  discard block
 block discarded – undo
283 283
 function geodir_admin_option_form($tab_name)
284 284
 {
285 285
 
286
-    //echo $tab_name.'_array.php' ;
287
-    global $geodir_settings, $is_default, $mapzoom;
288
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
-        /**
290
-         * Contains settings array for given tab.
291
-         *
292
-         * @since 1.0.0
293
-         * @package GeoDirectory
294
-         */
295
-        include_once('option-pages/' . $tab_name . '_array.php');
296
-    }
297
-
298
-    $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
-
300
-    switch ($tab_name) {
301
-
302
-        case 'general_settings':
303
-
304
-            geodir_admin_fields($geodir_settings['general_settings']);
305
-            /**
306
-             *
307
-             * Update Taxonomy Options *
308
-             *
309
-             **/
310
-            /*add_action('updated_option_place_prefix','update_listing_prefix');
286
+	//echo $tab_name.'_array.php' ;
287
+	global $geodir_settings, $is_default, $mapzoom;
288
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
+		/**
290
+		 * Contains settings array for given tab.
291
+		 *
292
+		 * @since 1.0.0
293
+		 * @package GeoDirectory
294
+		 */
295
+		include_once('option-pages/' . $tab_name . '_array.php');
296
+	}
297
+
298
+	$listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
+
300
+	switch ($tab_name) {
301
+
302
+		case 'general_settings':
303
+
304
+			geodir_admin_fields($geodir_settings['general_settings']);
305
+			/**
306
+			 *
307
+			 * Update Taxonomy Options *
308
+			 *
309
+			 **/
310
+			/*add_action('updated_option_place_prefix','update_listing_prefix');
311 311
             function update_listing_prefix(){
312 312
                 geodir_register_defaults();
313 313
             }*/
314 314
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
315
+			if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
+				$hide_save_button = "style='display:none;'";
317
+			else
318
+				$hide_save_button = '';
319 319
 
320
-            /**
321
-             * Filter weather the default save button in the GD admin settings pages should be shown.
322
-             *
323
-             * @since 1.0.0
324
-             * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
-             */
326
-            $hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
-            ?>
320
+			/**
321
+			 * Filter weather the default save button in the GD admin settings pages should be shown.
322
+			 *
323
+			 * @since 1.0.0
324
+			 * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
+			 */
326
+			$hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
+			?>
328 328
 
329 329
             <p class="submit">
330 330
             <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
@@ -334,36 +334,36 @@  discard block
 block discarded – undo
334 334
             </div>
335 335
             
336 336
 		<?php break;
337
-        case 'design_settings' :
338
-            geodir_admin_fields($geodir_settings['design_settings']);
337
+		case 'design_settings' :
338
+			geodir_admin_fields($geodir_settings['design_settings']);
339 339
 
340 340
 
341 341
 
342
-            ?>
342
+			?>
343 343
 			<p class="submit">
344 344
 			<input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
345 345
 			<input type="hidden" name="subtab" id="last_tab" />
346 346
 			</p>
347 347
 			</div>
348 348
         <?php break;
349
-        case 'permalink_settings' :
350
-            geodir_admin_fields($geodir_settings['permalink_settings']); ?>
349
+		case 'permalink_settings' :
350
+			geodir_admin_fields($geodir_settings['permalink_settings']); ?>
351 351
             <p class="submit">
352 352
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
353 353
             <input type="hidden" name="subtab" id="last_tab" />
354 354
             </p>
355 355
             </div>	
356 356
 		<?php break;
357
-        case 'title_meta_settings' :
358
-            geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
357
+		case 'title_meta_settings' :
358
+			geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
359 359
             <p class="submit">
360 360
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
361 361
             <input type="hidden" name="subtab" id="last_tab" />
362 362
             </p>
363 363
             </div>
364 364
 		<?php break;
365
-        case 'notifications_settings' :
366
-            geodir_admin_fields($geodir_settings['notifications_settings']); ?>
365
+		case 'notifications_settings' :
366
+			geodir_admin_fields($geodir_settings['notifications_settings']); ?>
367 367
 			
368 368
 			<p class="submit">
369 369
 				
@@ -373,36 +373,36 @@  discard block
 block discarded – undo
373 373
 			</div>
374 374
 			
375 375
 		<?php break;
376
-        case 'default_location_settings' :
377
-            ?>
376
+		case 'default_location_settings' :
377
+			?>
378 378
             <div class="inner_content_tab_main">
379 379
                 <div class="gd-content-heading">
380 380
                     <?php global $wpdb;
381 381
 
382 382
 
383
-                    $location_result = geodir_get_default_location();
383
+					$location_result = geodir_get_default_location();
384 384
 
385
-                    $prefix = '';
385
+					$prefix = '';
386 386
 
387 387
 
388
-                    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
-                    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
-                    $city = isset($location_result->city) ? $location_result->city : '';
391
-                    $region = isset($location_result->region) ? $location_result->region : '';
392
-                    $country = isset($location_result->country) ? $location_result->country : '';
388
+					$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
+					$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
+					$city = isset($location_result->city) ? $location_result->city : '';
391
+					$region = isset($location_result->region) ? $location_result->region : '';
392
+					$country = isset($location_result->country) ? $location_result->country : '';
393 393
 
394 394
 
395
-                    $map_title = __("Set Address On Map", 'geodirectory');
395
+					$map_title = __("Set Address On Map", 'geodirectory');
396 396
 
397
-                    ?>
397
+					?>
398 398
 
399 399
                     <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
403 403
                     <input type="hidden" name="update_city" value="<?php if (isset($location_result->location_id)) {
404
-                        echo $location_result->location_id;
405
-                    } ?>">
404
+						echo $location_result->location_id;
405
+					} ?>">
406 406
 
407 407
                     <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
408 408
 
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416 416
                                            id="<?php echo $prefix;?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418
-                                               echo $location_result->city;
419
-                                           } ?>"/>
418
+											   echo $location_result->city;
419
+										   } ?>"/>
420 420
 
421 421
                                     <div
422 422
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432 432
                                            id="<?php echo $prefix;?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434
-                                               echo $location_result->region;
435
-                                           } ?>"/>
434
+											   echo $location_result->region;
435
+										   } ?>"/>
436 436
 
437 437
                                     <div
438 438
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
448 448
 
449
-                                    $country_result = isset($location_result->country) ? $location_result->country : '';
450
-                                    ?>
449
+									$country_result = isset($location_result->country) ? $location_result->country : '';
450
+									?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453 453
                                             data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
                                 scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473
-                                /**
474
-                                 * Contains add listing page map functions.
475
-                                 *
476
-                                 * @since 1.0.0
477
-                                 */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
473
+								/**
474
+								 * Contains add listing page map functions.
475
+								 *
476
+								 * @since 1.0.0
477
+								 */
478
+								include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486 486
                                            id="<?php echo $prefix;?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488
-                                               echo $location_result->city_latitude;
489
-                                           } ?>"/>
488
+											   echo $location_result->city_latitude;
489
+										   } ?>"/>
490 490
 
491 491
                                     <div
492 492
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503 503
                                            id="<?php echo $prefix;?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505
-                                               echo $location_result->city_longitude;
506
-                                           } ?>"/>
505
+											   echo $location_result->city_longitude;
506
+										   } ?>"/>
507 507
 
508 508
                                     <div
509 509
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
                 </div>
536 536
             </div>
537 537
             <?php break;
538
-        case $listing_type . '_fields_settings' :
538
+		case $listing_type . '_fields_settings' :
539 539
 
540
-            geodir_custom_post_type_form();
540
+			geodir_custom_post_type_form();
541 541
 
542
-            break;
543
-        case 'tools_settings' :
544
-            geodir_diagnostic_tools_setting_page();
545
-            break;
546
-        case 'compatibility_settings' :
547
-            geodir_theme_compatibility_setting_page();
548
-            break;		
542
+			break;
543
+		case 'tools_settings' :
544
+			geodir_diagnostic_tools_setting_page();
545
+			break;
546
+		case 'compatibility_settings' :
547
+			geodir_theme_compatibility_setting_page();
548
+			break;		
549 549
 		case 'import_export' :
550
-            geodir_import_export_page();
551
-            break;
550
+			geodir_import_export_page();
551
+			break;
552 552
 
553
-    }// end of switch
553
+	}// end of switch
554 554
 }
555 555
 
556 556
 
@@ -590,170 +590,170 @@  discard block
 block discarded – undo
590 590
 function geodir_update_options_compatibility_settings()
591 591
 {
592 592
 
593
-    global $wpdb;
593
+	global $wpdb;
594 594
 
595 595
 
596
-    $theme_settings = array();
596
+	$theme_settings = array();
597 597
 
598
-    $theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
-    $theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
-    $theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
598
+	$theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
+	$theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
+	$theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
601 601
 
602
-    $theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
602
+	$theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
603 603
 
604
-    $theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
-    $theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
-    $theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
604
+	$theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
+	$theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
+	$theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
607 607
 
608
-    $theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
608
+	$theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
609 609
 
610
-    $theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
-    $theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
-    $theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
610
+	$theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
+	$theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
+	$theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
613 613
 
614
-    $theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
614
+	$theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
615 615
 
616
-    $theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
-    $theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
-    $theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
616
+	$theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
+	$theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
+	$theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
619 619
 
620
-    $theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
620
+	$theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
621 621
 
622
-    $theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
-    $theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
-    $theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
622
+	$theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
+	$theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
+	$theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
625 625
 
626
-    $theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
626
+	$theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
627 627
 
628
-    $theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
-    $theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
-    $theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
628
+	$theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
+	$theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
+	$theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
631 631
 
632
-    $theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
632
+	$theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
633 633
 
634 634
 // Other Actions
635
-    $theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
-    $theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
635
+	$theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
+	$theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
637 637
 
638 638
 // Filters
639
-    $theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
-    $theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
-    $theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
-    $theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
-    $theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
-    $theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
-    $theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
-    $theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
-    $theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
-    $theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
639
+	$theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
+	$theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
+	$theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
+	$theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
+	$theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
+	$theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
+	$theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
+	$theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
+	$theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
+	$theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
649 649
 //location manager filters
650
-    $theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
-    $theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
-    $theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
-    $theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
650
+	$theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
+	$theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
+	$theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
+	$theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
654 654
 
655 655
 
656 656
 // theme required css
657
-    $theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
657
+	$theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
658 658
 
659 659
 // theme required js
660
-    $theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
660
+	$theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
661 661
 
662 662
 // theme compat name
663
-    $theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
-    if ($theme_settings['gd_theme_compat'] == '') {
665
-        update_option('gd_theme_compat', '');
666
-        update_option('theme_compatibility_setting', '');
667
-        return;
668
-    }
663
+	$theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
+	if ($theme_settings['gd_theme_compat'] == '') {
665
+		update_option('gd_theme_compat', '');
666
+		update_option('theme_compatibility_setting', '');
667
+		return;
668
+	}
669 669
 
670 670
 // theme default options
671
-    $theme_settings['geodir_theme_compat_default_options'] = '';
671
+	$theme_settings['geodir_theme_compat_default_options'] = '';
672 672
 
673 673
 
674 674
 //suported theme code
675
-    $theme_settings['geodir_theme_compat_code'] = false;
676
-
677
-    $theme = wp_get_theme();
678
-
679
-    if ($theme->parent()) {
680
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
-    } else {
682
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
683
-    }
684
-
685
-    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
-        $theme_settings['geodir_theme_compat_code'] = $theme_name;
687
-    }
688
-
689
-
690
-    $theme_name = $theme_name . "_custom";
691
-    $theme_arr = get_option('gd_theme_compats');
692
-    update_option('gd_theme_compat', $theme_name);
693
-    /**
694
-     * Called before the theme compatibility settings are saved to the DB.
695
-     *
696
-     * @since 1.4.0
697
-     * @param array $theme_settings {
698
-     *    Attributes of the theme compatibility settings array.
699
-     *
700
-     *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
-     *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
-     *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
-     *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
-     *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
-     *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
-     *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
-     *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
-     *    @type string $geodir_article_open_id Geodir article open html id.
709
-     *    @type string $geodir_article_open_class Geodir article open html class.
710
-     *    @type string $geodir_article_open_replace Geodir article open content replace.
711
-     *    @type string $geodir_article_close_replace Geodir article close content replace.
712
-     *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
-     *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
-     *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
-     *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
-     *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
-     *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
-     *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
-     *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
-     *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
-     *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
-     *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
-     *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
-     *    @type string $geodir_top_content_add Geodir top content add.
725
-     *    @type string $geodir_before_main_content_add Geodir before main content add.
726
-     *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
-     *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
-     *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
-     *    @type string $geodir_before_title_filter Geodir before title filter.
730
-     *    @type string $geodir_after_title_filter Geodir after title filter.
731
-     *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
-     *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
-     *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
-     *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
-     *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
-     *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
-     *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
-     *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
-     *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
-     *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
-     *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
-     *    @type string $gd_theme_compat Gd theme compatibility.
743
-     *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
-     *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
-     *
746
-     * }
747
-     */
748
-    do_action('gd_compat_save_settings', $theme_settings);
675
+	$theme_settings['geodir_theme_compat_code'] = false;
676
+
677
+	$theme = wp_get_theme();
678
+
679
+	if ($theme->parent()) {
680
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
+	} else {
682
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
683
+	}
684
+
685
+	if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
+		$theme_settings['geodir_theme_compat_code'] = $theme_name;
687
+	}
688
+
689
+
690
+	$theme_name = $theme_name . "_custom";
691
+	$theme_arr = get_option('gd_theme_compats');
692
+	update_option('gd_theme_compat', $theme_name);
693
+	/**
694
+	 * Called before the theme compatibility settings are saved to the DB.
695
+	 *
696
+	 * @since 1.4.0
697
+	 * @param array $theme_settings {
698
+	 *    Attributes of the theme compatibility settings array.
699
+	 *
700
+	 *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
+	 *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
+	 *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
+	 *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
+	 *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
+	 *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
+	 *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
+	 *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
+	 *    @type string $geodir_article_open_id Geodir article open html id.
709
+	 *    @type string $geodir_article_open_class Geodir article open html class.
710
+	 *    @type string $geodir_article_open_replace Geodir article open content replace.
711
+	 *    @type string $geodir_article_close_replace Geodir article close content replace.
712
+	 *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
+	 *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
+	 *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
+	 *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
+	 *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
+	 *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
+	 *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
+	 *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
+	 *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
+	 *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
+	 *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
+	 *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
+	 *    @type string $geodir_top_content_add Geodir top content add.
725
+	 *    @type string $geodir_before_main_content_add Geodir before main content add.
726
+	 *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
+	 *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
+	 *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
+	 *    @type string $geodir_before_title_filter Geodir before title filter.
730
+	 *    @type string $geodir_after_title_filter Geodir after title filter.
731
+	 *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
+	 *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
+	 *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
+	 *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
+	 *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
+	 *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
+	 *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
+	 *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
+	 *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
+	 *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
+	 *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
+	 *    @type string $gd_theme_compat Gd theme compatibility.
743
+	 *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
+	 *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
+	 *
746
+	 * }
747
+	 */
748
+	do_action('gd_compat_save_settings', $theme_settings);
749 749
 
750 750
 //if($_POST['gd_theme_compat'])==
751
-    $theme_arr[$theme_name] = $theme_settings;
752
-    update_option('gd_theme_compats', $theme_arr);
751
+	$theme_arr[$theme_name] = $theme_settings;
752
+	update_option('gd_theme_compats', $theme_arr);
753 753
 
754 754
 
755 755
 //print_r($theme_settings);exit;
756
-    update_option('theme_compatibility_setting', $theme_settings);
756
+	update_option('theme_compatibility_setting', $theme_settings);
757 757
 
758 758
 }
759 759
 
@@ -766,12 +766,12 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function geodir_theme_compatibility_setting_page()
768 768
 {
769
-    global $wpdb;
770
-    $tc = get_option('theme_compatibility_setting');
771
-    //print_r($tc);
772
-    //print_r(wp_get_theme());
769
+	global $wpdb;
770
+	$tc = get_option('theme_compatibility_setting');
771
+	//print_r($tc);
772
+	//print_r(wp_get_theme());
773 773
 
774
-    ?>
774
+	?>
775 775
     <div class="inner_content_tab_main">
776 776
         <div class="gd-content-heading">
777 777
 
@@ -813,21 +813,21 @@  discard block
 block discarded – undo
813 813
                 <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814 814
                 <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
815 815
                 <?php
816
-                $theme_arr = get_option('gd_theme_compats');
817
-                $theme_active = get_option('gd_theme_compat');
818
-                if (is_array($theme_arr)) {
819
-                    foreach ($theme_arr as $key => $theme) {
820
-                        $sel = '';
821
-                        if ($theme_active == $key) {
822
-                            $sel = "selected";
823
-                        }
824
-                        echo "<option $sel>$key</option>";
825
-                    }
816
+				$theme_arr = get_option('gd_theme_compats');
817
+				$theme_active = get_option('gd_theme_compat');
818
+				if (is_array($theme_arr)) {
819
+					foreach ($theme_arr as $key => $theme) {
820
+						$sel = '';
821
+						if ($theme_active == $key) {
822
+							$sel = "selected";
823
+						}
824
+						echo "<option $sel>$key</option>";
825
+					}
826 826
 
827 827
 
828
-                }
828
+				}
829 829
 
830
-                ?>
830
+				?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833 833
                     class="button-primary"><?php _e('Export', 'geodirectory');?></button>
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
                         <small>geodir_wrapper_open</small>
937 937
                     </td>
938 938
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_id'])) {
939
-                            echo $tc['geodir_wrapper_open_id'];
940
-                        }?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
939
+							echo $tc['geodir_wrapper_open_id'];
940
+						}?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
941 941
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_class'])) {
942
-                            echo $tc['geodir_wrapper_open_class'];
943
-                        }?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
942
+							echo $tc['geodir_wrapper_open_class'];
943
+						}?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
944 944
                 </tr>
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
                         <span><?php _e('Output:', 'geodirectory');?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951
-                                echo $tc['geodir_wrapper_open_replace'];
952
-                            }?></textarea>
951
+								echo $tc['geodir_wrapper_open_replace'];
952
+							}?></textarea>
953 953
                     </td>
954 954
                 </tr>
955 955
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
                         <span><?php _e('Output:', 'geodirectory');?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972
-                                echo $tc['geodir_wrapper_close_replace'];
973
-                            }?></textarea>
972
+								echo $tc['geodir_wrapper_close_replace'];
973
+							}?></textarea>
974 974
                     </td>
975 975
                 </tr>
976 976
 
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
                         <small>geodir_wrapper_content_open</small>
981 981
                     </td>
982 982
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_id'])) {
983
-                            echo $tc['geodir_wrapper_content_open_id'];
984
-                        }?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
983
+							echo $tc['geodir_wrapper_content_open_id'];
984
+						}?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
985 985
                     </td>
986 986
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_class'])) {
987
-                            echo $tc['geodir_wrapper_content_open_class'];
988
-                        }?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
987
+							echo $tc['geodir_wrapper_content_open_class'];
988
+						}?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
989 989
                 </tr>
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
                         <span><?php _e('Output:', 'geodirectory');?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996
-                                echo $tc['geodir_wrapper_content_open_replace'];
997
-                            }?></textarea>
996
+								echo $tc['geodir_wrapper_content_open_replace'];
997
+							}?></textarea>
998 998
                     </td>
999 999
                 </tr>
1000 1000
 
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
                         <span><?php _e('Output:', 'geodirectory');?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017
-                                echo $tc['geodir_wrapper_content_close_replace'];
1018
-                            }?></textarea>
1017
+								echo $tc['geodir_wrapper_content_close_replace'];
1018
+							}?></textarea>
1019 1019
                     </td>
1020 1020
                 </tr>
1021 1021
 
@@ -1024,11 +1024,11 @@  discard block
 block discarded – undo
1024 1024
                         <small>geodir_article_open</small>
1025 1025
                     </td>
1026 1026
                     <td><input value="<?php if (isset($tc['geodir_article_open_id'])) {
1027
-                            echo $tc['geodir_article_open_id'];
1028
-                        }?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1027
+							echo $tc['geodir_article_open_id'];
1028
+						}?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1029 1029
                     <td><input value="<?php if (isset($tc['geodir_article_open_class'])) {
1030
-                            echo $tc['geodir_article_open_class'];
1031
-                        }?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1030
+							echo $tc['geodir_article_open_class'];
1031
+						}?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1032 1032
                 </tr>
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
                         <span><?php _e('Output:', 'geodirectory');?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039
-                                echo $tc['geodir_article_open_replace'];
1040
-                            }?></textarea>
1039
+								echo $tc['geodir_article_open_replace'];
1040
+							}?></textarea>
1041 1041
                     </td>
1042 1042
                 </tr>
1043 1043
 
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
                         <span><?php _e('Output:', 'geodirectory');?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059
-                                echo $tc['geodir_article_close_replace'];
1060
-                            }?></textarea>
1059
+								echo $tc['geodir_article_close_replace'];
1060
+							}?></textarea>
1061 1061
                     </td>
1062 1062
                 </tr>
1063 1063
 
@@ -1066,11 +1066,11 @@  discard block
 block discarded – undo
1066 1066
                         <small>geodir_sidebar_right_open</small>
1067 1067
                     </td>
1068 1068
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_id'])) {
1069
-                            echo $tc['geodir_sidebar_right_open_id'];
1070
-                        }?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1069
+							echo $tc['geodir_sidebar_right_open_id'];
1070
+						}?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1071 1071
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_class'])) {
1072
-                            echo $tc['geodir_sidebar_right_open_class'];
1073
-                        }?>" type="text" name="geodir_sidebar_right_open_class"
1072
+							echo $tc['geodir_sidebar_right_open_class'];
1073
+						}?>" type="text" name="geodir_sidebar_right_open_class"
1074 1074
                                placeholder="geodir-sidebar-right geodir-listings-sidebar-right"/></td>
1075 1075
                 </tr>
1076 1076
 
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
                         <span><?php _e('Output:', 'geodirectory');?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082
-                                echo $tc['geodir_sidebar_right_open_replace'];
1083
-                            }?></textarea>
1082
+								echo $tc['geodir_sidebar_right_open_replace'];
1083
+							}?></textarea>
1084 1084
                     </td>
1085 1085
                 </tr>
1086 1086
 
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
                         <span><?php _e('Output:', 'geodirectory');?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102
-                                echo $tc['geodir_sidebar_right_close_replace'];
1103
-                            }?></textarea>
1102
+								echo $tc['geodir_sidebar_right_close_replace'];
1103
+							}?></textarea>
1104 1104
                     </td>
1105 1105
                 </tr>
1106 1106
 
@@ -1110,11 +1110,11 @@  discard block
 block discarded – undo
1110 1110
                         <small>geodir_sidebar_left_open</small>
1111 1111
                     </td>
1112 1112
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_id'])) {
1113
-                            echo $tc['geodir_sidebar_left_open_id'];
1114
-                        }?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1113
+							echo $tc['geodir_sidebar_left_open_id'];
1114
+						}?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1115 1115
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_class'])) {
1116
-                            echo $tc['geodir_sidebar_left_open_class'];
1117
-                        }?>" type="text" name="geodir_sidebar_left_open_class"
1116
+							echo $tc['geodir_sidebar_left_open_class'];
1117
+						}?>" type="text" name="geodir_sidebar_left_open_class"
1118 1118
                                placeholder="geodir-sidebar-left geodir-listings-sidebar-left"/></td>
1119 1119
                 </tr>
1120 1120
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
                         <span><?php _e('Output:', 'geodirectory');?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126
-                                echo $tc['geodir_sidebar_left_open_replace'];
1127
-                            }?></textarea>
1126
+								echo $tc['geodir_sidebar_left_open_replace'];
1127
+							}?></textarea>
1128 1128
                     </td>
1129 1129
                 </tr>
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
                         <span><?php _e('Output:', 'geodirectory');?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146
-                                echo $tc['geodir_sidebar_left_close_replace'];
1147
-                            }?></textarea>
1146
+								echo $tc['geodir_sidebar_left_close_replace'];
1147
+							}?></textarea>
1148 1148
                     </td>
1149 1149
                 </tr>
1150 1150
 
@@ -1153,11 +1153,11 @@  discard block
 block discarded – undo
1153 1153
                         <small>geodir_main_content_open</small>
1154 1154
                     </td>
1155 1155
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_id'])) {
1156
-                            echo $tc['geodir_main_content_open_id'];
1157
-                        }?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1156
+							echo $tc['geodir_main_content_open_id'];
1157
+						}?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1158 1158
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_class'])) {
1159
-                            echo $tc['geodir_main_content_open_class'];
1160
-                        }?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1159
+							echo $tc['geodir_main_content_open_class'];
1160
+						}?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1161 1161
                 </tr>
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
                         <span><?php _e('Output:', 'geodirectory');?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168
-                                echo $tc['geodir_main_content_open_replace'];
1169
-                            }?></textarea>
1168
+								echo $tc['geodir_main_content_open_replace'];
1169
+							}?></textarea>
1170 1170
                     </td>
1171 1171
                 </tr>
1172 1172
 
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
                         <span><?php _e('Output:', 'geodirectory');?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188
-                                echo $tc['geodir_main_content_close_replace'];
1189
-                            }?></textarea>
1188
+								echo $tc['geodir_main_content_close_replace'];
1189
+							}?></textarea>
1190 1190
                     </td>
1191 1191
                 </tr>
1192 1192
 
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
                     </td>
1211 1211
                     <td><textarea name="geodir_top_content_add"
1212 1212
                                   placeholder=''><?php if (isset($tc['geodir_top_content_add'])) {
1213
-                                echo $tc['geodir_top_content_add'];
1214
-                            }?></textarea></td>
1213
+								echo $tc['geodir_top_content_add'];
1214
+							}?></textarea></td>
1215 1215
                 </tr>
1216 1216
 
1217 1217
                 <tr>
@@ -1220,8 +1220,8 @@  discard block
 block discarded – undo
1220 1220
                     </td>
1221 1221
                     <td><textarea name="geodir_before_main_content_add"
1222 1222
                                   placeholder=''><?php if (isset($tc['geodir_before_main_content_add'])) {
1223
-                                echo $tc['geodir_before_main_content_add'];
1224
-                            }?></textarea></td>
1223
+								echo $tc['geodir_before_main_content_add'];
1224
+							}?></textarea></td>
1225 1225
                 </tr>
1226 1226
 
1227 1227
 
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
                     </td>
1245 1245
                     <td><textarea name="geodir_full_page_class_filter"
1246 1246
                                   placeholder='geodir_full_page clearfix'><?php if (isset($tc['geodir_full_page_class_filter'])) {
1247
-                                echo $tc['geodir_full_page_class_filter'];
1248
-                            }?></textarea></td>
1247
+								echo $tc['geodir_full_page_class_filter'];
1248
+							}?></textarea></td>
1249 1249
                 </tr>
1250 1250
 
1251 1251
                 <tr>
@@ -1254,8 +1254,8 @@  discard block
 block discarded – undo
1254 1254
                     </td>
1255 1255
                     <td><textarea name="geodir_before_widget_filter"
1256 1256
                                   placeholder='<section id="%1$s" class="widget geodir-widget %2$s">'><?php if (isset($tc['geodir_before_widget_filter'])) {
1257
-                                echo $tc['geodir_before_widget_filter'];
1258
-                            }?></textarea></td>
1257
+								echo $tc['geodir_before_widget_filter'];
1258
+							}?></textarea></td>
1259 1259
                 </tr>
1260 1260
 
1261 1261
                 <tr>
@@ -1264,8 +1264,8 @@  discard block
 block discarded – undo
1264 1264
                     </td>
1265 1265
                     <td><textarea name="geodir_after_widget_filter"
1266 1266
                                   placeholder='</section>'><?php if (isset($tc['geodir_after_widget_filter'])) {
1267
-                                echo $tc['geodir_after_widget_filter'];
1268
-                            }?></textarea></td>
1267
+								echo $tc['geodir_after_widget_filter'];
1268
+							}?></textarea></td>
1269 1269
                 </tr>
1270 1270
 
1271 1271
                 <tr>
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
                     </td>
1275 1275
                     <td><textarea name="geodir_before_title_filter"
1276 1276
                                   placeholder='<h3 class="widget-title">'><?php if (isset($tc['geodir_before_title_filter'])) {
1277
-                                echo $tc['geodir_before_title_filter'];
1278
-                            }?></textarea></td>
1277
+								echo $tc['geodir_before_title_filter'];
1278
+							}?></textarea></td>
1279 1279
                 </tr>
1280 1280
 
1281 1281
                 <tr>
@@ -1284,8 +1284,8 @@  discard block
 block discarded – undo
1284 1284
                     </td>
1285 1285
                     <td><textarea name="geodir_after_title_filter"
1286 1286
                                   placeholder='</h3>'><?php if (isset($tc['geodir_after_title_filter'])) {
1287
-                                echo $tc['geodir_after_title_filter'];
1288
-                            }?></textarea></td>
1287
+								echo $tc['geodir_after_title_filter'];
1288
+							}?></textarea></td>
1289 1289
                 </tr>
1290 1290
 
1291 1291
                 <tr>
@@ -1294,8 +1294,8 @@  discard block
 block discarded – undo
1294 1294
                     </td>
1295 1295
                     <td><textarea name="geodir_menu_li_class_filter"
1296 1296
                                   placeholder='menu-item'><?php if (isset($tc['geodir_menu_li_class_filter'])) {
1297
-                                echo $tc['geodir_menu_li_class_filter'];
1298
-                            }?></textarea></td>
1297
+								echo $tc['geodir_menu_li_class_filter'];
1298
+							}?></textarea></td>
1299 1299
                 </tr>
1300 1300
 
1301 1301
                 <tr>
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
                     </td>
1305 1305
                     <td><textarea name="geodir_sub_menu_ul_class_filter"
1306 1306
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_sub_menu_ul_class_filter'])) {
1307
-                                echo $tc['geodir_sub_menu_ul_class_filter'];
1308
-                            }?></textarea></td>
1307
+								echo $tc['geodir_sub_menu_ul_class_filter'];
1308
+							}?></textarea></td>
1309 1309
                 </tr>
1310 1310
 
1311 1311
                 <tr>
@@ -1314,8 +1314,8 @@  discard block
 block discarded – undo
1314 1314
                     </td>
1315 1315
                     <td><textarea name="geodir_sub_menu_li_class_filter"
1316 1316
                                   placeholder='menu-item'><?php if (isset($tc['geodir_sub_menu_li_class_filter'])) {
1317
-                                echo $tc['geodir_sub_menu_li_class_filter'];
1318
-                            }?></textarea></td>
1317
+								echo $tc['geodir_sub_menu_li_class_filter'];
1318
+							}?></textarea></td>
1319 1319
                 </tr>
1320 1320
 
1321 1321
                 <tr>
@@ -1324,8 +1324,8 @@  discard block
 block discarded – undo
1324 1324
                     </td>
1325 1325
                     <td><textarea name="geodir_menu_a_class_filter"
1326 1326
                                   placeholder=''><?php if (isset($tc['geodir_menu_a_class_filter'])) {
1327
-                                echo $tc['geodir_menu_a_class_filter'];
1328
-                            }?></textarea></td>
1327
+								echo $tc['geodir_menu_a_class_filter'];
1328
+							}?></textarea></td>
1329 1329
                 </tr>
1330 1330
 
1331 1331
                 <tr>
@@ -1334,8 +1334,8 @@  discard block
 block discarded – undo
1334 1334
                     </td>
1335 1335
                     <td><textarea name="geodir_sub_menu_a_class_filter"
1336 1336
                                   placeholder=''><?php if (isset($tc['geodir_sub_menu_a_class_filter'])) {
1337
-                                echo $tc['geodir_sub_menu_a_class_filter'];
1338
-                            }?></textarea></td>
1337
+								echo $tc['geodir_sub_menu_a_class_filter'];
1338
+							}?></textarea></td>
1339 1339
                 </tr>
1340 1340
 
1341 1341
 
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
                     </td>
1346 1346
                     <td><textarea name="geodir_location_switcher_menu_li_class_filter"
1347 1347
                                   placeholder='menu-item menu-item-type-social menu-item-type-social gd-location-switcher'><?php if (isset($tc['geodir_location_switcher_menu_li_class_filter'])) {
1348
-                                echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
-                            }?></textarea></td>
1348
+								echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
+							}?></textarea></td>
1350 1350
                 </tr>
1351 1351
 
1352 1352
                 <tr>
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
                     </td>
1356 1356
                     <td><textarea name="geodir_location_switcher_menu_a_class_filter"
1357 1357
                                   placeholder=''><?php if (isset($tc['geodir_location_switcher_menu_a_class_filter'])) {
1358
-                                echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
-                            }?></textarea></td>
1358
+								echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
+							}?></textarea></td>
1360 1360
                 </tr>
1361 1361
 
1362 1362
                 <tr>
@@ -1365,8 +1365,8 @@  discard block
 block discarded – undo
1365 1365
                     </td>
1366 1366
                     <td><textarea name="geodir_location_switcher_menu_sub_ul_class_filter"
1367 1367
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
1368
-                                echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
-                            }?></textarea></td>
1368
+								echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
+							}?></textarea></td>
1370 1370
                 </tr>
1371 1371
 
1372 1372
                 <tr>
@@ -1375,21 +1375,21 @@  discard block
 block discarded – undo
1375 1375
                     </td>
1376 1376
                     <td><textarea name="geodir_location_switcher_menu_sub_li_class_filter"
1377 1377
                                   placeholder='menu-item gd-location-switcher-menu-item'><?php if (isset($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
1378
-                                echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
-                            }?></textarea></td>
1378
+								echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
+							}?></textarea></td>
1380 1380
                 </tr>
1381 1381
 
1382 1382
 
1383 1383
 
1384 1384
                 <?php
1385
-                /**
1386
-                 * Allows more filter setting to be added to theme compatibility settings page.
1387
-                 *
1388
-                 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
-                 *
1390
-                 * @since 1.4.0
1391
-                 */
1392
-                do_action('gd_compat_other_filters');?>
1385
+				/**
1386
+				 * Allows more filter setting to be added to theme compatibility settings page.
1387
+				 *
1388
+				 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
+				 *
1390
+				 * @since 1.4.0
1391
+				 */
1392
+				do_action('gd_compat_other_filters');?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
@@ -1402,8 +1402,8 @@  discard block
 block discarded – undo
1402 1402
                 <tr>
1403 1403
                     <td><textarea name="geodir_theme_compat_css"
1404 1404
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_css'])) {
1405
-                                echo $tc['geodir_theme_compat_css'];
1406
-                            }?></textarea></td>
1405
+								echo $tc['geodir_theme_compat_css'];
1406
+							}?></textarea></td>
1407 1407
                 </tr>
1408 1408
 
1409 1409
 
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
                 <tr>
1418 1418
                     <td><textarea name="geodir_theme_compat_js"
1419 1419
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_js'])) {
1420
-                                echo $tc['geodir_theme_compat_js'];
1421
-                            }?></textarea></td>
1420
+								echo $tc['geodir_theme_compat_js'];
1421
+							}?></textarea></td>
1422 1422
                 </tr>
1423 1423
 
1424 1424
 
@@ -1445,23 +1445,23 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function geodir_custom_post_type_form()
1447 1447
 {
1448
-    $listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1448
+	$listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1449 1449
 
1450
-    $sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1450
+	$sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1451 1451
 
1452 1452
 
1453
-    ?>
1453
+	?>
1454 1454
 
1455 1455
     <div class="gd-content-heading">
1456 1456
         <?php
1457
-        /**
1458
-         * Filter custom fields panel heading.
1459
-         *
1460
-         * @since 1.0.0
1461
-         * @param string $sub_tab Sub tab name.
1462
-         * @param string $listing_type Post type.
1463
-         */
1464
-        ?>
1457
+		/**
1458
+		 * Filter custom fields panel heading.
1459
+		 *
1460
+		 * @since 1.0.0
1461
+		 * @param string $sub_tab Sub tab name.
1462
+		 * @param string $listing_type Post type.
1463
+		 */
1464
+		?>
1465 1465
         <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
@@ -1469,25 +1469,25 @@  discard block
 block discarded – undo
1469 1469
 
1470 1470
             <div class="side-sortables" id="geodir-available-fields">
1471 1471
                 <?php
1472
-                /**
1473
-                 * Filter custom field available fields heading.
1474
-                 *
1475
-                 * @since 1.0.0
1476
-                 * @param string $sub_tab Sub tab name.
1477
-                 * @param string $listing_type Post type.
1478
-                 */
1479
-                ?>
1472
+				/**
1473
+				 * Filter custom field available fields heading.
1474
+				 *
1475
+				 * @since 1.0.0
1476
+				 * @param string $sub_tab Sub tab name.
1477
+				 * @param string $listing_type Post type.
1478
+				 */
1479
+				?>
1480 1480
                 <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483
-                /**
1484
-                 * Filter custom field available fields note text.
1485
-                 *
1486
-                 * @since 1.0.0
1487
-                 * @param string $sub_tab Sub tab name.
1488
-                 * @param string $listing_type Post type.
1489
-                 */
1490
-                ?>
1483
+				/**
1484
+				 * Filter custom field available fields note text.
1485
+				 *
1486
+				 * @since 1.0.0
1487
+				 * @param string $sub_tab Sub tab name.
1488
+				 * @param string $listing_type Post type.
1489
+				 */
1490
+				?>
1491 1491
                 <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1492 1492
 
1493 1493
                 <div class="inside">
@@ -1495,13 +1495,13 @@  discard block
 block discarded – undo
1495 1495
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1496 1496
 
1497 1497
                         <?php
1498
-                        /**
1499
-                         * Adds the available fields to the custom fields settings page per post type.
1500
-                         *
1501
-                         * @since 1.0.0
1502
-                         * @param string $sub_tab The current settings tab name.
1503
-                         */
1504
-                        do_action('geodir_manage_available_fields', $sub_tab); ?>
1498
+						/**
1499
+						 * Adds the available fields to the custom fields settings page per post type.
1500
+						 *
1501
+						 * @since 1.0.0
1502
+						 * @param string $sub_tab The current settings tab name.
1503
+						 */
1504
+						do_action('geodir_manage_available_fields', $sub_tab); ?>
1505 1505
 
1506 1506
                         <div style="clear:both"></div>
1507 1507
                     </div>
@@ -1514,25 +1514,25 @@  discard block
 block discarded – undo
1514 1514
             <div class="side-sortables" id="geodir-selected-fields">
1515 1515
                 <h3 class="hndle">
1516 1516
                     <?php
1517
-                    /**
1518
-                     * Filter custom field selected fields heading.
1519
-                     *
1520
-                     * @since 1.0.0
1521
-                     * @param string $sub_tab Sub tab name.
1522
-                     * @param string $listing_type Post type.
1523
-                     */
1524
-                    ?>
1517
+					/**
1518
+					 * Filter custom field selected fields heading.
1519
+					 *
1520
+					 * @since 1.0.0
1521
+					 * @param string $sub_tab Sub tab name.
1522
+					 * @param string $listing_type Post type.
1523
+					 */
1524
+					?>
1525 1525
                     <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1526 1526
                 </h3>
1527 1527
                 <?php
1528
-                /**
1529
-                 * Filter custom field selected fields note text.
1530
-                 *
1531
-                 * @since 1.0.0
1532
-                 * @param string $sub_tab Sub tab name.
1533
-                 * @param string $listing_type Post type.
1534
-                 */
1535
-                ?>
1528
+				/**
1529
+				 * Filter custom field selected fields note text.
1530
+				 *
1531
+				 * @since 1.0.0
1532
+				 * @param string $sub_tab Sub tab name.
1533
+				 * @param string $listing_type Post type.
1534
+				 */
1535
+				?>
1536 1536
                 <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1537 1537
 
1538 1538
                 <div class="inside">
@@ -1540,13 +1540,13 @@  discard block
 block discarded – undo
1540 1540
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1541 1541
                         <div class="field_row_main">
1542 1542
                             <?php
1543
-                            /**
1544
-                             * Adds the selected fields and setting to the custom fields settings page per post type.
1545
-                             *
1546
-                             * @since 1.0.0
1547
-                             * @param string $sub_tab The current settings tab name.
1548
-                             */
1549
-                            do_action('geodir_manage_selected_fields', $sub_tab); ?>
1543
+							/**
1544
+							 * Adds the selected fields and setting to the custom fields settings page per post type.
1545
+							 *
1546
+							 * @since 1.0.0
1547
+							 * @param string $sub_tab The current settings tab name.
1548
+							 */
1549
+							do_action('geodir_manage_selected_fields', $sub_tab); ?>
1550 1550
                         </div>
1551 1551
                         <div style="clear:both"></div>
1552 1552
                     </div>
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
  */
1570 1570
 function geodir_diagnostic_tools_setting_page()
1571 1571
 {
1572
-    ?>
1572
+	?>
1573 1573
     <div class="inner_content_tab_main">
1574 1574
         <div class="gd-content-heading">
1575 1575
 
@@ -1671,13 +1671,13 @@  discard block
 block discarded – undo
1671 1671
 					</td>
1672 1672
 				</tr>
1673 1673
                 <?php
1674
-                /**
1675
-                 * Allows you to add more setting to the GD>Tools settings page.
1676
-                 *
1677
-                 * Called after the last setting on the GD>Tools page.
1678
-                 * @since 1.0.0
1679
-                 */
1680
-                do_action('geodir_diagnostic_tool');?>
1674
+				/**
1675
+				 * Allows you to add more setting to the GD>Tools settings page.
1676
+				 *
1677
+				 * Called after the last setting on the GD>Tools page.
1678
+				 * @since 1.0.0
1679
+				 */
1680
+				do_action('geodir_diagnostic_tool');?>
1681 1681
 
1682 1682
                 </tbody>
1683 1683
             </table>
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 2 patches
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,23 +35,26 @@  discard block
 block discarded – undo
35 35
 
36 36
 /* ---- Delete field ---- */
37 37
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
38
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
39
-        return;
38
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
39
+            return;
40
+    }
40 41
     
41 42
     echo geodir_custom_field_delete($field_id);
42 43
 }
43 44
 
44 45
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
45
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
46
-        return;
46
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
47
+            return;
48
+    }
47 49
     
48 50
     echo geodir_custom_sort_field_delete($field_id);
49 51
 }
50 52
 
51 53
 /* ---- Save field  ---- */
52 54
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
53
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
54
-        return;
55
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
56
+            return;
57
+    }
55 58
 
56 59
     foreach ($_REQUEST as $pkey => $pval) {
57 60
         if (is_array($_REQUEST[$pkey])) {
@@ -77,8 +80,9 @@  discard block
 block discarded – undo
77 80
 
78 81
 /* ---- Save sort field  ---- */
79 82
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
80
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
81
-        return;
83
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
84
+            return;
85
+    }
82 86
 
83 87
     foreach ($_REQUEST as $pkey => $pval) {
84 88
         if (is_array($_REQUEST[$pkey])) {
Please login to merge, or discard this patch.
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Creates custom fields
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Creates custom fields
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 $data_type = isset($_REQUEST['data_type']) ? sanitize_text_field($_REQUEST['data_type']) : '';
10 10
 $field_type = isset($_REQUEST['field_type']) ? sanitize_text_field($_REQUEST['field_type']) : '';
@@ -15,95 +15,95 @@  discard block
 block discarded – undo
15 15
 
16 16
 $field_ids = array();
17 17
 if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) {
18
-    foreach ($_REQUEST['licontainer'] as $lic_id) {
19
-        $field_ids[] = sanitize_text_field($lic_id);
20
-    }
18
+	foreach ($_REQUEST['licontainer'] as $lic_id) {
19
+		$field_ids[] = sanitize_text_field($lic_id);
20
+	}
21 21
 }
22 22
 
23 23
 /* ------- check nonce field ------- */
24 24
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
25
-    echo godir_set_field_order($field_ids);
25
+	echo godir_set_field_order($field_ids);
26 26
 }
27 27
 
28 28
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
29
-    echo godir_set_sort_field_order($field_ids);
29
+	echo godir_set_sort_field_order($field_ids);
30 30
 }
31 31
 
32 32
 /* ---- Show field form in admin ---- */
33 33
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
34
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action);
34
+	geodir_custom_field_adminhtml($field_type, $field_id, $field_action);
35 35
 }
36 36
 
37 37
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
38
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action);
38
+	geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action);
39 39
 }
40 40
 
41 41
 /* ---- Delete field ---- */
42 42
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
43
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
44
-        return;
43
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
44
+		return;
45 45
     
46
-    echo geodir_custom_field_delete($field_id);
46
+	echo geodir_custom_field_delete($field_id);
47 47
 }
48 48
 
49 49
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
50
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
51
-        return;
50
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
51
+		return;
52 52
     
53
-    echo geodir_custom_sort_field_delete($field_id);
53
+	echo geodir_custom_sort_field_delete($field_id);
54 54
 }
55 55
 
56 56
 /* ---- Save field  ---- */
57 57
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
58
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
59
-        return;
60
-
61
-    foreach ($_REQUEST as $pkey => $pval) {
62
-        if (is_array($_REQUEST[$pkey])) {
63
-            $tags = 'skip_field';
64
-        } else {
65
-            $tags = '';
66
-        }
67
-
68
-        if ($tags != 'skip_field') {
69
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
70
-        }
71
-    }
72
-
73
-    $return = geodir_custom_field_save($_REQUEST);
74
-
75
-    if (is_int($return)) {
76
-        $lastid = $return;
77
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
78
-    } else {
79
-        echo $return;
80
-    }
58
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
59
+		return;
60
+
61
+	foreach ($_REQUEST as $pkey => $pval) {
62
+		if (is_array($_REQUEST[$pkey])) {
63
+			$tags = 'skip_field';
64
+		} else {
65
+			$tags = '';
66
+		}
67
+
68
+		if ($tags != 'skip_field') {
69
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
70
+		}
71
+	}
72
+
73
+	$return = geodir_custom_field_save($_REQUEST);
74
+
75
+	if (is_int($return)) {
76
+		$lastid = $return;
77
+		geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
78
+	} else {
79
+		echo $return;
80
+	}
81 81
 }
82 82
 
83 83
 /* ---- Save sort field  ---- */
84 84
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
85
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
86
-        return;
87
-
88
-    foreach ($_REQUEST as $pkey => $pval) {
89
-        if (is_array($_REQUEST[$pkey])) {
90
-            $tags = 'skip_field';
91
-        } else {
92
-            $tags = '';
93
-        }
94
-
95
-        if ($tags != 'skip_field') {
96
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
97
-        }
98
-    }
99
-
100
-    $return = geodir_custom_sort_field_save($_REQUEST);
101
-
102
-    if (is_int($return)) {
103
-        $lastid = $return;
104
-        $default = false;
105
-        geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
106
-    } else {
107
-        echo $return;
108
-    }
85
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
86
+		return;
87
+
88
+	foreach ($_REQUEST as $pkey => $pval) {
89
+		if (is_array($_REQUEST[$pkey])) {
90
+			$tags = 'skip_field';
91
+		} else {
92
+			$tags = '';
93
+		}
94
+
95
+		if ($tags != 'skip_field') {
96
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
97
+		}
98
+	}
99
+
100
+	$return = geodir_custom_sort_field_save($_REQUEST);
101
+
102
+	if (is_int($return)) {
103
+		$lastid = $return;
104
+		$default = false;
105
+		geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
106
+	} else {
107
+		echo $return;
108
+	}
109 109
 }
110 110
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_template_tags.php 3 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 {
38 38
     $is_detail_page = false;
39 39
 
40
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
40
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
41 41
         $is_detail_page = true;
42 42
     }
43 43
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         'siteurl' => get_option('siteurl'),
52 52
         'geodir_plugin_url' => geodir_plugin_url(),
53 53
         'geodir_ajax_url' => geodir_get_ajax_url(),
54
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
54
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
55 55
         'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56 56
     );
57 57
 
@@ -72,25 +72,25 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * }
74 74
      */
75
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
75
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
76 76
 
77 77
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78 78
 
79 79
 
80 80
 
81 81
 
82
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
83
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
83
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
84 84
 
85 85
 
86 86
 
87
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
87
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
88 88
     wp_enqueue_script('geodirectory-lightbox-jquery');
89 89
 
90 90
 
91 91
 
92
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
93
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-simplemodal');}
92
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
93
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-simplemodal'); }
94 94
 
95 95
 
96 96
     //if( get_option('geodir_enqueue_google_api_script')==1)
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             wp_enqueue_script( 'geodirectory-googlemap-script' );
112 112
            }
113 113
         */
114
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
114
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
115 115
     wp_enqueue_script('geodirectory-goMap-script');
116 116
 
117 117
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         wp_enqueue_script('plupload-all');
134 134
         wp_enqueue_script('jquery-ui-sortable');
135 135
 
136
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
136
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
137 137
         wp_enqueue_script('geodirectory-plupload-script');
138 138
 
139 139
         // SCRIPT FOR UPLOAD END
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_add_async_forscript($url)
247 247
 {
248
-    if (strpos($url, '#asyncload')===false)
248
+    if (strpos($url, '#asyncload') === false)
249 249
         return $url;
250 250
     else if (is_admin())
251 251
         return str_replace('#asyncload', '', $url);
252 252
     else
253
-        return str_replace('#asyncload', '', $url)."' async='async";
253
+        return str_replace('#asyncload', '', $url) . "' async='async";
254 254
 }
255 255
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
256 256
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 {
265 265
 
266 266
 
267
-    if(get_option('geodir_scss_core')) {
267
+    if (get_option('geodir_scss_core')) {
268 268
 
269 269
 
270 270
         wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
299 299
         wp_enqueue_style('geodir-chosen-style');
300 300
 
301
-    }else{
301
+    } else {
302 302
         wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
303 303
         wp_enqueue_style('geodir-core-scss');
304 304
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
     }
308 308
 
309
-    if(is_rtl()){
309
+    if (is_rtl()) {
310 310
     wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
311 311
     wp_enqueue_style('geodirectory-frontend-rtl-style');
312 312
     }
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         if ($max_page > 1 || $always_show) {
379 379
 			// Extra pagination info
380 380
 			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
381
-			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
381
+			$start_no = ($paged - 1) * $posts_per_page + 1;
382 382
 			$end_no = min($paged * $posts_per_page, $numposts);
383 383
 			
384 384
 			if ($geodir_pagination_more_info != '') {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         jQuery(function ($) {
446 446
             $("#distance_slider").slider({
447 447
                 range: true,
448
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
448
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
449 449
                 min: 0,
450 450
                 max: <?php echo $dist; ?>,
451 451
                 step: <?php echo $dist_dif; ?>,
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 
511 511
 
512 512
     <script type="text/javascript">
513
-        var default_location = '<?php if($search_location = geodir_get_default_location())  echo $search_location->city ;?>';
513
+        var default_location = '<?php if ($search_location = geodir_get_default_location())  echo $search_location->city; ?>';
514 514
         var latlng;
515 515
         var Sgeocoder;
516 516
         var address;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 				var $form = jQuery(this).closest('form');
524 524
 				
525 525
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
526
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
526
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
527 527
 				
528 528
 				// Disable location based search for disabled location post type.
529 529
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 					}
538 538
 				}
539 539
 				
540
-				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
540
+				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
541 541
 					geodir_setsearch($form);
542 542
 				} else {
543 543
 					jQuery(".snear", $form).val('');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		});
558 558
         
559 559
 		function geodir_setsearch($form) {
560
-			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
560
+			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
561 561
 			geocodeAddress($form);
562 562
 		}
563 563
 
@@ -570,8 +570,8 @@  discard block
 block discarded – undo
570 570
         function geocodeAddress($form) {
571 571
             Sgeocoder = new google.maps.Geocoder(); // Call the geocode function
572 572
 
573
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
574
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
573
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
574
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
575 575
                     jQuery(".snear", $form).val('');
576 576
                 }
577 577
                 jQuery($form).submit();
@@ -579,24 +579,24 @@  discard block
 block discarded – undo
579 579
 
580 580
                 var address = jQuery(".snear", $form).val();
581 581
 
582
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
582
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
583 583
                     initialise2();
584 584
                 } else {
585 585
 
586 586
                     Sgeocoder.geocode({'address': address<?php
587
-                    if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
588
-                    if($near_add2 =
587
+                    if ($near_add = get_option('geodir_search_near_addition')) {echo '+", ' . $near_add . '"'; }
588
+                    if ($near_add2 =
589 589
                     /**
590 590
                      * Adds any extra info to the near search box query when trying to geolocate it via google api.
591 591
                      *
592 592
                      * @since 1.0.0
593 593
                      */
594
-                    apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
594
+                    apply_filters('geodir_search_near_addition', '')) {echo $near_add2; }//gt_advanced_near_search();?>},
595 595
                         function (results, status) {
596 596
                             if (status == google.maps.GeocoderStatus.OK) {
597 597
                                 updateSearchPosition(results[0].geometry.location, $form);
598 598
                             } else {
599
-                                alert("<?php _e('Search was not successful for the following reason:','geodirectory');?>" + status);
599
+                                alert("<?php _e('Search was not successful for the following reason:', 'geodirectory'); ?>" + status);
600 600
                             }
601 601
                         });
602 602
                 }
@@ -627,19 +627,19 @@  discard block
 block discarded – undo
627 627
             var msg;
628 628
             switch (err.code) {
629 629
                 case err.UNKNOWN_ERROR:
630
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
630
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
631 631
                     break;
632 632
                 case err.PERMISSION_DENINED:
633
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
633
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
634 634
                     break;
635 635
                 case err.POSITION_UNAVAILABLE:
636
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
636
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
637 637
                     break;
638 638
                 case err.BREAK:
639
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
639
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
640 640
                     break;
641 641
                 default:
642
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
642
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
643 643
             }
644 644
             jQuery('#info').html(msg);
645 645
         }
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
              * @param object $post The post object.
680 680
              * @param string $link The link to the post.
681 681
              */
682
-            return apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
682
+            return apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
683 683
             break;
684 684
         case 'new' :
685 685
             /**
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
              * @param object $post The post object.
690 690
              * @param string $link The link to the post.
691 691
              */
692
-            return apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
692
+            return apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
693 693
             break;
694 694
 
695 695
     }
Please login to merge, or discard this patch.
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function geodir_core_dequeue_script()
24 24
 {
25
-    wp_dequeue_script('flexslider');
25
+	wp_dequeue_script('flexslider');
26 26
 }
27 27
 
28 28
 add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100);
@@ -35,159 +35,159 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_templates_scripts()
37 37
 {
38
-    $is_detail_page = false;
38
+	$is_detail_page = false;
39 39
 
40
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
41
-        $is_detail_page = true;
42
-    }
40
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
41
+		$is_detail_page = true;
42
+	}
43 43
 
44
-    wp_enqueue_script('jquery');
44
+	wp_enqueue_script('jquery');
45 45
 
46
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
47
-    wp_enqueue_script('geodirectory-script');
46
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
47
+	wp_enqueue_script('geodirectory-script');
48 48
 
49 49
 
50
-    $geodir_vars_data = array(
51
-        'siteurl' => get_option('siteurl'),
52
-        'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_ajax_url' => geodir_get_ajax_url(),
54
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
55
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56
-    );
50
+	$geodir_vars_data = array(
51
+		'siteurl' => get_option('siteurl'),
52
+		'geodir_plugin_url' => geodir_plugin_url(),
53
+		'geodir_ajax_url' => geodir_get_ajax_url(),
54
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
55
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56
+	);
57 57
 
58
-    /**
59
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
60
-     *
61
-     * This is used by addons to add JS translatable variables.
62
-     *
63
-     * @since 1.4.4
64
-     * @param array $geodir_vars_data {
65
-     *    geodir var data used by addons to add JS translatable variables.
66
-     *
67
-     *    @type string $siteurl Site url.
68
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
69
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
70
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
71
-     *    @type int $is_rtl Checks if current locale is RTL.
72
-     *
73
-     * }
74
-     */
75
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
58
+	/**
59
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
60
+	 *
61
+	 * This is used by addons to add JS translatable variables.
62
+	 *
63
+	 * @since 1.4.4
64
+	 * @param array $geodir_vars_data {
65
+	 *    geodir var data used by addons to add JS translatable variables.
66
+	 *
67
+	 *    @type string $siteurl Site url.
68
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
69
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
70
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
71
+	 *    @type int $is_rtl Checks if current locale is RTL.
72
+	 *
73
+	 * }
74
+	 */
75
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
76 76
 
77
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
77
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78 78
 
79 79
 
80 80
 
81 81
 
82
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
83
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
83
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
84 84
 
85 85
 
86 86
 
87
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
88
-    wp_enqueue_script('geodirectory-lightbox-jquery');
87
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
88
+	wp_enqueue_script('geodirectory-lightbox-jquery');
89 89
 
90 90
 
91 91
 
92
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
93
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-simplemodal');}
92
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
93
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-simplemodal');}
94 94
 
95 95
 
96
-    //if( get_option('geodir_enqueue_google_api_script')==1)
96
+	//if( get_option('geodir_enqueue_google_api_script')==1)
97 97
 
98
-    $map_lang = "&language=" . geodir_get_map_default_language();
99
-    /**
100
-     * Filter the variables that are added to the end of the google maps script call.
101
-     *
102
-     * This i used to change things like google maps language etc.
103
-     *
104
-     * @since 1.0.0
105
-     * @param string $var The string to filter, default is empty string.
106
-     */
107
-    $map_extra = apply_filters('geodir_googlemap_script_extra', '');
108
-    wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
109
-    /*	{
98
+	$map_lang = "&language=" . geodir_get_map_default_language();
99
+	/**
100
+	 * Filter the variables that are added to the end of the google maps script call.
101
+	 *
102
+	 * This i used to change things like google maps language etc.
103
+	 *
104
+	 * @since 1.0.0
105
+	 * @param string $var The string to filter, default is empty string.
106
+	 */
107
+	$map_extra = apply_filters('geodir_googlemap_script_extra', '');
108
+	wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
109
+	/*	{
110 110
             wp_register_script( 'geodirectory-googlemap-script', "//maps.google.com/maps/api/js?sensor=false&language=en" );
111 111
             wp_enqueue_script( 'geodirectory-googlemap-script' );
112 112
            }
113 113
         */
114
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
115
-    wp_enqueue_script('geodirectory-goMap-script');
114
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
115
+	wp_enqueue_script('geodirectory-goMap-script');
116 116
 
117 117
 
118
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
119
-    wp_enqueue_script('chosen');
118
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
119
+	wp_enqueue_script('chosen');
120 120
 
121
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
122
-    wp_enqueue_script('geodirectory-choose-ajax');
121
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
122
+	wp_enqueue_script('geodirectory-choose-ajax');
123 123
 
124
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
124
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
125 125
 
126 126
 
127
-    if (is_page() && geodir_is_page('add-listing')) {
127
+	if (is_page() && geodir_is_page('add-listing')) {
128 128
 
129 129
 
130 130
 
131 131
 
132
-        // SCRIPT FOR UPLOAD
133
-        wp_enqueue_script('plupload-all');
134
-        wp_enqueue_script('jquery-ui-sortable');
132
+		// SCRIPT FOR UPLOAD
133
+		wp_enqueue_script('plupload-all');
134
+		wp_enqueue_script('jquery-ui-sortable');
135 135
 
136
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
137
-        wp_enqueue_script('geodirectory-plupload-script');
136
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
137
+		wp_enqueue_script('geodirectory-plupload-script');
138 138
 
139
-        // SCRIPT FOR UPLOAD END
139
+		// SCRIPT FOR UPLOAD END
140 140
 
141
-        // 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
142
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
143
-            $ajax_url = admin_url('admin-ajax.php');
144
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
145
-            $ajax_url = admin_url('admin-ajax.php');
146
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
147
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
148
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
149
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
150
-        }
141
+		// 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
142
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
143
+			$ajax_url = admin_url('admin-ajax.php');
144
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
145
+			$ajax_url = admin_url('admin-ajax.php');
146
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
147
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
148
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
149
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
150
+		}
151 151
 
152
-        // place js config array for plupload
153
-        $plupload_init = array(
154
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
155
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
156
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
157
-            'drop_element' => 'dropbox', // will be adjusted per uploader
158
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
159
-            'multiple_queues' => true,
160
-            'max_file_size' => geodir_max_upload_size(),
161
-            'url' => $ajax_url,
162
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
163
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
164
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
165
-            'multipart' => true,
166
-            'urlstream_upload' => true,
167
-            'multi_selection' => false, // will be added per uploader
168
-            // additional post data to send to our ajax hook
169
-            'multipart_params' => array(
170
-                '_ajax_nonce' => "", // will be added per uploader
171
-                'action' => 'plupload_action', // the ajax action name
172
-                'imgid' => 0 // will be added per uploader
173
-            )
174
-        );
175
-        $base_plupload_config = json_encode($plupload_init);
176
-
177
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
178
-            'upload_img_size' => geodir_max_upload_size());
179
-
180
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
181
-
182
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
183
-    } // End if for add place page
184
-
185
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
186
-    if ($is_detail_page) {
152
+		// place js config array for plupload
153
+		$plupload_init = array(
154
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
155
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
156
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
157
+			'drop_element' => 'dropbox', // will be adjusted per uploader
158
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
159
+			'multiple_queues' => true,
160
+			'max_file_size' => geodir_max_upload_size(),
161
+			'url' => $ajax_url,
162
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
163
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
164
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
165
+			'multipart' => true,
166
+			'urlstream_upload' => true,
167
+			'multi_selection' => false, // will be added per uploader
168
+			// additional post data to send to our ajax hook
169
+			'multipart_params' => array(
170
+				'_ajax_nonce' => "", // will be added per uploader
171
+				'action' => 'plupload_action', // the ajax action name
172
+				'imgid' => 0 // will be added per uploader
173
+			)
174
+		);
175
+		$base_plupload_config = json_encode($plupload_init);
176
+
177
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
178
+			'upload_img_size' => geodir_max_upload_size());
179
+
180
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
181
+
182
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
183
+	} // End if for add place page
184
+
185
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
186
+	if ($is_detail_page) {
187 187
 		wp_enqueue_script('geodirectory-post-custom-js');
188 188
 	}
189 189
 
190
-    // font awesome rating script
190
+	// font awesome rating script
191 191
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
192 192
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
193 193
 		wp_enqueue_script('geodir-barrating-js');
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 		wp_enqueue_script('geodir-jRating-js');
197 197
 	}
198 198
 
199
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
200
-    wp_enqueue_script('geodir-on-document-load');
199
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
200
+	wp_enqueue_script('geodir-on-document-load');
201 201
 
202
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
-    wp_enqueue_script('google-geometa');
202
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
+	wp_enqueue_script('google-geometa');
204 204
 }
205 205
 
206 206
 /**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
  */
215 215
 function geodir_header_scripts()
216 216
 {
217
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
218
-    echo stripslashes(get_option('geodir_header_scripts'));
217
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
218
+	echo stripslashes(get_option('geodir_header_scripts'));
219 219
 }
220 220
 
221 221
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 function geodir_footer_scripts()
232 232
 {	
233 233
 	echo stripslashes(get_option('geodir_ga_tracking_code'));
234
-    echo stripslashes(get_option('geodir_footer_scripts'));
234
+	echo stripslashes(get_option('geodir_footer_scripts'));
235 235
 }
236 236
 
237 237
 
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_add_async_forscript($url)
247 247
 {
248
-    if (strpos($url, '#asyncload')===false)
249
-        return $url;
250
-    else if (is_admin())
251
-        return str_replace('#asyncload', '', $url);
252
-    else
253
-        return str_replace('#asyncload', '', $url)."' async='async";
248
+	if (strpos($url, '#asyncload')===false)
249
+		return $url;
250
+	else if (is_admin())
251
+		return str_replace('#asyncload', '', $url);
252
+	else
253
+		return str_replace('#asyncload', '', $url)."' async='async";
254 254
 }
255 255
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
256 256
 
@@ -264,55 +264,55 @@  discard block
 block discarded – undo
264 264
 {
265 265
 
266 266
 
267
-    if(get_option('geodir_scss_core')) {
267
+	if(get_option('geodir_scss_core')) {
268 268
 
269 269
 
270
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
271
-        wp_enqueue_style('geodirectory-frontend-style');
270
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
271
+		wp_enqueue_style('geodirectory-frontend-style');
272 272
 
273
-        wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
274
-        wp_enqueue_style('geodirectory-media-style');
273
+		wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
274
+		wp_enqueue_style('geodirectory-media-style');
275 275
 
276 276
 
277
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
278
-        wp_enqueue_style('geodirectory-jquery-ui-css');
277
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
278
+		wp_enqueue_style('geodirectory-jquery-ui-css');
279 279
 
280
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
281
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
280
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
281
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
282 282
 
283
-        wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
284
-        wp_enqueue_style('geodirectory-flexslider-css');
283
+		wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
284
+		wp_enqueue_style('geodirectory-flexslider-css');
285 285
 
286
-        wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
287
-        wp_enqueue_style('geodirectory-thic-box-css');
286
+		wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
287
+		wp_enqueue_style('geodirectory-thic-box-css');
288 288
 
289
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
290
-        wp_enqueue_style('geodirectory-pluplodar-css');
289
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
290
+		wp_enqueue_style('geodirectory-pluplodar-css');
291 291
 
292
-        wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
293
-        wp_enqueue_style('geodirectory-lightbox-css');
292
+		wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
293
+		wp_enqueue_style('geodirectory-lightbox-css');
294 294
 
295
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
296
-        wp_enqueue_style('geodir-rating-style');
295
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
296
+		wp_enqueue_style('geodir-rating-style');
297 297
 
298
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
299
-        wp_enqueue_style('geodir-chosen-style');
298
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
299
+		wp_enqueue_style('geodir-chosen-style');
300 300
 
301
-    }else{
302
-        wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
303
-        wp_enqueue_style('geodir-core-scss');
301
+	}else{
302
+		wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
303
+		wp_enqueue_style('geodir-core-scss');
304 304
 
305
-        wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
305
+		wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
306 306
 
307
-    }
307
+	}
308 308
 
309
-    if(is_rtl()){
310
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
311
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
312
-    }
309
+	if(is_rtl()){
310
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
311
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
312
+	}
313 313
 
314
-    wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
315
-    wp_enqueue_style('geodirectory-font-awesome');
314
+	wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
315
+	wp_enqueue_style('geodirectory-font-awesome');
316 316
 
317 317
 
318 318
 }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function geodir_get_sidebar()
328 328
 {
329
-    get_sidebar('geodirectory');
329
+	get_sidebar('geodirectory');
330 330
 }
331 331
 
332 332
 /**
@@ -347,35 +347,35 @@  discard block
 block discarded – undo
347 347
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false)
348 348
 {
349 349
 
350
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
350
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
351 351
 
352
-    if (empty($prelabel)) {
353
-        $prelabel = '<strong>&laquo;</strong>';
354
-    }
352
+	if (empty($prelabel)) {
353
+		$prelabel = '<strong>&laquo;</strong>';
354
+	}
355 355
 
356
-    if (empty($nxtlabel)) {
357
-        $nxtlabel = '<strong>&raquo;</strong>';
358
-    }
356
+	if (empty($nxtlabel)) {
357
+		$nxtlabel = '<strong>&raquo;</strong>';
358
+	}
359 359
 
360
-    $half_pages_to_show = round($pages_to_show / 2);
360
+	$half_pages_to_show = round($pages_to_show / 2);
361 361
 
362
-    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
363
-        return;
362
+	if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
363
+		return;
364 364
 
365
-    if (!is_single()) {
365
+	if (!is_single()) {
366 366
 		if (function_exists('geodir_location_geo_home_link')) {
367 367
 			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
368 368
 		}
369
-        $numposts = $wp_query->found_posts;
369
+		$numposts = $wp_query->found_posts;
370 370
 
371 371
 
372
-        $max_page = ceil($numposts / $posts_per_page);
372
+		$max_page = ceil($numposts / $posts_per_page);
373 373
 
374
-        if (empty($paged)) {
375
-            $paged = 1;
376
-        }
374
+		if (empty($paged)) {
375
+			$paged = 1;
376
+		}
377 377
 
378
-        if ($max_page > 1 || $always_show) {
378
+		if ($max_page > 1 || $always_show) {
379 379
 			// Extra pagination info
380 380
 			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
381 381
 			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
@@ -392,30 +392,30 @@  discard block
 block discarded – undo
392 392
 			}
393 393
 			
394 394
 			echo "$before <div class='Navi'>";
395
-            if ($paged >= ($pages_to_show - 1)) {
396
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
397
-            }
398
-            previous_posts_link($prelabel);
399
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
400
-                if ($i >= 1 && $i <= $max_page) {
401
-                    if ($i == $paged) {
402
-                        echo "<strong class='on'>$i</strong>";
403
-                    } else {
404
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
405
-                    }
406
-                }
407
-            }
408
-            next_posts_link($nxtlabel, $max_page);
409
-            if (($paged + $half_pages_to_show) < ($max_page)) {
410
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
411
-            }
412
-            echo "</div> $after";
413
-        }
395
+			if ($paged >= ($pages_to_show - 1)) {
396
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
397
+			}
398
+			previous_posts_link($prelabel);
399
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
400
+				if ($i >= 1 && $i <= $max_page) {
401
+					if ($i == $paged) {
402
+						echo "<strong class='on'>$i</strong>";
403
+					} else {
404
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
405
+					}
406
+				}
407
+			}
408
+			next_posts_link($nxtlabel, $max_page);
409
+			if (($paged + $half_pages_to_show) < ($max_page)) {
410
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
411
+			}
412
+			echo "</div> $after";
413
+		}
414 414
 		
415 415
 		if (function_exists('geodir_location_geo_home_link')) {
416 416
 			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
417 417
 		}
418
-    }
418
+	}
419 419
 }
420 420
 
421 421
 /**
@@ -426,20 +426,20 @@  discard block
 block discarded – undo
426 426
  */
427 427
 function geodir_listingsearch_scripts()
428 428
 {
429
-    if (get_option('gd_search_dist') != '') {
430
-        $dist = get_option('gd_search_dist');
431
-    } else {
432
-        $dist = 500;
433
-    }
434
-    $dist_dif = 1000;
435
-
436
-    if ($dist <= 5000) $dist_dif = 500;
437
-    if ($dist <= 1000) $dist_dif = 100;
438
-    if ($dist <= 500) $dist_dif = 50;
439
-    if ($dist <= 100) $dist_dif = 10;
440
-    if ($dist <= 50) $dist_dif = 5;
441
-
442
-    ?>
429
+	if (get_option('gd_search_dist') != '') {
430
+		$dist = get_option('gd_search_dist');
431
+	} else {
432
+		$dist = 500;
433
+	}
434
+	$dist_dif = 1000;
435
+
436
+	if ($dist <= 5000) $dist_dif = 500;
437
+	if ($dist <= 1000) $dist_dif = 100;
438
+	if ($dist <= 500) $dist_dif = 50;
439
+	if ($dist <= 100) $dist_dif = 10;
440
+	if ($dist <= 50) $dist_dif = 5;
441
+
442
+	?>
443 443
     <script type="text/javascript">
444 444
 
445 445
         jQuery(function ($) {
@@ -498,15 +498,15 @@  discard block
 block discarded – undo
498 498
 function geodir_add_sharelocation_scripts()
499 499
 {
500 500
 
501
-    $default_search_for_text = SEARCH_FOR_TEXT;
502
-    if (get_option('geodir_search_field_default_text'))
503
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
501
+	$default_search_for_text = SEARCH_FOR_TEXT;
502
+	if (get_option('geodir_search_field_default_text'))
503
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
504 504
 
505
-    $default_near_text = NEAR_TEXT;
506
-    if (get_option('geodir_near_field_default_text'))
507
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
505
+	$default_near_text = NEAR_TEXT;
506
+	if (get_option('geodir_near_field_default_text'))
507
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
508 508
 
509
-    ?>
509
+	?>
510 510
 
511 511
 
512 512
     <script type="text/javascript">
@@ -584,14 +584,14 @@  discard block
 block discarded – undo
584 584
                 } else {
585 585
 
586 586
                     Sgeocoder.geocode({'address': address<?php
587
-                    if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
588
-                    if($near_add2 =
589
-                    /**
590
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
591
-                     *
592
-                     * @since 1.0.0
593
-                     */
594
-                    apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
587
+					if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
588
+					if($near_add2 =
589
+					/**
590
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
591
+					 *
592
+					 * @since 1.0.0
593
+					 */
594
+					apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
595 595
                         function (results, status) {
596 596
                             if (status == google.maps.GeocoderStatus.OK) {
597 597
                                 updateSearchPosition(results[0].geometry.location, $form);
@@ -670,29 +670,29 @@  discard block
 block discarded – undo
670 670
  */
671 671
 function geodir_show_badges_on_image($which, $post, $link)
672 672
 {
673
-    switch ($which) {
674
-        case 'featured':
675
-            /**
676
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
677
-             *
678
-             * @since 1.0.0
679
-             * @param object $post The post object.
680
-             * @param string $link The link to the post.
681
-             */
682
-            return apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
683
-            break;
684
-        case 'new' :
685
-            /**
686
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
687
-             *
688
-             * @since 1.0.0
689
-             * @param object $post The post object.
690
-             * @param string $link The link to the post.
691
-             */
692
-            return apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
693
-            break;
694
-
695
-    }
673
+	switch ($which) {
674
+		case 'featured':
675
+			/**
676
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
677
+			 *
678
+			 * @since 1.0.0
679
+			 * @param object $post The post object.
680
+			 * @param string $link The link to the post.
681
+			 */
682
+			return apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
683
+			break;
684
+		case 'new' :
685
+			/**
686
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
687
+			 *
688
+			 * @since 1.0.0
689
+			 * @param object $post The post object.
690
+			 * @param string $link The link to the post.
691
+			 */
692
+			return apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
693
+			break;
694
+
695
+	}
696 696
 }
697 697
 
698 698
 ?>
699 699
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +38 added lines, -20 removed lines patch added patch discarded remove patch
@@ -245,13 +245,14 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_add_async_forscript($url)
247 247
 {
248
-    if (strpos($url, '#asyncload')===false)
249
-        return $url;
250
-    else if (is_admin())
251
-        return str_replace('#asyncload', '', $url);
252
-    else
253
-        return str_replace('#asyncload', '', $url)."' async='async";
254
-}
248
+    if (strpos($url, '#asyncload')===false) {
249
+            return $url;
250
+    } else if (is_admin()) {
251
+            return str_replace('#asyncload', '', $url);
252
+    } else {
253
+            return str_replace('#asyncload', '', $url)."' async='async";
254
+    }
255
+    }
255 256
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
256 257
 
257 258
 /**
@@ -298,7 +299,7 @@  discard block
 block discarded – undo
298 299
         wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
299 300
         wp_enqueue_style('geodir-chosen-style');
300 301
 
301
-    }else{
302
+    } else{
302 303
         wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
303 304
         wp_enqueue_style('geodir-core-scss');
304 305
 
@@ -359,8 +360,10 @@  discard block
 block discarded – undo
359 360
 
360 361
     $half_pages_to_show = round($pages_to_show / 2);
361 362
 
362
-    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
363
-        return;
363
+    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) {
364
+    	// dont apply default  pagination for geodirectory home page.
365
+        return;
366
+    }
364 367
 
365 368
     if (!is_single()) {
366 369
 		if (function_exists('geodir_location_geo_home_link')) {
@@ -433,11 +436,21 @@  discard block
 block discarded – undo
433 436
     }
434 437
     $dist_dif = 1000;
435 438
 
436
-    if ($dist <= 5000) $dist_dif = 500;
437
-    if ($dist <= 1000) $dist_dif = 100;
438
-    if ($dist <= 500) $dist_dif = 50;
439
-    if ($dist <= 100) $dist_dif = 10;
440
-    if ($dist <= 50) $dist_dif = 5;
439
+    if ($dist <= 5000) {
440
+    	$dist_dif = 500;
441
+    }
442
+    if ($dist <= 1000) {
443
+    	$dist_dif = 100;
444
+    }
445
+    if ($dist <= 500) {
446
+    	$dist_dif = 50;
447
+    }
448
+    if ($dist <= 100) {
449
+    	$dist_dif = 10;
450
+    }
451
+    if ($dist <= 50) {
452
+    	$dist_dif = 5;
453
+    }
441 454
 
442 455
     ?>
443 456
     <script type="text/javascript">
@@ -499,18 +512,23 @@  discard block
 block discarded – undo
499 512
 {
500 513
 
501 514
     $default_search_for_text = SEARCH_FOR_TEXT;
502
-    if (get_option('geodir_search_field_default_text'))
503
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
515
+    if (get_option('geodir_search_field_default_text')) {
516
+            $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
517
+    }
504 518
 
505 519
     $default_near_text = NEAR_TEXT;
506
-    if (get_option('geodir_near_field_default_text'))
507
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
520
+    if (get_option('geodir_near_field_default_text')) {
521
+            $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
522
+    }
508 523
 
509 524
     ?>
510 525
 
511 526
 
512 527
     <script type="text/javascript">
513
-        var default_location = '<?php if($search_location = geodir_get_default_location())  echo $search_location->city ;?>';
528
+        var default_location = '<?php if($search_location = geodir_get_default_location()) {
529
+	echo $search_location->city ;
530
+}
531
+?>';
514 532
         var latlng;
515 533
         var Sgeocoder;
516 534
         var address;
Please login to merge, or discard this patch.
upgrade.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
 
50
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
50
+    add_action('init', 'gd_fix_cpt_rewrite_slug', 11); // this needs to be kept for a few versions
51 51
 
52 52
     update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
53 53
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * @since 1.0.0
85 85
  * @package GeoDirectory
86 86
  */
87
-function geodir_upgrade_146(){
87
+function geodir_upgrade_146() {
88 88
     gd_convert_virtual_pages();
89 89
 }
90 90
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
  * @since 1.5.0
95 95
  * @package GeoDirectory
96 96
  */
97
-function geodir_upgrade_150(){
97
+function geodir_upgrade_150() {
98 98
     gd_fix_cpt_rewrite_slug();
99 99
 }
100 100
 
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
  * @since 1.4.8
107 107
  * @package GeoDirectory
108 108
  */
109
-function geodir_upgrade_148(){
109
+function geodir_upgrade_148() {
110 110
     /*
111 111
      * Blank the users google password if present as we now use oAuth 2.0
112 112
      */
113
-    update_option('geodir_ga_pass','');
114
-    update_option('geodir_ga_user','');
113
+    update_option('geodir_ga_pass', '');
114
+    update_option('geodir_ga_user', '');
115 115
 
116 116
 }
117 117
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
  * @since 1.5.3
123 123
  * @package GeoDirectory
124 124
  */
125
-function geodir_upgrade_153(){
125
+function geodir_upgrade_153() {
126 126
     geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
127 127
     geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
128 128
 }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @package GeoDirectory
135 135
  */
136
-function geodir_upgrade_154(){
136
+function geodir_upgrade_154() {
137 137
     geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
138 138
 }
139 139
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
  * @since 1.5.2
144 144
  * @package GeoDirectory
145 145
  */
146
-function geodir_upgrade_152(){
146
+function geodir_upgrade_152() {
147 147
     gd_fix_address_detail_table_limit();
148 148
 }
149 149
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
     update_option('gd_theme_compats', $theme_compat);
643 643
 
644
-    gd_set_theme_compat();// set the compat pack if avail
644
+    gd_set_theme_compat(); // set the compat pack if avail
645 645
 }
646 646
 
647 647
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
  * @package GeoDirectory
653 653
  * @global object $wpdb WordPress Database object.
654 654
  */
655
-function gd_convert_virtual_pages(){
655
+function gd_convert_virtual_pages() {
656 656
     global $wpdb;
657 657
 
658 658
     // Update the add listing page settings
@@ -663,9 +663,9 @@  discard block
 block discarded – undo
663 663
         )
664 664
     );
665 665
 
666
-    if($add_listing_page){
667
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
668
-        update_option( 'geodir_add_listing_page', $add_listing_page);
666
+    if ($add_listing_page) {
667
+        wp_update_post(array('ID' => $add_listing_page, 'post_status' => 'publish'));
668
+        update_option('geodir_add_listing_page', $add_listing_page);
669 669
     }
670 670
 
671 671
     // Update the listing preview page settings
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
         )
677 677
     );
678 678
 
679
-    if($listing_preview_page){
680
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
681
-        update_option( 'geodir_preview_page', $listing_preview_page);
679
+    if ($listing_preview_page) {
680
+        wp_update_post(array('ID' => $listing_preview_page, 'post_status' => 'publish'));
681
+        update_option('geodir_preview_page', $listing_preview_page);
682 682
     }
683 683
 
684 684
     // Update the listing success page settings
@@ -689,9 +689,9 @@  discard block
 block discarded – undo
689 689
         )
690 690
     );
691 691
 
692
-    if($listing_success_page){
693
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
694
-        update_option( 'geodir_success_page', $listing_success_page);
692
+    if ($listing_success_page) {
693
+        wp_update_post(array('ID' => $listing_success_page, 'post_status' => 'publish'));
694
+        update_option('geodir_success_page', $listing_success_page);
695 695
     }
696 696
 
697 697
     // Update the listing success page settings
@@ -702,11 +702,11 @@  discard block
 block discarded – undo
702 702
         )
703 703
     );
704 704
 
705
-    if($location_page){
705
+    if ($location_page) {
706 706
         $location_slug = get_option('geodir_location_prefix');
707
-        if(!$location_slug ){$location_slug  = 'location';}
708
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
709
-        update_option( 'geodir_location_page', $location_page);
707
+        if (!$location_slug) {$location_slug = 'location'; }
708
+        wp_update_post(array('ID' => $location_page, 'post_status' => 'publish', 'post_name' => $location_slug));
709
+        update_option('geodir_location_page', $location_page);
710 710
     }
711 711
 
712 712
 }
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
     $post_types = get_option('geodir_post_types');
726 726
 
727 727
 
728
-    if (is_array($post_types)){
728
+    if (is_array($post_types)) {
729 729
 
730 730
         foreach ($post_types as $post_type => $args) {
731 731
 
732 732
 
733
-            if(isset($args['rewrite']['slug'])){
734
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
733
+            if (isset($args['rewrite']['slug'])) {
734
+                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%", "", $args['rewrite']['slug']);
735 735
             }
736 736
 
737 737
                 $alt_post_types[$post_type] = $args;
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
         }
740 740
     }
741 741
 
742
-    if(!empty($alt_post_types)) {
743
-        update_option('geodir_post_types',$alt_post_types);
742
+    if (!empty($alt_post_types)) {
743
+        update_option('geodir_post_types', $alt_post_types);
744 744
         }
745 745
 
746 746
 
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
             // update each GD CTP
768 768
             try {
769 769
                 $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");
770
-            } catch(Exception $e) {
771
-                error_log( 'Error: ' . $e->getMessage() );
770
+            } catch (Exception $e) {
771
+                error_log('Error: ' . $e->getMessage());
772 772
             }
773 773
         }
774 774
     }
Please login to merge, or discard this patch.
Indentation   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -10,46 +10,46 @@  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 49
 
50
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
50
+	add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
51 51
 
52
-    update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
52
+	update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
53 53
 
54 54
 }
55 55
 
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function geodirectory_upgrade_all()
64 64
 {
65
-    geodir_create_tables();
66
-    geodir_update_review_db();
67
-    gd_install_theme_compat();
65
+	geodir_create_tables();
66
+	geodir_update_review_db();
67
+	gd_install_theme_compat();
68 68
 }
69 69
 
70 70
 /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function geodir_upgrade_136()
77 77
 {
78
-    geodir_fix_review_overall_rating();
78
+	geodir_fix_review_overall_rating();
79 79
 }
80 80
 
81 81
 /**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  * @package GeoDirectory
86 86
  */
87 87
 function geodir_upgrade_146(){
88
-    gd_convert_virtual_pages();
88
+	gd_convert_virtual_pages();
89 89
 }
90 90
 
91 91
 /**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
  * @package GeoDirectory
96 96
  */
97 97
 function geodir_upgrade_150(){
98
-    gd_fix_cpt_rewrite_slug();
98
+	gd_fix_cpt_rewrite_slug();
99 99
 }
100 100
 
101 101
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
  * @package GeoDirectory
108 108
  */
109 109
 function geodir_upgrade_148(){
110
-    /*
110
+	/*
111 111
      * Blank the users google password if present as we now use oAuth 2.0
112 112
      */
113
-    update_option('geodir_ga_pass','');
114
-    update_option('geodir_ga_user','');
113
+	update_option('geodir_ga_pass','');
114
+	update_option('geodir_ga_user','');
115 115
 
116 116
 }
117 117
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
  * @package GeoDirectory
124 124
  */
125 125
 function geodir_upgrade_153(){
126
-    geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
127
-    geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
126
+	geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
127
+	geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
128 128
 }
129 129
 
130 130
 /**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
  * @package GeoDirectory
135 135
  */
136 136
 function geodir_upgrade_154(){
137
-    geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
137
+	geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
138 138
 }
139 139
 
140 140
 /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  * @package GeoDirectory
145 145
  */
146 146
 function geodir_upgrade_152(){
147
-    gd_fix_address_detail_table_limit();
147
+	gd_fix_address_detail_table_limit();
148 148
 }
149 149
 
150 150
 
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
  */
159 159
 function geodir_update_review_db()
160 160
 {
161
-    global $wpdb, $plugin_prefix;
161
+	global $wpdb, $plugin_prefix;
162 162
 
163
-    geodir_fix_review_date();
164
-    geodir_fix_review_post_status();
165
-    geodir_fix_review_content();
166
-    geodir_fix_review_location();
163
+	geodir_fix_review_date();
164
+	geodir_fix_review_post_status();
165
+	geodir_fix_review_content();
166
+	geodir_fix_review_location();
167 167
 
168 168
 }
169 169
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function geodir_fix_review_date()
178 178
 {
179
-    global $wpdb;
180
-    $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'");
179
+	global $wpdb;
180
+	$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'");
181 181
 }
182 182
 
183 183
 /**
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
  */
190 190
 function geodir_fix_review_post_status()
191 191
 {
192
-    global $wpdb;
193
-    $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'");
192
+	global $wpdb;
193
+	$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'");
194 194
 }
195 195
 
196 196
 /**
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
  */
204 204
 function geodir_fix_review_content()
205 205
 {
206
-    global $wpdb;
207
-    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")) {
208
-        return true;
209
-    } else {
210
-        return false;
211
-    }
206
+	global $wpdb;
207
+	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")) {
208
+		return true;
209
+	} else {
210
+		return false;
211
+	}
212 212
 }
213 213
 
214 214
 /**
@@ -221,20 +221,20 @@  discard block
 block discarded – undo
221 221
  */
222 222
 function geodir_fix_review_location()
223 223
 {
224
-    global $wpdb;
224
+	global $wpdb;
225 225
 
226
-    $all_postypes = geodir_get_posttypes();
226
+	$all_postypes = geodir_get_posttypes();
227 227
 
228
-    if (!empty($all_postypes)) {
229
-        foreach ($all_postypes as $key) {
230
-            // update each GD CTP
228
+	if (!empty($all_postypes)) {
229
+		foreach ($all_postypes as $key) {
230
+			// update each GD CTP
231 231
 
232
-            $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");
232
+			$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");
233 233
 
234
-        }
235
-        return true;
236
-    }
237
-    return false;
234
+		}
235
+		return true;
236
+	}
237
+	return false;
238 238
 }
239 239
 
240 240
 /**
@@ -246,25 +246,25 @@  discard block
 block discarded – undo
246 246
  */
247 247
 function geodir_fix_review_overall_rating()
248 248
 {
249
-    global $wpdb;
249
+	global $wpdb;
250 250
 
251
-    $all_postypes = geodir_get_posttypes();
251
+	$all_postypes = geodir_get_posttypes();
252 252
 
253
-    if (!empty($all_postypes)) {
254
-        foreach ($all_postypes as $key) {
255
-            // update each GD CTP
256
-            $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
253
+	if (!empty($all_postypes)) {
254
+		foreach ($all_postypes as $key) {
255
+			// update each GD CTP
256
+			$reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
257 257
 
258
-            if (!empty($reviews)) {
259
-                foreach ($reviews as $post_id) {
260
-                    geodir_update_postrating($post_id->post_id, $key);
261
-                }
258
+			if (!empty($reviews)) {
259
+				foreach ($reviews as $post_id) {
260
+					geodir_update_postrating($post_id->post_id, $key);
261
+				}
262 262
 
263
-            }
263
+			}
264 264
 
265
-        }
265
+		}
266 266
 
267
-    }
267
+	}
268 268
 }
269 269
 
270 270
 
@@ -281,367 +281,367 @@  discard block
 block discarded – undo
281 281
  */
282 282
 function gd_install_theme_compat()
283 283
 {
284
-    global $wpdb;
284
+	global $wpdb;
285 285
 
286
-    $theme_compat = array();
287
-    $theme_compat = get_option('gd_theme_compats');
286
+	$theme_compat = array();
287
+	$theme_compat = get_option('gd_theme_compats');
288 288
 //GDF
289
-    $theme_compat['GeoDirectory_Framework'] = array(
290
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
291
-        'geodir_wrapper_open_class' => '',
292
-        'geodir_wrapper_open_replace' => '',
293
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
294
-        'geodir_wrapper_content_open_id' => 'geodir_content',
295
-        'geodir_wrapper_content_open_class' => '',
296
-        'geodir_wrapper_content_open_replace' => '',
297
-        'geodir_wrapper_content_close_replace' => '',
298
-        'geodir_article_open_id' => '',
299
-        'geodir_article_open_class' => '',
300
-        'geodir_article_open_replace' => '',
301
-        'geodir_article_close_replace' => '',
302
-        'geodir_sidebar_right_open_id' => '',
303
-        'geodir_sidebar_right_open_class' => '',
304
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
305
-        'geodir_sidebar_right_close_replace' => '',
306
-        'geodir_sidebar_left_open_id' => '',
307
-        'geodir_sidebar_left_open_class' => '',
308
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
309
-        'geodir_sidebar_left_close_replace' => '',
310
-        'geodir_main_content_open_id' => '',
311
-        'geodir_main_content_open_class' => '',
312
-        'geodir_main_content_open_replace' => '<!-- removed -->',
313
-        'geodir_main_content_close_replace' => '<!-- removed -->',
314
-        'geodir_top_content_add' => '',
315
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
316
-        'geodir_before_widget_filter' => '',
317
-        'geodir_after_widget_filter' => '',
318
-        'geodir_theme_compat_css' => '',
319
-        'geodir_theme_compat_js' => '',
320
-        'geodir_theme_compat_default_options' => '',
321
-        'geodir_theme_compat_code' => ''
322
-    );
289
+	$theme_compat['GeoDirectory_Framework'] = array(
290
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
291
+		'geodir_wrapper_open_class' => '',
292
+		'geodir_wrapper_open_replace' => '',
293
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
294
+		'geodir_wrapper_content_open_id' => 'geodir_content',
295
+		'geodir_wrapper_content_open_class' => '',
296
+		'geodir_wrapper_content_open_replace' => '',
297
+		'geodir_wrapper_content_close_replace' => '',
298
+		'geodir_article_open_id' => '',
299
+		'geodir_article_open_class' => '',
300
+		'geodir_article_open_replace' => '',
301
+		'geodir_article_close_replace' => '',
302
+		'geodir_sidebar_right_open_id' => '',
303
+		'geodir_sidebar_right_open_class' => '',
304
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
305
+		'geodir_sidebar_right_close_replace' => '',
306
+		'geodir_sidebar_left_open_id' => '',
307
+		'geodir_sidebar_left_open_class' => '',
308
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
309
+		'geodir_sidebar_left_close_replace' => '',
310
+		'geodir_main_content_open_id' => '',
311
+		'geodir_main_content_open_class' => '',
312
+		'geodir_main_content_open_replace' => '<!-- removed -->',
313
+		'geodir_main_content_close_replace' => '<!-- removed -->',
314
+		'geodir_top_content_add' => '',
315
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
316
+		'geodir_before_widget_filter' => '',
317
+		'geodir_after_widget_filter' => '',
318
+		'geodir_theme_compat_css' => '',
319
+		'geodir_theme_compat_js' => '',
320
+		'geodir_theme_compat_default_options' => '',
321
+		'geodir_theme_compat_code' => ''
322
+	);
323 323
 
324 324
 //Directory Theme
325
-    $theme_compat['Directory_Starter'] = array(
326
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
327
-        'geodir_wrapper_open_class' => '',
328
-        'geodir_wrapper_open_replace' => '',
329
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
330
-        'geodir_wrapper_content_open_id' => 'geodir_content',
331
-        'geodir_wrapper_content_open_class' => '',
332
-        'geodir_wrapper_content_open_replace' => '',
333
-        'geodir_wrapper_content_close_replace' => '',
334
-        'geodir_article_open_id' => '',
335
-        'geodir_article_open_class' => '',
336
-        'geodir_article_open_replace' => '',
337
-        'geodir_article_close_replace' => '',
338
-        'geodir_sidebar_right_open_id' => '',
339
-        'geodir_sidebar_right_open_class' => '',
340
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
341
-        'geodir_sidebar_right_close_replace' => '',
342
-        'geodir_sidebar_left_open_id' => '',
343
-        'geodir_sidebar_left_open_class' => '',
344
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
345
-        'geodir_sidebar_left_close_replace' => '',
346
-        'geodir_main_content_open_id' => '',
347
-        'geodir_main_content_open_class' => '',
348
-        'geodir_main_content_open_replace' => '<!-- removed -->',
349
-        'geodir_main_content_close_replace' => '<!-- removed -->',
350
-        'geodir_top_content_add' => '',
351
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
352
-        'geodir_before_widget_filter' => '',
353
-        'geodir_after_widget_filter' => '',
354
-        'geodir_theme_compat_css' => '',
355
-        'geodir_theme_compat_js' => '',
356
-        'geodir_theme_compat_default_options' => '',
357
-        'geodir_theme_compat_code' => ''
358
-    );
325
+	$theme_compat['Directory_Starter'] = array(
326
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
327
+		'geodir_wrapper_open_class' => '',
328
+		'geodir_wrapper_open_replace' => '',
329
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
330
+		'geodir_wrapper_content_open_id' => 'geodir_content',
331
+		'geodir_wrapper_content_open_class' => '',
332
+		'geodir_wrapper_content_open_replace' => '',
333
+		'geodir_wrapper_content_close_replace' => '',
334
+		'geodir_article_open_id' => '',
335
+		'geodir_article_open_class' => '',
336
+		'geodir_article_open_replace' => '',
337
+		'geodir_article_close_replace' => '',
338
+		'geodir_sidebar_right_open_id' => '',
339
+		'geodir_sidebar_right_open_class' => '',
340
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
341
+		'geodir_sidebar_right_close_replace' => '',
342
+		'geodir_sidebar_left_open_id' => '',
343
+		'geodir_sidebar_left_open_class' => '',
344
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
345
+		'geodir_sidebar_left_close_replace' => '',
346
+		'geodir_main_content_open_id' => '',
347
+		'geodir_main_content_open_class' => '',
348
+		'geodir_main_content_open_replace' => '<!-- removed -->',
349
+		'geodir_main_content_close_replace' => '<!-- removed -->',
350
+		'geodir_top_content_add' => '',
351
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
352
+		'geodir_before_widget_filter' => '',
353
+		'geodir_after_widget_filter' => '',
354
+		'geodir_theme_compat_css' => '',
355
+		'geodir_theme_compat_js' => '',
356
+		'geodir_theme_compat_default_options' => '',
357
+		'geodir_theme_compat_code' => ''
358
+	);
359 359
 
360 360
 //Jobby
361
-    $theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
361
+	$theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
362 362
 
363 363
 //GeoProperty
364
-    $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
364
+	$theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
365 365
 
366 366
 //Avada
367
-    $theme_compat['Avada'] = array(
368
-        'geodir_wrapper_open_id' => '',
369
-        'geodir_wrapper_open_class' => '',
370
-        'geodir_wrapper_open_replace' => '<!-- removed -->',
371
-        'geodir_wrapper_close_replace' => '<!-- removed -->',
372
-        'geodir_wrapper_content_open_id' => 'content',
373
-        'geodir_wrapper_content_open_class' => '',
374
-        'geodir_wrapper_content_open_replace' => '',
375
-        'geodir_wrapper_content_close_replace' => '',
376
-        'geodir_article_open_id' => '',
377
-        'geodir_article_open_class' => '',
378
-        'geodir_article_open_replace' => '',
379
-        'geodir_article_close_replace' => '',
380
-        'geodir_sidebar_right_open_id' => '',
381
-        'geodir_sidebar_right_open_class' => '',
382
-        'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
383
-        'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
384
-        'geodir_sidebar_left_open_id' => '',
385
-        'geodir_sidebar_left_open_class' => '',
386
-        'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
387
-        'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
388
-        'geodir_main_content_open_id' => '',
389
-        'geodir_main_content_open_class' => '',
390
-        'geodir_main_content_open_replace' => '<!-- removed -->',
391
-        'geodir_main_content_close_replace' => '<!-- removed -->',
392
-        'geodir_top_content_add' => '',
393
-        'geodir_before_main_content_add' => '',
394
-        'geodir_before_widget_filter' => '',
395
-        'geodir_after_widget_filter' => '',
396
-        '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;}'),
397
-        'geodir_theme_compat_js' => '',
398
-        'geodir_theme_compat_default_options' => '',
399
-        'geodir_theme_compat_code' => 'Avada'
400
-    );
367
+	$theme_compat['Avada'] = array(
368
+		'geodir_wrapper_open_id' => '',
369
+		'geodir_wrapper_open_class' => '',
370
+		'geodir_wrapper_open_replace' => '<!-- removed -->',
371
+		'geodir_wrapper_close_replace' => '<!-- removed -->',
372
+		'geodir_wrapper_content_open_id' => 'content',
373
+		'geodir_wrapper_content_open_class' => '',
374
+		'geodir_wrapper_content_open_replace' => '',
375
+		'geodir_wrapper_content_close_replace' => '',
376
+		'geodir_article_open_id' => '',
377
+		'geodir_article_open_class' => '',
378
+		'geodir_article_open_replace' => '',
379
+		'geodir_article_close_replace' => '',
380
+		'geodir_sidebar_right_open_id' => '',
381
+		'geodir_sidebar_right_open_class' => '',
382
+		'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
383
+		'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
384
+		'geodir_sidebar_left_open_id' => '',
385
+		'geodir_sidebar_left_open_class' => '',
386
+		'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
387
+		'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
388
+		'geodir_main_content_open_id' => '',
389
+		'geodir_main_content_open_class' => '',
390
+		'geodir_main_content_open_replace' => '<!-- removed -->',
391
+		'geodir_main_content_close_replace' => '<!-- removed -->',
392
+		'geodir_top_content_add' => '',
393
+		'geodir_before_main_content_add' => '',
394
+		'geodir_before_widget_filter' => '',
395
+		'geodir_after_widget_filter' => '',
396
+		'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;}'),
397
+		'geodir_theme_compat_js' => '',
398
+		'geodir_theme_compat_default_options' => '',
399
+		'geodir_theme_compat_code' => 'Avada'
400
+	);
401 401
 
402 402
 //Enfold
403
-    $theme_compat['Enfold'] = array(
404
-        'geodir_wrapper_open_id' => '',
405
-        'geodir_wrapper_open_class' => '',
406
-        'geodir_wrapper_open_replace' => '',
407
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
408
-        'geodir_wrapper_content_open_id' => '',
409
-        'geodir_wrapper_content_open_class' => '',
410
-        'geodir_wrapper_content_open_replace' => '',
411
-        'geodir_wrapper_content_close_replace' => '</div></main>',
412
-        'geodir_article_open_id' => '',
413
-        'geodir_article_open_class' => '',
414
-        'geodir_article_open_replace' => '',
415
-        'geodir_article_close_replace' => '',
416
-        'geodir_sidebar_right_open_id' => '',
417
-        'geodir_sidebar_right_open_class' => '',
418
-        'geodir_sidebar_right_open_replace' => '',
419
-        'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
420
-        'geodir_sidebar_left_open_id' => '',
421
-        'geodir_sidebar_left_open_class' => '',
422
-        'geodir_sidebar_left_open_replace' => '',
423
-        'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
424
-        'geodir_main_content_open_id' => '',
425
-        'geodir_main_content_open_class' => '',
426
-        'geodir_main_content_open_replace' => '',
427
-        'geodir_main_content_close_replace' => '',
428
-        'geodir_top_content_add' => '',
429
-        'geodir_before_main_content_add' => '',
430
-        'geodir_before_widget_filter' => '',
431
-        'geodir_after_widget_filter' => '',
432
-        '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;}'),
433
-        'geodir_theme_compat_js' => '',
434
-        'geodir_theme_compat_default_options' => '',
435
-        'geodir_theme_compat_code' => 'Enfold'
436
-    );
403
+	$theme_compat['Enfold'] = array(
404
+		'geodir_wrapper_open_id' => '',
405
+		'geodir_wrapper_open_class' => '',
406
+		'geodir_wrapper_open_replace' => '',
407
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
408
+		'geodir_wrapper_content_open_id' => '',
409
+		'geodir_wrapper_content_open_class' => '',
410
+		'geodir_wrapper_content_open_replace' => '',
411
+		'geodir_wrapper_content_close_replace' => '</div></main>',
412
+		'geodir_article_open_id' => '',
413
+		'geodir_article_open_class' => '',
414
+		'geodir_article_open_replace' => '',
415
+		'geodir_article_close_replace' => '',
416
+		'geodir_sidebar_right_open_id' => '',
417
+		'geodir_sidebar_right_open_class' => '',
418
+		'geodir_sidebar_right_open_replace' => '',
419
+		'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
420
+		'geodir_sidebar_left_open_id' => '',
421
+		'geodir_sidebar_left_open_class' => '',
422
+		'geodir_sidebar_left_open_replace' => '',
423
+		'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
424
+		'geodir_main_content_open_id' => '',
425
+		'geodir_main_content_open_class' => '',
426
+		'geodir_main_content_open_replace' => '',
427
+		'geodir_main_content_close_replace' => '',
428
+		'geodir_top_content_add' => '',
429
+		'geodir_before_main_content_add' => '',
430
+		'geodir_before_widget_filter' => '',
431
+		'geodir_after_widget_filter' => '',
432
+		'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;}'),
433
+		'geodir_theme_compat_js' => '',
434
+		'geodir_theme_compat_default_options' => '',
435
+		'geodir_theme_compat_code' => 'Enfold'
436
+	);
437 437
 
438 438
 // X
439
-    $theme_compat['X'] = array(
440
-        'geodir_wrapper_open_id' => '',
441
-        'geodir_wrapper_open_class' => '',
442
-        'geodir_wrapper_open_replace' => '',
443
-        'geodir_wrapper_close_replace' => '',
444
-        'geodir_wrapper_content_open_id' => '',
445
-        'geodir_wrapper_content_open_class' => '',
446
-        'geodir_wrapper_content_open_replace' => '',
447
-        'geodir_wrapper_content_close_replace' => '',
448
-        'geodir_article_open_id' => '',
449
-        'geodir_article_open_class' => '',
450
-        'geodir_article_open_replace' => '',
451
-        'geodir_article_close_replace' => '',
452
-        'geodir_sidebar_right_open_id' => '',
453
-        'geodir_sidebar_right_open_class' => '',
454
-        'geodir_sidebar_right_open_replace' => '',
455
-        'geodir_sidebar_right_close_replace' => '',
456
-        'geodir_sidebar_left_open_id' => '',
457
-        'geodir_sidebar_left_open_class' => '',
458
-        'geodir_sidebar_left_open_replace' => '',
459
-        'geodir_sidebar_left_close_replace' => '',
460
-        'geodir_main_content_open_id' => '',
461
-        'geodir_main_content_open_class' => '',
462
-        'geodir_main_content_open_replace' => '',
463
-        'geodir_main_content_close_replace' => '',
464
-        'geodir_top_content_add' => '',
465
-        'geodir_before_main_content_add' => '',
466
-        'geodir_before_widget_filter' => '',
467
-        'geodir_after_widget_filter' => '',
468
-        '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}'),
469
-        'geodir_theme_compat_js' => '',
470
-        'geodir_theme_compat_default_options' => '',
471
-        'geodir_theme_compat_code' => 'X'
472
-    );
439
+	$theme_compat['X'] = array(
440
+		'geodir_wrapper_open_id' => '',
441
+		'geodir_wrapper_open_class' => '',
442
+		'geodir_wrapper_open_replace' => '',
443
+		'geodir_wrapper_close_replace' => '',
444
+		'geodir_wrapper_content_open_id' => '',
445
+		'geodir_wrapper_content_open_class' => '',
446
+		'geodir_wrapper_content_open_replace' => '',
447
+		'geodir_wrapper_content_close_replace' => '',
448
+		'geodir_article_open_id' => '',
449
+		'geodir_article_open_class' => '',
450
+		'geodir_article_open_replace' => '',
451
+		'geodir_article_close_replace' => '',
452
+		'geodir_sidebar_right_open_id' => '',
453
+		'geodir_sidebar_right_open_class' => '',
454
+		'geodir_sidebar_right_open_replace' => '',
455
+		'geodir_sidebar_right_close_replace' => '',
456
+		'geodir_sidebar_left_open_id' => '',
457
+		'geodir_sidebar_left_open_class' => '',
458
+		'geodir_sidebar_left_open_replace' => '',
459
+		'geodir_sidebar_left_close_replace' => '',
460
+		'geodir_main_content_open_id' => '',
461
+		'geodir_main_content_open_class' => '',
462
+		'geodir_main_content_open_replace' => '',
463
+		'geodir_main_content_close_replace' => '',
464
+		'geodir_top_content_add' => '',
465
+		'geodir_before_main_content_add' => '',
466
+		'geodir_before_widget_filter' => '',
467
+		'geodir_after_widget_filter' => '',
468
+		'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}'),
469
+		'geodir_theme_compat_js' => '',
470
+		'geodir_theme_compat_default_options' => '',
471
+		'geodir_theme_compat_code' => 'X'
472
+	);
473 473
 
474 474
 // Divi
475
-    $theme_compat['Divi'] = array(
476
-        'geodir_wrapper_open_id' => 'main-content',
477
-        'geodir_wrapper_open_class' => '',
478
-        'geodir_wrapper_open_replace' => '',
479
-        'geodir_wrapper_close_replace' => '',
480
-        'geodir_wrapper_content_open_id' => 'left-area',
481
-        'geodir_wrapper_content_open_class' => '',
482
-        'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
483
-        'geodir_wrapper_content_close_replace' => '',
484
-        'geodir_article_open_id' => '',
485
-        'geodir_article_open_class' => '',
486
-        'geodir_article_open_replace' => '',
487
-        'geodir_article_close_replace' => '',
488
-        'geodir_sidebar_right_open_id' => 'sidebar',
489
-        'geodir_sidebar_right_open_class' => '',
490
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
491
-        'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
492
-        'geodir_sidebar_left_open_id' => 'sidebar',
493
-        'geodir_sidebar_left_open_class' => '',
494
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
495
-        'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
496
-        'geodir_main_content_open_id' => '',
497
-        'geodir_main_content_open_class' => '',
498
-        'geodir_main_content_open_replace' => '',
499
-        'geodir_main_content_close_replace' => '',
500
-        'geodir_top_content_add' => '',
501
-        'geodir_before_main_content_add' => '',
502
-        'geodir_before_widget_filter' => '',
503
-        'geodir_after_widget_filter' => '',
504
-        '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}'),
505
-        'geodir_theme_compat_js' => '',
506
-        'geodir_theme_compat_default_options' => '',
507
-        'geodir_theme_compat_code' => 'Divi'
508
-    );
475
+	$theme_compat['Divi'] = array(
476
+		'geodir_wrapper_open_id' => 'main-content',
477
+		'geodir_wrapper_open_class' => '',
478
+		'geodir_wrapper_open_replace' => '',
479
+		'geodir_wrapper_close_replace' => '',
480
+		'geodir_wrapper_content_open_id' => 'left-area',
481
+		'geodir_wrapper_content_open_class' => '',
482
+		'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
483
+		'geodir_wrapper_content_close_replace' => '',
484
+		'geodir_article_open_id' => '',
485
+		'geodir_article_open_class' => '',
486
+		'geodir_article_open_replace' => '',
487
+		'geodir_article_close_replace' => '',
488
+		'geodir_sidebar_right_open_id' => 'sidebar',
489
+		'geodir_sidebar_right_open_class' => '',
490
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
491
+		'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
492
+		'geodir_sidebar_left_open_id' => 'sidebar',
493
+		'geodir_sidebar_left_open_class' => '',
494
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
495
+		'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
496
+		'geodir_main_content_open_id' => '',
497
+		'geodir_main_content_open_class' => '',
498
+		'geodir_main_content_open_replace' => '',
499
+		'geodir_main_content_close_replace' => '',
500
+		'geodir_top_content_add' => '',
501
+		'geodir_before_main_content_add' => '',
502
+		'geodir_before_widget_filter' => '',
503
+		'geodir_after_widget_filter' => '',
504
+		'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}'),
505
+		'geodir_theme_compat_js' => '',
506
+		'geodir_theme_compat_default_options' => '',
507
+		'geodir_theme_compat_code' => 'Divi'
508
+	);
509 509
 
510 510
 // Genesis
511
-    $theme_compat['Genesis'] = array(
512
-        'geodir_wrapper_open_id' => '',
513
-        'geodir_wrapper_open_class' => 'content-sidebar-wrap',
514
-        'geodir_wrapper_open_replace' => '',
515
-        'geodir_wrapper_close_replace' => '',
516
-        'geodir_wrapper_content_open_id' => '',
517
-        'geodir_wrapper_content_open_class' => 'content',
518
-        'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
519
-        'geodir_wrapper_content_close_replace' => '',
520
-        'geodir_article_open_id' => '',
521
-        'geodir_article_open_class' => '',
522
-        'geodir_article_open_replace' => '',
523
-        'geodir_article_close_replace' => '',
524
-        'geodir_sidebar_right_open_id' => '',
525
-        'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
526
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
527
-        'geodir_sidebar_right_close_replace' => '',
528
-        'geodir_sidebar_left_open_id' => '',
529
-        'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
530
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
531
-        'geodir_sidebar_left_close_replace' => '',
532
-        'geodir_main_content_open_id' => '',
533
-        'geodir_main_content_open_class' => '',
534
-        'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
535
-        'geodir_main_content_close_replace' => '',
536
-        'geodir_top_content_add' => '',
537
-        'geodir_before_main_content_add' => '',
538
-        'geodir_before_widget_filter' => '',
539
-        'geodir_after_widget_filter' => '',
540
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
541
-        '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}'),
542
-        'geodir_theme_compat_js' => '',
543
-        'geodir_theme_compat_default_options' => '',
544
-        'geodir_theme_compat_code' => 'Genesis'
545
-    );
511
+	$theme_compat['Genesis'] = array(
512
+		'geodir_wrapper_open_id' => '',
513
+		'geodir_wrapper_open_class' => 'content-sidebar-wrap',
514
+		'geodir_wrapper_open_replace' => '',
515
+		'geodir_wrapper_close_replace' => '',
516
+		'geodir_wrapper_content_open_id' => '',
517
+		'geodir_wrapper_content_open_class' => 'content',
518
+		'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
519
+		'geodir_wrapper_content_close_replace' => '',
520
+		'geodir_article_open_id' => '',
521
+		'geodir_article_open_class' => '',
522
+		'geodir_article_open_replace' => '',
523
+		'geodir_article_close_replace' => '',
524
+		'geodir_sidebar_right_open_id' => '',
525
+		'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
526
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
527
+		'geodir_sidebar_right_close_replace' => '',
528
+		'geodir_sidebar_left_open_id' => '',
529
+		'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
530
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
531
+		'geodir_sidebar_left_close_replace' => '',
532
+		'geodir_main_content_open_id' => '',
533
+		'geodir_main_content_open_class' => '',
534
+		'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
535
+		'geodir_main_content_close_replace' => '',
536
+		'geodir_top_content_add' => '',
537
+		'geodir_before_main_content_add' => '',
538
+		'geodir_before_widget_filter' => '',
539
+		'geodir_after_widget_filter' => '',
540
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
541
+		'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}'),
542
+		'geodir_theme_compat_js' => '',
543
+		'geodir_theme_compat_default_options' => '',
544
+		'geodir_theme_compat_code' => 'Genesis'
545
+	);
546 546
 
547 547
 // Jupiter
548
-    $theme_compat['Jupiter'] = array(
549
-        'geodir_wrapper_open_id' => '',
550
-        'geodir_wrapper_open_class' => '',
551
-        '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">',
552
-        'geodir_wrapper_close_replace' => '</div></div></div>',
553
-        'geodir_wrapper_content_open_id' => '',
554
-        'geodir_wrapper_content_open_class' => '',
555
-        'geodir_wrapper_content_open_replace' => '',
556
-        'geodir_wrapper_content_close_replace' => '',
557
-        'geodir_article_open_id' => '',
558
-        'geodir_article_open_class' => '',
559
-        'geodir_article_open_replace' => '',
560
-        'geodir_article_close_replace' => '',
561
-        'geodir_sidebar_right_open_id' => 'mk-sidebar',
562
-        'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
563
-        'geodir_sidebar_right_open_replace' => '',
564
-        'geodir_sidebar_right_close_replace' => '',
565
-        'geodir_sidebar_left_open_id' => 'mk-sidebar',
566
-        'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
567
-        'geodir_sidebar_left_open_replace' => '',
568
-        'geodir_sidebar_left_close_replace' => '',
569
-        'geodir_main_content_open_id' => '',
570
-        'geodir_main_content_open_class' => '',
571
-        'geodir_main_content_open_replace' => '',
572
-        'geodir_main_content_close_replace' => '',
573
-        'geodir_top_content_add' => '',
574
-        'geodir_before_main_content_add' => '',
575
-        'geodir_before_widget_filter' => '',
576
-        'geodir_after_widget_filter' => '',
577
-        'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
578
-        'geodir_after_title_filter' => '',
579
-        'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
580
-        'geodir_sub_menu_ul_class_filter' => '',
581
-        'geodir_sub_menu_li_class_filter' => '',
582
-        'geodir_menu_a_class_filter' => 'menu-item-link',
583
-        'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
584
-        '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',
585
-        'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
586
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
587
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
588
-        '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}'),
589
-        'geodir_theme_compat_js' => '',
590
-        'geodir_theme_compat_default_options' => '',
591
-        'geodir_theme_compat_code' => 'Jupiter'
592
-    );
548
+	$theme_compat['Jupiter'] = array(
549
+		'geodir_wrapper_open_id' => '',
550
+		'geodir_wrapper_open_class' => '',
551
+		'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">',
552
+		'geodir_wrapper_close_replace' => '</div></div></div>',
553
+		'geodir_wrapper_content_open_id' => '',
554
+		'geodir_wrapper_content_open_class' => '',
555
+		'geodir_wrapper_content_open_replace' => '',
556
+		'geodir_wrapper_content_close_replace' => '',
557
+		'geodir_article_open_id' => '',
558
+		'geodir_article_open_class' => '',
559
+		'geodir_article_open_replace' => '',
560
+		'geodir_article_close_replace' => '',
561
+		'geodir_sidebar_right_open_id' => 'mk-sidebar',
562
+		'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
563
+		'geodir_sidebar_right_open_replace' => '',
564
+		'geodir_sidebar_right_close_replace' => '',
565
+		'geodir_sidebar_left_open_id' => 'mk-sidebar',
566
+		'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
567
+		'geodir_sidebar_left_open_replace' => '',
568
+		'geodir_sidebar_left_close_replace' => '',
569
+		'geodir_main_content_open_id' => '',
570
+		'geodir_main_content_open_class' => '',
571
+		'geodir_main_content_open_replace' => '',
572
+		'geodir_main_content_close_replace' => '',
573
+		'geodir_top_content_add' => '',
574
+		'geodir_before_main_content_add' => '',
575
+		'geodir_before_widget_filter' => '',
576
+		'geodir_after_widget_filter' => '',
577
+		'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
578
+		'geodir_after_title_filter' => '',
579
+		'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
580
+		'geodir_sub_menu_ul_class_filter' => '',
581
+		'geodir_sub_menu_li_class_filter' => '',
582
+		'geodir_menu_a_class_filter' => 'menu-item-link',
583
+		'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
584
+		'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',
585
+		'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
586
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
587
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
588
+		'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}'),
589
+		'geodir_theme_compat_js' => '',
590
+		'geodir_theme_compat_default_options' => '',
591
+		'geodir_theme_compat_code' => 'Jupiter'
592
+	);
593 593
 
594 594
 // Multi News
595
-    $theme_compat['Multi_News'] = array(
596
-        'geodir_wrapper_open_id' => '',
597
-        'geodir_wrapper_open_class' => 'main-container clearfix',
598
-        'geodir_wrapper_open_replace' => '',
599
-        'geodir_wrapper_close_replace' => '',
600
-        'geodir_wrapper_content_open_id' => '',
601
-        'geodir_wrapper_content_open_class' => '',
602
-        'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
603
-        'geodir_wrapper_content_close_replace' => '</div></div></div>',
604
-        'geodir_article_open_id' => '',
605
-        'geodir_article_open_class' => '',
606
-        'geodir_article_open_replace' => '',
607
-        'geodir_article_close_replace' => '',
608
-        'geodir_sidebar_right_open_id' => '',
609
-        'geodir_sidebar_right_open_class' => '',
610
-        'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
611
-        'geodir_sidebar_right_close_replace' => '',
612
-        'geodir_sidebar_left_open_id' => '',
613
-        'geodir_sidebar_left_open_class' => '',
614
-        'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
615
-        'geodir_sidebar_left_close_replace' => '',
616
-        'geodir_main_content_open_id' => '',
617
-        'geodir_main_content_open_class' => '',
618
-        'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
619
-        'geodir_main_content_close_replace' => '</div>',
620
-        'geodir_top_content_add' => '',
621
-        'geodir_before_main_content_add' => '',
622
-        'geodir_full_page_class_filter' => 'section full-width-section',
623
-        'geodir_before_widget_filter' => '',
624
-        'geodir_after_widget_filter' => '',
625
-        'geodir_before_title_filter' => '<div class="widget-title"><h2>',
626
-        'geodir_after_title_filter' => '</h2></div>',
627
-        'geodir_menu_li_class_filter' => '',
628
-        'geodir_sub_menu_ul_class_filter' => '',
629
-        'geodir_sub_menu_li_class_filter' => '',
630
-        'geodir_menu_a_class_filter' => '',
631
-        'geodir_sub_menu_a_class_filter' => '',
632
-        'geodir_location_switcher_menu_li_class_filter' => '',
633
-        'geodir_location_switcher_menu_a_class_filter' => '',
634
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
635
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
636
-        '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}'),
637
-        '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"})});',
638
-        'geodir_theme_compat_default_options' => '',
639
-        'geodir_theme_compat_code' => 'Multi_News'
640
-    );
641
-
642
-    update_option('gd_theme_compats', $theme_compat);
643
-
644
-    gd_set_theme_compat();// set the compat pack if avail
595
+	$theme_compat['Multi_News'] = array(
596
+		'geodir_wrapper_open_id' => '',
597
+		'geodir_wrapper_open_class' => 'main-container clearfix',
598
+		'geodir_wrapper_open_replace' => '',
599
+		'geodir_wrapper_close_replace' => '',
600
+		'geodir_wrapper_content_open_id' => '',
601
+		'geodir_wrapper_content_open_class' => '',
602
+		'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
603
+		'geodir_wrapper_content_close_replace' => '</div></div></div>',
604
+		'geodir_article_open_id' => '',
605
+		'geodir_article_open_class' => '',
606
+		'geodir_article_open_replace' => '',
607
+		'geodir_article_close_replace' => '',
608
+		'geodir_sidebar_right_open_id' => '',
609
+		'geodir_sidebar_right_open_class' => '',
610
+		'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
611
+		'geodir_sidebar_right_close_replace' => '',
612
+		'geodir_sidebar_left_open_id' => '',
613
+		'geodir_sidebar_left_open_class' => '',
614
+		'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
615
+		'geodir_sidebar_left_close_replace' => '',
616
+		'geodir_main_content_open_id' => '',
617
+		'geodir_main_content_open_class' => '',
618
+		'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
619
+		'geodir_main_content_close_replace' => '</div>',
620
+		'geodir_top_content_add' => '',
621
+		'geodir_before_main_content_add' => '',
622
+		'geodir_full_page_class_filter' => 'section full-width-section',
623
+		'geodir_before_widget_filter' => '',
624
+		'geodir_after_widget_filter' => '',
625
+		'geodir_before_title_filter' => '<div class="widget-title"><h2>',
626
+		'geodir_after_title_filter' => '</h2></div>',
627
+		'geodir_menu_li_class_filter' => '',
628
+		'geodir_sub_menu_ul_class_filter' => '',
629
+		'geodir_sub_menu_li_class_filter' => '',
630
+		'geodir_menu_a_class_filter' => '',
631
+		'geodir_sub_menu_a_class_filter' => '',
632
+		'geodir_location_switcher_menu_li_class_filter' => '',
633
+		'geodir_location_switcher_menu_a_class_filter' => '',
634
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
635
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
636
+		'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}'),
637
+		'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"})});',
638
+		'geodir_theme_compat_default_options' => '',
639
+		'geodir_theme_compat_code' => 'Multi_News'
640
+	);
641
+
642
+	update_option('gd_theme_compats', $theme_compat);
643
+
644
+	gd_set_theme_compat();// set the compat pack if avail
645 645
 }
646 646
 
647 647
 
@@ -653,61 +653,61 @@  discard block
 block discarded – undo
653 653
  * @global object $wpdb WordPress Database object.
654 654
  */
655 655
 function gd_convert_virtual_pages(){
656
-    global $wpdb;
657
-
658
-    // Update the add listing page settings
659
-    $add_listing_page = $wpdb->get_var(
660
-        $wpdb->prepare(
661
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
662
-            array('add-listing')
663
-        )
664
-    );
665
-
666
-    if($add_listing_page){
667
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
668
-        update_option( 'geodir_add_listing_page', $add_listing_page);
669
-    }
670
-
671
-    // Update the listing preview page settings
672
-    $listing_preview_page = $wpdb->get_var(
673
-        $wpdb->prepare(
674
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
675
-            array('listing-preview')
676
-        )
677
-    );
678
-
679
-    if($listing_preview_page){
680
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
681
-        update_option( 'geodir_preview_page', $listing_preview_page);
682
-    }
683
-
684
-    // Update the listing success page settings
685
-    $listing_success_page = $wpdb->get_var(
686
-        $wpdb->prepare(
687
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
688
-            array('listing-success')
689
-        )
690
-    );
691
-
692
-    if($listing_success_page){
693
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
694
-        update_option( 'geodir_success_page', $listing_success_page);
695
-    }
696
-
697
-    // Update the listing success page settings
698
-    $location_page = $wpdb->get_var(
699
-        $wpdb->prepare(
700
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
701
-            array('location')
702
-        )
703
-    );
704
-
705
-    if($location_page){
706
-        $location_slug = get_option('geodir_location_prefix');
707
-        if(!$location_slug ){$location_slug  = 'location';}
708
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
709
-        update_option( 'geodir_location_page', $location_page);
710
-    }
656
+	global $wpdb;
657
+
658
+	// Update the add listing page settings
659
+	$add_listing_page = $wpdb->get_var(
660
+		$wpdb->prepare(
661
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
662
+			array('add-listing')
663
+		)
664
+	);
665
+
666
+	if($add_listing_page){
667
+		wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
668
+		update_option( 'geodir_add_listing_page', $add_listing_page);
669
+	}
670
+
671
+	// Update the listing preview page settings
672
+	$listing_preview_page = $wpdb->get_var(
673
+		$wpdb->prepare(
674
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
675
+			array('listing-preview')
676
+		)
677
+	);
678
+
679
+	if($listing_preview_page){
680
+		wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
681
+		update_option( 'geodir_preview_page', $listing_preview_page);
682
+	}
683
+
684
+	// Update the listing success page settings
685
+	$listing_success_page = $wpdb->get_var(
686
+		$wpdb->prepare(
687
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
688
+			array('listing-success')
689
+		)
690
+	);
691
+
692
+	if($listing_success_page){
693
+		wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
694
+		update_option( 'geodir_success_page', $listing_success_page);
695
+	}
696
+
697
+	// Update the listing success page settings
698
+	$location_page = $wpdb->get_var(
699
+		$wpdb->prepare(
700
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
701
+			array('location')
702
+		)
703
+	);
704
+
705
+	if($location_page){
706
+		$location_slug = get_option('geodir_location_prefix');
707
+		if(!$location_slug ){$location_slug  = 'location';}
708
+		wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
709
+		update_option( 'geodir_location_page', $location_page);
710
+	}
711 711
 
712 712
 }
713 713
 
@@ -721,31 +721,31 @@  discard block
 block discarded – undo
721 721
 function gd_fix_cpt_rewrite_slug()
722 722
 {
723 723
 
724
-    $alt_post_types = array();
725
-    $post_types = get_option('geodir_post_types');
724
+	$alt_post_types = array();
725
+	$post_types = get_option('geodir_post_types');
726 726
 
727 727
 
728
-    if (is_array($post_types)){
728
+	if (is_array($post_types)){
729 729
 
730
-        foreach ($post_types as $post_type => $args) {
730
+		foreach ($post_types as $post_type => $args) {
731 731
 
732 732
 
733
-            if(isset($args['rewrite']['slug'])){
734
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
735
-            }
733
+			if(isset($args['rewrite']['slug'])){
734
+				$args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
735
+			}
736 736
 
737
-                $alt_post_types[$post_type] = $args;
737
+				$alt_post_types[$post_type] = $args;
738 738
 
739
-        }
740
-    }
739
+		}
740
+	}
741 741
 
742
-    if(!empty($alt_post_types)) {
743
-        update_option('geodir_post_types',$alt_post_types);
744
-        }
742
+	if(!empty($alt_post_types)) {
743
+		update_option('geodir_post_types',$alt_post_types);
744
+		}
745 745
 
746 746
 
747
-    // flush the rewrite rules
748
-    flush_rewrite_rules();
747
+	// flush the rewrite rules
748
+	flush_rewrite_rules();
749 749
 }
750 750
 
751 751
 
@@ -758,18 +758,18 @@  discard block
 block discarded – undo
758 758
  */
759 759
 function gd_fix_address_detail_table_limit()
760 760
 {
761
-    global $wpdb;
762
-
763
-    $all_postypes = geodir_get_posttypes();
764
-
765
-    if (!empty($all_postypes)) {
766
-        foreach ($all_postypes as $key) {
767
-            // update each GD CTP
768
-            try {
769
-                $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");
770
-            } catch(Exception $e) {
771
-                error_log( 'Error: ' . $e->getMessage() );
772
-            }
773
-        }
774
-    }
761
+	global $wpdb;
762
+
763
+	$all_postypes = geodir_get_posttypes();
764
+
765
+	if (!empty($all_postypes)) {
766
+		foreach ($all_postypes as $key) {
767
+			// update each GD CTP
768
+			try {
769
+				$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");
770
+			} catch(Exception $e) {
771
+				error_log( 'Error: ' . $e->getMessage() );
772
+			}
773
+		}
774
+	}
775 775
 }
Please login to merge, or discard this patch.
geodirectory-admin/admin_db_install.php 2 patches
Indentation   +295 added lines, -295 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 if (!function_exists('geodir_create_tables')) {
9
-    /**
10
-     * Creates custom db tables for storing GeoDirectory plugin data.
11
-     *
12
-     * @since 1.0.0
13
-     * @package GeoDirectory
14
-     * @global object $wpdb WordPress Database object.
15
-     * @global string $plugin_prefix GeoDirectory plugin table prefix.
16
-     */
17
-    function geodir_create_tables()
18
-    {
19
-
20
-        global $wpdb, $plugin_prefix;
21
-
22
-        $wpdb->hide_errors();
23
-
24
-        $collate = '';
25
-        if ($wpdb->has_cap('collation')) {
26
-            if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset";
27
-            if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
28
-        }
9
+	/**
10
+	 * Creates custom db tables for storing GeoDirectory plugin data.
11
+	 *
12
+	 * @since 1.0.0
13
+	 * @package GeoDirectory
14
+	 * @global object $wpdb WordPress Database object.
15
+	 * @global string $plugin_prefix GeoDirectory plugin table prefix.
16
+	 */
17
+	function geodir_create_tables()
18
+	{
19
+
20
+		global $wpdb, $plugin_prefix;
21
+
22
+		$wpdb->hide_errors();
23
+
24
+		$collate = '';
25
+		if ($wpdb->has_cap('collation')) {
26
+			if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset";
27
+			if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
28
+		}
29 29
 
30 30
 		/**
31 31
 		 * Include any functions needed for upgrades.
@@ -36,31 +36,31 @@  discard block
 block discarded – undo
36 36
 
37 37
 
38 38
 // rename tables if we need to
39
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_countries'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_countries'") == 0) {
40
-            $wpdb->query("RENAME TABLE geodir_countries TO " . $wpdb->prefix . "geodir_countries");
41
-        }
42
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_fields'") == 0) {
43
-            $wpdb->query("RENAME TABLE geodir_custom_fields TO " . $wpdb->prefix . "geodir_custom_fields");
44
-        }
45
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_icon'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_icon'") == 0) {
46
-            $wpdb->query("RENAME TABLE geodir_post_icon TO " . $wpdb->prefix . "geodir_post_icon");
47
-        }
48
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_attachments'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_attachments'") == 0) {
49
-            $wpdb->query("RENAME TABLE geodir_attachments TO " . $wpdb->prefix . "geodir_attachments");
50
-        }
51
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_review'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_review'") == 0) {
52
-            $wpdb->query("RENAME TABLE geodir_post_review TO " . $wpdb->prefix . "geodir_post_review");
53
-        }
54
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_sort_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_sort_fields'") == 0) {
55
-            $wpdb->query("RENAME TABLE geodir_custom_sort_fields TO " . $wpdb->prefix . "geodir_custom_sort_fields");
56
-        }
57
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_gd_place_detail'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_gd_place_detail'") == 0) {
58
-            $wpdb->query("RENAME TABLE geodir_gd_place_detail TO " . $wpdb->prefix . "geodir_gd_place_detail");
59
-        }
60
-
61
-
62
-        // Table for storing Countries
63
-        $GEODIR_COUNTRIES_TABLE = "CREATE TABLE " . GEODIR_COUNTRIES_TABLE . " (
39
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_countries'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_countries'") == 0) {
40
+			$wpdb->query("RENAME TABLE geodir_countries TO " . $wpdb->prefix . "geodir_countries");
41
+		}
42
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_fields'") == 0) {
43
+			$wpdb->query("RENAME TABLE geodir_custom_fields TO " . $wpdb->prefix . "geodir_custom_fields");
44
+		}
45
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_icon'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_icon'") == 0) {
46
+			$wpdb->query("RENAME TABLE geodir_post_icon TO " . $wpdb->prefix . "geodir_post_icon");
47
+		}
48
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_attachments'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_attachments'") == 0) {
49
+			$wpdb->query("RENAME TABLE geodir_attachments TO " . $wpdb->prefix . "geodir_attachments");
50
+		}
51
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_review'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_review'") == 0) {
52
+			$wpdb->query("RENAME TABLE geodir_post_review TO " . $wpdb->prefix . "geodir_post_review");
53
+		}
54
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_sort_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_sort_fields'") == 0) {
55
+			$wpdb->query("RENAME TABLE geodir_custom_sort_fields TO " . $wpdb->prefix . "geodir_custom_sort_fields");
56
+		}
57
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_gd_place_detail'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_gd_place_detail'") == 0) {
58
+			$wpdb->query("RENAME TABLE geodir_gd_place_detail TO " . $wpdb->prefix . "geodir_gd_place_detail");
59
+		}
60
+
61
+
62
+		// Table for storing Countries
63
+		$GEODIR_COUNTRIES_TABLE = "CREATE TABLE " . GEODIR_COUNTRIES_TABLE . " (
64 64
 						CountryId smallint AUTO_INCREMENT NOT NULL ,
65 65
 						Country varchar (50) NOT NULL ,
66 66
 						FIPS104 varchar (2) NOT NULL ,
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
 						Comment varchar (255) NULL ,
80 80
 						PRIMARY KEY  (CountryId)) $collate ";
81 81
 
82
-        /**
83
-         * Filter the SQL query that creates/updates the country DB table structure.
84
-         *
85
-         * @since 1.0.0
86
-         * @param string $sql The SQL insert query string.
87
-         */
88
-        $GEODIR_COUNTRIES_TABLE = apply_filters('geodir_before_country_table_create', $GEODIR_COUNTRIES_TABLE);
89
-        dbDelta($GEODIR_COUNTRIES_TABLE);
82
+		/**
83
+		 * Filter the SQL query that creates/updates the country DB table structure.
84
+		 *
85
+		 * @since 1.0.0
86
+		 * @param string $sql The SQL insert query string.
87
+		 */
88
+		$GEODIR_COUNTRIES_TABLE = apply_filters('geodir_before_country_table_create', $GEODIR_COUNTRIES_TABLE);
89
+		dbDelta($GEODIR_COUNTRIES_TABLE);
90 90
 
91 91
 
92
-        $country_table_empty = $wpdb->get_var("SELECT COUNT(CountryId) FROM " . GEODIR_COUNTRIES_TABLE . "");
92
+		$country_table_empty = $wpdb->get_var("SELECT COUNT(CountryId) FROM " . GEODIR_COUNTRIES_TABLE . "");
93 93
 
94
-        if ($country_table_empty == 0) {
94
+		if ($country_table_empty == 0) {
95 95
 
96
-            $countries_insert = "INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (`CountryId`, `Country`, `FIPS104`, `ISO2`, `ISO3`, `ISON`, `Internet`, `Capital`, `MapReference`, `NationalitySingular`, `NationalityPlural`, `Currency`, `CurrencyCode`, `Population`, `Title`, `COMMENT`) VALUES
96
+			$countries_insert = "INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (`CountryId`, `Country`, `FIPS104`, `ISO2`, `ISO3`, `ISON`, `Internet`, `Capital`, `MapReference`, `NationalitySingular`, `NationalityPlural`, `Currency`, `CurrencyCode`, `Population`, `Title`, `COMMENT`) VALUES
97 97
 	(1, 'Afghanistan', 'AF', 'AF', 'AFG', '4', 'AF', 'Kabul ', 'Asia ', 'Afghan', 'Afghans', 'Afghani ', 'AFA', 26813057, 'Afghanistan', ''),
98 98
 	(2, 'Albania', 'AL', 'AL', 'ALB', '8', 'AL', 'Tirana ', 'Europe ', 'Albanian', 'Albanians', 'Lek ', 'ALL', 3510484, 'Albania', ''),
99 99
 	(3, 'Algeria', 'AG', 'DZ', 'DZA', '12', 'DZ', 'Algiers ', 'Africa ', 'Algerian', 'Algerians', 'Algerian Dinar ', 'DZD', 31736053, 'Algeria', ''),
@@ -367,21 +367,21 @@  discard block
 block discarded – undo
367 367
 	(276, 'Curaçao', 'UC', 'CW', 'CUW', '531', 'CW', 'Willemstad ', 'Central America and the Caribbean', 'Curaçaoan', 'Curaçaoans', 'Netherlands Antillean guilder', 'ANG', 152760, 'Curaçao', ''),
368 368
 	(277, 'Caribbean Netherlands', '--', 'BQ', 'BES', '535', 'BQ', '--', 'Central America and the Caribbean', '--', '--', 'United States dollar', 'USD', 21133, 'Caribbean Netherlands', '')";
369 369
 
370
-            /**
371
-             * Filter the SQL query that inserts the country DB table data.
372
-             *
373
-             * @since 1.0.0
374
-             * @param string $sql The SQL insert query string.
375
-             */
376
-            $countries_insert = apply_filters('geodir_before_country_data_insert', $countries_insert);
377
-            $wpdb->query($countries_insert);
370
+			/**
371
+			 * Filter the SQL query that inserts the country DB table data.
372
+			 *
373
+			 * @since 1.0.0
374
+			 * @param string $sql The SQL insert query string.
375
+			 */
376
+			$countries_insert = apply_filters('geodir_before_country_data_insert', $countries_insert);
377
+			$wpdb->query($countries_insert);
378 378
 
379
-        }
379
+		}
380 380
 
381 381
 
382
-        // Table for storing location attribute - these are user defined
382
+		// Table for storing location attribute - these are user defined
383 383
 
384
-        $icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " (
384
+		$icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " (
385 385
 						id int NOT NULL AUTO_INCREMENT,
386 386
 						post_id int( 10 ) NOT NULL,
387 387
 						post_title varchar(254) NOT NULL,
@@ -390,19 +390,19 @@  discard block
 block discarded – undo
390 390
 						PRIMARY KEY  (id)
391 391
 						) $collate ";
392 392
 
393
-        /**
394
-         * Filter the SQL query that creates/updates the post_icon DB table structure.
395
-         *
396
-         * @since 1.0.0
397
-         * @param string $sql The SQL insert query string.
398
-         */
399
-        $icon_table = apply_filters('geodir_before_icon_table_create', $icon_table);
393
+		/**
394
+		 * Filter the SQL query that creates/updates the post_icon DB table structure.
395
+		 *
396
+		 * @since 1.0.0
397
+		 * @param string $sql The SQL insert query string.
398
+		 */
399
+		$icon_table = apply_filters('geodir_before_icon_table_create', $icon_table);
400 400
 
401
-        dbDelta($icon_table);
401
+		dbDelta($icon_table);
402 402
 
403
-        // Table for storing post custom fields - these are user defined
403
+		// Table for storing post custom fields - these are user defined
404 404
 
405
-        $post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " (
405
+		$post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " (
406 406
 							  id int(11) NOT NULL AUTO_INCREMENT,
407 407
 							  post_type varchar(100) NULL,
408 408
 							  data_type varchar(100) NULL DEFAULT NULL,
@@ -436,18 +436,18 @@  discard block
 block discarded – undo
436 436
 							  PRIMARY KEY  (id)
437 437
 							  ) $collate";
438 438
 
439
-        /**
440
-         * Filter the SQL query that creates/updates the custom_fields DB table structure.
441
-         *
442
-         * @since 1.0.0
443
-         * @param string $sql The SQL insert query string.
444
-         */
445
-        $post_custom_fields = apply_filters('geodir_before_custom_field_table_create', $post_custom_fields);
439
+		/**
440
+		 * Filter the SQL query that creates/updates the custom_fields DB table structure.
441
+		 *
442
+		 * @since 1.0.0
443
+		 * @param string $sql The SQL insert query string.
444
+		 */
445
+		$post_custom_fields = apply_filters('geodir_before_custom_field_table_create', $post_custom_fields);
446 446
 
447
-        dbDelta($post_custom_fields);
447
+		dbDelta($post_custom_fields);
448 448
 
449
-        // Table for storing place attribute - these are user defined
450
-        $post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail (
449
+		// Table for storing place attribute - these are user defined
450
+		$post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail (
451 451
 						post_id int(11) NOT NULL,
452 452
 						post_title text NULL DEFAULT NULL,
453 453
 						post_status varchar(20) NULL DEFAULT NULL,
@@ -473,22 +473,22 @@  discard block
 block discarded – undo
473 473
 						PRIMARY KEY  (post_id)
474 474
 						) $collate ";
475 475
 
476
-        /**
477
-         * Filter the SQL query that creates/updates the post_detail DB table structure.
478
-         *
479
-         * @since 1.0.0
480
-         * @param string $sql The SQL insert query string.
481
-         */
482
-        $post_detail = apply_filters('geodir_before_post_detail_table_create', $post_detail);
476
+		/**
477
+		 * Filter the SQL query that creates/updates the post_detail DB table structure.
478
+		 *
479
+		 * @since 1.0.0
480
+		 * @param string $sql The SQL insert query string.
481
+		 */
482
+		$post_detail = apply_filters('geodir_before_post_detail_table_create', $post_detail);
483 483
 
484
-        dbDelta($post_detail);
484
+		dbDelta($post_detail);
485 485
 
486
-        // alter post_title
487
-        //$wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_gd_place_detail MODIFY `post_title` text NULL");
486
+		// alter post_title
487
+		//$wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_gd_place_detail MODIFY `post_title` text NULL");
488 488
 
489
-        // Table for storing place images - these are user defined
489
+		// Table for storing place images - these are user defined
490 490
 
491
-        $attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " (
491
+		$attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " (
492 492
 						ID int(11) NOT NULL AUTO_INCREMENT,
493 493
 						post_id int(11) NOT NULL,
494 494
 						user_id int(11) DEFAULT NULL,
@@ -504,18 +504,18 @@  discard block
 block discarded – undo
504 504
 						PRIMARY KEY  (ID)
505 505
 						) $collate ";
506 506
 
507
-        /**
508
-         * Filter the SQL query that creates/updates the attachments DB table structure.
509
-         *
510
-         * @since 1.0.0
511
-         * @param string $sql The SQL insert query string.
512
-         */
513
-        $attechment_table = apply_filters('geodir_before_attachment_table_create', $attechment_table);
507
+		/**
508
+		 * Filter the SQL query that creates/updates the attachments DB table structure.
509
+		 *
510
+		 * @since 1.0.0
511
+		 * @param string $sql The SQL insert query string.
512
+		 */
513
+		$attechment_table = apply_filters('geodir_before_attachment_table_create', $attechment_table);
514 514
 
515
-        dbDelta($attechment_table);
515
+		dbDelta($attechment_table);
516 516
 
517 517
 
518
-        $custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " (
518
+		$custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " (
519 519
 			id int(11) NOT NULL AUTO_INCREMENT,
520 520
 			post_type varchar(255) NOT NULL,
521 521
 			data_type varchar(255) NOT NULL,
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
 			PRIMARY KEY  (id)
534 534
 			) $collate ";
535 535
 
536
-        /**
537
-         * Filter the SQL query that creates/updates the custom_sort_fields DB table structure.
538
-         *
539
-         * @since 1.0.0
540
-         * @param string $sql The SQL insert query string.
541
-         */
542
-        $custom_sort_fields_table = apply_filters('geodir_before_sort_fields_table_create', $custom_sort_fields_table);
536
+		/**
537
+		 * Filter the SQL query that creates/updates the custom_sort_fields DB table structure.
538
+		 *
539
+		 * @since 1.0.0
540
+		 * @param string $sql The SQL insert query string.
541
+		 */
542
+		$custom_sort_fields_table = apply_filters('geodir_before_sort_fields_table_create', $custom_sort_fields_table);
543 543
 
544
-        dbDelta($custom_sort_fields_table);
544
+		dbDelta($custom_sort_fields_table);
545 545
 
546 546
 
547
-            $review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " (
547
+			$review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " (
548 548
 			id int(11) NOT NULL AUTO_INCREMENT,
549 549
 			post_id int(11) DEFAULT NULL,
550 550
 			post_title varchar( 255 ) NULL DEFAULT NULL,
@@ -568,191 +568,191 @@  discard block
 block discarded – undo
568 568
 			PRIMARY KEY  (id)
569 569
 			) $collate  ";
570 570
 
571
-            /**
572
-             * Filter the SQL query that creates the review DB table structure.
573
-             *
574
-             * @since 1.0.0
575
-             * @param string $sql The SQL insert query string.
576
-             */
577
-            $review_table = apply_filters('geodir_before_review_table_create', $review_table);
578
-            dbDelta($review_table);
571
+			/**
572
+			 * Filter the SQL query that creates the review DB table structure.
573
+			 *
574
+			 * @since 1.0.0
575
+			 * @param string $sql The SQL insert query string.
576
+			 */
577
+			$review_table = apply_filters('geodir_before_review_table_create', $review_table);
578
+			dbDelta($review_table);
579 579
 
580 580
 
581 581
 
582
-        // Alter terms table
583
-        $term_icon_column = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->terms where field='term_icon'");
584
-        if (!$term_icon_column) {
585
-            $wpdb->query("ALTER TABLE $wpdb->terms ADD `term_icon` TEXT NULL DEFAULT NULL");
586
-        }
582
+		// Alter terms table
583
+		$term_icon_column = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->terms where field='term_icon'");
584
+		if (!$term_icon_column) {
585
+			$wpdb->query("ALTER TABLE $wpdb->terms ADD `term_icon` TEXT NULL DEFAULT NULL");
586
+		}
587 587
 
588
-        //require_once(geodir_plugin_path() . '/upgrade.php');
588
+		//require_once(geodir_plugin_path() . '/upgrade.php');
589 589
 
590 590
 
591
-    }
591
+	}
592 592
 } // END MAIN FUNCTION geodir_tables_install
593 593
 
594 594
 if (!function_exists('geodir_create_default_fields')) {
595
-    /**
596
-     * Inserts default custom fields table data into database.
597
-     *
598
-     * @since 1.0.0
599
-     * @package GeoDirectory
600
-     */
601
-    function geodir_create_default_fields()
602
-    {
603
-
604
-        $fields = array();
605
-
606
-        $fields[] = array('listing_type' => 'gd_place',
607
-            'data_type' => 'VARCHAR',
608
-            'field_type' => 'taxonomy',
609
-            'admin_title' => __('Category', 'geodirectory'),
610
-            'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
611
-            'site_title' => __('Category', 'geodirectory'),
612
-            'htmlvar_name' => 'gd_placecategory',
613
-            'default_value' => '',
614
-            'is_default' => '1',
615
-            'is_admin' => '1',
616
-            'is_required' => '1',
617
-            'clabels' => __('Category', 'geodirectory'));
618
-
619
-        $fields[] = array('listing_type' => 'gd_place',
620
-            'data_type' => 'VARCHAR',
621
-            'field_type' => 'address',
622
-            'admin_title' => __('Address', 'geodirectory'),
623
-            'admin_desc' => ADDRESS_MSG,
624
-            'site_title' => __('Address', 'geodirectory'),
625
-            'htmlvar_name' => 'post',
626
-            'default_value' => '',
627
-            'option_values' => '',
628
-            'is_default' => '1',
629
-            'is_admin' => '1',
630
-            'is_required' => '1',
631
-            'required_msg' => __('Address fields are required', 'geodirectory'),
632
-            'clabels' => __('Address', 'geodirectory'),
633
-            'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
634
-                'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
635
-                'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
636
-                'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
637
-                'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
638
-                'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
639
-                'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
640
-                'show_latlng' => 1));
641
-
642
-        $fields[] = array('listing_type' => 'gd_place',
643
-            'data_type' => 'VARCHAR',
644
-            'field_type' => 'text',
645
-            'admin_title' => __('Time', 'geodirectory'),
646
-            'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
647
-            'site_title' => __('Time', 'geodirectory'),
648
-            'htmlvar_name' => 'timing',
649
-            'default_value' => '',
650
-            'option_values' => '',
651
-            'is_default' => '1',
652
-            'is_admin' => '1',
653
-            'clabels' => __('Time', 'geodirectory'));
654
-
655
-        $fields[] = array('listing_type' => 'gd_place',
656
-            'data_type' => 'VARCHAR',
657
-            'field_type' => 'phone',
658
-            'admin_title' => __('Phone', 'geodirectory'),
659
-            'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
660
-            'site_title' => __('Phone', 'geodirectory'),
661
-            'htmlvar_name' => 'contact',
662
-            'default_value' => '',
663
-            'option_values' => '',
664
-            'is_default' => '1',
665
-            'is_admin' => '1',
666
-            'clabels' => __('Phone', 'geodirectory'));
667
-
668
-        $fields[] = array('listing_type' => 'gd_place',
669
-            'data_type' => 'VARCHAR',
670
-            'field_type' => 'email',
671
-            'admin_title' => __('Email', 'geodirectory'),
672
-            'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
673
-            'site_title' => __('Email', 'geodirectory'),
674
-            'htmlvar_name' => 'email',
675
-            'default_value' => '',
676
-            'option_values' => '',
677
-            'is_default' => '1',
678
-            'is_admin' => '1',
679
-            'clabels' => __('Email', 'geodirectory'));
680
-
681
-        $fields[] = array('listing_type' => 'gd_place',
682
-            'data_type' => 'VARCHAR',
683
-            'field_type' => 'url',
684
-            'admin_title' => __('Website', 'geodirectory'),
685
-            'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
686
-            'site_title' => __('Website', 'geodirectory'),
687
-            'htmlvar_name' => 'website',
688
-            'default_value' => '',
689
-            'option_values' => '',
690
-            'is_default' => '1',
691
-            'is_admin' => '1',
692
-            'clabels' => __('Website', 'geodirectory'));
693
-
694
-        $fields[] = array('listing_type' => 'gd_place',
695
-            'data_type' => 'VARCHAR',
696
-            'field_type' => 'url',
697
-            'admin_title' => __('Twitter', 'geodirectory'),
698
-            'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
699
-            'site_title' => __('Twitter', 'geodirectory'),
700
-            'htmlvar_name' => 'twitter',
701
-            'default_value' => '',
702
-            'option_values' => '',
703
-            'is_default' => '1',
704
-            'is_admin' => '1',
705
-            'clabels' => __('Twitter', 'geodirectory'));
706
-
707
-        $fields[] = array('listing_type' => 'gd_place',
708
-            'data_type' => 'VARCHAR',
709
-            'field_type' => 'url',
710
-            'admin_title' => __('Facebook', 'geodirectory'),
711
-            'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
712
-            'site_title' => __('Facebook', 'geodirectory'),
713
-            'htmlvar_name' => 'facebook',
714
-            'default_value' => '',
715
-            'option_values' => '',
716
-            'is_default' => '1',
717
-            'is_admin' => '1',
718
-            'clabels' => __('Facebook', 'geodirectory'));
719
-
720
-        $fields[] = array('listing_type' => 'gd_place',
721
-            'data_type' => 'TEXT',
722
-            'field_type' => 'textarea',
723
-            'admin_title' => __('Video', 'geodirectory'),
724
-            'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
725
-            'site_title' => __('Video', 'geodirectory'),
726
-            'htmlvar_name' => 'video',
727
-            'default_value' => '',
728
-            'option_values' => '',
729
-            'is_default' => '0',
730
-            'is_admin' => '1',
731
-            'clabels' => __('Video', 'geodirectory'));
732
-
733
-        $fields[] = array('listing_type' => 'gd_place',
734
-            'data_type' => 'TEXT',
735
-            'field_type' => 'textarea',
736
-            'admin_title' => __('Special Offers', 'geodirectory'),
737
-            'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
738
-            'site_title' => __('Special Offers', 'geodirectory'),
739
-            'htmlvar_name' => 'special_offers',
740
-            'default_value' => '',
741
-            'option_values' => '',
742
-            'is_default' => '0',
743
-            'is_admin' => '1',
744
-            'clabels' => __('Special Offers', 'geodirectory'));
745
-
746
-        /**
747
-         * Filter the array of default custom fields DB table data.
748
-         *
749
-         * @since 1.0.0
750
-         * @param string $fields The default custom fields as an array.
751
-         */
752
-        $fields = apply_filters('geodir_before_default_custom_fields_saved', $fields);
753
-        foreach ($fields as $field_index => $field) {
754
-            geodir_custom_field_save($field);
755
-
756
-        }
757
-    }
595
+	/**
596
+	 * Inserts default custom fields table data into database.
597
+	 *
598
+	 * @since 1.0.0
599
+	 * @package GeoDirectory
600
+	 */
601
+	function geodir_create_default_fields()
602
+	{
603
+
604
+		$fields = array();
605
+
606
+		$fields[] = array('listing_type' => 'gd_place',
607
+			'data_type' => 'VARCHAR',
608
+			'field_type' => 'taxonomy',
609
+			'admin_title' => __('Category', 'geodirectory'),
610
+			'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
611
+			'site_title' => __('Category', 'geodirectory'),
612
+			'htmlvar_name' => 'gd_placecategory',
613
+			'default_value' => '',
614
+			'is_default' => '1',
615
+			'is_admin' => '1',
616
+			'is_required' => '1',
617
+			'clabels' => __('Category', 'geodirectory'));
618
+
619
+		$fields[] = array('listing_type' => 'gd_place',
620
+			'data_type' => 'VARCHAR',
621
+			'field_type' => 'address',
622
+			'admin_title' => __('Address', 'geodirectory'),
623
+			'admin_desc' => ADDRESS_MSG,
624
+			'site_title' => __('Address', 'geodirectory'),
625
+			'htmlvar_name' => 'post',
626
+			'default_value' => '',
627
+			'option_values' => '',
628
+			'is_default' => '1',
629
+			'is_admin' => '1',
630
+			'is_required' => '1',
631
+			'required_msg' => __('Address fields are required', 'geodirectory'),
632
+			'clabels' => __('Address', 'geodirectory'),
633
+			'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
634
+				'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
635
+				'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
636
+				'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
637
+				'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
638
+				'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
639
+				'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
640
+				'show_latlng' => 1));
641
+
642
+		$fields[] = array('listing_type' => 'gd_place',
643
+			'data_type' => 'VARCHAR',
644
+			'field_type' => 'text',
645
+			'admin_title' => __('Time', 'geodirectory'),
646
+			'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
647
+			'site_title' => __('Time', 'geodirectory'),
648
+			'htmlvar_name' => 'timing',
649
+			'default_value' => '',
650
+			'option_values' => '',
651
+			'is_default' => '1',
652
+			'is_admin' => '1',
653
+			'clabels' => __('Time', 'geodirectory'));
654
+
655
+		$fields[] = array('listing_type' => 'gd_place',
656
+			'data_type' => 'VARCHAR',
657
+			'field_type' => 'phone',
658
+			'admin_title' => __('Phone', 'geodirectory'),
659
+			'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
660
+			'site_title' => __('Phone', 'geodirectory'),
661
+			'htmlvar_name' => 'contact',
662
+			'default_value' => '',
663
+			'option_values' => '',
664
+			'is_default' => '1',
665
+			'is_admin' => '1',
666
+			'clabels' => __('Phone', 'geodirectory'));
667
+
668
+		$fields[] = array('listing_type' => 'gd_place',
669
+			'data_type' => 'VARCHAR',
670
+			'field_type' => 'email',
671
+			'admin_title' => __('Email', 'geodirectory'),
672
+			'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
673
+			'site_title' => __('Email', 'geodirectory'),
674
+			'htmlvar_name' => 'email',
675
+			'default_value' => '',
676
+			'option_values' => '',
677
+			'is_default' => '1',
678
+			'is_admin' => '1',
679
+			'clabels' => __('Email', 'geodirectory'));
680
+
681
+		$fields[] = array('listing_type' => 'gd_place',
682
+			'data_type' => 'VARCHAR',
683
+			'field_type' => 'url',
684
+			'admin_title' => __('Website', 'geodirectory'),
685
+			'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
686
+			'site_title' => __('Website', 'geodirectory'),
687
+			'htmlvar_name' => 'website',
688
+			'default_value' => '',
689
+			'option_values' => '',
690
+			'is_default' => '1',
691
+			'is_admin' => '1',
692
+			'clabels' => __('Website', 'geodirectory'));
693
+
694
+		$fields[] = array('listing_type' => 'gd_place',
695
+			'data_type' => 'VARCHAR',
696
+			'field_type' => 'url',
697
+			'admin_title' => __('Twitter', 'geodirectory'),
698
+			'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
699
+			'site_title' => __('Twitter', 'geodirectory'),
700
+			'htmlvar_name' => 'twitter',
701
+			'default_value' => '',
702
+			'option_values' => '',
703
+			'is_default' => '1',
704
+			'is_admin' => '1',
705
+			'clabels' => __('Twitter', 'geodirectory'));
706
+
707
+		$fields[] = array('listing_type' => 'gd_place',
708
+			'data_type' => 'VARCHAR',
709
+			'field_type' => 'url',
710
+			'admin_title' => __('Facebook', 'geodirectory'),
711
+			'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
712
+			'site_title' => __('Facebook', 'geodirectory'),
713
+			'htmlvar_name' => 'facebook',
714
+			'default_value' => '',
715
+			'option_values' => '',
716
+			'is_default' => '1',
717
+			'is_admin' => '1',
718
+			'clabels' => __('Facebook', 'geodirectory'));
719
+
720
+		$fields[] = array('listing_type' => 'gd_place',
721
+			'data_type' => 'TEXT',
722
+			'field_type' => 'textarea',
723
+			'admin_title' => __('Video', 'geodirectory'),
724
+			'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
725
+			'site_title' => __('Video', 'geodirectory'),
726
+			'htmlvar_name' => 'video',
727
+			'default_value' => '',
728
+			'option_values' => '',
729
+			'is_default' => '0',
730
+			'is_admin' => '1',
731
+			'clabels' => __('Video', 'geodirectory'));
732
+
733
+		$fields[] = array('listing_type' => 'gd_place',
734
+			'data_type' => 'TEXT',
735
+			'field_type' => 'textarea',
736
+			'admin_title' => __('Special Offers', 'geodirectory'),
737
+			'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
738
+			'site_title' => __('Special Offers', 'geodirectory'),
739
+			'htmlvar_name' => 'special_offers',
740
+			'default_value' => '',
741
+			'option_values' => '',
742
+			'is_default' => '0',
743
+			'is_admin' => '1',
744
+			'clabels' => __('Special Offers', 'geodirectory'));
745
+
746
+		/**
747
+		 * Filter the array of default custom fields DB table data.
748
+		 *
749
+		 * @since 1.0.0
750
+		 * @param string $fields The default custom fields as an array.
751
+		 */
752
+		$fields = apply_filters('geodir_before_default_custom_fields_saved', $fields);
753
+		foreach ($fields as $field_index => $field) {
754
+			geodir_custom_field_save($field);
755
+
756
+		}
757
+	}
758 758
 }
759 759
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,12 @@
 block discarded – undo
23 23
 
24 24
         $collate = '';
25 25
         if ($wpdb->has_cap('collation')) {
26
-            if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset";
27
-            if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
26
+            if (!empty($wpdb->charset)) {
27
+            	$collate = "DEFAULT CHARACTER SET $wpdb->charset";
28
+            }
29
+            if (!empty($wpdb->collate)) {
30
+            	$collate .= " COLLATE $wpdb->collate";
31
+            }
28 32
         }
29 33
 
30 34
 		/**
Please login to merge, or discard this patch.