Test Failed
Push — master ( 3c40c1...6c0c46 )
by Stiofan
17:37
created
geodirectory-admin/dummy-data/property_rent.php 3 patches
Indentation   +872 added lines, -872 removed lines patch added patch discarded remove patch
@@ -7,452 +7,452 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 function geodir_property_rent_custom_fields($post_type='gd_place',$package_id=''){
10
-    $fields = array();
11
-    $package = ($package_id=='') ? '' : array($package_id);
12
-
13
-    // price
14
-    $fields[] = array('listing_type' => $post_type,
15
-                      'field_type'          =>  'text',
16
-                      'data_type'           =>  'FLOAT',
17
-                      'decimal_point'       =>  '2',
18
-                      'admin_title'         =>  __('Price', 'geodirectory'),
19
-                      'site_title'          =>  __('Price', 'geodirectory'),
20
-                      'admin_desc'          =>  __('Enter the price per calendar month (PCM)in $ (no currency symbol)', 'geodirectory'),
21
-                      'htmlvar_name'        =>  'price',
22
-                      'is_active'           =>  true,
23
-                      'for_admin_use'       =>  false,
24
-                      'default_value'       =>  '',
25
-                      'show_in' 	        =>  '[detail],[listing]',
26
-                      'is_required'         =>  false,
27
-                      'validation_pattern'  =>  addslashes_gpc('\d+(\.\d{2})?'), // add slashes required
28
-                      'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
29
-                      'required_msg'        =>  '',
30
-                      'field_icon'          =>  'fa fa-usd',
31
-                      'css_class'           =>  '',
32
-                      'cat_sort'            =>  true,
33
-                      'cat_filter'	        =>  true,
34
-                      'extra'        =>  array(
35
-                          'is_price'                  =>  1,
36
-                          'thousand_separator'        =>  'comma',
37
-                          'decimal_separator'         =>  'period',
38
-                          'decimal_display'           =>  'if',
39
-                          'currency_symbol'           =>  '$',
40
-                          'currency_symbol_placement' =>  'left'
41
-                      )
42
-    );
43
-
44
-    // property status
45
-    $fields[] = array('listing_type' => $post_type,
46
-                      'data_type' => 'VARCHAR',
47
-                      'field_type' => 'select',
48
-                      'field_type_key' => 'property_status',
49
-                      'is_active' => 1,
50
-                      'for_admin_use' => 0,
51
-                      'is_default' => 0,
52
-                      'admin_title' => __('Property Status', 'geodirectory'),
53
-                      'admin_desc' => __('Enter the status of the property.', 'geodirectory'),
54
-                      'site_title' => __('Property Status', 'geodirectory'),
55
-                      'htmlvar_name' => 'property_status',
56
-                      'default_value' => '',
57
-                      'is_required' => '1',
58
-                      'required_msg' => '',
59
-                      'show_in'   =>  '[detail],[listing]',
60
-                      'show_on_pkg' => $package,
61
-                      'option_values' => 'Select Status/,For Rent,Let,Under Offer',
62
-                      'field_icon' => 'fa fa-home',
63
-                      'css_class' => '',
64
-                      'cat_sort' => 1,
65
-                      'cat_filter' => 1,
66
-    );
67
-
68
-    // property furnishing
69
-    $fields[] = array('listing_type' => $post_type,
70
-                      'field_type'          =>  'select',
71
-                      'data_type'           =>  'VARCHAR',
72
-                      'admin_title'         =>  __('Furnishing', 'geodirectory'),
73
-                      'site_title'          =>  __('Furnishing', 'geodirectory'),
74
-                      'admin_desc'          =>  __('Enter the furnishing status of the property.', 'geodirectory'),
75
-                      'htmlvar_name'        =>  'property_furnishing',
76
-                      'is_active'           =>  true,
77
-                      'for_admin_use'       =>  false,
78
-                      'default_value'       =>  '',
79
-                      'show_in' 	        =>  '[detail],[listing]',
80
-                      'is_required'         =>  true,
81
-                      'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
82
-                      'validation_pattern'  =>  '',
83
-                      'validation_msg'      =>  '',
84
-                      'required_msg'        =>  '',
85
-                      'field_icon'          =>  'fa fa-th-large',
86
-                      'css_class'           =>  '',
87
-                      'cat_sort'            =>  true,
88
-                      'cat_filter'	        =>  true
89
-    );
90
-
91
-    // property type
92
-    $fields[] = array('listing_type' => $post_type,
93
-                      'field_type'          =>  'select',
94
-                      'data_type'           =>  'VARCHAR',
95
-                      'admin_title'         =>  __('Property Type', 'geodirectory'),
96
-                      'site_title'          =>  __('Property Type', 'geodirectory'),
97
-                      'admin_desc'          =>  __('Select the property type.', 'geodirectory'),
98
-                      'htmlvar_name'        =>  'property_type',
99
-                      'is_active'           =>  true,
100
-                      'for_admin_use'       =>  false,
101
-                      'default_value'       =>  '',
102
-                      'show_in' 	        =>  '[detail],[listing]',
103
-                      'is_required'         =>  true,
104
-                      'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage,Hotel,Land','geodirectory'),
105
-                      'validation_pattern'  =>  '',
106
-                      'validation_msg'      =>  '',
107
-                      'required_msg'        =>  '',
108
-                      'field_icon'          =>  'fa fa-home',
109
-                      'css_class'           =>  '',
110
-                      'cat_sort'            =>  true,
111
-                      'cat_filter'	        =>  true
112
-    );
113
-
114
-    // property bedrooms
115
-    $fields[] = array('listing_type' => $post_type,
116
-                      'field_type'          =>  'select',
117
-                      'data_type'           =>  'VARCHAR',
118
-                      'admin_title'         =>  __('Property Bedrooms', 'geodirectory'),
119
-                      'site_title'          =>  __('Bedrooms', 'geodirectory'),
120
-                      'admin_desc'          =>  __('Select the number of bedrooms', 'geodirectory'),
121
-                      'htmlvar_name'        =>  'property_bedrooms',
122
-                      'is_active'           =>  true,
123
-                      'for_admin_use'       =>  false,
124
-                      'default_value'       =>  '',
125
-                      'show_in' 	        =>  '[detail],[listing]',
126
-                      'is_required'         =>  true,
127
-                      'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
128
-                      'validation_pattern'  =>  '',
129
-                      'validation_msg'      =>  '',
130
-                      'required_msg'        =>  '',
131
-                      'field_icon'          =>  'fa fa-bed',
132
-                      'css_class'           =>  '',
133
-                      'cat_sort'            =>  true,
134
-                      'cat_filter'	        =>  true
135
-    );
136
-
137
-    // property bathrooms
138
-    $fields[] = array('listing_type' => $post_type,
139
-                      'field_type'          =>  'select',
140
-                      'data_type'           =>  'VARCHAR',
141
-                      'admin_title'         =>  __('Property Bathrooms', 'geodirectory'),
142
-                      'site_title'          =>  __('Bathrooms', 'geodirectory'),
143
-                      'admin_desc'          =>  __('Select the number of bathrooms', 'geodirectory'),
144
-                      'htmlvar_name'        =>  'property_bathrooms',
145
-                      'is_active'           =>  true,
146
-                      'for_admin_use'       =>  false,
147
-                      'default_value'       =>  '',
148
-                      'show_in' 	        =>  '[detail],[listing]',
149
-                      'is_required'         =>  true,
150
-                      'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
151
-                      'validation_pattern'  =>  '',
152
-                      'validation_msg'      =>  '',
153
-                      'required_msg'        =>  '',
154
-                      'field_icon'          =>  'fa fa-bold',
155
-                      'css_class'           =>  '',
156
-                      'cat_sort'            =>  true,
157
-                      'cat_filter'	        =>  true
158
-    );
159
-
160
-    // property area
161
-    $fields[] = array('listing_type' => $post_type,
162
-                      'field_type'          =>  'text',
163
-                      'data_type'           =>  'INT',
164
-                      'admin_title'         =>  __('Property Area', 'geodirectory'),
165
-                      'site_title'          =>  __('Area (Sq Ft)', 'geodirectory'),
166
-                      'admin_desc'          =>  __('Enter the Sq Ft value for the property', 'geodirectory'),
167
-                      'htmlvar_name'        =>  'property_area',
168
-                      'is_active'           =>  true,
169
-                      'for_admin_use'       =>  false,
170
-                      'default_value'       =>  '',
171
-                      'show_in' 	        =>  '[detail],[listing]',
172
-                      'is_required'         =>  false,
173
-                      'validation_pattern'  =>  addslashes_gpc('\d+(\.\d{2})?'), // add slashes required
174
-                      'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
175
-                      'required_msg'        =>  '',
176
-                      'field_icon'          =>  'fa fa-area-chart',
177
-                      'css_class'           =>  '',
178
-                      'cat_sort'            =>  true,
179
-                      'cat_filter'	        =>  true
180
-    );
181
-
182
-    // property features
183
-    $fields[] = array('listing_type' => $post_type,
184
-                      'field_type'          =>  'multiselect',
185
-                      'data_type'           =>  'VARCHAR',
186
-                      'admin_title'         =>  __('Property Features', 'geodirectory'),
187
-                      'site_title'          =>  __('Features', 'geodirectory'),
188
-                      'admin_desc'          =>  __('Select the property features.', 'geodirectory'),
189
-                      'htmlvar_name'        =>  'property_features',
190
-                      'is_active'           =>  true,
191
-                      'for_admin_use'       =>  false,
192
-                      'default_value'       =>  '',
193
-                      'show_in' 	        =>  '[detail],[listing]',
194
-                      'is_required'         =>  false,
195
-                      'option_values'       =>  __('Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
196
-                      'validation_pattern'  =>  '',
197
-                      'validation_msg'      =>  '',
198
-                      'required_msg'        =>  '',
199
-                      'field_icon'          =>  'fa fa-plus-square',
200
-                      'css_class'           =>  'gd-comma-list',
201
-                      'cat_sort'            =>  true,
202
-                      'cat_filter'	        =>  true
203
-    );
204
-
205
-
206
-
207
-    /**
208
-     * Filter the array of default custom fields DB table data.
209
-     *
210
-     * @since 1.6.6
211
-     * @param string $fields The default custom fields as an array.
212
-     */
213
-    $fields = apply_filters('geodir_property_rent_custom_fields', $fields);
214
-
215
-    return  $fields;
10
+	$fields = array();
11
+	$package = ($package_id=='') ? '' : array($package_id);
12
+
13
+	// price
14
+	$fields[] = array('listing_type' => $post_type,
15
+					  'field_type'          =>  'text',
16
+					  'data_type'           =>  'FLOAT',
17
+					  'decimal_point'       =>  '2',
18
+					  'admin_title'         =>  __('Price', 'geodirectory'),
19
+					  'site_title'          =>  __('Price', 'geodirectory'),
20
+					  'admin_desc'          =>  __('Enter the price per calendar month (PCM)in $ (no currency symbol)', 'geodirectory'),
21
+					  'htmlvar_name'        =>  'price',
22
+					  'is_active'           =>  true,
23
+					  'for_admin_use'       =>  false,
24
+					  'default_value'       =>  '',
25
+					  'show_in' 	        =>  '[detail],[listing]',
26
+					  'is_required'         =>  false,
27
+					  'validation_pattern'  =>  addslashes_gpc('\d+(\.\d{2})?'), // add slashes required
28
+					  'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
29
+					  'required_msg'        =>  '',
30
+					  'field_icon'          =>  'fa fa-usd',
31
+					  'css_class'           =>  '',
32
+					  'cat_sort'            =>  true,
33
+					  'cat_filter'	        =>  true,
34
+					  'extra'        =>  array(
35
+						  'is_price'                  =>  1,
36
+						  'thousand_separator'        =>  'comma',
37
+						  'decimal_separator'         =>  'period',
38
+						  'decimal_display'           =>  'if',
39
+						  'currency_symbol'           =>  '$',
40
+						  'currency_symbol_placement' =>  'left'
41
+					  )
42
+	);
43
+
44
+	// property status
45
+	$fields[] = array('listing_type' => $post_type,
46
+					  'data_type' => 'VARCHAR',
47
+					  'field_type' => 'select',
48
+					  'field_type_key' => 'property_status',
49
+					  'is_active' => 1,
50
+					  'for_admin_use' => 0,
51
+					  'is_default' => 0,
52
+					  'admin_title' => __('Property Status', 'geodirectory'),
53
+					  'admin_desc' => __('Enter the status of the property.', 'geodirectory'),
54
+					  'site_title' => __('Property Status', 'geodirectory'),
55
+					  'htmlvar_name' => 'property_status',
56
+					  'default_value' => '',
57
+					  'is_required' => '1',
58
+					  'required_msg' => '',
59
+					  'show_in'   =>  '[detail],[listing]',
60
+					  'show_on_pkg' => $package,
61
+					  'option_values' => 'Select Status/,For Rent,Let,Under Offer',
62
+					  'field_icon' => 'fa fa-home',
63
+					  'css_class' => '',
64
+					  'cat_sort' => 1,
65
+					  'cat_filter' => 1,
66
+	);
67
+
68
+	// property furnishing
69
+	$fields[] = array('listing_type' => $post_type,
70
+					  'field_type'          =>  'select',
71
+					  'data_type'           =>  'VARCHAR',
72
+					  'admin_title'         =>  __('Furnishing', 'geodirectory'),
73
+					  'site_title'          =>  __('Furnishing', 'geodirectory'),
74
+					  'admin_desc'          =>  __('Enter the furnishing status of the property.', 'geodirectory'),
75
+					  'htmlvar_name'        =>  'property_furnishing',
76
+					  'is_active'           =>  true,
77
+					  'for_admin_use'       =>  false,
78
+					  'default_value'       =>  '',
79
+					  'show_in' 	        =>  '[detail],[listing]',
80
+					  'is_required'         =>  true,
81
+					  'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
82
+					  'validation_pattern'  =>  '',
83
+					  'validation_msg'      =>  '',
84
+					  'required_msg'        =>  '',
85
+					  'field_icon'          =>  'fa fa-th-large',
86
+					  'css_class'           =>  '',
87
+					  'cat_sort'            =>  true,
88
+					  'cat_filter'	        =>  true
89
+	);
90
+
91
+	// property type
92
+	$fields[] = array('listing_type' => $post_type,
93
+					  'field_type'          =>  'select',
94
+					  'data_type'           =>  'VARCHAR',
95
+					  'admin_title'         =>  __('Property Type', 'geodirectory'),
96
+					  'site_title'          =>  __('Property Type', 'geodirectory'),
97
+					  'admin_desc'          =>  __('Select the property type.', 'geodirectory'),
98
+					  'htmlvar_name'        =>  'property_type',
99
+					  'is_active'           =>  true,
100
+					  'for_admin_use'       =>  false,
101
+					  'default_value'       =>  '',
102
+					  'show_in' 	        =>  '[detail],[listing]',
103
+					  'is_required'         =>  true,
104
+					  'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage,Hotel,Land','geodirectory'),
105
+					  'validation_pattern'  =>  '',
106
+					  'validation_msg'      =>  '',
107
+					  'required_msg'        =>  '',
108
+					  'field_icon'          =>  'fa fa-home',
109
+					  'css_class'           =>  '',
110
+					  'cat_sort'            =>  true,
111
+					  'cat_filter'	        =>  true
112
+	);
113
+
114
+	// property bedrooms
115
+	$fields[] = array('listing_type' => $post_type,
116
+					  'field_type'          =>  'select',
117
+					  'data_type'           =>  'VARCHAR',
118
+					  'admin_title'         =>  __('Property Bedrooms', 'geodirectory'),
119
+					  'site_title'          =>  __('Bedrooms', 'geodirectory'),
120
+					  'admin_desc'          =>  __('Select the number of bedrooms', 'geodirectory'),
121
+					  'htmlvar_name'        =>  'property_bedrooms',
122
+					  'is_active'           =>  true,
123
+					  'for_admin_use'       =>  false,
124
+					  'default_value'       =>  '',
125
+					  'show_in' 	        =>  '[detail],[listing]',
126
+					  'is_required'         =>  true,
127
+					  'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
128
+					  'validation_pattern'  =>  '',
129
+					  'validation_msg'      =>  '',
130
+					  'required_msg'        =>  '',
131
+					  'field_icon'          =>  'fa fa-bed',
132
+					  'css_class'           =>  '',
133
+					  'cat_sort'            =>  true,
134
+					  'cat_filter'	        =>  true
135
+	);
136
+
137
+	// property bathrooms
138
+	$fields[] = array('listing_type' => $post_type,
139
+					  'field_type'          =>  'select',
140
+					  'data_type'           =>  'VARCHAR',
141
+					  'admin_title'         =>  __('Property Bathrooms', 'geodirectory'),
142
+					  'site_title'          =>  __('Bathrooms', 'geodirectory'),
143
+					  'admin_desc'          =>  __('Select the number of bathrooms', 'geodirectory'),
144
+					  'htmlvar_name'        =>  'property_bathrooms',
145
+					  'is_active'           =>  true,
146
+					  'for_admin_use'       =>  false,
147
+					  'default_value'       =>  '',
148
+					  'show_in' 	        =>  '[detail],[listing]',
149
+					  'is_required'         =>  true,
150
+					  'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
151
+					  'validation_pattern'  =>  '',
152
+					  'validation_msg'      =>  '',
153
+					  'required_msg'        =>  '',
154
+					  'field_icon'          =>  'fa fa-bold',
155
+					  'css_class'           =>  '',
156
+					  'cat_sort'            =>  true,
157
+					  'cat_filter'	        =>  true
158
+	);
159
+
160
+	// property area
161
+	$fields[] = array('listing_type' => $post_type,
162
+					  'field_type'          =>  'text',
163
+					  'data_type'           =>  'INT',
164
+					  'admin_title'         =>  __('Property Area', 'geodirectory'),
165
+					  'site_title'          =>  __('Area (Sq Ft)', 'geodirectory'),
166
+					  'admin_desc'          =>  __('Enter the Sq Ft value for the property', 'geodirectory'),
167
+					  'htmlvar_name'        =>  'property_area',
168
+					  'is_active'           =>  true,
169
+					  'for_admin_use'       =>  false,
170
+					  'default_value'       =>  '',
171
+					  'show_in' 	        =>  '[detail],[listing]',
172
+					  'is_required'         =>  false,
173
+					  'validation_pattern'  =>  addslashes_gpc('\d+(\.\d{2})?'), // add slashes required
174
+					  'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
175
+					  'required_msg'        =>  '',
176
+					  'field_icon'          =>  'fa fa-area-chart',
177
+					  'css_class'           =>  '',
178
+					  'cat_sort'            =>  true,
179
+					  'cat_filter'	        =>  true
180
+	);
181
+
182
+	// property features
183
+	$fields[] = array('listing_type' => $post_type,
184
+					  'field_type'          =>  'multiselect',
185
+					  'data_type'           =>  'VARCHAR',
186
+					  'admin_title'         =>  __('Property Features', 'geodirectory'),
187
+					  'site_title'          =>  __('Features', 'geodirectory'),
188
+					  'admin_desc'          =>  __('Select the property features.', 'geodirectory'),
189
+					  'htmlvar_name'        =>  'property_features',
190
+					  'is_active'           =>  true,
191
+					  'for_admin_use'       =>  false,
192
+					  'default_value'       =>  '',
193
+					  'show_in' 	        =>  '[detail],[listing]',
194
+					  'is_required'         =>  false,
195
+					  'option_values'       =>  __('Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
196
+					  'validation_pattern'  =>  '',
197
+					  'validation_msg'      =>  '',
198
+					  'required_msg'        =>  '',
199
+					  'field_icon'          =>  'fa fa-plus-square',
200
+					  'css_class'           =>  'gd-comma-list',
201
+					  'cat_sort'            =>  true,
202
+					  'cat_filter'	        =>  true
203
+	);
204
+
205
+
206
+
207
+	/**
208
+	 * Filter the array of default custom fields DB table data.
209
+	 *
210
+	 * @since 1.6.6
211
+	 * @param string $fields The default custom fields as an array.
212
+	 */
213
+	$fields = apply_filters('geodir_property_rent_custom_fields', $fields);
214
+
215
+	return  $fields;
216 216
 }
217 217
 
218 218
 function geodir_property_rent_custom_fields_sort($post_type='gd_place') {
219 219
 
220 220
 
221
-    $fields = array();
222
-
223
-    // price sort
224
-    $fields[] = array(
225
-        'create_field'            => true,
226
-        'listing_type'            => $post_type,
227
-        'field_type'              => 'text',
228
-        'data_type'               => '',
229
-        'htmlvar_name'            => 'geodir_price',
230
-        'site_title'              => __('Price','geodirectory'),
231
-        'asc'                     => 1,
232
-        'asc_title'               => __('Price (lowest first)','geodirectory'),
233
-        'desc'                    => 1,
234
-        'desc_title'              => __('Price (highest first)','geodirectory'),
235
-        'is_active'               => 1
236
-    );
237
-
238
-    // area sort
239
-    $fields[] = array(
240
-        'create_field'            => true,
241
-        'listing_type'            => $post_type,
242
-        'field_type'              => 'text',
243
-        'data_type'               => '',
244
-        'htmlvar_name'            => 'geodir_property_area',
245
-        'site_title'              => __('Area (Sq Ft)','geodirectory'),
246
-        'asc'                     => 1,
247
-        'asc_title'               => __('Area (smallest first)','geodirectory'),
248
-        'desc'                    => 1,
249
-        'desc_title'              => __('Area (largest first)','geodirectory'),
250
-        'is_active'               => 1
251
-    );
252
-
253
-    // bedrooms sort
254
-    $fields[] = array(
255
-        'create_field'            => true,
256
-        'listing_type'            => $post_type,
257
-        'field_type'              => 'select',
258
-        'data_type'               => '',
259
-        'htmlvar_name'            => 'geodir_property_bedrooms',
260
-        'site_title'              => __('Area (Sq Ft)','geodirectory'),
261
-        'asc'                     => 1,
262
-        'asc_title'               => __('Bedrooms (least)','geodirectory'),
263
-        'desc'                    => 1,
264
-        'desc_title'              => __('Bedrooms (most)','geodirectory'),
265
-        'is_active'               => 1
266
-    );
267
-
268
-    /**
269
-     * Filter the array of advanced search fields DB table data.
270
-     *
271
-     * @since 1.6.6
272
-     * @param string $fields The default custom fields as an array.
273
-     */
274
-    $fields = apply_filters('geodir_property_sale_custom_fields_sort', $fields);
275
-
276
-    return $fields;
221
+	$fields = array();
222
+
223
+	// price sort
224
+	$fields[] = array(
225
+		'create_field'            => true,
226
+		'listing_type'            => $post_type,
227
+		'field_type'              => 'text',
228
+		'data_type'               => '',
229
+		'htmlvar_name'            => 'geodir_price',
230
+		'site_title'              => __('Price','geodirectory'),
231
+		'asc'                     => 1,
232
+		'asc_title'               => __('Price (lowest first)','geodirectory'),
233
+		'desc'                    => 1,
234
+		'desc_title'              => __('Price (highest first)','geodirectory'),
235
+		'is_active'               => 1
236
+	);
237
+
238
+	// area sort
239
+	$fields[] = array(
240
+		'create_field'            => true,
241
+		'listing_type'            => $post_type,
242
+		'field_type'              => 'text',
243
+		'data_type'               => '',
244
+		'htmlvar_name'            => 'geodir_property_area',
245
+		'site_title'              => __('Area (Sq Ft)','geodirectory'),
246
+		'asc'                     => 1,
247
+		'asc_title'               => __('Area (smallest first)','geodirectory'),
248
+		'desc'                    => 1,
249
+		'desc_title'              => __('Area (largest first)','geodirectory'),
250
+		'is_active'               => 1
251
+	);
252
+
253
+	// bedrooms sort
254
+	$fields[] = array(
255
+		'create_field'            => true,
256
+		'listing_type'            => $post_type,
257
+		'field_type'              => 'select',
258
+		'data_type'               => '',
259
+		'htmlvar_name'            => 'geodir_property_bedrooms',
260
+		'site_title'              => __('Area (Sq Ft)','geodirectory'),
261
+		'asc'                     => 1,
262
+		'asc_title'               => __('Bedrooms (least)','geodirectory'),
263
+		'desc'                    => 1,
264
+		'desc_title'              => __('Bedrooms (most)','geodirectory'),
265
+		'is_active'               => 1
266
+	);
267
+
268
+	/**
269
+	 * Filter the array of advanced search fields DB table data.
270
+	 *
271
+	 * @since 1.6.6
272
+	 * @param string $fields The default custom fields as an array.
273
+	 */
274
+	$fields = apply_filters('geodir_property_sale_custom_fields_sort', $fields);
275
+
276
+	return $fields;
277 277
 
278 278
 }
279 279
 
280 280
 function geodir_property_rent_custom_fields_advanced_search($post_type='gd_place') {
281 281
 
282 282
 
283
-    $fields = array();
284
-
285
-    // Price range
286
-    $fields[] = array(
287
-        'create_field'            => true,
288
-        'listing_type'            => $post_type,
289
-        'field_type'              => 'text',
290
-        'data_type'               => 'RANGE',
291
-        'is_active'               => 1,
292
-        'site_field_title'        => 'Price',
293
-        'field_data_type'         => 'FLOAT',
294
-        'main_search'             => 1,
295
-        'main_search_priority'    => 15,
296
-        'data_type_change'        => 'SELECT',
297
-        'search_condition_select' => 'SINGLE',
298
-        'search_min_value'        => '1000',
299
-        'search_max_value'        => '10000',
300
-        'search_diff_value'       => '1000',
301
-        'first_search_value'      => '0',
302
-        'first_search_text'       => '',
303
-        'last_search_text'        => '',
304
-        'search_condition'        => 'SELECT',
305
-        'site_htmlvar_name'       => 'geodir_price',
306
-        'htmlvar_name'            => 'geodir_price',
307
-        'field_title'             => 'geodir_price',
308
-        'expand_custom_value'     => '',
309
-        'front_search_title'      => 'Price Range pm',
310
-        'field_desc'              => ''
311
-    );
312
-
313
-    // bedrooms
314
-    $fields[] = array(
315
-        'create_field'            => true,
316
-        'listing_type'            => $post_type,
317
-        'field_type'              => 'select',
318
-        'data_type'               => 'CHECK',
319
-        'is_active'               => 1,
320
-        'site_field_title'        => 'Bedrooms',
321
-        'field_data_type'         => 'VARCHAR',
322
-        'main_search'             => 1,
323
-        'main_search_priority'    => 16,
324
-        'search_condition'        => 'SINGLE',
325
-        'site_htmlvar_name'       => 'geodir_property_bedrooms',
326
-        'htmlvar_name'            => 'geodir_property_bedrooms',
327
-        'field_title'             => 'geodir_property_bedrooms',
328
-        'front_search_title'      => 'Bedrooms',
329
-        'field_desc'              => '',
330
-        'expand_custom_value'     => 5,
331
-        'expand_search'           => 1,
332
-        'search_operator'         => 'OR'
333
-    );
334
-
335
-    // Property type
336
-    $fields[] = array(
337
-        'create_field'            => true,
338
-        'listing_type'            => $post_type,
339
-        'field_type'              => 'select',
340
-        'data_type'               => 'CHECK',
341
-        'is_active'               => 1,
342
-        'site_field_title'        => 'Property Type',
343
-        'field_data_type'         => 'VARCHAR',
344
-        'main_search'             => 0,
345
-        //'main_search_priority'    => 16,
346
-        'search_condition'        => 'SINGLE',
347
-        'site_htmlvar_name'       => 'geodir_property_type',
348
-        'htmlvar_name'            => 'geodir_property_type',
349
-        'field_title'             => 'geodir_property_type',
350
-        'front_search_title'      => 'Property Type',
351
-        'field_desc'              => '',
352
-        'expand_custom_value'     => 5,
353
-        'expand_search'           => 1,
354
-        'search_operator'         => 'OR'
355
-    );
356
-
357
-    // Property Features
358
-    $fields[] = array(
359
-        'create_field'            => true,
360
-        'listing_type'            => $post_type,
361
-        'field_type'              => 'multiselect',
362
-        'data_type'               => 'CHECK',
363
-        'is_active'               => 1,
364
-        'site_field_title'        => 'Features',
365
-        'field_data_type'         => 'VARCHAR',
366
-        'main_search'             => 0,
367
-        //'main_search_priority'    => 16,
368
-        'search_condition'        => 'SINGLE',
369
-        'site_htmlvar_name'       => 'geodir_property_features',
370
-        'htmlvar_name'            => 'geodir_property_features',
371
-        'field_title'             => 'geodir_property_features',
372
-        'front_search_title'      => 'Property Features',
373
-        'field_desc'              => '',
374
-        'expand_custom_value'     => 5,
375
-        'expand_search'           => 1,
376
-        'search_operator'         => 'AND'
377
-    );
378
-
379
-    // Property Bathrooms
380
-    $fields[] = array(
381
-        'create_field'            => true,
382
-        'listing_type'            => $post_type,
383
-        'field_type'              => 'select',
384
-        'data_type'               => 'CHECK',
385
-        'is_active'               => 1,
386
-        'site_field_title'        => 'Bathrooms',
387
-        'field_data_type'         => 'VARCHAR',
388
-        'main_search'             => 0,
389
-        //'main_search_priority'    => 16,
390
-        'search_condition'        => 'SINGLE',
391
-        'site_htmlvar_name'       => 'geodir_property_bathrooms',
392
-        'htmlvar_name'            => 'geodir_property_bathrooms',
393
-        'field_title'             => 'geodir_property_bathrooms',
394
-        'front_search_title'      => 'Bathrooms',
395
-        'field_desc'              => '',
396
-        'expand_custom_value'     => 5,
397
-        'expand_search'           => 1,
398
-        'search_operator'         => 'OR'
399
-    );
400
-
401
-    // Property Furnishing
402
-    $fields[] = array(
403
-        'create_field'            => true,
404
-        'listing_type'            => $post_type,
405
-        'field_type'              => 'select',
406
-        'data_type'               => 'CHECK',
407
-        'is_active'               => 1,
408
-        'site_field_title'        => 'Furnishing',
409
-        'field_data_type'         => 'VARCHAR',
410
-        'main_search'             => 0,
411
-        //'main_search_priority'    => 16,
412
-        'search_condition'        => 'SINGLE',
413
-        'site_htmlvar_name'       => 'geodir_property_furnishing',
414
-        'htmlvar_name'            => 'geodir_property_furnishing',
415
-        'field_title'             => 'geodir_property_furnishing',
416
-        'front_search_title'      => 'Furnishing',
417
-        'field_desc'              => '',
418
-        'expand_custom_value'     => 5,
419
-        'expand_search'           => 1,
420
-        'search_operator'         => 'OR'
421
-    );
422
-
423
-    // Property Status
424
-    $fields[] = array(
425
-        'create_field'            => true,
426
-        'listing_type'            => $post_type,
427
-        'field_type'              => 'select',
428
-        'data_type'               => 'CHECK',
429
-        'is_active'               => 1,
430
-        'site_field_title'        => 'Property Status',
431
-        'field_data_type'         => 'VARCHAR',
432
-        'main_search'             => 0,
433
-        //'main_search_priority'    => 16,
434
-        'search_condition'        => 'SINGLE',
435
-        'site_htmlvar_name'       => 'geodir_property_status',
436
-        'htmlvar_name'            => 'geodir_property_status',
437
-        'field_title'             => 'geodir_property_status',
438
-        'front_search_title'      => 'Property Status',
439
-        'field_desc'              => '',
440
-        'expand_custom_value'     => 5,
441
-        'expand_search'           => 1,
442
-        'search_operator'         => 'OR'
443
-    );
444
-
445
-
446
-
447
-    /**
448
-     * Filter the array of advanced search fields DB table data.
449
-     *
450
-     * @since 1.6.6
451
-     * @param string $fields The default custom fields as an array.
452
-     */
453
-    $fields = apply_filters('geodir_property_rent_custom_fields_advanced_search', $fields);
454
-
455
-    return $fields;
283
+	$fields = array();
284
+
285
+	// Price range
286
+	$fields[] = array(
287
+		'create_field'            => true,
288
+		'listing_type'            => $post_type,
289
+		'field_type'              => 'text',
290
+		'data_type'               => 'RANGE',
291
+		'is_active'               => 1,
292
+		'site_field_title'        => 'Price',
293
+		'field_data_type'         => 'FLOAT',
294
+		'main_search'             => 1,
295
+		'main_search_priority'    => 15,
296
+		'data_type_change'        => 'SELECT',
297
+		'search_condition_select' => 'SINGLE',
298
+		'search_min_value'        => '1000',
299
+		'search_max_value'        => '10000',
300
+		'search_diff_value'       => '1000',
301
+		'first_search_value'      => '0',
302
+		'first_search_text'       => '',
303
+		'last_search_text'        => '',
304
+		'search_condition'        => 'SELECT',
305
+		'site_htmlvar_name'       => 'geodir_price',
306
+		'htmlvar_name'            => 'geodir_price',
307
+		'field_title'             => 'geodir_price',
308
+		'expand_custom_value'     => '',
309
+		'front_search_title'      => 'Price Range pm',
310
+		'field_desc'              => ''
311
+	);
312
+
313
+	// bedrooms
314
+	$fields[] = array(
315
+		'create_field'            => true,
316
+		'listing_type'            => $post_type,
317
+		'field_type'              => 'select',
318
+		'data_type'               => 'CHECK',
319
+		'is_active'               => 1,
320
+		'site_field_title'        => 'Bedrooms',
321
+		'field_data_type'         => 'VARCHAR',
322
+		'main_search'             => 1,
323
+		'main_search_priority'    => 16,
324
+		'search_condition'        => 'SINGLE',
325
+		'site_htmlvar_name'       => 'geodir_property_bedrooms',
326
+		'htmlvar_name'            => 'geodir_property_bedrooms',
327
+		'field_title'             => 'geodir_property_bedrooms',
328
+		'front_search_title'      => 'Bedrooms',
329
+		'field_desc'              => '',
330
+		'expand_custom_value'     => 5,
331
+		'expand_search'           => 1,
332
+		'search_operator'         => 'OR'
333
+	);
334
+
335
+	// Property type
336
+	$fields[] = array(
337
+		'create_field'            => true,
338
+		'listing_type'            => $post_type,
339
+		'field_type'              => 'select',
340
+		'data_type'               => 'CHECK',
341
+		'is_active'               => 1,
342
+		'site_field_title'        => 'Property Type',
343
+		'field_data_type'         => 'VARCHAR',
344
+		'main_search'             => 0,
345
+		//'main_search_priority'    => 16,
346
+		'search_condition'        => 'SINGLE',
347
+		'site_htmlvar_name'       => 'geodir_property_type',
348
+		'htmlvar_name'            => 'geodir_property_type',
349
+		'field_title'             => 'geodir_property_type',
350
+		'front_search_title'      => 'Property Type',
351
+		'field_desc'              => '',
352
+		'expand_custom_value'     => 5,
353
+		'expand_search'           => 1,
354
+		'search_operator'         => 'OR'
355
+	);
356
+
357
+	// Property Features
358
+	$fields[] = array(
359
+		'create_field'            => true,
360
+		'listing_type'            => $post_type,
361
+		'field_type'              => 'multiselect',
362
+		'data_type'               => 'CHECK',
363
+		'is_active'               => 1,
364
+		'site_field_title'        => 'Features',
365
+		'field_data_type'         => 'VARCHAR',
366
+		'main_search'             => 0,
367
+		//'main_search_priority'    => 16,
368
+		'search_condition'        => 'SINGLE',
369
+		'site_htmlvar_name'       => 'geodir_property_features',
370
+		'htmlvar_name'            => 'geodir_property_features',
371
+		'field_title'             => 'geodir_property_features',
372
+		'front_search_title'      => 'Property Features',
373
+		'field_desc'              => '',
374
+		'expand_custom_value'     => 5,
375
+		'expand_search'           => 1,
376
+		'search_operator'         => 'AND'
377
+	);
378
+
379
+	// Property Bathrooms
380
+	$fields[] = array(
381
+		'create_field'            => true,
382
+		'listing_type'            => $post_type,
383
+		'field_type'              => 'select',
384
+		'data_type'               => 'CHECK',
385
+		'is_active'               => 1,
386
+		'site_field_title'        => 'Bathrooms',
387
+		'field_data_type'         => 'VARCHAR',
388
+		'main_search'             => 0,
389
+		//'main_search_priority'    => 16,
390
+		'search_condition'        => 'SINGLE',
391
+		'site_htmlvar_name'       => 'geodir_property_bathrooms',
392
+		'htmlvar_name'            => 'geodir_property_bathrooms',
393
+		'field_title'             => 'geodir_property_bathrooms',
394
+		'front_search_title'      => 'Bathrooms',
395
+		'field_desc'              => '',
396
+		'expand_custom_value'     => 5,
397
+		'expand_search'           => 1,
398
+		'search_operator'         => 'OR'
399
+	);
400
+
401
+	// Property Furnishing
402
+	$fields[] = array(
403
+		'create_field'            => true,
404
+		'listing_type'            => $post_type,
405
+		'field_type'              => 'select',
406
+		'data_type'               => 'CHECK',
407
+		'is_active'               => 1,
408
+		'site_field_title'        => 'Furnishing',
409
+		'field_data_type'         => 'VARCHAR',
410
+		'main_search'             => 0,
411
+		//'main_search_priority'    => 16,
412
+		'search_condition'        => 'SINGLE',
413
+		'site_htmlvar_name'       => 'geodir_property_furnishing',
414
+		'htmlvar_name'            => 'geodir_property_furnishing',
415
+		'field_title'             => 'geodir_property_furnishing',
416
+		'front_search_title'      => 'Furnishing',
417
+		'field_desc'              => '',
418
+		'expand_custom_value'     => 5,
419
+		'expand_search'           => 1,
420
+		'search_operator'         => 'OR'
421
+	);
422
+
423
+	// Property Status
424
+	$fields[] = array(
425
+		'create_field'            => true,
426
+		'listing_type'            => $post_type,
427
+		'field_type'              => 'select',
428
+		'data_type'               => 'CHECK',
429
+		'is_active'               => 1,
430
+		'site_field_title'        => 'Property Status',
431
+		'field_data_type'         => 'VARCHAR',
432
+		'main_search'             => 0,
433
+		//'main_search_priority'    => 16,
434
+		'search_condition'        => 'SINGLE',
435
+		'site_htmlvar_name'       => 'geodir_property_status',
436
+		'htmlvar_name'            => 'geodir_property_status',
437
+		'field_title'             => 'geodir_property_status',
438
+		'front_search_title'      => 'Property Status',
439
+		'field_desc'              => '',
440
+		'expand_custom_value'     => 5,
441
+		'expand_search'           => 1,
442
+		'search_operator'         => 'OR'
443
+	);
444
+
445
+
446
+
447
+	/**
448
+	 * Filter the array of advanced search fields DB table data.
449
+	 *
450
+	 * @since 1.6.6
451
+	 * @param string $fields The default custom fields as an array.
452
+	 */
453
+	$fields = apply_filters('geodir_property_rent_custom_fields_advanced_search', $fields);
454
+
455
+	return $fields;
456 456
 }
457 457
 
458 458
 global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2,$wpdb, $current_user,$dummy_post_index;
@@ -462,52 +462,52 @@  discard block
 block discarded – undo
462 462
 $category_array = array('Apartments', 'Houses', 'Commercial', 'Land');
463 463
 
464 464
 if($dummy_post_index==1){
465
-    // add the dummy categories
466
-    geodir_dummy_data_taxonomies($post_type,$category_array );
467
-
468
-    // add the dummy custom fields
469
-    $fields = geodir_property_rent_custom_fields($post_type);
470
-    geodir_create_dummy_fields($fields);
471
-
472
-    // add sort order items
473
-    $sort_fields = geodir_property_rent_custom_fields_sort($post_type);
474
-    foreach($sort_fields as $sort){
475
-        geodir_custom_sort_field_save($sort);
476
-    }
477
-
478
-    // update the type currently installed
479
-    update_option($post_type.'_dummy_data_type','property_rent');
480
-
481
-    // add the advanced search fields
482
-    if (defined('GEODIRADVANCESEARCH_VERSION')){
483
-        $search_fields = geodir_property_rent_custom_fields_advanced_search($post_type);
484
-        foreach($search_fields as $sfield){
485
-            geodir_custom_advance_search_field_save( $sfield );
486
-        }
487
-    }
465
+	// add the dummy categories
466
+	geodir_dummy_data_taxonomies($post_type,$category_array );
467
+
468
+	// add the dummy custom fields
469
+	$fields = geodir_property_rent_custom_fields($post_type);
470
+	geodir_create_dummy_fields($fields);
471
+
472
+	// add sort order items
473
+	$sort_fields = geodir_property_rent_custom_fields_sort($post_type);
474
+	foreach($sort_fields as $sort){
475
+		geodir_custom_sort_field_save($sort);
476
+	}
477
+
478
+	// update the type currently installed
479
+	update_option($post_type.'_dummy_data_type','property_rent');
480
+
481
+	// add the advanced search fields
482
+	if (defined('GEODIRADVANCESEARCH_VERSION')){
483
+		$search_fields = geodir_property_rent_custom_fields_advanced_search($post_type);
484
+		foreach($search_fields as $sfield){
485
+			geodir_custom_advance_search_field_save( $sfield );
486
+		}
487
+	}
488 488
 }
489 489
 
490 490
 if (geodir_dummy_folder_exists())
491
-    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
491
+	$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
492 492
 else
493
-    $dummy_image_url = 'https://wpgeodirectory.com/dummy';
493
+	$dummy_image_url = 'https://wpgeodirectory.com/dummy';
494 494
 
495 495
 $dummy_image_url = apply_filters('place_dummy_image_url', $dummy_image_url);
496 496
 
497 497
 switch ($dummy_post_index) {
498 498
 
499
-    case(1):
500
-        $image_array[] = "$dummy_image_url/ps/psf1.jpg";
501
-        $image_array[] = "$dummy_image_url/ps/psl1.jpg";
502
-        $image_array[] = "$dummy_image_url/ps/psb1.jpg";
503
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
504
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
499
+	case(1):
500
+		$image_array[] = "$dummy_image_url/ps/psf1.jpg";
501
+		$image_array[] = "$dummy_image_url/ps/psl1.jpg";
502
+		$image_array[] = "$dummy_image_url/ps/psb1.jpg";
503
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
504
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
505 505
 
506 506
 
507
-        $post_info[] = array(
508
-            "listing_type" => $post_type,
509
-            "post_title" => 'Eastern Lodge',
510
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec non augue ultrices, vulputate nulla at, consectetur ante. Quisque neque mi, vulputate quis nulla a, sollicitudin fringilla leo. Nam dictum id neque eu imperdiet. Curabitur ligula turpis, malesuada at lobortis commodo, vulputate volutpat arcu. Duis bibendum blandit aliquam. In ipsum diam, tristique ut bibendum vel, lobortis non tellus. Nulla ultricies, ante vitae placerat auctor, nisi quam blandit enim, sit amet aliquam est diam id urna. Suspendisse eget nibh volutpat, malesuada enim sed, egestas massa.
507
+		$post_info[] = array(
508
+			"listing_type" => $post_type,
509
+			"post_title" => 'Eastern Lodge',
510
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec non augue ultrices, vulputate nulla at, consectetur ante. Quisque neque mi, vulputate quis nulla a, sollicitudin fringilla leo. Nam dictum id neque eu imperdiet. Curabitur ligula turpis, malesuada at lobortis commodo, vulputate volutpat arcu. Duis bibendum blandit aliquam. In ipsum diam, tristique ut bibendum vel, lobortis non tellus. Nulla ultricies, ante vitae placerat auctor, nisi quam blandit enim, sit amet aliquam est diam id urna. Suspendisse eget nibh volutpat, malesuada enim sed, egestas massa.
511 511
 
512 512
 Aliquam ut odio ullamcorper, posuere enim sed, venenatis tortor. Donec justo elit, aliquam sed cursus sed, semper eget libero. Mauris consequat lorem sed fringilla tincidunt. Phasellus suscipit velit et elit tristique, ac commodo metus scelerisque. Vivamus finibus ipsum placerat pulvinar aliquet. Maecenas augue orci, blandit at nibh pharetra, condimentum congue ligula. Duis non ante sagittis odio convallis lacinia in quis sapien.
513 513
 
@@ -516,42 +516,42 @@  discard block
 block discarded – undo
516 516
 Vestibulum tristique quam eget bibendum pulvinar. Mauris sit amet magna ut arcu rutrum pellentesque feugiat et ipsum. Proin porta quam sed risus accumsan pharetra. Nulla quis semper nisl. Nulla facilisi. Nulla facilisi. Pellentesque euismod sollicitudin lacus vel ultricies. Vestibulum ut sem ut nulla ultricies convallis in at mi. Nunc vitae nibh arcu. Maecenas nunc enim, tempus a rhoncus eget, pellentesque ut erat.
517 517
 
518 518
 Suspendisse interdum accumsan magna et tempor. Suspendisse scelerisque at lorem sit amet faucibus. Aenean quis consectetur enim. Duis aliquet tristique tempus. Suspendisse id ullamcorper mauris. Aliquam in libero eu justo porttitor pulvinar. Nulla semper placerat lectus. Nulla mollis suscipit lacus, a blandit purus cursus non. Maecenas id tellus mi. Pellentesque sollicitudin nibh eget magna scelerisque consequat. Aliquam convallis orci arcu, et euismod dui cursus et. Donec nec pellentesque nulla, ac pretium massa. In gravida bibendum ornare.',
519
-            "post_images" => $image_array,
520
-            "post_category" => array($post_type.'category' => array($category_array[1])),
521
-            "post_tags" => array('Tags', 'Sample Tags'),
522
-            "geodir_video" => '',
523
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
524
-            "geodir_contact" => '(111) 677-4444',
525
-            "geodir_email" => '[email protected]',
526
-            "geodir_website" => 'http://example.com/',
527
-            "geodir_twitter" => 'http://example.com/',
528
-            "geodir_facebook" => 'http://example.com/',
529
-            "geodir_price" => '1750',
530
-            "geodir_property_status" => 'For Rent',
531
-            'geodir_property_furnishing' => 'Furnished',
532
-            'geodir_property_type' => 'Detached house',
533
-            'geodir_property_bedrooms' => '3',
534
-            'geodir_property_bathrooms' => '2',
535
-            'geodir_property_area' => '1850',
536
-            'geodir_property_features' => 'Gas Central Heating,Triple Glazing,Front Garden,Private driveway,Fireplace',
537
-            "post_dummy" => '1'
538
-        );
539
-
540
-
541
-        break;
542
-    case 2:
543
-        $image_array = array();
544
-        $post_meta = array();
545
-        $image_array[] = "$dummy_image_url/ps/psf2.jpg";
546
-        $image_array[] = "$dummy_image_url/ps/psl2.jpg";
547
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
548
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
549
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
550
-
551
-        $post_info[] = array(
552
-            "listing_type" => $post_type,
553
-            "post_title" => 'Daisy Street',
554
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
519
+			"post_images" => $image_array,
520
+			"post_category" => array($post_type.'category' => array($category_array[1])),
521
+			"post_tags" => array('Tags', 'Sample Tags'),
522
+			"geodir_video" => '',
523
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
524
+			"geodir_contact" => '(111) 677-4444',
525
+			"geodir_email" => '[email protected]',
526
+			"geodir_website" => 'http://example.com/',
527
+			"geodir_twitter" => 'http://example.com/',
528
+			"geodir_facebook" => 'http://example.com/',
529
+			"geodir_price" => '1750',
530
+			"geodir_property_status" => 'For Rent',
531
+			'geodir_property_furnishing' => 'Furnished',
532
+			'geodir_property_type' => 'Detached house',
533
+			'geodir_property_bedrooms' => '3',
534
+			'geodir_property_bathrooms' => '2',
535
+			'geodir_property_area' => '1850',
536
+			'geodir_property_features' => 'Gas Central Heating,Triple Glazing,Front Garden,Private driveway,Fireplace',
537
+			"post_dummy" => '1'
538
+		);
539
+
540
+
541
+		break;
542
+	case 2:
543
+		$image_array = array();
544
+		$post_meta = array();
545
+		$image_array[] = "$dummy_image_url/ps/psf2.jpg";
546
+		$image_array[] = "$dummy_image_url/ps/psl2.jpg";
547
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
548
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
549
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
550
+
551
+		$post_info[] = array(
552
+			"listing_type" => $post_type,
553
+			"post_title" => 'Daisy Street',
554
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
555 555
 
556 556
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
557 557
 
@@ -561,42 +561,42 @@  discard block
 block discarded – undo
561 561
 
562 562
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
563 563
 
564
-            "post_images" => $image_array,
565
-            "post_category" => array($post_type.'category' => array($category_array[1])),
566
-            "post_tags" => array('Garage'),
567
-            "geodir_video" => '',
568
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
569
-            "geodir_contact" => '(222) 777-1111',
570
-            "geodir_email" => '[email protected]',
571
-            "geodir_website" => 'http://example.com/',
572
-            "geodir_twitter" => 'http://example.com/',
573
-            "geodir_facebook" => 'http://example.com/',
574
-            "geodir_price" => '1150',
575
-            "geodir_property_status" => 'Let',
576
-            'geodir_property_furnishing' => 'Unfurnished',
577
-            'geodir_property_type' => 'Detached house',
578
-            'geodir_property_bedrooms' => '5',
579
-            'geodir_property_bathrooms' => '3',
580
-            'geodir_property_area' => '2650',
581
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Front Garden,Garage,Private driveway,Fireplace',
582
-            "post_dummy" => '1'
583
-        );
584
-
585
-        break;
586
-
587
-    case 3:
588
-        $image_array = array();
589
-        $post_meta = array();
590
-        $image_array[] = "$dummy_image_url/ps/psf3.jpg";
591
-        $image_array[] = "$dummy_image_url/ps/psl3.jpg";
592
-        $image_array[] = "$dummy_image_url/ps/psb3.jpg";
593
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
594
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
595
-
596
-        $post_info[] = array(
597
-            "listing_type" => $post_type,
598
-            "post_title" => 'Northbay House',
599
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
564
+			"post_images" => $image_array,
565
+			"post_category" => array($post_type.'category' => array($category_array[1])),
566
+			"post_tags" => array('Garage'),
567
+			"geodir_video" => '',
568
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
569
+			"geodir_contact" => '(222) 777-1111',
570
+			"geodir_email" => '[email protected]',
571
+			"geodir_website" => 'http://example.com/',
572
+			"geodir_twitter" => 'http://example.com/',
573
+			"geodir_facebook" => 'http://example.com/',
574
+			"geodir_price" => '1150',
575
+			"geodir_property_status" => 'Let',
576
+			'geodir_property_furnishing' => 'Unfurnished',
577
+			'geodir_property_type' => 'Detached house',
578
+			'geodir_property_bedrooms' => '5',
579
+			'geodir_property_bathrooms' => '3',
580
+			'geodir_property_area' => '2650',
581
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Front Garden,Garage,Private driveway,Fireplace',
582
+			"post_dummy" => '1'
583
+		);
584
+
585
+		break;
586
+
587
+	case 3:
588
+		$image_array = array();
589
+		$post_meta = array();
590
+		$image_array[] = "$dummy_image_url/ps/psf3.jpg";
591
+		$image_array[] = "$dummy_image_url/ps/psl3.jpg";
592
+		$image_array[] = "$dummy_image_url/ps/psb3.jpg";
593
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
594
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
595
+
596
+		$post_info[] = array(
597
+			"listing_type" => $post_type,
598
+			"post_title" => 'Northbay House',
599
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
600 600
 
601 601
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
602 602
 
@@ -606,43 +606,43 @@  discard block
 block discarded – undo
606 606
 
607 607
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
608 608
 
609
-            "post_images" => $image_array,
610
-            "post_category" => array($post_type.'category' => array($category_array[1])),
611
-            "post_tags" => array('Tags', 'Sample Tags'),
612
-            "geodir_video" => '',
613
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
614
-            "geodir_contact" => '(222) 777-1111',
615
-            "geodir_email" => '[email protected]',
616
-            "geodir_website" => 'http://example.com/',
617
-            "geodir_twitter" => 'http://example.com/',
618
-            "geodir_facebook" => 'http://example.com/',
619
-            "geodir_price" => '1300',
620
-            "geodir_property_status" => 'Under Offer',
621
-            'geodir_property_furnishing' => 'Unfurnished',
622
-            'geodir_property_type' => 'Detached house',
623
-            'geodir_property_bedrooms' => '6',
624
-            'geodir_property_bathrooms' => '6',
625
-            'geodir_property_area' => '1650',
626
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Triple Glazing,Off Road Parking,Fireplace',
627
-            "post_dummy" => '1'
628
-        );
629
-
630
-        break;
631
-
632
-
633
-    case 4:
634
-        $image_array = array();
635
-        $post_meta = array();
636
-        $image_array[] = "$dummy_image_url/ps/psf4.jpg";
637
-        $image_array[] = "$dummy_image_url/ps/psl4.jpg";
638
-        $image_array[] = "$dummy_image_url/ps/psb4.jpg";
639
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
640
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
641
-
642
-        $post_info[] = array(
643
-            "listing_type" => $post_type,
644
-            "post_title" => 'Jesmond Mansion',
645
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
609
+			"post_images" => $image_array,
610
+			"post_category" => array($post_type.'category' => array($category_array[1])),
611
+			"post_tags" => array('Tags', 'Sample Tags'),
612
+			"geodir_video" => '',
613
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
614
+			"geodir_contact" => '(222) 777-1111',
615
+			"geodir_email" => '[email protected]',
616
+			"geodir_website" => 'http://example.com/',
617
+			"geodir_twitter" => 'http://example.com/',
618
+			"geodir_facebook" => 'http://example.com/',
619
+			"geodir_price" => '1300',
620
+			"geodir_property_status" => 'Under Offer',
621
+			'geodir_property_furnishing' => 'Unfurnished',
622
+			'geodir_property_type' => 'Detached house',
623
+			'geodir_property_bedrooms' => '6',
624
+			'geodir_property_bathrooms' => '6',
625
+			'geodir_property_area' => '1650',
626
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Triple Glazing,Off Road Parking,Fireplace',
627
+			"post_dummy" => '1'
628
+		);
629
+
630
+		break;
631
+
632
+
633
+	case 4:
634
+		$image_array = array();
635
+		$post_meta = array();
636
+		$image_array[] = "$dummy_image_url/ps/psf4.jpg";
637
+		$image_array[] = "$dummy_image_url/ps/psl4.jpg";
638
+		$image_array[] = "$dummy_image_url/ps/psb4.jpg";
639
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
640
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
641
+
642
+		$post_info[] = array(
643
+			"listing_type" => $post_type,
644
+			"post_title" => 'Jesmond Mansion',
645
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
646 646
 
647 647
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
648 648
 
@@ -652,42 +652,42 @@  discard block
 block discarded – undo
652 652
 
653 653
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
654 654
 
655
-            "post_images" => $image_array,
656
-            "post_category" => array($post_type.'category' => array($category_array[1])),
657
-            "post_tags" => array('Tags', 'Sample Tags'),
658
-            "geodir_video" => '',
659
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
660
-            "geodir_contact" => '(222) 777-1111',
661
-            "geodir_email" => '[email protected]',
662
-            "geodir_website" => 'http://example.com/',
663
-            "geodir_twitter" => 'http://example.com/',
664
-            "geodir_facebook" => 'http://example.com/',
665
-            "geodir_price" => '13000',
666
-            "geodir_property_status" => 'Under Offer',
667
-            'geodir_property_furnishing' => 'Partially furnished',
668
-            'geodir_property_type' => 'Detached house',
669
-            'geodir_property_bedrooms' => '10',
670
-            'geodir_property_bathrooms' => '7',
671
-            'geodir_property_area' => '6600',
672
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden,Garage,Private driveway,Fireplace',
673
-            "post_dummy" => '1'
674
-        );
675
-
676
-        break;
677
-
678
-    case 5:
679
-        $image_array = array();
680
-        $post_meta = array();
681
-        $image_array[] = "$dummy_image_url/ps/psf5.jpg";
682
-        $image_array[] = "$dummy_image_url/ps/psl5.jpg";
683
-        $image_array[] = "$dummy_image_url/ps/psb5.jpg";
684
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
685
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
686
-
687
-        $post_info[] = array(
688
-            "listing_type" => $post_type,
689
-            "post_title" => 'Springfield Lodge',
690
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
655
+			"post_images" => $image_array,
656
+			"post_category" => array($post_type.'category' => array($category_array[1])),
657
+			"post_tags" => array('Tags', 'Sample Tags'),
658
+			"geodir_video" => '',
659
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
660
+			"geodir_contact" => '(222) 777-1111',
661
+			"geodir_email" => '[email protected]',
662
+			"geodir_website" => 'http://example.com/',
663
+			"geodir_twitter" => 'http://example.com/',
664
+			"geodir_facebook" => 'http://example.com/',
665
+			"geodir_price" => '13000',
666
+			"geodir_property_status" => 'Under Offer',
667
+			'geodir_property_furnishing' => 'Partially furnished',
668
+			'geodir_property_type' => 'Detached house',
669
+			'geodir_property_bedrooms' => '10',
670
+			'geodir_property_bathrooms' => '7',
671
+			'geodir_property_area' => '6600',
672
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden,Garage,Private driveway,Fireplace',
673
+			"post_dummy" => '1'
674
+		);
675
+
676
+		break;
677
+
678
+	case 5:
679
+		$image_array = array();
680
+		$post_meta = array();
681
+		$image_array[] = "$dummy_image_url/ps/psf5.jpg";
682
+		$image_array[] = "$dummy_image_url/ps/psl5.jpg";
683
+		$image_array[] = "$dummy_image_url/ps/psb5.jpg";
684
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
685
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
686
+
687
+		$post_info[] = array(
688
+			"listing_type" => $post_type,
689
+			"post_title" => 'Springfield Lodge',
690
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
691 691
 
692 692
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
693 693
 
@@ -697,42 +697,42 @@  discard block
 block discarded – undo
697 697
 
698 698
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
699 699
 
700
-            "post_images" => $image_array,
701
-            "post_category" => array($post_type.'category' => array($category_array[1])),
702
-            "post_tags" => array('Tags', 'Sample Tags'),
703
-            "geodir_video" => '',
704
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
705
-            "geodir_contact" => '(222) 777-1111',
706
-            "geodir_email" => '[email protected]',
707
-            "geodir_website" => 'http://example.com/',
708
-            "geodir_twitter" => 'http://example.com/',
709
-            "geodir_facebook" => 'http://example.com/',
710
-            "geodir_price" => '1800',
711
-            "geodir_property_status" => 'For Rent',
712
-            'geodir_property_furnishing' => 'Optional',
713
-            'geodir_property_type' => 'Detached house',
714
-            'geodir_property_bedrooms' => '4',
715
-            'geodir_property_bathrooms' => '3',
716
-            'geodir_property_area' => '3700',
717
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden',
718
-            "post_dummy" => '1'
719
-        );
720
-
721
-        break;
722
-
723
-    case 6:
724
-        $image_array = array();
725
-        $post_meta = array();
726
-        $image_array[] = "$dummy_image_url/ps/psf6.jpg";
727
-        $image_array[] = "$dummy_image_url/ps/psl6.jpg";
728
-        $image_array[] = "$dummy_image_url/ps/psb5.jpg";
729
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
730
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
731
-
732
-        $post_info[] = array(
733
-            "listing_type" => $post_type,
734
-            "post_title" => 'Forrest Park',
735
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
700
+			"post_images" => $image_array,
701
+			"post_category" => array($post_type.'category' => array($category_array[1])),
702
+			"post_tags" => array('Tags', 'Sample Tags'),
703
+			"geodir_video" => '',
704
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
705
+			"geodir_contact" => '(222) 777-1111',
706
+			"geodir_email" => '[email protected]',
707
+			"geodir_website" => 'http://example.com/',
708
+			"geodir_twitter" => 'http://example.com/',
709
+			"geodir_facebook" => 'http://example.com/',
710
+			"geodir_price" => '1800',
711
+			"geodir_property_status" => 'For Rent',
712
+			'geodir_property_furnishing' => 'Optional',
713
+			'geodir_property_type' => 'Detached house',
714
+			'geodir_property_bedrooms' => '4',
715
+			'geodir_property_bathrooms' => '3',
716
+			'geodir_property_area' => '3700',
717
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden',
718
+			"post_dummy" => '1'
719
+		);
720
+
721
+		break;
722
+
723
+	case 6:
724
+		$image_array = array();
725
+		$post_meta = array();
726
+		$image_array[] = "$dummy_image_url/ps/psf6.jpg";
727
+		$image_array[] = "$dummy_image_url/ps/psl6.jpg";
728
+		$image_array[] = "$dummy_image_url/ps/psb5.jpg";
729
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
730
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
731
+
732
+		$post_info[] = array(
733
+			"listing_type" => $post_type,
734
+			"post_title" => 'Forrest Park',
735
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
736 736
 
737 737
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
738 738
 
@@ -742,42 +742,42 @@  discard block
 block discarded – undo
742 742
 
743 743
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
744 744
 
745
-            "post_images" => $image_array,
746
-            "post_category" => array($post_type.'category' => array($category_array[1])),
747
-            "post_tags" => array('Tags', 'Sample Tags'),
748
-            "geodir_video" => '',
749
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
750
-            "geodir_contact" => '(222) 777-1111',
751
-            "geodir_email" => '[email protected]',
752
-            "geodir_website" => 'http://example.com/',
753
-            "geodir_twitter" => 'http://example.com/',
754
-            "geodir_facebook" => 'http://example.com/',
755
-            "geodir_price" => '2700',
756
-            "geodir_property_status" => 'For Rent',
757
-            'geodir_property_furnishing' => 'Unfurnished',
758
-            'geodir_property_type' => 'Detached house',
759
-            'geodir_property_bedrooms' => '5',
760
-            'geodir_property_bathrooms' => '4',
761
-            'geodir_property_area' => '2250',
762
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Front Garden,Private driveway',
763
-            "post_dummy" => '1'
764
-        );
765
-
766
-        break;
767
-
768
-    case 7:
769
-        $image_array = array();
770
-        $post_meta = array();
771
-        $image_array[] = "$dummy_image_url/ps/psf7.jpg";
772
-        $image_array[] = "$dummy_image_url/ps/psl4.jpg";
773
-        $image_array[] = "$dummy_image_url/ps/psb4.jpg";
774
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
775
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
776
-
777
-        $post_info[] = array(
778
-            "listing_type" => $post_type,
779
-            "post_title" => 'Fraser Suites',
780
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
745
+			"post_images" => $image_array,
746
+			"post_category" => array($post_type.'category' => array($category_array[1])),
747
+			"post_tags" => array('Tags', 'Sample Tags'),
748
+			"geodir_video" => '',
749
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
750
+			"geodir_contact" => '(222) 777-1111',
751
+			"geodir_email" => '[email protected]',
752
+			"geodir_website" => 'http://example.com/',
753
+			"geodir_twitter" => 'http://example.com/',
754
+			"geodir_facebook" => 'http://example.com/',
755
+			"geodir_price" => '2700',
756
+			"geodir_property_status" => 'For Rent',
757
+			'geodir_property_furnishing' => 'Unfurnished',
758
+			'geodir_property_type' => 'Detached house',
759
+			'geodir_property_bedrooms' => '5',
760
+			'geodir_property_bathrooms' => '4',
761
+			'geodir_property_area' => '2250',
762
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Front Garden,Private driveway',
763
+			"post_dummy" => '1'
764
+		);
765
+
766
+		break;
767
+
768
+	case 7:
769
+		$image_array = array();
770
+		$post_meta = array();
771
+		$image_array[] = "$dummy_image_url/ps/psf7.jpg";
772
+		$image_array[] = "$dummy_image_url/ps/psl4.jpg";
773
+		$image_array[] = "$dummy_image_url/ps/psb4.jpg";
774
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
775
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
776
+
777
+		$post_info[] = array(
778
+			"listing_type" => $post_type,
779
+			"post_title" => 'Fraser Suites',
780
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
781 781
 
782 782
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
783 783
 
@@ -787,42 +787,42 @@  discard block
 block discarded – undo
787 787
 
788 788
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
789 789
 
790
-            "post_images" => $image_array,
791
-            "post_category" => array($post_type.'category' => array($category_array[0])),
792
-            "post_tags" => array('Tags', 'Sample Tags'),
793
-            "geodir_video" => '',
794
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
795
-            "geodir_contact" => '(222) 777-1111',
796
-            "geodir_email" => '[email protected]',
797
-            "geodir_website" => 'http://example.com/',
798
-            "geodir_twitter" => 'http://example.com/',
799
-            "geodir_facebook" => 'http://example.com/',
800
-            "geodir_price" => '1450',
801
-            "geodir_property_status" => 'For Rent',
802
-            'geodir_property_furnishing' => 'Unfurnished',
803
-            'geodir_property_type' => 'Apartment',
804
-            'geodir_property_bedrooms' => '3',
805
-            'geodir_property_bathrooms' => '2',
806
-            'geodir_property_area' => '1250',
807
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing',
808
-            "post_dummy" => '1'
809
-        );
810
-
811
-        break;
812
-
813
-    case 8:
814
-        $image_array = array();
815
-        $post_meta = array();
816
-        $image_array[] = "$dummy_image_url/ps/psf8.jpg";
817
-        $image_array[] = "$dummy_image_url/ps/psl2.jpg";
818
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
819
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
820
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
821
-
822
-        $post_info[] = array(
823
-            "listing_type" => $post_type,
824
-            "post_title" => 'Richmore Apartments',
825
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
790
+			"post_images" => $image_array,
791
+			"post_category" => array($post_type.'category' => array($category_array[0])),
792
+			"post_tags" => array('Tags', 'Sample Tags'),
793
+			"geodir_video" => '',
794
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
795
+			"geodir_contact" => '(222) 777-1111',
796
+			"geodir_email" => '[email protected]',
797
+			"geodir_website" => 'http://example.com/',
798
+			"geodir_twitter" => 'http://example.com/',
799
+			"geodir_facebook" => 'http://example.com/',
800
+			"geodir_price" => '1450',
801
+			"geodir_property_status" => 'For Rent',
802
+			'geodir_property_furnishing' => 'Unfurnished',
803
+			'geodir_property_type' => 'Apartment',
804
+			'geodir_property_bedrooms' => '3',
805
+			'geodir_property_bathrooms' => '2',
806
+			'geodir_property_area' => '1250',
807
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing',
808
+			"post_dummy" => '1'
809
+		);
810
+
811
+		break;
812
+
813
+	case 8:
814
+		$image_array = array();
815
+		$post_meta = array();
816
+		$image_array[] = "$dummy_image_url/ps/psf8.jpg";
817
+		$image_array[] = "$dummy_image_url/ps/psl2.jpg";
818
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
819
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
820
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
821
+
822
+		$post_info[] = array(
823
+			"listing_type" => $post_type,
824
+			"post_title" => 'Richmore Apartments',
825
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
826 826
 
827 827
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
828 828
 
@@ -832,43 +832,43 @@  discard block
 block discarded – undo
832 832
 
833 833
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
834 834
 
835
-            "post_images" => $image_array,
836
-            "post_category" => array($post_type.'category' => array($category_array[0])),
837
-            "post_tags" => array('Tags', 'Sample Tags'),
838
-            "geodir_video" => '',
839
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
840
-            "geodir_contact" => '(222) 777-1111',
841
-            "geodir_email" => '[email protected]',
842
-            "geodir_website" => 'http://example.com/',
843
-            "geodir_twitter" => 'http://example.com/',
844
-            "geodir_facebook" => 'http://example.com/',
845
-            "geodir_price" => '2000',
846
-            "geodir_property_status" => 'For Rent',
847
-            'geodir_property_furnishing' => 'Unfurnished',
848
-            'geodir_property_type' => 'Apartment',
849
-            'geodir_property_bedrooms' => '2',
850
-            'geodir_property_bathrooms' => '2',
851
-            'geodir_property_area' => '1750',
852
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
853
-            "post_dummy" => '1'
854
-        );
855
-
856
-        break;
857
-
858
-
859
-    case 9:
860
-        $image_array = array();
861
-        $post_meta = array();
862
-        $image_array[] = "$dummy_image_url/ps/psf9.jpg";
863
-        $image_array[] = "$dummy_image_url/ps/psc9.jpg";
864
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
865
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
866
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
867
-
868
-        $post_info[] = array(
869
-            "listing_type" => $post_type,
870
-            "post_title" => 'Hotel Alpina',
871
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
835
+			"post_images" => $image_array,
836
+			"post_category" => array($post_type.'category' => array($category_array[0])),
837
+			"post_tags" => array('Tags', 'Sample Tags'),
838
+			"geodir_video" => '',
839
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
840
+			"geodir_contact" => '(222) 777-1111',
841
+			"geodir_email" => '[email protected]',
842
+			"geodir_website" => 'http://example.com/',
843
+			"geodir_twitter" => 'http://example.com/',
844
+			"geodir_facebook" => 'http://example.com/',
845
+			"geodir_price" => '2000',
846
+			"geodir_property_status" => 'For Rent',
847
+			'geodir_property_furnishing' => 'Unfurnished',
848
+			'geodir_property_type' => 'Apartment',
849
+			'geodir_property_bedrooms' => '2',
850
+			'geodir_property_bathrooms' => '2',
851
+			'geodir_property_area' => '1750',
852
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
853
+			"post_dummy" => '1'
854
+		);
855
+
856
+		break;
857
+
858
+
859
+	case 9:
860
+		$image_array = array();
861
+		$post_meta = array();
862
+		$image_array[] = "$dummy_image_url/ps/psf9.jpg";
863
+		$image_array[] = "$dummy_image_url/ps/psc9.jpg";
864
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
865
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
866
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
867
+
868
+		$post_info[] = array(
869
+			"listing_type" => $post_type,
870
+			"post_title" => 'Hotel Alpina',
871
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
872 872
 
873 873
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
874 874
 
@@ -878,39 +878,39 @@  discard block
 block discarded – undo
878 878
 
879 879
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
880 880
 
881
-            "post_images" => $image_array,
882
-            "post_category" => array($post_type.'category' => array($category_array[2])),
883
-            "post_tags" => array('Tags', 'Sample Tags'),
884
-            "geodir_video" => '',
885
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
886
-            "geodir_contact" => '(222) 777-1111',
887
-            "geodir_email" => '[email protected]',
888
-            "geodir_website" => 'http://example.com/',
889
-            "geodir_twitter" => 'http://example.com/',
890
-            "geodir_facebook" => 'http://example.com/',
891
-            "geodir_price" => '60000',
892
-            "geodir_property_status" => 'For Rent',
893
-            'geodir_property_furnishing' => 'Furnished',
894
-            'geodir_property_type' => 'Hotel',
895
-            'geodir_property_bedrooms' => '120',
896
-            'geodir_property_bathrooms' => '133',
897
-            'geodir_property_area' => '35000',
898
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
899
-            "post_dummy" => '1'
900
-        );
901
-
902
-        break;
903
-
904
-    case 10:
905
-        $image_array = array();
906
-        $post_meta = array();
907
-        $image_array[] = "$dummy_image_url/ps/psf10.jpg";
908
-        $image_array[] = "$dummy_image_url/ps/psf102.jpg";
909
-
910
-        $post_info[] = array(
911
-            "listing_type" => $post_type,
912
-            "post_title" => 'Development Land',
913
-            "post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
881
+			"post_images" => $image_array,
882
+			"post_category" => array($post_type.'category' => array($category_array[2])),
883
+			"post_tags" => array('Tags', 'Sample Tags'),
884
+			"geodir_video" => '',
885
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
886
+			"geodir_contact" => '(222) 777-1111',
887
+			"geodir_email" => '[email protected]',
888
+			"geodir_website" => 'http://example.com/',
889
+			"geodir_twitter" => 'http://example.com/',
890
+			"geodir_facebook" => 'http://example.com/',
891
+			"geodir_price" => '60000',
892
+			"geodir_property_status" => 'For Rent',
893
+			'geodir_property_furnishing' => 'Furnished',
894
+			'geodir_property_type' => 'Hotel',
895
+			'geodir_property_bedrooms' => '120',
896
+			'geodir_property_bathrooms' => '133',
897
+			'geodir_property_area' => '35000',
898
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
899
+			"post_dummy" => '1'
900
+		);
901
+
902
+		break;
903
+
904
+	case 10:
905
+		$image_array = array();
906
+		$post_meta = array();
907
+		$image_array[] = "$dummy_image_url/ps/psf10.jpg";
908
+		$image_array[] = "$dummy_image_url/ps/psf102.jpg";
909
+
910
+		$post_info[] = array(
911
+			"listing_type" => $post_type,
912
+			"post_title" => 'Development Land',
913
+			"post_desc" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut fringilla ipsum congue enim elementum ornare. Vestibulum id ipsum ac massa malesuada rutrum. Curabitur id erat nec mauris hendrerit pretium. Aliquam pretium sollicitudin enim ac hendrerit. Phasellus et enim elit. Mauris ac maximus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ut cursus leo. Aenean lacinia risus ut ex sodales, a dictum eros vulputate. Sed ornare ex eget velit fringilla luctus. Etiam a purus massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam non felis ultrices, dignissim metus mattis, interdum urna.
914 914
 
915 915
 Vivamus at ipsum consectetur, pellentesque lectus vitae, vulputate leo. Cras tincidunt suscipit vulputate. Aenean pretium diam dui, efficitur porttitor lorem cursus in. Aenean convallis, mauris quis fermentum vehicula, purus libero fringilla lorem, placerat ultricies magna velit sit amet neque. Aenean tempor ut eros et volutpat. Proin ac lacus et odio volutpat aliquet. Proin at erat enim. Vivamus venenatis dictum magna, id dignissim lacus molestie non. Nullam ornare placerat metus, quis aliquam orci tincidunt at. Sed semper imperdiet arcu, eu convallis eros fringilla vel.
916 916
 
@@ -920,93 +920,93 @@  discard block
 block discarded – undo
920 920
 
921 921
 Mauris ac elit vitae massa dignissim posuere. Sed blandit nibh ut elementum ullamcorper. Nunc facilisis elit eget lorem bibendum, eu fermentum neque ultrices. Etiam vestibulum gravida sollicitudin. Nullam velit quam, luctus vel suscipit id, ullamcorper sit amet ipsum. Donec a elit ac lorem porttitor gravida. Sed non dui sed lacus vulputate varius. Nullam in tincidunt odio, ac pharetra mauris. Integer ac volutpat quam. Mauris fermentum facilisis porttitor. Nunc ornare vel erat volutpat consectetur. Phasellus ut lacinia ante. Vestibulum massa orci, tincidunt sit amet urna in, maximus mollis ligula.',
922 922
 
923
-            "post_images" => $image_array,
924
-            "post_category" => array($post_type.'category' => array($category_array[3])),
925
-            "post_tags" => array('Tags', 'Sample Tags'),
926
-            "geodir_video" => '',
927
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
928
-            "geodir_contact" => '(222) 777-1111',
929
-            "geodir_email" => '[email protected]',
930
-            "geodir_website" => 'http://example.com/',
931
-            "geodir_twitter" => 'http://example.com/',
932
-            "geodir_facebook" => 'http://example.com/',
933
-            "geodir_price" => '800',
934
-            "geodir_property_status" => 'For Rent',
935
-            'geodir_property_furnishing' => '',
936
-            'geodir_property_type' => 'Land',
937
-            'geodir_property_bedrooms' => '',
938
-            'geodir_property_bathrooms' => '',
939
-            'geodir_property_area' => '250000',
940
-            'geodir_property_features' => '',
941
-            "post_dummy" => '1'
942
-        );
943
-
944
-        break;
923
+			"post_images" => $image_array,
924
+			"post_category" => array($post_type.'category' => array($category_array[3])),
925
+			"post_tags" => array('Tags', 'Sample Tags'),
926
+			"geodir_video" => '',
927
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
928
+			"geodir_contact" => '(222) 777-1111',
929
+			"geodir_email" => '[email protected]',
930
+			"geodir_website" => 'http://example.com/',
931
+			"geodir_twitter" => 'http://example.com/',
932
+			"geodir_facebook" => 'http://example.com/',
933
+			"geodir_price" => '800',
934
+			"geodir_property_status" => 'For Rent',
935
+			'geodir_property_furnishing' => '',
936
+			'geodir_property_type' => 'Land',
937
+			'geodir_property_bedrooms' => '',
938
+			'geodir_property_bathrooms' => '',
939
+			'geodir_property_area' => '250000',
940
+			'geodir_property_features' => '',
941
+			"post_dummy" => '1'
942
+		);
943
+
944
+		break;
945 945
 
946 946
 } // end of switch
947 947
 
948 948
 foreach ($post_info as $post_info) {
949
-    $default_location = geodir_get_default_location();
950
-    if ($city_bound_lat1 > $city_bound_lat2)
951
-        $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1));
952
-    else
953
-        $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2));
949
+	$default_location = geodir_get_default_location();
950
+	if ($city_bound_lat1 > $city_bound_lat2)
951
+		$dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1));
952
+	else
953
+		$dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2));
954 954
 
955 955
 
956
-    if ($city_bound_lng1 > $city_bound_lng2)
957
-        $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1));
958
-    else
959
-        $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2));
956
+	if ($city_bound_lng1 > $city_bound_lng2)
957
+		$dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1));
958
+	else
959
+		$dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2));
960 960
 
961
-    $load_map = get_option('geodir_load_map');
961
+	$load_map = get_option('geodir_load_map');
962 962
     
963
-    if ($load_map == 'osm') {
964
-        $post_address = geodir_get_osm_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
965
-    } else {
966
-        $post_address = geodir_get_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
967
-    }
968
-
969
-    $postal_code = '';
970
-    if (!empty($post_address)) {
971
-        if ($load_map == 'osm') {
972
-            $address = !empty($post_address->formatted_address) ? $post_address->formatted_address : '';
973
-            $postal_code = !empty($post_address->address->postcode) ? $post_address->address->postcode : '';
974
-        } else {
975
-            $addresses = array();
976
-            $addresses_default = array();
963
+	if ($load_map == 'osm') {
964
+		$post_address = geodir_get_osm_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
965
+	} else {
966
+		$post_address = geodir_get_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
967
+	}
968
+
969
+	$postal_code = '';
970
+	if (!empty($post_address)) {
971
+		if ($load_map == 'osm') {
972
+			$address = !empty($post_address->formatted_address) ? $post_address->formatted_address : '';
973
+			$postal_code = !empty($post_address->address->postcode) ? $post_address->address->postcode : '';
974
+		} else {
975
+			$addresses = array();
976
+			$addresses_default = array();
977 977
             
978
-            foreach ($post_address as $add_key => $add_value) {
979
-                if ($add_key < 2 && !empty($add_value->long_name)) {
980
-                    $addresses_default[] = $add_value->long_name;
981
-                }
982
-                if ($add_value->types[0] == 'postal_code') {
983
-                    $postal_code = $add_value->long_name;
984
-                }
985
-                if ($add_value->types[0] == 'street_number') {
986
-                    $addresses[] = $add_value->long_name;
987
-                }
988
-                if ($add_value->types[0] == 'route') {
989
-                    $addresses[] = $add_value->long_name;
990
-                }
991
-                if ($add_value->types[0] == 'neighborhood') {
992
-                    $addresses[] = $add_value->long_name;
993
-                }
994
-                if ($add_value->types[0] == 'sublocality') {
995
-                    $addresses[] = $add_value->long_name;
996
-                }
997
-            }
998
-            $address = !empty($addresses) ? implode(', ', $addresses) : (!empty($addresses_default) ? implode(', ', $addresses_default) : '');
999
-        }
1000
-
1001
-        $post_info['post_address'] = !empty($address) ? $address : $default_location->city;
1002
-        $post_info['post_city'] = $default_location->city;
1003
-        $post_info['post_region'] = $default_location->region;
1004
-        $post_info['post_country'] = $default_location->country;
1005
-        $post_info['post_zip'] = $postal_code;
1006
-        $post_info['post_latitude'] = $dummy_post_latitude;
1007
-        $post_info['post_longitude'] = $dummy_post_longitude;
1008
-    }
978
+			foreach ($post_address as $add_key => $add_value) {
979
+				if ($add_key < 2 && !empty($add_value->long_name)) {
980
+					$addresses_default[] = $add_value->long_name;
981
+				}
982
+				if ($add_value->types[0] == 'postal_code') {
983
+					$postal_code = $add_value->long_name;
984
+				}
985
+				if ($add_value->types[0] == 'street_number') {
986
+					$addresses[] = $add_value->long_name;
987
+				}
988
+				if ($add_value->types[0] == 'route') {
989
+					$addresses[] = $add_value->long_name;
990
+				}
991
+				if ($add_value->types[0] == 'neighborhood') {
992
+					$addresses[] = $add_value->long_name;
993
+				}
994
+				if ($add_value->types[0] == 'sublocality') {
995
+					$addresses[] = $add_value->long_name;
996
+				}
997
+			}
998
+			$address = !empty($addresses) ? implode(', ', $addresses) : (!empty($addresses_default) ? implode(', ', $addresses_default) : '');
999
+		}
1000
+
1001
+		$post_info['post_address'] = !empty($address) ? $address : $default_location->city;
1002
+		$post_info['post_city'] = $default_location->city;
1003
+		$post_info['post_region'] = $default_location->region;
1004
+		$post_info['post_country'] = $default_location->country;
1005
+		$post_info['post_zip'] = $postal_code;
1006
+		$post_info['post_latitude'] = $dummy_post_latitude;
1007
+		$post_info['post_longitude'] = $dummy_post_longitude;
1008
+	}
1009 1009
     
1010
-    geodir_save_listing($post_info, true);
1011
-    echo 1;
1010
+	geodir_save_listing($post_info, true);
1011
+	echo 1;
1012 1012
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-function geodir_property_rent_custom_fields($post_type='gd_place',$package_id=''){
9
+function geodir_property_rent_custom_fields($post_type = 'gd_place', $package_id = '') {
10 10
     $fields = array();
11
-    $package = ($package_id=='') ? '' : array($package_id);
11
+    $package = ($package_id == '') ? '' : array($package_id);
12 12
 
13 13
     // price
14 14
     $fields[] = array('listing_type' => $post_type,
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                       'default_value'       =>  '',
79 79
                       'show_in' 	        =>  '[detail],[listing]',
80 80
                       'is_required'         =>  true,
81
-                      'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
81
+                      'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'),
82 82
                       'validation_pattern'  =>  '',
83 83
                       'validation_msg'      =>  '',
84 84
                       'required_msg'        =>  '',
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                       'default_value'       =>  '',
102 102
                       'show_in' 	        =>  '[detail],[listing]',
103 103
                       'is_required'         =>  true,
104
-                      'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage,Hotel,Land','geodirectory'),
104
+                      'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage,Hotel,Land', 'geodirectory'),
105 105
                       'validation_pattern'  =>  '',
106 106
                       'validation_msg'      =>  '',
107 107
                       'required_msg'        =>  '',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                       'default_value'       =>  '',
125 125
                       'show_in' 	        =>  '[detail],[listing]',
126 126
                       'is_required'         =>  true,
127
-                      'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
127
+                      'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
128 128
                       'validation_pattern'  =>  '',
129 129
                       'validation_msg'      =>  '',
130 130
                       'required_msg'        =>  '',
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                       'default_value'       =>  '',
148 148
                       'show_in' 	        =>  '[detail],[listing]',
149 149
                       'is_required'         =>  true,
150
-                      'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
150
+                      'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
151 151
                       'validation_pattern'  =>  '',
152 152
                       'validation_msg'      =>  '',
153 153
                       'required_msg'        =>  '',
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                       'default_value'       =>  '',
193 193
                       'show_in' 	        =>  '[detail],[listing]',
194 194
                       'is_required'         =>  false,
195
-                      'option_values'       =>  __('Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
195
+                      'option_values'       =>  __('Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'),
196 196
                       'validation_pattern'  =>  '',
197 197
                       'validation_msg'      =>  '',
198 198
                       'required_msg'        =>  '',
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     return  $fields;
216 216
 }
217 217
 
218
-function geodir_property_rent_custom_fields_sort($post_type='gd_place') {
218
+function geodir_property_rent_custom_fields_sort($post_type = 'gd_place') {
219 219
 
220 220
 
221 221
     $fields = array();
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
         'field_type'              => 'text',
228 228
         'data_type'               => '',
229 229
         'htmlvar_name'            => 'geodir_price',
230
-        'site_title'              => __('Price','geodirectory'),
230
+        'site_title'              => __('Price', 'geodirectory'),
231 231
         'asc'                     => 1,
232
-        'asc_title'               => __('Price (lowest first)','geodirectory'),
232
+        'asc_title'               => __('Price (lowest first)', 'geodirectory'),
233 233
         'desc'                    => 1,
234
-        'desc_title'              => __('Price (highest first)','geodirectory'),
234
+        'desc_title'              => __('Price (highest first)', 'geodirectory'),
235 235
         'is_active'               => 1
236 236
     );
237 237
 
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
         'field_type'              => 'text',
243 243
         'data_type'               => '',
244 244
         'htmlvar_name'            => 'geodir_property_area',
245
-        'site_title'              => __('Area (Sq Ft)','geodirectory'),
245
+        'site_title'              => __('Area (Sq Ft)', 'geodirectory'),
246 246
         'asc'                     => 1,
247
-        'asc_title'               => __('Area (smallest first)','geodirectory'),
247
+        'asc_title'               => __('Area (smallest first)', 'geodirectory'),
248 248
         'desc'                    => 1,
249
-        'desc_title'              => __('Area (largest first)','geodirectory'),
249
+        'desc_title'              => __('Area (largest first)', 'geodirectory'),
250 250
         'is_active'               => 1
251 251
     );
252 252
 
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
         'field_type'              => 'select',
258 258
         'data_type'               => '',
259 259
         'htmlvar_name'            => 'geodir_property_bedrooms',
260
-        'site_title'              => __('Area (Sq Ft)','geodirectory'),
260
+        'site_title'              => __('Area (Sq Ft)', 'geodirectory'),
261 261
         'asc'                     => 1,
262
-        'asc_title'               => __('Bedrooms (least)','geodirectory'),
262
+        'asc_title'               => __('Bedrooms (least)', 'geodirectory'),
263 263
         'desc'                    => 1,
264
-        'desc_title'              => __('Bedrooms (most)','geodirectory'),
264
+        'desc_title'              => __('Bedrooms (most)', 'geodirectory'),
265 265
         'is_active'               => 1
266 266
     );
267 267
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 }
279 279
 
280
-function geodir_property_rent_custom_fields_advanced_search($post_type='gd_place') {
280
+function geodir_property_rent_custom_fields_advanced_search($post_type = 'gd_place') {
281 281
 
282 282
 
283 283
     $fields = array();
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
     return $fields;
456 456
 }
457 457
 
458
-global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2,$wpdb, $current_user,$dummy_post_index;
458
+global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2, $wpdb, $current_user, $dummy_post_index;
459 459
 $post_info = array();
460 460
 $image_array = array();
461 461
 $post_meta = array();
462 462
 $category_array = array('Apartments', 'Houses', 'Commercial', 'Land');
463 463
 
464
-if($dummy_post_index==1){
464
+if ($dummy_post_index == 1) {
465 465
     // add the dummy categories
466
-    geodir_dummy_data_taxonomies($post_type,$category_array );
466
+    geodir_dummy_data_taxonomies($post_type, $category_array);
467 467
 
468 468
     // add the dummy custom fields
469 469
     $fields = geodir_property_rent_custom_fields($post_type);
@@ -471,24 +471,24 @@  discard block
 block discarded – undo
471 471
 
472 472
     // add sort order items
473 473
     $sort_fields = geodir_property_rent_custom_fields_sort($post_type);
474
-    foreach($sort_fields as $sort){
474
+    foreach ($sort_fields as $sort) {
475 475
         geodir_custom_sort_field_save($sort);
476 476
     }
477 477
 
478 478
     // update the type currently installed
479
-    update_option($post_type.'_dummy_data_type','property_rent');
479
+    update_option($post_type.'_dummy_data_type', 'property_rent');
480 480
 
481 481
     // add the advanced search fields
482
-    if (defined('GEODIRADVANCESEARCH_VERSION')){
482
+    if (defined('GEODIRADVANCESEARCH_VERSION')) {
483 483
         $search_fields = geodir_property_rent_custom_fields_advanced_search($post_type);
484
-        foreach($search_fields as $sfield){
485
-            geodir_custom_advance_search_field_save( $sfield );
484
+        foreach ($search_fields as $sfield) {
485
+            geodir_custom_advance_search_field_save($sfield);
486 486
         }
487 487
     }
488 488
 }
489 489
 
490 490
 if (geodir_dummy_folder_exists())
491
-    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
491
+    $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy";
492 492
 else
493 493
     $dummy_image_url = 'https://wpgeodirectory.com/dummy';
494 494
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -488,10 +488,11 @@  discard block
 block discarded – undo
488 488
     }
489 489
 }
490 490
 
491
-if (geodir_dummy_folder_exists())
491
+if (geodir_dummy_folder_exists()) {
492 492
     $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
493
-else
493
+} else {
494 494
     $dummy_image_url = 'https://wpgeodirectory.com/dummy';
495
+}
495 496
 
496 497
 $dummy_image_url = apply_filters('place_dummy_image_url', $dummy_image_url);
497 498
 
@@ -948,16 +949,18 @@  discard block
 block discarded – undo
948 949
 
949 950
 foreach ($post_info as $post_info) {
950 951
     $default_location = geodir_get_default_location();
951
-    if ($city_bound_lat1 > $city_bound_lat2)
952
-        $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1));
953
-    else
954
-        $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2));
952
+    if ($city_bound_lat1 > $city_bound_lat2) {
953
+            $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1));
954
+    } else {
955
+            $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2));
956
+    }
955 957
 
956 958
 
957
-    if ($city_bound_lng1 > $city_bound_lng2)
958
-        $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1));
959
-    else
960
-        $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2));
959
+    if ($city_bound_lng1 > $city_bound_lng2) {
960
+            $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1));
961
+    } else {
962
+            $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2));
963
+    }
961 964
 
962 965
     $load_map = get_option('geodir_load_map');
963 966
     
Please login to merge, or discard this patch.
geodirectory-admin/admin_dummy_data_functions.php 3 patches
Braces   +13 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,10 +42,11 @@  discard block
 block discarded – undo
42 42
                     }
43 43
 
44 44
 
45
-                    if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
-                    else
48
-                        $dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
45
+                    if (geodir_dummy_folder_exists()) {
46
+                                            $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
+                    } else {
48
+                                            $dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
49
+                    }
49 50
 
50 51
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 52
 
@@ -86,10 +87,11 @@  discard block
 block discarded – undo
86 87
             if (!term_exists($catname, $post_type.'category')) {
87 88
                 $last_catid = wp_insert_term($catname, $post_type.'category');
88 89
 
89
-                if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
-                else
92
-                    $dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
90
+                if (geodir_dummy_folder_exists()) {
91
+                                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
92
+                } else {
93
+                                    $dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
94
+                }
93 95
 
94 96
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
95 97
 
@@ -220,7 +222,7 @@  discard block
 block discarded – undo
220 222
                  * @package GeoDirectory
221 223
                  */
222 224
                 include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
225
+            } elseif($key=='property_sale'){
224 226
                 /**
225 227
                  * Contains dummy property for sale post content.
226 228
                  *
@@ -228,7 +230,7 @@  discard block
 block discarded – undo
228 230
                  * @package GeoDirectory
229 231
                  */
230 232
                 include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
233
+            } elseif($key=='property_rent'){
232 234
                 /**
233 235
                  * Contains dummy property for sale post content.
234 236
                  *
@@ -337,7 +339,7 @@  discard block
 block discarded – undo
337 339
 
338 340
                     if($post_counts > 0){
339 341
                         echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
-                    }else{
342
+                    } else{
341 343
                         echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342 344
                     }
343 345
 
Please login to merge, or discard this patch.
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -19,151 +19,151 @@  discard block
 block discarded – undo
19 19
  * @global string $dummy_image_path The dummy image path.
20 20
  */
21 21
 function geodir_dummy_data_taxonomies($post_type,$category_array) {
22
-    global $wpdb, $dummy_image_path;
22
+	global $wpdb, $dummy_image_path;
23 23
 
24 24
 
25 25
 
26
-    $last_catid = '';
26
+	$last_catid = '';
27 27
 
28
-    $uploads = wp_upload_dir(); // Array of key => value pairs
28
+	$uploads = wp_upload_dir(); // Array of key => value pairs
29 29
 
30
-    for ($i = 0; $i < count($category_array); $i++) {
31
-        $parent_catid = 0;
32
-        if (is_array($category_array[$i])) {
33
-            $cat_name_arr = $category_array[$i];
34
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
35
-                $catname = $cat_name_arr[$j];
30
+	for ($i = 0; $i < count($category_array); $i++) {
31
+		$parent_catid = 0;
32
+		if (is_array($category_array[$i])) {
33
+			$cat_name_arr = $category_array[$i];
34
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
35
+				$catname = $cat_name_arr[$j];
36 36
 
37
-                if (!term_exists($catname, $post_type.'category')) {
38
-                    $last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid));
37
+				if (!term_exists($catname, $post_type.'category')) {
38
+					$last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid));
39 39
 
40
-                    if ($j == 0) {
41
-                        $parent_catid = $last_catid;
42
-                    }
40
+					if ($j == 0) {
41
+						$parent_catid = $last_catid;
42
+					}
43 43
 
44 44
 
45
-                    if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
-                    else
48
-                        $dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
45
+					if (geodir_dummy_folder_exists())
46
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
+					else
48
+						$dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
49 49
 
50
-                    $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
50
+					$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 51
 
52
-                    $catname = str_replace(' ', '_', $catname);
53
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
52
+					$catname = str_replace(' ', '_', $catname);
53
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
54 54
 
55
-                    if (empty($uploaded['error'])) {
56
-                        $new_path = $uploaded['file'];
57
-                        $new_url = $uploaded['url'];
58
-                    }
55
+					if (empty($uploaded['error'])) {
56
+						$new_path = $uploaded['file'];
57
+						$new_url = $uploaded['url'];
58
+					}
59 59
 
60
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
61
-
62
-                    $attachment = array(
63
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
64
-                        'post_mime_type' => $wp_filetype['type'],
65
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66
-                        'post_content' => '',
67
-                        'post_status' => 'inherit'
68
-                    );
69
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
70
-
71
-                    // you must first include the image.php file
72
-                    // for the function wp_generate_attachment_metadata() to work
73
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
74
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75
-                    wp_update_attachment_metadata($attach_id, $attach_data);
76
-
77
-                    if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
-                        geodir_update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
79
-                    }
80
-                }
81
-            }
60
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
82 61
 
83
-        } else {
84
-            $catname = $category_array[$i];
62
+					$attachment = array(
63
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
64
+						'post_mime_type' => $wp_filetype['type'],
65
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66
+						'post_content' => '',
67
+						'post_status' => 'inherit'
68
+					);
69
+					$attach_id = wp_insert_attachment($attachment, $new_path);
85 70
 
86
-            if (!term_exists($catname, $post_type.'category')) {
87
-                $last_catid = wp_insert_term($catname, $post_type.'category');
71
+					// you must first include the image.php file
72
+					// for the function wp_generate_attachment_metadata() to work
73
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
74
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75
+					wp_update_attachment_metadata($attach_id, $attach_data);
88 76
 
89
-                if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
-                else
92
-                    $dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
77
+					if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
+						geodir_update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
79
+					}
80
+				}
81
+			}
93 82
 
94
-                $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
83
+		} else {
84
+			$catname = $category_array[$i];
95 85
 
96
-                $catname = str_replace(' ', '_', $catname);
97
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
86
+			if (!term_exists($catname, $post_type.'category')) {
87
+				$last_catid = wp_insert_term($catname, $post_type.'category');
98 88
 
99
-                if (empty($uploaded['error'])) {
100
-                    $new_path = $uploaded['file'];
101
-                    $new_url = $uploaded['url'];
102
-                }
89
+				if (geodir_dummy_folder_exists())
90
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
+				else
92
+					$dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
103 93
 
104
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
94
+				$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
105 95
 
106
-                $attachment = array(
107
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
108
-                    'post_mime_type' => $wp_filetype['type'],
109
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110
-                    'post_content' => '',
111
-                    'post_status' => 'inherit'
112
-                );
96
+				$catname = str_replace(' ', '_', $catname);
97
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
113 98
 
114
-                $attach_id = wp_insert_attachment($attachment, $new_path);
99
+				if (empty($uploaded['error'])) {
100
+					$new_path = $uploaded['file'];
101
+					$new_url = $uploaded['url'];
102
+				}
115 103
 
104
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
116 105
 
117
-                // you must first include the image.php file
118
-                // for the function wp_generate_attachment_metadata() to work
119
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
120
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121
-                wp_update_attachment_metadata($attach_id, $attach_data);
106
+				$attachment = array(
107
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
108
+					'post_mime_type' => $wp_filetype['type'],
109
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110
+					'post_content' => '',
111
+					'post_status' => 'inherit'
112
+				);
113
+
114
+				$attach_id = wp_insert_attachment($attachment, $new_path);
122 115
 
123
-                if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
-                    geodir_update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type);
125
-                }
126
-            }
127
-        }
128 116
 
129
-    }
117
+				// you must first include the image.php file
118
+				// for the function wp_generate_attachment_metadata() to work
119
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
120
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121
+				wp_update_attachment_metadata($attach_id, $attach_data);
122
+
123
+				if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
+					geodir_update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type);
125
+				}
126
+			}
127
+		}
128
+
129
+	}
130 130
 }
131 131
 
132 132
 
133 133
 function geodir_dummy_data_types(){
134
-    $data =  array(
135
-        'standard_places' => array(
136
-            'name'=>__('Default','geodirectory'),
137
-            'count'=> 30
138
-        ),
139
-        'property_sale' => array(
140
-            'name'=>__('Property for sale','geodirectory'),
141
-            'count'=> 10
142
-        ),
143
-        'property_rent' => array(
144
-            'name'=>__('Property for rent','geodirectory'),
145
-            'count'=> 10
146
-        )
147
-    );
148
-
149
-    return apply_filters('geodir_dummy_data_types',$data );
134
+	$data =  array(
135
+		'standard_places' => array(
136
+			'name'=>__('Default','geodirectory'),
137
+			'count'=> 30
138
+		),
139
+		'property_sale' => array(
140
+			'name'=>__('Property for sale','geodirectory'),
141
+			'count'=> 10
142
+		),
143
+		'property_rent' => array(
144
+			'name'=>__('Property for rent','geodirectory'),
145
+			'count'=> 10
146
+		)
147
+	);
148
+
149
+	return apply_filters('geodir_dummy_data_types',$data );
150 150
 }
151 151
 
152 152
 
153 153
 function geodir_create_dummy_fields($fields)
154 154
 {
155 155
     
156
-    /**
157
-     * Filter the array of default custom fields DB table data.
158
-     *
159
-     * @since 1.0.0
160
-     * @param string $fields The default custom fields as an array.
161
-     */
162
-    $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
163
-    foreach ($fields as $field_index => $field) {
164
-        geodir_custom_field_save($field);
165
-
166
-    }
156
+	/**
157
+	 * Filter the array of default custom fields DB table data.
158
+	 *
159
+	 * @since 1.0.0
160
+	 * @param string $fields The default custom fields as an array.
161
+	 */
162
+	$fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
163
+	foreach ($fields as $field_index => $field) {
164
+		geodir_custom_field_save($field);
165
+
166
+	}
167 167
 }
168 168
 
169 169
 /**
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function geodir_delete_dummy_posts($post_type,$data_type)
178 178
 {
179
-    global $wpdb, $plugin_prefix;
179
+	global $wpdb, $plugin_prefix;
180 180
 
181 181
 
182
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
182
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
183 183
 
184 184
 
185
-    foreach ($post_ids as $post_ids_obj) {
186
-        wp_delete_post($post_ids_obj->post_id);
187
-    }
185
+	foreach ($post_ids as $post_ids_obj) {
186
+		wp_delete_post($post_ids_obj->post_id);
187
+	}
188 188
 
189
-    //double check posts are deleted
190
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
189
+	//double check posts are deleted
190
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
191 191
 
192
-    update_option($post_type.'_dummy_data_type','');
192
+	update_option($post_type.'_dummy_data_type','');
193 193
 }
194 194
 
195 195
 /**
@@ -203,78 +203,78 @@  discard block
 block discarded – undo
203 203
 function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
204 204
 {
205 205
 
206
-    @ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
207
-    $data_types = geodir_dummy_data_types();
208
-
209
-    $total_count = 0;
210
-    global $dummy_post_index;
211
-    $dummy_post_index = $item_index;
212
-    foreach( $data_types as $key=>$val){
213
-        if($key==$data_type){
214
-            $total_count = $val['count'];
215
-            if($key=='standard_places'){
216
-                /**
217
-                 * Contains dummy post content.
218
-                 *
219
-                 * @since 1.0.0
220
-                 * @package GeoDirectory
221
-                 */
222
-                include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
224
-                /**
225
-                 * Contains dummy property for sale post content.
226
-                 *
227
-                 * @since 1.6.11
228
-                 * @package GeoDirectory
229
-                 */
230
-                include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
232
-                /**
233
-                 * Contains dummy property for sale post content.
234
-                 *
235
-                 * @since 1.6.11
236
-                 * @package GeoDirectory
237
-                 */
238
-                include_once( 'dummy-data/property_rent.php' );
239
-            }
240
-
241
-        }
242
-
243
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
244
-    }
245
-
246
-
247
-
248
-    // delete image cache on last entry
249
-    if($total_count == $item_index){
250
-        delete_transient( 'cached_dummy_images' );
251
-        flush_rewrite_rules();
252
-    }
206
+	@ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
207
+	$data_types = geodir_dummy_data_types();
208
+
209
+	$total_count = 0;
210
+	global $dummy_post_index;
211
+	$dummy_post_index = $item_index;
212
+	foreach( $data_types as $key=>$val){
213
+		if($key==$data_type){
214
+			$total_count = $val['count'];
215
+			if($key=='standard_places'){
216
+				/**
217
+				 * Contains dummy post content.
218
+				 *
219
+				 * @since 1.0.0
220
+				 * @package GeoDirectory
221
+				 */
222
+				include_once( 'dummy-data/standard_places.php' );
223
+			}elseif($key=='property_sale'){
224
+				/**
225
+				 * Contains dummy property for sale post content.
226
+				 *
227
+				 * @since 1.6.11
228
+				 * @package GeoDirectory
229
+				 */
230
+				include_once( 'dummy-data/property_sale.php' );
231
+			}elseif($key=='property_rent'){
232
+				/**
233
+				 * Contains dummy property for sale post content.
234
+				 *
235
+				 * @since 1.6.11
236
+				 * @package GeoDirectory
237
+				 */
238
+				include_once( 'dummy-data/property_rent.php' );
239
+			}
240
+
241
+		}
242
+
243
+		do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
244
+	}
245
+
246
+
247
+
248
+	// delete image cache on last entry
249
+	if($total_count == $item_index){
250
+		delete_transient( 'cached_dummy_images' );
251
+		flush_rewrite_rules();
252
+	}
253 253
 
254 254
 
255 255
 }
256 256
 
257 257
 
258 258
 if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
259
-    /**
260
-     * GeoDirectory dummy data installation.
261
-     *
262
-     * @since 1.0.0
263
-     * @package GeoDirectory
264
-     * @global object $wpdb WordPress Database object.
265
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
266
-     * @param string $post_type The post type.
267
-     */
268
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
269
-    {
270
-
271
-        global $wpdb, $plugin_prefix;
272
-
273
-        if (!geodir_is_default_location_set()) {
274
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
275
-        } else {
276
-
277
-            ?>
259
+	/**
260
+	 * GeoDirectory dummy data installation.
261
+	 *
262
+	 * @since 1.0.0
263
+	 * @package GeoDirectory
264
+	 * @global object $wpdb WordPress Database object.
265
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
266
+	 * @param string $post_type The post type.
267
+	 */
268
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
269
+	{
270
+
271
+		global $wpdb, $plugin_prefix;
272
+
273
+		if (!geodir_is_default_location_set()) {
274
+			echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
275
+		} else {
276
+
277
+			?>
278 278
             <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span>
279 279
             <table class="form-table gd-dummy-table">
280 280
                 <tbody>
@@ -286,78 +286,78 @@  discard block
 block discarded – undo
286 286
 
287 287
                 <?php
288 288
 
289
-                $cpts = geodir_get_posttypes('array');
289
+				$cpts = geodir_get_posttypes('array');
290 290
 
291
-                $data_types = geodir_dummy_data_types();
291
+				$data_types = geodir_dummy_data_types();
292 292
 
293
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
293
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
294 294
 
295
-                foreach($cpts as $post_type=>$cpt){
295
+				foreach($cpts as $post_type=>$cpt){
296 296
 
297
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
297
+					$data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
298 298
 
299 299
 
300
-                    $set_dt = get_option($post_type.'_dummy_data_type');
300
+					$set_dt = get_option($post_type.'_dummy_data_type');
301 301
 
302
-                    $count = 30;
302
+					$count = 30;
303 303
 
304
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
304
+					geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
305 305
 
306
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
306
+					$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
307 307
 
308
-                    echo "<tr>";
309
-                    echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
308
+					echo "<tr>";
309
+					echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
310 310
 
311 311
 
312
-                    $select_disabled = $post_counts > 0 ? 'disabled' : '';
313
-                    echo "<td>";
314
-                    echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
312
+					$select_disabled = $post_counts > 0 ? 'disabled' : '';
313
+					echo "<td>";
314
+					echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
315 315
 
316
-                    foreach($data_types_for as $key=>$val){
317
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
318
-                        if($selected || count($data_types_for)==1){$count = $val['count'];}
319
-                        echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320
-                    }
321
-                    echo "</select>";
322
-
323
-                    $select_display = $post_counts > 0 ? 'display:none;' : '';
324
-                    echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325
-                    $x = 1;
326
-                    while($x <= $count){
327
-                        $selected = ($x==$count) ? "selected='selected'" : '';
328
-                        echo "<option $selected value='$x'>".$x."</option>";
329
-                        $x++;
330
-                    }
331
-                    echo "</select>";
332
-                    echo "</td>";
316
+					foreach($data_types_for as $key=>$val){
317
+						$selected = ($key==$set_dt) ? "selected='selected'" : '';
318
+						if($selected || count($data_types_for)==1){$count = $val['count'];}
319
+						echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320
+					}
321
+					echo "</select>";
333 322
 
323
+					$select_display = $post_counts > 0 ? 'display:none;' : '';
324
+					echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325
+					$x = 1;
326
+					while($x <= $count){
327
+						$selected = ($x==$count) ? "selected='selected'" : '';
328
+						echo "<option $selected value='$x'>".$x."</option>";
329
+						$x++;
330
+					}
331
+					echo "</select>";
332
+					echo "</td>";
334 333
 
335 334
 
336 335
 
337 336
 
338
-                    if($post_counts > 0){
339
-                        echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
-                    }else{
341
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342
-                    }
343 337
 
344
-                    echo "</tr>";
345
-                    //print_r($cpt);
346
-                }
338
+					if($post_counts > 0){
339
+						echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
+					}else{
341
+						echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342
+					}
343
+
344
+					echo "</tr>";
345
+					//print_r($cpt);
346
+				}
347 347
 
348
-                ?>
348
+				?>
349 349
                 </tbody>
350 350
             </table>
351 351
             <?php
352 352
 
353 353
 
354
-            $default_location = geodir_get_default_location();
355
-            $city = isset($default_location->city) ? $default_location->city : '';
356
-            $region = isset($default_location->region) ? $default_location->region : '';
357
-            $country = isset($default_location->country) ? $default_location->country : '';
358
-            $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
359
-            $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
360
-            ?>
354
+			$default_location = geodir_get_default_location();
355
+			$city = isset($default_location->city) ? $default_location->city : '';
356
+			$region = isset($default_location->region) ? $default_location->region : '';
357
+			$country = isset($default_location->country) ? $default_location->country : '';
358
+			$city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
359
+			$city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
360
+			?>
361 361
             <script type="text/javascript">
362 362
 
363 363
                 function geodir_dummy_set_count(data,cpt){
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                 }
534 534
             </script>
535 535
             <?php
536
-        }
537
-    }
536
+		}
537
+	}
538 538
 }
539 539
 
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @global object $wpdb WordPress Database object.
19 19
  * @global string $dummy_image_path The dummy image path.
20 20
  */
21
-function geodir_dummy_data_taxonomies($post_type,$category_array) {
21
+function geodir_dummy_data_taxonomies($post_type, $category_array) {
22 22
     global $wpdb, $dummy_image_path;
23 23
 
24 24
 
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 
44 44
 
45 45
                     if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
46
+                        $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
47 47
                     else
48 48
                         $dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
49 49
 
50 50
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 51
 
52 52
                     $catname = str_replace(' ', '_', $catname);
53
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
53
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
54 54
 
55 55
                     if (empty($uploaded['error'])) {
56 56
                         $new_path = $uploaded['file'];
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                     $wp_filetype = wp_check_filetype(basename($new_path), null);
61 61
 
62 62
                     $attachment = array(
63
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
63
+                        'guid' => $uploads['baseurl'].'/'.basename($new_path),
64 64
                         'post_mime_type' => $wp_filetype['type'],
65 65
                         'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66 66
                         'post_content' => '',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
                     // you must first include the image.php file
72 72
                     // for the function wp_generate_attachment_metadata() to work
73
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
73
+                    require_once(ABSPATH.'wp-admin/includes/image.php');
74 74
                     $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75 75
                     wp_update_attachment_metadata($attach_id, $attach_data);
76 76
 
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
                 $last_catid = wp_insert_term($catname, $post_type.'category');
88 88
 
89 89
                 if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
90
+                    $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
91 91
                 else
92 92
                     $dummy_image_url = 'http://wpgeodirectory.com/dummy/cat_icon';
93 93
 
94 94
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
95 95
 
96 96
                 $catname = str_replace(' ', '_', $catname);
97
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
97
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
98 98
 
99 99
                 if (empty($uploaded['error'])) {
100 100
                     $new_path = $uploaded['file'];
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 $wp_filetype = wp_check_filetype(basename($new_path), null);
105 105
 
106 106
                 $attachment = array(
107
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
107
+                    'guid' => $uploads['baseurl'].'/'.basename($new_path),
108 108
                     'post_mime_type' => $wp_filetype['type'],
109 109
                     'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110 110
                     'post_content' => '',
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
                 // you must first include the image.php file
118 118
                 // for the function wp_generate_attachment_metadata() to work
119
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
119
+                require_once(ABSPATH.'wp-admin/includes/image.php');
120 120
                 $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121 121
                 wp_update_attachment_metadata($attach_id, $attach_data);
122 122
 
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 }
131 131
 
132 132
 
133
-function geodir_dummy_data_types(){
134
-    $data =  array(
133
+function geodir_dummy_data_types() {
134
+    $data = array(
135 135
         'standard_places' => array(
136
-            'name'=>__('Default','geodirectory'),
136
+            'name'=>__('Default', 'geodirectory'),
137 137
             'count'=> 30
138 138
         ),
139 139
         'property_sale' => array(
140
-            'name'=>__('Property for sale','geodirectory'),
140
+            'name'=>__('Property for sale', 'geodirectory'),
141 141
             'count'=> 10
142 142
         ),
143 143
         'property_rent' => array(
144
-            'name'=>__('Property for rent','geodirectory'),
144
+            'name'=>__('Property for rent', 'geodirectory'),
145 145
             'count'=> 10
146 146
         )
147 147
     );
148 148
 
149
-    return apply_filters('geodir_dummy_data_types',$data );
149
+    return apply_filters('geodir_dummy_data_types', $data);
150 150
 }
151 151
 
152 152
 
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
  * @global object $wpdb WordPress Database object.
175 175
  * @global string $plugin_prefix Geodirectory plugin table prefix.
176 176
  */
177
-function geodir_delete_dummy_posts($post_type,$data_type)
177
+function geodir_delete_dummy_posts($post_type, $data_type)
178 178
 {
179 179
     global $wpdb, $plugin_prefix;
180 180
 
181 181
 
182
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
182
+    $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
183 183
 
184 184
 
185 185
     foreach ($post_ids as $post_ids_obj) {
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     }
188 188
 
189 189
     //double check posts are deleted
190
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
190
+    $wpdb->get_results("DELETE FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
191 191
 
192
-    update_option($post_type.'_dummy_data_type','');
192
+    update_option($post_type.'_dummy_data_type', '');
193 193
 }
194 194
 
195 195
 /**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
  * @global object $wpdb WordPress Database object.
201 201
  * @global object $current_user Current user object.
202 202
  */
203
-function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
203
+function geodir_insert_dummy_posts($post_type, $data_type, $item_index)
204 204
 {
205 205
 
206 206
     @ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
@@ -209,45 +209,45 @@  discard block
 block discarded – undo
209 209
     $total_count = 0;
210 210
     global $dummy_post_index;
211 211
     $dummy_post_index = $item_index;
212
-    foreach( $data_types as $key=>$val){
213
-        if($key==$data_type){
212
+    foreach ($data_types as $key=>$val) {
213
+        if ($key == $data_type) {
214 214
             $total_count = $val['count'];
215
-            if($key=='standard_places'){
215
+            if ($key == 'standard_places') {
216 216
                 /**
217 217
                  * Contains dummy post content.
218 218
                  *
219 219
                  * @since 1.0.0
220 220
                  * @package GeoDirectory
221 221
                  */
222
-                include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
222
+                include_once('dummy-data/standard_places.php');
223
+            }elseif ($key == 'property_sale') {
224 224
                 /**
225 225
                  * Contains dummy property for sale post content.
226 226
                  *
227 227
                  * @since 1.6.11
228 228
                  * @package GeoDirectory
229 229
                  */
230
-                include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
230
+                include_once('dummy-data/property_sale.php');
231
+            }elseif ($key == 'property_rent') {
232 232
                 /**
233 233
                  * Contains dummy property for sale post content.
234 234
                  *
235 235
                  * @since 1.6.11
236 236
                  * @package GeoDirectory
237 237
                  */
238
-                include_once( 'dummy-data/property_rent.php' );
238
+                include_once('dummy-data/property_rent.php');
239 239
             }
240 240
 
241 241
         }
242 242
 
243
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
243
+        do_action('geodir_insert_dummy_data_loop', $post_type, $data_type, $item_index);
244 244
     }
245 245
 
246 246
 
247 247
 
248 248
     // delete image cache on last entry
249
-    if($total_count == $item_index){
250
-        delete_transient( 'cached_dummy_images' );
249
+    if ($total_count == $item_index) {
250
+        delete_transient('cached_dummy_images');
251 251
         flush_rewrite_rules();
252 252
     }
253 253
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 }
256 256
 
257 257
 
258
-if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
258
+if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined('GD_TESTING_MODE'))) {
259 259
     /**
260 260
      * GeoDirectory dummy data installation.
261 261
      *
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
         global $wpdb, $plugin_prefix;
272 272
 
273 273
         if (!geodir_is_default_location_set()) {
274
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
274
+            echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>';
275 275
         } else {
276 276
 
277 277
             ?>
278
-            <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span>
278
+            <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.', 'geodirectory'); ?></small></span>
279 279
             <table class="form-table gd-dummy-table">
280 280
                 <tbody>
281 281
                 <tr>
282
-                    <td><strong><?php _e('CPT','geodirectory');?></strong></td>
283
-                    <td><strong><?php _e('Data Type','geodirectory');?></strong></td>
284
-                    <td><strong><?php _e('Action','geodirectory');?></strong></td>
282
+                    <td><strong><?php _e('CPT', 'geodirectory'); ?></strong></td>
283
+                    <td><strong><?php _e('Data Type', 'geodirectory'); ?></strong></td>
284
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
285 285
                 </tr>
286 286
 
287 287
                 <?php
@@ -292,18 +292,18 @@  discard block
 block discarded – undo
292 292
 
293 293
                 $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
294 294
 
295
-                foreach($cpts as $post_type=>$cpt){
295
+                foreach ($cpts as $post_type=>$cpt) {
296 296
 
297
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
297
+                    $data_types_for = apply_filters('geodir_dummy_date_types_for', $data_types, $post_type);
298 298
 
299 299
 
300 300
                     $set_dt = get_option($post_type.'_dummy_data_type');
301 301
 
302 302
                     $count = 30;
303 303
 
304
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
304
+                    geodir_add_column_if_not_exist($plugin_prefix.$post_type."_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
305 305
 
306
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
306
+                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
307 307
 
308 308
                     echo "<tr>";
309 309
                     echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
                     echo "<td>";
314 314
                     echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
315 315
 
316
-                    foreach($data_types_for as $key=>$val){
317
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
318
-                        if($selected || count($data_types_for)==1){$count = $val['count'];}
316
+                    foreach ($data_types_for as $key=>$val) {
317
+                        $selected = ($key == $set_dt) ? "selected='selected'" : '';
318
+                        if ($selected || count($data_types_for) == 1) {$count = $val['count']; }
319 319
                         echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320 320
                     }
321 321
                     echo "</select>";
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
                     $select_display = $post_counts > 0 ? 'display:none;' : '';
324 324
                     echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325 325
                     $x = 1;
326
-                    while($x <= $count){
327
-                        $selected = ($x==$count) ? "selected='selected'" : '';
326
+                    while ($x <= $count) {
327
+                        $selected = ($x == $count) ? "selected='selected'" : '';
328 328
                         echo "<option $selected value='$x'>".$x."</option>";
329 329
                         $x++;
330 330
                     }
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 
336 336
 
337 337
 
338
-                    if($post_counts > 0){
339
-                        echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
-                    }else{
341
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
338
+                    if ($post_counts > 0) {
339
+                        echo '<td><input type="button" value="'.__('Remove data', 'geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>';
340
+                    } else {
341
+                        echo '<td><input type="button" value="'.__('Insert data', 'geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>';
342 342
                     }
343 343
 
344 344
                     echo "</tr>";
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
                 }
376 376
 
377
-                var CITY_ADDRESS = '<?php echo addslashes( $city . ',' . $region . ',' . $country );?>';
377
+                var CITY_ADDRESS = '<?php echo addslashes($city.','.$region.','.$country); ?>';
378 378
                 var bound_lat_lng;
379 379
                 var latlng = ['<?php echo $city_latitude; ?>', <?php echo $city_longitude; ?>];
380 380
                 var lat = <?php echo $city_latitude; ?>;
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                                         return x.replace(" ", '');
408 408
                                     }); // remove spaces from lat/lon
409 409
                                 } else {
410
-                                    alert("<?php _e( 'Geocode was not successful for the following reason:', 'geodirectory' );?> " + status);
410
+                                    alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
411 411
                                 }
412 412
                             });
413 413
                     } else if (window.gdMaps == 'osm') {
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                 var dummy_post_index = 1;
432 432
 
433 433
                 function gdRemoveDummyData(obj, nonce, posttype){
434
-                    if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
434
+                    if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
435 435
                         jQuery(obj).prop('disabled', true);
436 436
                         jQuery('.gd-dummy-data-results-' + posttype).remove();
437 437
                         jQuery('<tr class="gd-dummy-data-results gd-dummy-data-results-' + posttype + '" >'+
@@ -446,14 +446,14 @@  discard block
 block discarded – undo
446 446
 
447 447
                         jQuery('.gd_progressbar_'+posttype).progressbar({value: 0});
448 448
 
449
-                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation'));?>');
449
+                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation')); ?>');
450 450
 
451 451
 
452 452
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=geodir_dummy_delete&posttype=' + posttype + '&_wpnonce=' + nonce,
453 453
                             function (data) {
454
-                                gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>');
454
+                                gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>');
455 455
                                 jQuery(obj).removeClass('gd-remove-data');
456
-                                jQuery(obj).val('<?php _e('Insert data','geodirectory');?>');
456
+                                jQuery(obj).val('<?php _e('Insert data', 'geodirectory'); ?>');
457 457
                                 jQuery(obj).prop('disabled', false);
458 458
                                 jQuery('#'+posttype+'_data_type_count').show();
459 459
                                 jQuery('#'+posttype+'_data_type').prop('disabled', false);
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
                         jQuery('.gd_progressbar_'+posttype).progressbar({value: 0});
498 498
 
499
-                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation'));?>');
499
+                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation')); ?>');
500 500
                     }
501 501
 
502 502
                     if (!(typeof bound_lat_lng == 'object' && bound_lat_lng.length == 4)) {
@@ -516,15 +516,15 @@  discard block
 block discarded – undo
516 516
                             percentage = percentage > 100 ? 100 : percentage;
517 517
 
518 518
 
519
-                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation'));?>');
519
+                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation')); ?>');
520 520
 
521 521
                             gdInstallDummyData(obj, nonce, posttype,insertedCount);
522 522
                         }
523 523
                         else {
524 524
                             percentage = 100;
525
-                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>');
525
+                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>');
526 526
                             jQuery(obj).addClass('gd-remove-data');
527
-                            jQuery(obj).val('<?php _e('Remove data','geodirectory');?>');
527
+                            jQuery(obj).val('<?php _e('Remove data', 'geodirectory'); ?>');
528 528
                             jQuery(obj).prop('disabled', false);
529 529
 
530 530
                         }
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_predefined.php 3 patches
Indentation   +404 added lines, -404 removed lines patch added patch discarded remove patch
@@ -17,370 +17,370 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_custom_fields_predefined($post_type=''){
19 19
 
20
-    $custom_fields = array();
21
-
22
-
23
-    // price
24
-    $custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
25
-        'field_type'  =>  'text',
26
-        'class'       =>  'gd-price',
27
-        'icon'        =>  'fa fa-usd',
28
-        'name'        =>  __('Price', 'geodirectory'),
29
-        'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
30
-        'defaults'    => array(
31
-            'data_type'           =>  'FLOAT',
32
-            'decimal_point'       =>  '2',
33
-            'admin_title'         =>  'Price',
34
-            'site_title'          =>  'Price',
35
-            'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
36
-            'htmlvar_name'        =>  'price',
37
-            'is_active'           =>  true,
38
-            'for_admin_use'       =>  false,
39
-            'default_value'       =>  '',
40
-            'show_in' 	      =>  '[detail],[listing]',
41
-            'is_required'         =>  false,
42
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
43
-            'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
44
-            'required_msg'        =>  '',
45
-            'field_icon'          =>  'fa fa-usd',
46
-            'css_class'           =>  '',
47
-            'cat_sort'            =>  true,
48
-            'cat_filter'	      =>  true,
49
-            'extra_fields'        =>  array(
50
-                'is_price'                  =>  1,
51
-                'thousand_separator'        =>  'comma',
52
-                'decimal_separator'         =>  'period',
53
-                'decimal_display'           =>  'if',
54
-                'currency_symbol'           =>  '$',
55
-                'currency_symbol_placement' =>  'left'
56
-            )
57
-        )
58
-    );
59
-
60
-    // property status
61
-    $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
62
-        'field_type'  =>  'select',
63
-        'class'       =>  'gd-property-status',
64
-        'icon'        =>  'fa fa-home',
65
-        'name'        =>  __('Property Status', 'geodirectory'),
66
-        'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
67
-        'defaults'    => array(
68
-            'data_type'           =>  'VARCHAR',
69
-            'admin_title'         =>  'Property Status',
70
-            'site_title'          =>  'Property Status',
71
-            'admin_desc'          =>  'Enter the status of the property.',
72
-            'htmlvar_name'        =>  'property_status',
73
-            'is_active'           =>  true,
74
-            'for_admin_use'       =>  false,
75
-            'default_value'       =>  '',
76
-            'show_in' 	          =>  '[detail],[listing]',
77
-            'is_required'         =>  true,
78
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
79
-            'validation_pattern'  =>  '',
80
-            'validation_msg'      =>  '',
81
-            'required_msg'        =>  '',
82
-            'field_icon'          =>  'fa fa-home',
83
-            'css_class'           =>  '',
84
-            'cat_sort'            =>  true,
85
-            'cat_filter'	      =>  true
86
-        )
87
-    );
88
-
89
-    // property furnishing
90
-    $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
91
-        'field_type'  =>  'select',
92
-        'class'       =>  'gd-property-furnishing',
93
-        'icon'        =>  'fa fa-home',
94
-        'name'        =>  __('Property Furnishing', 'geodirectory'),
95
-        'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
96
-        'defaults'    => array(
97
-            'data_type'           =>  'VARCHAR',
98
-            'admin_title'         =>  'Furnishing',
99
-            'site_title'          =>  'Furnishing',
100
-            'admin_desc'          =>  'Enter the furnishing status of the property.',
101
-            'htmlvar_name'        =>  'property_furnishing',
102
-            'is_active'           =>  true,
103
-            'for_admin_use'       =>  false,
104
-            'default_value'       =>  '',
105
-            'show_in' 	          =>  '[detail],[listing]',
106
-            'is_required'         =>  true,
107
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
108
-            'validation_pattern'  =>  '',
109
-            'validation_msg'      =>  '',
110
-            'required_msg'        =>  '',
111
-            'field_icon'          =>  'fa fa-th-large',
112
-            'css_class'           =>  '',
113
-            'cat_sort'            =>  true,
114
-            'cat_filter'	      =>  true
115
-        )
116
-    );
117
-
118
-    // property type
119
-    $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
120
-        'field_type'  =>  'select',
121
-        'class'       =>  'gd-property-type',
122
-        'icon'        =>  'fa fa-home',
123
-        'name'        =>  __('Property Type', 'geodirectory'),
124
-        'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
125
-        'defaults'    => array(
126
-            'data_type'           =>  'VARCHAR',
127
-            'admin_title'         =>  'Property Type',
128
-            'site_title'          =>  'Property Type',
129
-            'admin_desc'          =>  'Select the property type.',
130
-            'htmlvar_name'        =>  'property_type',
131
-            'is_active'           =>  true,
132
-            'for_admin_use'       =>  false,
133
-            'default_value'       =>  '',
134
-            'show_in' 	          =>  '[detail],[listing]',
135
-            'is_required'         =>  true,
136
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
137
-            'validation_pattern'  =>  '',
138
-            'validation_msg'      =>  '',
139
-            'required_msg'        =>  '',
140
-            'field_icon'          =>  'fa fa-home',
141
-            'css_class'           =>  '',
142
-            'cat_sort'            =>  true,
143
-            'cat_filter'	      =>  true
144
-        )
145
-    );
146
-
147
-    // property bedrooms
148
-    $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
149
-        'field_type'  =>  'select',
150
-        'class'       =>  'gd-property-bedrooms',
151
-        'icon'        =>  'fa fa-home',
152
-        'name'        =>  __('Property Bedrooms', 'geodirectory'),
153
-        'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
154
-        'defaults'    => array(
155
-            'data_type'           =>  'VARCHAR',
156
-            'admin_title'         =>  'Property Bedrooms',
157
-            'site_title'          =>  'Bedrooms',
158
-            'admin_desc'          =>  'Select the number of bedrooms',
159
-            'htmlvar_name'        =>  'property_bedrooms',
160
-            'is_active'           =>  true,
161
-            'for_admin_use'       =>  false,
162
-            'default_value'       =>  '',
163
-            'show_in' 	          =>  '[detail],[listing]',
164
-            'is_required'         =>  true,
165
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
166
-            'validation_pattern'  =>  '',
167
-            'validation_msg'      =>  '',
168
-            'required_msg'        =>  '',
169
-            'field_icon'          =>  'fa fa-bed',
170
-            'css_class'           =>  '',
171
-            'cat_sort'            =>  true,
172
-            'cat_filter'	      =>  true
173
-        )
174
-    );
175
-
176
-    // property bathrooms
177
-    $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
178
-        'field_type'  =>  'select',
179
-        'class'       =>  'gd-property-bathrooms',
180
-        'icon'        =>  'fa fa-home',
181
-        'name'        =>  __('Property Bathrooms', 'geodirectory'),
182
-        'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
183
-        'defaults'    => array(
184
-            'data_type'           =>  'VARCHAR',
185
-            'admin_title'         =>  'Property Bathrooms',
186
-            'site_title'          =>  'Bathrooms',
187
-            'admin_desc'          =>  'Select the number of bathrooms',
188
-            'htmlvar_name'        =>  'property_bathrooms',
189
-            'is_active'           =>  true,
190
-            'for_admin_use'       =>  false,
191
-            'default_value'       =>  '',
192
-            'show_in' 	          =>  '[detail],[listing]',
193
-            'is_required'         =>  true,
194
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
195
-            'validation_pattern'  =>  '',
196
-            'validation_msg'      =>  '',
197
-            'required_msg'        =>  '',
198
-            'field_icon'          =>  'fa fa-bold',
199
-            'css_class'           =>  '',
200
-            'cat_sort'            =>  true,
201
-            'cat_filter'	      =>  true
202
-        )
203
-    );
204
-
205
-    // property area
206
-    $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
207
-        'field_type'  =>  'text',
208
-        'class'       =>  'gd-area',
209
-        'icon'        =>  'fa fa-home',
210
-        'name'        =>  __('Property Area', 'geodirectory'),
211
-        'description' =>  __('Adds a input for the property area.', 'geodirectory'),
212
-        'defaults'    => array(
213
-            'data_type'           =>  'FLOAT',
214
-            'admin_title'         =>  'Property Area',
215
-            'site_title'          =>  'Area (Sq Ft)',
216
-            'admin_desc'          =>  'Enter the Sq Ft value for the property',
217
-            'htmlvar_name'        =>  'property_area',
218
-            'is_active'           =>  true,
219
-            'for_admin_use'       =>  false,
220
-            'default_value'       =>  '',
221
-            'show_in' 	      =>  '[detail],[listing]',
222
-            'is_required'         =>  false,
223
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
224
-            'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
225
-            'required_msg'        =>  '',
226
-            'field_icon'          =>  'fa fa-area-chart',
227
-            'css_class'           =>  '',
228
-            'cat_sort'            =>  true,
229
-            'cat_filter'	      =>  true
230
-        )
231
-    );
232
-
233
-    // property features
234
-    $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
235
-        'field_type'  =>  'multiselect',
236
-        'class'       =>  'gd-property-features',
237
-        'icon'        =>  'fa fa-home',
238
-        'name'        =>  __('Property Features', 'geodirectory'),
239
-        'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
240
-        'defaults'    => array(
241
-            'data_type'           =>  'VARCHAR',
242
-            'admin_title'         =>  'Property Features',
243
-            'site_title'          =>  'Features',
244
-            'admin_desc'          =>  'Select the property features.',
245
-            'htmlvar_name'        =>  'property_features',
246
-            'is_active'           =>  true,
247
-            'for_admin_use'       =>  false,
248
-            'default_value'       =>  '',
249
-            'show_in' 	          =>  '[detail],[listing]',
250
-            'is_required'         =>  true,
251
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
252
-            'validation_pattern'  =>  '',
253
-            'validation_msg'      =>  '',
254
-            'required_msg'        =>  '',
255
-            'field_icon'          =>  'fa fa-plus-square',
256
-            'css_class'           =>  '',
257
-            'cat_sort'            =>  true,
258
-            'cat_filter'	      =>  true
259
-        )
260
-    );
261
-
262
-    // Twitter feed
263
-    $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
264
-        'field_type'  =>  'text',
265
-        'class'       =>  'gd-twitter',
266
-        'icon'        =>  'fa fa-twitter',
267
-        'name'        =>  __('Twitter feed', 'geodirectory'),
268
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
269
-        'defaults'    => array(
270
-            'data_type'           =>  'VARCHAR',
271
-            'admin_title'         =>  'Twitter',
272
-            'site_title'          =>  'Twitter',
273
-            'admin_desc'          =>  'Enter your Twitter username',
274
-            'htmlvar_name'        =>  'twitterusername',
275
-            'is_active'           =>  true,
276
-            'for_admin_use'       =>  false,
277
-            'default_value'       =>  '',
278
-            'show_in' 	      =>  '[detail],[owntab]',
279
-            'is_required'         =>  false,
280
-            'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
281
-            'validation_msg'      =>  'Please enter a valid twitter username.',
282
-            'required_msg'        =>  '',
283
-            'field_icon'          =>  'fa fa-twitter',
284
-            'css_class'           =>  '',
285
-            'cat_sort'            =>  false,
286
-            'cat_filter'	      =>  false
287
-        )
288
-    );
289
-
290
-    // Get directions link
291
-    $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
292
-        'field_type'  =>  'text',
293
-        'class'       =>  'gd-get-directions',
294
-        'icon'        =>  'fa fa-location-arrow',
295
-        'name'        =>  __('Get Directions Link', 'geodirectory'),
296
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
297
-        'defaults'    => array(
298
-            'data_type'           =>  'VARCHAR',
299
-            'admin_title'         =>  'Get Directions',
300
-            'site_title'          =>  'Get Directions',
301
-            'admin_desc'          =>  '',
302
-            'htmlvar_name'        =>  'get_directions',
303
-            'is_active'           =>  true,
304
-            'for_admin_use'       =>  true,
305
-            'default_value'       =>  'Get Directions',
306
-            'show_in' 	      =>  '[detail],[listing]',
307
-            'is_required'         =>  false,
308
-            'validation_pattern'  =>  '',
309
-            'validation_msg'      =>  '',
310
-            'required_msg'        =>  '',
311
-            'field_icon'          =>  'fa fa-location-arrow',
312
-            'css_class'           =>  '',
313
-            'cat_sort'            =>  false,
314
-            'cat_filter'	      =>  false
315
-        )
316
-    );
317
-
318
-
319
-    // JOB TYPE CF
320
-
321
-    // job type
322
-    $custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces.
323
-        'field_type'  =>  'select',
324
-        'class'       =>  'gd-job-type',
325
-        'icon'        =>  'fa fa-briefcase',
326
-        'name'        =>  __('Job Type', 'geodirectory'),
327
-        'description' =>  __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'),
328
-        'defaults'    => array(
329
-            'data_type'           =>  'VARCHAR',
330
-            'admin_title'         =>  __('Job Type', 'geodirectory'),
331
-            'site_title'          =>  __('Job Type','geodirectory'),
332
-            'admin_desc'          =>  __('Select the type of job.','geodirectory'),
333
-            'htmlvar_name'        =>  'job_type',
334
-            'is_active'           =>  true,
335
-            'for_admin_use'       =>  false,
336
-            'default_value'       =>  '',
337
-            'show_in' 	          =>  '[detail],[listing]',
338
-            'is_required'         =>  true,
339
-            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
340
-            'validation_pattern'  =>  '',
341
-            'validation_msg'      =>  '',
342
-            'required_msg'        =>  '',
343
-            'field_icon'          =>  'fa fa-briefcase',
344
-            'css_class'           =>  '',
345
-            'cat_sort'            =>  true,
346
-            'cat_filter'	      =>  true
347
-        )
348
-    );
349
-
350
-    // job sector
351
-    $custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces.
352
-        'field_type'  =>  'select',
353
-        'class'       =>  'gd-job-type',
354
-        'icon'        =>  'fa fa-briefcase',
355
-        'name'        =>  __('Job Sector', 'geodirectory'),
356
-        'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357
-        'defaults'    => array(
358
-            'data_type'           =>  'VARCHAR',
359
-            'admin_title'         =>  __('Job Sector','geodirectory'),
360
-            'site_title'          =>  __('Job Sector','geodirectory'),
361
-            'admin_desc'          =>  __('Select the job sector.','geodirectory'),
362
-            'htmlvar_name'        =>  'job_sector',
363
-            'is_active'           =>  true,
364
-            'for_admin_use'       =>  false,
365
-            'default_value'       =>  '',
366
-            'show_in' 	          =>  '[detail]',
367
-            'is_required'         =>  true,
368
-            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
369
-            'validation_pattern'  =>  '',
370
-            'validation_msg'      =>  '',
371
-            'required_msg'        =>  '',
372
-            'field_icon'          =>  'fa fa-briefcase',
373
-            'css_class'           =>  '',
374
-            'cat_sort'            =>  true,
375
-            'cat_filter'	      =>  true
376
-        )
377
-    );
378
-
379
-
380
-    /**
381
-     * @see `geodir_custom_fields`
382
-     */
383
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
20
+	$custom_fields = array();
21
+
22
+
23
+	// price
24
+	$custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
25
+		'field_type'  =>  'text',
26
+		'class'       =>  'gd-price',
27
+		'icon'        =>  'fa fa-usd',
28
+		'name'        =>  __('Price', 'geodirectory'),
29
+		'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
30
+		'defaults'    => array(
31
+			'data_type'           =>  'FLOAT',
32
+			'decimal_point'       =>  '2',
33
+			'admin_title'         =>  'Price',
34
+			'site_title'          =>  'Price',
35
+			'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
36
+			'htmlvar_name'        =>  'price',
37
+			'is_active'           =>  true,
38
+			'for_admin_use'       =>  false,
39
+			'default_value'       =>  '',
40
+			'show_in' 	      =>  '[detail],[listing]',
41
+			'is_required'         =>  false,
42
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
43
+			'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
44
+			'required_msg'        =>  '',
45
+			'field_icon'          =>  'fa fa-usd',
46
+			'css_class'           =>  '',
47
+			'cat_sort'            =>  true,
48
+			'cat_filter'	      =>  true,
49
+			'extra_fields'        =>  array(
50
+				'is_price'                  =>  1,
51
+				'thousand_separator'        =>  'comma',
52
+				'decimal_separator'         =>  'period',
53
+				'decimal_display'           =>  'if',
54
+				'currency_symbol'           =>  '$',
55
+				'currency_symbol_placement' =>  'left'
56
+			)
57
+		)
58
+	);
59
+
60
+	// property status
61
+	$custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
62
+		'field_type'  =>  'select',
63
+		'class'       =>  'gd-property-status',
64
+		'icon'        =>  'fa fa-home',
65
+		'name'        =>  __('Property Status', 'geodirectory'),
66
+		'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
67
+		'defaults'    => array(
68
+			'data_type'           =>  'VARCHAR',
69
+			'admin_title'         =>  'Property Status',
70
+			'site_title'          =>  'Property Status',
71
+			'admin_desc'          =>  'Enter the status of the property.',
72
+			'htmlvar_name'        =>  'property_status',
73
+			'is_active'           =>  true,
74
+			'for_admin_use'       =>  false,
75
+			'default_value'       =>  '',
76
+			'show_in' 	          =>  '[detail],[listing]',
77
+			'is_required'         =>  true,
78
+			'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
79
+			'validation_pattern'  =>  '',
80
+			'validation_msg'      =>  '',
81
+			'required_msg'        =>  '',
82
+			'field_icon'          =>  'fa fa-home',
83
+			'css_class'           =>  '',
84
+			'cat_sort'            =>  true,
85
+			'cat_filter'	      =>  true
86
+		)
87
+	);
88
+
89
+	// property furnishing
90
+	$custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
91
+		'field_type'  =>  'select',
92
+		'class'       =>  'gd-property-furnishing',
93
+		'icon'        =>  'fa fa-home',
94
+		'name'        =>  __('Property Furnishing', 'geodirectory'),
95
+		'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
96
+		'defaults'    => array(
97
+			'data_type'           =>  'VARCHAR',
98
+			'admin_title'         =>  'Furnishing',
99
+			'site_title'          =>  'Furnishing',
100
+			'admin_desc'          =>  'Enter the furnishing status of the property.',
101
+			'htmlvar_name'        =>  'property_furnishing',
102
+			'is_active'           =>  true,
103
+			'for_admin_use'       =>  false,
104
+			'default_value'       =>  '',
105
+			'show_in' 	          =>  '[detail],[listing]',
106
+			'is_required'         =>  true,
107
+			'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
108
+			'validation_pattern'  =>  '',
109
+			'validation_msg'      =>  '',
110
+			'required_msg'        =>  '',
111
+			'field_icon'          =>  'fa fa-th-large',
112
+			'css_class'           =>  '',
113
+			'cat_sort'            =>  true,
114
+			'cat_filter'	      =>  true
115
+		)
116
+	);
117
+
118
+	// property type
119
+	$custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
120
+		'field_type'  =>  'select',
121
+		'class'       =>  'gd-property-type',
122
+		'icon'        =>  'fa fa-home',
123
+		'name'        =>  __('Property Type', 'geodirectory'),
124
+		'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
125
+		'defaults'    => array(
126
+			'data_type'           =>  'VARCHAR',
127
+			'admin_title'         =>  'Property Type',
128
+			'site_title'          =>  'Property Type',
129
+			'admin_desc'          =>  'Select the property type.',
130
+			'htmlvar_name'        =>  'property_type',
131
+			'is_active'           =>  true,
132
+			'for_admin_use'       =>  false,
133
+			'default_value'       =>  '',
134
+			'show_in' 	          =>  '[detail],[listing]',
135
+			'is_required'         =>  true,
136
+			'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
137
+			'validation_pattern'  =>  '',
138
+			'validation_msg'      =>  '',
139
+			'required_msg'        =>  '',
140
+			'field_icon'          =>  'fa fa-home',
141
+			'css_class'           =>  '',
142
+			'cat_sort'            =>  true,
143
+			'cat_filter'	      =>  true
144
+		)
145
+	);
146
+
147
+	// property bedrooms
148
+	$custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
149
+		'field_type'  =>  'select',
150
+		'class'       =>  'gd-property-bedrooms',
151
+		'icon'        =>  'fa fa-home',
152
+		'name'        =>  __('Property Bedrooms', 'geodirectory'),
153
+		'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
154
+		'defaults'    => array(
155
+			'data_type'           =>  'VARCHAR',
156
+			'admin_title'         =>  'Property Bedrooms',
157
+			'site_title'          =>  'Bedrooms',
158
+			'admin_desc'          =>  'Select the number of bedrooms',
159
+			'htmlvar_name'        =>  'property_bedrooms',
160
+			'is_active'           =>  true,
161
+			'for_admin_use'       =>  false,
162
+			'default_value'       =>  '',
163
+			'show_in' 	          =>  '[detail],[listing]',
164
+			'is_required'         =>  true,
165
+			'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
166
+			'validation_pattern'  =>  '',
167
+			'validation_msg'      =>  '',
168
+			'required_msg'        =>  '',
169
+			'field_icon'          =>  'fa fa-bed',
170
+			'css_class'           =>  '',
171
+			'cat_sort'            =>  true,
172
+			'cat_filter'	      =>  true
173
+		)
174
+	);
175
+
176
+	// property bathrooms
177
+	$custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
178
+		'field_type'  =>  'select',
179
+		'class'       =>  'gd-property-bathrooms',
180
+		'icon'        =>  'fa fa-home',
181
+		'name'        =>  __('Property Bathrooms', 'geodirectory'),
182
+		'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
183
+		'defaults'    => array(
184
+			'data_type'           =>  'VARCHAR',
185
+			'admin_title'         =>  'Property Bathrooms',
186
+			'site_title'          =>  'Bathrooms',
187
+			'admin_desc'          =>  'Select the number of bathrooms',
188
+			'htmlvar_name'        =>  'property_bathrooms',
189
+			'is_active'           =>  true,
190
+			'for_admin_use'       =>  false,
191
+			'default_value'       =>  '',
192
+			'show_in' 	          =>  '[detail],[listing]',
193
+			'is_required'         =>  true,
194
+			'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
195
+			'validation_pattern'  =>  '',
196
+			'validation_msg'      =>  '',
197
+			'required_msg'        =>  '',
198
+			'field_icon'          =>  'fa fa-bold',
199
+			'css_class'           =>  '',
200
+			'cat_sort'            =>  true,
201
+			'cat_filter'	      =>  true
202
+		)
203
+	);
204
+
205
+	// property area
206
+	$custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
207
+		'field_type'  =>  'text',
208
+		'class'       =>  'gd-area',
209
+		'icon'        =>  'fa fa-home',
210
+		'name'        =>  __('Property Area', 'geodirectory'),
211
+		'description' =>  __('Adds a input for the property area.', 'geodirectory'),
212
+		'defaults'    => array(
213
+			'data_type'           =>  'FLOAT',
214
+			'admin_title'         =>  'Property Area',
215
+			'site_title'          =>  'Area (Sq Ft)',
216
+			'admin_desc'          =>  'Enter the Sq Ft value for the property',
217
+			'htmlvar_name'        =>  'property_area',
218
+			'is_active'           =>  true,
219
+			'for_admin_use'       =>  false,
220
+			'default_value'       =>  '',
221
+			'show_in' 	      =>  '[detail],[listing]',
222
+			'is_required'         =>  false,
223
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
224
+			'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
225
+			'required_msg'        =>  '',
226
+			'field_icon'          =>  'fa fa-area-chart',
227
+			'css_class'           =>  '',
228
+			'cat_sort'            =>  true,
229
+			'cat_filter'	      =>  true
230
+		)
231
+	);
232
+
233
+	// property features
234
+	$custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
235
+		'field_type'  =>  'multiselect',
236
+		'class'       =>  'gd-property-features',
237
+		'icon'        =>  'fa fa-home',
238
+		'name'        =>  __('Property Features', 'geodirectory'),
239
+		'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
240
+		'defaults'    => array(
241
+			'data_type'           =>  'VARCHAR',
242
+			'admin_title'         =>  'Property Features',
243
+			'site_title'          =>  'Features',
244
+			'admin_desc'          =>  'Select the property features.',
245
+			'htmlvar_name'        =>  'property_features',
246
+			'is_active'           =>  true,
247
+			'for_admin_use'       =>  false,
248
+			'default_value'       =>  '',
249
+			'show_in' 	          =>  '[detail],[listing]',
250
+			'is_required'         =>  true,
251
+			'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
252
+			'validation_pattern'  =>  '',
253
+			'validation_msg'      =>  '',
254
+			'required_msg'        =>  '',
255
+			'field_icon'          =>  'fa fa-plus-square',
256
+			'css_class'           =>  '',
257
+			'cat_sort'            =>  true,
258
+			'cat_filter'	      =>  true
259
+		)
260
+	);
261
+
262
+	// Twitter feed
263
+	$custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
264
+		'field_type'  =>  'text',
265
+		'class'       =>  'gd-twitter',
266
+		'icon'        =>  'fa fa-twitter',
267
+		'name'        =>  __('Twitter feed', 'geodirectory'),
268
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
269
+		'defaults'    => array(
270
+			'data_type'           =>  'VARCHAR',
271
+			'admin_title'         =>  'Twitter',
272
+			'site_title'          =>  'Twitter',
273
+			'admin_desc'          =>  'Enter your Twitter username',
274
+			'htmlvar_name'        =>  'twitterusername',
275
+			'is_active'           =>  true,
276
+			'for_admin_use'       =>  false,
277
+			'default_value'       =>  '',
278
+			'show_in' 	      =>  '[detail],[owntab]',
279
+			'is_required'         =>  false,
280
+			'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
281
+			'validation_msg'      =>  'Please enter a valid twitter username.',
282
+			'required_msg'        =>  '',
283
+			'field_icon'          =>  'fa fa-twitter',
284
+			'css_class'           =>  '',
285
+			'cat_sort'            =>  false,
286
+			'cat_filter'	      =>  false
287
+		)
288
+	);
289
+
290
+	// Get directions link
291
+	$custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
292
+		'field_type'  =>  'text',
293
+		'class'       =>  'gd-get-directions',
294
+		'icon'        =>  'fa fa-location-arrow',
295
+		'name'        =>  __('Get Directions Link', 'geodirectory'),
296
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
297
+		'defaults'    => array(
298
+			'data_type'           =>  'VARCHAR',
299
+			'admin_title'         =>  'Get Directions',
300
+			'site_title'          =>  'Get Directions',
301
+			'admin_desc'          =>  '',
302
+			'htmlvar_name'        =>  'get_directions',
303
+			'is_active'           =>  true,
304
+			'for_admin_use'       =>  true,
305
+			'default_value'       =>  'Get Directions',
306
+			'show_in' 	      =>  '[detail],[listing]',
307
+			'is_required'         =>  false,
308
+			'validation_pattern'  =>  '',
309
+			'validation_msg'      =>  '',
310
+			'required_msg'        =>  '',
311
+			'field_icon'          =>  'fa fa-location-arrow',
312
+			'css_class'           =>  '',
313
+			'cat_sort'            =>  false,
314
+			'cat_filter'	      =>  false
315
+		)
316
+	);
317
+
318
+
319
+	// JOB TYPE CF
320
+
321
+	// job type
322
+	$custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces.
323
+		'field_type'  =>  'select',
324
+		'class'       =>  'gd-job-type',
325
+		'icon'        =>  'fa fa-briefcase',
326
+		'name'        =>  __('Job Type', 'geodirectory'),
327
+		'description' =>  __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'),
328
+		'defaults'    => array(
329
+			'data_type'           =>  'VARCHAR',
330
+			'admin_title'         =>  __('Job Type', 'geodirectory'),
331
+			'site_title'          =>  __('Job Type','geodirectory'),
332
+			'admin_desc'          =>  __('Select the type of job.','geodirectory'),
333
+			'htmlvar_name'        =>  'job_type',
334
+			'is_active'           =>  true,
335
+			'for_admin_use'       =>  false,
336
+			'default_value'       =>  '',
337
+			'show_in' 	          =>  '[detail],[listing]',
338
+			'is_required'         =>  true,
339
+			'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
340
+			'validation_pattern'  =>  '',
341
+			'validation_msg'      =>  '',
342
+			'required_msg'        =>  '',
343
+			'field_icon'          =>  'fa fa-briefcase',
344
+			'css_class'           =>  '',
345
+			'cat_sort'            =>  true,
346
+			'cat_filter'	      =>  true
347
+		)
348
+	);
349
+
350
+	// job sector
351
+	$custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces.
352
+		'field_type'  =>  'select',
353
+		'class'       =>  'gd-job-type',
354
+		'icon'        =>  'fa fa-briefcase',
355
+		'name'        =>  __('Job Sector', 'geodirectory'),
356
+		'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357
+		'defaults'    => array(
358
+			'data_type'           =>  'VARCHAR',
359
+			'admin_title'         =>  __('Job Sector','geodirectory'),
360
+			'site_title'          =>  __('Job Sector','geodirectory'),
361
+			'admin_desc'          =>  __('Select the job sector.','geodirectory'),
362
+			'htmlvar_name'        =>  'job_sector',
363
+			'is_active'           =>  true,
364
+			'for_admin_use'       =>  false,
365
+			'default_value'       =>  '',
366
+			'show_in' 	          =>  '[detail]',
367
+			'is_required'         =>  true,
368
+			'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
369
+			'validation_pattern'  =>  '',
370
+			'validation_msg'      =>  '',
371
+			'required_msg'        =>  '',
372
+			'field_icon'          =>  'fa fa-briefcase',
373
+			'css_class'           =>  '',
374
+			'cat_sort'            =>  true,
375
+			'cat_filter'	      =>  true
376
+		)
377
+	);
378
+
379
+
380
+	/**
381
+	 * @see `geodir_custom_fields`
382
+	 */
383
+	return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
384 384
 }
385 385
 
386 386
 
@@ -395,32 +395,32 @@  discard block
 block discarded – undo
395 395
  * @return string The html to output.
396 396
  */
397 397
 function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
398
-    global $post;
398
+	global $post;
399 399
 
400 400
 
401
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
401
+	if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
402 402
 
403
-        $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
403
+		$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
404 404
 
405
-        $field_icon = geodir_field_icon_proccess($cf);
406
-        if (strpos($field_icon, 'http') !== false) {
407
-            $field_icon_af = '';
408
-        } elseif ($field_icon == '') {
409
-            $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
410
-        } else {
411
-            $field_icon_af = $field_icon;
412
-            $field_icon = '';
413
-        }
405
+		$field_icon = geodir_field_icon_proccess($cf);
406
+		if (strpos($field_icon, 'http') !== false) {
407
+			$field_icon_af = '';
408
+		} elseif ($field_icon == '') {
409
+			$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
410
+		} else {
411
+			$field_icon_af = $field_icon;
412
+			$field_icon = '';
413
+		}
414 414
 
415 415
 
416
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
416
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
417 417
 
418
-        $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
419
-        $html .= '</div>';
418
+		$html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
419
+		$html .= '</div>';
420 420
 
421
-    endif;
421
+	endif;
422 422
 
423
-    return $html;
423
+	return $html;
424 424
 }
425 425
 add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
426 426
 
@@ -435,37 +435,37 @@  discard block
 block discarded – undo
435 435
  * @return string The html to output.
436 436
  */
437 437
 function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
438
-    global $post;
438
+	global $post;
439 439
 
440 440
 
441
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
441
+	if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
442 442
 
443
-        $field_icon = geodir_field_icon_proccess( $cf );
444
-        if ( strpos( $field_icon, 'http' ) !== false ) {
445
-            $field_icon_af = '';
446
-        } elseif ( $field_icon == '' ) {
447
-            $field_icon_af = '<i class="fa fa-location-arrow"></i>';
448
-        } else {
449
-            $field_icon_af = $field_icon;
450
-            $field_icon    = '';
451
-        }
443
+		$field_icon = geodir_field_icon_proccess( $cf );
444
+		if ( strpos( $field_icon, 'http' ) !== false ) {
445
+			$field_icon_af = '';
446
+		} elseif ( $field_icon == '' ) {
447
+			$field_icon_af = '<i class="fa fa-location-arrow"></i>';
448
+		} else {
449
+			$field_icon_af = $field_icon;
450
+			$field_icon    = '';
451
+		}
452 452
 
453
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
453
+		$link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
454 454
 
455
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
455
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
456 456
 
457
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
458
-            $html .= $field_icon_af;
459
-        }
457
+		if(isset( $cf['field_icon'] ) && $cf['field_icon']){
458
+			$html .= $field_icon_af;
459
+		}
460 460
 
461
-        // We use maps.apple.com here because it will handle redirects nicely in most cases
462
-        $html .= '<a href="https://maps.apple.com/?daddr=' . $post->post_latitude . ',' . $post->post_longitude . '" target="_blank" >' . $link_text . '</a>';
463
-        $html .= '</div>';
461
+		// We use maps.apple.com here because it will handle redirects nicely in most cases
462
+		$html .= '<a href="https://maps.apple.com/?daddr=' . $post->post_latitude . ',' . $post->post_longitude . '" target="_blank" >' . $link_text . '</a>';
463
+		$html .= '</div>';
464 464
 
465
-    }else{
466
-        $html ='';
467
-    }
465
+	}else{
466
+		$html ='';
467
+	}
468 468
 
469
-    return $html;
469
+	return $html;
470 470
 }
471 471
 add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package GeoDirectory
16 16
  * @see `geodir_custom_field_save` for array details.
17 17
  */
18
-function geodir_custom_fields_predefined($post_type=''){
18
+function geodir_custom_fields_predefined($post_type = '') {
19 19
 
20 20
     $custom_fields = array();
21 21
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             'default_value'       =>  '',
76 76
             'show_in' 	          =>  '[detail],[listing]',
77 77
             'is_required'         =>  true,
78
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
78
+            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let', 'geodirectory'),
79 79
             'validation_pattern'  =>  '',
80 80
             'validation_msg'      =>  '',
81 81
             'required_msg'        =>  '',
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             'default_value'       =>  '',
105 105
             'show_in' 	          =>  '[detail],[listing]',
106 106
             'is_required'         =>  true,
107
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
107
+            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'),
108 108
             'validation_pattern'  =>  '',
109 109
             'validation_msg'      =>  '',
110 110
             'required_msg'        =>  '',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             'default_value'       =>  '',
134 134
             'show_in' 	          =>  '[detail],[listing]',
135 135
             'is_required'         =>  true,
136
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
136
+            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage', 'geodirectory'),
137 137
             'validation_pattern'  =>  '',
138 138
             'validation_msg'      =>  '',
139 139
             'required_msg'        =>  '',
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             'default_value'       =>  '',
163 163
             'show_in' 	          =>  '[detail],[listing]',
164 164
             'is_required'         =>  true,
165
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
165
+            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
166 166
             'validation_pattern'  =>  '',
167 167
             'validation_msg'      =>  '',
168 168
             'required_msg'        =>  '',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             'default_value'       =>  '',
192 192
             'show_in' 	          =>  '[detail],[listing]',
193 193
             'is_required'         =>  true,
194
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
194
+            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
195 195
             'validation_pattern'  =>  '',
196 196
             'validation_msg'      =>  '',
197 197
             'required_msg'        =>  '',
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             'default_value'       =>  '',
249 249
             'show_in' 	          =>  '[detail],[listing]',
250 250
             'is_required'         =>  true,
251
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
251
+            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'),
252 252
             'validation_pattern'  =>  '',
253 253
             'validation_msg'      =>  '',
254 254
             'required_msg'        =>  '',
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
         'defaults'    => array(
329 329
             'data_type'           =>  'VARCHAR',
330 330
             'admin_title'         =>  __('Job Type', 'geodirectory'),
331
-            'site_title'          =>  __('Job Type','geodirectory'),
332
-            'admin_desc'          =>  __('Select the type of job.','geodirectory'),
331
+            'site_title'          =>  __('Job Type', 'geodirectory'),
332
+            'admin_desc'          =>  __('Select the type of job.', 'geodirectory'),
333 333
             'htmlvar_name'        =>  'job_type',
334 334
             'is_active'           =>  true,
335 335
             'for_admin_use'       =>  false,
336 336
             'default_value'       =>  '',
337 337
             'show_in' 	          =>  '[detail],[listing]',
338 338
             'is_required'         =>  true,
339
-            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
339
+            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other', 'geodirectory'),
340 340
             'validation_pattern'  =>  '',
341 341
             'validation_msg'      =>  '',
342 342
             'required_msg'        =>  '',
@@ -356,16 +356,16 @@  discard block
 block discarded – undo
356 356
         'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357 357
         'defaults'    => array(
358 358
             'data_type'           =>  'VARCHAR',
359
-            'admin_title'         =>  __('Job Sector','geodirectory'),
360
-            'site_title'          =>  __('Job Sector','geodirectory'),
361
-            'admin_desc'          =>  __('Select the job sector.','geodirectory'),
359
+            'admin_title'         =>  __('Job Sector', 'geodirectory'),
360
+            'site_title'          =>  __('Job Sector', 'geodirectory'),
361
+            'admin_desc'          =>  __('Select the job sector.', 'geodirectory'),
362 362
             'htmlvar_name'        =>  'job_sector',
363 363
             'is_active'           =>  true,
364 364
             'for_admin_use'       =>  false,
365 365
             'default_value'       =>  '',
366 366
             'show_in' 	          =>  '[detail]',
367 367
             'is_required'         =>  true,
368
-            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
368
+            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies', 'geodirectory'),
369 369
             'validation_pattern'  =>  '',
370 370
             'validation_msg'      =>  '',
371 371
             'required_msg'        =>  '',
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     /**
381 381
      * @see `geodir_custom_fields`
382 382
      */
383
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
383
+    return apply_filters('geodir_custom_fields_predefined', $custom_fields, $post_type);
384 384
 }
385 385
 
386 386
 
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
  * @since 1.6.9
395 395
  * @return string The html to output.
396 396
  */
397
-function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
397
+function geodir_predefined_custom_field_output_twitter_feed($html, $location, $cf) {
398 398
     global $post;
399 399
 
400 400
 
401
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
401
+    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
402 402
 
403 403
         $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
404 404
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         }
414 414
 
415 415
 
416
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
416
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
417 417
 
418 418
         $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
419 419
         $html .= '</div>';
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
     return $html;
424 424
 }
425
-add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
425
+add_filter('geodir_custom_field_output_text_key_twitter_feed', 'geodir_predefined_custom_field_output_twitter_feed', 10, 3);
426 426
 
427 427
 /**
428 428
  * Filter the get_directions custom field output to show a link.
@@ -434,38 +434,38 @@  discard block
 block discarded – undo
434 434
  * @since 1.6.9
435 435
  * @return string The html to output.
436 436
  */
437
-function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
437
+function geodir_predefined_custom_field_output_get_directions($html, $location, $cf) {
438 438
     global $post;
439 439
 
440 440
 
441
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
441
+    if (isset($post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset($post->post_latitude) && $post->post_latitude) {
442 442
 
443
-        $field_icon = geodir_field_icon_proccess( $cf );
444
-        if ( strpos( $field_icon, 'http' ) !== false ) {
443
+        $field_icon = geodir_field_icon_proccess($cf);
444
+        if (strpos($field_icon, 'http') !== false) {
445 445
             $field_icon_af = '';
446
-        } elseif ( $field_icon == '' ) {
446
+        } elseif ($field_icon == '') {
447 447
             $field_icon_af = '<i class="fa fa-location-arrow"></i>';
448 448
         } else {
449 449
             $field_icon_af = $field_icon;
450 450
             $field_icon    = '';
451 451
         }
452 452
 
453
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
453
+        $link_text = isset($post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __('Get Directions', 'geodirectory');
454 454
 
455
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
455
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
456 456
 
457
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
457
+        if (isset($cf['field_icon']) && $cf['field_icon']) {
458 458
             $html .= $field_icon_af;
459 459
         }
460 460
 
461 461
         // We use maps.apple.com here because it will handle redirects nicely in most cases
462
-        $html .= '<a href="https://maps.apple.com/?daddr=' . $post->post_latitude . ',' . $post->post_longitude . '" target="_blank" >' . $link_text . '</a>';
462
+        $html .= '<a href="https://maps.apple.com/?daddr='.$post->post_latitude.','.$post->post_longitude.'" target="_blank" >'.$link_text.'</a>';
463 463
         $html .= '</div>';
464 464
 
465
-    }else{
466
-        $html ='';
465
+    } else {
466
+        $html = '';
467 467
     }
468 468
 
469 469
     return $html;
470 470
 }
471
-add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
471
+add_filter('geodir_custom_field_output_text_key_get_directions', 'geodir_predefined_custom_field_output_get_directions', 10, 3);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -462,7 +462,7 @@
 block discarded – undo
462 462
         $html .= '<a href="https://maps.apple.com/?daddr=' . $post->post_latitude . ',' . $post->post_longitude . '" target="_blank" >' . $link_text . '</a>';
463 463
         $html .= '</div>';
464 464
 
465
-    }else{
465
+    } else{
466 466
         $html ='';
467 467
     }
468 468
 
Please login to merge, or discard this patch.
geodirectory-functions/template_functions.php 4 patches
Braces   +49 added lines, -20 removed lines patch added patch discarded remove patch
@@ -83,14 +83,16 @@  discard block
 block discarded – undo
83 83
             $success_page_id = geodir_success_page_id();
84 84
             if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
85 85
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
86
-            )
87
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
86
+            ) {
87
+                            $post_type = sanitize_text_field($_REQUEST['listing_type']);
88
+            }
88 89
             return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
89 90
             break;
90 91
         case 'detail':
91 92
         case 'preview':
92
-            if (in_array(get_post_type(), geodir_get_posttypes()))
93
-                $post_type = get_post_type();
93
+            if (in_array(get_post_type(), geodir_get_posttypes())) {
94
+                            $post_type = get_post_type();
95
+            }
94 96
             return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
95 97
             break;
96 98
         case 'listing':
@@ -196,7 +198,9 @@  discard block
 block discarded – undo
196 198
 
197 199
         $template = geodir_locate_template('signup');
198 200
 
199
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
201
+        if (!$template) {
202
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
203
+        }
200 204
 
201 205
         /**
202 206
          * Filter the signup template path.
@@ -214,7 +218,9 @@  discard block
 block discarded – undo
214 218
 
215 219
             $template = geodir_locate_template('information');
216 220
 
217
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
221
+            if (!$template) {
222
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
223
+            }
218 224
             /**
219 225
              * Filter the information template path.
220 226
              *
@@ -248,7 +254,9 @@  discard block
 block discarded – undo
248 254
             if (!$is_current_user_owner) {
249 255
                 $template = geodir_locate_template('information');
250 256
 
251
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
257
+                if (!$template) {
258
+                	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
259
+                }
252 260
                 /**
253 261
                  * Filter the information template path.
254 262
                  *
@@ -270,7 +278,9 @@  discard block
 block discarded – undo
270 278
 
271 279
         $template = geodir_locate_template('add-listing');
272 280
 
273
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
281
+        if (!$template) {
282
+        	$template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
283
+        }
274 284
         /**
275 285
          * Filter the add listing template path.
276 286
          *
@@ -287,7 +297,9 @@  discard block
 block discarded – undo
287 297
 
288 298
         $template = geodir_locate_template('preview');
289 299
 
290
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
300
+        if (!$template) {
301
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
302
+        }
291 303
         /**
292 304
          * Filter the preview template path.
293 305
          *
@@ -303,7 +315,9 @@  discard block
 block discarded – undo
303 315
 
304 316
         $template = geodir_locate_template('success');
305 317
 
306
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
318
+        if (!$template) {
319
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
320
+        }
307 321
         /**
308 322
          * Filter the success template path.
309 323
          *
@@ -318,7 +332,9 @@  discard block
 block discarded – undo
318 332
 
319 333
         $template = geodir_locate_template('detail');
320 334
 
321
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
335
+        if (!$template) {
336
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
337
+        }
322 338
         /**
323 339
          * Filter the detail template path.
324 340
          *
@@ -333,7 +349,9 @@  discard block
 block discarded – undo
333 349
 
334 350
         $template = geodir_locate_template('listing');
335 351
 
336
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
352
+        if (!$template) {
353
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
354
+        }
337 355
         /**
338 356
          * Filter the listing template path.
339 357
          *
@@ -348,7 +366,9 @@  discard block
 block discarded – undo
348 366
 
349 367
         $template = geodir_locate_template('search');
350 368
 
351
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
369
+        if (!$template) {
370
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
371
+        }
352 372
         /**
353 373
          * Filter the search template path.
354 374
          *
@@ -363,7 +383,9 @@  discard block
 block discarded – undo
363 383
 
364 384
         $template = geodir_locate_template('author');
365 385
 
366
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
386
+        if (!$template) {
387
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
388
+        }
367 389
         /**
368 390
          * Filter the author template path.
369 391
          *
@@ -384,7 +406,9 @@  discard block
 block discarded – undo
384 406
 
385 407
             $template = geodir_locate_template('geodir-home');
386 408
 
387
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
409
+            if (!$template) {
410
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
411
+            }
388 412
             /**
389 413
              * Filter the home page template path.
390 414
              *
@@ -397,7 +421,9 @@  discard block
 block discarded – undo
397 421
 
398 422
             $template = geodir_locate_template('location');
399 423
 
400
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
424
+            if (!$template) {
425
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
426
+            }
401 427
             /**
402 428
              * Filter the location template path.
403 429
              *
@@ -406,8 +432,9 @@  discard block
 block discarded – undo
406 432
              */
407 433
             return $template = apply_filters('geodir_template_location', $template);
408 434
 
409
-        } else
410
-            return $template;
435
+        } else {
436
+                    return $template;
437
+        }
411 438
 
412 439
     }
413 440
 
@@ -461,8 +488,10 @@  discard block
 block discarded – undo
461 488
          * @since 1.0.0
462 489
          */
463 490
         include($template);
464
-    else:
465
-        locate_template(array("geodirectory/" . $template_name), true, false);
491
+    else {
492
+    	:
493
+        locate_template(array("geodirectory/" . $template_name), true, false);
494
+    }
466 495
     endif;
467 496
 
468 497
 }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
  * @global object $post The current post object.
418 418
  * @global object $geodirectory Not yet implemented.
419 419
  * @param string $slug The template slug.
420
- * @param null $name The template name.
420
+ * @param string $name The template name.
421 421
  */
422 422
 function geodir_get_template_part($slug = '', $name = NULL)
423 423
 {
@@ -673,6 +673,9 @@  discard block
 block discarded – undo
673 673
 	}
674 674
 }
675 675
 
676
+/**
677
+ * @param string $shortcode
678
+ */
676 679
 function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
677 680
     if ( empty( $content ) || empty( $shortcode ) ) {
678 681
         return array();
Please login to merge, or discard this patch.
Indentation   +409 added lines, -409 removed lines patch added patch discarded remove patch
@@ -19,134 +19,134 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_locate_template($template = '')
21 21
 {
22
-    global $post_type, $wp, $post;
23
-    $fields = array();
24
-
25
-    switch ($template):
26
-        case 'signup':
27
-            return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
-            break;
29
-        case 'add-listing':
30
-            $gd_post_types = geodir_get_posttypes();
22
+	global $post_type, $wp, $post;
23
+	$fields = array();
24
+
25
+	switch ($template):
26
+		case 'signup':
27
+			return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
+			break;
29
+		case 'add-listing':
30
+			$gd_post_types = geodir_get_posttypes();
31 31
             
32
-            if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
-                $post_type = '';
34
-            }
32
+			if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
+				$post_type = '';
34
+			}
35 35
             
36
-            $sc_post_type = '';
37
-            if (is_page() && !empty($post->post_content) && ($shortcode = geodir_parse_shortcodes($post->post_content, 'gd_add_listing'))) {
38
-                $listing_page_id = $post->ID;
39
-                if (!empty($shortcode['listing_type'])) {
40
-                    $sc_post_type = $shortcode['listing_type'];
41
-                }
42
-            } else {
43
-                $listing_page_id = geodir_add_listing_page_id();
44
-            }
36
+			$sc_post_type = '';
37
+			if (is_page() && !empty($post->post_content) && ($shortcode = geodir_parse_shortcodes($post->post_content, 'gd_add_listing'))) {
38
+				$listing_page_id = $post->ID;
39
+				if (!empty($shortcode['listing_type'])) {
40
+					$sc_post_type = $shortcode['listing_type'];
41
+				}
42
+			} else {
43
+				$listing_page_id = geodir_add_listing_page_id();
44
+			}
45 45
             
46
-            $is_wpml = geodir_is_wpml() ? true : false;
46
+			$is_wpml = geodir_is_wpml() ? true : false;
47 47
 
48
-            if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49
-                && in_array($_REQUEST['listing_type'], $gd_post_types)) {
50
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
51
-            }
48
+			if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49
+				&& in_array($_REQUEST['listing_type'], $gd_post_types)) {
50
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
51
+			}
52 52
             
53
-            if (empty($post_type) && !isset($_REQUEST['pid'])) {
54
-                $pagename = $wp->query_vars['pagename'];
53
+			if (empty($post_type) && !isset($_REQUEST['pid'])) {
54
+				$pagename = $wp->query_vars['pagename'];
55 55
                 
56
-                if (!empty($gd_post_types)) {
57
-                    $post_type = $gd_post_types[0];
58
-                }
56
+				if (!empty($gd_post_types)) {
57
+					$post_type = $gd_post_types[0];
58
+				}
59 59
                 
60
-                if ($sc_post_type != '') {
61
-                    $post_type = $sc_post_type;
62
-                }
60
+				if ($sc_post_type != '') {
61
+					$post_type = $sc_post_type;
62
+				}
63 63
                 
64
-                if (empty($post_type) && !empty($gd_post_types)) {
65
-                    $post_type = $gd_post_types[0];
66
-                }
64
+				if (empty($post_type) && !empty($gd_post_types)) {
65
+					$post_type = $gd_post_types[0];
66
+				}
67 67
                 
68
-                if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69
-                    wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70
-                } else {
71
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
72
-                }
73
-                gd_die();
74
-            }
75
-            return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
76
-            break;
77
-        case 'success':
78
-            $success_page_id = geodir_success_page_id();
79
-            if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
80
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
81
-            )
82
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
83
-            return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
84
-            break;
85
-        case 'detail':
86
-        case 'preview':
87
-            if (in_array(get_post_type(), geodir_get_posttypes()))
88
-                $post_type = get_post_type();
89
-            return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
90
-            break;
91
-        case 'listing':
92
-            $templates = array();
93
-            if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
94
-                $post_type = get_post_type();
95
-                $templates[] = "geodirectory/archive-$post_type.php";
96
-            }
97
-
98
-
99
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
100
-                $query_obj = get_queried_object();
101
-                $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
102
-                $curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
103
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
104
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
105
-            }
106
-
107
-            $templates[] = "geodirectory/geodir-listing.php";
108
-
109
-            return $template = locate_template($templates);
110
-            break;
111
-        case 'information':
112
-            return $template = locate_template(array("geodirectory/geodir-information.php"));
113
-            break;
114
-        case 'author':
115
-            return $template = locate_template(array("geodirectory/geodir-author.php"));
116
-            break;
117
-        case 'search':
118
-            return $template = locate_template(array("geodirectory/geodir-search.php"));
119
-            break;
120
-        case 'location':
121
-            return $template = locate_template(array("geodirectory/geodir-location.php"));
122
-            break;
123
-        case 'geodir-home':
124
-            return $template = locate_template(array("geodirectory/geodir-home.php"));
125
-            break;
126
-        case 'listing-listview':
127
-            $template = locate_template(array("geodirectory/listing-listview.php"));
128
-            if (!$template) {
129
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
130
-            }
131
-            return $template;
132
-            break;
133
-        case 'widget-listing-listview':
134
-            $template = locate_template(array("geodirectory/widget-listing-listview.php"));
135
-            if (!$template) {
136
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
137
-            }
138
-            return $template;
139
-            break;
68
+				if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69
+					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70
+				} else {
71
+					wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
72
+				}
73
+				gd_die();
74
+			}
75
+			return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
76
+			break;
77
+		case 'success':
78
+			$success_page_id = geodir_success_page_id();
79
+			if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
80
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
81
+			)
82
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
83
+			return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
84
+			break;
85
+		case 'detail':
86
+		case 'preview':
87
+			if (in_array(get_post_type(), geodir_get_posttypes()))
88
+				$post_type = get_post_type();
89
+			return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
90
+			break;
91
+		case 'listing':
92
+			$templates = array();
93
+			if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
94
+				$post_type = get_post_type();
95
+				$templates[] = "geodirectory/archive-$post_type.php";
96
+			}
97
+
98
+
99
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
100
+				$query_obj = get_queried_object();
101
+				$curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
102
+				$curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
103
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
104
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
105
+			}
106
+
107
+			$templates[] = "geodirectory/geodir-listing.php";
108
+
109
+			return $template = locate_template($templates);
110
+			break;
111
+		case 'information':
112
+			return $template = locate_template(array("geodirectory/geodir-information.php"));
113
+			break;
114
+		case 'author':
115
+			return $template = locate_template(array("geodirectory/geodir-author.php"));
116
+			break;
117
+		case 'search':
118
+			return $template = locate_template(array("geodirectory/geodir-search.php"));
119
+			break;
120
+		case 'location':
121
+			return $template = locate_template(array("geodirectory/geodir-location.php"));
122
+			break;
123
+		case 'geodir-home':
124
+			return $template = locate_template(array("geodirectory/geodir-home.php"));
125
+			break;
126
+		case 'listing-listview':
127
+			$template = locate_template(array("geodirectory/listing-listview.php"));
128
+			if (!$template) {
129
+				$template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
130
+			}
131
+			return $template;
132
+			break;
133
+		case 'widget-listing-listview':
134
+			$template = locate_template(array("geodirectory/widget-listing-listview.php"));
135
+			if (!$template) {
136
+				$template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
137
+			}
138
+			return $template;
139
+			break;
140 140
 		case 'email-message':
141
-            $template = locate_template(array("geodirectory/email-message.php"));
142
-            if (!$template) {
143
-                $template = geodir_plugin_path() . '/geodirectory-templates/email-message.php';
144
-            }
145
-            return $template;
146
-            break;
147
-    endswitch;
141
+			$template = locate_template(array("geodirectory/email-message.php"));
142
+			if (!$template) {
143
+				$template = geodir_plugin_path() . '/geodirectory-templates/email-message.php';
144
+			}
145
+			return $template;
146
+			break;
147
+	endswitch;
148 148
 
149
-    return false;
149
+	return false;
150 150
 
151 151
 }
152 152
 
@@ -165,255 +165,255 @@  discard block
 block discarded – undo
165 165
 function geodir_template_loader($template)
166 166
 {
167 167
 
168
-    global $wp_query;
169
-
170
-    /**
171
-     * Filter the custom page list.
172
-     *
173
-     * @since 1.0.0
174
-     */
175
-    $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
176
-        'geodir_signup_page' =>
177
-            apply_filters('geodir_set_custom_signup_page', false),
178
-        'geodir_add_listing_page' =>
179
-            apply_filters('geodir_set_custom_add_listing_page', false),
180
-        'geodir_preview_page' =>
181
-            apply_filters('geodir_set_custom_preview_page', false),
182
-        'geodir_listing_success_page' =>
183
-            apply_filters('geodir_set_custom_listing_success_page', false),
184
-        'geodir_listing_detail_page' =>
185
-            apply_filters('geodir_set_custom_listing_detail_page', false),
186
-        'geodir_listing_page' =>
187
-            apply_filters('geodir_set_custom_listing_page', false),
188
-        'geodir_search_page' =>
189
-            apply_filters('geodir_set_custom_search_page', false),
190
-        'geodir_author_page' =>
191
-            apply_filters('geodir_set_custom_author_page', false),
192
-        'geodir_home_map_page' =>
193
-            apply_filters('geodir_set_custom_home_map_page', false)
194
-    ));
195
-
196
-
197
-    if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
198
-
199
-        $template = geodir_locate_template('signup');
200
-
201
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
202
-
203
-        /**
204
-         * Filter the signup template path.
205
-         *
206
-         * @since 1.0.0
207
-         * @param string $template The template path.
208
-         */
209
-        return $template = apply_filters('geodir_template_signup', $template);
210
-    }
211
-
212
-    if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
213
-        if (!geodir_is_default_location_set()) {
214
-            global $information;
215
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
216
-
217
-            $template = geodir_locate_template('information');
218
-
219
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
220
-            /**
221
-             * Filter the information template path.
222
-             *
223
-             * @since 1.0.0
224
-             * @param string $template The template path.
225
-             */
226
-            return $template = apply_filters('geodir_template_information', $template);
227
-        }
228
-        // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
229
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
230
-            /// WPML
231
-            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
232
-                global $sitepress;
168
+	global $wp_query;
169
+
170
+	/**
171
+	 * Filter the custom page list.
172
+	 *
173
+	 * @since 1.0.0
174
+	 */
175
+	$geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
176
+		'geodir_signup_page' =>
177
+			apply_filters('geodir_set_custom_signup_page', false),
178
+		'geodir_add_listing_page' =>
179
+			apply_filters('geodir_set_custom_add_listing_page', false),
180
+		'geodir_preview_page' =>
181
+			apply_filters('geodir_set_custom_preview_page', false),
182
+		'geodir_listing_success_page' =>
183
+			apply_filters('geodir_set_custom_listing_success_page', false),
184
+		'geodir_listing_detail_page' =>
185
+			apply_filters('geodir_set_custom_listing_detail_page', false),
186
+		'geodir_listing_page' =>
187
+			apply_filters('geodir_set_custom_listing_page', false),
188
+		'geodir_search_page' =>
189
+			apply_filters('geodir_set_custom_search_page', false),
190
+		'geodir_author_page' =>
191
+			apply_filters('geodir_set_custom_author_page', false),
192
+		'geodir_home_map_page' =>
193
+			apply_filters('geodir_set_custom_home_map_page', false)
194
+	));
195
+
196
+
197
+	if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
198
+
199
+		$template = geodir_locate_template('signup');
200
+
201
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
202
+
203
+		/**
204
+		 * Filter the signup template path.
205
+		 *
206
+		 * @since 1.0.0
207
+		 * @param string $template The template path.
208
+		 */
209
+		return $template = apply_filters('geodir_template_signup', $template);
210
+	}
211
+
212
+	if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
213
+		if (!geodir_is_default_location_set()) {
214
+			global $information;
215
+			$information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
216
+
217
+			$template = geodir_locate_template('information');
218
+
219
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
220
+			/**
221
+			 * Filter the information template path.
222
+			 *
223
+			 * @since 1.0.0
224
+			 * @param string $template The template path.
225
+			 */
226
+			return $template = apply_filters('geodir_template_information', $template);
227
+		}
228
+		// check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
229
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
230
+			/// WPML
231
+			if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
232
+				global $sitepress;
233 233
                 
234
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
235
-                $sitepress->switch_lang($lang_of_duplicate, true);
234
+				$lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
235
+				$sitepress->switch_lang($lang_of_duplicate, true);
236 236
         
237
-                $redirect_to = get_permalink(geodir_add_listing_page_id());
238
-                $_GET['pid'] = $duplicate_of;
239
-                if (!empty($_GET)) {
240
-                    $redirect_to = add_query_arg($_GET, $redirect_to);
241
-                }
242
-                wp_redirect($redirect_to);
243
-                exit;
244
-            }
245
-            /// WPML
237
+				$redirect_to = get_permalink(geodir_add_listing_page_id());
238
+				$_GET['pid'] = $duplicate_of;
239
+				if (!empty($_GET)) {
240
+					$redirect_to = add_query_arg($_GET, $redirect_to);
241
+				}
242
+				wp_redirect($redirect_to);
243
+				exit;
244
+			}
245
+			/// WPML
246 246
             
247
-            global $information;
248
-            $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
249
-            $is_current_user_owner = geodir_listing_belong_to_current_user();
250
-            if (!$is_current_user_owner) {
251
-                $template = geodir_locate_template('information');
252
-
253
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
254
-                /**
255
-                 * Filter the information template path.
256
-                 *
257
-                 * @since 1.0.0
258
-                 * @param string $template The template path.
259
-                 */
260
-                return $template = apply_filters('geodir_template_information', $template);
261
-            }
247
+			global $information;
248
+			$information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
249
+			$is_current_user_owner = geodir_listing_belong_to_current_user();
250
+			if (!$is_current_user_owner) {
251
+				$template = geodir_locate_template('information');
252
+
253
+				if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
254
+				/**
255
+				 * Filter the information template path.
256
+				 *
257
+				 * @since 1.0.0
258
+				 * @param string $template The template path.
259
+				 */
260
+				return $template = apply_filters('geodir_template_information', $template);
261
+			}
262 262
 
263 263
 
264
-        }
264
+		}
265 265
 
266
-        //geodir_is_login(true);
267
-        global $current_user;
268
-        if (!$current_user->ID) {
269
-            wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
270
-            exit;
271
-        }
266
+		//geodir_is_login(true);
267
+		global $current_user;
268
+		if (!$current_user->ID) {
269
+			wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
270
+			exit;
271
+		}
272 272
 
273
-        $template = geodir_locate_template('add-listing');
274
-
275
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
276
-        /**
277
-         * Filter the add listing template path.
278
-         *
279
-         * @since 1.0.0
280
-         * @param string $template The template path.
281
-         */
282
-        return $template = apply_filters('geodir_template_add_listing', $template);
283
-    }
273
+		$template = geodir_locate_template('add-listing');
284 274
 
275
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
276
+		/**
277
+		 * Filter the add listing template path.
278
+		 *
279
+		 * @since 1.0.0
280
+		 * @param string $template The template path.
281
+		 */
282
+		return $template = apply_filters('geodir_template_add_listing', $template);
283
+	}
285 284
 
286
-    if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
287
-        global $preview;
288
-        $preview = true;
289 285
 
290
-        $template = geodir_locate_template('preview');
286
+	if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
287
+		global $preview;
288
+		$preview = true;
291 289
 
292
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
293
-        /**
294
-         * Filter the preview template path.
295
-         *
296
-         * @since 1.0.0
297
-         * @param string $template The template path.
298
-         */
299
-        return $template = apply_filters('geodir_template_preview', $template);
290
+		$template = geodir_locate_template('preview');
300 291
 
301
-    }
292
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
293
+		/**
294
+		 * Filter the preview template path.
295
+		 *
296
+		 * @since 1.0.0
297
+		 * @param string $template The template path.
298
+		 */
299
+		return $template = apply_filters('geodir_template_preview', $template);
302 300
 
301
+	}
303 302
 
304
-    if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
305 303
 
306
-        $template = geodir_locate_template('success');
304
+	if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
307 305
 
308
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
309
-        /**
310
-         * Filter the success template path.
311
-         *
312
-         * @since 1.0.0
313
-         * @param string $template The template path.
314
-         */
315
-        return $template = apply_filters('geodir_template_success', $template);
306
+		$template = geodir_locate_template('success');
316 307
 
317
-    }
308
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
309
+		/**
310
+		 * Filter the success template path.
311
+		 *
312
+		 * @since 1.0.0
313
+		 * @param string $template The template path.
314
+		 */
315
+		return $template = apply_filters('geodir_template_success', $template);
318 316
 
319
-    if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
317
+	}
320 318
 
321
-        $template = geodir_locate_template('detail');
319
+	if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
322 320
 
323
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
324
-        /**
325
-         * Filter the detail template path.
326
-         *
327
-         * @since 1.0.0
328
-         * @param string $template The template path.
329
-         */
330
-        return $template = apply_filters('geodir_template_detail', $template);
321
+		$template = geodir_locate_template('detail');
331 322
 
332
-    }
323
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
324
+		/**
325
+		 * Filter the detail template path.
326
+		 *
327
+		 * @since 1.0.0
328
+		 * @param string $template The template path.
329
+		 */
330
+		return $template = apply_filters('geodir_template_detail', $template);
333 331
 
334
-    if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
332
+	}
335 333
 
336
-        $template = geodir_locate_template('listing');
334
+	if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
337 335
 
338
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
339
-        /**
340
-         * Filter the listing template path.
341
-         *
342
-         * @since 1.0.0
343
-         * @param string $template The template path.
344
-         */
345
-        return $template = apply_filters('geodir_template_listing', $template);
336
+		$template = geodir_locate_template('listing');
346 337
 
347
-    }
338
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
339
+		/**
340
+		 * Filter the listing template path.
341
+		 *
342
+		 * @since 1.0.0
343
+		 * @param string $template The template path.
344
+		 */
345
+		return $template = apply_filters('geodir_template_listing', $template);
348 346
 
349
-    if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
347
+	}
350 348
 
351
-        $template = geodir_locate_template('search');
349
+	if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
352 350
 
353
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
354
-        /**
355
-         * Filter the search template path.
356
-         *
357
-         * @since 1.0.0
358
-         * @param string $template The template path.
359
-         */
360
-        return $template = apply_filters('geodir_template_search', $template);
351
+		$template = geodir_locate_template('search');
361 352
 
362
-    }
353
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
354
+		/**
355
+		 * Filter the search template path.
356
+		 *
357
+		 * @since 1.0.0
358
+		 * @param string $template The template path.
359
+		 */
360
+		return $template = apply_filters('geodir_template_search', $template);
363 361
 
364
-    if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
362
+	}
365 363
 
366
-        $template = geodir_locate_template('author');
364
+	if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
367 365
 
368
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
369
-        /**
370
-         * Filter the author template path.
371
-         *
372
-         * @since 1.0.0
373
-         * @param string $template The template path.
374
-         */
375
-        return $template = apply_filters('geodir_template_author', $template);
366
+		$template = geodir_locate_template('author');
376 367
 
377
-    }
368
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
369
+		/**
370
+		 * Filter the author template path.
371
+		 *
372
+		 * @since 1.0.0
373
+		 * @param string $template The template path.
374
+		 */
375
+		return $template = apply_filters('geodir_template_author', $template);
378 376
 
379
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
377
+	}
380 378
 
381
-        global $post, $wp_query;
379
+	if ( geodir_is_page('home') || geodir_is_page('location')) {
382 380
 
383
-        if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
384
-            || (is_home() && !$wp_query->is_posts_page)
385
-        ) {
381
+		global $post, $wp_query;
386 382
 
387
-            $template = geodir_locate_template('geodir-home');
383
+		if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
384
+			|| (is_home() && !$wp_query->is_posts_page)
385
+		) {
388 386
 
389
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
390
-            /**
391
-             * Filter the home page template path.
392
-             *
393
-             * @since 1.0.0
394
-             * @param string $template The template path.
395
-             */
396
-            return $template = apply_filters('geodir_template_homepage', $template);
387
+			$template = geodir_locate_template('geodir-home');
397 388
 
398
-        } elseif (geodir_is_page('location')) {
389
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
390
+			/**
391
+			 * Filter the home page template path.
392
+			 *
393
+			 * @since 1.0.0
394
+			 * @param string $template The template path.
395
+			 */
396
+			return $template = apply_filters('geodir_template_homepage', $template);
399 397
 
400
-            $template = geodir_locate_template('location');
398
+		} elseif (geodir_is_page('location')) {
401 399
 
402
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
403
-            /**
404
-             * Filter the location template path.
405
-             *
406
-             * @since 1.0.0
407
-             * @param string $template The template path.
408
-             */
409
-            return $template = apply_filters('geodir_template_location', $template);
400
+			$template = geodir_locate_template('location');
410 401
 
411
-        } else
412
-            return $template;
402
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
403
+			/**
404
+			 * Filter the location template path.
405
+			 *
406
+			 * @since 1.0.0
407
+			 * @param string $template The template path.
408
+			 */
409
+			return $template = apply_filters('geodir_template_location', $template);
413 410
 
414
-    }
411
+		} else
412
+			return $template;
415 413
 
416
-    return $template;
414
+	}
415
+
416
+	return $template;
417 417
 }
418 418
 
419 419
 /**
@@ -428,44 +428,44 @@  discard block
 block discarded – undo
428 428
  */
429 429
 function geodir_get_template_part($slug = '', $name = NULL)
430 430
 {
431
-    global $geodirectory, $post;
432
-    /**
433
-     * Called at the start for the geodir_get_template_part() function.
434
-     *
435
-     * Used dynamic hook name: geodir_get_template_part_{$slug}
436
-     *
437
-     * @since 1.0.0
438
-     * @package GeoDirectory
439
-     * @param string $slug The template slug.
440
-     * @param string $name The template name.
441
-     */
442
-    do_action("geodir_get_template_part_{$slug}", $slug, $name);
443
-    $templates = array();
444
-    $name = (string)$name;
445
-    if ('' !== $name) {
446
-        $template_name = "{$slug}-{$name}.php";
447
-
448
-    } else {
449
-        $template_name = "{$slug}.php";
450
-    }
451
-
452
-    if (!locate_template(array("geodirectory/" . $template_name))) :
453
-        /**
454
-         * Filter the template part with slug and name.
455
-         *
456
-         * @since 1.0.0
457
-         * @param string $template_name The template name.
458
-         */
459
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
460
-        /**
461
-         * Includes the template part with slug and name.
462
-         *
463
-         * @since 1.0.0
464
-         */
465
-        include($template);
466
-    else:
467
-        locate_template(array("geodirectory/" . $template_name), true, false);
468
-    endif;
431
+	global $geodirectory, $post;
432
+	/**
433
+	 * Called at the start for the geodir_get_template_part() function.
434
+	 *
435
+	 * Used dynamic hook name: geodir_get_template_part_{$slug}
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @package GeoDirectory
439
+	 * @param string $slug The template slug.
440
+	 * @param string $name The template name.
441
+	 */
442
+	do_action("geodir_get_template_part_{$slug}", $slug, $name);
443
+	$templates = array();
444
+	$name = (string)$name;
445
+	if ('' !== $name) {
446
+		$template_name = "{$slug}-{$name}.php";
447
+
448
+	} else {
449
+		$template_name = "{$slug}.php";
450
+	}
451
+
452
+	if (!locate_template(array("geodirectory/" . $template_name))) :
453
+		/**
454
+		 * Filter the template part with slug and name.
455
+		 *
456
+		 * @since 1.0.0
457
+		 * @param string $template_name The template name.
458
+		 */
459
+		$template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
460
+		/**
461
+		 * Includes the template part with slug and name.
462
+		 *
463
+		 * @since 1.0.0
464
+		 */
465
+		include($template);
466
+	else:
467
+		locate_template(array("geodirectory/" . $template_name), true, false);
468
+	endif;
469 469
 
470 470
 }
471 471
 
@@ -481,23 +481,23 @@  discard block
 block discarded – undo
481 481
  */
482 482
 function geodir_core_post_view_extra_class($class, $all_postypes = '')
483 483
 {
484
-    global $post;
484
+	global $post;
485 485
 
486
-    if (!$all_postypes) {
487
-        $all_postypes = geodir_get_posttypes();
488
-    }
486
+	if (!$all_postypes) {
487
+		$all_postypes = geodir_get_posttypes();
488
+	}
489 489
 
490
-    $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
491
-    $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
492
-    $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
490
+	$gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
491
+	$gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
492
+	$gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
493 493
 
494
-    if ($gdp_post_id && $gdp_post_type) {
495
-        $append_class = 'gd-post-' . $gdp_post_type;
496
-        $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
497
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
498
-    }
494
+	if ($gdp_post_id && $gdp_post_type) {
495
+		$append_class = 'gd-post-' . $gdp_post_type;
496
+		$append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
497
+		$class = $class != '' ? $class . ' ' . $append_class : $append_class;
498
+	}
499 499
 
500
-    return $class;
500
+	return $class;
501 501
 }
502 502
 
503 503
 /**
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
  * @param bool $favorite Listing Optional. Are favorite listings results? Default: false.
512 512
  */
513 513
 function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
514
-    if ($favorite) {
514
+	if ($favorite) {
515 515
 		$message = __('No favorite listings found which match your selection.', 'geodirectory');
516 516
 	} else {
517 517
 		$message = __('No listings found which match your selection.', 'geodirectory');
@@ -681,42 +681,42 @@  discard block
 block discarded – undo
681 681
 }
682 682
 
683 683
 function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
684
-    if ( empty( $content ) || empty( $shortcode ) ) {
685
-        return array();
686
-    }
684
+	if ( empty( $content ) || empty( $shortcode ) ) {
685
+		return array();
686
+	}
687 687
     
688
-    if ( false === strpos( $content, '[' ) ) {
689
-        return array();
690
-    }
691
-
692
-    if ( ! has_shortcode( $content, $shortcode ) ) {
693
-        return array();
694
-    }
695
-
696
-    $shortcodes = array();
697
-    if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
698
-        foreach ( $matches as $match ) {
699
-            if ( $shortcode === $match[2] ) {
700
-                $shortcode_attrs = shortcode_parse_atts( $match[3] );
701
-                if ( ! is_array( $shortcode_attrs ) ) {
702
-                    $shortcode_attrs = array();
703
-                }
704
-                $shortcode_attrs['shortcode_tag'] = $shortcode;
705
-                if ( !empty( $match[5] ) ) {
706
-                    $shortcode_attrs['shortcode_content'] = $match[5];
707
-                }
708
-                $shortcodes[] = $shortcode_attrs;
709
-                if ( $first === true ) {
710
-                    break;
711
-                }
712
-            }
713
-        }
714
-        if ( $first === true && !empty( $shortcodes ) ) {
715
-            $shortcodes = $shortcodes[0];
716
-        }
717
-    }
718
-
719
-    return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
688
+	if ( false === strpos( $content, '[' ) ) {
689
+		return array();
690
+	}
691
+
692
+	if ( ! has_shortcode( $content, $shortcode ) ) {
693
+		return array();
694
+	}
695
+
696
+	$shortcodes = array();
697
+	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
698
+		foreach ( $matches as $match ) {
699
+			if ( $shortcode === $match[2] ) {
700
+				$shortcode_attrs = shortcode_parse_atts( $match[3] );
701
+				if ( ! is_array( $shortcode_attrs ) ) {
702
+					$shortcode_attrs = array();
703
+				}
704
+				$shortcode_attrs['shortcode_tag'] = $shortcode;
705
+				if ( !empty( $match[5] ) ) {
706
+					$shortcode_attrs['shortcode_content'] = $match[5];
707
+				}
708
+				$shortcodes[] = $shortcode_attrs;
709
+				if ( $first === true ) {
710
+					break;
711
+				}
712
+			}
713
+		}
714
+		if ( $first === true && !empty( $shortcodes ) ) {
715
+			$shortcodes = $shortcodes[0];
716
+		}
717
+	}
718
+
719
+	return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
720 720
 }
721 721
 
722 722
 /**
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69 69
                     wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70 70
                 } else {
71
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
71
+                    wp_redirect(trailingslashit(get_site_url()).$pagename.'/?listing_type='.$post_type);
72 72
                 }
73 73
                 gd_die();
74 74
             }
@@ -126,21 +126,21 @@  discard block
 block discarded – undo
126 126
         case 'listing-listview':
127 127
             $template = locate_template(array("geodirectory/listing-listview.php"));
128 128
             if (!$template) {
129
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
129
+                $template = geodir_plugin_path().'/geodirectory-templates/listing-listview.php';
130 130
             }
131 131
             return $template;
132 132
             break;
133 133
         case 'widget-listing-listview':
134 134
             $template = locate_template(array("geodirectory/widget-listing-listview.php"));
135 135
             if (!$template) {
136
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
136
+                $template = geodir_plugin_path().'/geodirectory-templates/widget-listing-listview.php';
137 137
             }
138 138
             return $template;
139 139
             break;
140 140
 		case 'email-message':
141 141
             $template = locate_template(array("geodirectory/email-message.php"));
142 142
             if (!$template) {
143
-                $template = geodir_plugin_path() . '/geodirectory-templates/email-message.php';
143
+                $template = geodir_plugin_path().'/geodirectory-templates/email-message.php';
144 144
             }
145 145
             return $template;
146 146
             break;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
         $template = geodir_locate_template('signup');
200 200
 
201
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
201
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php';
202 202
 
203 203
         /**
204 204
          * Filter the signup template path.
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
     if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
213 213
         if (!geodir_is_default_location_set()) {
214 214
             global $information;
215
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
215
+            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>');
216 216
 
217 217
             $template = geodir_locate_template('information');
218 218
 
219
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
219
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';
220 220
             /**
221 221
              * Filter the information template path.
222 222
              *
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
         // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
229 229
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
230 230
             /// WPML
231
-            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
231
+            if (geodir_wpml_is_post_type_translated(get_post_type((int) $_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int) $_GET['pid'])) {
232 232
                 global $sitepress;
233 233
                 
234
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
234
+                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_'.get_post_type($duplicate_of));
235 235
                 $sitepress->switch_lang($lang_of_duplicate, true);
236 236
         
237 237
                 $redirect_to = get_permalink(geodir_add_listing_page_id());
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             if (!$is_current_user_owner) {
251 251
                 $template = geodir_locate_template('information');
252 252
 
253
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
253
+                if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';
254 254
                 /**
255 255
                  * Filter the information template path.
256 256
                  *
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         $template = geodir_locate_template('add-listing');
274 274
 
275
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
275
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/add-listing.php';
276 276
         /**
277 277
          * Filter the add listing template path.
278 278
          *
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
         $template = geodir_locate_template('preview');
291 291
 
292
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
292
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';
293 293
         /**
294 294
          * Filter the preview template path.
295 295
          *
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
         $template = geodir_locate_template('success');
307 307
 
308
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
308
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-success.php';
309 309
         /**
310 310
          * Filter the success template path.
311 311
          *
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
         $template = geodir_locate_template('detail');
322 322
 
323
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
323
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';
324 324
         /**
325 325
          * Filter the detail template path.
326 326
          *
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
         $template = geodir_locate_template('listing');
337 337
 
338
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
338
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-listing.php';
339 339
         /**
340 340
          * Filter the listing template path.
341 341
          *
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
         $template = geodir_locate_template('search');
352 352
 
353
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
353
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-search.php';
354 354
         /**
355 355
          * Filter the search template path.
356 356
          *
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 
366 366
         $template = geodir_locate_template('author');
367 367
 
368
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
368
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-author.php';
369 369
         /**
370 370
          * Filter the author template path.
371 371
          *
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
     }
378 378
 
379
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
379
+    if (geodir_is_page('home') || geodir_is_page('location')) {
380 380
 
381 381
         global $post, $wp_query;
382 382
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
             $template = geodir_locate_template('geodir-home');
388 388
 
389
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
389
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-home.php';
390 390
             /**
391 391
              * Filter the home page template path.
392 392
              *
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
             $template = geodir_locate_template('location');
401 401
 
402
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
402
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-location.php';
403 403
             /**
404 404
              * Filter the location template path.
405 405
              *
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
      */
442 442
     do_action("geodir_get_template_part_{$slug}", $slug, $name);
443 443
     $templates = array();
444
-    $name = (string)$name;
444
+    $name = (string) $name;
445 445
     if ('' !== $name) {
446 446
         $template_name = "{$slug}-{$name}.php";
447 447
 
@@ -449,14 +449,14 @@  discard block
 block discarded – undo
449 449
         $template_name = "{$slug}.php";
450 450
     }
451 451
 
452
-    if (!locate_template(array("geodirectory/" . $template_name))) :
452
+    if (!locate_template(array("geodirectory/".$template_name))) :
453 453
         /**
454 454
          * Filter the template part with slug and name.
455 455
          *
456 456
          * @since 1.0.0
457 457
          * @param string $template_name The template name.
458 458
          */
459
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
459
+        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path().'/geodirectory-templates/'.$template_name);
460 460
         /**
461 461
          * Includes the template part with slug and name.
462 462
          *
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
          */
465 465
         include($template);
466 466
     else:
467
-        locate_template(array("geodirectory/" . $template_name), true, false);
467
+        locate_template(array("geodirectory/".$template_name), true, false);
468 468
     endif;
469 469
 
470 470
 }
@@ -492,9 +492,9 @@  discard block
 block discarded – undo
492 492
     $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
493 493
 
494 494
     if ($gdp_post_id && $gdp_post_type) {
495
-        $append_class = 'gd-post-' . $gdp_post_type;
495
+        $append_class = 'gd-post-'.$gdp_post_type;
496 496
         $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
497
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
497
+        $class = $class != '' ? $class.' '.$append_class : $append_class;
498 498
     }
499 499
 
500 500
     return $class;
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	$message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
528 528
 	
529
-	echo '<li class="no-listing">' . $message . '</li>';
529
+	echo '<li class="no-listing">'.$message.'</li>';
530 530
 }
531 531
 
532 532
 /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 function geodir_convert_listing_view_class($columns = '') {
556 556
 	$class = '';
557 557
 	
558
-	switch ((int)$columns) {
558
+	switch ((int) $columns) {
559 559
 		case 1:
560 560
 			$class = '';
561 561
 		break;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 		$html .= '<option value=""></option>';
621 621
 		if (!empty($star_texts) && is_array($star_texts)) {
622 622
 			foreach ($star_texts as $i => $text) {
623
-				$html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
623
+				$html .= '<option '.selected((int) ($i + 1), (int) $default, false).' value="'.(int) ($i + 1).'">'.$text.'</option>';
624 624
 			}
625 625
 		} else {
626 626
 			$html .= '<option value="1">1</option>';
@@ -649,14 +649,14 @@  discard block
 block discarded – undo
649 649
 function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
650 650
 	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
651 651
 		$rating = min($rating, $star_count);
652
-		$full_stars = floor( $rating );
653
-		$half_stars = ceil( $rating - $full_stars );
652
+		$full_stars = floor($rating);
653
+		$half_stars = ceil($rating - $full_stars);
654 654
 		$empty_stars = $star_count - $full_stars - $half_stars;
655 655
 		
656 656
 		$html = '<div class="gd-star-rating gd-fa-star-rating">';
657
-		$html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
658
-		$html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
659
-		$html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
657
+		$html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
658
+		$html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
659
+		$html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
660 660
 		$html .= '</div>';
661 661
 	}
662 662
 
@@ -675,48 +675,48 @@  discard block
 block discarded – undo
675 675
 		$full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
676 676
 		if ($full_color != '#757575') {
677 677
 			echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,
678
-			.gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;}</style>';
678
+			.gd-star-rating i.fa {color:' . stripslashes($full_color).'!important;}</style>';
679 679
 		}
680 680
 	}
681 681
 }
682 682
 
683
-function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
684
-    if ( empty( $content ) || empty( $shortcode ) ) {
683
+function geodir_parse_shortcodes($content, $shortcode, $first = true) {
684
+    if (empty($content) || empty($shortcode)) {
685 685
         return array();
686 686
     }
687 687
     
688
-    if ( false === strpos( $content, '[' ) ) {
688
+    if (false === strpos($content, '[')) {
689 689
         return array();
690 690
     }
691 691
 
692
-    if ( ! has_shortcode( $content, $shortcode ) ) {
692
+    if (!has_shortcode($content, $shortcode)) {
693 693
         return array();
694 694
     }
695 695
 
696 696
     $shortcodes = array();
697
-    if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
698
-        foreach ( $matches as $match ) {
699
-            if ( $shortcode === $match[2] ) {
700
-                $shortcode_attrs = shortcode_parse_atts( $match[3] );
701
-                if ( ! is_array( $shortcode_attrs ) ) {
697
+    if (preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER)) {
698
+        foreach ($matches as $match) {
699
+            if ($shortcode === $match[2]) {
700
+                $shortcode_attrs = shortcode_parse_atts($match[3]);
701
+                if (!is_array($shortcode_attrs)) {
702 702
                     $shortcode_attrs = array();
703 703
                 }
704 704
                 $shortcode_attrs['shortcode_tag'] = $shortcode;
705
-                if ( !empty( $match[5] ) ) {
705
+                if (!empty($match[5])) {
706 706
                     $shortcode_attrs['shortcode_content'] = $match[5];
707 707
                 }
708 708
                 $shortcodes[] = $shortcode_attrs;
709
-                if ( $first === true ) {
709
+                if ($first === true) {
710 710
                     break;
711 711
                 }
712 712
             }
713 713
         }
714
-        if ( $first === true && !empty( $shortcodes ) ) {
714
+        if ($first === true && !empty($shortcodes)) {
715 715
             $shortcodes = $shortcodes[0];
716 716
         }
717 717
     }
718 718
 
719
-    return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
719
+    return apply_filters('geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first);
720 720
 }
721 721
 
722 722
 /**
@@ -730,14 +730,14 @@  discard block
 block discarded – undo
730 730
  * @param array $email_vars     The email parameters.
731 731
  * @return string Filtered email message.
732 732
  */
733
-function geodir_email_wrap_message( $message, $email_type = '', $email_vars = array() ) {
733
+function geodir_email_wrap_message($message, $email_type = '', $email_vars = array()) {
734 734
 	global $geodir_email_content, $geodir_email_type, $geodir_email_vars;
735 735
 
736 736
 	$geodir_email_content = $message;
737 737
 	$geodir_email_type = $email_type;
738 738
 	$geodir_email_vars = $email_vars;
739 739
 
740
-	$template = apply_filters( "geodir_template_part-email-content", geodir_locate_template( 'email-message' ) );
740
+	$template = apply_filters("geodir_template_part-email-content", geodir_locate_template('email-message'));
741 741
 
742 742
 	ob_start();
743 743
 	/**
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @since 1.6.26
747 747
 	 */
748
-	include( $template );
748
+	include($template);
749 749
 
750 750
 	$content = ob_get_clean();
751 751
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
  * @param string $post_id       The post ID.
771 771
  * @param string $user_id       The user ID.
772 772
  */
773
-function geodir_email_wrap_user_message( $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ) {
773
+function geodir_email_wrap_user_message($message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id) {
774 774
 	$email_vars = array();
775 775
 	$email_vars['message_type'] = $message_type;
776 776
 	$email_vars['fromEmail'] = $fromEmail;
@@ -783,9 +783,9 @@  discard block
 block discarded – undo
783 783
 	$email_vars['post_id'] = $post_id;
784 784
 	$email_vars['user_id'] = $user_id;
785 785
 
786
-	return geodir_email_wrap_message( $message, $message_type, $email_vars );
786
+	return geodir_email_wrap_message($message, $message_type, $email_vars);
787 787
 }
788
-add_filter( 'geodir_sendEmail_message', 'geodir_email_wrap_user_message', 10, 11 );
788
+add_filter('geodir_sendEmail_message', 'geodir_email_wrap_user_message', 10, 11);
789 789
 
790 790
 /**
791 791
  * Filter the admin email message.
@@ -799,13 +799,13 @@  discard block
 block discarded – undo
799 799
  * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
800 800
  * @param string $custom_1     Custom data to be sent.
801 801
  */
802
-function geodir_email_wrap_admin_message( $message, $page_id, $user_id, $message_type, $custom_1 ) {
802
+function geodir_email_wrap_admin_message($message, $page_id, $user_id, $message_type, $custom_1) {
803 803
 	$email_vars = array();
804 804
 	$email_vars['message_type'] = $message_type;
805 805
 	$email_vars['page_id'] = $page_id;
806 806
 	$email_vars['user_id'] = $user_id;
807 807
 	$email_vars['custom_1'] = $custom_1;
808 808
 
809
-	return geodir_email_wrap_message( $message, $message_type, $email_vars );
809
+	return geodir_email_wrap_message($message, $message_type, $email_vars);
810 810
 }
811
-add_filter( 'geodir_adminEmail_message', 'geodir_email_wrap_admin_message', 10, 5 );
812 811
\ No newline at end of file
812
+add_filter('geodir_adminEmail_message', 'geodir_email_wrap_admin_message', 10, 5);
813 813
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_functions.php 3 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                         global $sitepress;
264 264
                         $default_lang = $sitepress->get_default_language();
265 265
                         $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
266
-                    }else{
266
+                    } else{
267 267
                         $term_id = $cat_term->term_id;
268 268
                     }
269 269
                     if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
@@ -291,8 +291,9 @@  discard block
 block discarded – undo
291 291
 
292 292
         return $out;
293 293
     } else {
294
-        if ($cat_parent == 0)
295
-            return _e('No category', 'geodirectory');
294
+        if ($cat_parent == 0) {
295
+                    return _e('No category', 'geodirectory');
296
+        }
296 297
     }
297 298
     return;
298 299
 }
Please login to merge, or discard this patch.
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function  geodir_init_map_jason()
17 17
 {
18
-    global $map_jason;
19
-    $map_jason = array();
18
+	global $map_jason;
19
+	$map_jason = array();
20 20
 }
21 21
 
22 22
 /**
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function geodir_init_map_canvas_array()
30 30
 {
31
-    global $map_canvas_arr;
32
-    $map_canvas_arr = array();
31
+	global $map_canvas_arr;
32
+	$map_canvas_arr = array();
33 33
 }
34 34
 
35 35
 
@@ -50,68 +50,68 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function create_marker_jason_of_posts($post)
52 52
 {
53
-    global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
53
+	global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
54 54
 
55
-    if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array)) {
55
+	if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array)) {
56 56
 
57
-        if(isset($map_jason[$post->ID])){return null;}
57
+		if(isset($map_jason[$post->ID])){return null;}
58 58
 
59
-        $srcharr = array("'", "/", "-", '"', '\\');
60
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
59
+		$srcharr = array("'", "/", "-", '"', '\\');
60
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
61 61
 
62
-        $default_category = isset($post->default_category) ? $post->default_category : geodir_get_post_meta($post->ID,'default_category');
62
+		$default_category = isset($post->default_category) ? $post->default_category : geodir_get_post_meta($post->ID,'default_category');
63 63
 
64
-        $geodir_cat_icons = geodir_get_term_icon();
65
-        $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_category]) ? $geodir_cat_icons[$default_category] : '';
64
+		$geodir_cat_icons = geodir_get_term_icon();
65
+		$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_category]) ? $geodir_cat_icons[$default_category] : '';
66 66
 
67
-        $post_title = $post->post_title;
68
-        $title = str_replace($srcharr, $replarr, $post_title);
67
+		$post_title = $post->post_title;
68
+		$title = str_replace($srcharr, $replarr, $post_title);
69 69
 
70
-        if (is_ssl()) {
71
-            $icon = str_replace("http:","https:",$icon );
72
-        }
70
+		if (is_ssl()) {
71
+			$icon = str_replace("http:","https:",$icon );
72
+		}
73 73
         
74
-        if ($icon != '') {
75
-            $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
74
+		if ($icon != '') {
75
+			$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
76 76
             
77
-            if (isset($gd_marker_sizes[$icon])) {
78
-                $icon_size = $gd_marker_sizes[$icon];
79
-            } else {
80
-                $icon_size = geodir_get_marker_size($icon);
81
-                $gd_marker_sizes[$icon] = $icon_size;
82
-            }               
83
-        } else {
84
-            $icon_size = array('w' => 36, 'h' => 45);
85
-        }
86
-
87
-        $post_latitude = isset($post->post_latitude) ? $post->post_latitude : geodir_get_post_meta($post->ID,'post_latitude');
88
-        $post_longitude = isset($post->post_longitude) ? $post->post_longitude : geodir_get_post_meta($post->ID,'post_longitude');
89
-
90
-
91
-        $post_json = '{"id":"' . $post->ID
92
-                     . '","t": "' . $title
93
-                     . '","lt": "' . $post_latitude
94
-                     . '","ln": "' . $post_longitude
95
-                     . '","mk_id":"' . $post->ID . '_' . $default_category
96
-                     . '","i":"' . $icon
97
-                     . '","w":"' . $icon_size['w']
98
-                     . '","h":"' . $icon_size['h'] . '"}';
99
-
100
-        /**
101
-         * Filter the json data when creating output for post json marker..
102
-         *
103
-         * @since 1.5.7
104
-         * @param string $post_json JSON representation of the post marker info.
105
-         * @param object $post The post object.
106
-         */
107
-        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
108
-
109
-        // only assign it if it has a value
110
-        if($post_map_json){
111
-            $map_jason[$post->ID] = $post_map_json;
112
-        }
113
-
114
-    }
77
+			if (isset($gd_marker_sizes[$icon])) {
78
+				$icon_size = $gd_marker_sizes[$icon];
79
+			} else {
80
+				$icon_size = geodir_get_marker_size($icon);
81
+				$gd_marker_sizes[$icon] = $icon_size;
82
+			}               
83
+		} else {
84
+			$icon_size = array('w' => 36, 'h' => 45);
85
+		}
86
+
87
+		$post_latitude = isset($post->post_latitude) ? $post->post_latitude : geodir_get_post_meta($post->ID,'post_latitude');
88
+		$post_longitude = isset($post->post_longitude) ? $post->post_longitude : geodir_get_post_meta($post->ID,'post_longitude');
89
+
90
+
91
+		$post_json = '{"id":"' . $post->ID
92
+					 . '","t": "' . $title
93
+					 . '","lt": "' . $post_latitude
94
+					 . '","ln": "' . $post_longitude
95
+					 . '","mk_id":"' . $post->ID . '_' . $default_category
96
+					 . '","i":"' . $icon
97
+					 . '","w":"' . $icon_size['w']
98
+					 . '","h":"' . $icon_size['h'] . '"}';
99
+
100
+		/**
101
+		 * Filter the json data when creating output for post json marker..
102
+		 *
103
+		 * @since 1.5.7
104
+		 * @param string $post_json JSON representation of the post marker info.
105
+		 * @param object $post The post object.
106
+		 */
107
+		$post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
108
+
109
+		// only assign it if it has a value
110
+		if($post_map_json){
111
+			$map_jason[$post->ID] = $post_map_json;
112
+		}
113
+
114
+	}
115 115
 }
116 116
 
117 117
 /**
@@ -124,67 +124,67 @@  discard block
 block discarded – undo
124 124
  */
125 125
 function send_marker_jason_to_js()
126 126
 {
127
-    global $map_jason, $map_canvas_arr;
128
-
129
-    if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
130
-        foreach ($map_canvas_arr as $canvas => $jason) {
131
-            if (is_array($map_jason) && !empty($map_jason)) {
132
-
133
-                // on details page only show the main marker on the map
134
-                if(geodir_is_page('detail')){
135
-                    global $post;
136
-                    if(isset($map_jason[$post->ID])){
137
-                        $map_jason = array($map_jason[$post->ID]);
138
-                    }
139
-                }
140
-                $canvas_jason = $canvas . "_jason";
141
-                $map_canvas_arr[$canvas] = array_unique($map_jason);
142
-                unset($cat_content_info);
143
-                $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
144
-                $totalcount = count(array_unique($map_jason));
145
-                if (!empty($cat_content_info)) {
146
-                    $json_content = substr(implode(',', $cat_content_info), 1);
147
-                    $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
148
-                    $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
149
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
150
-                } else {
151
-                    $canvas_jason = '[{"totalcount":"0"}]';
152
-                }
153
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
154
-
155
-                /**
156
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
157
-                 *
158
-                 * You can use this filter to modify map canvas json args.
159
-                 *
160
-                 * @since 1.0.0
161
-                 * @package GeoDirectory
162
-                 * @param string $canvas Map canvas array key.
163
-                 * @param array $map_canvas_jason_args Map canvas args.
164
-                 */
165
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
166
-
167
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
168
-            } else {
169
-                $canvas_jason = '[{"totalcount":"0"}]';
170
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
171
-
172
-                /**
173
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
174
-                 *
175
-                 * You can use this filter to modify map canvas json args.
176
-                 *
177
-                 * @since 1.0.0
178
-                 * @package GeoDirectory
179
-                 * @param string $canvas Map canvas array key.
180
-                 * @param array $map_canvas_jason_args Map canvas args.
181
-                 */
182
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
183
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
184
-            }
185
-        }
186
-
187
-    }
127
+	global $map_jason, $map_canvas_arr;
128
+
129
+	if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
130
+		foreach ($map_canvas_arr as $canvas => $jason) {
131
+			if (is_array($map_jason) && !empty($map_jason)) {
132
+
133
+				// on details page only show the main marker on the map
134
+				if(geodir_is_page('detail')){
135
+					global $post;
136
+					if(isset($map_jason[$post->ID])){
137
+						$map_jason = array($map_jason[$post->ID]);
138
+					}
139
+				}
140
+				$canvas_jason = $canvas . "_jason";
141
+				$map_canvas_arr[$canvas] = array_unique($map_jason);
142
+				unset($cat_content_info);
143
+				$cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
144
+				$totalcount = count(array_unique($map_jason));
145
+				if (!empty($cat_content_info)) {
146
+					$json_content = substr(implode(',', $cat_content_info), 1);
147
+					$json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
148
+					$json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
149
+					$canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
150
+				} else {
151
+					$canvas_jason = '[{"totalcount":"0"}]';
152
+				}
153
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
154
+
155
+				/**
156
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
157
+				 *
158
+				 * You can use this filter to modify map canvas json args.
159
+				 *
160
+				 * @since 1.0.0
161
+				 * @package GeoDirectory
162
+				 * @param string $canvas Map canvas array key.
163
+				 * @param array $map_canvas_jason_args Map canvas args.
164
+				 */
165
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
166
+
167
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
168
+			} else {
169
+				$canvas_jason = '[{"totalcount":"0"}]';
170
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
171
+
172
+				/**
173
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
174
+				 *
175
+				 * You can use this filter to modify map canvas json args.
176
+				 *
177
+				 * @since 1.0.0
178
+				 * @package GeoDirectory
179
+				 * @param string $canvas Map canvas array key.
180
+				 * @param array $map_canvas_jason_args Map canvas args.
181
+				 */
182
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
183
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
184
+			}
185
+		}
186
+
187
+	}
188 188
 }
189 189
 
190 190
 /**
@@ -207,99 +207,99 @@  discard block
 block discarded – undo
207 207
  */
208 208
 function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false)
209 209
 {
210
-    global $cat_count, $geodir_cat_icons, $gd_session;
210
+	global $cat_count, $geodir_cat_icons, $gd_session;
211 211
 
212
-    $exclude_categories = get_option('geodir_exclude_cat_on_map');
213
-    $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
212
+	$exclude_categories = get_option('geodir_exclude_cat_on_map');
213
+	$exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
214 214
 
215
-    // check if exclude categories saved before fix of categories identical names
216
-    if ($exclude_categories_new) {
217
-        $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
218
-        $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
219
-    }
215
+	// check if exclude categories saved before fix of categories identical names
216
+	if ($exclude_categories_new) {
217
+		$gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
218
+		$exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
219
+	}
220 220
 
221
-    $exclude_cat_str = implode(',', $exclude_categories);
221
+	$exclude_cat_str = implode(',', $exclude_categories);
222 222
 
223
-    if ($exclude_cat_str == '') {
224
-        $exclude_cat_str = '0';
225
-    }
223
+	if ($exclude_cat_str == '') {
224
+		$exclude_cat_str = '0';
225
+	}
226 226
 
227
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
227
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
228 228
 
229
-    if ($hide_empty) {
230
-        $cat_terms = geodir_filter_empty_terms($cat_terms);
231
-    }
229
+	if ($hide_empty) {
230
+		$cat_terms = geodir_filter_empty_terms($cat_terms);
231
+	}
232 232
 
233
-    $main_list_class = '';
234
-    //If there are terms, start displaying
235
-    if (count($cat_terms) > 0) {
236
-        //Displaying as a list
237
-        $p = $pading * 15;
238
-        $pading++;
233
+	$main_list_class = '';
234
+	//If there are terms, start displaying
235
+	if (count($cat_terms) > 0) {
236
+		//Displaying as a list
237
+		$p = $pading * 15;
238
+		$pading++;
239 239
 
240
-        if ($cat_parent == 0) {
241
-            $list_class = 'main_list';
242
-            $display = '';
243
-        } else {
244
-            $list_class = 'sub_list';
245
-            $display = !$child_collapse ? '' : 'display:none';
246
-        }
240
+		if ($cat_parent == 0) {
241
+			$list_class = 'main_list';
242
+			$display = '';
243
+		} else {
244
+			$list_class = 'sub_list';
245
+			$display = !$child_collapse ? '' : 'display:none';
246
+		}
247 247
 
248
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
248
+		$out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
249 249
 
250
-        $geodir_cat_icons = geodir_get_term_icon();
250
+		$geodir_cat_icons = geodir_get_term_icon();
251 251
 
252
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
253
-        if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
254
-            $geodir_default_map_search_pt = $homemap_catlist_ptype;
255
-        }
256
-        $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt);
252
+		$geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
253
+		if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
254
+			$geodir_default_map_search_pt = $homemap_catlist_ptype;
255
+		}
256
+		$post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt);
257 257
         
258
-        foreach ($cat_terms as $cat_term):
259
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
260
-
261
-            if (!in_array($cat_term->term_id, $exclude_categories)):
262
-                //Secret sauce.  Function calls itself to display child elements, if any
263
-                $checked = 'checked="checked"';
264
-
265
-                // Untick the category by default on home map
266
-                if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
267
-                    if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
268
-                        global $sitepress;
269
-                        $default_lang = $sitepress->get_default_language();
270
-                        $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
271
-                    }else{
272
-                        $term_id = $cat_term->term_id;
273
-                    }
274
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
275
-                        $checked = '';
276
-                    }
277
-                }
278
-
279
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
280
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
281
-                $term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
282
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
283
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
284
-
285
-            endif;
286
-
287
-
288
-            // get sub category by recursion
289
-            $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
290
-
291
-            $out .= '</li>';
292
-
293
-        endforeach;
294
-
295
-        $out .= '</ul>';
296
-
297
-        return $out;
298
-    } else {
299
-        if ($cat_parent == 0)
300
-            return _e('No category', 'geodirectory');
301
-    }
302
-    return;
258
+		foreach ($cat_terms as $cat_term):
259
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
260
+
261
+			if (!in_array($cat_term->term_id, $exclude_categories)):
262
+				//Secret sauce.  Function calls itself to display child elements, if any
263
+				$checked = 'checked="checked"';
264
+
265
+				// Untick the category by default on home map
266
+				if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
267
+					if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
268
+						global $sitepress;
269
+						$default_lang = $sitepress->get_default_language();
270
+						$term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
271
+					}else{
272
+						$term_id = $cat_term->term_id;
273
+					}
274
+					if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
275
+						$checked = '';
276
+					}
277
+				}
278
+
279
+				$term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
280
+				$term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
281
+				$term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
282
+				$term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
283
+				$out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
284
+
285
+			endif;
286
+
287
+
288
+			// get sub category by recursion
289
+			$out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
290
+
291
+			$out .= '</li>';
292
+
293
+		endforeach;
294
+
295
+		$out .= '</ul>';
296
+
297
+		return $out;
298
+	} else {
299
+		if ($cat_parent == 0)
300
+			return _e('No category', 'geodirectory');
301
+	}
302
+	return;
303 303
 }
304 304
 
305 305
 /**
@@ -311,19 +311,19 @@  discard block
 block discarded – undo
311 311
  * @return string The map API provider name.
312 312
  */
313 313
 function geodir_map_name() {
314
-    $geodir_map_name = get_option('geodir_load_map', 'google');
314
+	$geodir_map_name = get_option('geodir_load_map', 'google');
315 315
     
316
-    if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
317
-        $geodir_map_name = 'auto';
318
-    }
319
-
320
-    /**
321
-     * Filter the map JS API provider name.
322
-     *
323
-     * @since 1.6.1
324
-     * @param string $geodir_map_name The map API provider name.
325
-     */
326
-    return apply_filters('geodir_map_name', $geodir_map_name);
316
+	if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
317
+		$geodir_map_name = 'auto';
318
+	}
319
+
320
+	/**
321
+	 * Filter the map JS API provider name.
322
+	 *
323
+	 * @since 1.6.1
324
+	 * @param string $geodir_map_name The map API provider name.
325
+	 */
326
+	return apply_filters('geodir_map_name', $geodir_map_name);
327 327
 }
328 328
 
329 329
 /**
@@ -339,48 +339,48 @@  discard block
 block discarded – undo
339 339
  * @return array The icon size.
340 340
  */
341 341
 function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
342
-    global $gd_marker_sizes;
342
+	global $gd_marker_sizes;
343 343
     
344
-    if (empty($gd_marker_sizes)) {
345
-        $gd_marker_sizes = array();
346
-    }
344
+	if (empty($gd_marker_sizes)) {
345
+		$gd_marker_sizes = array();
346
+	}
347 347
       
348
-    if (!empty($gd_marker_sizes[$icon])) {
349
-        return $gd_marker_sizes[$icon];
350
-    }
348
+	if (!empty($gd_marker_sizes[$icon])) {
349
+		return $gd_marker_sizes[$icon];
350
+	}
351 351
     
352
-    if (empty($icon)) {
353
-        $gd_marker_sizes[$icon] = $default_size;
352
+	if (empty($icon)) {
353
+		$gd_marker_sizes[$icon] = $default_size;
354 354
         
355
-        return $default_size;
356
-    }
355
+		return $default_size;
356
+	}
357 357
     
358
-    $icon_url = $icon;
358
+	$icon_url = $icon;
359 359
     
360
-    $uploads = wp_upload_dir(); // Array of key => value pairs
360
+	$uploads = wp_upload_dir(); // Array of key => value pairs
361 361
       
362
-    if (!path_is_absolute($icon)) {
363
-        $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
364
-    }
362
+	if (!path_is_absolute($icon)) {
363
+		$icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
364
+	}
365 365
     
366
-    if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
367
-        $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
368
-    }
366
+	if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
367
+		$icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
368
+	}
369 369
     
370
-    $sizes = array();
371
-    if (is_file($icon) && file_exists($icon)) {
372
-        $size = getimagesize(trim($icon));
370
+	$sizes = array();
371
+	if (is_file($icon) && file_exists($icon)) {
372
+		$size = getimagesize(trim($icon));
373 373
         
374
-        if (!empty($size[0]) && !empty($size[1])) {
375
-            $sizes = array('w' => $size[0], 'h' => $size[1]);
376
-        }
377
-    }
374
+		if (!empty($size[0]) && !empty($size[1])) {
375
+			$sizes = array('w' => $size[0], 'h' => $size[1]);
376
+		}
377
+	}
378 378
     
379
-    $sizes = !empty($sizes) ? $sizes : $default_size;
379
+	$sizes = !empty($sizes) ? $sizes : $default_size;
380 380
     
381
-    $gd_marker_sizes[$icon_url] = $sizes;
381
+	$gd_marker_sizes[$icon_url] = $sizes;
382 382
     
383
-    return $sizes;
383
+	return $sizes;
384 384
 }
385 385
 
386 386
 add_action('wp_footer', 'geodir_map_load_script', 10);
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
  * @package GeoDirectory
393 393
  */
394 394
 function geodir_map_load_script() {
395
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'google-maps-api', 'done')) {
396
-        $plugin_url = geodir_plugin_url();
395
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'google-maps-api', 'done')) {
396
+		$plugin_url = geodir_plugin_url();
397 397
 ?>
398 398
 <script type="text/javascript">
399 399
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -408,5 +408,5 @@  discard block
 block discarded – undo
408 408
 }
409 409
 </script>
410 410
 <?php
411
-    }
411
+	}
412 412
 }
413 413
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
     if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array)) {
56 56
 
57
-        if(isset($map_jason[$post->ID])){return null;}
57
+        if (isset($map_jason[$post->ID])) {return null; }
58 58
 
59 59
         $srcharr = array("'", "/", "-", '"', '\\');
60 60
         $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
61 61
 
62
-        $default_category = isset($post->default_category) ? $post->default_category : geodir_get_post_meta($post->ID,'default_category');
62
+        $default_category = isset($post->default_category) ? $post->default_category : geodir_get_post_meta($post->ID, 'default_category');
63 63
 
64 64
         $geodir_cat_icons = geodir_get_term_icon();
65 65
         $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_category]) ? $geodir_cat_icons[$default_category] : '';
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $title = str_replace($srcharr, $replarr, $post_title);
69 69
 
70 70
         if (is_ssl()) {
71
-            $icon = str_replace("http:","https:",$icon );
71
+            $icon = str_replace("http:", "https:", $icon);
72 72
         }
73 73
         
74 74
         if ($icon != '') {
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
             $icon_size = array('w' => 36, 'h' => 45);
85 85
         }
86 86
 
87
-        $post_latitude = isset($post->post_latitude) ? $post->post_latitude : geodir_get_post_meta($post->ID,'post_latitude');
88
-        $post_longitude = isset($post->post_longitude) ? $post->post_longitude : geodir_get_post_meta($post->ID,'post_longitude');
87
+        $post_latitude = isset($post->post_latitude) ? $post->post_latitude : geodir_get_post_meta($post->ID, 'post_latitude');
88
+        $post_longitude = isset($post->post_longitude) ? $post->post_longitude : geodir_get_post_meta($post->ID, 'post_longitude');
89 89
 
90 90
 
91
-        $post_json = '{"id":"' . $post->ID
92
-                     . '","t": "' . $title
93
-                     . '","lt": "' . $post_latitude
94
-                     . '","ln": "' . $post_longitude
95
-                     . '","mk_id":"' . $post->ID . '_' . $default_category
96
-                     . '","i":"' . $icon
97
-                     . '","w":"' . $icon_size['w']
98
-                     . '","h":"' . $icon_size['h'] . '"}';
91
+        $post_json = '{"id":"'.$post->ID
92
+                     . '","t": "'.$title
93
+                     . '","lt": "'.$post_latitude
94
+                     . '","ln": "'.$post_longitude
95
+                     . '","mk_id":"'.$post->ID.'_'.$default_category
96
+                     . '","i":"'.$icon
97
+                     . '","w":"'.$icon_size['w']
98
+                     . '","h":"'.$icon_size['h'].'"}';
99 99
 
100 100
         /**
101 101
          * Filter the json data when creating output for post json marker..
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
          * @param string $post_json JSON representation of the post marker info.
105 105
          * @param object $post The post object.
106 106
          */
107
-        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
107
+        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
108 108
 
109 109
         // only assign it if it has a value
110
-        if($post_map_json){
110
+        if ($post_map_json) {
111 111
             $map_jason[$post->ID] = $post_map_json;
112 112
         }
113 113
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
             if (is_array($map_jason) && !empty($map_jason)) {
132 132
 
133 133
                 // on details page only show the main marker on the map
134
-                if(geodir_is_page('detail')){
134
+                if (geodir_is_page('detail')) {
135 135
                     global $post;
136
-                    if(isset($map_jason[$post->ID])){
136
+                    if (isset($map_jason[$post->ID])) {
137 137
                         $map_jason = array($map_jason[$post->ID]);
138 138
                     }
139 139
                 }
140
-                $canvas_jason = $canvas . "_jason";
140
+                $canvas_jason = $canvas."_jason";
141 141
                 $map_canvas_arr[$canvas] = array_unique($map_jason);
142 142
                 unset($cat_content_info);
143 143
                 $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
                     $json_content = substr(implode(',', $cat_content_info), 1);
147 147
                     $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
148 148
                     $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
149
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
149
+                    $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
150 150
                 } else {
151 151
                     $canvas_jason = '[{"totalcount":"0"}]';
152 152
                 }
153
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
153
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
154 154
 
155 155
                 /**
156 156
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
                  * @param string $canvas Map canvas array key.
163 163
                  * @param array $map_canvas_jason_args Map canvas args.
164 164
                  */
165
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
165
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
166 166
 
167
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
167
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
168 168
             } else {
169 169
                 $canvas_jason = '[{"totalcount":"0"}]';
170
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
170
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
171 171
 
172 172
                 /**
173 173
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
                  * @param string $canvas Map canvas array key.
180 180
                  * @param array $map_canvas_jason_args Map canvas args.
181 181
                  */
182
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
183
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
182
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
183
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
184 184
             }
185 185
         }
186 186
 
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
             $display = !$child_collapse ? '' : 'display:none';
246 246
         }
247 247
 
248
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
248
+        $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">';
249 249
 
250 250
         $geodir_cat_icons = geodir_get_term_icon();
251 251
 
252
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
252
+        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
253 253
         if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
254 254
             $geodir_default_map_search_pt = $homemap_catlist_ptype;
255 255
         }
@@ -264,23 +264,23 @@  discard block
 block discarded – undo
264 264
 
265 265
                 // Untick the category by default on home map
266 266
                 if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
267
-                    if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
267
+                    if (geodir_wpml_is_taxonomy_translated($post_type.'category')) { // if WPML
268 268
                         global $sitepress;
269 269
                         $default_lang = $sitepress->get_default_language();
270 270
                         $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
271
-                    }else{
271
+                    } else {
272 272
                         $term_id = $cat_term->term_id;
273 273
                     }
274
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
274
+                    if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$term_id, $geodir_home_map_untick)) {
275 275
                         $checked = '';
276 276
                     }
277 277
                 }
278 278
 
279
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
280
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
281
-                $term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
282
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
283
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
279
+                $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"';
280
+                $term_check .= ' name="'.$map_canvas_name.'_cat[]" ';
281
+                $term_check .= '  title="'.esc_attr(geodir_utf8_ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">';
282
+                $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.geodir_utf8_ucfirst($cat_term->name).'"/>';
283
+                $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.geodir_utf8_ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>';
284 284
 
285 285
             endif;
286 286
 
@@ -392,19 +392,19 @@  discard block
 block discarded – undo
392 392
  * @package GeoDirectory
393 393
  */
394 394
 function geodir_map_load_script() {
395
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'google-maps-api', 'done')) {
395
+    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('google-maps-api', 'done')) {
396 396
         $plugin_url = geodir_plugin_url();
397 397
 ?>
398 398
 <script type="text/javascript">
399 399
 if (!(window.google && typeof google.maps !== 'undefined')) {
400
-    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
400
+    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
401 401
     document.getElementsByTagName("head")[0].appendChild(css);
402
-    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
402
+    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
403 403
     document.getElementsByTagName("head")[0].appendChild(css);
404
-    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
405
-    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/osm.geocode.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
406
-    document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
407
-    document.write('<' + 'script id="geodirectory-o-overlappingmarker-script" src="<?php echo $plugin_url;?>/geodirectory-assets/jawj/oms-leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
404
+    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
405
+    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/osm.geocode.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
406
+    document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
407
+    document.write('<' + 'script id="geodirectory-o-overlappingmarker-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/jawj/oms-leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
408 408
 }
409 409
 </script>
410 410
 <?php
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
  * @global object $wpdb WordPress Database object.
2179 2179
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2180 2180
  * @param int $attachment_id Attachment ID.
2181
- * @return bool|void Returns false on failure.
2181
+ * @return false|null Returns false on failure.
2182 2182
  */
2183 2183
 function geodirectory_before_featured_image_delete($attachment_id)
2184 2184
 {
@@ -2685,7 +2685,7 @@  discard block
 block discarded – undo
2685 2685
  * @since 1.6.16
2686 2686
  * @package GeoDirectory
2687 2687
  * @param array $classes The class array of the HTML element.
2688
- * @return array Modified class array.
2688
+ * @return string[] Modified class array.
2689 2689
  */
2690 2690
 function geodir_body_class_active_map($classes = array()) {
2691 2691
     $classes[] = 'gd-map-' . geodir_map_name();
Please login to merge, or discard this patch.
Braces   +89 added lines, -72 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 add_filter('query_vars', 'geodir_add_location_var');
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89
-if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
89
+if (get_option('permalink_structure') != '') {
90
+    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91
+}
91 92
 
92 93
 add_filter('parse_query', 'geodir_modified_query');
93 94
 
@@ -431,8 +432,9 @@  discard block
 block discarded – undo
431 432
      */
432 433
     do_action('geodir_after_social_sharing_buttons');
433 434
     $content_html = ob_get_clean();
434
-    if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
435
+    if (trim($content_html) != '') {
436
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
437
+    }
436 438
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437 439
         /**
438 440
          * Filter the geodir_social_sharing_buttons() function content.
@@ -488,8 +490,9 @@  discard block
 block discarded – undo
488 490
      */
489 491
     do_action('geodir_after_edit_post_link');
490 492
     $content_html = ob_get_clean();
491
-    if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
+    if (trim($content_html) != '') {
494
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
495
+    }
493 496
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
494 497
         /**
495 498
          * Filter the geodir_edit_post_link() function content.
@@ -1063,8 +1066,9 @@  discard block
 block discarded – undo
1063 1066
      */
1064 1067
     do_action('geodir_after_google_analytics');
1065 1068
     $content_html = ob_get_clean();
1066
-    if (trim($content_html) != '')
1067
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1069
+    if (trim($content_html) != '') {
1070
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
+    }
1068 1072
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1069 1073
         /**
1070 1074
          * Filter the geodir_edit_post_link() function content.
@@ -1206,8 +1210,9 @@  discard block
 block discarded – undo
1206 1210
     do_action('geodir_after_detail_page_more_info');
1207 1211
 
1208 1212
     $content_html = ob_get_clean();
1209
-    if (trim($content_html) != '')
1210
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1213
+    if (trim($content_html) != '') {
1214
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1215
+    }
1211 1216
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1212 1217
         /**
1213 1218
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1334,8 +1339,9 @@  discard block
 block discarded – undo
1334 1339
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1335 1340
 
1336 1341
     foreach ($arr_alert_msg as $key => $value) {
1337
-        if (!is_scalar($value))
1338
-            continue;
1342
+        if (!is_scalar($value)) {
1343
+                    continue;
1344
+        }
1339 1345
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1340 1346
     }
1341 1347
 
@@ -1391,17 +1397,19 @@  discard block
 block discarded – undo
1391 1397
     global $geodir_sidebars;
1392 1398
     global $sidebars_widgets;
1393 1399
 
1394
-    if (!is_array($sidebars_widgets))
1395
-        $sidebars_widgets = wp_get_sidebars_widgets();
1400
+    if (!is_array($sidebars_widgets)) {
1401
+            $sidebars_widgets = wp_get_sidebars_widgets();
1402
+    }
1396 1403
     $geodir_old_sidebars = array();
1397 1404
 
1398 1405
     if (is_array($geodir_sidebars)) {
1399 1406
         foreach ($geodir_sidebars as $val) {
1400 1407
             if (is_array($sidebars_widgets)) {
1401
-                if (array_key_exists($val, $sidebars_widgets))
1402
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1403
-                else
1404
-                    $geodir_old_sidebars[$val] = array();
1408
+                if (array_key_exists($val, $sidebars_widgets)) {
1409
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1410
+                } else {
1411
+                                    $geodir_old_sidebars[$val] = array();
1412
+                }
1405 1413
             }
1406 1414
         }
1407 1415
     }
@@ -1422,16 +1430,19 @@  discard block
 block discarded – undo
1422 1430
 {
1423 1431
     global $sidebars_widgets;
1424 1432
 
1425
-    if (!is_array($sidebars_widgets))
1426
-        $sidebars_widgets = wp_get_sidebars_widgets();
1433
+    if (!is_array($sidebars_widgets)) {
1434
+            $sidebars_widgets = wp_get_sidebars_widgets();
1435
+    }
1427 1436
 
1428 1437
     if (is_array($sidebars_widgets)) {
1429 1438
         $geodir_old_sidebars = get_option('geodir_sidebars');
1430 1439
         if (is_array($geodir_old_sidebars)) {
1431 1440
             foreach ($geodir_old_sidebars as $key => $val) {
1432
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1441
+                if(0 === strpos($key, 'geodir_')) {
1442
+                	// if gd widget
1433 1443
                 {
1434
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1444
+                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1445
+                }
1435 1446
                 }
1436 1447
 
1437 1448
 
@@ -1567,20 +1578,25 @@  discard block
 block discarded – undo
1567 1578
         }
1568 1579
     }
1569 1580
     
1570
-    if ($tab == 'post_info')
1571
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1581
+    if ($tab == 'post_info') {
1582
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1583
+    }
1572 1584
     
1573
-    if ($tab == 'post_images')
1574
-        $is_display = (!empty($post_images)) ? true : false;
1585
+    if ($tab == 'post_images') {
1586
+            $is_display = (!empty($post_images)) ? true : false;
1587
+    }
1575 1588
 
1576
-    if ($tab == 'post_video')
1577
-        $is_display = (!empty($video)) ? true : false;
1589
+    if ($tab == 'post_video') {
1590
+            $is_display = (!empty($video)) ? true : false;
1591
+    }
1578 1592
 
1579
-    if ($tab == 'special_offers')
1580
-        $is_display = (!empty($special_offers)) ? true : false;
1593
+    if ($tab == 'special_offers') {
1594
+            $is_display = (!empty($special_offers)) ? true : false;
1595
+    }
1581 1596
 
1582
-    if ($tab == 'reviews')
1583
-        $is_display = (geodir_is_page('detail')) ? true : false;
1597
+    if ($tab == 'reviews') {
1598
+            $is_display = (geodir_is_page('detail')) ? true : false;
1599
+    }
1584 1600
 
1585 1601
     if ($tab == 'related_listing') {
1586 1602
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1814,11 +1830,13 @@  discard block
 block discarded – undo
1814 1830
     $region_slug = $default_location->region_slug;
1815 1831
     $city_slug = $default_location->city_slug;
1816 1832
 
1817
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1818
-        return $slug_exists = true;
1833
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1834
+            return $slug_exists = true;
1835
+    }
1819 1836
 
1820
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1821
-        return $slug_exists = true;
1837
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1838
+            return $slug_exists = true;
1839
+    }
1822 1840
 
1823 1841
     return $slug_exists;
1824 1842
 }
@@ -1861,40 +1879,31 @@  discard block
 block discarded – undo
1861 1879
     if(geodir_is_page('home')){
1862 1880
         $gd_page = 'home';
1863 1881
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1864
-    }
1865
-    elseif(geodir_is_page('detail')){
1882
+    } elseif(geodir_is_page('detail')){
1866 1883
         $gd_page = 'detail';
1867 1884
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1868
-    }
1869
-    elseif(geodir_is_page('pt')){
1885
+    } elseif(geodir_is_page('pt')){
1870 1886
         $gd_page = 'pt';
1871 1887
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('listing')){
1888
+    } elseif(geodir_is_page('listing')){
1874 1889
         $gd_page = 'listing';
1875 1890
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1876
-    }
1877
-    elseif(geodir_is_page('location')){
1891
+    } elseif(geodir_is_page('location')){
1878 1892
         $gd_page = 'location';
1879 1893
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1880
-    }
1881
-    elseif(geodir_is_page('search')){
1894
+    } elseif(geodir_is_page('search')){
1882 1895
         $gd_page = 'search';
1883 1896
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1884
-    }
1885
-    elseif(geodir_is_page('add-listing')){
1897
+    } elseif(geodir_is_page('add-listing')){
1886 1898
         $gd_page = 'add-listing';
1887 1899
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1888
-    }
1889
-    elseif(geodir_is_page('author')){
1900
+    } elseif(geodir_is_page('author')){
1890 1901
         $gd_page = 'author';
1891 1902
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1892
-    }
1893
-    elseif(geodir_is_page('login')){
1903
+    } elseif(geodir_is_page('login')){
1894 1904
         $gd_page = 'login';
1895 1905
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1896
-    }
1897
-    elseif(geodir_is_page('listing-success')){
1906
+    } elseif(geodir_is_page('listing-success')){
1898 1907
         $gd_page = 'listing-success';
1899 1908
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1900 1909
     }
@@ -1972,11 +1981,13 @@  discard block
 block discarded – undo
1972 1981
 
1973 1982
     if (!get_option('geodir_remove_url_seperator')) {
1974 1983
 
1975
-        if (get_option('geodir_listingurl_separator'))
1976
-            delete_option('geodir_listingurl_separator');
1984
+        if (get_option('geodir_listingurl_separator')) {
1985
+                    delete_option('geodir_listingurl_separator');
1986
+        }
1977 1987
 
1978
-        if (get_option('geodir_detailurl_separator'))
1979
-            delete_option('geodir_detailurl_separator');
1988
+        if (get_option('geodir_detailurl_separator')) {
1989
+                    delete_option('geodir_detailurl_separator');
1990
+        }
1980 1991
 
1981 1992
         flush_rewrite_rules(false);
1982 1993
 
@@ -2000,8 +2011,9 @@  discard block
 block discarded – undo
2000 2011
 {
2001 2012
     foreach ($permalink_arr as $key => $value) {
2002 2013
 
2003
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2004
-            unset($permalink_arr[$key]);
2014
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2015
+                    unset($permalink_arr[$key]);
2016
+        }
2005 2017
 
2006 2018
     }
2007 2019
 
@@ -2136,16 +2148,18 @@  discard block
 block discarded – undo
2136 2148
 
2137 2149
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2138 2150
 
2139
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2140
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2151
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2152
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2153
+            }
2141 2154
         }
2142 2155
 
2143 2156
         if (array_key_exists('special_offers', $tabs_arr)) {
2144 2157
 
2145 2158
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2146 2159
 
2147
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2148
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2160
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2161
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2162
+            }
2149 2163
         }
2150 2164
 
2151 2165
     }
@@ -2200,8 +2214,9 @@  discard block
 block discarded – undo
2200 2214
 
2201 2215
         $all_postypes = geodir_get_posttypes();
2202 2216
 
2203
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2204
-            return false;
2217
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2218
+                    return false;
2219
+        }
2205 2220
 
2206 2221
         $uploads = wp_upload_dir();
2207 2222
 
@@ -2275,8 +2290,9 @@  discard block
 block discarded – undo
2275 2290
                         $file_info = pathinfo($attach->file);
2276 2291
 
2277 2292
                         $sub_dir = '';
2278
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2279
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2293
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2294
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2295
+                        }
2280 2296
 
2281 2297
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2282 2298
                         $uploads_path = $uploads['basedir'];
@@ -2297,8 +2313,9 @@  discard block
 block discarded – undo
2297 2313
 
2298 2314
                     if (!empty($attachment_data)) {
2299 2315
 
2300
-                        if ($attachment_data->ID)
2301
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2316
+                        if ($attachment_data->ID) {
2317
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2318
+                        }
2302 2319
 
2303 2320
                     } else {
2304 2321
 
@@ -2489,7 +2506,7 @@  discard block
 block discarded – undo
2489 2506
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2490 2507
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2491 2508
 
2492
-                    }else{
2509
+                    } else{
2493 2510
                         $i = 0;
2494 2511
                         $fieldset_count++;
2495 2512
                         $field_set_start = 1;
@@ -2618,7 +2635,7 @@  discard block
 block discarded – undo
2618 2635
             $status_icon = '<i class="fa fa-play"></i>';
2619 2636
             if ($real_status == 'publish') {
2620 2637
                 $status .= __('Published', 'geodirectory');
2621
-            }elseif ($real_status == 'pending') {
2638
+            } elseif ($real_status == 'pending') {
2622 2639
                 $status .= __('Awaiting Review', 'geodirectory');
2623 2640
             } else {
2624 2641
                 $status .= __('Not published', 'geodirectory');
Please login to merge, or discard this patch.
Indentation   +1212 added lines, -1212 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
-    if ($geodir_theme_location) {
228
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
229
-    } else {
230
-        update_option('geodir_theme_location_nav', '');
231
-    }
226
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
+	if ($geodir_theme_location) {
228
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
229
+	} else {
230
+		update_option('geodir_theme_location_nav', '');
231
+	}
232 232
 }
233 233
 
234 234
 /// add action for theme switch to blank previous theme navigation location setting
@@ -249,42 +249,42 @@  discard block
 block discarded – undo
249 249
  */
250 250
 function geodir_add_post_filters()
251 251
 {
252
-    /**
253
-     * Contains all function for filtering listing.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     */
258
-    include_once('geodirectory-functions/listing_filters.php');
252
+	/**
253
+	 * Contains all function for filtering listing.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 */
258
+	include_once('geodirectory-functions/listing_filters.php');
259 259
     
260
-    // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
-    }
260
+	// Theme My Login compatibility fix
261
+	if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
+		remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
+	}
264 264
     
265
-    if ( isset( $_REQUEST['geodir_search'] ) ) {
266
-        add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
-        add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
268
-    }
265
+	if ( isset( $_REQUEST['geodir_search'] ) ) {
266
+		add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
+		add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
268
+	}
269 269
 }
270 270
 
271 271
 
272 272
 if (!function_exists('geodir_init_defaults')) {
273
-    /**
274
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
275
-     *
276
-     * @since 1.0.0
277
-     * @package GeoDirectory
278
-     */
279
-    function geodir_init_defaults()
280
-    {
281
-        if (function_exists('geodir_register_defaults')) {
273
+	/**
274
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
275
+	 *
276
+	 * @since 1.0.0
277
+	 * @package GeoDirectory
278
+	 */
279
+	function geodir_init_defaults()
280
+	{
281
+		if (function_exists('geodir_register_defaults')) {
282 282
 
283
-            geodir_register_defaults();
283
+			geodir_register_defaults();
284 284
 
285
-        }
285
+		}
286 286
 
287
-    }
287
+	}
288 288
 }
289 289
 
290 290
 
@@ -306,26 +306,26 @@  discard block
 block discarded – undo
306 306
 // CALLED ON 'sidebars_widgets' FILTER
307 307
 
308 308
 if (!function_exists('geodir_restrict_widget')) {
309
-    /**
310
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
311
-     *
312
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
313
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
314
-     * @since 1.0.0
315
-     * @package GeoDirectory
316
-     */
317
-    function geodir_restrict_widget()
318
-    {
319
-        global $is_listing, $is_single_place;
309
+	/**
310
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
311
+	 *
312
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
313
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
314
+	 * @since 1.0.0
315
+	 * @package GeoDirectory
316
+	 */
317
+	function geodir_restrict_widget()
318
+	{
319
+		global $is_listing, $is_single_place;
320 320
 
321
-        // set is listing	
322
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
321
+		// set is listing	
322
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
323 323
 
324
-        // set is single place
325
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
324
+		// set is single place
325
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
326 326
 
327 327
 
328
-    }
328
+	}
329 329
 }
330 330
 
331 331
 
@@ -346,31 +346,31 @@  discard block
 block discarded – undo
346 346
  */
347 347
 function geodir_detail_page_sidebar_content_sorting()
348 348
 {
349
-    $arr_detail_page_sidebar_content =
350
-        /**
351
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
352
-         *
353
-         * This filter can be used to remove sections of the details page sidebar,
354
-         * add new sections or rearrange the order of the sections.
355
-         *
356
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
357
-         * @since 1.0.0
358
-         */
359
-        apply_filters('geodir_detail_page_sidebar_content',
360
-            array('geodir_social_sharing_buttons',
361
-                'geodir_detail_page_google_analytics',
362
-                'geodir_edit_post_link',
363
-                'geodir_detail_page_review_rating',
364
-                'geodir_detail_page_more_info'
365
-            ) // end of array 
366
-        ); // end of apply filter
367
-    if (!empty($arr_detail_page_sidebar_content)) {
368
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
369
-            if (function_exists($content_function)) {
370
-                add_action('geodir_detail_page_sidebar', $content_function);
371
-            }
372
-        }
373
-    }
349
+	$arr_detail_page_sidebar_content =
350
+		/**
351
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
352
+		 *
353
+		 * This filter can be used to remove sections of the details page sidebar,
354
+		 * add new sections or rearrange the order of the sections.
355
+		 *
356
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
357
+		 * @since 1.0.0
358
+		 */
359
+		apply_filters('geodir_detail_page_sidebar_content',
360
+			array('geodir_social_sharing_buttons',
361
+				'geodir_detail_page_google_analytics',
362
+				'geodir_edit_post_link',
363
+				'geodir_detail_page_review_rating',
364
+				'geodir_detail_page_more_info'
365
+			) // end of array 
366
+		); // end of apply filter
367
+	if (!empty($arr_detail_page_sidebar_content)) {
368
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
369
+			if (function_exists($content_function)) {
370
+				add_action('geodir_detail_page_sidebar', $content_function);
371
+			}
372
+		}
373
+	}
374 374
 }
375 375
 
376 376
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_add_to_favourite_link()
387 387
 {
388
-    global $post, $preview;
389
-    if (!$preview && geodir_is_page('detail')) {
390
-        ?>
388
+	global $post, $preview;
389
+	if (!$preview && geodir_is_page('detail')) {
390
+		?>
391 391
         <p class="edit_link">
392 392
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
393 393
         </p>
394 394
     <?php
395
-    }
395
+	}
396 396
 }
397 397
 
398 398
 /**
@@ -406,41 +406,41 @@  discard block
 block discarded – undo
406 406
  */
407 407
 function geodir_social_sharing_buttons()
408 408
 {
409
-    global $preview;
410
-    ob_start(); // Start  buffering;
411
-    /**
412
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
413
-     *
414
-     * @since 1.0.0
415
-     */
416
-    do_action('geodir_before_social_sharing_buttons');
417
-    if (!$preview) {
418
-        ?>
409
+	global $preview;
410
+	ob_start(); // Start  buffering;
411
+	/**
412
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
413
+	 *
414
+	 * @since 1.0.0
415
+	 */
416
+	do_action('geodir_before_social_sharing_buttons');
417
+	if (!$preview) {
418
+		?>
419 419
         <div class="likethis">
420 420
             <?php geodir_twitter_tweet_button(); ?>
421 421
             <?php geodir_fb_like_button(); ?>
422 422
             <?php geodir_google_plus_button(); ?>
423 423
         </div>
424 424
     <?php
425
-    }// end of if, if its a preview or not
426
-
427
-    /**
428
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
429
-     *
430
-     * @since 1.0.0
431
-     */
432
-    do_action('geodir_after_social_sharing_buttons');
433
-    $content_html = ob_get_clean();
434
-    if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437
-        /**
438
-         * Filter the geodir_social_sharing_buttons() function content.
439
-         *
440
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
441
-         */
442
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
443
-    }
425
+	}// end of if, if its a preview or not
426
+
427
+	/**
428
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
429
+	 *
430
+	 * @since 1.0.0
431
+	 */
432
+	do_action('geodir_after_social_sharing_buttons');
433
+	$content_html = ob_get_clean();
434
+	if (trim($content_html) != '')
435
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437
+		/**
438
+		 * Filter the geodir_social_sharing_buttons() function content.
439
+		 *
440
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
441
+		 */
442
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
443
+	}
444 444
 
445 445
 
446 446
 }
@@ -458,46 +458,46 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function geodir_edit_post_link()
460 460
 {
461
-    global $post, $preview;
462
-    ob_start(); // Start buffering;
463
-    /**
464
-     * This is called before the edit post link html in the function geodir_edit_post_link()
465
-     *
466
-     * @since 1.0.0
467
-     */
468
-    do_action('geodir_before_edit_post_link');
469
-    if (!$preview) {
470
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
461
+	global $post, $preview;
462
+	ob_start(); // Start buffering;
463
+	/**
464
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
465
+	 *
466
+	 * @since 1.0.0
467
+	 */
468
+	do_action('geodir_before_edit_post_link');
469
+	if (!$preview) {
470
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
471 471
         
472
-        if ($is_current_user_owner) {
473
-            $post_id = $post->ID;
472
+		if ($is_current_user_owner) {
473
+			$post_id = $post->ID;
474 474
             
475
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
-                $post_id = (int)$_REQUEST['pid'];
477
-            }
475
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
+				$post_id = (int)$_REQUEST['pid'];
477
+			}
478 478
 
479
-            $postlink = get_permalink(geodir_add_listing_page_id());
480
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
482
-        }
483
-    }// end of if, if its a preview or not
484
-    /**
485
-     * This is called after the edit post link html in the function geodir_edit_post_link()
486
-     *
487
-     * @since 1.0.0
488
-     */
489
-    do_action('geodir_after_edit_post_link');
490
-    $content_html = ob_get_clean();
491
-    if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
494
-        /**
495
-         * Filter the geodir_edit_post_link() function content.
496
-         *
497
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
498
-         */
499
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
500
-    }
479
+			$postlink = get_permalink(geodir_add_listing_page_id());
480
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
482
+		}
483
+	}// end of if, if its a preview or not
484
+	/**
485
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
486
+	 *
487
+	 * @since 1.0.0
488
+	 */
489
+	do_action('geodir_after_edit_post_link');
490
+	$content_html = ob_get_clean();
491
+	if (trim($content_html) != '')
492
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
494
+		/**
495
+		 * Filter the geodir_edit_post_link() function content.
496
+		 *
497
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
498
+		 */
499
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
500
+	}
501 501
 }
502 502
 
503 503
 /**
@@ -511,45 +511,45 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function geodir_detail_page_google_analytics()
513 513
 {
514
-    if ( ! get_option( 'geodir_ga_stats' ) ) {
514
+	if ( ! get_option( 'geodir_ga_stats' ) ) {
515 515
 		return;
516 516
 	}
517 517
 	global $post,$preview;
518
-    if($preview){return '';}
519
-    $package_info = array();
520
-    $package_info = geodir_post_package_info($package_info, $post);
518
+	if($preview){return '';}
519
+	$package_info = array();
520
+	$package_info = geodir_post_package_info($package_info, $post);
521 521
 
522
-    $id = trim(get_option('geodir_ga_account_id'));
522
+	$id = trim(get_option('geodir_ga_account_id'));
523 523
 
524
-    if (!$id) {
525
-        return; //if no Google Analytics ID then bail.
526
-    }
524
+	if (!$id) {
525
+		return; //if no Google Analytics ID then bail.
526
+	}
527 527
 
528
-    ob_start(); // Start buffering;
529
-    /**
530
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
531
-     *
532
-     * @since 1.0.0
533
-     */
534
-    do_action('geodir_before_google_analytics');
528
+	ob_start(); // Start buffering;
529
+	/**
530
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
531
+	 *
532
+	 * @since 1.0.0
533
+	 */
534
+	do_action('geodir_before_google_analytics');
535 535
     
536
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
537
-    /**
538
-     * Filter the time interval to check & refresh new users results.
539
-     *
540
-     * @since 1.5.9
541
-     *
542
-     * @param int $refresh_time Time interval to check & refresh new users results.
543
-     */
544
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
545
-    $refresh_time = absint($refresh_time * 1000);
536
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
537
+	/**
538
+	 * Filter the time interval to check & refresh new users results.
539
+	 *
540
+	 * @since 1.5.9
541
+	 *
542
+	 * @param int $refresh_time Time interval to check & refresh new users results.
543
+	 */
544
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
545
+	$refresh_time = absint($refresh_time * 1000);
546 546
     
547
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
547
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
548 548
     
549
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
-    if (is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
551
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
552
-        ?>
549
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
+	if (is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
551
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
552
+		?>
553 553
         <script type="text/javascript">
554 554
             var gd_gaTimeOut;
555 555
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -801,15 +801,15 @@  discard block
 block discarded – undo
801 801
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
802 802
 
803 803
                     <?php
804
-                    // Here we list the shorthand days of the week so it can be used in translation.
805
-                    __("Mon",'geodirectory');
806
-                    __("Tue",'geodirectory');
807
-                    __("Wed",'geodirectory');
808
-                    __("Thu",'geodirectory');
809
-                    __("Fri",'geodirectory');
810
-                    __("Sat",'geodirectory');
811
-                    __("Sun",'geodirectory');
812
-                    ?>
804
+					// Here we list the shorthand days of the week so it can be used in translation.
805
+					__("Mon",'geodirectory');
806
+					__("Tue",'geodirectory');
807
+					__("Wed",'geodirectory');
808
+					__("Thu",'geodirectory');
809
+					__("Fri",'geodirectory');
810
+					__("Sat",'geodirectory');
811
+					__("Sun",'geodirectory');
812
+					?>
813 813
 
814 814
                     labels = [
815 815
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1058,24 +1058,24 @@  discard block
 block discarded – undo
1058 1058
         </span>
1059 1059
 
1060 1060
     <?php
1061
-    }
1062
-    /**
1063
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1064
-     *
1065
-     * @since 1.0.0
1066
-     */
1067
-    do_action('geodir_after_google_analytics');
1068
-    $content_html = ob_get_clean();
1069
-    if (trim($content_html) != '')
1070
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1072
-        /**
1073
-         * Filter the geodir_edit_post_link() function content.
1074
-         *
1075
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1076
-         */
1077
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1078
-    }
1061
+	}
1062
+	/**
1063
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1064
+	 *
1065
+	 * @since 1.0.0
1066
+	 */
1067
+	do_action('geodir_after_google_analytics');
1068
+	$content_html = ob_get_clean();
1069
+	if (trim($content_html) != '')
1070
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1072
+		/**
1073
+		 * Filter the geodir_edit_post_link() function content.
1074
+		 *
1075
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1076
+		 */
1077
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1078
+	}
1079 1079
 }
1080 1080
 
1081 1081
 /**
@@ -1092,94 +1092,94 @@  discard block
 block discarded – undo
1092 1092
  */
1093 1093
 function geodir_detail_page_review_rating()
1094 1094
 {
1095
-    global $post, $preview, $post_images;
1095
+	global $post, $preview, $post_images;
1096 1096
     
1097
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1098
-        return;
1099
-    }
1100
-    ob_start(); // Start  buffering;
1101
-    /**
1102
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1103
-     *
1104
-     * This is called outside the check for an actual rating and the check for preview page.
1105
-     *
1106
-     * @since 1.0.0
1107
-     */
1108
-    do_action('geodir_before_detail_page_review_rating');
1109
-
1110
-    $comment_count = geodir_get_review_count_total($post->ID);
1111
-    $post_avgratings = geodir_get_post_rating($post->ID);
1112
-
1113
-    if ($post_avgratings != 0 && !$preview) {
1114
-        /**
1115
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1116
-         *
1117
-         * This is called inside the check for an actual rating and the check for preview page.
1118
-         *
1119
-         * @since 1.0.0
1120
-         * @param float $post_avgratings Average rating for the current post.
1121
-         * @param int $post->ID Current post ID.
1122
-         */
1123
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
-
1125
-        $html = '<p style=" float:left;">';
1126
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1127
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1128
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1097
+	if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1098
+		return;
1099
+	}
1100
+	ob_start(); // Start  buffering;
1101
+	/**
1102
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1103
+	 *
1104
+	 * This is called outside the check for an actual rating and the check for preview page.
1105
+	 *
1106
+	 * @since 1.0.0
1107
+	 */
1108
+	do_action('geodir_before_detail_page_review_rating');
1109
+
1110
+	$comment_count = geodir_get_review_count_total($post->ID);
1111
+	$post_avgratings = geodir_get_post_rating($post->ID);
1112
+
1113
+	if ($post_avgratings != 0 && !$preview) {
1114
+		/**
1115
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1116
+		 *
1117
+		 * This is called inside the check for an actual rating and the check for preview page.
1118
+		 *
1119
+		 * @since 1.0.0
1120
+		 * @param float $post_avgratings Average rating for the current post.
1121
+		 * @param int $post->ID Current post ID.
1122
+		 */
1123
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
+
1125
+		$html = '<p style=" float:left;">';
1126
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1127
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1128
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1129 1129
        
1130 1130
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1131 1131
 	   
1132 1132
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1133 1133
 
1134
-        $html .= '<span class="item">';
1135
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1134
+		$html .= '<span class="item">';
1135
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1136 1136
 
1137
-        if ($post_images) {
1138
-            foreach ($post_images as $img) {
1139
-                $post_img = $img->src;
1140
-                break;
1141
-            }
1142
-        }
1143
-
1144
-        if (isset($post_img) && $post_img) {
1145
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1146
-        }
1147
-
1148
-        $html .= '</span>';
1149
-
1150
-        echo $html .= '</div>';
1151
-        /**
1152
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1153
-         *
1154
-         * This is called inside the check for an actual rating and the check for preview page.
1155
-         *
1156
-         * @since 1.0.0
1157
-         * @param float $post_avgratings Average rating for the current post.
1158
-         * @param int $post->ID Current post ID.
1159
-         */
1160
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1161
-    }
1162
-    /**
1163
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1164
-     *
1165
-     * This is called outside the check for an actual rating and the check for preview page.
1166
-     *
1167
-     * @since 1.0.0
1168
-     */
1169
-    do_action('geodir_after_detail_page_review_rating');
1170
-    $content_html = ob_get_clean();
1171
-    if (trim($content_html) != '') {
1172
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1173
-    }
1174
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1175
-        /**
1176
-         * Filter the geodir_detail_page_review_rating() function content.
1177
-         *
1178
-         * @since 1.0.0
1179
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1180
-         */
1181
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1182
-    }
1137
+		if ($post_images) {
1138
+			foreach ($post_images as $img) {
1139
+				$post_img = $img->src;
1140
+				break;
1141
+			}
1142
+		}
1143
+
1144
+		if (isset($post_img) && $post_img) {
1145
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1146
+		}
1147
+
1148
+		$html .= '</span>';
1149
+
1150
+		echo $html .= '</div>';
1151
+		/**
1152
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1153
+		 *
1154
+		 * This is called inside the check for an actual rating and the check for preview page.
1155
+		 *
1156
+		 * @since 1.0.0
1157
+		 * @param float $post_avgratings Average rating for the current post.
1158
+		 * @param int $post->ID Current post ID.
1159
+		 */
1160
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1161
+	}
1162
+	/**
1163
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1164
+	 *
1165
+	 * This is called outside the check for an actual rating and the check for preview page.
1166
+	 *
1167
+	 * @since 1.0.0
1168
+	 */
1169
+	do_action('geodir_after_detail_page_review_rating');
1170
+	$content_html = ob_get_clean();
1171
+	if (trim($content_html) != '') {
1172
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1173
+	}
1174
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1175
+		/**
1176
+		 * Filter the geodir_detail_page_review_rating() function content.
1177
+		 *
1178
+		 * @since 1.0.0
1179
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1180
+		 */
1181
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1182
+	}
1183 1183
 }
1184 1184
 
1185 1185
 /**
@@ -1191,35 +1191,35 @@  discard block
 block discarded – undo
1191 1191
  */
1192 1192
 function geodir_detail_page_more_info()
1193 1193
 {
1194
-    ob_start(); // Start  buffering;
1195
-    /**
1196
-     * This is called before the info section html.
1197
-     *
1198
-     * @since 1.0.0
1199
-     */
1200
-    do_action('geodir_before_detail_page_more_info');
1201
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1202
-        echo $geodir_post_detail_fields;
1203
-    }
1204
-    /**
1205
-     * This is called after the info section html.
1206
-     *
1207
-     * @since 1.0.0
1208
-     */
1209
-    do_action('geodir_after_detail_page_more_info');
1210
-
1211
-    $content_html = ob_get_clean();
1212
-    if (trim($content_html) != '')
1213
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1215
-        /**
1216
-         * Filter the output html for function geodir_detail_page_more_info().
1217
-         *
1218
-         * @since 1.0.0
1219
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1220
-         */
1221
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1222
-    }
1194
+	ob_start(); // Start  buffering;
1195
+	/**
1196
+	 * This is called before the info section html.
1197
+	 *
1198
+	 * @since 1.0.0
1199
+	 */
1200
+	do_action('geodir_before_detail_page_more_info');
1201
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1202
+		echo $geodir_post_detail_fields;
1203
+	}
1204
+	/**
1205
+	 * This is called after the info section html.
1206
+	 *
1207
+	 * @since 1.0.0
1208
+	 */
1209
+	do_action('geodir_after_detail_page_more_info');
1210
+
1211
+	$content_html = ob_get_clean();
1212
+	if (trim($content_html) != '')
1213
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1215
+		/**
1216
+		 * Filter the output html for function geodir_detail_page_more_info().
1217
+		 *
1218
+		 * @since 1.0.0
1219
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1220
+		 */
1221
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1222
+	}
1223 1223
 }
1224 1224
 
1225 1225
 
@@ -1233,15 +1233,15 @@  discard block
 block discarded – undo
1233 1233
  */
1234 1234
 function geodir_localize_all_js_msg()
1235 1235
 {// check_ajax_referer function is used to make sure no files are uploaded remotely but it will fail if used between https and non https so we do the check below of the urls
1236
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1237
-        $ajax_url = admin_url('admin-ajax.php');
1238
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1239
-        $ajax_url = admin_url('admin-ajax.php');
1240
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1241
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1242
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1243
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1244
-    }
1236
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1237
+		$ajax_url = admin_url('admin-ajax.php');
1238
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1239
+		$ajax_url = admin_url('admin-ajax.php');
1240
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1241
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1242
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1243
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1244
+	}
1245 1245
 	
1246 1246
 	/**
1247 1247
 	 * Filter the allowed image type extensions for post images.
@@ -1251,62 +1251,62 @@  discard block
 block discarded – undo
1251 1251
 	 */
1252 1252
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1253 1253
 	
1254
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1255
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1256
-    $default_marker_width = $default_marker_size['w'];
1257
-    $default_marker_height = $default_marker_size['h'];
1254
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1255
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1256
+	$default_marker_width = $default_marker_size['w'];
1257
+	$default_marker_height = $default_marker_size['h'];
1258 1258
     
1259
-    $arr_alert_msg = array(
1260
-        'geodir_plugin_url' => geodir_plugin_url(),
1261
-        'geodir_admin_ajax_url' => $ajax_url,
1262
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1263
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1264
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1265
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1266
-        //start not show alert msg
1267
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1268
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1269
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1270
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1271
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1272
-        // end not show alert msg
1273
-        'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1274
-        'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1275
-        //start not show alert msg
1276
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1277
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1278
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1279
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1280
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1281
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1282
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1283
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1284
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1285
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1286
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1287
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1288
-        'geodir_default_marker_icon' => $default_marker_icon,
1289
-        'geodir_default_marker_w' => $default_marker_width,
1290
-        'geodir_default_marker_h' => $default_marker_height,
1291
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1292
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1293
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1294
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1295
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1296
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1297
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1298
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1299
-        'err_empty_review' => __('Please type a review.', 'geodirectory'),
1300
-        'err_empty_reply' => __('Please type a reply.', 'geodirectory'),
1301
-        /* on/off dragging for phone devices */
1302
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1303
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1304
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1305
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1306
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1307
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1308
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1309
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1259
+	$arr_alert_msg = array(
1260
+		'geodir_plugin_url' => geodir_plugin_url(),
1261
+		'geodir_admin_ajax_url' => $ajax_url,
1262
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1263
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1264
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1265
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1266
+		//start not show alert msg
1267
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1268
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1269
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1270
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1271
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1272
+		// end not show alert msg
1273
+		'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1274
+		'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1275
+		//start not show alert msg
1276
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1277
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1278
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1279
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1280
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1281
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1282
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1283
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1284
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1285
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1286
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1287
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1288
+		'geodir_default_marker_icon' => $default_marker_icon,
1289
+		'geodir_default_marker_w' => $default_marker_width,
1290
+		'geodir_default_marker_h' => $default_marker_height,
1291
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1292
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1293
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1294
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1295
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1296
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1297
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1298
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1299
+		'err_empty_review' => __('Please type a review.', 'geodirectory'),
1300
+		'err_empty_reply' => __('Please type a reply.', 'geodirectory'),
1301
+		/* on/off dragging for phone devices */
1302
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1303
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1304
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1305
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1306
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1307
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1308
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1309
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1310 1310
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1311 1311
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1312 1312
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1314,41 +1314,41 @@  discard block
 block discarded – undo
1314 1314
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1315 1315
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1316 1316
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1317
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318
-        'geodir_map_name' => geodir_map_name(),
1319
-        'osmStart' => __('Start', 'geodirectory'),
1320
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1321
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1322
-        'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1323
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1324
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1325
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1326
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1327
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1328
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1317
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318
+		'geodir_map_name' => geodir_map_name(),
1319
+		'osmStart' => __('Start', 'geodirectory'),
1320
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1321
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1322
+		'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1323
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1324
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1325
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1326
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1327
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1328
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1329 1329
 		'mapLanguage' => geodir_get_map_default_language()
1330
-    );
1331
-
1332
-    /**
1333
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1334
-     *
1335
-     * With this filter you can add, remove or change translated JS strings.
1336
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1337
-     *
1338
-     * @since 1.0.0
1339
-     */
1340
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1341
-
1342
-    foreach ($arr_alert_msg as $key => $value) {
1343
-        if (!is_scalar($value))
1344
-            continue;
1345
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1346
-    }
1330
+	);
1331
+
1332
+	/**
1333
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1334
+	 *
1335
+	 * With this filter you can add, remove or change translated JS strings.
1336
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1337
+	 *
1338
+	 * @since 1.0.0
1339
+	 */
1340
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1347 1341
 
1348
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1349
-    echo '<script>';
1350
-    echo $script;
1351
-    echo '</script>';
1342
+	foreach ($arr_alert_msg as $key => $value) {
1343
+		if (!is_scalar($value))
1344
+			continue;
1345
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1346
+	}
1347
+
1348
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1349
+	echo '<script>';
1350
+	echo $script;
1351
+	echo '</script>';
1352 1352
 }
1353 1353
 
1354 1354
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1364,11 +1364,11 @@  discard block
 block discarded – undo
1364 1364
  */
1365 1365
 function geodir_admin_bar_site_menu($wp_admin_bar)
1366 1366
 {
1367
-    if (get_option("geodir_installed")) {
1368
-        if (current_user_can('manage_options')) {
1369
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1370
-        }
1371
-    }
1367
+	if (get_option("geodir_installed")) {
1368
+		if (current_user_can('manage_options')) {
1369
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1370
+		}
1371
+	}
1372 1372
 }
1373 1373
 
1374 1374
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1394,25 +1394,25 @@  discard block
 block discarded – undo
1394 1394
  */
1395 1395
 function geodir_store_sidebars()
1396 1396
 {
1397
-    global $geodir_sidebars;
1398
-    global $sidebars_widgets;
1399
-
1400
-    if (!is_array($sidebars_widgets))
1401
-        $sidebars_widgets = wp_get_sidebars_widgets();
1402
-    $geodir_old_sidebars = array();
1403
-
1404
-    if (is_array($geodir_sidebars)) {
1405
-        foreach ($geodir_sidebars as $val) {
1406
-            if (is_array($sidebars_widgets)) {
1407
-                if (array_key_exists($val, $sidebars_widgets))
1408
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1409
-                else
1410
-                    $geodir_old_sidebars[$val] = array();
1411
-            }
1412
-        }
1413
-    }
1414
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1415
-    geodir_option_version_backup('geodir_sidebars');
1397
+	global $geodir_sidebars;
1398
+	global $sidebars_widgets;
1399
+
1400
+	if (!is_array($sidebars_widgets))
1401
+		$sidebars_widgets = wp_get_sidebars_widgets();
1402
+	$geodir_old_sidebars = array();
1403
+
1404
+	if (is_array($geodir_sidebars)) {
1405
+		foreach ($geodir_sidebars as $val) {
1406
+			if (is_array($sidebars_widgets)) {
1407
+				if (array_key_exists($val, $sidebars_widgets))
1408
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1409
+				else
1410
+					$geodir_old_sidebars[$val] = array();
1411
+			}
1412
+		}
1413
+	}
1414
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1415
+	geodir_option_version_backup('geodir_sidebars');
1416 1416
 
1417 1417
 }
1418 1418
 
@@ -1426,28 +1426,28 @@  discard block
 block discarded – undo
1426 1426
  */
1427 1427
 function geodir_restore_sidebars()
1428 1428
 {
1429
-    global $sidebars_widgets;
1430
-
1431
-    if (!is_array($sidebars_widgets))
1432
-        $sidebars_widgets = wp_get_sidebars_widgets();
1433
-
1434
-    if (is_array($sidebars_widgets)) {
1435
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1436
-        if (is_array($geodir_old_sidebars)) {
1437
-            foreach ($geodir_old_sidebars as $key => $val) {
1438
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1439
-                {
1440
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1441
-                }
1429
+	global $sidebars_widgets;
1442 1430
 
1431
+	if (!is_array($sidebars_widgets))
1432
+		$sidebars_widgets = wp_get_sidebars_widgets();
1443 1433
 
1444
-            }
1445
-        }
1434
+	if (is_array($sidebars_widgets)) {
1435
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1436
+		if (is_array($geodir_old_sidebars)) {
1437
+			foreach ($geodir_old_sidebars as $key => $val) {
1438
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1439
+				{
1440
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1441
+				}
1446 1442
 
1447
-    }
1448 1443
 
1449
-    update_option('sidebars_widgets', $sidebars_widgets);
1450
-    update_option('geodir_sidebars', '');
1444
+			}
1445
+		}
1446
+
1447
+	}
1448
+
1449
+	update_option('sidebars_widgets', $sidebars_widgets);
1450
+	update_option('geodir_sidebars', '');
1451 1451
 }
1452 1452
 
1453 1453
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1460,9 +1460,9 @@  discard block
 block discarded – undo
1460 1460
  */
1461 1461
 function geodir_after_listing_post_gridview()
1462 1462
 {
1463
-    global $gridview_columns;
1463
+	global $gridview_columns;
1464 1464
 
1465
-    $gridview_columns = '';
1465
+	$gridview_columns = '';
1466 1466
 
1467 1467
 }
1468 1468
 
@@ -1490,11 +1490,11 @@  discard block
 block discarded – undo
1490 1490
  */
1491 1491
 function so_handle_038($url, $original_url, $_context)
1492 1492
 {
1493
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1494
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1495
-    }
1493
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1494
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1495
+	}
1496 1496
 
1497
-    return $url;
1497
+	return $url;
1498 1498
 }
1499 1499
 
1500 1500
 
@@ -1510,34 +1510,34 @@  discard block
 block discarded – undo
1510 1510
 function geodir_after_main_form_fields() {
1511 1511
 	global $gd_session;
1512 1512
 	
1513
-    if (get_option('geodir_accept_term_condition')) {
1514
-        global $post;
1515
-        $term_condition = '';
1516
-        if (isset($_REQUEST['backandedit'])) {
1517
-            $post = (object)$gd_session->get('listing');
1518
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1519
-        }
1520
-
1521
-        ?>
1513
+	if (get_option('geodir_accept_term_condition')) {
1514
+		global $post;
1515
+		$term_condition = '';
1516
+		if (isset($_REQUEST['backandedit'])) {
1517
+			$post = (object)$gd_session->get('listing');
1518
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1519
+		}
1520
+
1521
+		?>
1522 1522
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1523 1523
             <label>&nbsp;</label>
1524 1524
 
1525 1525
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1526 1526
 				<span style="display:block"> 
1527 1527
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1528
-                    echo 'checked="checked"';
1529
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1528
+					echo 'checked="checked"';
1529
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1530 1530
                        class="geodir_textfield" value="1"
1531 1531
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1532 1532
 				</span>
1533 1533
             </div>
1534 1534
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1535
-                    _e($required_msg, 'geodirectory');
1536
-                } ?></span>
1535
+					_e($required_msg, 'geodirectory');
1536
+				} ?></span>
1537 1537
         </div>
1538 1538
     <?php
1539 1539
 
1540
-    }
1540
+	}
1541 1541
 }
1542 1542
 
1543 1543
 
@@ -1562,42 +1562,42 @@  discard block
 block discarded – undo
1562 1562
  */
1563 1563
 function geodir_detail_page_tab_is_display($is_display, $tab)
1564 1564
 {
1565
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1565
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1566 1566
 
1567
-    if ($tab == 'post_profile') {
1568
-        /** This action is documented in geodirectory_template_actions.php */
1569
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1567
+	if ($tab == 'post_profile') {
1568
+		/** This action is documented in geodirectory_template_actions.php */
1569
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1570 1570
         
1571
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1572
-            $is_display = false;
1573
-        }
1574
-    }
1571
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1572
+			$is_display = false;
1573
+		}
1574
+	}
1575 1575
     
1576
-    if ($tab == 'post_info')
1577
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1576
+	if ($tab == 'post_info')
1577
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1578 1578
     
1579
-    if ($tab == 'post_images')
1580
-        $is_display = (!empty($post_images)) ? true : false;
1579
+	if ($tab == 'post_images')
1580
+		$is_display = (!empty($post_images)) ? true : false;
1581 1581
 
1582
-    if ($tab == 'post_video')
1583
-        $is_display = (!empty($video)) ? true : false;
1582
+	if ($tab == 'post_video')
1583
+		$is_display = (!empty($video)) ? true : false;
1584 1584
 
1585
-    if ($tab == 'special_offers')
1586
-        $is_display = (!empty($special_offers)) ? true : false;
1585
+	if ($tab == 'special_offers')
1586
+		$is_display = (!empty($special_offers)) ? true : false;
1587 1587
 
1588
-    if ($tab == 'reviews')
1589
-        $is_display = (geodir_is_page('detail')) ? true : false;
1588
+	if ($tab == 'reviews')
1589
+		$is_display = (geodir_is_page('detail')) ? true : false;
1590 1590
 
1591
-    if ($tab == 'related_listing') {
1592
-       $message = __('No listings found which match your selection.', 'geodirectory');
1591
+	if ($tab == 'related_listing') {
1592
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1593 1593
        
1594
-       /** This action is documented in geodirectory-functions/template_functions.php */
1595
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1594
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1595
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1596 1596
        
1597
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1598
-    }
1597
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1598
+	}
1599 1599
 
1600
-    return $is_display;
1600
+	return $is_display;
1601 1601
 }
1602 1602
 
1603 1603
 
@@ -1613,69 +1613,69 @@  discard block
 block discarded – undo
1613 1613
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1614 1614
  */
1615 1615
 function geodir_changes_in_custom_fields_table() {
1616
-    global $wpdb, $plugin_prefix;
1616
+	global $wpdb, $plugin_prefix;
1617 1617
 	
1618 1618
 	// Remove unused virtual page
1619 1619
 	$listings_page_id = (int)get_option('geodir_listing_page');
1620 1620
 	if ($listings_page_id) {
1621 1621
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1622
-        delete_option('geodir_listing_page');
1622
+		delete_option('geodir_listing_page');
1623 1623
 	}
1624 1624
 
1625
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1626
-        $wpdb->query(
1627
-            $wpdb->prepare(
1628
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1629
-                array('1', '1', 'admin')
1630
-            )
1631
-        );
1625
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1626
+		$wpdb->query(
1627
+			$wpdb->prepare(
1628
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1629
+				array('1', '1', 'admin')
1630
+			)
1631
+		);
1632 1632
 
1633 1633
 
1634
-        /* --- terms meta value set --- */
1634
+		/* --- terms meta value set --- */
1635 1635
 
1636
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1636
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1637 1637
 
1638
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1638
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1639 1639
 
1640
-        if (!empty($options_data)) {
1640
+		if (!empty($options_data)) {
1641 1641
 
1642
-            foreach ($options_data as $optobj) {
1642
+			foreach ($options_data as $optobj) {
1643 1643
 
1644
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1644
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1645 1645
 
1646
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1646
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1647 1647
 
1648
-                if (!empty($taxonomies_data)) {
1648
+				if (!empty($taxonomies_data)) {
1649 1649
 
1650
-                    foreach ($taxonomies_data as $taxobj) {
1650
+					foreach ($taxonomies_data as $taxobj) {
1651 1651
 
1652
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1653
-                        $post_type = $taxObject->object_type[0];
1652
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1653
+						$post_type = $taxObject->object_type[0];
1654 1654
 
1655
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1655
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1656 1656
 
1657
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1657
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1658 1658
 
1659
-                        if ($duplicate_data) {
1659
+						if ($duplicate_data) {
1660 1660
 
1661
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1661
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1662 1662
 
1663
-                        } else {
1663
+						} else {
1664 1664
 
1665
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1665
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1666 1666
 
1667
-                        }
1667
+						}
1668 1668
 
1669
-                    }
1669
+					}
1670 1670
 
1671
-                }
1671
+				}
1672 1672
 
1673
-            }
1674
-        }
1673
+			}
1674
+		}
1675 1675
 
1676
-        update_option('geodir_changes_in_custom_fields_table', '1');
1676
+		update_option('geodir_changes_in_custom_fields_table', '1');
1677 1677
 
1678
-    }
1678
+	}
1679 1679
 
1680 1680
 }
1681 1681
 
@@ -1694,24 +1694,24 @@  discard block
 block discarded – undo
1694 1694
 function geodir_location_slug_check($slug)
1695 1695
 {
1696 1696
 
1697
-    global $wpdb, $table_prefix;
1697
+	global $wpdb, $table_prefix;
1698 1698
 
1699
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1699
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1700 1700
 
1701
-    if ($slug_exists) {
1701
+	if ($slug_exists) {
1702 1702
 
1703
-        $suffix = 1;
1704
-        do {
1705
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1706
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1707
-            $suffix++;
1708
-        } while ($location_slug_check && $suffix < 100);
1703
+		$suffix = 1;
1704
+		do {
1705
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1706
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1707
+			$suffix++;
1708
+		} while ($location_slug_check && $suffix < 100);
1709 1709
 
1710
-        $slug = $alt_location_name;
1710
+		$slug = $alt_location_name;
1711 1711
 
1712
-    }
1712
+	}
1713 1713
 
1714
-    return $slug;
1714
+	return $slug;
1715 1715
 
1716 1716
 }
1717 1717
 
@@ -1736,42 +1736,42 @@  discard block
 block discarded – undo
1736 1736
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1737 1737
 {
1738 1738
 
1739
-    global $wpdb, $plugin_prefix, $table_prefix;
1739
+	global $wpdb, $plugin_prefix, $table_prefix;
1740 1740
 
1741
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1741
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1742 1742
 
1743
-    $slug = $tern_data->slug;
1743
+	$slug = $tern_data->slug;
1744 1744
 
1745
-    /**
1746
-     * Filter if a term slug exists.
1747
-     *
1748
-     * @since 1.0.0
1749
-     * @package GeoDirectory
1750
-     * @param bool $bool Default: false.
1751
-     * @param string $slug The term slug.
1752
-     * @param int $term_id The term ID.
1753
-     */
1754
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1745
+	/**
1746
+	 * Filter if a term slug exists.
1747
+	 *
1748
+	 * @since 1.0.0
1749
+	 * @package GeoDirectory
1750
+	 * @param bool $bool Default: false.
1751
+	 * @param string $slug The term slug.
1752
+	 * @param int $term_id The term ID.
1753
+	 */
1754
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1755 1755
 
1756
-    if ($slug_exists) {
1756
+	if ($slug_exists) {
1757 1757
 
1758
-        $suffix = 1;
1759
-        do {
1760
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1758
+		$suffix = 1;
1759
+		do {
1760
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1761 1761
 
1762
-            /** This action is documented in geodirectory_hooks_actions.php */
1763
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1762
+			/** This action is documented in geodirectory_hooks_actions.php */
1763
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1764 1764
 
1765
-            $suffix++;
1766
-        } while ($term_slug_check && $suffix < 100);
1765
+			$suffix++;
1766
+		} while ($term_slug_check && $suffix < 100);
1767 1767
 
1768
-        $slug = $new_slug;
1768
+		$slug = $new_slug;
1769 1769
 
1770
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1770
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1771 1771
 
1772
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1772
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1773 1773
 
1774
-    }
1774
+	}
1775 1775
 	
1776 1776
 	// Update tag in detail table.
1777 1777
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1812,21 +1812,21 @@  discard block
 block discarded – undo
1812 1812
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1813 1813
 {
1814 1814
 
1815
-    global $wpdb, $table_prefix;
1815
+	global $wpdb, $table_prefix;
1816 1816
 
1817
-    $default_location = geodir_get_default_location();
1817
+	$default_location = geodir_get_default_location();
1818 1818
 
1819
-    $country_slug = $default_location->country_slug;
1820
-    $region_slug = $default_location->region_slug;
1821
-    $city_slug = $default_location->city_slug;
1819
+	$country_slug = $default_location->country_slug;
1820
+	$region_slug = $default_location->region_slug;
1821
+	$city_slug = $default_location->city_slug;
1822 1822
 
1823
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1824
-        return $slug_exists = true;
1823
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1824
+		return $slug_exists = true;
1825 1825
 
1826
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1827
-        return $slug_exists = true;
1826
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1827
+		return $slug_exists = true;
1828 1828
 
1829
-    return $slug_exists;
1829
+	return $slug_exists;
1830 1830
 }
1831 1831
 
1832 1832
 
@@ -1846,75 +1846,75 @@  discard block
 block discarded – undo
1846 1846
  */
1847 1847
 function geodir_custom_page_title($title = '', $sep = '')
1848 1848
 {
1849
-    global $wp;
1850
-    if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1851
-        return $title;
1852
-    }
1849
+	global $wp;
1850
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1851
+		return $title;
1852
+	}
1853 1853
 
1854
-    if ($sep == '') {
1855
-        /**
1856
-         * Filter the page title separator.
1857
-         *
1858
-         * @since 1.0.0
1859
-         * @package GeoDirectory
1860
-         * @param string $sep The separator, default: `|`.
1861
-         */
1862
-        $sep = apply_filters('geodir_page_title_separator', '|');
1863
-    }
1854
+	if ($sep == '') {
1855
+		/**
1856
+		 * Filter the page title separator.
1857
+		 *
1858
+		 * @since 1.0.0
1859
+		 * @package GeoDirectory
1860
+		 * @param string $sep The separator, default: `|`.
1861
+		 */
1862
+		$sep = apply_filters('geodir_page_title_separator', '|');
1863
+	}
1864 1864
 
1865 1865
 
1866
-    $gd_page = '';
1867
-    if(geodir_is_page('home')){
1868
-        $gd_page = 'home';
1869
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1870
-    }
1871
-    elseif(geodir_is_page('detail')){
1872
-        $gd_page = 'detail';
1873
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1874
-    }
1875
-    elseif(geodir_is_page('pt')){
1876
-        $gd_page = 'pt';
1877
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1878
-    }
1879
-    elseif(geodir_is_page('listing')){
1880
-        $gd_page = 'listing';
1881
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1882
-    }
1883
-    elseif(geodir_is_page('location')){
1884
-        $gd_page = 'location';
1885
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1886
-    }
1887
-    elseif(geodir_is_page('search')){
1888
-        $gd_page = 'search';
1889
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1890
-    }
1891
-    elseif(geodir_is_page('add-listing')){
1892
-        $gd_page = 'add-listing';
1893
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1894
-    }
1895
-    elseif(geodir_is_page('author')){
1896
-        $gd_page = 'author';
1897
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1898
-    }
1899
-    elseif(geodir_is_page('login')){
1900
-        $gd_page = 'login';
1901
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1902
-    }
1903
-    elseif(geodir_is_page('listing-success')){
1904
-        $gd_page = 'listing-success';
1905
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1906
-    }
1866
+	$gd_page = '';
1867
+	if(geodir_is_page('home')){
1868
+		$gd_page = 'home';
1869
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1870
+	}
1871
+	elseif(geodir_is_page('detail')){
1872
+		$gd_page = 'detail';
1873
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1874
+	}
1875
+	elseif(geodir_is_page('pt')){
1876
+		$gd_page = 'pt';
1877
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1878
+	}
1879
+	elseif(geodir_is_page('listing')){
1880
+		$gd_page = 'listing';
1881
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1882
+	}
1883
+	elseif(geodir_is_page('location')){
1884
+		$gd_page = 'location';
1885
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1886
+	}
1887
+	elseif(geodir_is_page('search')){
1888
+		$gd_page = 'search';
1889
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1890
+	}
1891
+	elseif(geodir_is_page('add-listing')){
1892
+		$gd_page = 'add-listing';
1893
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1894
+	}
1895
+	elseif(geodir_is_page('author')){
1896
+		$gd_page = 'author';
1897
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1898
+	}
1899
+	elseif(geodir_is_page('login')){
1900
+		$gd_page = 'login';
1901
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1902
+	}
1903
+	elseif(geodir_is_page('listing-success')){
1904
+		$gd_page = 'listing-success';
1905
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1906
+	}
1907 1907
 
1908 1908
 
1909
-    /**
1910
-     * Filter page meta title to replace variables.
1911
-     *
1912
-     * @since 1.5.4
1913
-     * @param string $title The page title including variables.
1914
-     * @param string $gd_page The GeoDirectory page type if any.
1915
-     * @param string $sep The title separator symbol.
1916
-     */
1917
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1909
+	/**
1910
+	 * Filter page meta title to replace variables.
1911
+	 *
1912
+	 * @since 1.5.4
1913
+	 * @param string $title The page title including variables.
1914
+	 * @param string $gd_page The GeoDirectory page type if any.
1915
+	 * @param string $sep The title separator symbol.
1916
+	 */
1917
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1918 1918
 
1919 1919
 }
1920 1920
 
@@ -1930,36 +1930,36 @@  discard block
 block discarded – undo
1930 1930
 function geodir_set_post_attachment()
1931 1931
 {
1932 1932
 
1933
-    if (!get_option('geodir_set_post_attachments')) {
1933
+	if (!get_option('geodir_set_post_attachments')) {
1934 1934
 
1935
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1936
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1935
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1936
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1937 1937
 
1938
-        $all_postypes = geodir_get_posttypes();
1938
+		$all_postypes = geodir_get_posttypes();
1939 1939
 
1940
-        foreach($all_postypes as $post_type){
1941
-            $args = array(
1942
-                'posts_per_page' => -1,
1943
-                'post_type' => $post_type,
1944
-                'post_status' => 'publish');
1940
+		foreach($all_postypes as $post_type){
1941
+			$args = array(
1942
+				'posts_per_page' => -1,
1943
+				'post_type' => $post_type,
1944
+				'post_status' => 'publish');
1945 1945
 
1946
-            $posts_array = get_posts($args);
1946
+			$posts_array = get_posts($args);
1947 1947
 
1948
-            if (!empty($posts_array)) {
1948
+			if (!empty($posts_array)) {
1949 1949
 
1950
-                foreach ($posts_array as $post) {
1950
+				foreach ($posts_array as $post) {
1951 1951
 
1952
-                    geodir_set_wp_featured_image($post->ID);
1952
+					geodir_set_wp_featured_image($post->ID);
1953 1953
 
1954
-                }
1954
+				}
1955 1955
 
1956
-            }
1957
-        }
1956
+			}
1957
+		}
1958 1958
 
1959 1959
 
1960
-        update_option('geodir_set_post_attachments', '1');
1960
+		update_option('geodir_set_post_attachments', '1');
1961 1961
 
1962
-    }
1962
+	}
1963 1963
 
1964 1964
 }
1965 1965
 
@@ -1976,19 +1976,19 @@  discard block
 block discarded – undo
1976 1976
 function geodir_remove_url_seperator()
1977 1977
 {
1978 1978
 
1979
-    if (!get_option('geodir_remove_url_seperator')) {
1979
+	if (!get_option('geodir_remove_url_seperator')) {
1980 1980
 
1981
-        if (get_option('geodir_listingurl_separator'))
1982
-            delete_option('geodir_listingurl_separator');
1981
+		if (get_option('geodir_listingurl_separator'))
1982
+			delete_option('geodir_listingurl_separator');
1983 1983
 
1984
-        if (get_option('geodir_detailurl_separator'))
1985
-            delete_option('geodir_detailurl_separator');
1984
+		if (get_option('geodir_detailurl_separator'))
1985
+			delete_option('geodir_detailurl_separator');
1986 1986
 
1987
-        flush_rewrite_rules(false);
1987
+		flush_rewrite_rules(false);
1988 1988
 
1989
-        update_option('geodir_remove_url_seperator', '1');
1989
+		update_option('geodir_remove_url_seperator', '1');
1990 1990
 
1991
-    }
1991
+	}
1992 1992
 
1993 1993
 }
1994 1994
 
@@ -2004,19 +2004,19 @@  discard block
 block discarded – undo
2004 2004
  */
2005 2005
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2006 2006
 {
2007
-    foreach ($permalink_arr as $key => $value) {
2007
+	foreach ($permalink_arr as $key => $value) {
2008 2008
 
2009
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2010
-            unset($permalink_arr[$key]);
2009
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2010
+			unset($permalink_arr[$key]);
2011 2011
 
2012
-    }
2012
+	}
2013 2013
 
2014
-    return $permalink_arr;
2014
+	return $permalink_arr;
2015 2015
 
2016 2016
 }
2017 2017
 
2018 2018
 if (!is_admin()) {
2019
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2019
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2020 2020
 }
2021 2021
 /**
2022 2022
  * Set status from draft to publish.
@@ -2029,16 +2029,16 @@  discard block
 block discarded – undo
2029 2029
  */
2030 2030
 function geodir_set_status_draft_to_publish_for_own_post($post)
2031 2031
 {
2032
-    $user_id = get_current_user_id();
2032
+	$user_id = get_current_user_id();
2033 2033
 
2034
-    if(!$user_id){return $post;}
2034
+	if(!$user_id){return $post;}
2035 2035
 
2036
-    $gd_post_types = geodir_get_posttypes();
2036
+	$gd_post_types = geodir_get_posttypes();
2037 2037
 
2038
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2039
-        $post[0]->post_status = 'publish';
2040
-    }
2041
-    return $post;
2038
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2039
+		$post[0]->post_status = 'publish';
2040
+	}
2041
+	return $post;
2042 2042
 }
2043 2043
 
2044 2044
 
@@ -2130,33 +2130,33 @@  discard block
 block discarded – undo
2130 2130
  */
2131 2131
 function geodir_detail_page_tab_headings_change($tabs_arr)
2132 2132
 {
2133
-    global $wpdb;
2133
+	global $wpdb;
2134 2134
 
2135
-    $post_type = geodir_get_current_posttype();
2135
+	$post_type = geodir_get_current_posttype();
2136 2136
 
2137
-    $all_postypes = geodir_get_posttypes();
2137
+	$all_postypes = geodir_get_posttypes();
2138 2138
 
2139
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2139
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2140 2140
 
2141
-        if (array_key_exists('post_video', $tabs_arr)) {
2141
+		if (array_key_exists('post_video', $tabs_arr)) {
2142 2142
 
2143
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2143
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2144 2144
 
2145
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2146
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2147
-        }
2145
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2146
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2147
+		}
2148 2148
 
2149
-        if (array_key_exists('special_offers', $tabs_arr)) {
2149
+		if (array_key_exists('special_offers', $tabs_arr)) {
2150 2150
 
2151
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2151
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2152 2152
 
2153
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2154
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2155
-        }
2153
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2154
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2155
+		}
2156 2156
 
2157
-    }
2157
+	}
2158 2158
 
2159
-    return $tabs_arr;
2159
+	return $tabs_arr;
2160 2160
 
2161 2161
 }
2162 2162
 
@@ -2169,10 +2169,10 @@  discard block
 block discarded – undo
2169 2169
  */
2170 2170
 function geodir_remove_template_redirect_actions()
2171 2171
 {
2172
-    if (geodir_is_page('login')){
2173
-        remove_all_actions('template_redirect');
2174
-        remove_action('init', 'avia_modify_front', 10);
2175
-    }
2172
+	if (geodir_is_page('login')){
2173
+		remove_all_actions('template_redirect');
2174
+		remove_action('init', 'avia_modify_front', 10);
2175
+	}
2176 2176
 }
2177 2177
 
2178 2178
 
@@ -2194,51 +2194,51 @@  discard block
 block discarded – undo
2194 2194
 function geodirectory_before_featured_image_delete($attachment_id)
2195 2195
 {
2196 2196
 
2197
-    global $wpdb, $plugin_prefix;
2197
+	global $wpdb, $plugin_prefix;
2198 2198
 
2199
-    $post_id = get_post_field('post_parent', $attachment_id);
2199
+	$post_id = get_post_field('post_parent', $attachment_id);
2200 2200
 
2201
-    $attachment_url = wp_get_attachment_url($attachment_id);
2201
+	$attachment_url = wp_get_attachment_url($attachment_id);
2202 2202
 
2203
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2203
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2204 2204
 
2205
-        $post_type = get_post_type($post_id);
2205
+		$post_type = get_post_type($post_id);
2206 2206
 
2207
-        $all_postypes = geodir_get_posttypes();
2207
+		$all_postypes = geodir_get_posttypes();
2208 2208
 
2209
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2210
-            return false;
2209
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2210
+			return false;
2211 2211
 
2212
-        $uploads = wp_upload_dir();
2212
+		$uploads = wp_upload_dir();
2213 2213
 
2214
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2214
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2215 2215
 
2216
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2216
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2217 2217
 
2218
-        $wpdb->query(
2219
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2220
-                array($post_id, $split_img_file_path)
2221
-            )
2222
-        );
2218
+		$wpdb->query(
2219
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2220
+				array($post_id, $split_img_file_path)
2221
+			)
2222
+		);
2223 2223
 
2224
-        $attachment_data = $wpdb->get_row(
2225
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2226
-                array($post_id)
2227
-            )
2228
-        );
2224
+		$attachment_data = $wpdb->get_row(
2225
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2226
+				array($post_id)
2227
+			)
2228
+		);
2229 2229
 
2230
-        if (!empty($attachment_data)) {
2231
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2232
-        }
2230
+		if (!empty($attachment_data)) {
2231
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2232
+		}
2233 2233
 
2234 2234
 
2235
-        $table_name = $plugin_prefix . $post_type . '_detail';
2235
+		$table_name = $plugin_prefix . $post_type . '_detail';
2236 2236
 
2237
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2237
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2238 2238
 
2239
-        geodir_set_wp_featured_image($post_id);
2239
+		geodir_set_wp_featured_image($post_id);
2240 2240
 
2241
-    }
2241
+	}
2242 2242
 
2243 2243
 }
2244 2244
 
@@ -2256,79 +2256,79 @@  discard block
 block discarded – undo
2256 2256
 function geodir_temp_set_post_attachment()
2257 2257
 {
2258 2258
 
2259
-    global $wpdb, $plugin_prefix;
2259
+	global $wpdb, $plugin_prefix;
2260 2260
 
2261
-    $all_postypes = geodir_get_posttypes();
2261
+	$all_postypes = geodir_get_posttypes();
2262 2262
 
2263
-    foreach ($all_postypes as $posttype) {
2263
+	foreach ($all_postypes as $posttype) {
2264 2264
 
2265
-        $tablename = $plugin_prefix . $posttype . '_detail';
2265
+		$tablename = $plugin_prefix . $posttype . '_detail';
2266 2266
 
2267
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2267
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2268 2268
 
2269
-        if (!empty($get_post_data)) {
2269
+		if (!empty($get_post_data)) {
2270 2270
 
2271
-            foreach ($get_post_data as $data) {
2271
+			foreach ($get_post_data as $data) {
2272 2272
 
2273
-                $post_id = $data->post_id;
2273
+				$post_id = $data->post_id;
2274 2274
 
2275
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2275
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2276 2276
 
2277
-                if (!empty($attachment_data)) {
2277
+				if (!empty($attachment_data)) {
2278 2278
 
2279
-                    foreach ($attachment_data as $attach) {
2279
+					foreach ($attachment_data as $attach) {
2280 2280
 
2281
-                        $file_info = pathinfo($attach->file);
2281
+						$file_info = pathinfo($attach->file);
2282 2282
 
2283
-                        $sub_dir = '';
2284
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2285
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2283
+						$sub_dir = '';
2284
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2285
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2286 2286
 
2287
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2288
-                        $uploads_path = $uploads['basedir'];
2287
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2288
+						$uploads_path = $uploads['basedir'];
2289 2289
 
2290
-                        $file_name = $file_info['basename'];
2290
+						$file_name = $file_info['basename'];
2291 2291
 
2292
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2292
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2293 2293
 
2294
-                        if (!file_exists($img_arr['path'])) {
2294
+						if (!file_exists($img_arr['path'])) {
2295 2295
 
2296
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2296
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2297 2297
 
2298
-                        }
2298
+						}
2299 2299
 
2300
-                    }
2300
+					}
2301 2301
 
2302
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2302
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2303 2303
 
2304
-                    if (!empty($attachment_data)) {
2304
+					if (!empty($attachment_data)) {
2305 2305
 
2306
-                        if ($attachment_data->ID)
2307
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2306
+						if ($attachment_data->ID)
2307
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2308 2308
 
2309
-                    } else {
2309
+					} else {
2310 2310
 
2311
-                        if (has_post_thumbnail($post_id)) {
2311
+						if (has_post_thumbnail($post_id)) {
2312 2312
 
2313
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2313
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2314 2314
 
2315
-                            wp_delete_attachment($post_thumbnail_id);
2315
+							wp_delete_attachment($post_thumbnail_id);
2316 2316
 
2317
-                        }
2317
+						}
2318 2318
 
2319
-                    }
2319
+					}
2320 2320
 
2321
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2321
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2322 2322
 
2323
-                    geodir_set_wp_featured_image($post_id);
2323
+					geodir_set_wp_featured_image($post_id);
2324 2324
 
2325
-                }
2325
+				}
2326 2326
 
2327
-            }
2327
+			}
2328 2328
 
2329
-        }
2329
+		}
2330 2330
 
2331
-    }
2331
+	}
2332 2332
 
2333 2333
 }
2334 2334
 
@@ -2346,9 +2346,9 @@  discard block
 block discarded – undo
2346 2346
 function geodir_default_rating_star_icon()
2347 2347
 {
2348 2348
 
2349
-    if (!get_option('geodir_default_rating_star_icon')) {
2350
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2351
-    }
2349
+	if (!get_option('geodir_default_rating_star_icon')) {
2350
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2351
+	}
2352 2352
 
2353 2353
 }
2354 2354
 
@@ -2366,25 +2366,25 @@  discard block
 block discarded – undo
2366 2366
  */
2367 2367
 function geodir_user_post_listing_count($user_id = 0)
2368 2368
 {
2369
-    global $wpdb, $plugin_prefix, $current_user;
2370
-    if(!$user_id){
2371
-        $user_id = $current_user->ID;
2372
-    }
2369
+	global $wpdb, $plugin_prefix, $current_user;
2370
+	if(!$user_id){
2371
+		$user_id = $current_user->ID;
2372
+	}
2373 2373
 
2374
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2374
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2375 2375
 
2376
-    $user_listing = array();
2377
-    if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2378
-        foreach ($all_posts as $ptype) {
2379
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2376
+	$user_listing = array();
2377
+	if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2378
+		foreach ($all_posts as $ptype) {
2379
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2380 2380
 
2381
-            if ($total_posts > 0) {
2382
-                $user_listing[$ptype] = $total_posts;
2383
-            }
2384
-        }
2385
-    }
2381
+			if ($total_posts > 0) {
2382
+				$user_listing[$ptype] = $total_posts;
2383
+			}
2384
+		}
2385
+	}
2386 2386
 
2387
-    return $user_listing;
2387
+	return $user_listing;
2388 2388
 }
2389 2389
 
2390 2390
 
@@ -2404,189 +2404,189 @@  discard block
 block discarded – undo
2404 2404
  */
2405 2405
 function geodir_detail_page_custom_field_tab($tabs_arr)
2406 2406
 {
2407
-    global $post;
2408
-
2409
-    $post_type = geodir_get_current_posttype();
2410
-    $all_postypes = geodir_get_posttypes();
2411
-
2412
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2413
-        $package_info = array();
2414
-        $package_info = geodir_post_package_info($package_info, $post);
2415
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2416
-        $fields_location = 'owntab';
2417
-
2418
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2419
-        //remove video and special offers if it is already set to show
2420
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2421
-            $unset_video = true;
2422
-        }
2423
-
2424
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2425
-            $unset_special_offers = true;
2426
-        }
2427
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2428
-            foreach($custom_fields as $key => $custom_field){
2429
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2430
-                    unset($custom_fields[$key]);
2431
-                }
2432
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2433
-                    unset($custom_fields[$key]);
2434
-                }
2435
-            }
2436
-        }
2437
-
2438
-
2439
-        if (!empty($custom_fields)) {
2440
-            $parse_custom_fields = array();
2441
-            foreach ($custom_fields as $field) {
2442
-                $field = stripslashes_deep($field); // strip slashes
2443
-                $type = $field;
2444
-                $field_name = $field['htmlvar_name'];
2445
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2446
-                    $post->{$field_name} = $_REQUEST[$field_name];
2447
-                }
2407
+	global $post;
2448 2408
 
2449
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2450
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2451
-                        continue;
2452
-                    }
2409
+	$post_type = geodir_get_current_posttype();
2410
+	$all_postypes = geodir_get_posttypes();
2453 2411
 
2454
-                    $parse_custom_fields[] = $field;
2455
-                }
2456
-            }
2457
-            $custom_fields = $parse_custom_fields;
2458
-        }
2459
-        //print_r($custom_fields);
2460
-        if (!empty($custom_fields)) {
2412
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2413
+		$package_info = array();
2414
+		$package_info = geodir_post_package_info($package_info, $post);
2415
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2416
+		$fields_location = 'owntab';
2461 2417
 
2462
-            global $field_set_start;
2418
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2419
+		//remove video and special offers if it is already set to show
2420
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2421
+			$unset_video = true;
2422
+		}
2463 2423
 
2464
-            $post = stripslashes_deep($post); // strip slashes
2465
-            
2466
-            $field_set_start = 0;
2467
-            $fieldset_count = 0;
2468
-            $fieldset = '';
2469
-            $total_fields = count($custom_fields);
2470
-            $count_field = 0;
2471
-            $fieldset_arr = array();
2472
-            $i = 0;
2473
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2474
-
2475
-            foreach ($custom_fields as $field) {
2476
-                $count_field++;
2477
-                $field_name = $field['htmlvar_name'];
2478
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2479
-                    $post->{$field_name} = $_REQUEST[$field_name];
2480
-                }
2424
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2425
+			$unset_special_offers = true;
2426
+		}
2427
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2428
+			foreach($custom_fields as $key => $custom_field){
2429
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2430
+					unset($custom_fields[$key]);
2431
+				}
2432
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2433
+					unset($custom_fields[$key]);
2434
+				}
2435
+			}
2436
+		}
2481 2437
 
2482
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2483
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2484
-                    $site_title = trim($field['site_title']);
2485
-                    $type = $field;
2486
-                    $variables_array = array();
2487 2438
 
2488
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2489
-                        continue;
2490
-                    }
2439
+		if (!empty($custom_fields)) {
2440
+			$parse_custom_fields = array();
2441
+			foreach ($custom_fields as $field) {
2442
+				$field = stripslashes_deep($field); // strip slashes
2443
+				$type = $field;
2444
+				$field_name = $field['htmlvar_name'];
2445
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2446
+					$post->{$field_name} = $_REQUEST[$field_name];
2447
+				}
2491 2448
 
2492
-                    if ($type['type'] != 'fieldset') {
2493
-                        $i++;
2494
-                        $variables_array['post_id'] = $post->ID;
2495
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2496
-                        $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2497
-
2498
-                    }else{
2499
-                        $i = 0;
2500
-                        $fieldset_count++;
2501
-                        $field_set_start = 1;
2502
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2503
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2504
-                    }
2449
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2450
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2451
+						continue;
2452
+					}
2505 2453
 
2454
+					$parse_custom_fields[] = $field;
2455
+				}
2456
+			}
2457
+			$custom_fields = $parse_custom_fields;
2458
+		}
2459
+		//print_r($custom_fields);
2460
+		if (!empty($custom_fields)) {
2506 2461
 
2507
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2508
-                    $type = stripslashes_deep($type); // strip slashes
2509
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2510
-                    $html = '';
2511
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2512
-                    if($html_var=='post'){$html_var='post_address';}
2513
-                    $field_icon = geodir_field_icon_proccess($type);
2514
-                    $filed_type = $type['type'];
2515
-
2516
-                    /**
2517
-                     * Filter the output for custom fields.
2518
-                     *
2519
-                     * Here we can remove or add new functions depending on the field type.
2520
-                     *
2521
-                     * @param string $html The html to be filtered (blank).
2522
-                     * @param string $fields_location The location the field is to be show.
2523
-                     * @param array $type The array of field values.
2524
-                     */
2525
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2526
-
2527
-
2528
-                    /**
2529
-                     * Filter custom field output in tab.
2530
-                     *
2531
-                     * @since 1.5.6
2532
-                     *
2533
-                     * @param string $html_var The HTML variable name for the field.
2534
-                     * @param string $html Custom field unfiltered HTML.
2535
-                     * @param array $variables_array Custom field variables array.
2536
-                     */
2537
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2538
-
2539
-                    $fieldset_html = '';
2540
-                    if ($field_set_start == 1) {
2541
-                        $add_html = false;
2542
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2543
-                            if ($fieldset != '') {
2544
-                                $add_html = true;
2545
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2546
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2547
-                            }
2548
-                            $fieldset_html = $fieldset;
2549
-                            $fieldset = '';
2550
-                        } else {
2551
-                            $fieldset .= $html;
2552
-                            if ($total_fields == $count_field && $fieldset != '') {
2553
-                                $add_html = true;
2554
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2555
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2556
-                                $fieldset_html = $fieldset;
2557
-                            }
2558
-                        }
2462
+			global $field_set_start;
2559 2463
 
2560
-                        if ($add_html) {
2561
-                            $tabs_arr[$htmlvar_name] = array(
2562
-                                'heading_text' => __($label, 'geodirectory'),
2563
-                                'is_active_tab' => false,
2564
-                                /**
2565
-                                 * Filter if a custom field should be displayed on the details page tab.
2566
-                                 *
2567
-                                 * @since 1.0.0
2568
-                                 * @param string $htmlvar_name The field HTML var name.
2569
-                                 */
2570
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2571
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2572
-                            );
2573
-                        }
2574
-                    } else {
2575
-                        if ($html != '') {
2576
-                            $tabs_arr[$html_var] = array(
2577
-                                'heading_text' => __($label, 'geodirectory'),
2578
-                                'is_active_tab' => false,
2579
-                                /** This action is documented in geodirectory_hooks_actions.php */
2580
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2581
-                                'tab_content' => $html
2582
-                            );
2583
-                        }
2584
-                    }
2585
-                }
2586
-            }
2587
-        }
2588
-    }
2589
-    return $tabs_arr;
2464
+			$post = stripslashes_deep($post); // strip slashes
2465
+            
2466
+			$field_set_start = 0;
2467
+			$fieldset_count = 0;
2468
+			$fieldset = '';
2469
+			$total_fields = count($custom_fields);
2470
+			$count_field = 0;
2471
+			$fieldset_arr = array();
2472
+			$i = 0;
2473
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2474
+
2475
+			foreach ($custom_fields as $field) {
2476
+				$count_field++;
2477
+				$field_name = $field['htmlvar_name'];
2478
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2479
+					$post->{$field_name} = $_REQUEST[$field_name];
2480
+				}
2481
+
2482
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2483
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2484
+					$site_title = trim($field['site_title']);
2485
+					$type = $field;
2486
+					$variables_array = array();
2487
+
2488
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2489
+						continue;
2490
+					}
2491
+
2492
+					if ($type['type'] != 'fieldset') {
2493
+						$i++;
2494
+						$variables_array['post_id'] = $post->ID;
2495
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2496
+						$variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2497
+
2498
+					}else{
2499
+						$i = 0;
2500
+						$fieldset_count++;
2501
+						$field_set_start = 1;
2502
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2503
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2504
+					}
2505
+
2506
+
2507
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2508
+					$type = stripslashes_deep($type); // strip slashes
2509
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2510
+					$html = '';
2511
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2512
+					if($html_var=='post'){$html_var='post_address';}
2513
+					$field_icon = geodir_field_icon_proccess($type);
2514
+					$filed_type = $type['type'];
2515
+
2516
+					/**
2517
+					 * Filter the output for custom fields.
2518
+					 *
2519
+					 * Here we can remove or add new functions depending on the field type.
2520
+					 *
2521
+					 * @param string $html The html to be filtered (blank).
2522
+					 * @param string $fields_location The location the field is to be show.
2523
+					 * @param array $type The array of field values.
2524
+					 */
2525
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2526
+
2527
+
2528
+					/**
2529
+					 * Filter custom field output in tab.
2530
+					 *
2531
+					 * @since 1.5.6
2532
+					 *
2533
+					 * @param string $html_var The HTML variable name for the field.
2534
+					 * @param string $html Custom field unfiltered HTML.
2535
+					 * @param array $variables_array Custom field variables array.
2536
+					 */
2537
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2538
+
2539
+					$fieldset_html = '';
2540
+					if ($field_set_start == 1) {
2541
+						$add_html = false;
2542
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2543
+							if ($fieldset != '') {
2544
+								$add_html = true;
2545
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2546
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2547
+							}
2548
+							$fieldset_html = $fieldset;
2549
+							$fieldset = '';
2550
+						} else {
2551
+							$fieldset .= $html;
2552
+							if ($total_fields == $count_field && $fieldset != '') {
2553
+								$add_html = true;
2554
+								$label = $fieldset_arr[$fieldset_count]['label'];
2555
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2556
+								$fieldset_html = $fieldset;
2557
+							}
2558
+						}
2559
+
2560
+						if ($add_html) {
2561
+							$tabs_arr[$htmlvar_name] = array(
2562
+								'heading_text' => __($label, 'geodirectory'),
2563
+								'is_active_tab' => false,
2564
+								/**
2565
+								 * Filter if a custom field should be displayed on the details page tab.
2566
+								 *
2567
+								 * @since 1.0.0
2568
+								 * @param string $htmlvar_name The field HTML var name.
2569
+								 */
2570
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2571
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2572
+							);
2573
+						}
2574
+					} else {
2575
+						if ($html != '') {
2576
+							$tabs_arr[$html_var] = array(
2577
+								'heading_text' => __($label, 'geodirectory'),
2578
+								'is_active_tab' => false,
2579
+								/** This action is documented in geodirectory_hooks_actions.php */
2580
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2581
+								'tab_content' => $html
2582
+							);
2583
+						}
2584
+					}
2585
+				}
2586
+			}
2587
+		}
2588
+	}
2589
+	return $tabs_arr;
2590 2590
 }
2591 2591
 
2592 2592
 /* display add listing page for wpml */
@@ -2610,41 +2610,41 @@  discard block
 block discarded – undo
2610 2610
  */
2611 2611
 function geodir_add_post_status_author_page()
2612 2612
 {
2613
-    global $wpdb, $post;
2614
-
2615
-    $html = '';
2616
-    if (get_current_user_id()) {
2617
-
2618
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2619
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2620
-
2621
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2622
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2623
-            $status = "<strong>(";
2624
-            $status_icon = '<i class="fa fa-play"></i>';
2625
-            if ($real_status == 'publish') {
2626
-                $status .= __('Published', 'geodirectory');
2627
-            }elseif ($real_status == 'pending') {
2628
-                $status .= __('Awaiting Review', 'geodirectory');
2629
-            } else {
2630
-                $status .= __('Not published', 'geodirectory');
2631
-                $status_icon = '<i class="fa fa-pause"></i>';
2632
-            }
2633
-            $status .= ")</strong>";
2613
+	global $wpdb, $post;
2614
+
2615
+	$html = '';
2616
+	if (get_current_user_id()) {
2617
+
2618
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2619
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2620
+
2621
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2622
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2623
+			$status = "<strong>(";
2624
+			$status_icon = '<i class="fa fa-play"></i>';
2625
+			if ($real_status == 'publish') {
2626
+				$status .= __('Published', 'geodirectory');
2627
+			}elseif ($real_status == 'pending') {
2628
+				$status .= __('Awaiting Review', 'geodirectory');
2629
+			} else {
2630
+				$status .= __('Not published', 'geodirectory');
2631
+				$status_icon = '<i class="fa fa-pause"></i>';
2632
+			}
2633
+			$status .= ")</strong>";
2634 2634
 
2635
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2636
-        }
2637
-    }
2635
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2636
+		}
2637
+	}
2638 2638
 
2639
-    if ($html != '') {
2640
-        /**
2641
-         * Filter the post status text on the author page.
2642
-         *
2643
-         * @since 1.0.0
2644
-         * @param string $html The HTML of the status.
2645
-         */
2646
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2647
-    }
2639
+	if ($html != '') {
2640
+		/**
2641
+		 * Filter the post status text on the author page.
2642
+		 *
2643
+		 * @since 1.0.0
2644
+		 * @param string $html The HTML of the status.
2645
+		 */
2646
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2647
+	}
2648 2648
 
2649 2649
 
2650 2650
 }
@@ -2658,9 +2658,9 @@  discard block
 block discarded – undo
2658 2658
  * @package GeoDirectory
2659 2659
  */
2660 2660
 function geodir_init_no_rating() {
2661
-    if (geodir_rating_disabled_post_types()) {
2662
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2663
-    }
2661
+	if (geodir_rating_disabled_post_types()) {
2662
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2663
+	}
2664 2664
 }
2665 2665
 
2666 2666
 /**
@@ -2674,22 +2674,22 @@  discard block
 block discarded – undo
2674 2674
  * @return array Modified sort options array.
2675 2675
  */
2676 2676
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2677
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2678
-        $new_options = array();
2677
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2678
+		$new_options = array();
2679 2679
         
2680
-        if (!empty($options)) {
2681
-            foreach ($options as $option) {
2682
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2683
-                    continue;
2684
-                }
2685
-                $new_options[] = $option;
2686
-            }
2680
+		if (!empty($options)) {
2681
+			foreach ($options as $option) {
2682
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2683
+					continue;
2684
+				}
2685
+				$new_options[] = $option;
2686
+			}
2687 2687
 
2688
-            $options = $new_options;
2689
-        }
2690
-    }
2688
+			$options = $new_options;
2689
+		}
2690
+	}
2691 2691
 
2692
-    return $options;
2692
+	return $options;
2693 2693
 }
2694 2694
 
2695 2695
 /**
@@ -2701,9 +2701,9 @@  discard block
 block discarded – undo
2701 2701
  * @return array Modified class array.
2702 2702
  */
2703 2703
 function geodir_body_class_active_map($classes = array()) {
2704
-    $classes[] = 'gd-map-' . geodir_map_name();
2704
+	$classes[] = 'gd-map-' . geodir_map_name();
2705 2705
 
2706
-    return $classes;
2706
+	return $classes;
2707 2707
 }
2708 2708
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2709 2709
 
@@ -2716,9 +2716,9 @@  discard block
 block discarded – undo
2716 2716
  * @return string Modified class string.
2717 2717
  */
2718 2718
 function geodir_admin_body_class_active_map($class = '') {    
2719
-    $class .= ' gd-map-' . geodir_map_name();
2719
+	$class .= ' gd-map-' . geodir_map_name();
2720 2720
 
2721
-    return $class;
2721
+	return $class;
2722 2722
 }
2723 2723
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2724 2724
 
@@ -2736,36 +2736,36 @@  discard block
 block discarded – undo
2736 2736
  * @return array Translation texts.
2737 2737
  */
2738 2738
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2739
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2740
-
2741
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2742
-
2743
-    /**
2744
-     * Filters the geodirectory option names that requires to add for translation.
2745
-     *
2746
-     * @since 1.5.7
2747
-     * @package GeoDirectory
2748
-     *
2749
-     * @param  array $gd_options Array of option names.
2750
-     */
2751
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2752
-    $gd_options = array_unique($gd_options);
2753
-
2754
-    if (!empty($gd_options)) {
2755
-        foreach ($gd_options as $gd_option) {
2756
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2757
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2739
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2740
+
2741
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2742
+
2743
+	/**
2744
+	 * Filters the geodirectory option names that requires to add for translation.
2745
+	 *
2746
+	 * @since 1.5.7
2747
+	 * @package GeoDirectory
2748
+	 *
2749
+	 * @param  array $gd_options Array of option names.
2750
+	 */
2751
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2752
+	$gd_options = array_unique($gd_options);
2753
+
2754
+	if (!empty($gd_options)) {
2755
+		foreach ($gd_options as $gd_option) {
2756
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2757
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2758 2758
                 
2759
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2760
-                    $translation_texts[] = stripslashes_deep($option_value);
2761
-                }
2762
-            }
2763
-        }
2764
-    }
2759
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2760
+					$translation_texts[] = stripslashes_deep($option_value);
2761
+				}
2762
+			}
2763
+		}
2764
+	}
2765 2765
 
2766
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2766
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2767 2767
 
2768
-    return $translation_texts;
2768
+	return $translation_texts;
2769 2769
 }
2770 2770
 
2771 2771
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2779,15 +2779,15 @@  discard block
 block discarded – undo
2779 2779
 
2780 2780
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2781 2781
 function gd_get_comments_link($comments_link, $post_id) {
2782
-    $post_type = get_post_type($post_id);
2782
+	$post_type = get_post_type($post_id);
2783 2783
 
2784
-    $all_postypes = geodir_get_posttypes();
2785
-    if (in_array($post_type, $all_postypes)) {
2786
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2787
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2788
-    }
2784
+	$all_postypes = geodir_get_posttypes();
2785
+	if (in_array($post_type, $all_postypes)) {
2786
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2787
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2788
+	}
2789 2789
 
2790
-    return $comments_link;
2790
+	return $comments_link;
2791 2791
 }
2792 2792
 
2793 2793
 
@@ -2805,11 +2805,11 @@  discard block
 block discarded – undo
2805 2805
 function geodir_add_nav_menu_class( $args )
2806 2806
 {
2807 2807
 
2808
-        if(isset($args['menu_class'])){
2809
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2810
-        }
2808
+		if(isset($args['menu_class'])){
2809
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2810
+		}
2811 2811
     
2812
-    return $args;
2812
+	return $args;
2813 2813
 }
2814 2814
 
2815 2815
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2826,15 +2826,15 @@  discard block
 block discarded – undo
2826 2826
  * @return string Filtered locale ID.
2827 2827
  */
2828 2828
 function geodir_wpml_filter_locale($locale) {
2829
-    global $sitepress;
2829
+	global $sitepress;
2830 2830
     
2831
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2831
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2832 2832
     
2833
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2834
-        $locale = $sitepress->get_locale($current_lang);
2835
-    }
2833
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2834
+		$locale = $sitepress->get_locale($current_lang);
2835
+	}
2836 2836
     
2837
-    return $locale;
2837
+	return $locale;
2838 2838
 }
2839 2839
 
2840 2840
 /**
@@ -2844,20 +2844,20 @@  discard block
 block discarded – undo
2844 2844
  * @package GeoDirectory
2845 2845
  */
2846 2846
 function geodir_wpml_set_filter() {
2847
-    if (geodir_is_wpml()) {
2848
-        global $sitepress;
2847
+	if (geodir_is_wpml()) {
2848
+		global $sitepress;
2849 2849
         
2850
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2851
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2852
-        }
2850
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2851
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2852
+		}
2853 2853
         
2854
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2855
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2854
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2855
+		add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2856 2856
 		add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' );
2857
-        if (is_admin()) {
2858
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2859
-        }
2860
-    }
2857
+		if (is_admin()) {
2858
+			add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2859
+		}
2860
+	}
2861 2861
 }
2862 2862
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2863 2863
 
@@ -2870,38 +2870,38 @@  discard block
 block discarded – undo
2870 2870
  * @return array Filtered languages.
2871 2871
  */
2872 2872
 function geodir_wpml_filter_ls_languages($languages) {    
2873
-    if (geodir_is_geodir_page()) {        
2874
-        $keep_vars = array();
2873
+	if (geodir_is_geodir_page()) {        
2874
+		$keep_vars = array();
2875 2875
         
2876
-        if (geodir_is_page('add-listing')) {
2877
-            $keep_vars = array('listing_type', 'package_id');
2878
-        } else if (geodir_is_page('search')) {
2879
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2880
-        } else if (geodir_is_page('author')) {
2881
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2882
-        } else if (geodir_is_page('login')) {
2883
-            $keep_vars = array('forgot', 'signup');
2884
-        }        
2876
+		if (geodir_is_page('add-listing')) {
2877
+			$keep_vars = array('listing_type', 'package_id');
2878
+		} else if (geodir_is_page('search')) {
2879
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2880
+		} else if (geodir_is_page('author')) {
2881
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2882
+		} else if (geodir_is_page('login')) {
2883
+			$keep_vars = array('forgot', 'signup');
2884
+		}        
2885 2885
         
2886
-        if (!empty($keep_vars)) {
2887
-            foreach ( $languages as $code => $url) {
2888
-                $filter_url = $url['url'];
2886
+		if (!empty($keep_vars)) {
2887
+			foreach ( $languages as $code => $url) {
2888
+				$filter_url = $url['url'];
2889 2889
                 
2890
-                foreach ($keep_vars as $var) {
2891
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2892
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2893
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2894
-                    }
2895
-                }
2890
+				foreach ($keep_vars as $var) {
2891
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2892
+						$filter_url = remove_query_arg(array($var), $filter_url);
2893
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2894
+					}
2895
+				}
2896 2896
                 
2897
-                if ($filter_url != $url['url']) {
2898
-                    $languages[$code]['url'] = $filter_url;
2899
-                }
2900
-            }
2901
-        }
2902
-    }
2897
+				if ($filter_url != $url['url']) {
2898
+					$languages[$code]['url'] = $filter_url;
2899
+				}
2900
+			}
2901
+		}
2902
+	}
2903 2903
 
2904
-    return $languages;
2904
+	return $languages;
2905 2905
 }
2906 2906
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2907 2907
 
@@ -2912,18 +2912,18 @@  discard block
 block discarded – undo
2912 2912
  *
2913 2913
  */
2914 2914
 function geodir_remove_yoast_seo_metas(){
2915
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2916
-        $wpseo = WPSEO_Frontend::get_instance();
2915
+	if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2916
+		$wpseo = WPSEO_Frontend::get_instance();
2917 2917
         
2918
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2919
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2920
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2921
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2922
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2923
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2918
+		remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2919
+		remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2920
+		remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2921
+		remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2922
+		remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2923
+		remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2924 2924
         
2925
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2926
-    }
2925
+		remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2926
+	}
2927 2927
 }
2928 2928
 
2929 2929
 /**
@@ -2937,20 +2937,20 @@  discard block
 block discarded – undo
2937 2937
  *
2938 2938
  */
2939 2939
  function geodir_wpml_ajax_set_guest_lang() {    
2940
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2941
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2942
-            global $sitepress;
2940
+	if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2941
+		if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2942
+			global $sitepress;
2943 2943
             
2944
-            $referer = wp_get_referer();
2944
+			$referer = wp_get_referer();
2945 2945
             
2946
-            $current_lang = $sitepress->get_current_language();
2947
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2946
+			$current_lang = $sitepress->get_current_language();
2947
+			$referrer_lang = $sitepress->get_language_from_url( $referer );
2948 2948
             
2949
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2950
-                $_GET['lang'] = $referrer_lang;
2951
-            }
2952
-        }
2953
-    }
2949
+			if ( $referrer_lang && $current_lang != $referrer_lang ) {
2950
+				$_GET['lang'] = $referrer_lang;
2951
+			}
2952
+		}
2953
+	}
2954 2954
 }
2955 2955
 add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2956 2956
 
@@ -2962,36 +2962,36 @@  discard block
 block discarded – undo
2962 2962
  * @param object $wp The WordPress object.
2963 2963
  */
2964 2964
 function geodir_check_redirect($wp) {
2965
-    if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2966
-        $current_url = geodir_curPageURL();
2967
-        $search = 'czech-republic';
2968
-        $replace = 'czechia';        
2965
+	if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2966
+		$current_url = geodir_curPageURL();
2967
+		$search = 'czech-republic';
2968
+		$replace = 'czechia';        
2969 2969
         
2970
-        $has_slash = substr($current_url, -1);
2971
-        if ($has_slash != "/") {
2972
-            $current_url .= '/';
2973
-        }
2970
+		$has_slash = substr($current_url, -1);
2971
+		if ($has_slash != "/") {
2972
+			$current_url .= '/';
2973
+		}
2974 2974
         
2975
-        $redirect = false;
2976
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2977
-            $redirect = true;
2978
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2979
-        }
2975
+		$redirect = false;
2976
+		if (strpos($current_url, '/' . $search . '/') !== false) {
2977
+			$redirect = true;
2978
+			$current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2979
+		}
2980 2980
         
2981
-        if ($has_slash != "/") {
2982
-            $current_url = trim($current_url, '/');
2983
-        }
2981
+		if ($has_slash != "/") {
2982
+			$current_url = trim($current_url, '/');
2983
+		}
2984 2984
         
2985
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2986
-            $redirect = true;
2987
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2988
-        }
2989
-
2990
-        if ($redirect) {
2991
-            wp_redirect($current_url);
2992
-            exit;
2993
-        }
2994
-    }
2985
+		if (strpos($current_url, 'gd_country=' . $search) !== false) {
2986
+			$redirect = true;
2987
+			$current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2988
+		}
2989
+
2990
+		if ($redirect) {
2991
+			wp_redirect($current_url);
2992
+			exit;
2993
+		}
2994
+	}
2995 2995
 }
2996 2996
 add_action('parse_request', 'geodir_check_redirect', 101, 1);
2997 2997
 
@@ -3011,50 +3011,50 @@  discard block
 block discarded – undo
3011 3011
  * @param string $original_slug The original post slug.
3012 3012
  */
3013 3013
 function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3014
-    global $wpdb, $sitepress;
3014
+	global $wpdb, $sitepress;
3015 3015
     
3016
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3017
-        $wpml_post_join = "";
3018
-        $wpml_post_where = "";
3019
-        $wpml_term_join = "";
3020
-        $wpml_term_where = "";
3016
+	if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3017
+		$wpml_post_join = "";
3018
+		$wpml_post_where = "";
3019
+		$wpml_term_join = "";
3020
+		$wpml_term_where = "";
3021 3021
         
3022
-        if (geodir_wpml_is_post_type_translated($post_type)) {
3023
-            $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3024
-            $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3025
-            if (!$post_language) {
3026
-                $post_language = $sitepress->get_current_language();
3027
-            }
3022
+		if (geodir_wpml_is_post_type_translated($post_type)) {
3023
+			$post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3024
+			$post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3025
+			if (!$post_language) {
3026
+				$post_language = $sitepress->get_current_language();
3027
+			}
3028 3028
             
3029
-            $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3030
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3029
+			$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3030
+			$wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3031 3031
             
3032
-            $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3033
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3034
-        }
3032
+			$wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3033
+			$wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3034
+		}
3035 3035
 
3036
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3036
+		$term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3037 3037
 
3038
-        if ( $term_slug_check ) {
3039
-            $suffix = 1;
3038
+		if ( $term_slug_check ) {
3039
+			$suffix = 1;
3040 3040
             
3041
-            do {
3042
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3041
+			do {
3042
+				$alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3043 3043
                 
3044
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3044
+				$term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3045 3045
                 
3046
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3046
+				$post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3047 3047
                 
3048
-                $term_slug_check = $term_check || $post_check;
3048
+				$term_slug_check = $term_check || $post_check;
3049 3049
                 
3050
-                $suffix++;
3051
-            } while ( $term_slug_check );
3050
+				$suffix++;
3051
+			} while ( $term_slug_check );
3052 3052
             
3053
-            $slug = $alt_slug;
3054
-        }
3055
-    }
3053
+			$slug = $alt_slug;
3054
+		}
3055
+	}
3056 3056
     
3057
-    return $slug;
3057
+	return $slug;
3058 3058
 }
3059 3059
 add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3060 3060
 
@@ -3074,48 +3074,48 @@  discard block
 block discarded – undo
3074 3074
  * @return bool true when exists. false when not exists.
3075 3075
  */
3076 3076
 function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3077
-    global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3077
+	global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3078 3078
     
3079
-    if ( $slug_exists ) {
3080
-        return $slug_exists;
3081
-    }
3079
+	if ( $slug_exists ) {
3080
+		return $slug_exists;
3081
+	}
3082 3082
     
3083
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3084
-        $taxonomy = $gd_term_taxonomy[$term_id];
3085
-    } else {
3086
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3087
-        $gd_term_taxonomy[$term_id] = $taxonomy;
3088
-    }
3083
+	if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3084
+		$taxonomy = $gd_term_taxonomy[$term_id];
3085
+	} else {
3086
+		$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3087
+		$gd_term_taxonomy[$term_id] = $taxonomy;
3088
+	}
3089 3089
     
3090
-    if ( empty($taxonomy) ) {
3091
-        return $slug_exists;
3092
-    }
3090
+	if ( empty($taxonomy) ) {
3091
+		return $slug_exists;
3092
+	}
3093 3093
     
3094
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3095
-        $post_type = $gd_term_post_type[$term_id];
3096
-    } else {
3097
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3098
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3099
-    }
3094
+	if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3095
+		$post_type = $gd_term_post_type[$term_id];
3096
+	} else {
3097
+		$taxonomy_obj = get_taxonomy( $taxonomy );
3098
+		$post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3099
+	}
3100 3100
     
3101
-    $wpml_post_join = "";
3102
-    $wpml_post_where = "";
3101
+	$wpml_post_join = "";
3102
+	$wpml_post_where = "";
3103 3103
     
3104
-    if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3105
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3106
-        if (!$term_language) {
3107
-            $term_language = $sitepress->get_current_language();
3108
-        }
3104
+	if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3105
+		$term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3106
+		if (!$term_language) {
3107
+			$term_language = $sitepress->get_current_language();
3108
+		}
3109 3109
         
3110
-        $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3111
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3112
-    }
3110
+		$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3111
+		$wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3112
+	}
3113 3113
     
3114
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3115
-        $slug_exists = true;
3116
-    }
3114
+	if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3115
+		$slug_exists = true;
3116
+	}
3117 3117
 
3118
-    return $slug_exists;
3118
+	return $slug_exists;
3119 3119
 }
3120 3120
 add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3121 3121
 
Please login to merge, or discard this patch.
Spacing   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 /* WP REVIEW COUNT ACTIONS */
177 177
 ////////////////////////
178 178
 
179
-add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
179
+add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
180 180
 //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
181
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
181
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
182 182
 //add_action('created_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
184 184
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
227 227
     if ($geodir_theme_location) {
228 228
         update_option('geodir_theme_location_nav', $geodir_theme_location);
229 229
     } else {
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     include_once('geodirectory-functions/listing_filters.php');
259 259
     
260 260
     // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
261
+    if (isset($_REQUEST['geodir_search']) && class_exists('Theme_My_Login')) {
262
+        remove_action('pre_get_posts', array(Theme_My_Login::get_object(), 'pre_get_posts'));
263 263
     }
264 264
     
265
-    if ( isset( $_REQUEST['geodir_search'] ) ) {
266
-        add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
-        add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
265
+    if (isset($_REQUEST['geodir_search'])) {
266
+        add_filter('geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3);
267
+        add_filter('geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3);
268 268
     }
269 269
 }
270 270
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 
332 332
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
333 333
 
334
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
335
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
334
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
335
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
336 336
 
337 337
 // Detail page sidebar content 
338 338
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
     do_action('geodir_after_social_sharing_buttons');
433 433
     $content_html = ob_get_clean();
434 434
     if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
435
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
436
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
437 437
         /**
438 438
          * Filter the geodir_social_sharing_buttons() function content.
439 439
          *
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
             $post_id = $post->ID;
474 474
             
475 475
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
-                $post_id = (int)$_REQUEST['pid'];
476
+                $post_id = (int) $_REQUEST['pid'];
477 477
             }
478 478
 
479 479
             $postlink = get_permalink(geodir_add_listing_page_id());
480 480
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
481
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
482 482
         }
483 483
     }// end of if, if its a preview or not
484 484
     /**
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
     do_action('geodir_after_edit_post_link');
490 490
     $content_html = ob_get_clean();
491 491
     if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
492
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
493
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
494 494
         /**
495 495
          * Filter the geodir_edit_post_link() function content.
496 496
          *
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function geodir_detail_page_google_analytics()
513 513
 {
514
-    if ( ! get_option( 'geodir_ga_stats' ) ) {
514
+    if (!get_option('geodir_ga_stats')) {
515 515
 		return;
516 516
 	}
517
-	global $post,$preview;
518
-    if($preview){return '';}
517
+	global $post, $preview;
518
+    if ($preview) {return ''; }
519 519
     $package_info = array();
520 520
     $package_info = geodir_post_package_info($package_info, $post);
521 521
 
@@ -547,14 +547,14 @@  discard block
 block discarded – undo
547 547
     $hide_refresh = get_option('geodir_ga_auto_refresh');
548 548
     
549 549
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
-    if (is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
550
+    if (is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
551 551
         $page_url = urlencode($_SERVER['REQUEST_URI']);
552 552
         ?>
553 553
         <script type="text/javascript">
554 554
             var gd_gaTimeOut;
555
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
556
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
557
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
555
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
556
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
557
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
558 558
             ga_data1 = false;
559 559
             ga_data2 = false;
560 560
             ga_data3 = false;
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
             }
696 696
 
697 697
             function gdga_noResults() {
698
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
698
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
699 699
                 jQuery('#gdga-legend-container').html('');
700 700
             }
701 701
 
@@ -727,18 +727,18 @@  discard block
 block discarded – undo
727 727
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
728 728
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
729 729
 
730
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
731
-                        '<?php _e('Feb', 'geodirectory');?>',
732
-                        '<?php _e('Mar', 'geodirectory');?>',
733
-                        '<?php _e('Apr', 'geodirectory');?>',
734
-                        '<?php _e('May', 'geodirectory');?>',
735
-                        '<?php _e('Jun', 'geodirectory');?>',
736
-                        '<?php _e('Jul', 'geodirectory');?>',
737
-                        '<?php _e('Aug', 'geodirectory');?>',
738
-                        '<?php _e('Sep', 'geodirectory');?>',
739
-                        '<?php _e('Oct', 'geodirectory');?>',
740
-                        '<?php _e('Nov', 'geodirectory');?>',
741
-                        '<?php _e('Dec', 'geodirectory');?>'];
730
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
731
+                        '<?php _e('Feb', 'geodirectory'); ?>',
732
+                        '<?php _e('Mar', 'geodirectory'); ?>',
733
+                        '<?php _e('Apr', 'geodirectory'); ?>',
734
+                        '<?php _e('May', 'geodirectory'); ?>',
735
+                        '<?php _e('Jun', 'geodirectory'); ?>',
736
+                        '<?php _e('Jul', 'geodirectory'); ?>',
737
+                        '<?php _e('Aug', 'geodirectory'); ?>',
738
+                        '<?php _e('Sep', 'geodirectory'); ?>',
739
+                        '<?php _e('Oct', 'geodirectory'); ?>',
740
+                        '<?php _e('Nov', 'geodirectory'); ?>',
741
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
742 742
 
743 743
                     // Ensure the data arrays are at least as long as the labels array.
744 744
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
                         labels : labels,
752 752
                         datasets : [
753 753
                             {
754
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
754
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
755 755
                                 fillColor : "rgba(220,220,220,0.5)",
756 756
                                 strokeColor : "rgba(220,220,220,1)",
757 757
                                 data : data2
758 758
                             },
759 759
                             {
760
-                                label: '<?php _e('This Year', 'geodirectory');?>',
760
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
761 761
                                 fillColor : "rgba(151,187,205,0.5)",
762 762
                                 strokeColor : "rgba(151,187,205,1)",
763 763
                                 data : data1
@@ -802,30 +802,30 @@  discard block
 block discarded – undo
802 802
 
803 803
                     <?php
804 804
                     // Here we list the shorthand days of the week so it can be used in translation.
805
-                    __("Mon",'geodirectory');
806
-                    __("Tue",'geodirectory');
807
-                    __("Wed",'geodirectory');
808
-                    __("Thu",'geodirectory');
809
-                    __("Fri",'geodirectory');
810
-                    __("Sat",'geodirectory');
811
-                    __("Sun",'geodirectory');
805
+                    __("Mon", 'geodirectory');
806
+                    __("Tue", 'geodirectory');
807
+                    __("Wed", 'geodirectory');
808
+                    __("Thu", 'geodirectory');
809
+                    __("Fri", 'geodirectory');
810
+                    __("Sat", 'geodirectory');
811
+                    __("Sun", 'geodirectory');
812 812
                     ?>
813 813
 
814 814
                     labels = [
815
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
816
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
817
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
818
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
819
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
820
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
821
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
815
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
816
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
817
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
818
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
819
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
820
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
821
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
822 822
                     ];
823 823
 
824 824
                     var data = {
825 825
                         labels : labels,
826 826
                         datasets : [
827 827
                             {
828
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
828
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
829 829
                                 fillColor : "rgba(220,220,220,0.5)",
830 830
                                 strokeColor : "rgba(220,220,220,1)",
831 831
                                 pointColor : "rgba(220,220,220,1)",
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                                 data : data2
834 834
                             },
835 835
                             {
836
-                                label: '<?php _e('This Week', 'geodirectory');?>',
836
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
837 837
                                 fillColor : "rgba(151,187,205,0.5)",
838 838
                                 strokeColor : "rgba(151,187,205,1)",
839 839
                                 pointColor : "rgba(151,187,205,1)",
@@ -1040,18 +1040,18 @@  discard block
 block discarded – undo
1040 1040
         </style>
1041 1041
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1042 1042
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1043
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1043
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1044 1044
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1045
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1045
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1046 1046
             <div id="gd-active-users-container">
1047
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1047
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1048 1048
                     <b class="gd-ActiveUsers-value">0</b>
1049 1049
                 </div>
1050 1050
             </div>
1051 1051
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1052
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1053
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1054
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1052
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1053
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1054
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1055 1055
             </select>
1056 1056
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1057 1057
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1067,8 +1067,8 @@  discard block
 block discarded – undo
1067 1067
     do_action('geodir_after_google_analytics');
1068 1068
     $content_html = ob_get_clean();
1069 1069
     if (trim($content_html) != '')
1070
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1070
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1071
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1072 1072
         /**
1073 1073
          * Filter the geodir_edit_post_link() function content.
1074 1074
          *
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 {
1095 1095
     global $post, $preview, $post_images;
1096 1096
     
1097
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1097
+    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) {
1098 1098
         return;
1099 1099
     }
1100 1100
     ob_start(); // Start  buffering;
@@ -1129,10 +1129,10 @@  discard block
 block discarded – undo
1129 1129
        
1130 1130
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1131 1131
 	   
1132
-	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1132
+	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />';
1133 1133
 
1134 1134
         $html .= '<span class="item">';
1135
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1135
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1136 1136
 
1137 1137
         if ($post_images) {
1138 1138
             foreach ($post_images as $img) {
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
         }
1143 1143
 
1144 1144
         if (isset($post_img) && $post_img) {
1145
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1145
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1146 1146
         }
1147 1147
 
1148 1148
         $html .= '</span>';
@@ -1169,9 +1169,9 @@  discard block
 block discarded – undo
1169 1169
     do_action('geodir_after_detail_page_review_rating');
1170 1170
     $content_html = ob_get_clean();
1171 1171
     if (trim($content_html) != '') {
1172
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1172
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1173 1173
     }
1174
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1174
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1175 1175
         /**
1176 1176
          * Filter the geodir_detail_page_review_rating() function content.
1177 1177
          *
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
 
1211 1211
     $content_html = ob_get_clean();
1212 1212
     if (trim($content_html) != '')
1213
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1213
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1214
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1215 1215
         /**
1216 1216
          * Filter the output html for function geodir_detail_page_more_info().
1217 1217
          *
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1313 1313
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1314 1314
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1315
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1315
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1316 1316
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1317 1317
         'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318 1318
         'geodir_map_name' => geodir_map_name(),
@@ -1342,10 +1342,10 @@  discard block
 block discarded – undo
1342 1342
     foreach ($arr_alert_msg as $key => $value) {
1343 1343
         if (!is_scalar($value))
1344 1344
             continue;
1345
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1345
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1346 1346
     }
1347 1347
 
1348
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1348
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1349 1349
     echo '<script>';
1350 1350
     echo $script;
1351 1351
     echo '</script>';
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
         $geodir_old_sidebars = get_option('geodir_sidebars');
1436 1436
         if (is_array($geodir_old_sidebars)) {
1437 1437
             foreach ($geodir_old_sidebars as $key => $val) {
1438
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1438
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1439 1439
                 {
1440 1440
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1441 1441
                 }
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
         global $post;
1515 1515
         $term_condition = '';
1516 1516
         if (isset($_REQUEST['backandedit'])) {
1517
-            $post = (object)$gd_session->get('listing');
1517
+            $post = (object) $gd_session->get('listing');
1518 1518
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1519 1519
         }
1520 1520
 
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
                     echo 'checked="checked"';
1529 1529
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1530 1530
                        class="geodir_textfield" value="1"
1531
-                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1531
+                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1532 1532
 				</span>
1533 1533
             </div>
1534 1534
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
         /** This action is documented in geodirectory_template_actions.php */
1569 1569
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1570 1570
         
1571
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1571
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1572 1572
             $is_display = false;
1573 1573
         }
1574 1574
     }
@@ -1616,16 +1616,16 @@  discard block
 block discarded – undo
1616 1616
     global $wpdb, $plugin_prefix;
1617 1617
 	
1618 1618
 	// Remove unused virtual page
1619
-	$listings_page_id = (int)get_option('geodir_listing_page');
1619
+	$listings_page_id = (int) get_option('geodir_listing_page');
1620 1620
 	if ($listings_page_id) {
1621
-		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1621
+		$wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1622 1622
         delete_option('geodir_listing_page');
1623 1623
 	}
1624 1624
 
1625 1625
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1626 1626
         $wpdb->query(
1627 1627
             $wpdb->prepare(
1628
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1628
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1629 1629
                 array('1', '1', 'admin')
1630 1630
             )
1631 1631
         );
@@ -1633,9 +1633,9 @@  discard block
 block discarded – undo
1633 1633
 
1634 1634
         /* --- terms meta value set --- */
1635 1635
 
1636
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1636
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1637 1637
 
1638
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1638
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1639 1639
 
1640 1640
         if (!empty($options_data)) {
1641 1641
 
@@ -1643,7 +1643,7 @@  discard block
 block discarded – undo
1643 1643
 
1644 1644
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1645 1645
 
1646
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1646
+                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1647 1647
 
1648 1648
                 if (!empty($taxonomies_data)) {
1649 1649
 
@@ -1652,17 +1652,17 @@  discard block
 block discarded – undo
1652 1652
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1653 1653
                         $post_type = $taxObject->object_type[0];
1654 1654
 
1655
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1655
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1656 1656
 
1657
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1657
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1658 1658
 
1659 1659
                         if ($duplicate_data) {
1660 1660
 
1661
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1661
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1662 1662
 
1663 1663
                         } else {
1664 1664
 
1665
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1665
+                            $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1666 1666
 
1667 1667
                         }
1668 1668
 
@@ -1696,14 +1696,14 @@  discard block
 block discarded – undo
1696 1696
 
1697 1697
     global $wpdb, $table_prefix;
1698 1698
 
1699
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1699
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1700 1700
 
1701 1701
     if ($slug_exists) {
1702 1702
 
1703 1703
         $suffix = 1;
1704 1704
         do {
1705
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1706
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1705
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1706
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1707 1707
             $suffix++;
1708 1708
         } while ($location_slug_check && $suffix < 100);
1709 1709
 
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 
1758 1758
         $suffix = 1;
1759 1759
         do {
1760
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1760
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1761 1761
 
1762 1762
             /** This action is documented in geodirectory_hooks_actions.php */
1763 1763
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
 
1770 1770
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1771 1771
 
1772
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1772
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1773 1773
 
1774 1774
     }
1775 1775
 	
@@ -1778,18 +1778,18 @@  discard block
 block discarded – undo
1778 1778
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1779 1779
 	
1780 1780
 	$post_types = geodir_get_posttypes();
1781
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1782
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1781
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1782
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1783 1783
 		
1784 1784
 		if (!empty($posts_obj)) {
1785 1785
 			foreach ($posts_obj as $post_obj) {
1786 1786
 				$post_id = $post_obj->object_id;
1787 1787
 				
1788
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1788
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1789 1789
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1790 1790
 				
1791
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1792
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1791
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1792
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1793 1793
 			}
1794 1794
 		}
1795 1795
 	}
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1824 1824
         return $slug_exists = true;
1825 1825
 
1826
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1826
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1827 1827
         return $slug_exists = true;
1828 1828
 
1829 1829
     return $slug_exists;
@@ -1864,43 +1864,43 @@  discard block
 block discarded – undo
1864 1864
 
1865 1865
 
1866 1866
     $gd_page = '';
1867
-    if(geodir_is_page('home')){
1867
+    if (geodir_is_page('home')) {
1868 1868
         $gd_page = 'home';
1869 1869
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1870 1870
     }
1871
-    elseif(geodir_is_page('detail')){
1871
+    elseif (geodir_is_page('detail')) {
1872 1872
         $gd_page = 'detail';
1873 1873
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1874 1874
     }
1875
-    elseif(geodir_is_page('pt')){
1875
+    elseif (geodir_is_page('pt')) {
1876 1876
         $gd_page = 'pt';
1877 1877
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1878 1878
     }
1879
-    elseif(geodir_is_page('listing')){
1879
+    elseif (geodir_is_page('listing')) {
1880 1880
         $gd_page = 'listing';
1881 1881
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1882 1882
     }
1883
-    elseif(geodir_is_page('location')){
1883
+    elseif (geodir_is_page('location')) {
1884 1884
         $gd_page = 'location';
1885 1885
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1886 1886
     }
1887
-    elseif(geodir_is_page('search')){
1887
+    elseif (geodir_is_page('search')) {
1888 1888
         $gd_page = 'search';
1889 1889
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1890 1890
     }
1891
-    elseif(geodir_is_page('add-listing')){
1891
+    elseif (geodir_is_page('add-listing')) {
1892 1892
         $gd_page = 'add-listing';
1893 1893
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1894 1894
     }
1895
-    elseif(geodir_is_page('author')){
1895
+    elseif (geodir_is_page('author')) {
1896 1896
         $gd_page = 'author';
1897 1897
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1898 1898
     }
1899
-    elseif(geodir_is_page('login')){
1899
+    elseif (geodir_is_page('login')) {
1900 1900
         $gd_page = 'login';
1901 1901
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1902 1902
     }
1903
-    elseif(geodir_is_page('listing-success')){
1903
+    elseif (geodir_is_page('listing-success')) {
1904 1904
         $gd_page = 'listing-success';
1905 1905
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1906 1906
     }
@@ -1932,12 +1932,12 @@  discard block
 block discarded – undo
1932 1932
 
1933 1933
     if (!get_option('geodir_set_post_attachments')) {
1934 1934
 
1935
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1936
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1935
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1936
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1937 1937
 
1938 1938
         $all_postypes = geodir_get_posttypes();
1939 1939
 
1940
-        foreach($all_postypes as $post_type){
1940
+        foreach ($all_postypes as $post_type) {
1941 1941
             $args = array(
1942 1942
                 'posts_per_page' => -1,
1943 1943
                 'post_type' => $post_type,
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
 {
2032 2032
     $user_id = get_current_user_id();
2033 2033
 
2034
-    if(!$user_id){return $post;}
2034
+    if (!$user_id) {return $post; }
2035 2035
 
2036 2036
     $gd_post_types = geodir_get_posttypes();
2037 2037
 
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
 
2141 2141
         if (array_key_exists('post_video', $tabs_arr)) {
2142 2142
 
2143
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2143
+            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2144 2144
 
2145 2145
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2146 2146
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
 
2149 2149
         if (array_key_exists('special_offers', $tabs_arr)) {
2150 2150
 
2151
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2151
+            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2152 2152
 
2153 2153
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2154 2154
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2169,7 +2169,7 @@  discard block
 block discarded – undo
2169 2169
  */
2170 2170
 function geodir_remove_template_redirect_actions()
2171 2171
 {
2172
-    if (geodir_is_page('login')){
2172
+    if (geodir_is_page('login')) {
2173 2173
         remove_all_actions('template_redirect');
2174 2174
         remove_action('init', 'avia_modify_front', 10);
2175 2175
     }
@@ -2216,25 +2216,25 @@  discard block
 block discarded – undo
2216 2216
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2217 2217
 
2218 2218
         $wpdb->query(
2219
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2219
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2220 2220
                 array($post_id, $split_img_file_path)
2221 2221
             )
2222 2222
         );
2223 2223
 
2224 2224
         $attachment_data = $wpdb->get_row(
2225
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2225
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2226 2226
                 array($post_id)
2227 2227
             )
2228 2228
         );
2229 2229
 
2230 2230
         if (!empty($attachment_data)) {
2231
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2231
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2232 2232
         }
2233 2233
 
2234 2234
 
2235
-        $table_name = $plugin_prefix . $post_type . '_detail';
2235
+        $table_name = $plugin_prefix.$post_type.'_detail';
2236 2236
 
2237
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2237
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2238 2238
 
2239 2239
         geodir_set_wp_featured_image($post_id);
2240 2240
 
@@ -2262,9 +2262,9 @@  discard block
 block discarded – undo
2262 2262
 
2263 2263
     foreach ($all_postypes as $posttype) {
2264 2264
 
2265
-        $tablename = $plugin_prefix . $posttype . '_detail';
2265
+        $tablename = $plugin_prefix.$posttype.'_detail';
2266 2266
 
2267
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2267
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2268 2268
 
2269 2269
         if (!empty($get_post_data)) {
2270 2270
 
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 
2273 2273
                 $post_id = $data->post_id;
2274 2274
 
2275
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2275
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2276 2276
 
2277 2277
                 if (!empty($attachment_data)) {
2278 2278
 
@@ -2289,22 +2289,22 @@  discard block
 block discarded – undo
2289 2289
 
2290 2290
                         $file_name = $file_info['basename'];
2291 2291
 
2292
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2292
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2293 2293
 
2294 2294
                         if (!file_exists($img_arr['path'])) {
2295 2295
 
2296
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2296
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2297 2297
 
2298 2298
                         }
2299 2299
 
2300 2300
                     }
2301 2301
 
2302
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2302
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2303 2303
 
2304 2304
                     if (!empty($attachment_data)) {
2305 2305
 
2306 2306
                         if ($attachment_data->ID)
2307
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2307
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2308 2308
 
2309 2309
                     } else {
2310 2310
 
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
 
2319 2319
                     }
2320 2320
 
2321
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2321
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2322 2322
 
2323 2323
                     geodir_set_wp_featured_image($post_id);
2324 2324
 
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
 {
2348 2348
 
2349 2349
     if (!get_option('geodir_default_rating_star_icon')) {
2350
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2350
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2351 2351
     }
2352 2352
 
2353 2353
 }
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 function geodir_user_post_listing_count($user_id = 0)
2368 2368
 {
2369 2369
     global $wpdb, $plugin_prefix, $current_user;
2370
-    if(!$user_id){
2370
+    if (!$user_id) {
2371 2371
         $user_id = $current_user->ID;
2372 2372
     }
2373 2373
 
@@ -2376,7 +2376,7 @@  discard block
 block discarded – undo
2376 2376
     $user_listing = array();
2377 2377
     if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2378 2378
         foreach ($all_posts as $ptype) {
2379
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2379
+            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2380 2380
 
2381 2381
             if ($total_posts > 0) {
2382 2382
                 $user_listing[$ptype] = $total_posts;
@@ -2417,19 +2417,19 @@  discard block
 block discarded – undo
2417 2417
 
2418 2418
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2419 2419
         //remove video and special offers if it is already set to show
2420
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2420
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2421 2421
             $unset_video = true;
2422 2422
         }
2423 2423
 
2424
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2424
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2425 2425
             $unset_special_offers = true;
2426 2426
         }
2427
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2428
-            foreach($custom_fields as $key => $custom_field){
2429
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2427
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2428
+            foreach ($custom_fields as $key => $custom_field) {
2429
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2430 2430
                     unset($custom_fields[$key]);
2431 2431
                 }
2432
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2432
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2433 2433
                     unset($custom_fields[$key]);
2434 2434
                 }
2435 2435
             }
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
                     $post->{$field_name} = $_REQUEST[$field_name];
2447 2447
                 }
2448 2448
 
2449
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2449
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
2450 2450
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2451 2451
                         continue;
2452 2452
                     }
@@ -2479,7 +2479,7 @@  discard block
 block discarded – undo
2479 2479
                     $post->{$field_name} = $_REQUEST[$field_name];
2480 2480
                 }
2481 2481
 
2482
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2482
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
2483 2483
                     $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2484 2484
                     $site_title = trim($field['site_title']);
2485 2485
                     $type = $field;
@@ -2495,21 +2495,21 @@  discard block
 block discarded – undo
2495 2495
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2496 2496
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2497 2497
 
2498
-                    }else{
2498
+                    } else {
2499 2499
                         $i = 0;
2500 2500
                         $fieldset_count++;
2501 2501
                         $field_set_start = 1;
2502
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2502
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2503 2503
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2504 2504
                     }
2505 2505
 
2506 2506
 
2507
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2507
+                    if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
2508 2508
                     $type = stripslashes_deep($type); // strip slashes
2509
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2509
+                    if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
2510 2510
                     $html = '';
2511 2511
                     $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2512
-                    if($html_var=='post'){$html_var='post_address';}
2512
+                    if ($html_var == 'post') {$html_var = 'post_address'; }
2513 2513
                     $field_icon = geodir_field_icon_proccess($type);
2514 2514
                     $filed_type = $type['type'];
2515 2515
 
@@ -2522,7 +2522,7 @@  discard block
 block discarded – undo
2522 2522
                      * @param string $fields_location The location the field is to be show.
2523 2523
                      * @param array $type The array of field values.
2524 2524
                      */
2525
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2525
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2526 2526
 
2527 2527
 
2528 2528
                     /**
@@ -2568,7 +2568,7 @@  discard block
 block discarded – undo
2568 2568
                                  * @param string $htmlvar_name The field HTML var name.
2569 2569
                                  */
2570 2570
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2571
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2571
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2572 2572
                             );
2573 2573
                         }
2574 2574
                     } else {
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
             }
2633 2633
             $status .= ")</strong>";
2634 2634
 
2635
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2635
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2636 2636
         }
2637 2637
     }
2638 2638
 
@@ -2701,7 +2701,7 @@  discard block
 block discarded – undo
2701 2701
  * @return array Modified class array.
2702 2702
  */
2703 2703
 function geodir_body_class_active_map($classes = array()) {
2704
-    $classes[] = 'gd-map-' . geodir_map_name();
2704
+    $classes[] = 'gd-map-'.geodir_map_name();
2705 2705
 
2706 2706
     return $classes;
2707 2707
 }
@@ -2716,7 +2716,7 @@  discard block
 block discarded – undo
2716 2716
  * @return string Modified class string.
2717 2717
  */
2718 2718
 function geodir_admin_body_class_active_map($class = '') {    
2719
-    $class .= ' gd-map-' . geodir_map_name();
2719
+    $class .= ' gd-map-'.geodir_map_name();
2720 2720
 
2721 2721
     return $class;
2722 2722
 }
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
  * @return array Translation texts.
2737 2737
  */
2738 2738
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2739
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2739
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2740 2740
 
2741 2741
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2742 2742
 
@@ -2802,17 +2802,17 @@  discard block
 block discarded – undo
2802 2802
  * @param array $args The array of menu arguments.
2803 2803
  * @return array The modified arguments.
2804 2804
  */
2805
-function geodir_add_nav_menu_class( $args )
2805
+function geodir_add_nav_menu_class($args)
2806 2806
 {
2807 2807
 
2808
-        if(isset($args['menu_class'])){
2808
+        if (isset($args['menu_class'])) {
2809 2809
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2810 2810
         }
2811 2811
     
2812 2812
     return $args;
2813 2813
 }
2814 2814
 
2815
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2815
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2816 2816
 
2817 2817
 /**
2818 2818
  * Filters WordPress locale ID.
@@ -2852,10 +2852,10 @@  discard block
 block discarded – undo
2852 2852
         }
2853 2853
         
2854 2854
         add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2855
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2856
-		add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' );
2855
+        add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1);
2856
+		add_action('geodir_after_search_form', 'geodir_wpml_add_language_input_field');
2857 2857
         if (is_admin()) {
2858
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2858
+            add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1);
2859 2859
         }
2860 2860
     }
2861 2861
 }
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
         }        
2885 2885
         
2886 2886
         if (!empty($keep_vars)) {
2887
-            foreach ( $languages as $code => $url) {
2887
+            foreach ($languages as $code => $url) {
2888 2888
                 $filter_url = $url['url'];
2889 2889
                 
2890 2890
                 foreach ($keep_vars as $var) {
@@ -2903,7 +2903,7 @@  discard block
 block discarded – undo
2903 2903
 
2904 2904
     return $languages;
2905 2905
 }
2906
-add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2906
+add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1);
2907 2907
 
2908 2908
 /**
2909 2909
  * Remove Yoast SEO hook if disabled on GD pages.
@@ -2911,18 +2911,18 @@  discard block
 block discarded – undo
2911 2911
  * @since 1.6.18
2912 2912
  *
2913 2913
  */
2914
-function geodir_remove_yoast_seo_metas(){
2915
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2914
+function geodir_remove_yoast_seo_metas() {
2915
+    if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) {
2916 2916
         $wpseo = WPSEO_Frontend::get_instance();
2917 2917
         
2918
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2919
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2920
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2921
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2922
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2923
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2918
+        remove_action('wp_head', array($wpseo, 'metadesc'), 6);
2919
+        remove_action('wp_head', array($wpseo, 'metakeywords'), 11);
2920
+        remove_filter('pre_get_document_title', array($wpseo, 'title'), 15);
2921
+        remove_filter('wp_title', array($wpseo, 'title'), 15, 3);
2922
+        remove_filter('thematic_doctitle', array($wpseo, 'title'), 15);
2923
+        remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99);
2924 2924
         
2925
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2925
+        remove_action('template_redirect', 'wpseo_frontend_head_init', 999);
2926 2926
     }
2927 2927
 }
2928 2928
 
@@ -2937,22 +2937,22 @@  discard block
 block discarded – undo
2937 2937
  *
2938 2938
  */
2939 2939
  function geodir_wpml_ajax_set_guest_lang() {    
2940
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2941
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2940
+    if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) {
2941
+        if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) {
2942 2942
             global $sitepress;
2943 2943
             
2944 2944
             $referer = wp_get_referer();
2945 2945
             
2946 2946
             $current_lang = $sitepress->get_current_language();
2947
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2947
+            $referrer_lang = $sitepress->get_language_from_url($referer);
2948 2948
             
2949
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2949
+            if ($referrer_lang && $current_lang != $referrer_lang) {
2950 2950
                 $_GET['lang'] = $referrer_lang;
2951 2951
             }
2952 2952
         }
2953 2953
     }
2954 2954
 }
2955
-add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2955
+add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1);
2956 2956
 
2957 2957
 /**
2958 2958
  * Change country slug czech-republic to czechia and redirect.
@@ -2973,18 +2973,18 @@  discard block
 block discarded – undo
2973 2973
         }
2974 2974
         
2975 2975
         $redirect = false;
2976
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2976
+        if (strpos($current_url, '/'.$search.'/') !== false) {
2977 2977
             $redirect = true;
2978
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2978
+            $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1);
2979 2979
         }
2980 2980
         
2981 2981
         if ($has_slash != "/") {
2982 2982
             $current_url = trim($current_url, '/');
2983 2983
         }
2984 2984
         
2985
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2985
+        if (strpos($current_url, 'gd_country='.$search) !== false) {
2986 2986
             $redirect = true;
2987
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2987
+            $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url);
2988 2988
         }
2989 2989
 
2990 2990
         if ($redirect) {
@@ -3010,10 +3010,10 @@  discard block
 block discarded – undo
3010 3010
  * @param int    $post_parent   Post parent ID
3011 3011
  * @param string $original_slug The original post slug.
3012 3012
  */
3013
-function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3013
+function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
3014 3014
     global $wpdb, $sitepress;
3015 3015
     
3016
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3016
+    if ($post_type && strpos($post_type, 'gd_') === 0) {
3017 3017
         $wpml_post_join = "";
3018 3018
         $wpml_post_where = "";
3019 3019
         $wpml_term_join = "";
@@ -3027,28 +3027,28 @@  discard block
 block discarded – undo
3027 3027
             }
3028 3028
             
3029 3029
             $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3030
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3030
+            $wpml_post_where = " AND icl_t.language_code = '".$post_language."'";
3031 3031
             
3032 3032
             $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3033
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3033
+            $wpml_term_where = " AND icl_t.language_code = '".$post_language."'";
3034 3034
         }
3035 3035
 
3036
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3036
+        $term_slug_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $slug));
3037 3037
 
3038
-        if ( $term_slug_check ) {
3038
+        if ($term_slug_check) {
3039 3039
             $suffix = 1;
3040 3040
             
3041 3041
             do {
3042
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3042
+                $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix";
3043 3043
                 
3044
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3044
+                $term_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug));
3045 3045
                 
3046
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3046
+                $post_check = !$term_check && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID));
3047 3047
                 
3048 3048
                 $term_slug_check = $term_check || $post_check;
3049 3049
                 
3050 3050
                 $suffix++;
3051
-            } while ( $term_slug_check );
3051
+            } while ($term_slug_check);
3052 3052
             
3053 3053
             $slug = $alt_slug;
3054 3054
         }
@@ -3056,7 +3056,7 @@  discard block
 block discarded – undo
3056 3056
     
3057 3057
     return $slug;
3058 3058
 }
3059
-add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3059
+add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6);
3060 3060
 
3061 3061
 /**
3062 3062
  * Check whether a post name with slug exists or not.
@@ -3073,51 +3073,51 @@  discard block
 block discarded – undo
3073 3073
  * @param int $term_id The term ID.
3074 3074
  * @return bool true when exists. false when not exists.
3075 3075
  */
3076
-function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3076
+function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) {
3077 3077
     global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3078 3078
     
3079
-    if ( $slug_exists ) {
3079
+    if ($slug_exists) {
3080 3080
         return $slug_exists;
3081 3081
     }
3082 3082
     
3083
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3083
+    if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) {
3084 3084
         $taxonomy = $gd_term_taxonomy[$term_id];
3085 3085
     } else {
3086
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3086
+        $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id));
3087 3087
         $gd_term_taxonomy[$term_id] = $taxonomy;
3088 3088
     }
3089 3089
     
3090
-    if ( empty($taxonomy) ) {
3090
+    if (empty($taxonomy)) {
3091 3091
         return $slug_exists;
3092 3092
     }
3093 3093
     
3094
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3094
+    if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) {
3095 3095
         $post_type = $gd_term_post_type[$term_id];
3096 3096
     } else {
3097
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3098
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3097
+        $taxonomy_obj = get_taxonomy($taxonomy);
3098
+        $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL;
3099 3099
     }
3100 3100
     
3101 3101
     $wpml_post_join = "";
3102 3102
     $wpml_post_where = "";
3103 3103
     
3104 3104
     if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3105
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3105
+        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language();
3106 3106
         if (!$term_language) {
3107 3107
             $term_language = $sitepress->get_current_language();
3108 3108
         }
3109 3109
         
3110 3110
         $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3111
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3111
+        $wpml_post_where = " AND icl_t.language_code = '".$term_language."'";
3112 3112
     }
3113 3113
     
3114
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3114
+    if ($post_type && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type))) {
3115 3115
         $slug_exists = true;
3116 3116
     }
3117 3117
 
3118 3118
     return $slug_exists;
3119 3119
 }
3120
-add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3120
+add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3);
3121 3121
 
3122 3122
 /**
3123 3123
  * Add hidden WPML language input field.
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
 function geodir_wpml_add_language_input_field() {
3132 3132
 	global $sitepress;
3133 3133
 
3134
-	if ( function_exists( 'wpml_add_language_form_field_action' ) && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting( 'language_negotiation_type' ) ) {
3134
+	if (function_exists('wpml_add_language_form_field_action') && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting('language_negotiation_type')) {
3135 3135
 		wpml_add_language_form_field_action();
3136 3136
 	}
3137 3137
 }
3138 3138
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-templates/geodir-signup.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@
 block discarded – undo
14 14
  */
15 15
 if (get_current_user_id()) {
16 16
 
17
-    $_redirect = home_url();
18
-    if (isset($_REQUEST['redirect_add_listing'])) {
19
-        $_redirect = $_REQUEST['redirect_add_listing'];
20
-    } elseif (!empty($_REQUEST['redirect_to'])) {
21
-        $_redirect = $_REQUEST['redirect_to'];
22
-    }
23
-
24
-    wp_safe_redirect($_redirect , 302);
25
-    exit;
17
+	$_redirect = home_url();
18
+	if (isset($_REQUEST['redirect_add_listing'])) {
19
+		$_redirect = $_REQUEST['redirect_add_listing'];
20
+	} elseif (!empty($_REQUEST['redirect_to'])) {
21
+		$_redirect = $_REQUEST['redirect_to'];
22
+	}
23
+
24
+	wp_safe_redirect($_redirect , 302);
25
+	exit;
26 26
 }
27 27
 
28 28
 // call header
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         $_redirect = $_REQUEST['redirect_to'];
22 22
     }
23 23
 
24
-    wp_safe_redirect($_redirect , 302);
24
+    wp_safe_redirect($_redirect, 302);
25 25
     exit;
26 26
 }
27 27
 
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 3 patches
Braces   +161 added lines, -116 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -159,8 +162,9 @@  discard block
 block discarded – undo
159 162
     if (get_option('geodir_show_addlisting_nav')) {
160 163
 
161 164
         $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
165
+        if (geodir_is_page('add-listing')) {
166
+                    $menu_class = 'current-menu-item';
167
+        }
164 168
 
165 169
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166 170
         $post_types = geodir_get_posttypes('object');
@@ -176,8 +180,9 @@  discard block
 block discarded – undo
176 180
                                 if (geodir_get_addlisting_link($post_type)) {
177 181
 
178 182
                                     $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
183
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
184
+                                                                            $menu_class = 'current-menu-item';
185
+                                    }
181 186
                                     /**
182 187
                                      * Filter the menu li class.
183 188
                                      *
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
                                     if (geodir_get_addlisting_link($post_type)) {
262 267
 
263 268
                                         $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
269
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
270
+                                                                                    $menu_class = 'current-menu-item';
271
+                                        }
266 272
                                         /**
267 273
                                          * Filter the menu li class.
268 274
                                          *
@@ -319,8 +325,9 @@  discard block
 block discarded – undo
319 325
     }
320 326
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 327
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
328
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
329
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
330
+    }
324 331
 
325 332
     return $menu;
326 333
 
@@ -407,17 +414,20 @@  discard block
 block discarded – undo
407 414
     $geodir_post_type = get_query_var('post_type');
408 415
 
409 416
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
410
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
411
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
412
-        elseif (isset($_REQUEST['listing_type']))
413
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
417
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
418
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
419
+        } elseif (isset($_REQUEST['listing_type'])) {
420
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
421
+        }
414 422
     }
415 423
 
416
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
417
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
424
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
425
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
426
+    }
418 427
 
419
-    if (is_tax())
420
-        $geodir_post_type = geodir_get_taxonomy_posttype();
428
+    if (is_tax()) {
429
+            $geodir_post_type = geodir_get_taxonomy_posttype();
430
+    }
421 431
 
422 432
     // Retrive post type for map marker html ajax request on preview page.
423 433
     if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
@@ -431,8 +441,9 @@  discard block
 block discarded – undo
431 441
     $all_postypes = geodir_get_posttypes();
432 442
     $all_postypes = stripslashes_deep($all_postypes);
433 443
 
434
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
435
-        $geodir_post_type = '';
444
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
445
+            $geodir_post_type = '';
446
+    }
436 447
 
437 448
     if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
438 449
         $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
@@ -517,11 +528,12 @@  discard block
 block discarded – undo
517 528
         endswitch;
518 529
     }
519 530
 
520
-    if (!empty($post_types))
521
-        return $post_types;
522
-    else
523
-        return array();
524
-}
531
+    if (!empty($post_types)) {
532
+            return $post_types;
533
+    } else {
534
+            return array();
535
+    }
536
+    }
525 537
 
526 538
 /**
527 539
  * Get Custom Post Type info.
@@ -538,9 +550,10 @@  discard block
 block discarded – undo
538 550
     $post_types = stripslashes_deep($post_types);
539 551
     if (!empty($post_types) && $post_type != '') {
540 552
         return $post_types[$post_type];
541
-    } else
542
-        return false;
543
-}
553
+    } else {
554
+            return false;
555
+    }
556
+    }
544 557
 
545 558
 if (!function_exists('geodir_get_taxonomies')) {
546 559
     /**
@@ -626,10 +639,11 @@  discard block
 block discarded – undo
626 639
                 . geodir_utf8_ucfirst($category_obj->name) . '</option>';
627 640
         }
628 641
 
629
-        if ($echo)
630
-            echo $html;
631
-        else
632
-            return $html;
642
+        if ($echo) {
643
+                    echo $html;
644
+        } else {
645
+                    return $html;
646
+        }
633 647
     }
634 648
 }
635 649
 
@@ -663,11 +677,12 @@  discard block
 block discarded – undo
663 677
 
664 678
     }
665 679
 
666
-    if (!empty($listing_slug))
667
-        return $listing_slug;
668
-    else
669
-        return false;
670
-}
680
+    if (!empty($listing_slug)) {
681
+            return $listing_slug;
682
+    } else {
683
+            return false;
684
+    }
685
+    }
671 686
 
672 687
 
673 688
 /**
@@ -698,16 +713,18 @@  discard block
 block discarded – undo
698 713
     if (!empty($taxonomies)) {
699 714
         foreach (geodir_get_posttypes() as $pt) {
700 715
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
701
-            if (array_intersect($taxonomies, $object_taxonomies))
702
-                $post_type[] = $pt;
716
+            if (array_intersect($taxonomies, $object_taxonomies)) {
717
+                            $post_type[] = $pt;
718
+            }
703 719
         }
704 720
     }
705 721
 
706
-    if (!empty($post_type))
707
-        return $post_type[0];
708
-    else
709
-        return false;
710
-}
722
+    if (!empty($post_type)) {
723
+            return $post_type[0];
724
+    } else {
725
+            return false;
726
+    }
727
+    }
711 728
 
712 729
 if (!function_exists('geodir_custom_taxonomy_walker')) {
713 730
     /**
@@ -763,18 +780,18 @@  discard block
 block discarded – undo
763 780
                 $checked = '';
764 781
 
765 782
                 if (in_array($cat_term->term_id, $search_terms)) {
766
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
767
-                        $checked = 'selected="selected"';
768
-                    else
769
-                        $checked = 'checked="checked"';
783
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
784
+                                            $checked = 'selected="selected"';
785
+                    } else {
786
+                                            $checked = 'checked="checked"';
787
+                    }
770 788
                 }
771 789
 
772
-                if ($cat_display == 'radio')
773
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
774
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
775
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
776
-
777
-                else {
790
+                if ($cat_display == 'radio') {
791
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
792
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
793
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
794
+                } else {
778 795
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
779 796
                 }
780 797
 
@@ -783,8 +800,9 @@  discard block
 block discarded – undo
783 800
 
784 801
             }
785 802
 
786
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
787
-                $out .= '</div>';
803
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
804
+                            $out .= '</div>';
805
+            }
788 806
 
789 807
             return $out;
790 808
         }
@@ -810,18 +828,21 @@  discard block
 block discarded – undo
810 828
         global $exclude_cats, $gd_session;
811 829
 
812 830
         $cat_exclude = '';
813
-        if (is_array($exclude_cats) && !empty($exclude_cats))
814
-            $cat_exclude = serialize($exclude_cats);
831
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
832
+                    $cat_exclude = serialize($exclude_cats);
833
+        }
815 834
 
816 835
         if (isset($_REQUEST['backandedit'])) {
817 836
             $post = (object)$gd_session->get('listing');
818 837
 
819
-            if (!is_array($post->post_category[$cat_taxonomy]))
820
-                $post_category = $post->post_category[$cat_taxonomy];
838
+            if (!is_array($post->post_category[$cat_taxonomy])) {
839
+                            $post_category = $post->post_category[$cat_taxonomy];
840
+            }
821 841
 
822 842
             $post_categories = $post->post_category_str;
823
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
824
-                $post_category_str = $post_categories[$cat_taxonomy];
843
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
844
+                            $post_category_str = $post_categories[$cat_taxonomy];
845
+            }
825 846
 
826 847
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
827 848
             global $post;
@@ -1012,8 +1033,9 @@  discard block
 block discarded – undo
1012 1033
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1013 1034
             $post_cat_str = $post_categories[$cat_taxonomy];
1014 1035
             $post_cat_array = explode("#", $post_cat_str);
1015
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1016
-                $style = "display:none;";
1036
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
1037
+                            $style = "display:none;";
1038
+            }
1017 1039
         }
1018 1040
         ?>
1019 1041
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -1048,7 +1070,7 @@  discard block
 block discarded – undo
1048 1070
 
1049 1071
         if(is_array( $exclude_cats)){
1050 1072
             $exclude_cats = array_map( 'intval', $exclude_cats );
1051
-        }else{
1073
+        } else{
1052 1074
             $exclude_cats = intval($exclude_cats);
1053 1075
         }
1054 1076
 
@@ -1078,7 +1100,10 @@  discard block
 block discarded – undo
1078 1100
 
1079 1101
             <div class="post_default_category">
1080 1102
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1081
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1103
+                       onchange="update_listing_cat()" <?php if ($default) {
1104
+	echo ' checked="checked" ';
1105
+}
1106
+?>   />
1082 1107
         <span> 
1083 1108
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1084 1109
         </span>
@@ -1178,8 +1203,9 @@  discard block
 block discarded – undo
1178 1203
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1179 1204
 
1180 1205
         $option_selected = '';
1181
-        if (!$selected)
1182
-            $option_slected = ' selected="selected" ';
1206
+        if (!$selected) {
1207
+                    $option_slected = ' selected="selected" ';
1208
+        }
1183 1209
 
1184 1210
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1185 1211
 
@@ -1187,8 +1213,9 @@  discard block
 block discarded – undo
1187 1213
 
1188 1214
         foreach ($cat_terms as $cat_term) {
1189 1215
             $option_selected = '';
1190
-            if ($selected == $cat_term->term_id)
1191
-                $option_selected = ' selected="selected" ';
1216
+            if ($selected == $cat_term->term_id) {
1217
+                            $option_selected = ' selected="selected" ';
1218
+            }
1192 1219
 
1193 1220
             // Count child terms
1194 1221
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1253,8 +1280,9 @@  discard block
 block discarded – undo
1253 1280
 
1254 1281
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1255 1282
 
1256
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1257
-        $listing_slug = 'places';
1283
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1284
+            $listing_slug = 'places';
1285
+    }
1258 1286
 
1259 1287
     /**
1260 1288
      * Taxonomies
@@ -1566,8 +1594,9 @@  discard block
 block discarded – undo
1566 1594
                             'city_slug' => $post->city_slug
1567 1595
                         );
1568 1596
 
1569
-                    } else
1570
-                        $post_location = geodir_get_location();
1597
+                    } else {
1598
+                                            $post_location = geodir_get_location();
1599
+                    }
1571 1600
 
1572 1601
 
1573 1602
                 } else {
@@ -1596,8 +1625,9 @@  discard block
 block discarded – undo
1596 1625
                             );
1597 1626
 
1598 1627
                         }
1599
-                    } else
1600
-                        $post_location = geodir_get_location();
1628
+                    } else {
1629
+                                            $post_location = geodir_get_location();
1630
+                    }
1601 1631
                 }
1602 1632
 
1603 1633
 
@@ -1636,16 +1666,17 @@  discard block
 block discarded – undo
1636 1666
 
1637 1667
                     if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
1638 1668
                         $post_terms = absint($_POST['post_default_category']);
1639
-                    }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
1669
+                    } elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
1640 1670
                         $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
1641 1671
                         $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0;
1642
-                    }elseif (isset($post->{$taxonomies})) {
1672
+                    } elseif (isset($post->{$taxonomies})) {
1643 1673
                         $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1644 1674
                         $post_terms = $post_terms[0];
1645 1675
                     }
1646 1676
 
1647
-                    if (!$post_terms)
1648
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1677
+                    if (!$post_terms) {
1678
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1679
+                    }
1649 1680
 
1650 1681
                     if (!$post_terms) {
1651 1682
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1659,8 +1690,9 @@  discard block
 block discarded – undo
1659 1690
 
1660 1691
                 $term = get_term_by('id', $post_terms, $taxonomies);
1661 1692
 
1662
-                if (!empty($term))
1663
-                    $term_request = $term->slug;
1693
+                if (!empty($term)) {
1694
+                                    $term_request = $term->slug;
1695
+                }
1664 1696
                 //$term_request = $term->slug.'/';
1665 1697
             }
1666 1698
 
@@ -1675,9 +1707,13 @@  discard block
 block discarded – undo
1675 1707
                 $request_term .= $term_request;
1676 1708
 
1677 1709
             } else {
1678
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1710
+                if (isset($location_request) && $location_request != '') {
1711
+                	$request_term = $location_request;
1712
+                }
1679 1713
 
1680
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1714
+                if (isset($term_request) && $term_request != '') {
1715
+                	$request_term .= $term_request;
1716
+                }
1681 1717
             }
1682 1718
             $request_term = trim($request_term, '/');
1683 1719
             
@@ -1686,10 +1722,11 @@  discard block
 block discarded – undo
1686 1722
                 $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
1687 1723
             }
1688 1724
             
1689
-            if (!empty($request_term))
1690
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1691
-            else
1692
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1725
+            if (!empty($request_term)) {
1726
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1727
+            } else {
1728
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1729
+            }
1693 1730
             //echo $post_link ;
1694 1731
         }
1695 1732
         // temp cache the permalink
@@ -1881,11 +1918,12 @@  discard block
 block discarded – undo
1881 1918
     
1882 1919
     $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name;
1883 1920
     
1884
-    if ($echo)
1885
-        echo $label;
1886
-    else
1887
-        return $label;
1888
-}
1921
+    if ($echo) {
1922
+            echo $label;
1923
+    } else {
1924
+            return $label;
1925
+    }
1926
+    }
1889 1927
 
1890 1928
 /**
1891 1929
  * Print or Get post type plural label.
@@ -1901,18 +1939,20 @@  discard block
 block discarded – undo
1901 1939
 function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
1902 1940
     $all_postypes = geodir_get_posttypes();
1903 1941
 
1904
-    if (!in_array($post_type, $all_postypes))
1905
-        return false;
1942
+    if (!in_array($post_type, $all_postypes)) {
1943
+            return false;
1944
+    }
1906 1945
 
1907 1946
     $obj_post_type = get_post_type_object($post_type);
1908 1947
     
1909 1948
     $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name;
1910 1949
     
1911
-    if ($echo)
1912
-        echo $label;
1913
-    else
1914
-        return $label;
1915
-}
1950
+    if ($echo) {
1951
+            echo $label;
1952
+    } else {
1953
+            return $label;
1954
+    }
1955
+    }
1916 1956
 
1917 1957
 /**
1918 1958
  * Checks whether a term exists or not.
@@ -1935,19 +1975,22 @@  discard block
 block discarded – undo
1935 1975
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1936 1976
 
1937 1977
     if (is_int($term)) {
1938
-        if (0 == $term)
1939
-            return 0;
1978
+        if (0 == $term) {
1979
+                    return 0;
1980
+        }
1940 1981
         $where = 't.term_id = %d';
1941
-        if (!empty($taxonomy))
1942
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1943
-        else
1944
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1982
+        if (!empty($taxonomy)) {
1983
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1984
+        } else {
1985
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1986
+        }
1945 1987
     }
1946 1988
 
1947 1989
     $term = trim(wp_unslash($term));
1948 1990
 
1949
-    if ('' === $slug = sanitize_title($term))
1950
-        return 0;
1991
+    if ('' === $slug = sanitize_title($term)) {
1992
+            return 0;
1993
+    }
1951 1994
 
1952 1995
     $where = 't.slug = %s';
1953 1996
 
@@ -1964,14 +2007,16 @@  discard block
 block discarded – undo
1964 2007
         $where_fields[] = $taxonomy;
1965 2008
 
1966 2009
 
1967
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1968
-            return $result;
2010
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
2011
+                    return $result;
2012
+        }
1969 2013
 
1970 2014
         return false;
1971 2015
     }
1972 2016
 
1973
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1974
-        return $result;
2017
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
2018
+            return $result;
2019
+    }
1975 2020
 
1976 2021
     return false;
1977 2022
 }
Please login to merge, or discard this patch.
Indentation   +1273 added lines, -1273 removed lines patch added patch discarded remove patch
@@ -33,265 +33,265 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147 147
 
148
-            $items .= '	</ul> ';
149
-            /**
150
-             * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
-             *
152
-             * @since 1.5.9
153
-             */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
155
-            $items .= '</li>';
156
-        }
157
-    }
158
-
159
-    if (get_option('geodir_show_addlisting_nav')) {
160
-
161
-        $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
164
-
165
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
-        $post_types = geodir_get_posttypes('object');
167
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
-
170
-        if (!empty($post_types)) {
171
-            foreach ($post_types as $post_type => $args) {
172
-                if (!empty($geodir_allow_posttype_frontend)) {
173
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
-                        if (!empty($show_add_listing_post_types_main_nav)) {
175
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
-                                if (geodir_get_addlisting_link($post_type)) {
177
-
178
-                                    $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
181
-                                    /**
182
-                                     * Filter the menu li class.
183
-                                     *
184
-                                     * @since 1.0.0
185
-                                     * @param string $menu_class The menu HTML class.
186
-                                     */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
-                                    /**
189
-                                     * Filter the menu a class.
190
-                                     *
191
-                                     * @since 1.0.0
192
-                                     */
193
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
194
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
148
+			$items .= '	</ul> ';
149
+			/**
150
+			 * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
+			 *
152
+			 * @since 1.5.9
153
+			 */
154
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
155
+			$items .= '</li>';
156
+		}
157
+	}
158
+
159
+	if (get_option('geodir_show_addlisting_nav')) {
160
+
161
+		$menu_class = '';
162
+		if (geodir_is_page('add-listing'))
163
+			$menu_class = 'current-menu-item';
164
+
165
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
+		$post_types = geodir_get_posttypes('object');
167
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
+
170
+		if (!empty($post_types)) {
171
+			foreach ($post_types as $post_type => $args) {
172
+				if (!empty($geodir_allow_posttype_frontend)) {
173
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
+						if (!empty($show_add_listing_post_types_main_nav)) {
175
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
+								if (geodir_get_addlisting_link($post_type)) {
177
+
178
+									$menu_class = '';
179
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
+										$menu_class = 'current-menu-item';
181
+									/**
182
+									 * Filter the menu li class.
183
+									 *
184
+									 * @since 1.0.0
185
+									 * @param string $menu_class The menu HTML class.
186
+									 */
187
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
+									/**
189
+									 * Filter the menu a class.
190
+									 *
191
+									 * @since 1.0.0
192
+									 */
193
+									$a_class = apply_filters('geodir_menu_a_class', '');
194
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
195
+									$items .= '<li class="' . $li_class . '">
196 196
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197 197
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
198 198
 											</a>
199 199
 										</li>';
200
-                                }
201
-                            }
202
-                        }
203
-                    }
204
-                }
205
-            }
206
-        }
207
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
-    }
209
-
210
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
-    if ($is_add_listing_sub_meny_exists) {
213
-
214
-        if (get_option('geodir_show_addlisting_nav')) {
215
-            /**
216
-             * Filter the menu li class.
217
-             *
218
-             * @since 1.0.0
219
-             * @param string $menu_class The menu HTML class.
220
-             */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
-            /**
223
-             * Filter the sub menu li class.
224
-             *
225
-             * @since 1.0.0
226
-             * @param string $menu_class The menu HTML class.
227
-             */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
-            /**
230
-             * Filter the sub menu ul class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
-            /**
236
-             * Filter the menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $a_class = apply_filters('geodir_menu_a_class', '');
241
-            /**
242
-             * Filter the sub menu a class.
243
-             *
244
-             * @since 1.0.0
245
-             */
246
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
200
+								}
201
+							}
202
+						}
203
+					}
204
+				}
205
+			}
206
+		}
207
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
+	}
209
+
210
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
+	if ($is_add_listing_sub_meny_exists) {
213
+
214
+		if (get_option('geodir_show_addlisting_nav')) {
215
+			/**
216
+			 * Filter the menu li class.
217
+			 *
218
+			 * @since 1.0.0
219
+			 * @param string $menu_class The menu HTML class.
220
+			 */
221
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
+			/**
223
+			 * Filter the sub menu li class.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @param string $menu_class The menu HTML class.
227
+			 */
228
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
+			/**
230
+			 * Filter the sub menu ul class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
+			/**
236
+			 * Filter the menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$a_class = apply_filters('geodir_menu_a_class', '');
241
+			/**
242
+			 * Filter the sub menu a class.
243
+			 *
244
+			 * @since 1.0.0
245
+			 */
246
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
+			$items .= '<li  class="' . $li_class . '">
248 248
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249 249
 					<ul class="' . $sub_ul_class . '">';
250 250
 
251
-            $post_types = geodir_get_posttypes('object');
252
-
253
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
-
255
-            if (!empty($post_types)) {
256
-                foreach ($post_types as $post_type => $args) {
257
-                    if (!empty($geodir_allow_posttype_frontend)) {
258
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
-                            if (!empty($show_add_listing_post_types)) {
260
-                                if (in_array($post_type, $show_add_listing_post_types)) {
261
-                                    if (geodir_get_addlisting_link($post_type)) {
262
-
263
-                                        $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
266
-                                        /**
267
-                                         * Filter the menu li class.
268
-                                         *
269
-                                         * @since 1.0.0
270
-                                         * @param string $menu_class The menu HTML class.
271
-                                         */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $sub_li_class . '">
251
+			$post_types = geodir_get_posttypes('object');
252
+
253
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
+
255
+			if (!empty($post_types)) {
256
+				foreach ($post_types as $post_type => $args) {
257
+					if (!empty($geodir_allow_posttype_frontend)) {
258
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
+							if (!empty($show_add_listing_post_types)) {
260
+								if (in_array($post_type, $show_add_listing_post_types)) {
261
+									if (geodir_get_addlisting_link($post_type)) {
262
+
263
+										$menu_class = '';
264
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
+											$menu_class = 'current-menu-item';
266
+										/**
267
+										 * Filter the menu li class.
268
+										 *
269
+										 * @since 1.0.0
270
+										 * @param string $menu_class The menu HTML class.
271
+										 */
272
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
274
+										$items .= '<li class="' . $sub_li_class . '">
275 275
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276 276
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
277 277
 														</a>
278 278
 													</li>';
279
-                                    }
280
-                                }
281
-                            }
282
-                        }
283
-                    }
284
-                }
285
-            }
279
+									}
280
+								}
281
+							}
282
+						}
283
+					}
284
+				}
285
+			}
286 286
 
287
-            $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
289
-            $items .= '</li>';
287
+			$items .= '	</ul> ';
288
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
289
+			$items .= '</li>';
290 290
 
291
-        }
292
-    }
293
-    // apply filter to add more navigations // -Filter-Location-Manager
294
-    return $items;
291
+		}
292
+	}
293
+	// apply filter to add more navigations // -Filter-Location-Manager
294
+	return $items;
295 295
 }
296 296
 
297 297
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function geodir_pagemenu_items($menu, $args)
311 311
 {
312
-    $locations = get_nav_menu_locations();
313
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
314
-    $geodir_theme_location_nav = array();
315
-    if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
-        $geodir_theme_location_nav[] = $args['theme_location'];
318
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
-    }
320
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
312
+	$locations = get_nav_menu_locations();
313
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
314
+	$geodir_theme_location_nav = array();
315
+	if (empty($locations) && empty($geodir_theme_location)) {
316
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
+		$geodir_theme_location_nav[] = $args['theme_location'];
318
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
+	}
320
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+	else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
324 324
 
325
-    return $menu;
325
+	return $menu;
326 326
 
327 327
 }
328 328
 
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
 function geodir_menu_items($items, $args)
343 343
 {
344 344
 
345
-    $location = $args->theme_location;
345
+	$location = $args->theme_location;
346 346
 
347
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
347
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
348 348
 
349
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
349
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
352
-        return $items;
351
+		$items = $items . geodir_add_nav_menu_items();
352
+		return $items;
353 353
 
354
-    } else {
355
-        return $items;
356
-    }
354
+	} else {
355
+		return $items;
356
+	}
357 357
 }
358 358
 
359 359
 /**
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_get_category_all_array()
370 370
 {
371
-    global $wpdb;
372
-    $return_array = array();
373
-
374
-    $taxonomies = geodir_get_taxonomies();
375
-    $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
377
-
378
-    $pn_categories = $wpdb->get_results(
379
-        $wpdb->prepare(
380
-            "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
382
-        )
383
-    );
384
-
385
-    foreach ($pn_categories as $pn_categories_obj) {
386
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
-            "title" => $pn_categories_obj->name,);
388
-    }
389
-    return $return_array;
371
+	global $wpdb;
372
+	$return_array = array();
373
+
374
+	$taxonomies = geodir_get_taxonomies();
375
+	$taxonomies = implode("','", $taxonomies);
376
+	$taxonomies = "'" . $taxonomies . "'";
377
+
378
+	$pn_categories = $wpdb->get_results(
379
+		$wpdb->prepare(
380
+			"SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
+			array($wpdb->terms . term_id)
382
+		)
383
+	);
384
+
385
+	foreach ($pn_categories as $pn_categories_obj) {
386
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
+			"title" => $pn_categories_obj->name,);
388
+	}
389
+	return $return_array;
390 390
 }
391 391
 
392 392
 
@@ -402,49 +402,49 @@  discard block
 block discarded – undo
402 402
  * @return string The post type.
403 403
  */
404 404
 function geodir_get_current_posttype() {
405
-    global $wp_query, $post, $geodir_post_type;
405
+	global $wp_query, $post, $geodir_post_type;
406 406
 
407
-    $geodir_post_type = get_query_var('post_type');
407
+	$geodir_post_type = get_query_var('post_type');
408 408
 
409
-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
410
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
411
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
412
-        elseif (isset($_REQUEST['listing_type']))
413
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
414
-    }
409
+	if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
410
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
411
+			$geodir_post_type = get_post_type((int)$_REQUEST['pid']);
412
+		elseif (isset($_REQUEST['listing_type']))
413
+			$geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
414
+	}
415 415
 
416
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
417
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
416
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
417
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
418 418
 
419
-    if (is_tax())
420
-        $geodir_post_type = geodir_get_taxonomy_posttype();
419
+	if (is_tax())
420
+		$geodir_post_type = geodir_get_taxonomy_posttype();
421 421
 
422
-    // Retrive post type for map marker html ajax request on preview page.
423
-    if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
424
-        if (!empty($post->post_type)) {
425
-            $geodir_post_type = $post->post_type;
426
-        } else if (!empty($post->listing_type)) {
427
-            $geodir_post_type = $post->listing_type;
428
-        }
429
-    }
422
+	// Retrive post type for map marker html ajax request on preview page.
423
+	if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
424
+		if (!empty($post->post_type)) {
425
+			$geodir_post_type = $post->post_type;
426
+		} else if (!empty($post->listing_type)) {
427
+			$geodir_post_type = $post->listing_type;
428
+		}
429
+	}
430 430
 
431
-    $all_postypes = geodir_get_posttypes();
432
-    $all_postypes = stripslashes_deep($all_postypes);
431
+	$all_postypes = geodir_get_posttypes();
432
+	$all_postypes = stripslashes_deep($all_postypes);
433 433
 
434
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
435
-        $geodir_post_type = '';
434
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
435
+		$geodir_post_type = '';
436 436
 
437
-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
438
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
439
-    }
437
+	if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
438
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
439
+	}
440 440
 
441 441
 
442
-    /**
443
-     * Filter the default CPT return.
444
-     *
445
-     * @since 1.6.9
446
-     */
447
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
442
+	/**
443
+	 * Filter the default CPT return.
444
+	 *
445
+	 * @since 1.6.9
446
+	 */
447
+	return apply_filters('geodir_get_current_posttype',$geodir_post_type);
448 448
 }
449 449
 
450 450
 /**
@@ -458,22 +458,22 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function geodir_get_default_posttype()
460 460
 {
461
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
462
-
463
-    $stype = false;
464
-    foreach ( $post_types as $post_type => $info ) {
465
-        global $wpdb;
466
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
467
-        if ( $has_posts ) {
468
-            $stype = $post_type; break;
469
-        }
470
-    }
471
-
472
-    if(!$stype){
473
-        $stype = 'gd_place';
474
-    }
475
-
476
-    return $stype;
461
+	$post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
462
+
463
+	$stype = false;
464
+	foreach ( $post_types as $post_type => $info ) {
465
+		global $wpdb;
466
+		$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
467
+		if ( $has_posts ) {
468
+			$stype = $post_type; break;
469
+		}
470
+	}
471
+
472
+	if(!$stype){
473
+		$stype = 'gd_place';
474
+	}
475
+
476
+	return $stype;
477 477
 }
478 478
 
479 479
 /**
@@ -487,21 +487,21 @@  discard block
 block discarded – undo
487 487
  */
488 488
 function geodir_get_posttypes($output = 'names')
489 489
 {
490
-    $post_types = array();
491
-    $post_types = get_option('geodir_post_types');
492
-    $post_types = stripslashes_deep($post_types);
493
-    if (!empty($post_types)) {
494
-        switch ($output):
495
-            case 'object':
496
-            case 'Object':
497
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
498
-                break;
499
-            case 'array':
500
-            case 'Array':
501
-                $post_types = (array)$post_types;
502
-                break;
490
+	$post_types = array();
491
+	$post_types = get_option('geodir_post_types');
492
+	$post_types = stripslashes_deep($post_types);
493
+	if (!empty($post_types)) {
494
+		switch ($output):
495
+			case 'object':
496
+			case 'Object':
497
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
498
+				break;
499
+			case 'array':
500
+			case 'Array':
501
+				$post_types = (array)$post_types;
502
+				break;
503 503
 			case 'options':
504
-                $post_types = (array)$post_types;
504
+				$post_types = (array)$post_types;
505 505
 				
506 506
 				$options = array();
507 507
 				if (!empty($post_types)) {
@@ -510,17 +510,17 @@  discard block
 block discarded – undo
510 510
 					}
511 511
 				}
512 512
 				$post_types = $options;
513
-                break;
514
-            default:
515
-                $post_types = array_keys($post_types);
516
-                break;
517
-        endswitch;
518
-    }
519
-
520
-    if (!empty($post_types))
521
-        return $post_types;
522
-    else
523
-        return array();
513
+				break;
514
+			default:
515
+				$post_types = array_keys($post_types);
516
+				break;
517
+		endswitch;
518
+	}
519
+
520
+	if (!empty($post_types))
521
+		return $post_types;
522
+	else
523
+		return array();
524 524
 }
525 525
 
526 526
 /**
@@ -533,104 +533,104 @@  discard block
 block discarded – undo
533 533
  */
534 534
 function geodir_get_posttype_info($post_type = '')
535 535
 {
536
-    $post_types = array();
537
-    $post_types = get_option('geodir_post_types');
538
-    $post_types = stripslashes_deep($post_types);
539
-    if (!empty($post_types) && $post_type != '') {
540
-        return $post_types[$post_type];
541
-    } else
542
-        return false;
536
+	$post_types = array();
537
+	$post_types = get_option('geodir_post_types');
538
+	$post_types = stripslashes_deep($post_types);
539
+	if (!empty($post_types) && $post_type != '') {
540
+		return $post_types[$post_type];
541
+	} else
542
+		return false;
543 543
 }
544 544
 
545 545
 if (!function_exists('geodir_get_taxonomies')) {
546
-    /**
547
-     * Get all custom taxonomies.
548
-     *
549
-     * @since 1.0.0
550
-     * @package GeoDirectory
551
-     * @param string $post_type The post type.
552
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
553
-     * @return array|bool Taxonomies on success. false on failure.
554
-     */
555
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) {
556
-        $taxonomies = array();
557
-        $gd_taxonomies = array();
558
-
559
-        if ($taxonomies = get_option('geodir_taxonomies')) {
560
-            $gd_taxonomies = array_keys($taxonomies);
561
-
562
-            if ($post_type != '') {
563
-                $gd_taxonomies = array();
564
-            }
546
+	/**
547
+	 * Get all custom taxonomies.
548
+	 *
549
+	 * @since 1.0.0
550
+	 * @package GeoDirectory
551
+	 * @param string $post_type The post type.
552
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
553
+	 * @return array|bool Taxonomies on success. false on failure.
554
+	 */
555
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) {
556
+		$taxonomies = array();
557
+		$gd_taxonomies = array();
558
+
559
+		if ($taxonomies = get_option('geodir_taxonomies')) {
560
+			$gd_taxonomies = array_keys($taxonomies);
561
+
562
+			if ($post_type != '') {
563
+				$gd_taxonomies = array();
564
+			}
565 565
 
566
-            $i = 0;
567
-            foreach ($taxonomies as $taxonomy => $args) {
568
-                if ($post_type != '' && $args['object_type'] == $post_type) {
569
-                    $gd_taxonomies[] = $taxonomy;
570
-                }
566
+			$i = 0;
567
+			foreach ($taxonomies as $taxonomy => $args) {
568
+				if ($post_type != '' && $args['object_type'] == $post_type) {
569
+					$gd_taxonomies[] = $taxonomy;
570
+				}
571 571
 
572
-                if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
573
-                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
574
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
575
-                    }
576
-                }
577
-            }
572
+				if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
573
+					if (array_search($taxonomy, $gd_taxonomies) !== false) {
574
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
575
+					}
576
+				}
577
+			}
578 578
 
579
-            $gd_taxonomies = array_values($gd_taxonomies);
580
-        }
581
-
582
-        /**
583
-         * Filter the taxonomies.
584
-         *
585
-         * @since 1.0.0
586
-         * @param array $gd_taxonomies The taxonomy array.
587
-         */
588
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
589
-
590
-        if (!empty($taxonomies)) {
591
-            return $taxonomies;
592
-        } else {
593
-            return false;
594
-        }
595
-    }
579
+			$gd_taxonomies = array_values($gd_taxonomies);
580
+		}
581
+
582
+		/**
583
+		 * Filter the taxonomies.
584
+		 *
585
+		 * @since 1.0.0
586
+		 * @param array $gd_taxonomies The taxonomy array.
587
+		 */
588
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
589
+
590
+		if (!empty($taxonomies)) {
591
+			return $taxonomies;
592
+		} else {
593
+			return false;
594
+		}
595
+	}
596 596
 }
597 597
 
598 598
 if (!function_exists(' geodir_get_categories_dl')) {
599
-    /**
600
-     * Get categories dropdown HTML.
601
-     *
602
-     * @since 1.0.0
603
-     * @package GeoDirectory
604
-     * @param string $post_type The post type.
605
-     * @param string $selected The selected value.
606
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
607
-     * @param bool $echo Prints the HTML when set to true. Default: true.
608
-     * @return void|string Dropdown HTML.
609
-     */
610
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
611
-    {
612
-
613
-        $html = '';
614
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
615
-
616
-        $categories = get_terms($taxonomies);
617
-
618
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
619
-
620
-        foreach ($categories as $category_obj) {
621
-            $select_opt = '';
622
-            if ($selected == $category_obj->term_id) {
623
-                $select_opt = 'selected="selected"';
624
-            }
625
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
626
-                . geodir_utf8_ucfirst($category_obj->name) . '</option>';
627
-        }
628
-
629
-        if ($echo)
630
-            echo $html;
631
-        else
632
-            return $html;
633
-    }
599
+	/**
600
+	 * Get categories dropdown HTML.
601
+	 *
602
+	 * @since 1.0.0
603
+	 * @package GeoDirectory
604
+	 * @param string $post_type The post type.
605
+	 * @param string $selected The selected value.
606
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
607
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
608
+	 * @return void|string Dropdown HTML.
609
+	 */
610
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
611
+	{
612
+
613
+		$html = '';
614
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
615
+
616
+		$categories = get_terms($taxonomies);
617
+
618
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
619
+
620
+		foreach ($categories as $category_obj) {
621
+			$select_opt = '';
622
+			if ($selected == $category_obj->term_id) {
623
+				$select_opt = 'selected="selected"';
624
+			}
625
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
626
+				. geodir_utf8_ucfirst($category_obj->name) . '</option>';
627
+		}
628
+
629
+		if ($echo)
630
+			echo $html;
631
+		else
632
+			return $html;
633
+	}
634 634
 }
635 635
 
636 636
 
@@ -645,28 +645,28 @@  discard block
 block discarded – undo
645 645
 function geodir_get_listing_slug($object_type = '')
646 646
 {
647 647
 
648
-    $listing_slug = '';
648
+	$listing_slug = '';
649 649
 
650
-    $post_types = get_option('geodir_post_types');
651
-    $taxonomies = get_option('geodir_taxonomies');
650
+	$post_types = get_option('geodir_post_types');
651
+	$taxonomies = get_option('geodir_taxonomies');
652 652
 
653 653
 
654
-    if ($object_type != '') {
655
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
654
+	if ($object_type != '') {
655
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
656 656
 
657
-            $object_info = $post_types[$object_type];
658
-            $listing_slug = $object_info['listing_slug'];
659
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
660
-            $object_info = $taxonomies[$object_type];
661
-            $listing_slug = $object_info['listing_slug'];
662
-        }
657
+			$object_info = $post_types[$object_type];
658
+			$listing_slug = $object_info['listing_slug'];
659
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
660
+			$object_info = $taxonomies[$object_type];
661
+			$listing_slug = $object_info['listing_slug'];
662
+		}
663 663
 
664
-    }
664
+	}
665 665
 
666
-    if (!empty($listing_slug))
667
-        return $listing_slug;
668
-    else
669
-        return false;
666
+	if (!empty($listing_slug))
667
+		return $listing_slug;
668
+	else
669
+		return false;
670 670
 }
671 671
 
672 672
 
@@ -681,212 +681,212 @@  discard block
 block discarded – undo
681 681
  */
682 682
 function geodir_get_taxonomy_posttype($taxonomy = '')
683 683
 {
684
-    global $wp_query;
685
-
686
-    $post_type = array();
687
-    $taxonomies = array();
688
-
689
-    if (!empty($taxonomy)) {
690
-        $taxonomies[] = $taxonomy;
691
-    } elseif (isset($wp_query->tax_query->queries)) {
692
-        $tax_arr = $wp_query->tax_query->queries;
693
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
694
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
695
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
696
-    }
697
-
698
-    if (!empty($taxonomies)) {
699
-        foreach (geodir_get_posttypes() as $pt) {
700
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
701
-            if (array_intersect($taxonomies, $object_taxonomies))
702
-                $post_type[] = $pt;
703
-        }
704
-    }
705
-
706
-    if (!empty($post_type))
707
-        return $post_type[0];
708
-    else
709
-        return false;
684
+	global $wp_query;
685
+
686
+	$post_type = array();
687
+	$taxonomies = array();
688
+
689
+	if (!empty($taxonomy)) {
690
+		$taxonomies[] = $taxonomy;
691
+	} elseif (isset($wp_query->tax_query->queries)) {
692
+		$tax_arr = $wp_query->tax_query->queries;
693
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
694
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
695
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
696
+	}
697
+
698
+	if (!empty($taxonomies)) {
699
+		foreach (geodir_get_posttypes() as $pt) {
700
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
701
+			if (array_intersect($taxonomies, $object_taxonomies))
702
+				$post_type[] = $pt;
703
+		}
704
+	}
705
+
706
+	if (!empty($post_type))
707
+		return $post_type[0];
708
+	else
709
+		return false;
710 710
 }
711 711
 
712 712
 if (!function_exists('geodir_custom_taxonomy_walker')) {
713
-    /**
714
-     * Custom taxonomy walker function.
715
-     *
716
-     * @since 1.0.0
717
-     * @package GeoDirectory
718
-     * @param string $cat_taxonomy The taxonomy name.
719
-     * @param int $cat_parent The parent term ID.
720
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
721
-     * @param int $pading CSS padding in pixels.
722
-     * @return string|void taxonomy HTML.
723
-     */
724
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
725
-    {
726
-        global $cat_display, $post_cat, $exclude_cats;
727
-
728
-        $search_terms = trim($post_cat, ",");
729
-
730
-        $search_terms = explode(",", $search_terms);
731
-
732
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
733
-
734
-        $display = '';
735
-        $onchange = '';
736
-        $term_check = '';
737
-        $main_list_class = '';
738
-        $out = '';
739
-        //If there are terms, start displaying
740
-        if (count($cat_terms) > 0) {
741
-            //Displaying as a list
742
-            $p = $pading * 20;
743
-            $pading++;
744
-
745
-
746
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
747
-                if ($cat_parent == 0) {
748
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
749
-                    $main_list_class = 'class="main_list_selecter"';
750
-                } else {
751
-                    //$display = 'display:none';
752
-                    $list_class = 'sub_list gd-sub-cats-list';
753
-                }
754
-            }
713
+	/**
714
+	 * Custom taxonomy walker function.
715
+	 *
716
+	 * @since 1.0.0
717
+	 * @package GeoDirectory
718
+	 * @param string $cat_taxonomy The taxonomy name.
719
+	 * @param int $cat_parent The parent term ID.
720
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
721
+	 * @param int $pading CSS padding in pixels.
722
+	 * @return string|void taxonomy HTML.
723
+	 */
724
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
725
+	{
726
+		global $cat_display, $post_cat, $exclude_cats;
727
+
728
+		$search_terms = trim($post_cat, ",");
729
+
730
+		$search_terms = explode(",", $search_terms);
731
+
732
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
733
+
734
+		$display = '';
735
+		$onchange = '';
736
+		$term_check = '';
737
+		$main_list_class = '';
738
+		$out = '';
739
+		//If there are terms, start displaying
740
+		if (count($cat_terms) > 0) {
741
+			//Displaying as a list
742
+			$p = $pading * 20;
743
+			$pading++;
744
+
745
+
746
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
747
+				if ($cat_parent == 0) {
748
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
749
+					$main_list_class = 'class="main_list_selecter"';
750
+				} else {
751
+					//$display = 'display:none';
752
+					$list_class = 'sub_list gd-sub-cats-list';
753
+				}
754
+			}
755 755
 
756
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
757
-                $p = 0;
758
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
759
-            }
756
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
757
+				$p = 0;
758
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
759
+			}
760 760
 
761
-            foreach ($cat_terms as $cat_term) {
761
+			foreach ($cat_terms as $cat_term) {
762 762
 
763
-                $checked = '';
763
+				$checked = '';
764 764
 
765
-                if (in_array($cat_term->term_id, $search_terms)) {
766
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
767
-                        $checked = 'selected="selected"';
768
-                    else
769
-                        $checked = 'checked="checked"';
770
-                }
765
+				if (in_array($cat_term->term_id, $search_terms)) {
766
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
767
+						$checked = 'selected="selected"';
768
+					else
769
+						$checked = 'checked="checked"';
770
+				}
771 771
 
772
-                if ($cat_display == 'radio')
773
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
774
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
775
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
772
+				if ($cat_display == 'radio')
773
+					$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
774
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
775
+					$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
776 776
 
777
-                else {
778
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
779
-                }
777
+				else {
778
+					$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
779
+				}
780 780
 
781
-                // Call recurson to print sub cats
782
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
781
+				// Call recurson to print sub cats
782
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
783 783
 
784
-            }
784
+			}
785 785
 
786
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
787
-                $out .= '</div>';
786
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
787
+				$out .= '</div>';
788 788
 
789
-            return $out;
790
-        }
791
-        return;
792
-    }
789
+			return $out;
790
+		}
791
+		return;
792
+	}
793 793
 }
794 794
 
795 795
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
796
-    /**
797
-     * Custom taxonomy walker function.
798
-     *
799
-     * @since 1.0.0
800
-     * @package GeoDirectory
801
-     * @global object $post WordPress Post object.
802
-     * @global object $gd_session GeoDirectory Session object.
803
-     * @param string $cat_taxonomy The taxonomy name.
804
-     * @param string $cat_limit Number of categories to display.
805
-     */
806
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
807
-    {
808
-        $post_category = '';
809
-        $post_category_str = '';
810
-        global $exclude_cats, $gd_session;
811
-
812
-        $cat_exclude = '';
813
-        if (is_array($exclude_cats) && !empty($exclude_cats))
814
-            $cat_exclude = serialize($exclude_cats);
815
-
816
-        if (isset($_REQUEST['backandedit'])) {
817
-            $post = (object)$gd_session->get('listing');
818
-
819
-            if (!is_array($post->post_category[$cat_taxonomy]))
820
-                $post_category = $post->post_category[$cat_taxonomy];
821
-
822
-            $post_categories = $post->post_category_str;
823
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
824
-                $post_category_str = $post_categories[$cat_taxonomy];
825
-
826
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
827
-            global $post;
828
-
829
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
830
-            if (empty($post_category) && isset($post->{$cat_taxonomy})) {
831
-                $post_category = $post->{$cat_taxonomy};
832
-            }
796
+	/**
797
+	 * Custom taxonomy walker function.
798
+	 *
799
+	 * @since 1.0.0
800
+	 * @package GeoDirectory
801
+	 * @global object $post WordPress Post object.
802
+	 * @global object $gd_session GeoDirectory Session object.
803
+	 * @param string $cat_taxonomy The taxonomy name.
804
+	 * @param string $cat_limit Number of categories to display.
805
+	 */
806
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
807
+	{
808
+		$post_category = '';
809
+		$post_category_str = '';
810
+		global $exclude_cats, $gd_session;
811
+
812
+		$cat_exclude = '';
813
+		if (is_array($exclude_cats) && !empty($exclude_cats))
814
+			$cat_exclude = serialize($exclude_cats);
815
+
816
+		if (isset($_REQUEST['backandedit'])) {
817
+			$post = (object)$gd_session->get('listing');
818
+
819
+			if (!is_array($post->post_category[$cat_taxonomy]))
820
+				$post_category = $post->post_category[$cat_taxonomy];
821
+
822
+			$post_categories = $post->post_category_str;
823
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
824
+				$post_category_str = $post_categories[$cat_taxonomy];
825
+
826
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
827
+			global $post;
828
+
829
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
830
+			if (empty($post_category) && isset($post->{$cat_taxonomy})) {
831
+				$post_category = $post->{$cat_taxonomy};
832
+			}
833 833
 
834
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
834
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
835 835
 
836
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
837
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
838
-                    if (is_numeric($cat_part)) {
839
-                        $cat_part_arr[] = $cat_part;
840
-                    }
841
-                }
842
-                if (is_array($cat_part_arr)) {
843
-                    $post_category = implode(',', $cat_part_arr);
844
-                }
845
-            }
836
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
837
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
838
+					if (is_numeric($cat_part)) {
839
+						$cat_part_arr[] = $cat_part;
840
+					}
841
+				}
842
+				if (is_array($cat_part_arr)) {
843
+					$post_category = implode(',', $cat_part_arr);
844
+				}
845
+			}
846 846
 
847
-            if (!empty($post_category)) {
848
-                $cat1 = array_filter(explode(',', $post_category));
849
-                $post_category = ',' . implode(',', $cat1) . ',';
847
+			if (!empty($post_category)) {
848
+				$cat1 = array_filter(explode(',', $post_category));
849
+				$post_category = ',' . implode(',', $cat1) . ',';
850 850
 
851
-            }
851
+			}
852 852
 
853
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
853
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
854 854
 
855
-                $post_category_upd = explode(',', $post_category);
856
-                $post_category_change = '';
857
-                foreach ($post_category_upd as $cat) {
855
+				$post_category_upd = explode(',', $post_category);
856
+				$post_category_change = '';
857
+				foreach ($post_category_upd as $cat) {
858 858
 
859
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
860
-                        $post_category_change .= ',' . $cat;
861
-                    }
862
-                }
863
-                $post_category = $post_category_change;
864
-            }
859
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
860
+						$post_category_change .= ',' . $cat;
861
+					}
862
+				}
863
+				$post_category = $post_category_change;
864
+			}
865 865
 
866 866
 
867
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
868
-                $post_category_str = $post_categories[$cat_taxonomy];
869
-            }
870
-        }
867
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
868
+				$post_category_str = $post_categories[$cat_taxonomy];
869
+			}
870
+		}
871 871
 
872
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
872
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
873 873
 
874
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
874
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
875 875
 
876
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
876
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
877 877
 
878 878
 
879
-        ?>
879
+		?>
880 880
         <div class="cat_sublist">
881 881
             <?php
882 882
 
883
-            $post_id = isset($post->ID) ? $post->ID : '';
883
+			$post_id = isset($post->ID) ? $post->ID : '';
884 884
 
885
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
885
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
886 886
 
887
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
888
-            }
889
-            ?>
887
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
888
+			}
889
+			?>
890 890
         </div>
891 891
         <script type="text/javascript">
892 892
 
@@ -1009,22 +1009,22 @@  discard block
 block discarded – undo
1009 1009
 
1010 1010
         </script>
1011 1011
         <?php
1012
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1013
-            $post_cat_str = $post_categories[$cat_taxonomy];
1014
-            $post_cat_array = explode("#", $post_cat_str);
1015
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1016
-                $style = "display:none;";
1017
-        }
1018
-        ?>
1012
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1013
+			$post_cat_str = $post_categories[$cat_taxonomy];
1014
+			$post_cat_array = explode("#", $post_cat_str);
1015
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1016
+				$style = "display:none;";
1017
+		}
1018
+		?>
1019 1019
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1020
-            echo $style;
1021
-        }?> ">
1020
+			echo $style;
1021
+		}?> ">
1022 1022
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1023
-            ?>
1023
+			?>
1024 1024
         </div>
1025 1025
     <?php
1026 1026
 
1027
-    }
1027
+	}
1028 1028
 }
1029 1029
 
1030 1030
 /**
@@ -1041,23 +1041,23 @@  discard block
 block discarded – undo
1041 1041
  */
1042 1042
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
1043 1043
 {
1044
-    global $exclude_cats;
1044
+	global $exclude_cats;
1045 1045
 
1046
-    if ($exclude != '') {
1047
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
1046
+	if ($exclude != '') {
1047
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
1048 1048
 
1049
-        if(is_array( $exclude_cats)){
1050
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1051
-        }else{
1052
-            $exclude_cats = intval($exclude_cats);
1053
-        }
1049
+		if(is_array( $exclude_cats)){
1050
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1051
+		}else{
1052
+			$exclude_cats = intval($exclude_cats);
1053
+		}
1054 1054
 
1055
-    }
1055
+	}
1056 1056
 
1057
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1058
-        (!is_array($exclude_cats) || empty($exclude_cats))
1059
-    ) {
1060
-        ?>
1057
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1058
+		(!is_array($exclude_cats) || empty($exclude_cats))
1059
+	) {
1060
+		?>
1061 1061
 
1062 1062
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1063 1063
 
@@ -1086,8 +1086,8 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
             <br/>
1088 1088
             <?php
1089
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1090
-            if (!empty($cat_terms)) { ?>
1089
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1090
+			if (!empty($cat_terms)) { ?>
1091 1091
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1092 1092
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1093 1093
             <?php } ?>
@@ -1109,53 +1109,53 @@  discard block
 block discarded – undo
1109 1109
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1110 1110
 {
1111 1111
 
1112
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1113
-        $post_cat_str = $post_categories[$request_taxonomy];
1114
-        $post_cat_array = explode("#", $post_cat_str);
1115
-        if (is_array($post_cat_array)) {
1116
-            $post_cat_array = array_unique( $post_cat_array );
1112
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1113
+		$post_cat_str = $post_categories[$request_taxonomy];
1114
+		$post_cat_array = explode("#", $post_cat_str);
1115
+		if (is_array($post_cat_array)) {
1116
+			$post_cat_array = array_unique( $post_cat_array );
1117 1117
 
1118 1118
 			foreach ($post_cat_array as $post_cat_html) {
1119 1119
 
1120
-                $post_cat_info = explode(":", $post_cat_html);
1121
-                $post_maincat_str = $post_cat_info[0];
1120
+				$post_cat_info = explode(":", $post_cat_html);
1121
+				$post_maincat_str = $post_cat_info[0];
1122 1122
 
1123
-                if (!empty($post_maincat_str)) {
1124
-                    $post_maincat_info = explode(",", $post_maincat_str);
1125
-                    $post_maincat_id = $post_maincat_info[0];
1126
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1127
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1128
-                }
1129
-                $post_sub_catid = '';
1130
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1131
-                    $post_sub_catid = (int)$post_cat_info[1];
1132
-                }
1123
+				if (!empty($post_maincat_str)) {
1124
+					$post_maincat_info = explode(",", $post_maincat_str);
1125
+					$post_maincat_id = $post_maincat_info[0];
1126
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1127
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1128
+				}
1129
+				$post_sub_catid = '';
1130
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1131
+					$post_sub_catid = (int)$post_cat_info[1];
1132
+				}
1133 1133
 
1134
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1134
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1135 1135
 
1136
-            }
1137
-        } else {
1136
+			}
1137
+		} else {
1138 1138
 
1139
-            $post_cat_info = explode(":", $post_cat_str);
1140
-            $post_maincat_str = $post_cat_info[0];
1139
+			$post_cat_info = explode(":", $post_cat_str);
1140
+			$post_maincat_str = $post_cat_info[0];
1141 1141
 
1142
-            $post_sub_catid = '';
1142
+			$post_sub_catid = '';
1143 1143
 
1144
-            if (!empty($post_maincat_str)) {
1145
-                $post_maincat_info = explode(",", $post_maincat_str);
1146
-                $post_maincat_id = $post_maincat_info[0];
1147
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1148
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1149
-            }
1144
+			if (!empty($post_maincat_str)) {
1145
+				$post_maincat_info = explode(",", $post_maincat_str);
1146
+				$post_maincat_id = $post_maincat_info[0];
1147
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1148
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1149
+			}
1150 1150
 
1151
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1152
-                $post_sub_catid = (int)$post_cat_info[1];
1153
-            }
1151
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1152
+				$post_sub_catid = (int)$post_cat_info[1];
1153
+			}
1154 1154
 
1155
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1155
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1156 1156
 
1157
-        }
1158
-    }
1157
+		}
1158
+	}
1159 1159
 }
1160 1160
 
1161 1161
 /**
@@ -1169,35 +1169,35 @@  discard block
 block discarded – undo
1169 1169
  */
1170 1170
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1171 1171
 {
1172
-    global $exclude_cats;
1172
+	global $exclude_cats;
1173 1173
 
1174
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1174
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1175 1175
 
1176
-    if (!empty($cat_terms)) {
1177
-        $onchange = '';
1178
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1176
+	if (!empty($cat_terms)) {
1177
+		$onchange = '';
1178
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1179 1179
 
1180
-        $option_selected = '';
1181
-        if (!$selected)
1182
-            $option_slected = ' selected="selected" ';
1180
+		$option_selected = '';
1181
+		if (!$selected)
1182
+			$option_slected = ' selected="selected" ';
1183 1183
 
1184
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1184
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1185 1185
 
1186
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1186
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1187 1187
 
1188
-        foreach ($cat_terms as $cat_term) {
1189
-            $option_selected = '';
1190
-            if ($selected == $cat_term->term_id)
1191
-                $option_selected = ' selected="selected" ';
1188
+		foreach ($cat_terms as $cat_term) {
1189
+			$option_selected = '';
1190
+			if ($selected == $cat_term->term_id)
1191
+				$option_selected = ' selected="selected" ';
1192 1192
 
1193
-            // Count child terms
1194
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1195
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1193
+			// Count child terms
1194
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1195
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1196 1196
 
1197
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>';
1198
-        }
1199
-        echo '</select>';
1200
-    }
1197
+			echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>';
1198
+		}
1199
+		echo '</select>';
1200
+	}
1201 1201
 }
1202 1202
 
1203 1203
 /**
@@ -1213,28 +1213,28 @@  discard block
 block discarded – undo
1213 1213
  */
1214 1214
 function geodir_custom_update_messages($messages)
1215 1215
 {
1216
-    global $post, $post_ID;
1217
-
1218
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1219
-
1220
-    foreach ($post_types as $post_type => $post_object) {
1221
-
1222
-        $messages[$post_type] = array(
1223
-            0 => '', // Unused. Messages start at index 1.
1224
-            1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1225
-            2 => __('Custom field updated.', 'geodirectory'),
1226
-            3 => __('Custom field deleted.', 'geodirectory'),
1227
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1228
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1229
-            6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1230
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1231
-            8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1232
-            9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1233
-            10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1234
-        );
1235
-    }
1236
-
1237
-    return $messages;
1216
+	global $post, $post_ID;
1217
+
1218
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1219
+
1220
+	foreach ($post_types as $post_type => $post_object) {
1221
+
1222
+		$messages[$post_type] = array(
1223
+			0 => '', // Unused. Messages start at index 1.
1224
+			1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1225
+			2 => __('Custom field updated.', 'geodirectory'),
1226
+			3 => __('Custom field deleted.', 'geodirectory'),
1227
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1228
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1229
+			6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1230
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1231
+			8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1232
+			9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1233
+			10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1234
+		);
1235
+	}
1236
+
1237
+	return $messages;
1238 1238
 }
1239 1239
 
1240 1240
 
@@ -1249,182 +1249,182 @@  discard block
 block discarded – undo
1249 1249
 function geodir_register_defaults()
1250 1250
 {
1251 1251
 
1252
-    global $wpdb;
1253
-
1254
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1255
-
1256
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1257
-        $listing_slug = 'places';
1258
-
1259
-    /**
1260
-     * Taxonomies
1261
-     **/
1262
-    //if ( ! taxonomy_exists('gd_place_tags') )
1263
-    {
1264
-
1265
-        $gd_placetags = array();
1266
-        $gd_placetags['object_type'] = 'gd_place';
1267
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1268
-        $gd_placetags['args'] = array(
1269
-            'public' => true,
1270
-            'hierarchical' => false,
1271
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1272
-            'query_var' => true,
1273
-
1274
-            'labels' => array(
1275
-                'name' => __('Place Tags', 'geodirectory'),
1276
-                'singular_name' => __('Place Tag', 'geodirectory'),
1277
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1278
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1279
-                'all_items' => __('All Place Tags', 'geodirectory'),
1280
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1281
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1282
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1283
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1284
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1285
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1286
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1287
-            ),
1288
-        );
1289
-
1290
-
1291
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1292
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1293
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1294
-
1295
-
1296
-        // Update post types and delete tmp options
1297
-        flush_rewrite_rules();
1298
-
1299
-    }
1300
-
1301
-    //if ( ! taxonomy_exists('gd_placecategory') )
1302
-    {
1303
-
1304
-        $gd_placecategory = array();
1305
-        $gd_placecategory['object_type'] = 'gd_place';
1306
-        $gd_placecategory['listing_slug'] = $listing_slug;
1307
-        $gd_placecategory['args'] = array(
1308
-            'public' => true,
1309
-            'hierarchical' => true,
1310
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1311
-            'query_var' => true,
1312
-            'labels' => array(
1313
-                'name' => __('Place Categories', 'geodirectory'),
1314
-                'singular_name' => __('Place Category', 'geodirectory'),
1315
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1316
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1317
-                'all_items' => __('All Place Categories', 'geodirectory'),
1318
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1319
-                'update_item' => __('Update Place Category', 'geodirectory'),
1320
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1321
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1322
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1323
-            ),
1324
-        );
1325
-
1326
-
1327
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1328
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1329
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1330
-
1331
-
1332
-        flush_rewrite_rules();
1333
-    }
1334
-
1335
-    /**
1336
-     * Post Types
1337
-     **/
1338
-
1339
-    //if ( ! post_type_exists('gd_place') )
1340
-    {
1341
-
1342
-        $labels = array(
1343
-            'name' => __('Places', 'geodirectory'),
1344
-            'singular_name' => __('Place', 'geodirectory'),
1345
-            'add_new' => __('Add New', 'geodirectory'),
1346
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1347
-            'edit_item' => __('Edit Place', 'geodirectory'),
1348
-            'new_item' => __('New Place', 'geodirectory'),
1349
-            'view_item' => __('View Place', 'geodirectory'),
1350
-            'search_items' => __('Search Places', 'geodirectory'),
1351
-            'not_found' => __('No Place Found', 'geodirectory'),
1352
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1353
-
1354
-        $place_default = array(
1355
-            'labels' => $labels,
1356
-            'can_export' => true,
1357
-            'capability_type' => 'post',
1358
-            'description' => 'Place post type.',
1359
-            'has_archive' => $listing_slug,
1360
-            'hierarchical' => false,
1361
-            'map_meta_cap' => true,
1362
-            'menu_icon' => $menu_icon,
1363
-            'public' => true,
1364
-            'query_var' => true,
1365
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1366
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1367
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1368
-
1369
-        //Update custom post types
1370
-        $geodir_post_types = get_option('geodir_post_types');
1371
-        $geodir_post_types['gd_place'] = $place_default;
1372
-        update_option('geodir_post_types', $geodir_post_types);
1373
-
1374
-        // Update post types and delete tmp options
1375
-        flush_rewrite_rules();
1376
-    }
1377
-
1378
-
1379
-    geodir_register_taxonomies();
1380
-    geodir_register_post_types();
1381
-
1382
-    //die;
1252
+	global $wpdb;
1253
+
1254
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1255
+
1256
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1257
+		$listing_slug = 'places';
1258
+
1259
+	/**
1260
+	 * Taxonomies
1261
+	 **/
1262
+	//if ( ! taxonomy_exists('gd_place_tags') )
1263
+	{
1264
+
1265
+		$gd_placetags = array();
1266
+		$gd_placetags['object_type'] = 'gd_place';
1267
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1268
+		$gd_placetags['args'] = array(
1269
+			'public' => true,
1270
+			'hierarchical' => false,
1271
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1272
+			'query_var' => true,
1273
+
1274
+			'labels' => array(
1275
+				'name' => __('Place Tags', 'geodirectory'),
1276
+				'singular_name' => __('Place Tag', 'geodirectory'),
1277
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1278
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1279
+				'all_items' => __('All Place Tags', 'geodirectory'),
1280
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1281
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1282
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1283
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1284
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1285
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1286
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1287
+			),
1288
+		);
1289
+
1290
+
1291
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1292
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1293
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1294
+
1295
+
1296
+		// Update post types and delete tmp options
1297
+		flush_rewrite_rules();
1298
+
1299
+	}
1300
+
1301
+	//if ( ! taxonomy_exists('gd_placecategory') )
1302
+	{
1303
+
1304
+		$gd_placecategory = array();
1305
+		$gd_placecategory['object_type'] = 'gd_place';
1306
+		$gd_placecategory['listing_slug'] = $listing_slug;
1307
+		$gd_placecategory['args'] = array(
1308
+			'public' => true,
1309
+			'hierarchical' => true,
1310
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1311
+			'query_var' => true,
1312
+			'labels' => array(
1313
+				'name' => __('Place Categories', 'geodirectory'),
1314
+				'singular_name' => __('Place Category', 'geodirectory'),
1315
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1316
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1317
+				'all_items' => __('All Place Categories', 'geodirectory'),
1318
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1319
+				'update_item' => __('Update Place Category', 'geodirectory'),
1320
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1321
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1322
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1323
+			),
1324
+		);
1325
+
1326
+
1327
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1328
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1329
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1330
+
1331
+
1332
+		flush_rewrite_rules();
1333
+	}
1334
+
1335
+	/**
1336
+	 * Post Types
1337
+	 **/
1338
+
1339
+	//if ( ! post_type_exists('gd_place') )
1340
+	{
1341
+
1342
+		$labels = array(
1343
+			'name' => __('Places', 'geodirectory'),
1344
+			'singular_name' => __('Place', 'geodirectory'),
1345
+			'add_new' => __('Add New', 'geodirectory'),
1346
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1347
+			'edit_item' => __('Edit Place', 'geodirectory'),
1348
+			'new_item' => __('New Place', 'geodirectory'),
1349
+			'view_item' => __('View Place', 'geodirectory'),
1350
+			'search_items' => __('Search Places', 'geodirectory'),
1351
+			'not_found' => __('No Place Found', 'geodirectory'),
1352
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1353
+
1354
+		$place_default = array(
1355
+			'labels' => $labels,
1356
+			'can_export' => true,
1357
+			'capability_type' => 'post',
1358
+			'description' => 'Place post type.',
1359
+			'has_archive' => $listing_slug,
1360
+			'hierarchical' => false,
1361
+			'map_meta_cap' => true,
1362
+			'menu_icon' => $menu_icon,
1363
+			'public' => true,
1364
+			'query_var' => true,
1365
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1366
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1367
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1368
+
1369
+		//Update custom post types
1370
+		$geodir_post_types = get_option('geodir_post_types');
1371
+		$geodir_post_types['gd_place'] = $place_default;
1372
+		update_option('geodir_post_types', $geodir_post_types);
1373
+
1374
+		// Update post types and delete tmp options
1375
+		flush_rewrite_rules();
1376
+	}
1377
+
1378
+
1379
+	geodir_register_taxonomies();
1380
+	geodir_register_post_types();
1381
+
1382
+	//die;
1383 1383
 
1384 1384
 }
1385 1385
 
1386 1386
 $gd_wpml_get_languages = "";
1387 1387
 function gd_wpml_get_lang_from_url($url) {
1388
-    global $sitepress, $gd_wpml_get_languages;
1388
+	global $sitepress, $gd_wpml_get_languages;
1389 1389
     
1390
-    if (geodir_is_wpml()) {
1391
-        return $sitepress->get_language_from_url($url);
1392
-    }
1390
+	if (geodir_is_wpml()) {
1391
+		return $sitepress->get_language_from_url($url);
1392
+	}
1393 1393
     
1394
-    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {
1395
-        return $_REQUEST['lang'];
1396
-    }
1394
+	if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {
1395
+		return $_REQUEST['lang'];
1396
+	}
1397 1397
 
1398
-    $url = str_replace(array("http://","https://"),"",$url);
1398
+	$url = str_replace(array("http://","https://"),"",$url);
1399 1399
 
1400
-    // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1401
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1400
+	// site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1401
+	$site_url = str_replace(array("http://","https://"),"",site_url());
1402 1402
 
1403
-    $url = str_replace($site_url,"",$url);
1403
+	$url = str_replace($site_url,"",$url);
1404 1404
 
1405
-    $segments = explode('/', trim($url, '/'));
1405
+	$segments = explode('/', trim($url, '/'));
1406 1406
 
1407
-    if ($gd_wpml_get_languages) {
1408
-        $langs = $gd_wpml_get_languages;
1409
-    } else {
1410
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1411
-    }
1407
+	if ($gd_wpml_get_languages) {
1408
+		$langs = $gd_wpml_get_languages;
1409
+	} else {
1410
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1411
+	}
1412 1412
 
1413
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1414
-        return $segments[0];
1415
-    }
1413
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1414
+		return $segments[0];
1415
+	}
1416 1416
 
1417
-    return false;
1417
+	return false;
1418 1418
 }
1419 1419
 
1420 1420
 function gd_wpml_slug_translation_turned_on($post_type) {
1421 1421
 
1422
-    global $sitepress;
1423
-    $settings = $sitepress->get_settings();
1424
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1425
-    && $settings['posts_slug_translation']['types'][$post_type]
1426
-    && isset($settings['posts_slug_translation']['on'])
1427
-    && $settings['posts_slug_translation']['on'];
1422
+	global $sitepress;
1423
+	$settings = $sitepress->get_settings();
1424
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1425
+	&& $settings['posts_slug_translation']['types'][$post_type]
1426
+	&& isset($settings['posts_slug_translation']['on'])
1427
+	&& $settings['posts_slug_translation']['on'];
1428 1428
 }
1429 1429
 
1430 1430
 
@@ -1451,162 +1451,162 @@  discard block
 block discarded – undo
1451 1451
  */
1452 1452
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1453 1453
 {
1454
-    //echo $post_link."<br />".$sample ;
1454
+	//echo $post_link."<br />".$sample ;
1455 1455
 
1456 1456
 
1457
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1458
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1459
-        if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
1460
-    } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
1461
-        return $post_link;
1462
-    } else {
1463
-        $orig_post = $post;
1464
-        $post = $post_obj;
1465
-    }
1457
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1458
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1459
+		if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
1460
+	} elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
1461
+		return $post_link;
1462
+	} else {
1463
+		$orig_post = $post;
1464
+		$post = $post_obj;
1465
+	}
1466 1466
 
1467 1467
 
1468 1468
 
1469
-    if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit;
1469
+	if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit;
1470 1470
 
1471 1471
 
1472
-        // if we dont have a GD post then try to grab it
1473
-        if(!isset($post->default_category)){
1474
-            $gd_post = geodir_get_post_info($post->ID);
1475
-            if(!empty($gd_post)){
1476
-                $post = $gd_post;
1477
-            }
1478
-        }
1472
+		// if we dont have a GD post then try to grab it
1473
+		if(!isset($post->default_category)){
1474
+			$gd_post = geodir_get_post_info($post->ID);
1475
+			if(!empty($gd_post)){
1476
+				$post = $gd_post;
1477
+			}
1478
+		}
1479 1479
 
1480 1480
 
1481
-        $post_types = get_option('geodir_post_types');
1482
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1481
+		$post_types = get_option('geodir_post_types');
1482
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1483 1483
 
1484
-        // Alter the CPT slug if WPML is set to do so
1485
-        if(geodir_wpml_is_post_type_translated($post->post_type)){
1486
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1484
+		// Alter the CPT slug if WPML is set to do so
1485
+		if(geodir_wpml_is_post_type_translated($post->post_type)){
1486
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1487 1487
 
1488
-                $org_slug = $slug;
1489
-                $slug = apply_filters( 'wpml_translate_single_string',
1490
-                    $slug,
1491
-                    'WordPress',
1492
-                    'URL slug: ' . $slug,
1493
-                    $language_code);
1488
+				$org_slug = $slug;
1489
+				$slug = apply_filters( 'wpml_translate_single_string',
1490
+					$slug,
1491
+					'WordPress',
1492
+					'URL slug: ' . $slug,
1493
+					$language_code);
1494 1494
 
1495
-                if(!$slug){$slug = $org_slug;}
1495
+				if(!$slug){$slug = $org_slug;}
1496 1496
 
1497
-            }
1498
-        }
1497
+			}
1498
+		}
1499 1499
 
1500
-        if (function_exists('geodir_location_geo_home_link')) {
1501
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1502
-        }
1500
+		if (function_exists('geodir_location_geo_home_link')) {
1501
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1502
+		}
1503 1503
         
1504
-        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1505
-        $site_url = trailingslashit(get_bloginfo('url'));
1504
+		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1505
+		$site_url = trailingslashit(get_bloginfo('url'));
1506 1506
         
1507
-        if (function_exists('geodir_location_geo_home_link')) {
1508
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1509
-        }
1510
-
1511
-        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1512
-        if ($fix_url) {
1513
-            $post_link = str_replace($site_url, '', $post_link);
1514
-        }
1515
-
1516
-        $post_link = trailingslashit(
1517
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1518
-        );
1519
-
1520
-        if ($fix_url) {
1521
-            $post_link = $site_url . $post_link;
1522
-        }
1523
-
1524
-        if (isset($comment_post_cache[$post->ID])) {
1525
-            $post = $comment_post_cache[$post->ID];
1526
-        }
1527
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1528
-            $post_id = $post->ID;
1529
-            if (isset($orig_post)) {
1530
-                $post = $orig_post;
1531
-            }
1532
-            return $gd_permalink_cache[$post_id];
1533
-        }
1507
+		if (function_exists('geodir_location_geo_home_link')) {
1508
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1509
+		}
1534 1510
 
1535
-        if (!isset($post->post_locations)) {
1536
-            $post_type = $post->post_type;
1537
-            $ID = $post->ID;
1538
-            $post2 = $wpdb->get_row(
1539
-                $wpdb->prepare(
1540
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1541
-                    array($post->ID)
1542
-                )
1543
-            );
1511
+		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1512
+		if ($fix_url) {
1513
+			$post_link = str_replace($site_url, '', $post_link);
1514
+		}
1544 1515
 
1545
-            $post = (object)array_merge((array)$post, (array)$post2);
1516
+		$post_link = trailingslashit(
1517
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1518
+		);
1546 1519
 
1547
-            $comment_post_cache[$post->ID] = $post;
1548
-        }
1520
+		if ($fix_url) {
1521
+			$post_link = $site_url . $post_link;
1522
+		}
1549 1523
 
1524
+		if (isset($comment_post_cache[$post->ID])) {
1525
+			$post = $comment_post_cache[$post->ID];
1526
+		}
1527
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1528
+			$post_id = $post->ID;
1529
+			if (isset($orig_post)) {
1530
+				$post = $orig_post;
1531
+			}
1532
+			return $gd_permalink_cache[$post_id];
1533
+		}
1550 1534
 
1535
+		if (!isset($post->post_locations)) {
1536
+			$post_type = $post->post_type;
1537
+			$ID = $post->ID;
1538
+			$post2 = $wpdb->get_row(
1539
+				$wpdb->prepare(
1540
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1541
+					array($post->ID)
1542
+				)
1543
+			);
1551 1544
 
1552
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1545
+			$post = (object)array_merge((array)$post, (array)$post2);
1553 1546
 
1554
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1555
-                $location_request = '';
1547
+			$comment_post_cache[$post->ID] = $post;
1548
+		}
1556 1549
 
1557 1550
 
1558
-                if (!empty($post->post_locations)) {
1559
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1560
-                    if (count($geodir_arr_locations) == 3) {
1561
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1562
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1563
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1564
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1565
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1566
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1567 1551
 
1568
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1569
-                            'region_slug' => $post->region_slug,
1570
-                            'city_slug' => $post->city_slug
1571
-                        );
1552
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1572 1553
 
1573
-                    } else
1574
-                        $post_location = geodir_get_location();
1554
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1555
+				$location_request = '';
1575 1556
 
1576 1557
 
1577
-                } else {
1558
+				if (!empty($post->post_locations)) {
1559
+					$geodir_arr_locations = explode(',', $post->post_locations);
1560
+					if (count($geodir_arr_locations) == 3) {
1561
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1562
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1563
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1564
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1565
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1566
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1578 1567
 
1579
-                    $post_location_sql = $wpdb->get_results(
1580
-                        $wpdb->prepare(
1581
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1582
-                            array($post->ID)
1583
-                        )
1584
-                    );
1585
-
1586
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1587
-
1588
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1589
-                        if (count($geodir_arr_locations) == 3) {
1590
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1591
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1592
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1593
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1594
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1595
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1596
-
1597
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1598
-                                'region_slug' => $post->region_slug,
1599
-                                'city_slug' => $post->city_slug
1600
-                            );
1568
+						$post_location = (object)array('country_slug' => $post->country_slug,
1569
+							'region_slug' => $post->region_slug,
1570
+							'city_slug' => $post->city_slug
1571
+						);
1601 1572
 
1602
-                        }
1603
-                    } else
1604
-                        $post_location = geodir_get_location();
1605
-                }
1573
+					} else
1574
+						$post_location = geodir_get_location();
1575
+
1576
+
1577
+				} else {
1578
+
1579
+					$post_location_sql = $wpdb->get_results(
1580
+						$wpdb->prepare(
1581
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1582
+							array($post->ID)
1583
+						)
1584
+					);
1585
+
1586
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1587
+
1588
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1589
+						if (count($geodir_arr_locations) == 3) {
1590
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1591
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1592
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1593
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1594
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1595
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1596
+
1597
+							$post_location = (object)array('country_slug' => $post->country_slug,
1598
+								'region_slug' => $post->region_slug,
1599
+								'city_slug' => $post->city_slug
1600
+							);
1601
+
1602
+						}
1603
+					} else
1604
+						$post_location = geodir_get_location();
1605
+				}
1606 1606
 
1607 1607
 
1608
-                if (!empty($post_location)) {
1609
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1608
+				if (!empty($post_location)) {
1609
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1610 1610
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1611 1611
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1612 1612
 					
@@ -1624,88 +1624,88 @@  discard block
 block discarded – undo
1624 1624
 					$location_slug[] = $city_slug;
1625 1625
 					
1626 1626
 					$location_request .= implode('/', $location_slug) . '/';
1627
-                }
1628
-            }
1627
+				}
1628
+			}
1629 1629
 
1630
-            if (get_option('geodir_add_categories_url')) {
1630
+			if (get_option('geodir_add_categories_url')) {
1631 1631
 
1632
-                $term_request = '';
1633
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1634
-                $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : '';
1632
+				$term_request = '';
1633
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1634
+				$taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : '';
1635 1635
 
1636
-                if (!empty($post->default_category)) {
1637
-                    $post_terms = $post->default_category;
1638
-                } else {
1639
-                    $post_terms = '';
1640
-
1641
-                    if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
1642
-                        $post_terms = absint($_POST['post_default_category']);
1643
-                    }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
1644
-                        $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
1645
-                        $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0;
1646
-                    }elseif (isset($post->{$taxonomies})) {
1647
-                        $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1648
-                        $post_terms = $post_terms[0];
1649
-                    }
1636
+				if (!empty($post->default_category)) {
1637
+					$post_terms = $post->default_category;
1638
+				} else {
1639
+					$post_terms = '';
1640
+
1641
+					if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
1642
+						$post_terms = absint($_POST['post_default_category']);
1643
+					}elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
1644
+						$post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
1645
+						$post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0;
1646
+					}elseif (isset($post->{$taxonomies})) {
1647
+						$post_terms = explode(",", trim($post->{$taxonomies}, ","));
1648
+						$post_terms = $post_terms[0];
1649
+					}
1650 1650
 
1651
-                    if (!$post_terms)
1652
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1651
+					if (!$post_terms)
1652
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1653 1653
 
1654
-                    if (!$post_terms) {
1655
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1654
+					if (!$post_terms) {
1655
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1656 1656
 
1657
-                        if ($post_terms) {
1658
-                            $post_terms = explode(",", trim($post_terms, ","));
1659
-                            $post_terms = $post_terms[0];
1660
-                        }
1661
-                    }
1662
-                }
1657
+						if ($post_terms) {
1658
+							$post_terms = explode(",", trim($post_terms, ","));
1659
+							$post_terms = $post_terms[0];
1660
+						}
1661
+					}
1662
+				}
1663 1663
 
1664
-                $term = get_term_by('id', $post_terms, $taxonomies);
1664
+				$term = get_term_by('id', $post_terms, $taxonomies);
1665 1665
 
1666
-                if (!empty($term))
1667
-                    $term_request = $term->slug;
1668
-                //$term_request = $term->slug.'/';
1669
-            }
1666
+				if (!empty($term))
1667
+					$term_request = $term->slug;
1668
+				//$term_request = $term->slug.'/';
1669
+			}
1670 1670
 
1671
-            $request_term = '';
1672
-            $listingurl_separator = '';
1673
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1674
-            $detailurl_separator = '';
1675
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1676
-                $request_term = $location_request;
1677
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1678
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1679
-                $request_term .= $term_request;
1671
+			$request_term = '';
1672
+			$listingurl_separator = '';
1673
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1674
+			$detailurl_separator = '';
1675
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1676
+				$request_term = $location_request;
1677
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1678
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1679
+				$request_term .= $term_request;
1680 1680
 
1681
-            } else {
1682
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1681
+			} else {
1682
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1683 1683
 
1684
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1685
-            }
1686
-            $request_term = trim($request_term, '/');
1684
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1685
+			}
1686
+			$request_term = trim($request_term, '/');
1687 1687
             
1688
-            // Fix with WPML the location terms added twice when CPT slug is translated.
1689
-            if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
1690
-                $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
1691
-            }
1688
+			// Fix with WPML the location terms added twice when CPT slug is translated.
1689
+			if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
1690
+				$post_link = str_replace('%gd_taxonomy%/', '', $post_link);
1691
+			}
1692 1692
             
1693
-            if (!empty($request_term))
1694
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1695
-            else
1696
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1697
-            //echo $post_link ;
1698
-        }
1699
-        // temp cache the permalink
1700
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1701
-            $gd_permalink_cache[$post->ID] = $post_link;
1702
-        }
1703
-    }
1704
-    if (isset($orig_post)) {
1705
-        $post = $orig_post;
1706
-    }
1707
-
1708
-    return $post_link;
1693
+			if (!empty($request_term))
1694
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1695
+			else
1696
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1697
+			//echo $post_link ;
1698
+		}
1699
+		// temp cache the permalink
1700
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1701
+			$gd_permalink_cache[$post->ID] = $post_link;
1702
+		}
1703
+	}
1704
+	if (isset($orig_post)) {
1705
+		$post = $orig_post;
1706
+	}
1707
+
1708
+	return $post_link;
1709 1709
 }
1710 1710
 
1711 1711
 /**
@@ -1721,117 +1721,117 @@  discard block
 block discarded – undo
1721 1721
  * @return string The term link.
1722 1722
  */
1723 1723
 function geodir_term_link($termlink, $term, $taxonomy) {
1724
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1724
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1725 1725
 
1726
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1727
-        global $geodir_add_location_url, $gd_session;
1728
-        $include_location = false;
1729
-        $request_term = array();
1730
-        $add_location_url = get_option('geodir_add_location_url');
1731
-        $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1726
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1727
+		global $geodir_add_location_url, $gd_session;
1728
+		$include_location = false;
1729
+		$request_term = array();
1730
+		$add_location_url = get_option('geodir_add_location_url');
1731
+		$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1732 1732
 
1733
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1733
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1734 1734
 
1735
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1736
-            if ($geodir_add_location_url && $add_location_url) {
1737
-                $include_location = true;
1738
-            }
1739
-        } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1740
-            $include_location = true;
1741
-        } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1742
-            $include_location = true;
1743
-        }
1744
-
1745
-        if ($include_location) {
1746
-            global $post;
1747
-            $location_terms = array();
1735
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1736
+			if ($geodir_add_location_url && $add_location_url) {
1737
+				$include_location = true;
1738
+			}
1739
+		} elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1740
+			$include_location = true;
1741
+		} elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1742
+			$include_location = true;
1743
+		}
1744
+
1745
+		if ($include_location) {
1746
+			global $post;
1747
+			$location_terms = array();
1748 1748
             
1749
-            $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1749
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1750 1750
             
1751
-            if (geodir_is_page('detail')) {
1752
-                if (!isset($post->country_slug) && !empty($post->post_locations)) {
1753
-                    $post_locations = explode(',', $post->post_locations);
1754
-
1755
-                    if (count($post_locations) == 3) {
1756
-                        $post->city_slug = str_replace('[', '', $post_locations[0]);
1757
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1758
-                        $post->region_slug = str_replace('[', '', $post_locations[1]);
1759
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1760
-                        $post->country_slug = str_replace('[', '', $post_locations[2]);
1761
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1762
-                    }
1763
-                }
1751
+			if (geodir_is_page('detail')) {
1752
+				if (!isset($post->country_slug) && !empty($post->post_locations)) {
1753
+					$post_locations = explode(',', $post->post_locations);
1754
+
1755
+					if (count($post_locations) == 3) {
1756
+						$post->city_slug = str_replace('[', '', $post_locations[0]);
1757
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1758
+						$post->region_slug = str_replace('[', '', $post_locations[1]);
1759
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1760
+						$post->country_slug = str_replace('[', '', $post_locations[2]);
1761
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1762
+					}
1763
+				}
1764 1764
 
1765
-                if (isset($post->country_slug)) {
1766
-                    $location_terms = array(
1767
-                        'gd_country' => $post->country_slug,
1768
-                        'gd_region' => $post->region_slug,
1769
-                        'gd_city' => $post->city_slug
1770
-                    );
1765
+				if (isset($post->country_slug)) {
1766
+					$location_terms = array(
1767
+						'gd_country' => $post->country_slug,
1768
+						'gd_region' => $post->region_slug,
1769
+						'gd_city' => $post->city_slug
1770
+					);
1771 1771
 
1772
-                    if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1773
-                        $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1774
-                    }
1775
-                }
1776
-            }
1772
+					if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1773
+						$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1774
+					}
1775
+				}
1776
+			}
1777 1777
             
1778
-            if (empty($location_terms)) {
1779
-                $location_terms = geodir_get_current_location_terms('query_vars');
1780
-            }
1778
+			if (empty($location_terms)) {
1779
+				$location_terms = geodir_get_current_location_terms('query_vars');
1780
+			}
1781 1781
 
1782
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1783
-            $location_terms = geodir_remove_location_terms($location_terms);
1782
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1783
+			$location_terms = geodir_remove_location_terms($location_terms);
1784 1784
 
1785
-            if (!empty($location_terms)) {
1786
-                $url_separator = '';
1785
+			if (!empty($location_terms)) {
1786
+				$url_separator = '';
1787 1787
 
1788
-                if (get_option('permalink_structure') != '') {
1789
-                    $old_listing_slug = '/' . $listing_slug . '/';
1790
-                    $request_term = implode("/", $location_terms);
1791
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1788
+				if (get_option('permalink_structure') != '') {
1789
+					$old_listing_slug = '/' . $listing_slug . '/';
1790
+					$request_term = implode("/", $location_terms);
1791
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1792 1792
 
1793
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1794
-                } else {
1795
-                    $termlink = geodir_getlink($termlink, $request_term);
1796
-                }
1797
-            }
1798
-        }
1793
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1794
+				} else {
1795
+					$termlink = geodir_getlink($termlink, $request_term);
1796
+				}
1797
+			}
1798
+		}
1799 1799
 
1800
-        // Alter the CPT slug is WPML is set to do so
1801
-        /* we can replace this with the below function
1800
+		// Alter the CPT slug is WPML is set to do so
1801
+		/* we can replace this with the below function
1802 1802
         if(geodir_is_wpml()){
1803 1803
             global $sitepress;
1804 1804
             $post_type = str_replace("category","",$taxonomy);
1805 1805
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1806 1806
         }*/
1807 1807
 
1808
-        // Alter the CPT slug if WPML is set to do so
1809
-        if (geodir_is_wpml()) {
1810
-            $post_types = get_option('geodir_post_types');
1811
-            $post_type = str_replace("category","",$taxonomy);
1812
-            $post_type = str_replace("_tags","",$post_type);
1813
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1814
-            if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
1815
-                global $sitepress;
1816
-                $default_lang = $sitepress->get_default_language();
1817
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1818
-                if (!$language_code ) {
1819
-                    $language_code  = $default_lang;
1820
-                }
1808
+		// Alter the CPT slug if WPML is set to do so
1809
+		if (geodir_is_wpml()) {
1810
+			$post_types = get_option('geodir_post_types');
1811
+			$post_type = str_replace("category","",$taxonomy);
1812
+			$post_type = str_replace("_tags","",$post_type);
1813
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1814
+			if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
1815
+				global $sitepress;
1816
+				$default_lang = $sitepress->get_default_language();
1817
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1818
+				if (!$language_code ) {
1819
+					$language_code  = $default_lang;
1820
+				}
1821 1821
 
1822
-                $org_slug = $slug;
1823
-                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1822
+				$org_slug = $slug;
1823
+				$slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1824 1824
 
1825
-                if (!$slug) {
1826
-                    $slug = $org_slug;
1827
-                }
1825
+				if (!$slug) {
1826
+					$slug = $org_slug;
1827
+				}
1828 1828
 
1829
-                $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1830
-            }
1831
-        }
1832
-    }
1829
+				$termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1830
+			}
1831
+		}
1832
+	}
1833 1833
     
1834
-    return $termlink;
1834
+	return $termlink;
1835 1835
 }
1836 1836
 
1837 1837
 /**
@@ -1857,14 +1857,14 @@  discard block
 block discarded – undo
1857 1857
 	if (in_array($post_type, geodir_get_posttypes())) {
1858 1858
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1859 1859
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1860
-                $location_terms = array(
1861
-                    'gd_country' => $post->country_slug,
1862
-                    'gd_region' => $post->region_slug,
1863
-                    'gd_city' => $post->city_slug
1864
-                );
1865
-            } else {
1866
-                $location_terms = geodir_get_current_location_terms('query_vars');
1867
-            }
1860
+				$location_terms = array(
1861
+					'gd_country' => $post->country_slug,
1862
+					'gd_region' => $post->region_slug,
1863
+					'gd_city' => $post->city_slug
1864
+				);
1865
+			} else {
1866
+				$location_terms = geodir_get_current_location_terms('query_vars');
1867
+			}
1868 1868
 			
1869 1869
 			$location_terms = geodir_remove_location_terms($location_terms);
1870 1870
 			
@@ -1896,17 +1896,17 @@  discard block
 block discarded – undo
1896 1896
  * @return void|string Label.
1897 1897
  */
1898 1898
 function get_post_type_singular_label($post_type, $echo = false, $translate = false) {
1899
-    $obj_post_type = get_post_type_object($post_type);
1900
-    if (!is_object($obj_post_type)) {
1901
-        return;
1902
-    }
1899
+	$obj_post_type = get_post_type_object($post_type);
1900
+	if (!is_object($obj_post_type)) {
1901
+		return;
1902
+	}
1903 1903
     
1904
-    $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name;
1904
+	$label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name;
1905 1905
     
1906
-    if ($echo)
1907
-        echo $label;
1908
-    else
1909
-        return $label;
1906
+	if ($echo)
1907
+		echo $label;
1908
+	else
1909
+		return $label;
1910 1910
 }
1911 1911
 
1912 1912
 /**
@@ -1921,19 +1921,19 @@  discard block
 block discarded – undo
1921 1921
  * @return void|string Label.
1922 1922
  */
1923 1923
 function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
1924
-    $all_postypes = geodir_get_posttypes();
1924
+	$all_postypes = geodir_get_posttypes();
1925 1925
 
1926
-    if (!in_array($post_type, $all_postypes))
1927
-        return false;
1926
+	if (!in_array($post_type, $all_postypes))
1927
+		return false;
1928 1928
 
1929
-    $obj_post_type = get_post_type_object($post_type);
1929
+	$obj_post_type = get_post_type_object($post_type);
1930 1930
     
1931
-    $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name;
1931
+	$label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name;
1932 1932
     
1933
-    if ($echo)
1934
-        echo $label;
1935
-    else
1936
-        return $label;
1933
+	if ($echo)
1934
+		echo $label;
1935
+	else
1936
+		return $label;
1937 1937
 }
1938 1938
 
1939 1939
 /**
@@ -1951,51 +1951,51 @@  discard block
 block discarded – undo
1951 1951
  */
1952 1952
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1953 1953
 {
1954
-    global $wpdb;
1955
-
1956
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1957
-    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1958
-
1959
-    if (is_int($term)) {
1960
-        if (0 == $term)
1961
-            return 0;
1962
-        $where = 't.term_id = %d';
1963
-        if (!empty($taxonomy))
1964
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1965
-        else
1966
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1967
-    }
1954
+	global $wpdb;
1955
+
1956
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1957
+	$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1958
+
1959
+	if (is_int($term)) {
1960
+		if (0 == $term)
1961
+			return 0;
1962
+		$where = 't.term_id = %d';
1963
+		if (!empty($taxonomy))
1964
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1965
+		else
1966
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1967
+	}
1968 1968
 
1969
-    $term = trim(wp_unslash($term));
1969
+	$term = trim(wp_unslash($term));
1970 1970
 
1971
-    if ('' === $slug = sanitize_title($term))
1972
-        return 0;
1971
+	if ('' === $slug = sanitize_title($term))
1972
+		return 0;
1973 1973
 
1974
-    $where = 't.slug = %s';
1974
+	$where = 't.slug = %s';
1975 1975
 
1976
-    $where_fields = array($slug);
1977
-    if (!empty($taxonomy)) {
1978
-        $parent = (int)$parent;
1979
-        if ($parent > 0) {
1980
-            $where_fields[] = $parent;
1981
-            $else_where_fields[] = $parent;
1982
-            $where .= ' AND tt.parent = %d';
1976
+	$where_fields = array($slug);
1977
+	if (!empty($taxonomy)) {
1978
+		$parent = (int)$parent;
1979
+		if ($parent > 0) {
1980
+			$where_fields[] = $parent;
1981
+			$else_where_fields[] = $parent;
1982
+			$where .= ' AND tt.parent = %d';
1983 1983
 
1984
-        }
1984
+		}
1985 1985
 
1986
-        $where_fields[] = $taxonomy;
1986
+		$where_fields[] = $taxonomy;
1987 1987
 
1988 1988
 
1989
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1990
-            return $result;
1989
+		if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1990
+			return $result;
1991 1991
 
1992
-        return false;
1993
-    }
1992
+		return false;
1993
+	}
1994 1994
 
1995
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1996
-        return $result;
1995
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1996
+		return $result;
1997 1997
 
1998
-    return false;
1998
+	return false;
1999 1999
 }
2000 2000
 
2001 2001
 /**
@@ -2007,7 +2007,7 @@  discard block
 block discarded – undo
2007 2007
 function geodir_get_term_icon_rebuild()
2008 2008
 {
2009 2009
 
2010
-    update_option('gd_term_icons', '');
2010
+	update_option('gd_term_icons', '');
2011 2011
 
2012 2012
 }
2013 2013
 
@@ -2025,61 +2025,61 @@  discard block
 block discarded – undo
2025 2025
  */
2026 2026
 function geodir_get_term_icon($term_id = false, $rebuild = false)
2027 2027
 {
2028
-    global $wpdb;
2029
-    if (!$rebuild) {
2030
-        $terms_icons = get_option('gd_term_icons');
2031
-    } else {
2032
-        $terms_icons = array();
2033
-    }
2034
-
2035
-    if (empty($terms_icons)) {
2036
-        $terms_icons = array();
2037
-        $default_icon_url = get_option('geodir_default_marker_icon');
2038
-        $taxonomy = geodir_get_taxonomies();
2039
-        $post_types = geodir_get_posttypes();
2040
-        $tax_arr = array();
2041
-        foreach ($post_types as $post_type) {
2042
-            $tax_arr[] = "'" . $post_type . "category'";
2043
-        }
2044
-        $tax_c = implode(',', $tax_arr);
2045
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
2046
-        //$terms = get_terms( $taxonomy );
2047
-
2048
-        if($terms) {
2049
-            foreach ($terms as $term) {
2050
-                $post_type = str_replace("category", "", $term->taxonomy);
2051
-                $a_terms[$post_type][] = $term;
2028
+	global $wpdb;
2029
+	if (!$rebuild) {
2030
+		$terms_icons = get_option('gd_term_icons');
2031
+	} else {
2032
+		$terms_icons = array();
2033
+	}
2052 2034
 
2053
-            }
2054
-        }
2035
+	if (empty($terms_icons)) {
2036
+		$terms_icons = array();
2037
+		$default_icon_url = get_option('geodir_default_marker_icon');
2038
+		$taxonomy = geodir_get_taxonomies();
2039
+		$post_types = geodir_get_posttypes();
2040
+		$tax_arr = array();
2041
+		foreach ($post_types as $post_type) {
2042
+			$tax_arr[] = "'" . $post_type . "category'";
2043
+		}
2044
+		$tax_c = implode(',', $tax_arr);
2045
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
2046
+		//$terms = get_terms( $taxonomy );
2055 2047
 
2056
-        if($a_terms) {
2057
-            foreach ($a_terms as $pt => $t2) {
2048
+		if($terms) {
2049
+			foreach ($terms as $term) {
2050
+				$post_type = str_replace("category", "", $term->taxonomy);
2051
+				$a_terms[$post_type][] = $term;
2058 2052
 
2059
-                foreach ($t2 as $term) {
2060
-                    $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2061
-                    if ($term_icon) {
2062
-                        $term_icon_url = $term_icon["src"];
2063
-                    } else {
2064
-                        $term_icon_url = $default_icon_url;
2065
-                    }
2066
-                    $terms_icons[$term->term_id] = $term_icon_url;
2067
-                }
2068
-            }
2069
-        }
2053
+			}
2054
+		}
2055
+
2056
+		if($a_terms) {
2057
+			foreach ($a_terms as $pt => $t2) {
2070 2058
 
2071
-        update_option('gd_term_icons', $terms_icons);
2072
-    }
2059
+				foreach ($t2 as $term) {
2060
+					$term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2061
+					if ($term_icon) {
2062
+						$term_icon_url = $term_icon["src"];
2063
+					} else {
2064
+						$term_icon_url = $default_icon_url;
2065
+					}
2066
+					$terms_icons[$term->term_id] = $term_icon_url;
2067
+				}
2068
+			}
2069
+		}
2073 2070
 
2074
-    if ($term_id && isset($terms_icons[$term_id])) {
2075
-        return $terms_icons[$term_id];
2076
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
2077
-        return get_option('geodir_default_marker_icon');
2078
-    }
2071
+		update_option('gd_term_icons', $terms_icons);
2072
+	}
2073
+
2074
+	if ($term_id && isset($terms_icons[$term_id])) {
2075
+		return $terms_icons[$term_id];
2076
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
2077
+		return get_option('geodir_default_marker_icon');
2078
+	}
2079 2079
 
2080
-    if (is_ssl()) {
2081
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2082
-    }
2080
+	if (is_ssl()) {
2081
+		$terms_icons = str_replace("http:","https:",$terms_icons );
2082
+	}
2083 2083
 
2084
-    return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2084
+	return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2085 2085
 }
2086 2086
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
                              * @since 1.0.0
61 61
                              * @param string $menu_class The menu HTML class.
62 62
                              */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
63
+                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
64 64
                             /**
65 65
                              * Filter the menu a class.
66 66
                              *
67 67
                              * @since 1.0.0
68 68
                              */
69 69
                             $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
71
-									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72
-										' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . '
70
+                            $items .= '<li class="'.$li_class.'">
71
+									<a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'">
72
+										' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').'
73 73
 									</a>
74 74
 								</li>';
75 75
                         }
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
              * @since 1.0.0
89 89
              * @param string $menu_class The menu HTML class.
90 90
              */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
91
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class);
92 92
             /**
93 93
              * Filter the sub menu li class.
94 94
              *
95 95
              * @since 1.0.0
96 96
              * @param string $menu_class The menu HTML class.
97 97
              */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
98
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
99 99
             /**
100 100
              * Filter the sub menu ul class.
101 101
              *
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
              * @since 1.0.0
115 115
              */
116 116
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
118
-					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119
-					<ul class="' . $sub_ul_class . '">';
117
+            $items .= '<li class="'.$li_class.'">
118
+					<a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a>
119
+					<ul class="' . $sub_ul_class.'">';
120 120
             $post_types = geodir_get_posttypes('object');
121 121
 
122 122
             $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
                                 if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134 134
                                     $menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
137
-														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138
-															' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . '
136
+                                $items .= '<li class="'.$sub_li_class.'">
137
+														<a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'">
138
+															' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').'
139 139
 														</a>
140 140
 													</li>';
141 141
                             }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
              *
152 152
              * @since 1.5.9
153 153
              */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
154
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
155 155
             $items .= '</li>';
156 156
         }
157 157
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                                      * @since 1.0.0
185 185
                                      * @param string $menu_class The menu HTML class.
186 186
                                      */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
187
+                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
188 188
                                     /**
189 189
                                      * Filter the menu a class.
190 190
                                      *
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
                                      */
193 193
                                     $a_class = apply_filters('geodir_menu_a_class', '');
194 194
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
196
-											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
195
+                                    $items .= '<li class="'.$li_class.'">
196
+											<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'">
197
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
198 198
 											</a>
199 199
 										</li>';
200 200
                                 }
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
              * @since 1.0.0
219 219
              * @param string $menu_class The menu HTML class.
220 220
              */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
221
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class);
222 222
             /**
223 223
              * Filter the sub menu li class.
224 224
              *
225 225
              * @since 1.0.0
226 226
              * @param string $menu_class The menu HTML class.
227 227
              */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
228
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
229 229
             /**
230 230
              * Filter the sub menu ul class.
231 231
              *
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
              * @since 1.0.0
245 245
              */
246 246
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
248
-					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249
-					<ul class="' . $sub_ul_class . '">';
247
+            $items .= '<li  class="'.$li_class.'">
248
+					<a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a>
249
+					<ul class="' . $sub_ul_class.'">';
250 250
 
251 251
             $post_types = geodir_get_posttypes('object');
252 252
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
                                          * @since 1.0.0
270 270
                                          * @param string $menu_class The menu HTML class.
271 271
                                          */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
272
+                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
273 273
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $sub_li_class . '">
275
-														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
274
+                                        $items .= '<li class="'.$sub_li_class.'">
275
+														<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'">
276
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
277 277
 														</a>
278 278
 													</li>';
279 279
                                     }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             }
286 286
 
287 287
             $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
288
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
289 289
             $items .= '</li>';
290 290
 
291 291
         }
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
     $geodir_theme_location = get_option('geodir_theme_location_nav');
314 314
     $geodir_theme_location_nav = array();
315 315
     if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
316
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
317 317
         $geodir_theme_location_nav[] = $args['theme_location'];
318 318
         update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319 319
     }
320 320
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322 322
     else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
323
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
324 324
 
325 325
     return $menu;
326 326
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
     if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
351
+        $items = $items.geodir_add_nav_menu_items();
352 352
         return $items;
353 353
 
354 354
     } else {
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
 
374 374
     $taxonomies = geodir_get_taxonomies();
375 375
     $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
376
+    $taxonomies = "'".$taxonomies."'";
377 377
 
378 378
     $pn_categories = $wpdb->get_results(
379 379
         $wpdb->prepare(
380 380
             "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
381
+            array($wpdb->terms.term_id)
382 382
         )
383 383
     );
384 384
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 
409 409
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
410 410
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
411
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
+            $geodir_post_type = get_post_type((int) $_REQUEST['pid']);
412 412
         elseif (isset($_REQUEST['listing_type']))
413 413
             $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
414 414
     }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
     if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
435 435
         $geodir_post_type = '';
436 436
 
437
-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
437
+    if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) {
438 438
         $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
439 439
     }
440 440
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
      *
445 445
      * @since 1.6.9
446 446
      */
447
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
447
+    return apply_filters('geodir_get_current_posttype', $geodir_post_type);
448 448
 }
449 449
 
450 450
 /**
@@ -458,18 +458,18 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function geodir_get_default_posttype()
460 460
 {
461
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
461
+    $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object'));
462 462
 
463 463
     $stype = false;
464
-    foreach ( $post_types as $post_type => $info ) {
464
+    foreach ($post_types as $post_type => $info) {
465 465
         global $wpdb;
466
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
467
-        if ( $has_posts ) {
466
+        $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
467
+        if ($has_posts) {
468 468
             $stype = $post_type; break;
469 469
         }
470 470
     }
471 471
 
472
-    if(!$stype){
472
+    if (!$stype) {
473 473
         $stype = 'gd_place';
474 474
     }
475 475
 
@@ -494,14 +494,14 @@  discard block
 block discarded – undo
494 494
         switch ($output):
495 495
             case 'object':
496 496
             case 'Object':
497
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
497
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
498 498
                 break;
499 499
             case 'array':
500 500
             case 'Array':
501
-                $post_types = (array)$post_types;
501
+                $post_types = (array) $post_types;
502 502
                 break;
503 503
 			case 'options':
504
-                $post_types = (array)$post_types;
504
+                $post_types = (array) $post_types;
505 505
 				
506 506
 				$options = array();
507 507
 				if (!empty($post_types)) {
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                     $gd_taxonomies[] = $taxonomy;
570 570
                 }
571 571
 
572
-                if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
572
+                if ($tages_taxonomies === false && substr($taxonomy, -5) == '_tags') {
573 573
                     if (array_search($taxonomy, $gd_taxonomies) !== false) {
574 574
                         unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
575 575
                     }
@@ -615,15 +615,15 @@  discard block
 block discarded – undo
615 615
 
616 616
         $categories = get_terms($taxonomies);
617 617
 
618
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
618
+        $html .= '<option value="0">'.__('All', 'geodirectory').'</option>';
619 619
 
620 620
         foreach ($categories as $category_obj) {
621 621
             $select_opt = '';
622 622
             if ($selected == $category_obj->term_id) {
623 623
                 $select_opt = 'selected="selected"';
624 624
             }
625
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
626
-                . geodir_utf8_ucfirst($category_obj->name) . '</option>';
625
+            $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">'
626
+                . geodir_utf8_ucfirst($category_obj->name).'</option>';
627 627
         }
628 628
 
629 629
         if ($echo)
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
     } elseif (isset($wp_query->tax_query->queries)) {
692 692
         $tax_arr = $wp_query->tax_query->queries;
693 693
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
694
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
694
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
695 695
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
696 696
     }
697 697
 
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 
746 746
             if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
747 747
                 if ($cat_parent == 0) {
748
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
748
+                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display;
749 749
                     $main_list_class = 'class="main_list_selecter"';
750 750
                 } else {
751 751
                     //$display = 'display:none';
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 
756 756
             if ($cat_display == 'checkbox' || $cat_display == 'radio') {
757 757
                 $p = 0;
758
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
758
+                $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">';
759 759
             }
760 760
 
761 761
             foreach ($cat_terms as $cat_term) {
@@ -770,12 +770,12 @@  discard block
 block discarded – undo
770 770
                 }
771 771
 
772 772
                 if ($cat_display == 'radio')
773
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
773
+                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>';
774 774
                 elseif ($cat_display == 'select' || $cat_display == 'multiselect')
775
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
775
+                    $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</option>';
776 776
 
777 777
                 else {
778
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
778
+                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>';
779 779
                 }
780 780
 
781 781
                 // Call recurson to print sub cats
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
             $cat_exclude = serialize($exclude_cats);
815 815
 
816 816
         if (isset($_REQUEST['backandedit'])) {
817
-            $post = (object)$gd_session->get('listing');
817
+            $post = (object) $gd_session->get('listing');
818 818
 
819 819
             if (!is_array($post->post_category[$cat_taxonomy]))
820 820
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 
847 847
             if (!empty($post_category)) {
848 848
                 $cat1 = array_filter(explode(',', $post_category));
849
-                $post_category = ',' . implode(',', $cat1) . ',';
849
+                $post_category = ','.implode(',', $cat1).',';
850 850
 
851 851
             }
852 852
 
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
                 foreach ($post_category_upd as $cat) {
858 858
 
859 859
                     if (!in_array($cat, $exclude_cats) && $cat != '') {
860
-                        $post_category_change .= ',' . $cat;
860
+                        $post_category_change .= ','.$cat;
861 861
                     }
862 862
                 }
863 863
                 $post_category = $post_category_change;
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
             }
870 870
         }
871 871
 
872
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
872
+        echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']"  />';
873 873
 
874
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
874
+        echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']"  />';
875 875
 
876
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
876
+        echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']"  />';
877 877
 
878 878
 
879 879
         ?>
@@ -892,14 +892,14 @@  discard block
 block discarded – undo
892 892
 
893 893
             function show_subcatlist(main_cat, catObj) {
894 894
                 if (main_cat != '') {
895
-					var url = '<?php echo geodir_get_ajax_url();?>';
896
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
897
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
895
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
896
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
897
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
898 898
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
899
-					<?php if ((int)$cat_limit > 0) { ?>
899
+					<?php if ((int) $cat_limit > 0) { ?>
900 900
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
901 901
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
902
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
902
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
903 903
 						return false;
904 904
 					}
905 905
 					<?php } ?>
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
             }
939 939
 
940 940
             function update_listing_cat(el) {
941
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
941
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
942 942
                 var cat_ids = '';
943 943
                 var main_cat = '';
944 944
                 var sub_cat = '';
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1020 1020
             echo $style;
1021 1021
         }?> ">
1022
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1022
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
1023 1023
             ?>
1024 1024
         </div>
1025 1025
     <?php
@@ -1046,9 +1046,9 @@  discard block
 block discarded – undo
1046 1046
     if ($exclude != '') {
1047 1047
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
1048 1048
 
1049
-        if(is_array( $exclude_cats)){
1050
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1051
-        }else{
1049
+        if (is_array($exclude_cats)) {
1050
+            $exclude_cats = array_map('intval', $exclude_cats);
1051
+        } else {
1052 1052
             $exclude_cats = intval($exclude_cats);
1053 1053
         }
1054 1054
 
@@ -1062,25 +1062,25 @@  discard block
 block discarded – undo
1062 1062
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1063 1063
 
1064 1064
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1065
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1065
+            <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>"
1066 1066
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1067 1067
             <?php /* ?>
1068 1068
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1069 1069
 		<?php */ ?>
1070 1070
 
1071
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1071
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1072 1072
                    onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
1073 1073
                    checked="checked" disabled="disabled"/>
1074 1074
        <span> 
1075
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1075
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1076 1076
         </span>
1077 1077
             <br/>
1078 1078
 
1079 1079
             <div class="post_default_category">
1080
-                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1081
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1080
+                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>"
1081
+                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?>   />
1082 1082
         <span> 
1083
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1083
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1084 1084
         </span>
1085 1085
             </div>
1086 1086
 
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
         $post_cat_str = $post_categories[$request_taxonomy];
1114 1114
         $post_cat_array = explode("#", $post_cat_str);
1115 1115
         if (is_array($post_cat_array)) {
1116
-            $post_cat_array = array_unique( $post_cat_array );
1116
+            $post_cat_array = array_unique($post_cat_array);
1117 1117
 
1118 1118
 			foreach ($post_cat_array as $post_cat_html) {
1119 1119
 
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
                 }
1129 1129
                 $post_sub_catid = '';
1130 1130
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1131
-                    $post_sub_catid = (int)$post_cat_info[1];
1131
+                    $post_sub_catid = (int) $post_cat_info[1];
1132 1132
                 }
1133 1133
 
1134 1134
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
             }
1150 1150
 
1151 1151
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1152
-                $post_sub_catid = (int)$post_cat_info[1];
1152
+                $post_sub_catid = (int) $post_cat_info[1];
1153 1153
             }
1154 1154
 
1155 1155
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1181,9 +1181,9 @@  discard block
 block discarded – undo
1181 1181
         if (!$selected)
1182 1182
             $option_slected = ' selected="selected" ';
1183 1183
 
1184
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1184
+        echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >';
1185 1185
 
1186
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1186
+        echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>';
1187 1187
 
1188 1188
         foreach ($cat_terms as $cat_term) {
1189 1189
             $option_selected = '';
@@ -1191,10 +1191,10 @@  discard block
 block discarded – undo
1191 1191
                 $option_selected = ' selected="selected" ';
1192 1192
 
1193 1193
             // Count child terms
1194
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1195
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1194
+            $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1195
+            $has_child = !empty($child_terms) ? 't' : 'f';
1196 1196
 
1197
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>';
1197
+            echo '<option  '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.geodir_utf8_ucfirst($cat_term->name).'</option>';
1198 1198
         }
1199 1199
         echo '</select>';
1200 1200
     }
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
             2 => __('Custom field updated.', 'geodirectory'),
1226 1226
             3 => __('Custom field deleted.', 'geodirectory'),
1227 1227
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1228
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1228
+            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
1229 1229
             6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1230 1230
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1231 1231
             8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 
1252 1252
     global $wpdb;
1253 1253
 
1254
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1254
+    $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico';
1255 1255
 
1256 1256
     if (!$listing_slug = get_option('geodir_listing_prefix'))
1257 1257
         $listing_slug = 'places';
@@ -1264,11 +1264,11 @@  discard block
 block discarded – undo
1264 1264
 
1265 1265
         $gd_placetags = array();
1266 1266
         $gd_placetags['object_type'] = 'gd_place';
1267
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1267
+        $gd_placetags['listing_slug'] = $listing_slug.'/tags';
1268 1268
         $gd_placetags['args'] = array(
1269 1269
             'public' => true,
1270 1270
             'hierarchical' => false,
1271
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1271
+            'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true),
1272 1272
             'query_var' => true,
1273 1273
 
1274 1274
             'labels' => array(
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
             'menu_icon' => $menu_icon,
1363 1363
             'public' => true,
1364 1364
             'query_var' => true,
1365
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1365
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1366 1366
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1367 1367
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1368 1368
 
@@ -1395,12 +1395,12 @@  discard block
 block discarded – undo
1395 1395
         return $_REQUEST['lang'];
1396 1396
     }
1397 1397
 
1398
-    $url = str_replace(array("http://","https://"),"",$url);
1398
+    $url = str_replace(array("http://", "https://"), "", $url);
1399 1399
 
1400 1400
     // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1401
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1401
+    $site_url = str_replace(array("http://", "https://"), "", site_url());
1402 1402
 
1403
-    $url = str_replace($site_url,"",$url);
1403
+    $url = str_replace($site_url, "", $url);
1404 1404
 
1405 1405
     $segments = explode('/', trim($url, '/'));
1406 1406
 
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 
1457 1457
     global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1458 1458
     if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1459
-        if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
1459
+        if ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending') {return $post_link; }
1460 1460
     } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
1461 1461
         return $post_link;
1462 1462
     } else {
@@ -1470,9 +1470,9 @@  discard block
 block discarded – undo
1470 1470
 
1471 1471
 
1472 1472
         // if we dont have a GD post then try to grab it
1473
-        if(!isset($post->default_category)){
1473
+        if (!isset($post->default_category)) {
1474 1474
             $gd_post = geodir_get_post_info($post->ID);
1475
-            if(!empty($gd_post)){
1475
+            if (!empty($gd_post)) {
1476 1476
                 $post = $gd_post;
1477 1477
             }
1478 1478
         }
@@ -1482,17 +1482,17 @@  discard block
 block discarded – undo
1482 1482
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1483 1483
 
1484 1484
         // Alter the CPT slug if WPML is set to do so
1485
-        if(geodir_wpml_is_post_type_translated($post->post_type)){
1486
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1485
+        if (geodir_wpml_is_post_type_translated($post->post_type)) {
1486
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1487 1487
 
1488 1488
                 $org_slug = $slug;
1489
-                $slug = apply_filters( 'wpml_translate_single_string',
1489
+                $slug = apply_filters('wpml_translate_single_string',
1490 1490
                     $slug,
1491 1491
                     'WordPress',
1492
-                    'URL slug: ' . $slug,
1492
+                    'URL slug: '.$slug,
1493 1493
                     $language_code);
1494 1494
 
1495
-                if(!$slug){$slug = $org_slug;}
1495
+                if (!$slug) {$slug = $org_slug; }
1496 1496
 
1497 1497
             }
1498 1498
         }
@@ -1514,11 +1514,11 @@  discard block
 block discarded – undo
1514 1514
         }
1515 1515
 
1516 1516
         $post_link = trailingslashit(
1517
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1517
+            preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1)
1518 1518
         );
1519 1519
 
1520 1520
         if ($fix_url) {
1521
-            $post_link = $site_url . $post_link;
1521
+            $post_link = $site_url.$post_link;
1522 1522
         }
1523 1523
 
1524 1524
         if (isset($comment_post_cache[$post->ID])) {
@@ -1537,12 +1537,12 @@  discard block
 block discarded – undo
1537 1537
             $ID = $post->ID;
1538 1538
             $post2 = $wpdb->get_row(
1539 1539
                 $wpdb->prepare(
1540
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1540
+                    "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1541 1541
                     array($post->ID)
1542 1542
                 )
1543 1543
             );
1544 1544
 
1545
-            $post = (object)array_merge((array)$post, (array)$post2);
1545
+            $post = (object) array_merge((array) $post, (array) $post2);
1546 1546
 
1547 1547
             $comment_post_cache[$post->ID] = $post;
1548 1548
         }
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 
1552 1552
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1553 1553
 
1554
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1554
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1555 1555
                 $location_request = '';
1556 1556
 
1557 1557
 
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1566 1566
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1567 1567
 
1568
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1568
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1569 1569
                             'region_slug' => $post->region_slug,
1570 1570
                             'city_slug' => $post->city_slug
1571 1571
                         );
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 
1579 1579
                     $post_location_sql = $wpdb->get_results(
1580 1580
                         $wpdb->prepare(
1581
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1581
+                            "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1582 1582
                             array($post->ID)
1583 1583
                         )
1584 1584
                     );
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1595 1595
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1596 1596
 
1597
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1597
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1598 1598
                                 'region_slug' => $post->region_slug,
1599 1599
                                 'city_slug' => $post->city_slug
1600 1600
                             );
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
 					}
1624 1624
 					$location_slug[] = $city_slug;
1625 1625
 					
1626
-					$location_request .= implode('/', $location_slug) . '/';
1626
+					$location_request .= implode('/', $location_slug).'/';
1627 1627
                 }
1628 1628
             }
1629 1629
 
@@ -1638,9 +1638,9 @@  discard block
 block discarded – undo
1638 1638
                 } else {
1639 1639
                     $post_terms = '';
1640 1640
 
1641
-                    if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
1641
+                    if (isset($_POST['post_default_category']) && $_POST['post_default_category']) {
1642 1642
                         $post_terms = absint($_POST['post_default_category']);
1643
-                    }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
1643
+                    }elseif (isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
1644 1644
                         $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
1645 1645
                         $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0;
1646 1646
                     }elseif (isset($post->{$taxonomies})) {
@@ -1686,14 +1686,14 @@  discard block
 block discarded – undo
1686 1686
             $request_term = trim($request_term, '/');
1687 1687
             
1688 1688
             // Fix with WPML the location terms added twice when CPT slug is translated.
1689
-            if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
1689
+            if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/'.$request_term.$detailurl_separator) !== false) {
1690 1690
                 $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
1691 1691
             }
1692 1692
             
1693 1693
             if (!empty($request_term))
1694
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1694
+                $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1695 1695
             else
1696
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1696
+                $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1697 1697
             //echo $post_link ;
1698 1698
         }
1699 1699
         // temp cache the permalink
@@ -1786,9 +1786,9 @@  discard block
 block discarded – undo
1786 1786
                 $url_separator = '';
1787 1787
 
1788 1788
                 if (get_option('permalink_structure') != '') {
1789
-                    $old_listing_slug = '/' . $listing_slug . '/';
1789
+                    $old_listing_slug = '/'.$listing_slug.'/';
1790 1790
                     $request_term = implode("/", $location_terms);
1791
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1791
+                    $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/';
1792 1792
 
1793 1793
                     $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1794 1794
                 } else {
@@ -1808,25 +1808,25 @@  discard block
 block discarded – undo
1808 1808
         // Alter the CPT slug if WPML is set to do so
1809 1809
         if (geodir_is_wpml()) {
1810 1810
             $post_types = get_option('geodir_post_types');
1811
-            $post_type = str_replace("category","",$taxonomy);
1812
-            $post_type = str_replace("_tags","",$post_type);
1811
+            $post_type = str_replace("category", "", $taxonomy);
1812
+            $post_type = str_replace("_tags", "", $post_type);
1813 1813
             $slug = $post_types[$post_type]['rewrite']['slug'];
1814 1814
             if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
1815 1815
                 global $sitepress;
1816 1816
                 $default_lang = $sitepress->get_default_language();
1817 1817
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1818
-                if (!$language_code ) {
1819
-                    $language_code  = $default_lang;
1818
+                if (!$language_code) {
1819
+                    $language_code = $default_lang;
1820 1820
                 }
1821 1821
 
1822 1822
                 $org_slug = $slug;
1823
-                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1823
+                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code);
1824 1824
 
1825 1825
                 if (!$slug) {
1826 1826
                     $slug = $org_slug;
1827 1827
                 }
1828 1828
 
1829
-                $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1829
+                $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1));
1830 1830
             }
1831 1831
         }
1832 1832
     }
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
 	
1857 1857
 	if (in_array($post_type, geodir_get_posttypes())) {
1858 1858
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1859
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1859
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1860 1860
                 $location_terms = array(
1861 1861
                     'gd_country' => $post->country_slug,
1862 1862
                     'gd_region' => $post->region_slug,
@@ -1873,7 +1873,7 @@  discard block
 block discarded – undo
1873 1873
 					$location_terms = implode("/", $location_terms);
1874 1874
 					$location_terms = rtrim($location_terms, '/');
1875 1875
 					
1876
-					$link .= urldecode($location_terms) . '/';
1876
+					$link .= urldecode($location_terms).'/';
1877 1877
 				} else {
1878 1878
 					$link = geodir_getlink($link, $location_terms);
1879 1879
 				}
@@ -1961,9 +1961,9 @@  discard block
 block discarded – undo
1961 1961
             return 0;
1962 1962
         $where = 't.term_id = %d';
1963 1963
         if (!empty($taxonomy))
1964
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1964
+            return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1965 1965
         else
1966
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1966
+            return $wpdb->get_var($wpdb->prepare($select.$where, $term));
1967 1967
     }
1968 1968
 
1969 1969
     $term = trim(wp_unslash($term));
@@ -1975,7 +1975,7 @@  discard block
 block discarded – undo
1975 1975
 
1976 1976
     $where_fields = array($slug);
1977 1977
     if (!empty($taxonomy)) {
1978
-        $parent = (int)$parent;
1978
+        $parent = (int) $parent;
1979 1979
         if ($parent > 0) {
1980 1980
             $where_fields[] = $parent;
1981 1981
             $else_where_fields[] = $parent;
@@ -2039,13 +2039,13 @@  discard block
 block discarded – undo
2039 2039
         $post_types = geodir_get_posttypes();
2040 2040
         $tax_arr = array();
2041 2041
         foreach ($post_types as $post_type) {
2042
-            $tax_arr[] = "'" . $post_type . "category'";
2042
+            $tax_arr[] = "'".$post_type."category'";
2043 2043
         }
2044 2044
         $tax_c = implode(',', $tax_arr);
2045 2045
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
2046 2046
         //$terms = get_terms( $taxonomy );
2047 2047
 
2048
-        if($terms) {
2048
+        if ($terms) {
2049 2049
             foreach ($terms as $term) {
2050 2050
                 $post_type = str_replace("category", "", $term->taxonomy);
2051 2051
                 $a_terms[$post_type][] = $term;
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
             }
2054 2054
         }
2055 2055
 
2056
-        if($a_terms) {
2056
+        if ($a_terms) {
2057 2057
             foreach ($a_terms as $pt => $t2) {
2058 2058
 
2059 2059
                 foreach ($t2 as $term) {
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
     }
2079 2079
 
2080 2080
     if (is_ssl()) {
2081
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2081
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
2082 2082
     }
2083 2083
 
2084 2084
     return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/get_markers.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
  *
82 82
  * @param string $map_json The map marker json.
83 83
  * @since 1.6.22
84
- * @return mixed
84
+ * @return string
85 85
  */
86 86
 function geodir_save_map_cache($map_json){
87 87
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -247,11 +247,13 @@  discard block
 block discarded – undo
247 247
         }
248 248
     }
249 249
 
250
-    if (!empty($field_default_cat))
251
-        $field_default_cat = '';
250
+    if (!empty($field_default_cat)) {
251
+            $field_default_cat = '';
252
+    }
252 253
 
253
-    if (!empty($cat_find_array))
254
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
254
+    if (!empty($cat_find_array)) {
255
+            $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
256
+    }
255 257
 
256 258
     $main_query_array = $map_cat_ids_array;
257 259
   
@@ -283,8 +285,9 @@  discard block
 block discarded – undo
283 285
         $gd_posttype = " AND p.post_type = %s";
284 286
         $main_query_array[] = $_REQUEST['gd_posttype'];
285 287
 
286
-    } else
287
-        $table = $plugin_prefix . 'gd_place_detail';
288
+    } else {
289
+            $table = $plugin_prefix . 'gd_place_detail';
290
+    }
288 291
 
289 292
     $join = ", " . $table . " AS pd ";
290 293
 
@@ -606,8 +609,7 @@  discard block
 block discarded – undo
606 609
 
607 610
     if (!empty($cat_content_info)) {
608 611
         $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
609
-    }
610
-    else {
612
+    } else {
611 613
         $map_json =  '[{"totalcount":"0"}]';
612 614
     }
613 615
 
Please login to merge, or discard this patch.
Indentation   +446 added lines, -446 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 
9 9
 // Enable map cache if set
10 10
 if(get_option('geodir_enable_map_cache')){
11
-    add_filter('geodir_get_markers_cache','geodir_get_map_cache');
12
-    add_filter('geodir_markers_json','geodir_save_map_cache',10);
11
+	add_filter('geodir_get_markers_cache','geodir_get_map_cache');
12
+	add_filter('geodir_markers_json','geodir_save_map_cache',10);
13 13
 }
14 14
 
15 15
 
@@ -23,59 +23,59 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function geodir_get_map_cache($cache){
25 25
 
26
-    // if a search is going on then dont even try to check for cache.
27
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
28
-        return $cache;
29
-    }
26
+	// if a search is going on then dont even try to check for cache.
27
+	if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
28
+		return $cache;
29
+	}
30 30
 
31
-    $url_params = array();
32
-    $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
33
-    $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
34
-    $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
35
-    $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
36
-    $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
37
-    $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
38
-    $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
39
-    $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
40
-    $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
41
-    $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
42
-    $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
43
-    $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
44
-    $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
31
+	$url_params = array();
32
+	$url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
33
+	$url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
34
+	$url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
35
+	$url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
36
+	$url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
37
+	$url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
38
+	$url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
39
+	$url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
40
+	$url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
41
+	$url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
42
+	$url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
43
+	$url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
44
+	$url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
45 45
 
46
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
46
+	$file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
47 47
 
48
-    $blog_id = get_current_blog_id();
49
-    if($blog_id>1){
50
-        $file_name = $blog_id."_".$file_name;
51
-    }
48
+	$blog_id = get_current_blog_id();
49
+	if($blog_id>1){
50
+		$file_name = $blog_id."_".$file_name;
51
+	}
52 52
 
53
-    $file_path = realpath(dirname(__FILE__))."/map-cache/";
53
+	$file_path = realpath(dirname(__FILE__))."/map-cache/";
54 54
 
55 55
 
56
-    if(file_exists($file_path.$file_name.".json")){
56
+	if(file_exists($file_path.$file_name.".json")){
57 57
 
58 58
 
59
-        ob_start();
60
-        readfile($file_path.$file_name.".json"); // readfile is quicker then file get contents
61
-        $content = ob_get_clean();
59
+		ob_start();
60
+		readfile($file_path.$file_name.".json"); // readfile is quicker then file get contents
61
+		$content = ob_get_clean();
62 62
 
63
-        // do the cache delete stuff
64
-        $cache_time = get_option('geodir_map_cache');
65
-        if(!$cache_time){
66
-            $cache_time = time();
67
-            update_option('geodir_map_cache', $cache_time);
68
-        }
63
+		// do the cache delete stuff
64
+		$cache_time = get_option('geodir_map_cache');
65
+		if(!$cache_time){
66
+			$cache_time = time();
67
+			update_option('geodir_map_cache', $cache_time);
68
+		}
69 69
 
70
-        if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
71
-            geodir_delete_map_cache();
72
-        }
70
+		if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
71
+			geodir_delete_map_cache();
72
+		}
73 73
 
74
-        return $content;
74
+		return $content;
75 75
 
76
-    }
76
+	}
77 77
 
78
-    return $cache;
78
+	return $cache;
79 79
 }
80 80
 
81 81
 
@@ -88,109 +88,109 @@  discard block
 block discarded – undo
88 88
  */
89 89
 function geodir_save_map_cache($map_json){
90 90
 
91
-    // if a search is going on then dont even try to check for cache.
92
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
93
-        return $map_json;
94
-    }
95
-
96
-    $url_params = array();
97
-    $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
98
-    $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
99
-    $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
100
-    $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
101
-    $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
102
-    $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
103
-    $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
104
-    $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
105
-    $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
106
-    $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
107
-    $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
108
-    $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
109
-    $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
110
-
111
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
112
-
113
-    $blog_id = get_current_blog_id();
114
-    if($blog_id>1){
115
-        $file_name = $blog_id."_".$file_name;
116
-    }
117
-
118
-    $file_path = realpath(dirname(__FILE__))."/map-cache/";
119
-
120
-
121
-    global $wp_filesystem;
122
-    if (empty($wp_filesystem)) {
123
-        require_once (ABSPATH . '/wp-admin/includes/file.php');
124
-        WP_Filesystem();
125
-    }
126
-    $wp_filesystem->put_contents(
127
-        $file_path.$file_name.".json",
128
-        $map_json,
129
-        FS_CHMOD_FILE // predefined mode settings for WP files
130
-    );
131
-
132
-
133
-    return $map_json;
91
+	// if a search is going on then dont even try to check for cache.
92
+	if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
93
+		return $map_json;
94
+	}
95
+
96
+	$url_params = array();
97
+	$url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
98
+	$url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
99
+	$url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
100
+	$url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
101
+	$url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
102
+	$url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
103
+	$url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
104
+	$url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
105
+	$url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
106
+	$url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
107
+	$url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
108
+	$url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
109
+	$url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
110
+
111
+	$file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
112
+
113
+	$blog_id = get_current_blog_id();
114
+	if($blog_id>1){
115
+		$file_name = $blog_id."_".$file_name;
116
+	}
117
+
118
+	$file_path = realpath(dirname(__FILE__))."/map-cache/";
119
+
120
+
121
+	global $wp_filesystem;
122
+	if (empty($wp_filesystem)) {
123
+		require_once (ABSPATH . '/wp-admin/includes/file.php');
124
+		WP_Filesystem();
125
+	}
126
+	$wp_filesystem->put_contents(
127
+		$file_path.$file_name.".json",
128
+		$map_json,
129
+		FS_CHMOD_FILE // predefined mode settings for WP files
130
+	);
131
+
132
+
133
+	return $map_json;
134 134
 
135 135
 }
136 136
 
137 137
 
138 138
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
139
-    global $gd_session;
140
-    $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
141
-    $gd_session->set('homemap_catlist_ptype', $gd_post_type);
142
-    $post_taxonomy = geodir_get_taxonomies($gd_post_type);
143
-    $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
144
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
145
-    echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
146
-    die;
139
+	global $gd_session;
140
+	$gd_post_type = sanitize_text_field($_REQUEST['post_type']);
141
+	$gd_session->set('homemap_catlist_ptype', $gd_post_type);
142
+	$post_taxonomy = geodir_get_taxonomies($gd_post_type);
143
+	$map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
144
+	$child_collapse = (bool)$_REQUEST['child_collapse'];
145
+	echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
146
+	die;
147 147
 }
148 148
 
149 149
 // Send the content-type header with correct encoding
150 150
 header("Content-type: text/javascript; charset=utf-8");
151 151
 
152 152
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
153
-    echo get_markers();
154
-    exit;
153
+	echo get_markers();
154
+	exit;
155 155
 } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
156
-    /**
157
-     * @global object $wpdb WordPress Database object.
158
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
159
-     * @global object $gd_session GeoDirectory Session object.
160
-     */
161
-    global $wpdb, $plugin_prefix, $gd_session;
162
-
163
-    if ($_REQUEST['m_id'] != '') {
164
-        $pid = (int)$_REQUEST['m_id'];
165
-    } else {
166
-        echo __('No marker data found', 'geodirectory');
167
-        exit;
168
-    }
169
-
170
-    if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
171
-        $post = (object)$gd_ses_listing;
172
-        echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
173
-    } else {
174
-        $geodir_post_type = get_post_type($pid);
175
-
176
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
177
-
178
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
179
-
180
-        $postinfo = $wpdb->get_results($sql);
181
-
182
-        $data_arr = array();
183
-
184
-        if ($postinfo) {
185
-            $srcharr = array("'", "/", "-", '"', '\\');
186
-            $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
187
-
188
-            foreach ($postinfo as $postinfo_obj) {
189
-                echo geodir_get_infowindow_html($postinfo_obj);
190
-            }
191
-        }
192
-    }
193
-    exit;
156
+	/**
157
+	 * @global object $wpdb WordPress Database object.
158
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
159
+	 * @global object $gd_session GeoDirectory Session object.
160
+	 */
161
+	global $wpdb, $plugin_prefix, $gd_session;
162
+
163
+	if ($_REQUEST['m_id'] != '') {
164
+		$pid = (int)$_REQUEST['m_id'];
165
+	} else {
166
+		echo __('No marker data found', 'geodirectory');
167
+		exit;
168
+	}
169
+
170
+	if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
171
+		$post = (object)$gd_ses_listing;
172
+		echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
173
+	} else {
174
+		$geodir_post_type = get_post_type($pid);
175
+
176
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
177
+
178
+		$sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
179
+
180
+		$postinfo = $wpdb->get_results($sql);
181
+
182
+		$data_arr = array();
183
+
184
+		if ($postinfo) {
185
+			$srcharr = array("'", "/", "-", '"', '\\');
186
+			$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
187
+
188
+			foreach ($postinfo as $postinfo_obj) {
189
+				echo geodir_get_infowindow_html($postinfo_obj);
190
+			}
191
+		}
192
+	}
193
+	exit;
194 194
 }
195 195
 
196 196
 /**
@@ -209,93 +209,93 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function get_markers() {
211 211
     
212
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
212
+	global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
213 213
 
214 214
 
215
-    /**
216
-     * Filter to allow for any map caching to be output before queries.
217
-     *
218
-     * @since 1.6.22
219
-     */
220
-    $map_cache = apply_filters('geodir_get_markers_cache','');
221
-    if($map_cache){
222
-        return $map_cache;
223
-        wp_die();
224
-    }
215
+	/**
216
+	 * Filter to allow for any map caching to be output before queries.
217
+	 *
218
+	 * @since 1.6.22
219
+	 */
220
+	$map_cache = apply_filters('geodir_get_markers_cache','');
221
+	if($map_cache){
222
+		return $map_cache;
223
+		wp_die();
224
+	}
225 225
 
226 226
 
227 227
 
228
-    $search = '';
228
+	$search = '';
229 229
 
230
-    $srcharr = array("'", "/", "-", '"', '\\', '&#39;');
231
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
230
+	$srcharr = array("'", "/", "-", '"', '\\', '&#39;');
231
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
232 232
 
233
-    $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
233
+	$post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
234 234
 
235
-    $map_cat_ids_array = array('0');
236
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
235
+	$map_cat_ids_array = array('0');
236
+	$cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
237 237
 
238 238
 
239
-    $field_default_cat = '';
240
-    if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
241
-        $map_cat_arr = trim($_REQUEST['cat_id'], ',');
239
+	$field_default_cat = '';
240
+	if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
241
+		$map_cat_arr = trim($_REQUEST['cat_id'], ',');
242 242
 
243
-        if (!empty($map_cat_arr)) {
244
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
243
+		if (!empty($map_cat_arr)) {
244
+			$field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
245 245
 
246
-            $map_cat_ids_array = explode(',', $map_cat_arr);
247
-            $cat_find_array = array();
248
-            foreach ($map_cat_ids_array as $cat_id) {
249
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
250
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
251
-                $main_query_array[] = $cat_id;
252
-            }
246
+			$map_cat_ids_array = explode(',', $map_cat_arr);
247
+			$cat_find_array = array();
248
+			foreach ($map_cat_ids_array as $cat_id) {
249
+				$field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
250
+				$cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
251
+				$main_query_array[] = $cat_id;
252
+			}
253 253
 
254
-        }
255
-    }
254
+		}
255
+	}
256 256
 
257
-    if (!empty($field_default_cat))
258
-        $field_default_cat = '';
257
+	if (!empty($field_default_cat))
258
+		$field_default_cat = '';
259 259
 
260
-    if (!empty($cat_find_array))
261
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
260
+	if (!empty($cat_find_array))
261
+		$search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
262 262
 
263
-    $main_query_array = $map_cat_ids_array;
263
+	$main_query_array = $map_cat_ids_array;
264 264
   
265
-    if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
266
-        $search .= " AND p.post_title LIKE %s";
267
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
268
-    }
269
-
270
-    /**
271
-     * Filter the marker query search SQL, values are replaces with %s or %d.
272
-     *
273
-     * @since 1.5.3
274
-     *
275
-     * @param string $search The SQL query for search/where.
276
-     */
277
-    $search = apply_filters('geodir_marker_search', $search);
278
-    /**
279
-     * Filter the marker query search SQL values %s and %d, this is an array of values.
280
-     *
281
-     * @since 1.5.3
282
-     *
283
-     * @param array $main_query_array The SQL query values for search/where.
284
-     */
285
-    $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
286
-
287
-    $gd_posttype = '';
288
-    if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
289
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
290
-        $gd_posttype = " AND p.post_type = %s";
291
-        $main_query_array[] = $_REQUEST['gd_posttype'];
292
-
293
-    } else
294
-        $table = $plugin_prefix . 'gd_place_detail';
295
-
296
-    $join = ", " . $table . " AS pd ";
297
-
298
-    /**
265
+	if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
266
+		$search .= " AND p.post_title LIKE %s";
267
+		$main_query_array[] = "%" . $_REQUEST['search'] . "%";
268
+	}
269
+
270
+	/**
271
+	 * Filter the marker query search SQL, values are replaces with %s or %d.
272
+	 *
273
+	 * @since 1.5.3
274
+	 *
275
+	 * @param string $search The SQL query for search/where.
276
+	 */
277
+	$search = apply_filters('geodir_marker_search', $search);
278
+	/**
279
+	 * Filter the marker query search SQL values %s and %d, this is an array of values.
280
+	 *
281
+	 * @since 1.5.3
282
+	 *
283
+	 * @param array $main_query_array The SQL query values for search/where.
284
+	 */
285
+	$main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
286
+
287
+	$gd_posttype = '';
288
+	if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
289
+		$table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
290
+		$gd_posttype = " AND p.post_type = %s";
291
+		$main_query_array[] = $_REQUEST['gd_posttype'];
292
+
293
+	} else
294
+		$table = $plugin_prefix . 'gd_place_detail';
295
+
296
+	$join = ", " . $table . " AS pd ";
297
+
298
+	/**
299 299
 	 * Filter the SQL JOIN clause for the markers data
300 300
 	 *
301 301
 	 * @since 1.0.0
@@ -312,16 +312,16 @@  discard block
 block discarded – undo
312 312
 	 * @param string $search Row of searched fields to use in WHERE clause.
313 313
 	 */
314 314
 	$search = apply_filters('geodir_home_map_listing_where', $search);
315
-    $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
316
-    $cat_type = $post_type . 'category';
317
-    if ($post_type == 'gd_event') {
318
-        $event_select = ", pd.recurring_dates, pd.is_recurring";
319
-    } else {
320
-        $event_select = "";
321
-    }
322
-
323
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
324
-    /**
315
+	$search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
316
+	$cat_type = $post_type . 'category';
317
+	if ($post_type == 'gd_event') {
318
+		$event_select = ", pd.recurring_dates, pd.is_recurring";
319
+	} else {
320
+		$event_select = "";
321
+	}
322
+
323
+	$sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
324
+	/**
325 325
 	 * Filter the SQL SELECT clause to retrive fields data
326 326
 	 *
327 327
 	 * @since 1.0.0
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
342 342
 
343
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
343
+	$catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
344 344
     
345 345
 	/**
346 346
 	 * Filter the SQL query to retrive markers data
@@ -356,276 +356,276 @@  discard block
 block discarded – undo
356 356
 //    print_r($gd_session);
357 357
 //    print_r($_SESSION);
358 358
 
359
-    $catinfo = $wpdb->get_results($catsql);
359
+	$catinfo = $wpdb->get_results($catsql);
360 360
 	
361
-    $cat_content_info = array();
362
-    $content_data = array();
363
-    $post_ids = array();
364
-
365
-    /**
366
-     * Called before marker data is processed into JSON.
367
-     *
368
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
369
-     *
370
-     * @since 1.5.3
371
-     * @param object $catinfo The posts object containing all marker data.
372
-     * @see 'geodir_after_marker_post_process'
373
-     */
374
-    $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
375
-
376
-    /**
377
-     * Called before marker data is processed into JSON.
378
-     *
379
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
380
-     *
381
-     * @since 1.4.9
382
-     * @param object $catinfo The posts object containing all marker data.
383
-     * @see 'geodir_after_marker_post_process'
384
-     */
385
-    do_action('geodir_before_marker_post_process_action', $catinfo);
386
-
387
-    // Sort any posts into a ajax array
388
-    if (!empty($catinfo)) {
389
-        $geodir_cat_icons = geodir_get_term_icon();
390
-        global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
391
-
392
-        $today = strtotime(date_i18n('Y-m-d'));
393
-        $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
361
+	$cat_content_info = array();
362
+	$content_data = array();
363
+	$post_ids = array();
364
+
365
+	/**
366
+	 * Called before marker data is processed into JSON.
367
+	 *
368
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
369
+	 *
370
+	 * @since 1.5.3
371
+	 * @param object $catinfo The posts object containing all marker data.
372
+	 * @see 'geodir_after_marker_post_process'
373
+	 */
374
+	$catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
375
+
376
+	/**
377
+	 * Called before marker data is processed into JSON.
378
+	 *
379
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
380
+	 *
381
+	 * @since 1.4.9
382
+	 * @param object $catinfo The posts object containing all marker data.
383
+	 * @see 'geodir_after_marker_post_process'
384
+	 */
385
+	do_action('geodir_before_marker_post_process_action', $catinfo);
386
+
387
+	// Sort any posts into a ajax array
388
+	if (!empty($catinfo)) {
389
+		$geodir_cat_icons = geodir_get_term_icon();
390
+		global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
391
+
392
+		$today = strtotime(date_i18n('Y-m-d'));
393
+		$show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
394 394
         
395
-        foreach ($catinfo as $catinfo_obj) {
396
-            $post_title = $catinfo_obj->post_title;
395
+		foreach ($catinfo as $catinfo_obj) {
396
+			$post_title = $catinfo_obj->post_title;
397 397
             
398
-            if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
399
-                $event_dates = '';
400
-                $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
398
+			if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
399
+				$event_dates = '';
400
+				$recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
401 401
 
402
-                $post_info = geodir_get_post_info($catinfo_obj->post_id);
402
+				$post_info = geodir_get_post_info($catinfo_obj->post_id);
403 403
                 
404
-                if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
405
-                    $starttimes = '';
406
-                    $endtimes = '';
407
-                    $astarttimes = array();
408
-                    $aendtimes = array();
409
-                    if ( !isset( $recurring_data['repeat_type'] ) ) {
410
-                        $recurring_data['repeat_type'] = 'custom';
411
-                    }
412
-                    $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
413
-                    $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
404
+				if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
405
+					$starttimes = '';
406
+					$endtimes = '';
407
+					$astarttimes = array();
408
+					$aendtimes = array();
409
+					if ( !isset( $recurring_data['repeat_type'] ) ) {
410
+						$recurring_data['repeat_type'] = 'custom';
411
+					}
412
+					$repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
413
+					$different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
414 414
         
415
-                    $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
415
+					$recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
416 416
                     
417
-                    if ( !empty( $recurring_dates ) ) {
418
-                        if ( empty( $recurring_data['all_day'] ) ) {
419
-                            if ( $repeat_type == 'custom' && $different_times ) {
420
-                                $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
421
-                                $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
422
-                            } else {
423
-                                $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
424
-                                $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
425
-                            }
426
-                        }
417
+					if ( !empty( $recurring_dates ) ) {
418
+						if ( empty( $recurring_data['all_day'] ) ) {
419
+							if ( $repeat_type == 'custom' && $different_times ) {
420
+								$astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
421
+								$aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
422
+							} else {
423
+								$starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
424
+								$endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
425
+							}
426
+						}
427 427
                         
428
-                        $e = 0;
429
-                        foreach( $recurring_dates as $key => $date ) {
430
-                            if ( $repeat_type == 'custom' && $different_times ) {
431
-                                if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
432
-                                    $starttimes = $astarttimes[$key];
433
-                                    $endtimes = $aendtimes[$key];
434
-                                } else {
435
-                                    $starttimes = '';
436
-                                    $endtimes = '';
437
-                                }
438
-                            }
428
+						$e = 0;
429
+						foreach( $recurring_dates as $key => $date ) {
430
+							if ( $repeat_type == 'custom' && $different_times ) {
431
+								if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
432
+									$starttimes = $astarttimes[$key];
433
+									$endtimes = $aendtimes[$key];
434
+								} else {
435
+									$starttimes = '';
436
+									$endtimes = '';
437
+								}
438
+							}
439 439
                             
440
-                            $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
441
-                            $duration--;
442
-                            $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
440
+							$duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
441
+							$duration--;
442
+							$enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
443 443
                             
444
-                            // Hide past dates
445
-                            if ( strtotime( $enddate ) < $today ) {
446
-                                continue;
447
-                            }
444
+							// Hide past dates
445
+							if ( strtotime( $enddate ) < $today ) {
446
+								continue;
447
+							}
448 448
                                     
449
-                            $sdate = strtotime( $date . ' ' . $starttimes );
450
-                            $edate = strtotime( $enddate . ' ' . $endtimes );
449
+							$sdate = strtotime( $date . ' ' . $starttimes );
450
+							$edate = strtotime( $enddate . ' ' . $endtimes );
451 451
                                         
452
-                            $start_date = date_i18n( $geodir_date_time_format, $sdate );
453
-                            $end_date = date_i18n( $geodir_date_time_format, $edate );
452
+							$start_date = date_i18n( $geodir_date_time_format, $sdate );
453
+							$end_date = date_i18n( $geodir_date_time_format, $edate );
454 454
                             
455
-                            $same_day = false;
456
-                            $full_day = false;
457
-                            $same_datetime = false;
455
+							$same_day = false;
456
+							$full_day = false;
457
+							$same_datetime = false;
458 458
                             
459
-                            if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
460
-                                $full_day = true;
461
-                            }
459
+							if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
460
+								$full_day = true;
461
+							}
462 462
                             
463
-                            if ( $start_date == $end_date && $full_day ) {
464
-                                $same_datetime = true;
465
-                            }
466
-
467
-                            $link_date = date_i18n( 'Y-m-d', $sdate );
468
-                            $title_date = date_i18n( $geodir_date_format, $sdate );
469
-                            if ( $full_day ) {
470
-                                $start_date = $title_date;
471
-                                $end_date = date_i18n( $geodir_date_format, $edate );
472
-                            }
463
+							if ( $start_date == $end_date && $full_day ) {
464
+								$same_datetime = true;
465
+							}
466
+
467
+							$link_date = date_i18n( 'Y-m-d', $sdate );
468
+							$title_date = date_i18n( $geodir_date_format, $sdate );
469
+							if ( $full_day ) {
470
+								$start_date = $title_date;
471
+								$end_date = date_i18n( $geodir_date_format, $edate );
472
+							}
473 473
                             
474
-                            if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
475
-                                $same_day = true;
474
+							if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
475
+								$same_day = true;
476 476
                                 
477
-                                $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
478
-                            }
477
+								$start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
478
+							}
479 479
                             
480
-                            $event_dates .= ' :: ' . $start_date;
480
+							$event_dates .= ' :: ' . $start_date;
481 481
                         
482
-                            if ( !$same_day && !$same_datetime ) {
483
-                                $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
484
-                            }
482
+							if ( !$same_day && !$same_datetime ) {
483
+								$event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
484
+							}
485 485
                             
486
-                            $e++;
486
+							$e++;
487 487
                             
488
-                            if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
489
-                                break;
490
-                            }
491
-                        }
492
-                    }
493
-                } else {
494
-                    $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
495
-                    $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
496
-                    $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
497
-                    $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
498
-                    $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
488
+							if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
489
+								break;
490
+							}
491
+						}
492
+					}
493
+				} else {
494
+					$start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
495
+					$end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
496
+					$all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
497
+					$starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
498
+					$endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
499 499
                 
500
-                    $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
501
-                    $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
502
-                    $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
500
+					$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
501
+					$starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
502
+					$endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
503 503
                     
504
-                    if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
505
-                        $start_date = $event_recurring_dates[0];
506
-                    }
504
+					if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
505
+						$start_date = $event_recurring_dates[0];
506
+					}
507 507
                                 
508
-                    if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
509
-                        $end_date = $start_date;
510
-                    }
508
+					if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
509
+						$end_date = $start_date;
510
+					}
511 511
                     
512
-                    if ($end_date != '' && strtotime($end_date) >= $today) {
513
-                        if ( $starttime == '' && !empty( $starttimes ) ) {
514
-                            $starttime = $starttimes[0];
515
-                            $endtime = $endtimes[0];
516
-                        }
512
+					if ($end_date != '' && strtotime($end_date) >= $today) {
513
+						if ( $starttime == '' && !empty( $starttimes ) ) {
514
+							$starttime = $starttimes[0];
515
+							$endtime = $endtimes[0];
516
+						}
517 517
                         
518
-                        $same_day = false;
519
-                        $one_day = false;
520
-                        if ( $start_date == $end_date && $all_day ) {
521
-                            $one_day = true;
522
-                        }
523
-
524
-                        if ( $all_day ) {
525
-                            $start_datetime = strtotime( $start_date );
526
-                            $end_datetime = strtotime( $end_date );
518
+						$same_day = false;
519
+						$one_day = false;
520
+						if ( $start_date == $end_date && $all_day ) {
521
+							$one_day = true;
522
+						}
523
+
524
+						if ( $all_day ) {
525
+							$start_datetime = strtotime( $start_date );
526
+							$end_datetime = strtotime( $end_date );
527 527
                             
528
-                            $start_date = date_i18n( $geodir_date_format, $start_datetime );
529
-                            $end_date = date_i18n( $geodir_date_format, $end_datetime );
530
-                            if ( $start_date == $end_date ) {
531
-                                $one_day = true;
532
-                            }
533
-                        } else {
534
-                            if ( $start_date == $end_date && $starttime == $endtime ) {
535
-                                $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
536
-                                $one_day = false;
537
-                            }
538
-                            $start_datetime = strtotime( $start_date . ' ' . $starttime );
539
-                            $end_datetime = strtotime( $end_date . ' ' . $endtime );
528
+							$start_date = date_i18n( $geodir_date_format, $start_datetime );
529
+							$end_date = date_i18n( $geodir_date_format, $end_datetime );
530
+							if ( $start_date == $end_date ) {
531
+								$one_day = true;
532
+							}
533
+						} else {
534
+							if ( $start_date == $end_date && $starttime == $endtime ) {
535
+								$end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
536
+								$one_day = false;
537
+							}
538
+							$start_datetime = strtotime( $start_date . ' ' . $starttime );
539
+							$end_datetime = strtotime( $end_date . ' ' . $endtime );
540 540
                             
541
-                            $start_date = date_i18n( $geodir_date_time_format, $start_datetime );
542
-                            $end_date = date_i18n( $geodir_date_time_format, $end_datetime );
543
-                        }
541
+							$start_date = date_i18n( $geodir_date_time_format, $start_datetime );
542
+							$end_date = date_i18n( $geodir_date_time_format, $end_datetime );
543
+						}
544 544
 
545
-                        if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
546
-                            $same_day = true;
545
+						if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
546
+							$same_day = true;
547 547
                             
548
-                            $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
549
-                        }
548
+							$start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
549
+						}
550 550
                         
551
-                        $event_dates .= ' :: ' . $start_date;
551
+						$event_dates .= ' :: ' . $start_date;
552 552
                         
553
-                        if ( !$same_day && !$one_day ) {
554
-                            $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
555
-                        }
556
-                    }
557
-                }
558
-
559
-                if (empty($event_dates)) {
560
-                    continue;
561
-                }
553
+						if ( !$same_day && !$one_day ) {
554
+							$event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
555
+						}
556
+					}
557
+				}
558
+
559
+				if (empty($event_dates)) {
560
+					continue;
561
+				}
562 562
                 
563
-                $post_title .= $event_dates;
564
-            }
563
+				$post_title .= $event_dates;
564
+			}
565 565
 
566
-            $map_cat_ids_array;
567
-            $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
566
+			$map_cat_ids_array;
567
+			$default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
568 568
 
569
-            // if single cat lets just show that icon
570
-            if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
571
-                $default_cat = (int)$map_cat_ids_array[0];
572
-            }
569
+			// if single cat lets just show that icon
570
+			if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
571
+				$default_cat = (int)$map_cat_ids_array[0];
572
+			}
573 573
 
574
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
575
-            $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
576
-            $title = str_replace($srcharr, $replarr, $post_title);
574
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
575
+			$mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
576
+			$title = str_replace($srcharr, $replarr, $post_title);
577 577
             
578
-            if ($icon != '') {
579
-                $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
578
+			if ($icon != '') {
579
+				$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
580 580
                 
581
-                if (isset($gd_marker_sizes[$icon])) {
582
-                    $icon_size = $gd_marker_sizes[$icon];
583
-                } else {
584
-                    $icon_size = geodir_get_marker_size($icon);
585
-                    $gd_marker_sizes[$icon] = $icon_size;
586
-                }               
587
-            } else {
588
-                $icon_size = array('w' => 36, 'h' => 45);
589
-            }
590
-
591
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
592
-            $post_ids[] = $catinfo_obj->post_id;
593
-        }
594
-    }
595
-
596
-    /**
597
-     * Called after marker data is processed into JSON.
598
-     *
599
-     * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
600
-     *
601
-     * @since 1.4.9
602
-     * @param array $content_data The array containing all markers in JSON format.
603
-     * @param object $catinfo The posts object containing all marker data.
604
-     * @see 'geodir_before_marker_post_process'
605
-     */
606
-    do_action('geodir_after_marker_post_process', $content_data, $catinfo);
607
-
608
-    if (!empty($content_data)) {
609
-        $cat_content_info[] = implode(',', $content_data);
610
-    }
611
-
612
-    $totalcount = count(array_unique($post_ids));
613
-
614
-    if (!empty($cat_content_info)) {
615
-        $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
616
-    }
617
-    else {
618
-        $map_json =  '[{"totalcount":"0"}]';
619
-    }
620
-
621
-
622
-    /**
623
-     * Filter the marker json return.
624
-     *
625
-     * @since 1.6.22
626
-     * @param string $map_json The JSON string of the map markers results.
627
-     */
628
-    return apply_filters('geodir_markers_json',$map_json);
581
+				if (isset($gd_marker_sizes[$icon])) {
582
+					$icon_size = $gd_marker_sizes[$icon];
583
+				} else {
584
+					$icon_size = geodir_get_marker_size($icon);
585
+					$gd_marker_sizes[$icon] = $icon_size;
586
+				}               
587
+			} else {
588
+				$icon_size = array('w' => 36, 'h' => 45);
589
+			}
590
+
591
+			$content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
592
+			$post_ids[] = $catinfo_obj->post_id;
593
+		}
594
+	}
595
+
596
+	/**
597
+	 * Called after marker data is processed into JSON.
598
+	 *
599
+	 * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
600
+	 *
601
+	 * @since 1.4.9
602
+	 * @param array $content_data The array containing all markers in JSON format.
603
+	 * @param object $catinfo The posts object containing all marker data.
604
+	 * @see 'geodir_before_marker_post_process'
605
+	 */
606
+	do_action('geodir_after_marker_post_process', $content_data, $catinfo);
607
+
608
+	if (!empty($content_data)) {
609
+		$cat_content_info[] = implode(',', $content_data);
610
+	}
611
+
612
+	$totalcount = count(array_unique($post_ids));
613
+
614
+	if (!empty($cat_content_info)) {
615
+		$map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
616
+	}
617
+	else {
618
+		$map_json =  '[{"totalcount":"0"}]';
619
+	}
620
+
621
+
622
+	/**
623
+	 * Filter the marker json return.
624
+	 *
625
+	 * @since 1.6.22
626
+	 * @param string $map_json The JSON string of the map markers results.
627
+	 */
628
+	return apply_filters('geodir_markers_json',$map_json);
629 629
 }
630 630
 
631 631
 
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Enable map cache if set
10
-if(get_option('geodir_enable_map_cache')){
11
-    add_filter('geodir_get_markers_cache','geodir_get_map_cache');
12
-    add_filter('geodir_markers_json','geodir_save_map_cache',10);
10
+if (get_option('geodir_enable_map_cache')) {
11
+    add_filter('geodir_get_markers_cache', 'geodir_get_map_cache');
12
+    add_filter('geodir_markers_json', 'geodir_save_map_cache', 10);
13 13
 }
14 14
 
15 15
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
  * @since 1.6.22
22 22
  * @return string
23 23
  */
24
-function geodir_get_map_cache($cache){
24
+function geodir_get_map_cache($cache) {
25 25
 
26 26
     // if a search is going on then dont even try to check for cache.
27
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
27
+    if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
28 28
         return $cache;
29 29
     }
30 30
 
@@ -43,17 +43,17 @@  discard block
 block discarded – undo
43 43
     $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
44 44
     $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
45 45
 
46
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
46
+    $file_name = sanitize_file_name(md5(implode("-", $url_params)));
47 47
 
48 48
     $blog_id = get_current_blog_id();
49
-    if($blog_id>1){
49
+    if ($blog_id > 1) {
50 50
         $file_name = $blog_id."_".$file_name;
51 51
     }
52 52
 
53 53
     $file_path = realpath(dirname(__FILE__))."/map-cache/";
54 54
 
55 55
 
56
-    if(file_exists($file_path.$file_name.".json")){
56
+    if (file_exists($file_path.$file_name.".json")) {
57 57
 
58 58
 
59 59
         ob_start();
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
 
63 63
         // do the cache delete stuff
64 64
         $cache_time = get_option('geodir_map_cache');
65
-        if(!$cache_time){
65
+        if (!$cache_time) {
66 66
             $cache_time = time();
67 67
             update_option('geodir_map_cache', $cache_time);
68 68
         }
69 69
 
70
-        if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
70
+        if ((time() - $cache_time) > 86400) { // delete the cache every 24 hours
71 71
             geodir_delete_map_cache();
72 72
         }
73 73
 
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
  * @since 1.6.22
87 87
  * @return mixed
88 88
  */
89
-function geodir_save_map_cache($map_json){
89
+function geodir_save_map_cache($map_json) {
90 90
 
91 91
     // if a search is going on then dont even try to check for cache.
92
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
92
+    if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
93 93
         return $map_json;
94 94
     }
95 95
 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
     $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
109 109
     $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
110 110
 
111
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
111
+    $file_name = sanitize_file_name(md5(implode("-", $url_params)));
112 112
 
113 113
     $blog_id = get_current_blog_id();
114
-    if($blog_id>1){
114
+    if ($blog_id > 1) {
115 115
         $file_name = $blog_id."_".$file_name;
116 116
     }
117 117
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
     global $wp_filesystem;
122 122
     if (empty($wp_filesystem)) {
123
-        require_once (ABSPATH . '/wp-admin/includes/file.php');
123
+        require_once (ABSPATH.'/wp-admin/includes/file.php');
124 124
         WP_Filesystem();
125 125
     }
126 126
     $wp_filesystem->put_contents(
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     $gd_session->set('homemap_catlist_ptype', $gd_post_type);
142 142
     $post_taxonomy = geodir_get_taxonomies($gd_post_type);
143 143
     $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
144
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
144
+    $child_collapse = (bool) $_REQUEST['child_collapse'];
145 145
     echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
146 146
     die;
147 147
 }
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
     global $wpdb, $plugin_prefix, $gd_session;
162 162
 
163 163
     if ($_REQUEST['m_id'] != '') {
164
-        $pid = (int)$_REQUEST['m_id'];
164
+        $pid = (int) $_REQUEST['m_id'];
165 165
     } else {
166 166
         echo __('No marker data found', 'geodirectory');
167 167
         exit;
168 168
     }
169 169
 
170 170
     if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
171
-        $post = (object)$gd_ses_listing;
171
+        $post = (object) $gd_ses_listing;
172 172
         echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
173 173
     } else {
174 174
         $geodir_post_type = get_post_type($pid);
175 175
 
176
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
176
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
177 177
 
178
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
178
+        $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
179 179
 
180 180
         $postinfo = $wpdb->get_results($sql);
181 181
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function get_markers() {
211 211
     
212
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
212
+    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session;
213 213
 
214 214
 
215 215
     /**
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
      *
218 218
      * @since 1.6.22
219 219
      */
220
-    $map_cache = apply_filters('geodir_get_markers_cache','');
221
-    if($map_cache){
220
+    $map_cache = apply_filters('geodir_get_markers_cache', '');
221
+    if ($map_cache) {
222 222
         return $map_cache;
223 223
         wp_die();
224 224
     }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
234 234
 
235 235
     $map_cat_ids_array = array('0');
236
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
236
+    $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
237 237
 
238 238
 
239 239
     $field_default_cat = '';
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
         $map_cat_arr = trim($_REQUEST['cat_id'], ',');
242 242
 
243 243
         if (!empty($map_cat_arr)) {
244
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
244
+            $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
245 245
 
246 246
             $map_cat_ids_array = explode(',', $map_cat_arr);
247 247
             $cat_find_array = array();
248 248
             foreach ($map_cat_ids_array as $cat_id) {
249
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
250
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
249
+                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id ";
250
+                $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)";
251 251
                 $main_query_array[] = $cat_id;
252 252
             }
253 253
 
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
         $field_default_cat = '';
259 259
 
260 260
     if (!empty($cat_find_array))
261
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
261
+        $search .= "AND (".implode(' OR ', $cat_find_array).")";
262 262
 
263 263
     $main_query_array = $map_cat_ids_array;
264 264
   
265 265
     if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
266 266
         $search .= " AND p.post_title LIKE %s";
267
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
267
+        $main_query_array[] = "%".$_REQUEST['search']."%";
268 268
     }
269 269
 
270 270
     /**
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 
287 287
     $gd_posttype = '';
288 288
     if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
289
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
289
+        $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail';
290 290
         $gd_posttype = " AND p.post_type = %s";
291 291
         $main_query_array[] = $_REQUEST['gd_posttype'];
292 292
 
293 293
     } else
294
-        $table = $plugin_prefix . 'gd_place_detail';
294
+        $table = $plugin_prefix.'gd_place_detail';
295 295
 
296
-    $join = ", " . $table . " AS pd ";
296
+    $join = ", ".$table." AS pd ";
297 297
 
298 298
     /**
299 299
 	 * Filter the SQL JOIN clause for the markers data
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	$search = apply_filters('geodir_home_map_listing_where', $search);
315 315
     $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
316
-    $cat_type = $post_type . 'category';
316
+    $cat_type = $post_type.'category';
317 317
     if ($post_type == 'gd_event') {
318 318
         $event_select = ", pd.recurring_dates, pd.is_recurring";
319 319
     } else {
320 320
         $event_select = "";
321 321
     }
322 322
 
323
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
323
+    $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select;
324 324
     /**
325 325
 	 * Filter the SQL SELECT clause to retrive fields data
326 326
 	 *
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
342 342
 
343
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
343
+    $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
344 344
     
345 345
 	/**
346 346
 	 * Filter the SQL query to retrive markers data
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
         global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
391 391
 
392 392
         $today = strtotime(date_i18n('Y-m-d'));
393
-        $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
393
+        $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0;
394 394
         
395 395
         foreach ($catinfo as $catinfo_obj) {
396 396
             $post_title = $catinfo_obj->post_title;
@@ -406,29 +406,29 @@  discard block
 block discarded – undo
406 406
                     $endtimes = '';
407 407
                     $astarttimes = array();
408 408
                     $aendtimes = array();
409
-                    if ( !isset( $recurring_data['repeat_type'] ) ) {
409
+                    if (!isset($recurring_data['repeat_type'])) {
410 410
                         $recurring_data['repeat_type'] = 'custom';
411 411
                     }
412
-                    $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
413
-                    $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
412
+                    $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
413
+                    $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false;
414 414
         
415 415
                     $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
416 416
                     
417
-                    if ( !empty( $recurring_dates ) ) {
418
-                        if ( empty( $recurring_data['all_day'] ) ) {
419
-                            if ( $repeat_type == 'custom' && $different_times ) {
420
-                                $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
421
-                                $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
417
+                    if (!empty($recurring_dates)) {
418
+                        if (empty($recurring_data['all_day'])) {
419
+                            if ($repeat_type == 'custom' && $different_times) {
420
+                                $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array();
421
+                                $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array();
422 422
                             } else {
423
-                                $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
424
-                                $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
423
+                                $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : '';
424
+                                $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : '';
425 425
                             }
426 426
                         }
427 427
                         
428 428
                         $e = 0;
429
-                        foreach( $recurring_dates as $key => $date ) {
430
-                            if ( $repeat_type == 'custom' && $different_times ) {
431
-                                if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
429
+                        foreach ($recurring_dates as $key => $date) {
430
+                            if ($repeat_type == 'custom' && $different_times) {
431
+                                if (!empty($astarttimes) && isset($astarttimes[$key])) {
432 432
                                     $starttimes = $astarttimes[$key];
433 433
                                     $endtimes = $aendtimes[$key];
434 434
                                 } else {
@@ -437,50 +437,50 @@  discard block
 block discarded – undo
437 437
                                 }
438 438
                             }
439 439
                             
440
-                            $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
440
+                            $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1;
441 441
                             $duration--;
442
-                            $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
442
+                            $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day'));
443 443
                             
444 444
                             // Hide past dates
445
-                            if ( strtotime( $enddate ) < $today ) {
445
+                            if (strtotime($enddate) < $today) {
446 446
                                 continue;
447 447
                             }
448 448
                                     
449
-                            $sdate = strtotime( $date . ' ' . $starttimes );
450
-                            $edate = strtotime( $enddate . ' ' . $endtimes );
449
+                            $sdate = strtotime($date.' '.$starttimes);
450
+                            $edate = strtotime($enddate.' '.$endtimes);
451 451
                                         
452
-                            $start_date = date_i18n( $geodir_date_time_format, $sdate );
453
-                            $end_date = date_i18n( $geodir_date_time_format, $edate );
452
+                            $start_date = date_i18n($geodir_date_time_format, $sdate);
453
+                            $end_date = date_i18n($geodir_date_time_format, $edate);
454 454
                             
455 455
                             $same_day = false;
456 456
                             $full_day = false;
457 457
                             $same_datetime = false;
458 458
                             
459
-                            if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
459
+                            if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) {
460 460
                                 $full_day = true;
461 461
                             }
462 462
                             
463
-                            if ( $start_date == $end_date && $full_day ) {
463
+                            if ($start_date == $end_date && $full_day) {
464 464
                                 $same_datetime = true;
465 465
                             }
466 466
 
467
-                            $link_date = date_i18n( 'Y-m-d', $sdate );
468
-                            $title_date = date_i18n( $geodir_date_format, $sdate );
469
-                            if ( $full_day ) {
467
+                            $link_date = date_i18n('Y-m-d', $sdate);
468
+                            $title_date = date_i18n($geodir_date_format, $sdate);
469
+                            if ($full_day) {
470 470
                                 $start_date = $title_date;
471
-                                $end_date = date_i18n( $geodir_date_format, $edate );
471
+                                $end_date = date_i18n($geodir_date_format, $edate);
472 472
                             }
473 473
                             
474
-                            if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
474
+                            if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) {
475 475
                                 $same_day = true;
476 476
                                 
477
-                                $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
477
+                                $start_date .= ' - '.date_i18n($geodir_time_format, $edate);
478 478
                             }
479 479
                             
480
-                            $event_dates .= ' :: ' . $start_date;
480
+                            $event_dates .= ' :: '.$start_date;
481 481
                         
482
-                            if ( !$same_day && !$same_datetime ) {
483
-                                $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
482
+                            if (!$same_day && !$same_datetime) {
483
+                                $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
484 484
                             }
485 485
                             
486 486
                             $e++;
@@ -491,67 +491,67 @@  discard block
 block discarded – undo
491 491
                         }
492 492
                     }
493 493
                 } else {
494
-                    $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
495
-                    $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
496
-                    $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
497
-                    $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
498
-                    $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
494
+                    $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : '';
495
+                    $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date;
496
+                    $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false;
497
+                    $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : '';
498
+                    $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : '';
499 499
                 
500
-                    $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
501
-                    $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
502
-                    $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
500
+                    $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
501
+                    $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array();
502
+                    $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array();
503 503
                     
504
-                    if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
504
+                    if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) {
505 505
                         $start_date = $event_recurring_dates[0];
506 506
                     }
507 507
                                 
508
-                    if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
508
+                    if (strtotime($end_date) < strtotime($start_date)) {
509 509
                         $end_date = $start_date;
510 510
                     }
511 511
                     
512 512
                     if ($end_date != '' && strtotime($end_date) >= $today) {
513
-                        if ( $starttime == '' && !empty( $starttimes ) ) {
513
+                        if ($starttime == '' && !empty($starttimes)) {
514 514
                             $starttime = $starttimes[0];
515 515
                             $endtime = $endtimes[0];
516 516
                         }
517 517
                         
518 518
                         $same_day = false;
519 519
                         $one_day = false;
520
-                        if ( $start_date == $end_date && $all_day ) {
520
+                        if ($start_date == $end_date && $all_day) {
521 521
                             $one_day = true;
522 522
                         }
523 523
 
524
-                        if ( $all_day ) {
525
-                            $start_datetime = strtotime( $start_date );
526
-                            $end_datetime = strtotime( $end_date );
524
+                        if ($all_day) {
525
+                            $start_datetime = strtotime($start_date);
526
+                            $end_datetime = strtotime($end_date);
527 527
                             
528
-                            $start_date = date_i18n( $geodir_date_format, $start_datetime );
529
-                            $end_date = date_i18n( $geodir_date_format, $end_datetime );
530
-                            if ( $start_date == $end_date ) {
528
+                            $start_date = date_i18n($geodir_date_format, $start_datetime);
529
+                            $end_date = date_i18n($geodir_date_format, $end_datetime);
530
+                            if ($start_date == $end_date) {
531 531
                                 $one_day = true;
532 532
                             }
533 533
                         } else {
534
-                            if ( $start_date == $end_date && $starttime == $endtime ) {
535
-                                $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
534
+                            if ($start_date == $end_date && $starttime == $endtime) {
535
+                                $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day'));
536 536
                                 $one_day = false;
537 537
                             }
538
-                            $start_datetime = strtotime( $start_date . ' ' . $starttime );
539
-                            $end_datetime = strtotime( $end_date . ' ' . $endtime );
538
+                            $start_datetime = strtotime($start_date.' '.$starttime);
539
+                            $end_datetime = strtotime($end_date.' '.$endtime);
540 540
                             
541
-                            $start_date = date_i18n( $geodir_date_time_format, $start_datetime );
542
-                            $end_date = date_i18n( $geodir_date_time_format, $end_datetime );
541
+                            $start_date = date_i18n($geodir_date_time_format, $start_datetime);
542
+                            $end_date = date_i18n($geodir_date_time_format, $end_datetime);
543 543
                         }
544 544
 
545
-                        if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
545
+                        if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) {
546 546
                             $same_day = true;
547 547
                             
548
-                            $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
548
+                            $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime);
549 549
                         }
550 550
                         
551
-                        $event_dates .= ' :: ' . $start_date;
551
+                        $event_dates .= ' :: '.$start_date;
552 552
                         
553
-                        if ( !$same_day && !$one_day ) {
554
-                            $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
553
+                        if (!$same_day && !$one_day) {
554
+                            $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
555 555
                         }
556 556
                     }
557 557
                 }
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
             $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
568 568
 
569 569
             // if single cat lets just show that icon
570
-            if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
571
-                $default_cat = (int)$map_cat_ids_array[0];
570
+            if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) {
571
+                $default_cat = (int) $map_cat_ids_array[0];
572 572
             }
573 573
 
574 574
             $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
                 $icon_size = array('w' => 36, 'h' => 45);
589 589
             }
590 590
 
591
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
591
+            $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
592 592
             $post_ids[] = $catinfo_obj->post_id;
593 593
         }
594 594
     }
@@ -612,10 +612,10 @@  discard block
 block discarded – undo
612 612
     $totalcount = count(array_unique($post_ids));
613 613
 
614 614
     if (!empty($cat_content_info)) {
615
-        $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
615
+        $map_json = '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
616 616
     }
617 617
     else {
618
-        $map_json =  '[{"totalcount":"0"}]';
618
+        $map_json = '[{"totalcount":"0"}]';
619 619
     }
620 620
 
621 621
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
      * @since 1.6.22
626 626
      * @param string $map_json The JSON string of the map markers results.
627 627
      */
628
-    return apply_filters('geodir_markers_json',$map_json);
628
+    return apply_filters('geodir_markers_json', $map_json);
629 629
 }
630 630
 
631 631
 
Please login to merge, or discard this patch.