Test Failed
Pull Request — master (#348)
by Viruthagiri
21:56
created
geodirectory-admin/dummy-data/property_sale.php 3 patches
Indentation   +873 added lines, -873 removed lines patch added patch discarded remove patch
@@ -7,453 +7,453 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 function geodir_property_sale_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 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 Sale,Sold,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_sale_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 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 Sale,Sold,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_sale_custom_fields', $fields);
214
+
215
+	return  $fields;
216 216
 }
217 217
 
218 218
 function geodir_property_sale_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
-    /**
270
-     * Filter the array of advanced search fields DB table data.
271
-     *
272
-     * @since 1.6.6
273
-     * @param string $fields The default custom fields as an array.
274
-     */
275
-    $fields = apply_filters('geodir_property_sale_custom_fields_sort', $fields);
276
-
277
-    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
+	/**
270
+	 * Filter the array of advanced search fields DB table data.
271
+	 *
272
+	 * @since 1.6.6
273
+	 * @param string $fields The default custom fields as an array.
274
+	 */
275
+	$fields = apply_filters('geodir_property_sale_custom_fields_sort', $fields);
276
+
277
+	return $fields;
278 278
 
279 279
 }
280 280
 
281 281
 function geodir_property_sale_custom_fields_advanced_search($post_type='gd_place') {
282 282
 
283 283
 
284
-    $fields = array();
285
-
286
-    // price range
287
-    $fields[] = array(
288
-        'create_field'            => true,
289
-        'listing_type'            => $post_type,
290
-        'field_type'              => 'text',
291
-        'data_type'               => 'RANGE',
292
-        'is_active'               => 1,
293
-        'site_field_title'        => 'Price',
294
-        'field_data_type'         => 'FLOAT',
295
-        'main_search'             => 1,
296
-        'main_search_priority'    => 15,
297
-        'data_type_change'        => 'SELECT',
298
-        'search_condition_select' => 'SINGLE',
299
-        'search_min_value'        => '50000',
300
-        'search_max_value'        => '1000000',
301
-        'search_diff_value'       => '100000',
302
-        'first_search_value'      => '0',
303
-        'first_search_text'       => '',
304
-        'last_search_text'        => '',
305
-        'search_condition'        => 'SELECT',
306
-        'site_htmlvar_name'       => 'geodir_price',
307
-        'htmlvar_name'            => 'geodir_price',
308
-        'field_title'             => 'geodir_price',
309
-        'expand_custom_value'     => '',
310
-        'front_search_title'      => 'Price Range',
311
-        'field_desc'              => ''
312
-    );
313
-
314
-    // bedrooms
315
-    $fields[] = array(
316
-        'create_field'            => true,
317
-        'listing_type'            => $post_type,
318
-        'field_type'              => 'select',
319
-        'data_type'               => 'CHECK',
320
-        'is_active'               => 1,
321
-        'site_field_title'        => 'Bedrooms',
322
-        'field_data_type'         => 'VARCHAR',
323
-        'main_search'             => 1,
324
-        'main_search_priority'    => 16,
325
-        'search_condition'        => 'SINGLE',
326
-        'site_htmlvar_name'       => 'geodir_property_bedrooms',
327
-        'htmlvar_name'            => 'geodir_property_bedrooms',
328
-        'field_title'             => 'geodir_property_bedrooms',
329
-        'front_search_title'      => 'Bedrooms',
330
-        'field_desc'              => '',
331
-        'expand_custom_value'     => 5,
332
-        'expand_search'           => 1,
333
-        'search_operator'         => 'OR'
334
-    );
335
-
336
-    // Property type
337
-    $fields[] = array(
338
-        'create_field'            => true,
339
-        'listing_type'            => $post_type,
340
-        'field_type'              => 'select',
341
-        'data_type'               => 'CHECK',
342
-        'is_active'               => 1,
343
-        'site_field_title'        => 'Property Type',
344
-        'field_data_type'         => 'VARCHAR',
345
-        'main_search'             => 0,
346
-        //'main_search_priority'    => 16,
347
-        'search_condition'        => 'SINGLE',
348
-        'site_htmlvar_name'       => 'geodir_property_type',
349
-        'htmlvar_name'            => 'geodir_property_type',
350
-        'field_title'             => 'geodir_property_type',
351
-        'front_search_title'      => 'Property Type',
352
-        'field_desc'              => '',
353
-        'expand_custom_value'     => 5,
354
-        'expand_search'           => 1,
355
-        'search_operator'         => 'OR'
356
-    );
357
-
358
-    // Property Features
359
-    $fields[] = array(
360
-        'create_field'            => true,
361
-        'listing_type'            => $post_type,
362
-        'field_type'              => 'multiselect',
363
-        'data_type'               => 'CHECK',
364
-        'is_active'               => 1,
365
-        'site_field_title'        => 'Features',
366
-        'field_data_type'         => 'VARCHAR',
367
-        'main_search'             => 0,
368
-        //'main_search_priority'    => 16,
369
-        'search_condition'        => 'SINGLE',
370
-        'site_htmlvar_name'       => 'geodir_property_features',
371
-        'htmlvar_name'            => 'geodir_property_features',
372
-        'field_title'             => 'geodir_property_features',
373
-        'front_search_title'      => 'Property Features',
374
-        'field_desc'              => '',
375
-        'expand_custom_value'     => 5,
376
-        'expand_search'           => 1,
377
-        'search_operator'         => 'AND'
378
-    );
379
-
380
-    // Property Bathrooms
381
-    $fields[] = array(
382
-        'create_field'            => true,
383
-        'listing_type'            => $post_type,
384
-        'field_type'              => 'select',
385
-        'data_type'               => 'CHECK',
386
-        'is_active'               => 1,
387
-        'site_field_title'        => 'Bathrooms',
388
-        'field_data_type'         => 'VARCHAR',
389
-        'main_search'             => 0,
390
-        //'main_search_priority'    => 16,
391
-        'search_condition'        => 'SINGLE',
392
-        'site_htmlvar_name'       => 'geodir_property_bathrooms',
393
-        'htmlvar_name'            => 'geodir_property_bathrooms',
394
-        'field_title'             => 'geodir_property_bathrooms',
395
-        'front_search_title'      => 'Bathrooms',
396
-        'field_desc'              => '',
397
-        'expand_custom_value'     => 5,
398
-        'expand_search'           => 1,
399
-        'search_operator'         => 'OR'
400
-    );
401
-
402
-    // Property Furnishing
403
-    $fields[] = array(
404
-        'create_field'            => true,
405
-        'listing_type'            => $post_type,
406
-        'field_type'              => 'select',
407
-        'data_type'               => 'CHECK',
408
-        'is_active'               => 1,
409
-        'site_field_title'        => 'Furnishing',
410
-        'field_data_type'         => 'VARCHAR',
411
-        'main_search'             => 0,
412
-        //'main_search_priority'    => 16,
413
-        'search_condition'        => 'SINGLE',
414
-        'site_htmlvar_name'       => 'geodir_property_furnishing',
415
-        'htmlvar_name'            => 'geodir_property_furnishing',
416
-        'field_title'             => 'geodir_property_furnishing',
417
-        'front_search_title'      => 'Furnishing',
418
-        'field_desc'              => '',
419
-        'expand_custom_value'     => 5,
420
-        'expand_search'           => 1,
421
-        'search_operator'         => 'OR'
422
-    );
423
-
424
-    // Property Status
425
-    $fields[] = array(
426
-        'create_field'            => true,
427
-        'listing_type'            => $post_type,
428
-        'field_type'              => 'select',
429
-        'data_type'               => 'CHECK',
430
-        'is_active'               => 1,
431
-        'site_field_title'        => 'Property Status',
432
-        'field_data_type'         => 'VARCHAR',
433
-        'main_search'             => 0,
434
-        //'main_search_priority'    => 16,
435
-        'search_condition'        => 'SINGLE',
436
-        'site_htmlvar_name'       => 'geodir_property_status',
437
-        'htmlvar_name'            => 'geodir_property_status',
438
-        'field_title'             => 'geodir_property_status',
439
-        'front_search_title'      => 'Property Status',
440
-        'field_desc'              => '',
441
-        'expand_custom_value'     => 5,
442
-        'expand_search'           => 1,
443
-        'search_operator'         => 'OR'
444
-    );
445
-
446
-
447
-
448
-    /**
449
-     * Filter the array of advanced search fields DB table data.
450
-     *
451
-     * @since 1.6.6
452
-     * @param string $fields The default custom fields as an array.
453
-     */
454
-    $fields = apply_filters('geodir_property_sale_custom_fields_advanced_search', $fields);
455
-
456
-    return $fields;
284
+	$fields = array();
285
+
286
+	// price range
287
+	$fields[] = array(
288
+		'create_field'            => true,
289
+		'listing_type'            => $post_type,
290
+		'field_type'              => 'text',
291
+		'data_type'               => 'RANGE',
292
+		'is_active'               => 1,
293
+		'site_field_title'        => 'Price',
294
+		'field_data_type'         => 'FLOAT',
295
+		'main_search'             => 1,
296
+		'main_search_priority'    => 15,
297
+		'data_type_change'        => 'SELECT',
298
+		'search_condition_select' => 'SINGLE',
299
+		'search_min_value'        => '50000',
300
+		'search_max_value'        => '1000000',
301
+		'search_diff_value'       => '100000',
302
+		'first_search_value'      => '0',
303
+		'first_search_text'       => '',
304
+		'last_search_text'        => '',
305
+		'search_condition'        => 'SELECT',
306
+		'site_htmlvar_name'       => 'geodir_price',
307
+		'htmlvar_name'            => 'geodir_price',
308
+		'field_title'             => 'geodir_price',
309
+		'expand_custom_value'     => '',
310
+		'front_search_title'      => 'Price Range',
311
+		'field_desc'              => ''
312
+	);
313
+
314
+	// bedrooms
315
+	$fields[] = array(
316
+		'create_field'            => true,
317
+		'listing_type'            => $post_type,
318
+		'field_type'              => 'select',
319
+		'data_type'               => 'CHECK',
320
+		'is_active'               => 1,
321
+		'site_field_title'        => 'Bedrooms',
322
+		'field_data_type'         => 'VARCHAR',
323
+		'main_search'             => 1,
324
+		'main_search_priority'    => 16,
325
+		'search_condition'        => 'SINGLE',
326
+		'site_htmlvar_name'       => 'geodir_property_bedrooms',
327
+		'htmlvar_name'            => 'geodir_property_bedrooms',
328
+		'field_title'             => 'geodir_property_bedrooms',
329
+		'front_search_title'      => 'Bedrooms',
330
+		'field_desc'              => '',
331
+		'expand_custom_value'     => 5,
332
+		'expand_search'           => 1,
333
+		'search_operator'         => 'OR'
334
+	);
335
+
336
+	// Property type
337
+	$fields[] = array(
338
+		'create_field'            => true,
339
+		'listing_type'            => $post_type,
340
+		'field_type'              => 'select',
341
+		'data_type'               => 'CHECK',
342
+		'is_active'               => 1,
343
+		'site_field_title'        => 'Property Type',
344
+		'field_data_type'         => 'VARCHAR',
345
+		'main_search'             => 0,
346
+		//'main_search_priority'    => 16,
347
+		'search_condition'        => 'SINGLE',
348
+		'site_htmlvar_name'       => 'geodir_property_type',
349
+		'htmlvar_name'            => 'geodir_property_type',
350
+		'field_title'             => 'geodir_property_type',
351
+		'front_search_title'      => 'Property Type',
352
+		'field_desc'              => '',
353
+		'expand_custom_value'     => 5,
354
+		'expand_search'           => 1,
355
+		'search_operator'         => 'OR'
356
+	);
357
+
358
+	// Property Features
359
+	$fields[] = array(
360
+		'create_field'            => true,
361
+		'listing_type'            => $post_type,
362
+		'field_type'              => 'multiselect',
363
+		'data_type'               => 'CHECK',
364
+		'is_active'               => 1,
365
+		'site_field_title'        => 'Features',
366
+		'field_data_type'         => 'VARCHAR',
367
+		'main_search'             => 0,
368
+		//'main_search_priority'    => 16,
369
+		'search_condition'        => 'SINGLE',
370
+		'site_htmlvar_name'       => 'geodir_property_features',
371
+		'htmlvar_name'            => 'geodir_property_features',
372
+		'field_title'             => 'geodir_property_features',
373
+		'front_search_title'      => 'Property Features',
374
+		'field_desc'              => '',
375
+		'expand_custom_value'     => 5,
376
+		'expand_search'           => 1,
377
+		'search_operator'         => 'AND'
378
+	);
379
+
380
+	// Property Bathrooms
381
+	$fields[] = array(
382
+		'create_field'            => true,
383
+		'listing_type'            => $post_type,
384
+		'field_type'              => 'select',
385
+		'data_type'               => 'CHECK',
386
+		'is_active'               => 1,
387
+		'site_field_title'        => 'Bathrooms',
388
+		'field_data_type'         => 'VARCHAR',
389
+		'main_search'             => 0,
390
+		//'main_search_priority'    => 16,
391
+		'search_condition'        => 'SINGLE',
392
+		'site_htmlvar_name'       => 'geodir_property_bathrooms',
393
+		'htmlvar_name'            => 'geodir_property_bathrooms',
394
+		'field_title'             => 'geodir_property_bathrooms',
395
+		'front_search_title'      => 'Bathrooms',
396
+		'field_desc'              => '',
397
+		'expand_custom_value'     => 5,
398
+		'expand_search'           => 1,
399
+		'search_operator'         => 'OR'
400
+	);
401
+
402
+	// Property Furnishing
403
+	$fields[] = array(
404
+		'create_field'            => true,
405
+		'listing_type'            => $post_type,
406
+		'field_type'              => 'select',
407
+		'data_type'               => 'CHECK',
408
+		'is_active'               => 1,
409
+		'site_field_title'        => 'Furnishing',
410
+		'field_data_type'         => 'VARCHAR',
411
+		'main_search'             => 0,
412
+		//'main_search_priority'    => 16,
413
+		'search_condition'        => 'SINGLE',
414
+		'site_htmlvar_name'       => 'geodir_property_furnishing',
415
+		'htmlvar_name'            => 'geodir_property_furnishing',
416
+		'field_title'             => 'geodir_property_furnishing',
417
+		'front_search_title'      => 'Furnishing',
418
+		'field_desc'              => '',
419
+		'expand_custom_value'     => 5,
420
+		'expand_search'           => 1,
421
+		'search_operator'         => 'OR'
422
+	);
423
+
424
+	// Property Status
425
+	$fields[] = array(
426
+		'create_field'            => true,
427
+		'listing_type'            => $post_type,
428
+		'field_type'              => 'select',
429
+		'data_type'               => 'CHECK',
430
+		'is_active'               => 1,
431
+		'site_field_title'        => 'Property Status',
432
+		'field_data_type'         => 'VARCHAR',
433
+		'main_search'             => 0,
434
+		//'main_search_priority'    => 16,
435
+		'search_condition'        => 'SINGLE',
436
+		'site_htmlvar_name'       => 'geodir_property_status',
437
+		'htmlvar_name'            => 'geodir_property_status',
438
+		'field_title'             => 'geodir_property_status',
439
+		'front_search_title'      => 'Property Status',
440
+		'field_desc'              => '',
441
+		'expand_custom_value'     => 5,
442
+		'expand_search'           => 1,
443
+		'search_operator'         => 'OR'
444
+	);
445
+
446
+
447
+
448
+	/**
449
+	 * Filter the array of advanced search fields DB table data.
450
+	 *
451
+	 * @since 1.6.6
452
+	 * @param string $fields The default custom fields as an array.
453
+	 */
454
+	$fields = apply_filters('geodir_property_sale_custom_fields_advanced_search', $fields);
455
+
456
+	return $fields;
457 457
 }
458 458
 
459 459
 global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2,$wpdb, $current_user,$dummy_post_index;
@@ -463,52 +463,52 @@  discard block
 block discarded – undo
463 463
 $category_array = array('Apartments', 'Houses', 'Commercial', 'Land');
464 464
 
465 465
 if($dummy_post_index==1){
466
-    // add the dummy categories
467
-    geodir_dummy_data_taxonomies($post_type,$category_array );
468
-
469
-    // add the dummy custom fields
470
-    $fields = geodir_property_sale_custom_fields($post_type);
471
-    geodir_create_dummy_fields($fields);
472
-
473
-    // add sort order items
474
-    $sort_fields = geodir_property_sale_custom_fields_sort($post_type);
475
-    foreach($sort_fields as $sort){
476
-        geodir_custom_sort_field_save($sort);
477
-    }
478
-
479
-    // update the type currently installed
480
-    update_option($post_type.'_dummy_data_type','property_sale');
481
-
482
-    // add the advanced search fields
483
-    if (defined('GEODIRADVANCESEARCH_VERSION')){
484
-        $search_fields = geodir_property_sale_custom_fields_advanced_search($post_type);
485
-        foreach($search_fields as $sfield){
486
-            geodir_custom_advance_search_field_save( $sfield );
487
-        }
488
-    }
466
+	// add the dummy categories
467
+	geodir_dummy_data_taxonomies($post_type,$category_array );
468
+
469
+	// add the dummy custom fields
470
+	$fields = geodir_property_sale_custom_fields($post_type);
471
+	geodir_create_dummy_fields($fields);
472
+
473
+	// add sort order items
474
+	$sort_fields = geodir_property_sale_custom_fields_sort($post_type);
475
+	foreach($sort_fields as $sort){
476
+		geodir_custom_sort_field_save($sort);
477
+	}
478
+
479
+	// update the type currently installed
480
+	update_option($post_type.'_dummy_data_type','property_sale');
481
+
482
+	// add the advanced search fields
483
+	if (defined('GEODIRADVANCESEARCH_VERSION')){
484
+		$search_fields = geodir_property_sale_custom_fields_advanced_search($post_type);
485
+		foreach($search_fields as $sfield){
486
+			geodir_custom_advance_search_field_save( $sfield );
487
+		}
488
+	}
489 489
 }
490 490
 
491 491
 if (geodir_dummy_folder_exists())
492
-    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
492
+	$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
493 493
 else
494
-    $dummy_image_url = 'https://www.wpgeodirectory.com/dummy';
494
+	$dummy_image_url = 'https://www.wpgeodirectory.com/dummy';
495 495
 
496 496
 $dummy_image_url = apply_filters('place_dummy_image_url', $dummy_image_url);
497 497
 
498 498
 switch ($dummy_post_index) {
499 499
 
500
-    case(1):
501
-        $image_array[] = "$dummy_image_url/ps/psf1.jpg";
502
-        $image_array[] = "$dummy_image_url/ps/psl1.jpg";
503
-        $image_array[] = "$dummy_image_url/ps/psb1.jpg";
504
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
505
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
500
+	case(1):
501
+		$image_array[] = "$dummy_image_url/ps/psf1.jpg";
502
+		$image_array[] = "$dummy_image_url/ps/psl1.jpg";
503
+		$image_array[] = "$dummy_image_url/ps/psb1.jpg";
504
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
505
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
506 506
 
507 507
 
508
-        $post_info[] = array(
509
-            "listing_type" => $post_type,
510
-            "post_title" => 'Eastern Lodge',
511
-            "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.
508
+		$post_info[] = array(
509
+			"listing_type" => $post_type,
510
+			"post_title" => 'Eastern Lodge',
511
+			"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.
512 512
 
513 513
 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.
514 514
 
@@ -517,42 +517,42 @@  discard block
 block discarded – undo
517 517
 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.
518 518
 
519 519
 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.',
520
-            "post_images" => $image_array,
521
-            "post_category" => array($post_type.'category' => array($category_array[1])),
522
-            "post_tags" => array('Tags', 'Sample Tags'),
523
-            "geodir_video" => '',
524
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
525
-            "geodir_contact" => '(111) 677-4444',
526
-            "geodir_email" => '[email protected]',
527
-            "geodir_website" => 'http://example.com/',
528
-            "geodir_twitter" => 'http://example.com/',
529
-            "geodir_facebook" => 'http://example.com/',
530
-            "geodir_price" => '350000',
531
-            "geodir_property_status" => 'For Sale',
532
-            'geodir_property_furnishing' => 'Furnished',
533
-            'geodir_property_type' => 'Detached house',
534
-            'geodir_property_bedrooms' => '3',
535
-            'geodir_property_bathrooms' => '2',
536
-            'geodir_property_area' => '1850',
537
-            'geodir_property_features' => 'Gas Central Heating,Triple Glazing,Front Garden,Private driveway,Fireplace',
538
-            "post_dummy" => '1'
539
-        );
540
-
541
-
542
-        break;
543
-    case 2:
544
-        $image_array = array();
545
-        $post_meta = array();
546
-        $image_array[] = "$dummy_image_url/ps/psf2.jpg";
547
-        $image_array[] = "$dummy_image_url/ps/psl2.jpg";
548
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
549
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
550
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
551
-
552
-        $post_info[] = array(
553
-            "listing_type" => $post_type,
554
-            "post_title" => 'Daisy Street',
555
-            "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.
520
+			"post_images" => $image_array,
521
+			"post_category" => array($post_type.'category' => array($category_array[1])),
522
+			"post_tags" => array('Tags', 'Sample Tags'),
523
+			"geodir_video" => '',
524
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
525
+			"geodir_contact" => '(111) 677-4444',
526
+			"geodir_email" => '[email protected]',
527
+			"geodir_website" => 'http://example.com/',
528
+			"geodir_twitter" => 'http://example.com/',
529
+			"geodir_facebook" => 'http://example.com/',
530
+			"geodir_price" => '350000',
531
+			"geodir_property_status" => 'For Sale',
532
+			'geodir_property_furnishing' => 'Furnished',
533
+			'geodir_property_type' => 'Detached house',
534
+			'geodir_property_bedrooms' => '3',
535
+			'geodir_property_bathrooms' => '2',
536
+			'geodir_property_area' => '1850',
537
+			'geodir_property_features' => 'Gas Central Heating,Triple Glazing,Front Garden,Private driveway,Fireplace',
538
+			"post_dummy" => '1'
539
+		);
540
+
541
+
542
+		break;
543
+	case 2:
544
+		$image_array = array();
545
+		$post_meta = array();
546
+		$image_array[] = "$dummy_image_url/ps/psf2.jpg";
547
+		$image_array[] = "$dummy_image_url/ps/psl2.jpg";
548
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
549
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
550
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
551
+
552
+		$post_info[] = array(
553
+			"listing_type" => $post_type,
554
+			"post_title" => 'Daisy Street',
555
+			"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.
556 556
 
557 557
 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.
558 558
 
@@ -562,42 +562,42 @@  discard block
 block discarded – undo
562 562
 
563 563
 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.',
564 564
 
565
-            "post_images" => $image_array,
566
-            "post_category" => array($post_type.'category' => array($category_array[1])),
567
-            "post_tags" => array('Garage'),
568
-            "geodir_video" => '',
569
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
570
-            "geodir_contact" => '(222) 777-1111',
571
-            "geodir_email" => '[email protected]',
572
-            "geodir_website" => 'http://example.com/',
573
-            "geodir_twitter" => 'http://example.com/',
574
-            "geodir_facebook" => 'http://example.com/',
575
-            "geodir_price" => '230000',
576
-            "geodir_property_status" => 'Sold',
577
-            'geodir_property_furnishing' => 'Unfurnished',
578
-            'geodir_property_type' => 'Detached house',
579
-            'geodir_property_bedrooms' => '5',
580
-            'geodir_property_bathrooms' => '3',
581
-            'geodir_property_area' => '2650',
582
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Front Garden,Garage,Private driveway,Fireplace',
583
-            "post_dummy" => '1'
584
-        );
585
-
586
-        break;
587
-
588
-    case 3:
589
-        $image_array = array();
590
-        $post_meta = array();
591
-        $image_array[] = "$dummy_image_url/ps/psf3.jpg";
592
-        $image_array[] = "$dummy_image_url/ps/psl3.jpg";
593
-        $image_array[] = "$dummy_image_url/ps/psb3.jpg";
594
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
595
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
596
-
597
-        $post_info[] = array(
598
-            "listing_type" => $post_type,
599
-            "post_title" => 'Northbay House',
600
-            "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.
565
+			"post_images" => $image_array,
566
+			"post_category" => array($post_type.'category' => array($category_array[1])),
567
+			"post_tags" => array('Garage'),
568
+			"geodir_video" => '',
569
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
570
+			"geodir_contact" => '(222) 777-1111',
571
+			"geodir_email" => '[email protected]',
572
+			"geodir_website" => 'http://example.com/',
573
+			"geodir_twitter" => 'http://example.com/',
574
+			"geodir_facebook" => 'http://example.com/',
575
+			"geodir_price" => '230000',
576
+			"geodir_property_status" => 'Sold',
577
+			'geodir_property_furnishing' => 'Unfurnished',
578
+			'geodir_property_type' => 'Detached house',
579
+			'geodir_property_bedrooms' => '5',
580
+			'geodir_property_bathrooms' => '3',
581
+			'geodir_property_area' => '2650',
582
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Front Garden,Garage,Private driveway,Fireplace',
583
+			"post_dummy" => '1'
584
+		);
585
+
586
+		break;
587
+
588
+	case 3:
589
+		$image_array = array();
590
+		$post_meta = array();
591
+		$image_array[] = "$dummy_image_url/ps/psf3.jpg";
592
+		$image_array[] = "$dummy_image_url/ps/psl3.jpg";
593
+		$image_array[] = "$dummy_image_url/ps/psb3.jpg";
594
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
595
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
596
+
597
+		$post_info[] = array(
598
+			"listing_type" => $post_type,
599
+			"post_title" => 'Northbay House',
600
+			"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.
601 601
 
602 602
 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.
603 603
 
@@ -607,43 +607,43 @@  discard block
 block discarded – undo
607 607
 
608 608
 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.',
609 609
 
610
-            "post_images" => $image_array,
611
-            "post_category" => array($post_type.'category' => array($category_array[1])),
612
-            "post_tags" => array('Tags', 'Sample Tags'),
613
-            "geodir_video" => '',
614
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
615
-            "geodir_contact" => '(222) 777-1111',
616
-            "geodir_email" => '[email protected]',
617
-            "geodir_website" => 'http://example.com/',
618
-            "geodir_twitter" => 'http://example.com/',
619
-            "geodir_facebook" => 'http://example.com/',
620
-            "geodir_price" => '260000',
621
-            "geodir_property_status" => 'Under Offer',
622
-            'geodir_property_furnishing' => 'Unfurnished',
623
-            'geodir_property_type' => 'Detached house',
624
-            'geodir_property_bedrooms' => '6',
625
-            'geodir_property_bathrooms' => '6',
626
-            'geodir_property_area' => '1650',
627
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Triple Glazing,Off Road Parking,Fireplace',
628
-            "post_dummy" => '1'
629
-        );
630
-
631
-        break;
632
-
633
-
634
-    case 4:
635
-        $image_array = array();
636
-        $post_meta = array();
637
-        $image_array[] = "$dummy_image_url/ps/psf4.jpg";
638
-        $image_array[] = "$dummy_image_url/ps/psl4.jpg";
639
-        $image_array[] = "$dummy_image_url/ps/psb4.jpg";
640
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
641
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
642
-
643
-        $post_info[] = array(
644
-            "listing_type" => $post_type,
645
-            "post_title" => 'Jesmond Mansion',
646
-            "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.
610
+			"post_images" => $image_array,
611
+			"post_category" => array($post_type.'category' => array($category_array[1])),
612
+			"post_tags" => array('Tags', 'Sample Tags'),
613
+			"geodir_video" => '',
614
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
615
+			"geodir_contact" => '(222) 777-1111',
616
+			"geodir_email" => '[email protected]',
617
+			"geodir_website" => 'http://example.com/',
618
+			"geodir_twitter" => 'http://example.com/',
619
+			"geodir_facebook" => 'http://example.com/',
620
+			"geodir_price" => '260000',
621
+			"geodir_property_status" => 'Under Offer',
622
+			'geodir_property_furnishing' => 'Unfurnished',
623
+			'geodir_property_type' => 'Detached house',
624
+			'geodir_property_bedrooms' => '6',
625
+			'geodir_property_bathrooms' => '6',
626
+			'geodir_property_area' => '1650',
627
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Triple Glazing,Off Road Parking,Fireplace',
628
+			"post_dummy" => '1'
629
+		);
630
+
631
+		break;
632
+
633
+
634
+	case 4:
635
+		$image_array = array();
636
+		$post_meta = array();
637
+		$image_array[] = "$dummy_image_url/ps/psf4.jpg";
638
+		$image_array[] = "$dummy_image_url/ps/psl4.jpg";
639
+		$image_array[] = "$dummy_image_url/ps/psb4.jpg";
640
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
641
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
642
+
643
+		$post_info[] = array(
644
+			"listing_type" => $post_type,
645
+			"post_title" => 'Jesmond Mansion',
646
+			"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.
647 647
 
648 648
 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.
649 649
 
@@ -653,42 +653,42 @@  discard block
 block discarded – undo
653 653
 
654 654
 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.',
655 655
 
656
-            "post_images" => $image_array,
657
-            "post_category" => array($post_type.'category' => array($category_array[1])),
658
-            "post_tags" => array('Tags', 'Sample Tags'),
659
-            "geodir_video" => '',
660
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
661
-            "geodir_contact" => '(222) 777-1111',
662
-            "geodir_email" => '[email protected]',
663
-            "geodir_website" => 'http://example.com/',
664
-            "geodir_twitter" => 'http://example.com/',
665
-            "geodir_facebook" => 'http://example.com/',
666
-            "geodir_price" => '2300000',
667
-            "geodir_property_status" => 'Under Offer',
668
-            'geodir_property_furnishing' => 'Partially furnished',
669
-            'geodir_property_type' => 'Detached house',
670
-            'geodir_property_bedrooms' => '10',
671
-            'geodir_property_bathrooms' => '7',
672
-            'geodir_property_area' => '6600',
673
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden,Garage,Private driveway,Fireplace',
674
-            "post_dummy" => '1'
675
-        );
676
-
677
-        break;
678
-
679
-    case 5:
680
-        $image_array = array();
681
-        $post_meta = array();
682
-        $image_array[] = "$dummy_image_url/ps/psf5.jpg";
683
-        $image_array[] = "$dummy_image_url/ps/psl5.jpg";
684
-        $image_array[] = "$dummy_image_url/ps/psb5.jpg";
685
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
686
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
687
-
688
-        $post_info[] = array(
689
-            "listing_type" => $post_type,
690
-            "post_title" => 'Springfield Lodge',
691
-            "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.
656
+			"post_images" => $image_array,
657
+			"post_category" => array($post_type.'category' => array($category_array[1])),
658
+			"post_tags" => array('Tags', 'Sample Tags'),
659
+			"geodir_video" => '',
660
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
661
+			"geodir_contact" => '(222) 777-1111',
662
+			"geodir_email" => '[email protected]',
663
+			"geodir_website" => 'http://example.com/',
664
+			"geodir_twitter" => 'http://example.com/',
665
+			"geodir_facebook" => 'http://example.com/',
666
+			"geodir_price" => '2300000',
667
+			"geodir_property_status" => 'Under Offer',
668
+			'geodir_property_furnishing' => 'Partially furnished',
669
+			'geodir_property_type' => 'Detached house',
670
+			'geodir_property_bedrooms' => '10',
671
+			'geodir_property_bathrooms' => '7',
672
+			'geodir_property_area' => '6600',
673
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden,Garage,Private driveway,Fireplace',
674
+			"post_dummy" => '1'
675
+		);
676
+
677
+		break;
678
+
679
+	case 5:
680
+		$image_array = array();
681
+		$post_meta = array();
682
+		$image_array[] = "$dummy_image_url/ps/psf5.jpg";
683
+		$image_array[] = "$dummy_image_url/ps/psl5.jpg";
684
+		$image_array[] = "$dummy_image_url/ps/psb5.jpg";
685
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
686
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
687
+
688
+		$post_info[] = array(
689
+			"listing_type" => $post_type,
690
+			"post_title" => 'Springfield Lodge',
691
+			"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.
692 692
 
693 693
 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.
694 694
 
@@ -698,42 +698,42 @@  discard block
 block discarded – undo
698 698
 
699 699
 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.',
700 700
 
701
-            "post_images" => $image_array,
702
-            "post_category" => array($post_type.'category' => array($category_array[1])),
703
-            "post_tags" => array('Tags', 'Sample Tags'),
704
-            "geodir_video" => '',
705
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
706
-            "geodir_contact" => '(222) 777-1111',
707
-            "geodir_email" => '[email protected]',
708
-            "geodir_website" => 'http://example.com/',
709
-            "geodir_twitter" => 'http://example.com/',
710
-            "geodir_facebook" => 'http://example.com/',
711
-            "geodir_price" => '330000',
712
-            "geodir_property_status" => 'For Sale',
713
-            'geodir_property_furnishing' => 'Optional',
714
-            'geodir_property_type' => 'Detached house',
715
-            'geodir_property_bedrooms' => '4',
716
-            'geodir_property_bathrooms' => '3',
717
-            'geodir_property_area' => '3700',
718
-            'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden',
719
-            "post_dummy" => '1'
720
-        );
721
-
722
-        break;
723
-
724
-    case 6:
725
-        $image_array = array();
726
-        $post_meta = array();
727
-        $image_array[] = "$dummy_image_url/ps/psf6.jpg";
728
-        $image_array[] = "$dummy_image_url/ps/psl6.jpg";
729
-        $image_array[] = "$dummy_image_url/ps/psb5.jpg";
730
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
731
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
732
-
733
-        $post_info[] = array(
734
-            "listing_type" => $post_type,
735
-            "post_title" => 'Forrest Park',
736
-            "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.
701
+			"post_images" => $image_array,
702
+			"post_category" => array($post_type.'category' => array($category_array[1])),
703
+			"post_tags" => array('Tags', 'Sample Tags'),
704
+			"geodir_video" => '',
705
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
706
+			"geodir_contact" => '(222) 777-1111',
707
+			"geodir_email" => '[email protected]',
708
+			"geodir_website" => 'http://example.com/',
709
+			"geodir_twitter" => 'http://example.com/',
710
+			"geodir_facebook" => 'http://example.com/',
711
+			"geodir_price" => '330000',
712
+			"geodir_property_status" => 'For Sale',
713
+			'geodir_property_furnishing' => 'Optional',
714
+			'geodir_property_type' => 'Detached house',
715
+			'geodir_property_bedrooms' => '4',
716
+			'geodir_property_bathrooms' => '3',
717
+			'geodir_property_area' => '3700',
718
+			'geodir_property_features' => 'Select Features/,Oil Central Heating,Double Glazing,Front Garden',
719
+			"post_dummy" => '1'
720
+		);
721
+
722
+		break;
723
+
724
+	case 6:
725
+		$image_array = array();
726
+		$post_meta = array();
727
+		$image_array[] = "$dummy_image_url/ps/psf6.jpg";
728
+		$image_array[] = "$dummy_image_url/ps/psl6.jpg";
729
+		$image_array[] = "$dummy_image_url/ps/psb5.jpg";
730
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
731
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
732
+
733
+		$post_info[] = array(
734
+			"listing_type" => $post_type,
735
+			"post_title" => 'Forrest Park',
736
+			"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.
737 737
 
738 738
 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.
739 739
 
@@ -743,42 +743,42 @@  discard block
 block discarded – undo
743 743
 
744 744
 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.',
745 745
 
746
-            "post_images" => $image_array,
747
-            "post_category" => array($post_type.'category' => array($category_array[1])),
748
-            "post_tags" => array('Tags', 'Sample Tags'),
749
-            "geodir_video" => '',
750
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
751
-            "geodir_contact" => '(222) 777-1111',
752
-            "geodir_email" => '[email protected]',
753
-            "geodir_website" => 'http://example.com/',
754
-            "geodir_twitter" => 'http://example.com/',
755
-            "geodir_facebook" => 'http://example.com/',
756
-            "geodir_price" => '530000',
757
-            "geodir_property_status" => 'For Sale',
758
-            'geodir_property_furnishing' => 'Unfurnished',
759
-            'geodir_property_type' => 'Detached house',
760
-            'geodir_property_bedrooms' => '5',
761
-            'geodir_property_bathrooms' => '4',
762
-            'geodir_property_area' => '2250',
763
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Front Garden,Private driveway',
764
-            "post_dummy" => '1'
765
-        );
766
-
767
-        break;
768
-
769
-    case 7:
770
-        $image_array = array();
771
-        $post_meta = array();
772
-        $image_array[] = "$dummy_image_url/ps/psf7.jpg";
773
-        $image_array[] = "$dummy_image_url/ps/psl4.jpg";
774
-        $image_array[] = "$dummy_image_url/ps/psb4.jpg";
775
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
776
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
777
-
778
-        $post_info[] = array(
779
-            "listing_type" => $post_type,
780
-            "post_title" => 'Fraser Suites',
781
-            "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.
746
+			"post_images" => $image_array,
747
+			"post_category" => array($post_type.'category' => array($category_array[1])),
748
+			"post_tags" => array('Tags', 'Sample Tags'),
749
+			"geodir_video" => '',
750
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
751
+			"geodir_contact" => '(222) 777-1111',
752
+			"geodir_email" => '[email protected]',
753
+			"geodir_website" => 'http://example.com/',
754
+			"geodir_twitter" => 'http://example.com/',
755
+			"geodir_facebook" => 'http://example.com/',
756
+			"geodir_price" => '530000',
757
+			"geodir_property_status" => 'For Sale',
758
+			'geodir_property_furnishing' => 'Unfurnished',
759
+			'geodir_property_type' => 'Detached house',
760
+			'geodir_property_bedrooms' => '5',
761
+			'geodir_property_bathrooms' => '4',
762
+			'geodir_property_area' => '2250',
763
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Front Garden,Private driveway',
764
+			"post_dummy" => '1'
765
+		);
766
+
767
+		break;
768
+
769
+	case 7:
770
+		$image_array = array();
771
+		$post_meta = array();
772
+		$image_array[] = "$dummy_image_url/ps/psf7.jpg";
773
+		$image_array[] = "$dummy_image_url/ps/psl4.jpg";
774
+		$image_array[] = "$dummy_image_url/ps/psb4.jpg";
775
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
776
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
777
+
778
+		$post_info[] = array(
779
+			"listing_type" => $post_type,
780
+			"post_title" => 'Fraser Suites',
781
+			"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.
782 782
 
783 783
 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.
784 784
 
@@ -788,42 +788,42 @@  discard block
 block discarded – undo
788 788
 
789 789
 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.',
790 790
 
791
-            "post_images" => $image_array,
792
-            "post_category" => array($post_type.'category' => array($category_array[0])),
793
-            "post_tags" => array('Tags', 'Sample Tags'),
794
-            "geodir_video" => '',
795
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
796
-            "geodir_contact" => '(222) 777-1111',
797
-            "geodir_email" => '[email protected]',
798
-            "geodir_website" => 'http://example.com/',
799
-            "geodir_twitter" => 'http://example.com/',
800
-            "geodir_facebook" => 'http://example.com/',
801
-            "geodir_price" => '245000',
802
-            "geodir_property_status" => 'For Sale',
803
-            'geodir_property_furnishing' => 'Unfurnished',
804
-            'geodir_property_type' => 'Apartment',
805
-            'geodir_property_bedrooms' => '3',
806
-            'geodir_property_bathrooms' => '2',
807
-            'geodir_property_area' => '1250',
808
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing',
809
-            "post_dummy" => '1'
810
-        );
811
-
812
-        break;
813
-
814
-    case 8:
815
-        $image_array = array();
816
-        $post_meta = array();
817
-        $image_array[] = "$dummy_image_url/ps/psf8.jpg";
818
-        $image_array[] = "$dummy_image_url/ps/psl2.jpg";
819
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
820
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
821
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
822
-
823
-        $post_info[] = array(
824
-            "listing_type" => $post_type,
825
-            "post_title" => 'Richmore Apartments',
826
-            "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.
791
+			"post_images" => $image_array,
792
+			"post_category" => array($post_type.'category' => array($category_array[0])),
793
+			"post_tags" => array('Tags', 'Sample Tags'),
794
+			"geodir_video" => '',
795
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
796
+			"geodir_contact" => '(222) 777-1111',
797
+			"geodir_email" => '[email protected]',
798
+			"geodir_website" => 'http://example.com/',
799
+			"geodir_twitter" => 'http://example.com/',
800
+			"geodir_facebook" => 'http://example.com/',
801
+			"geodir_price" => '245000',
802
+			"geodir_property_status" => 'For Sale',
803
+			'geodir_property_furnishing' => 'Unfurnished',
804
+			'geodir_property_type' => 'Apartment',
805
+			'geodir_property_bedrooms' => '3',
806
+			'geodir_property_bathrooms' => '2',
807
+			'geodir_property_area' => '1250',
808
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing',
809
+			"post_dummy" => '1'
810
+		);
811
+
812
+		break;
813
+
814
+	case 8:
815
+		$image_array = array();
816
+		$post_meta = array();
817
+		$image_array[] = "$dummy_image_url/ps/psf8.jpg";
818
+		$image_array[] = "$dummy_image_url/ps/psl2.jpg";
819
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
820
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
821
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
822
+
823
+		$post_info[] = array(
824
+			"listing_type" => $post_type,
825
+			"post_title" => 'Richmore Apartments',
826
+			"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.
827 827
 
828 828
 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.
829 829
 
@@ -833,43 +833,43 @@  discard block
 block discarded – undo
833 833
 
834 834
 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.',
835 835
 
836
-            "post_images" => $image_array,
837
-            "post_category" => array($post_type.'category' => array($category_array[0])),
838
-            "post_tags" => array('Tags', 'Sample Tags'),
839
-            "geodir_video" => '',
840
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
841
-            "geodir_contact" => '(222) 777-1111',
842
-            "geodir_email" => '[email protected]',
843
-            "geodir_website" => 'http://example.com/',
844
-            "geodir_twitter" => 'http://example.com/',
845
-            "geodir_facebook" => 'http://example.com/',
846
-            "geodir_price" => '395000',
847
-            "geodir_property_status" => 'For Sale',
848
-            'geodir_property_furnishing' => 'Unfurnished',
849
-            'geodir_property_type' => 'Apartment',
850
-            'geodir_property_bedrooms' => '2',
851
-            'geodir_property_bathrooms' => '2',
852
-            'geodir_property_area' => '1750',
853
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
854
-            "post_dummy" => '1'
855
-        );
856
-
857
-        break;
858
-
859
-
860
-    case 9:
861
-        $image_array = array();
862
-        $post_meta = array();
863
-        $image_array[] = "$dummy_image_url/ps/psf9.jpg";
864
-        $image_array[] = "$dummy_image_url/ps/psc9.jpg";
865
-        $image_array[] = "$dummy_image_url/ps/psb2.jpg";
866
-        $image_array[] = "$dummy_image_url/ps/psk.jpg";
867
-        $image_array[] = "$dummy_image_url/ps/psbr.jpg";
868
-
869
-        $post_info[] = array(
870
-            "listing_type" => $post_type,
871
-            "post_title" => 'Hotel Alpina',
872
-            "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.
836
+			"post_images" => $image_array,
837
+			"post_category" => array($post_type.'category' => array($category_array[0])),
838
+			"post_tags" => array('Tags', 'Sample Tags'),
839
+			"geodir_video" => '',
840
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
841
+			"geodir_contact" => '(222) 777-1111',
842
+			"geodir_email" => '[email protected]',
843
+			"geodir_website" => 'http://example.com/',
844
+			"geodir_twitter" => 'http://example.com/',
845
+			"geodir_facebook" => 'http://example.com/',
846
+			"geodir_price" => '395000',
847
+			"geodir_property_status" => 'For Sale',
848
+			'geodir_property_furnishing' => 'Unfurnished',
849
+			'geodir_property_type' => 'Apartment',
850
+			'geodir_property_bedrooms' => '2',
851
+			'geodir_property_bathrooms' => '2',
852
+			'geodir_property_area' => '1750',
853
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
854
+			"post_dummy" => '1'
855
+		);
856
+
857
+		break;
858
+
859
+
860
+	case 9:
861
+		$image_array = array();
862
+		$post_meta = array();
863
+		$image_array[] = "$dummy_image_url/ps/psf9.jpg";
864
+		$image_array[] = "$dummy_image_url/ps/psc9.jpg";
865
+		$image_array[] = "$dummy_image_url/ps/psb2.jpg";
866
+		$image_array[] = "$dummy_image_url/ps/psk.jpg";
867
+		$image_array[] = "$dummy_image_url/ps/psbr.jpg";
868
+
869
+		$post_info[] = array(
870
+			"listing_type" => $post_type,
871
+			"post_title" => 'Hotel Alpina',
872
+			"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.
873 873
 
874 874
 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.
875 875
 
@@ -879,39 +879,39 @@  discard block
 block discarded – undo
879 879
 
880 880
 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.',
881 881
 
882
-            "post_images" => $image_array,
883
-            "post_category" => array($post_type.'category' => array($category_array[2])),
884
-            "post_tags" => array('Tags', 'Sample Tags'),
885
-            "geodir_video" => '',
886
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
887
-            "geodir_contact" => '(222) 777-1111',
888
-            "geodir_email" => '[email protected]',
889
-            "geodir_website" => 'http://example.com/',
890
-            "geodir_twitter" => 'http://example.com/',
891
-            "geodir_facebook" => 'http://example.com/',
892
-            "geodir_price" => '12500000',
893
-            "geodir_property_status" => 'For Sale',
894
-            'geodir_property_furnishing' => 'Furnished',
895
-            'geodir_property_type' => 'Hotel',
896
-            'geodir_property_bedrooms' => '120',
897
-            'geodir_property_bathrooms' => '133',
898
-            'geodir_property_area' => '35000',
899
-            'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
900
-            "post_dummy" => '1'
901
-        );
902
-
903
-        break;
904
-
905
-    case 10:
906
-        $image_array = array();
907
-        $post_meta = array();
908
-        $image_array[] = "$dummy_image_url/ps/psf10.jpg";
909
-        $image_array[] = "$dummy_image_url/ps/psf102.jpg";
910
-
911
-        $post_info[] = array(
912
-            "listing_type" => $post_type,
913
-            "post_title" => 'Development Land',
914
-            "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.
882
+			"post_images" => $image_array,
883
+			"post_category" => array($post_type.'category' => array($category_array[2])),
884
+			"post_tags" => array('Tags', 'Sample Tags'),
885
+			"geodir_video" => '',
886
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
887
+			"geodir_contact" => '(222) 777-1111',
888
+			"geodir_email" => '[email protected]',
889
+			"geodir_website" => 'http://example.com/',
890
+			"geodir_twitter" => 'http://example.com/',
891
+			"geodir_facebook" => 'http://example.com/',
892
+			"geodir_price" => '12500000',
893
+			"geodir_property_status" => 'For Sale',
894
+			'geodir_property_furnishing' => 'Furnished',
895
+			'geodir_property_type' => 'Hotel',
896
+			'geodir_property_bedrooms' => '120',
897
+			'geodir_property_bathrooms' => '133',
898
+			'geodir_property_area' => '35000',
899
+			'geodir_property_features' => 'Select Features/,Gas Central Heating,Double Glazing,Garage',
900
+			"post_dummy" => '1'
901
+		);
902
+
903
+		break;
904
+
905
+	case 10:
906
+		$image_array = array();
907
+		$post_meta = array();
908
+		$image_array[] = "$dummy_image_url/ps/psf10.jpg";
909
+		$image_array[] = "$dummy_image_url/ps/psf102.jpg";
910
+
911
+		$post_info[] = array(
912
+			"listing_type" => $post_type,
913
+			"post_title" => 'Development Land',
914
+			"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.
915 915
 
916 916
 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.
917 917
 
@@ -921,93 +921,93 @@  discard block
 block discarded – undo
921 921
 
922 922
 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.',
923 923
 
924
-            "post_images" => $image_array,
925
-            "post_category" => array($post_type.'category' => array($category_array[3])),
926
-            "post_tags" => array('Tags', 'Sample Tags'),
927
-            "geodir_video" => '',
928
-            "geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
929
-            "geodir_contact" => '(222) 777-1111',
930
-            "geodir_email" => '[email protected]',
931
-            "geodir_website" => 'http://example.com/',
932
-            "geodir_twitter" => 'http://example.com/',
933
-            "geodir_facebook" => 'http://example.com/',
934
-            "geodir_price" => '80000',
935
-            "geodir_property_status" => 'For Sale',
936
-            'geodir_property_furnishing' => '',
937
-            'geodir_property_type' => 'Land',
938
-            'geodir_property_bedrooms' => '',
939
-            'geodir_property_bathrooms' => '',
940
-            'geodir_property_area' => '250000',
941
-            'geodir_property_features' => '',
942
-            "post_dummy" => '1'
943
-        );
944
-
945
-        break;
924
+			"post_images" => $image_array,
925
+			"post_category" => array($post_type.'category' => array($category_array[3])),
926
+			"post_tags" => array('Tags', 'Sample Tags'),
927
+			"geodir_video" => '',
928
+			"geodir_timing" => 'Viewing Sunday 10 am to 9 pm',
929
+			"geodir_contact" => '(222) 777-1111',
930
+			"geodir_email" => '[email protected]',
931
+			"geodir_website" => 'http://example.com/',
932
+			"geodir_twitter" => 'http://example.com/',
933
+			"geodir_facebook" => 'http://example.com/',
934
+			"geodir_price" => '80000',
935
+			"geodir_property_status" => 'For Sale',
936
+			'geodir_property_furnishing' => '',
937
+			'geodir_property_type' => 'Land',
938
+			'geodir_property_bedrooms' => '',
939
+			'geodir_property_bathrooms' => '',
940
+			'geodir_property_area' => '250000',
941
+			'geodir_property_features' => '',
942
+			"post_dummy" => '1'
943
+		);
944
+
945
+		break;
946 946
 
947 947
 } // end of switch
948 948
 
949 949
 foreach ($post_info as $post_info) {
950
-    $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));
950
+	$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));
955 955
 
956 956
 
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));
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));
961 961
 
962
-    $load_map = get_option('geodir_load_map');
962
+	$load_map = get_option('geodir_load_map');
963 963
     
964
-    if ($load_map == 'osm') {
965
-        $post_address = geodir_get_osm_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
966
-    } else {
967
-        $post_address = geodir_get_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
968
-    }
969
-
970
-    $postal_code = '';
971
-    if (!empty($post_address)) {
972
-        if ($load_map == 'osm') {
973
-            $address = !empty($post_address->formatted_address) ? $post_address->formatted_address : '';
974
-            $postal_code = !empty($post_address->address->postcode) ? $post_address->address->postcode : '';
975
-        } else {
976
-            $addresses = array();
977
-            $addresses_default = array();
964
+	if ($load_map == 'osm') {
965
+		$post_address = geodir_get_osm_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
966
+	} else {
967
+		$post_address = geodir_get_address_by_lat_lan($dummy_post_latitude, $dummy_post_longitude);
968
+	}
969
+
970
+	$postal_code = '';
971
+	if (!empty($post_address)) {
972
+		if ($load_map == 'osm') {
973
+			$address = !empty($post_address->formatted_address) ? $post_address->formatted_address : '';
974
+			$postal_code = !empty($post_address->address->postcode) ? $post_address->address->postcode : '';
975
+		} else {
976
+			$addresses = array();
977
+			$addresses_default = array();
978 978
             
979
-            foreach ($post_address as $add_key => $add_value) {
980
-                if ($add_key < 2 && !empty($add_value->long_name)) {
981
-                    $addresses_default[] = $add_value->long_name;
982
-                }
983
-                if ($add_value->types[0] == 'postal_code') {
984
-                    $postal_code = $add_value->long_name;
985
-                }
986
-                if ($add_value->types[0] == 'street_number') {
987
-                    $addresses[] = $add_value->long_name;
988
-                }
989
-                if ($add_value->types[0] == 'route') {
990
-                    $addresses[] = $add_value->long_name;
991
-                }
992
-                if ($add_value->types[0] == 'neighborhood') {
993
-                    $addresses[] = $add_value->long_name;
994
-                }
995
-                if ($add_value->types[0] == 'sublocality') {
996
-                    $addresses[] = $add_value->long_name;
997
-                }
998
-            }
999
-            $address = !empty($addresses) ? implode(', ', $addresses) : (!empty($addresses_default) ? implode(', ', $addresses_default) : '');
1000
-        }
1001
-
1002
-        $post_info['post_address'] = !empty($address) ? $address : $default_location->city;
1003
-        $post_info['post_city'] = $default_location->city;
1004
-        $post_info['post_region'] = $default_location->region;
1005
-        $post_info['post_country'] = $default_location->country;
1006
-        $post_info['post_zip'] = $postal_code;
1007
-        $post_info['post_latitude'] = $dummy_post_latitude;
1008
-        $post_info['post_longitude'] = $dummy_post_longitude;
1009
-    }
979
+			foreach ($post_address as $add_key => $add_value) {
980
+				if ($add_key < 2 && !empty($add_value->long_name)) {
981
+					$addresses_default[] = $add_value->long_name;
982
+				}
983
+				if ($add_value->types[0] == 'postal_code') {
984
+					$postal_code = $add_value->long_name;
985
+				}
986
+				if ($add_value->types[0] == 'street_number') {
987
+					$addresses[] = $add_value->long_name;
988
+				}
989
+				if ($add_value->types[0] == 'route') {
990
+					$addresses[] = $add_value->long_name;
991
+				}
992
+				if ($add_value->types[0] == 'neighborhood') {
993
+					$addresses[] = $add_value->long_name;
994
+				}
995
+				if ($add_value->types[0] == 'sublocality') {
996
+					$addresses[] = $add_value->long_name;
997
+				}
998
+			}
999
+			$address = !empty($addresses) ? implode(', ', $addresses) : (!empty($addresses_default) ? implode(', ', $addresses_default) : '');
1000
+		}
1001
+
1002
+		$post_info['post_address'] = !empty($address) ? $address : $default_location->city;
1003
+		$post_info['post_city'] = $default_location->city;
1004
+		$post_info['post_region'] = $default_location->region;
1005
+		$post_info['post_country'] = $default_location->country;
1006
+		$post_info['post_zip'] = $postal_code;
1007
+		$post_info['post_latitude'] = $dummy_post_latitude;
1008
+		$post_info['post_longitude'] = $dummy_post_longitude;
1009
+	}
1010 1010
     
1011
-    geodir_save_listing($post_info, true);
1012
-    echo 1;
1011
+	geodir_save_listing($post_info, true);
1012
+	echo 1;
1013 1013
 }
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_sale_custom_fields($post_type='gd_place',$package_id=''){
9
+function geodir_property_sale_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_sale_custom_fields_sort($post_type='gd_place') {
218
+function geodir_property_sale_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
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
 }
280 280
 
281
-function geodir_property_sale_custom_fields_advanced_search($post_type='gd_place') {
281
+function geodir_property_sale_custom_fields_advanced_search($post_type = 'gd_place') {
282 282
 
283 283
 
284 284
     $fields = array();
@@ -456,15 +456,15 @@  discard block
 block discarded – undo
456 456
     return $fields;
457 457
 }
458 458
 
459
-global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2,$wpdb, $current_user,$dummy_post_index;
459
+global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2, $wpdb, $current_user, $dummy_post_index;
460 460
 $post_info = array();
461 461
 $image_array = array();
462 462
 $post_meta = array();
463 463
 $category_array = array('Apartments', 'Houses', 'Commercial', 'Land');
464 464
 
465
-if($dummy_post_index==1){
465
+if ($dummy_post_index == 1) {
466 466
     // add the dummy categories
467
-    geodir_dummy_data_taxonomies($post_type,$category_array );
467
+    geodir_dummy_data_taxonomies($post_type, $category_array);
468 468
 
469 469
     // add the dummy custom fields
470 470
     $fields = geodir_property_sale_custom_fields($post_type);
@@ -472,24 +472,24 @@  discard block
 block discarded – undo
472 472
 
473 473
     // add sort order items
474 474
     $sort_fields = geodir_property_sale_custom_fields_sort($post_type);
475
-    foreach($sort_fields as $sort){
475
+    foreach ($sort_fields as $sort) {
476 476
         geodir_custom_sort_field_save($sort);
477 477
     }
478 478
 
479 479
     // update the type currently installed
480
-    update_option($post_type.'_dummy_data_type','property_sale');
480
+    update_option($post_type.'_dummy_data_type', 'property_sale');
481 481
 
482 482
     // add the advanced search fields
483
-    if (defined('GEODIRADVANCESEARCH_VERSION')){
483
+    if (defined('GEODIRADVANCESEARCH_VERSION')) {
484 484
         $search_fields = geodir_property_sale_custom_fields_advanced_search($post_type);
485
-        foreach($search_fields as $sfield){
486
-            geodir_custom_advance_search_field_save( $sfield );
485
+        foreach ($search_fields as $sfield) {
486
+            geodir_custom_advance_search_field_save($sfield);
487 487
         }
488 488
     }
489 489
 }
490 490
 
491 491
 if (geodir_dummy_folder_exists())
492
-    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
492
+    $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy";
493 493
 else
494 494
     $dummy_image_url = 'https://www.wpgeodirectory.com/dummy';
495 495
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -487,10 +487,11 @@  discard block
 block discarded – undo
487 487
     }
488 488
 }
489 489
 
490
-if (geodir_dummy_folder_exists())
490
+if (geodir_dummy_folder_exists()) {
491 491
     $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy";
492
-else
492
+} else {
493 493
     $dummy_image_url = 'https://www.wpgeodirectory.com/dummy';
494
+}
494 495
 
495 496
 $dummy_image_url = apply_filters('place_dummy_image_url', $dummy_image_url);
496 497
 
@@ -947,16 +948,18 @@  discard block
 block discarded – undo
947 948
 
948 949
 foreach ($post_info as $post_info) {
949 950
     $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));
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));
955
+    }
954 956
 
955 957
 
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));
958
+    if ($city_bound_lng1 > $city_bound_lng2) {
959
+            $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1));
960
+    } else {
961
+            $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2));
962
+    }
960 963
 
961 964
     $load_map = get_option('geodir_load_map');
962 965
     
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 4 patches
Braces   +88 added lines, -71 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
 
@@ -420,8 +421,9 @@  discard block
 block discarded – undo
420 421
      */
421 422
     do_action('geodir_after_social_sharing_buttons');
422 423
     $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
424
+    if (trim($content_html) != '') {
425
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+    }
425 427
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426 428
         /**
427 429
          * Filter the geodir_social_sharing_buttons() function content.
@@ -477,8 +479,9 @@  discard block
 block discarded – undo
477 479
      */
478 480
     do_action('geodir_after_edit_post_link');
479 481
     $content_html = ob_get_clean();
480
-    if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
+    if (trim($content_html) != '') {
483
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
484
+    }
482 485
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
483 486
         /**
484 487
          * Filter the geodir_edit_post_link() function content.
@@ -1052,8 +1055,9 @@  discard block
 block discarded – undo
1052 1055
      */
1053 1056
     do_action('geodir_after_google_analytics');
1054 1057
     $content_html = ob_get_clean();
1055
-    if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1058
+    if (trim($content_html) != '') {
1059
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1060
+    }
1057 1061
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058 1062
         /**
1059 1063
          * Filter the geodir_edit_post_link() function content.
@@ -1190,8 +1194,9 @@  discard block
 block discarded – undo
1190 1194
     do_action('geodir_after_detail_page_more_info');
1191 1195
 
1192 1196
     $content_html = ob_get_clean();
1193
-    if (trim($content_html) != '')
1194
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1197
+    if (trim($content_html) != '') {
1198
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1199
+    }
1195 1200
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1196 1201
         /**
1197 1202
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1311,8 +1316,9 @@  discard block
 block discarded – undo
1311 1316
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1312 1317
 
1313 1318
     foreach ($arr_alert_msg as $key => $value) {
1314
-        if (!is_scalar($value))
1315
-            continue;
1319
+        if (!is_scalar($value)) {
1320
+                    continue;
1321
+        }
1316 1322
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1317 1323
     }
1318 1324
 
@@ -1368,17 +1374,19 @@  discard block
 block discarded – undo
1368 1374
     global $geodir_sidebars;
1369 1375
     global $sidebars_widgets;
1370 1376
 
1371
-    if (!is_array($sidebars_widgets))
1372
-        $sidebars_widgets = wp_get_sidebars_widgets();
1377
+    if (!is_array($sidebars_widgets)) {
1378
+            $sidebars_widgets = wp_get_sidebars_widgets();
1379
+    }
1373 1380
     $geodir_old_sidebars = array();
1374 1381
 
1375 1382
     if (is_array($geodir_sidebars)) {
1376 1383
         foreach ($geodir_sidebars as $val) {
1377 1384
             if (is_array($sidebars_widgets)) {
1378
-                if (array_key_exists($val, $sidebars_widgets))
1379
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1380
-                else
1381
-                    $geodir_old_sidebars[$val] = array();
1385
+                if (array_key_exists($val, $sidebars_widgets)) {
1386
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1387
+                } else {
1388
+                                    $geodir_old_sidebars[$val] = array();
1389
+                }
1382 1390
             }
1383 1391
         }
1384 1392
     }
@@ -1399,16 +1407,19 @@  discard block
 block discarded – undo
1399 1407
 {
1400 1408
     global $sidebars_widgets;
1401 1409
 
1402
-    if (!is_array($sidebars_widgets))
1403
-        $sidebars_widgets = wp_get_sidebars_widgets();
1410
+    if (!is_array($sidebars_widgets)) {
1411
+            $sidebars_widgets = wp_get_sidebars_widgets();
1412
+    }
1404 1413
 
1405 1414
     if (is_array($sidebars_widgets)) {
1406 1415
         $geodir_old_sidebars = get_option('geodir_sidebars');
1407 1416
         if (is_array($geodir_old_sidebars)) {
1408 1417
             foreach ($geodir_old_sidebars as $key => $val) {
1409
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1418
+                if(0 === strpos($key, 'geodir_')) {
1419
+                	// if gd widget
1410 1420
                 {
1411
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1421
+                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1422
+                }
1412 1423
                 }
1413 1424
 
1414 1425
 
@@ -1544,20 +1555,25 @@  discard block
 block discarded – undo
1544 1555
         }
1545 1556
     }
1546 1557
     
1547
-    if ($tab == 'post_info')
1548
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1558
+    if ($tab == 'post_info') {
1559
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1560
+    }
1549 1561
     
1550
-    if ($tab == 'post_images')
1551
-        $is_display = (!empty($post_images)) ? true : false;
1562
+    if ($tab == 'post_images') {
1563
+            $is_display = (!empty($post_images)) ? true : false;
1564
+    }
1552 1565
 
1553
-    if ($tab == 'post_video')
1554
-        $is_display = (!empty($video)) ? true : false;
1566
+    if ($tab == 'post_video') {
1567
+            $is_display = (!empty($video)) ? true : false;
1568
+    }
1555 1569
 
1556
-    if ($tab == 'special_offers')
1557
-        $is_display = (!empty($special_offers)) ? true : false;
1570
+    if ($tab == 'special_offers') {
1571
+            $is_display = (!empty($special_offers)) ? true : false;
1572
+    }
1558 1573
 
1559
-    if ($tab == 'reviews')
1560
-        $is_display = (geodir_is_page('detail')) ? true : false;
1574
+    if ($tab == 'reviews') {
1575
+            $is_display = (geodir_is_page('detail')) ? true : false;
1576
+    }
1561 1577
 
1562 1578
     if ($tab == 'related_listing') {
1563 1579
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1791,11 +1807,13 @@  discard block
 block discarded – undo
1791 1807
     $region_slug = $default_location->region_slug;
1792 1808
     $city_slug = $default_location->city_slug;
1793 1809
 
1794
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1795
-        return $slug_exists = true;
1810
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1811
+            return $slug_exists = true;
1812
+    }
1796 1813
 
1797
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1798
-        return $slug_exists = true;
1814
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1815
+            return $slug_exists = true;
1816
+    }
1799 1817
 
1800 1818
     return $slug_exists;
1801 1819
 }
@@ -1837,40 +1855,31 @@  discard block
 block discarded – undo
1837 1855
     if(geodir_is_page('home')){
1838 1856
         $gd_page = 'home';
1839 1857
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1840
-    }
1841
-    elseif(geodir_is_page('detail')){
1858
+    } elseif(geodir_is_page('detail')){
1842 1859
         $gd_page = 'detail';
1843 1860
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1844
-    }
1845
-    elseif(geodir_is_page('pt')){
1861
+    } elseif(geodir_is_page('pt')){
1846 1862
         $gd_page = 'pt';
1847 1863
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1848
-    }
1849
-    elseif(geodir_is_page('listing')){
1864
+    } elseif(geodir_is_page('listing')){
1850 1865
         $gd_page = 'listing';
1851 1866
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1852
-    }
1853
-    elseif(geodir_is_page('location')){
1867
+    } elseif(geodir_is_page('location')){
1854 1868
         $gd_page = 'location';
1855 1869
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1856
-    }
1857
-    elseif(geodir_is_page('search')){
1870
+    } elseif(geodir_is_page('search')){
1858 1871
         $gd_page = 'search';
1859 1872
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1860
-    }
1861
-    elseif(geodir_is_page('add-listing')){
1873
+    } elseif(geodir_is_page('add-listing')){
1862 1874
         $gd_page = 'add-listing';
1863 1875
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1864
-    }
1865
-    elseif(geodir_is_page('author')){
1876
+    } elseif(geodir_is_page('author')){
1866 1877
         $gd_page = 'author';
1867 1878
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1868
-    }
1869
-    elseif(geodir_is_page('login')){
1879
+    } elseif(geodir_is_page('login')){
1870 1880
         $gd_page = 'login';
1871 1881
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('listing-success')){
1882
+    } elseif(geodir_is_page('listing-success')){
1874 1883
         $gd_page = 'listing-success';
1875 1884
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1876 1885
     }
@@ -1948,11 +1957,13 @@  discard block
 block discarded – undo
1948 1957
 
1949 1958
     if (!get_option('geodir_remove_url_seperator')) {
1950 1959
 
1951
-        if (get_option('geodir_listingurl_separator'))
1952
-            delete_option('geodir_listingurl_separator');
1960
+        if (get_option('geodir_listingurl_separator')) {
1961
+                    delete_option('geodir_listingurl_separator');
1962
+        }
1953 1963
 
1954
-        if (get_option('geodir_detailurl_separator'))
1955
-            delete_option('geodir_detailurl_separator');
1964
+        if (get_option('geodir_detailurl_separator')) {
1965
+                    delete_option('geodir_detailurl_separator');
1966
+        }
1956 1967
 
1957 1968
         flush_rewrite_rules(false);
1958 1969
 
@@ -1976,8 +1987,9 @@  discard block
 block discarded – undo
1976 1987
 {
1977 1988
     foreach ($permalink_arr as $key => $value) {
1978 1989
 
1979
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1980
-            unset($permalink_arr[$key]);
1990
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
1991
+                    unset($permalink_arr[$key]);
1992
+        }
1981 1993
 
1982 1994
     }
1983 1995
 
@@ -2112,16 +2124,18 @@  discard block
 block discarded – undo
2112 2124
 
2113 2125
             $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)));
2114 2126
 
2115
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2116
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2127
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2128
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2129
+            }
2117 2130
         }
2118 2131
 
2119 2132
         if (array_key_exists('special_offers', $tabs_arr)) {
2120 2133
 
2121 2134
             $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)));
2122 2135
 
2123
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2124
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2136
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2137
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2138
+            }
2125 2139
         }
2126 2140
 
2127 2141
     }
@@ -2176,8 +2190,9 @@  discard block
 block discarded – undo
2176 2190
 
2177 2191
         $all_postypes = geodir_get_posttypes();
2178 2192
 
2179
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2180
-            return false;
2193
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2194
+                    return false;
2195
+        }
2181 2196
 
2182 2197
         $uploads = wp_upload_dir();
2183 2198
 
@@ -2251,8 +2266,9 @@  discard block
 block discarded – undo
2251 2266
                         $file_info = pathinfo($attach->file);
2252 2267
 
2253 2268
                         $sub_dir = '';
2254
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2255
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2269
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2270
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2271
+                        }
2256 2272
 
2257 2273
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2258 2274
                         $uploads_path = $uploads['basedir'];
@@ -2273,8 +2289,9 @@  discard block
 block discarded – undo
2273 2289
 
2274 2290
                     if (!empty($attachment_data)) {
2275 2291
 
2276
-                        if ($attachment_data->ID)
2277
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2292
+                        if ($attachment_data->ID) {
2293
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2294
+                        }
2278 2295
 
2279 2296
                     } else {
2280 2297
 
@@ -2470,7 +2487,7 @@  discard block
 block discarded – undo
2470 2487
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2471 2488
                         $variables_array['value'] = '';
2472 2489
                         $variables_array['value'] = $post->{$type['htmlvar_name']};
2473
-                    }else{
2490
+                    } else{
2474 2491
                         $i = 0;
2475 2492
                         $fieldset_count++;
2476 2493
                         $field_set_start = 1;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
  * @global object $wpdb WordPress Database object.
2172 2172
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2173 2173
  * @param int $attachment_id Attachment ID.
2174
- * @return bool|void Returns false on failure.
2174
+ * @return false|null Returns false on failure.
2175 2175
  */
2176 2176
 function geodirectory_before_featured_image_delete($attachment_id)
2177 2177
 {
@@ -2344,6 +2344,7 @@  discard block
 block discarded – undo
2344 2344
  * @global object $wpdb WordPress Database object.
2345 2345
  * @global object $current_user Current user object.
2346 2346
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2347
+ * @param string $user_id
2347 2348
  * @return array User listing count for each post type.
2348 2349
  */
2349 2350
 function geodir_user_post_listing_count($user_id=null)
@@ -2680,7 +2681,7 @@  discard block
 block discarded – undo
2680 2681
  * @since 1.6.16
2681 2682
  * @package GeoDirectory
2682 2683
  * @param array $classes The class array of the HTML element.
2683
- * @return array Modified class array.
2684
+ * @return string[] Modified class array.
2684 2685
  */
2685 2686
 function geodir_body_class_active_map($classes = array()) {
2686 2687
     $classes[] = 'gd-map-' . geodir_map_name();
Please login to merge, or discard this patch.
Indentation   +1087 added lines, -1087 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,31 +335,31 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
350
-                'geodir_detail_page_google_analytics',
351
-                'geodir_edit_post_link',
352
-                'geodir_detail_page_review_rating',
353
-                'geodir_detail_page_more_info'
354
-            ) // end of array 
355
-        ); // end of apply filter
356
-    if (!empty($arr_detail_page_sidebar_content)) {
357
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
358
-            if (function_exists($content_function)) {
359
-                add_action('geodir_detail_page_sidebar', $content_function);
360
-            }
361
-        }
362
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
350
+				'geodir_detail_page_google_analytics',
351
+				'geodir_edit_post_link',
352
+				'geodir_detail_page_review_rating',
353
+				'geodir_detail_page_more_info'
354
+			) // end of array 
355
+		); // end of apply filter
356
+	if (!empty($arr_detail_page_sidebar_content)) {
357
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
358
+			if (function_exists($content_function)) {
359
+				add_action('geodir_detail_page_sidebar', $content_function);
360
+			}
361
+		}
362
+	}
363 363
 }
364 364
 
365 365
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function geodir_add_to_favourite_link()
376 376
 {
377
-    global $post, $preview;
378
-    if (!$preview && geodir_is_page('detail')) {
379
-        ?>
377
+	global $post, $preview;
378
+	if (!$preview && geodir_is_page('detail')) {
379
+		?>
380 380
         <p class="edit_link">
381 381
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
382 382
         </p>
383 383
     <?php
384
-    }
384
+	}
385 385
 }
386 386
 
387 387
 /**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
  */
396 396
 function geodir_social_sharing_buttons()
397 397
 {
398
-    global $preview;
399
-    ob_start(); // Start  buffering;
400
-    /**
401
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
-     *
403
-     * @since 1.0.0
404
-     */
405
-    do_action('geodir_before_social_sharing_buttons');
406
-    if (!$preview) {
407
-        ?>
398
+	global $preview;
399
+	ob_start(); // Start  buffering;
400
+	/**
401
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
+	 *
403
+	 * @since 1.0.0
404
+	 */
405
+	do_action('geodir_before_social_sharing_buttons');
406
+	if (!$preview) {
407
+		?>
408 408
         <div class="likethis">
409 409
             <?php geodir_twitter_tweet_button(); ?>
410 410
             <?php geodir_fb_like_button(); ?>
411 411
             <?php geodir_google_plus_button(); ?>
412 412
         </div>
413 413
     <?php
414
-    }// end of if, if its a preview or not
415
-
416
-    /**
417
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
-     *
419
-     * @since 1.0.0
420
-     */
421
-    do_action('geodir_after_social_sharing_buttons');
422
-    $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
-        /**
427
-         * Filter the geodir_social_sharing_buttons() function content.
428
-         *
429
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
-         */
431
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
-    }
414
+	}// end of if, if its a preview or not
415
+
416
+	/**
417
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
+	 *
419
+	 * @since 1.0.0
420
+	 */
421
+	do_action('geodir_after_social_sharing_buttons');
422
+	$content_html = ob_get_clean();
423
+	if (trim($content_html) != '')
424
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
+		/**
427
+		 * Filter the geodir_social_sharing_buttons() function content.
428
+		 *
429
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
+		 */
431
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
+	}
433 433
 
434 434
 
435 435
 }
@@ -447,46 +447,46 @@  discard block
 block discarded – undo
447 447
  */
448 448
 function geodir_edit_post_link()
449 449
 {
450
-    global $post, $preview;
451
-    ob_start(); // Start buffering;
452
-    /**
453
-     * This is called before the edit post link html in the function geodir_edit_post_link()
454
-     *
455
-     * @since 1.0.0
456
-     */
457
-    do_action('geodir_before_edit_post_link');
458
-    if (!$preview) {
459
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
450
+	global $post, $preview;
451
+	ob_start(); // Start buffering;
452
+	/**
453
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
454
+	 *
455
+	 * @since 1.0.0
456
+	 */
457
+	do_action('geodir_before_edit_post_link');
458
+	if (!$preview) {
459
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
460 460
         
461
-        if ($is_current_user_owner) {
462
-            $post_id = $post->ID;
461
+		if ($is_current_user_owner) {
462
+			$post_id = $post->ID;
463 463
             
464
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
-                $post_id = (int)$_REQUEST['pid'];
466
-            }
464
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
+				$post_id = (int)$_REQUEST['pid'];
466
+			}
467 467
 
468
-            $postlink = get_permalink(geodir_add_listing_page_id());
469
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
471
-        }
472
-    }// end of if, if its a preview or not
473
-    /**
474
-     * This is called after the edit post link html in the function geodir_edit_post_link()
475
-     *
476
-     * @since 1.0.0
477
-     */
478
-    do_action('geodir_after_edit_post_link');
479
-    $content_html = ob_get_clean();
480
-    if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
483
-        /**
484
-         * Filter the geodir_edit_post_link() function content.
485
-         *
486
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
487
-         */
488
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
489
-    }
468
+			$postlink = get_permalink(geodir_add_listing_page_id());
469
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
471
+		}
472
+	}// end of if, if its a preview or not
473
+	/**
474
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
475
+	 *
476
+	 * @since 1.0.0
477
+	 */
478
+	do_action('geodir_after_edit_post_link');
479
+	$content_html = ob_get_clean();
480
+	if (trim($content_html) != '')
481
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
483
+		/**
484
+		 * Filter the geodir_edit_post_link() function content.
485
+		 *
486
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
487
+		 */
488
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
489
+	}
490 490
 }
491 491
 
492 492
 /**
@@ -500,42 +500,42 @@  discard block
 block discarded – undo
500 500
  */
501 501
 function geodir_detail_page_google_analytics()
502 502
 {
503
-    global $post,$preview;
504
-    if($preview){return '';}
505
-    $package_info = array();
506
-    $package_info = geodir_post_package_info($package_info, $post);
503
+	global $post,$preview;
504
+	if($preview){return '';}
505
+	$package_info = array();
506
+	$package_info = geodir_post_package_info($package_info, $post);
507 507
 
508
-    $id = trim(get_option('geodir_ga_account_id'));
508
+	$id = trim(get_option('geodir_ga_account_id'));
509 509
 
510
-    if (!$id) {
511
-        return; //if no Google Analytics ID then bail.
512
-    }
510
+	if (!$id) {
511
+		return; //if no Google Analytics ID then bail.
512
+	}
513 513
 
514
-    ob_start(); // Start buffering;
515
-    /**
516
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
517
-     *
518
-     * @since 1.0.0
519
-     */
520
-    do_action('geodir_before_google_analytics');
514
+	ob_start(); // Start buffering;
515
+	/**
516
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
517
+	 *
518
+	 * @since 1.0.0
519
+	 */
520
+	do_action('geodir_before_google_analytics');
521 521
     
522
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
523
-    /**
524
-     * Filter the time interval to check & refresh new users results.
525
-     *
526
-     * @since 1.5.9
527
-     *
528
-     * @param int $refresh_time Time interval to check & refresh new users results.
529
-     */
530
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
531
-    $refresh_time = absint($refresh_time * 1000);
522
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
523
+	/**
524
+	 * Filter the time interval to check & refresh new users results.
525
+	 *
526
+	 * @since 1.5.9
527
+	 *
528
+	 * @param int $refresh_time Time interval to check & refresh new users results.
529
+	 */
530
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
531
+	$refresh_time = absint($refresh_time * 1000);
532 532
     
533
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
533
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
534 534
     
535
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
537
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
538
-        ?>
535
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
537
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
538
+		?>
539 539
         <script type="text/javascript">
540 540
             var gd_gaTimeOut;
541 541
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -787,15 +787,15 @@  discard block
 block discarded – undo
787 787
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
788 788
 
789 789
                     <?php
790
-                    // Here we list the shorthand days of the week so it can be used in translation.
791
-                    __("Mon",'geodirectory');
792
-                    __("Tue",'geodirectory');
793
-                    __("Wed",'geodirectory');
794
-                    __("Thu",'geodirectory');
795
-                    __("Fri",'geodirectory');
796
-                    __("Sat",'geodirectory');
797
-                    __("Sun",'geodirectory');
798
-                    ?>
790
+					// Here we list the shorthand days of the week so it can be used in translation.
791
+					__("Mon",'geodirectory');
792
+					__("Tue",'geodirectory');
793
+					__("Wed",'geodirectory');
794
+					__("Thu",'geodirectory');
795
+					__("Fri",'geodirectory');
796
+					__("Sat",'geodirectory');
797
+					__("Sun",'geodirectory');
798
+					?>
799 799
 
800 800
                     labels = [
801 801
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1044,24 +1044,24 @@  discard block
 block discarded – undo
1044 1044
         </span>
1045 1045
 
1046 1046
     <?php
1047
-    }
1048
-    /**
1049
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1050
-     *
1051
-     * @since 1.0.0
1052
-     */
1053
-    do_action('geodir_after_google_analytics');
1054
-    $content_html = ob_get_clean();
1055
-    if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058
-        /**
1059
-         * Filter the geodir_edit_post_link() function content.
1060
-         *
1061
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1062
-         */
1063
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1064
-    }
1047
+	}
1048
+	/**
1049
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1050
+	 *
1051
+	 * @since 1.0.0
1052
+	 */
1053
+	do_action('geodir_after_google_analytics');
1054
+	$content_html = ob_get_clean();
1055
+	if (trim($content_html) != '')
1056
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058
+		/**
1059
+		 * Filter the geodir_edit_post_link() function content.
1060
+		 *
1061
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1062
+		 */
1063
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1064
+	}
1065 1065
 }
1066 1066
 
1067 1067
 /**
@@ -1078,94 +1078,94 @@  discard block
 block discarded – undo
1078 1078
  */
1079 1079
 function geodir_detail_page_review_rating()
1080 1080
 {
1081
-    global $post, $preview, $post_images;
1081
+	global $post, $preview, $post_images;
1082 1082
     
1083
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1084
-        return;
1085
-    }
1086
-    ob_start(); // Start  buffering;
1087
-    /**
1088
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1089
-     *
1090
-     * This is called outside the check for an actual rating and the check for preview page.
1091
-     *
1092
-     * @since 1.0.0
1093
-     */
1094
-    do_action('geodir_before_detail_page_review_rating');
1095
-
1096
-    $comment_count = geodir_get_review_count_total($post->ID);
1097
-    $post_avgratings = geodir_get_post_rating($post->ID);
1098
-
1099
-    if ($post_avgratings != 0 && !$preview) {
1100
-        /**
1101
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1102
-         *
1103
-         * This is called inside the check for an actual rating and the check for preview page.
1104
-         *
1105
-         * @since 1.0.0
1106
-         * @param float $post_avgratings Average rating for the surrent post.
1107
-         * @param int $post->ID Current post ID.
1108
-         */
1109
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1110
-
1111
-        $html = '<p style=" float:left;">';
1112
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1113
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1114
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1083
+	if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1084
+		return;
1085
+	}
1086
+	ob_start(); // Start  buffering;
1087
+	/**
1088
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1089
+	 *
1090
+	 * This is called outside the check for an actual rating and the check for preview page.
1091
+	 *
1092
+	 * @since 1.0.0
1093
+	 */
1094
+	do_action('geodir_before_detail_page_review_rating');
1095
+
1096
+	$comment_count = geodir_get_review_count_total($post->ID);
1097
+	$post_avgratings = geodir_get_post_rating($post->ID);
1098
+
1099
+	if ($post_avgratings != 0 && !$preview) {
1100
+		/**
1101
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1102
+		 *
1103
+		 * This is called inside the check for an actual rating and the check for preview page.
1104
+		 *
1105
+		 * @since 1.0.0
1106
+		 * @param float $post_avgratings Average rating for the surrent post.
1107
+		 * @param int $post->ID Current post ID.
1108
+		 */
1109
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1110
+
1111
+		$html = '<p style=" float:left;">';
1112
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1113
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1114
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1115 1115
        
1116 1116
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1117 1117
 	   
1118 1118
 	   $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 />';
1119 1119
 
1120
-        $html .= '<span class="item">';
1121
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1120
+		$html .= '<span class="item">';
1121
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1122 1122
 
1123
-        if ($post_images) {
1124
-            foreach ($post_images as $img) {
1125
-                $post_img = $img->src;
1126
-                break;
1127
-            }
1128
-        }
1129
-
1130
-        if (isset($post_img) && $post_img) {
1131
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1132
-        }
1133
-
1134
-        $html .= '</span>';
1135
-
1136
-        echo $html .= '</div>';
1137
-        /**
1138
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1139
-         *
1140
-         * This is called inside the check for an actual rating and the check for preview page.
1141
-         *
1142
-         * @since 1.0.0
1143
-         * @param float $post_avgratings Average rating for the surrent post.
1144
-         * @param int $post->ID Current post ID.
1145
-         */
1146
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1147
-    }
1148
-    /**
1149
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1150
-     *
1151
-     * This is called outside the check for an actual rating and the check for preview page.
1152
-     *
1153
-     * @since 1.0.0
1154
-     */
1155
-    do_action('geodir_after_detail_page_review_rating');
1156
-    $content_html = ob_get_clean();
1157
-    if (trim($content_html) != '') {
1158
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1159
-    }
1160
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1161
-        /**
1162
-         * Filter the geodir_detail_page_review_rating() function content.
1163
-         *
1164
-         * @since 1.0.0
1165
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1166
-         */
1167
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1168
-    }
1123
+		if ($post_images) {
1124
+			foreach ($post_images as $img) {
1125
+				$post_img = $img->src;
1126
+				break;
1127
+			}
1128
+		}
1129
+
1130
+		if (isset($post_img) && $post_img) {
1131
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1132
+		}
1133
+
1134
+		$html .= '</span>';
1135
+
1136
+		echo $html .= '</div>';
1137
+		/**
1138
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1139
+		 *
1140
+		 * This is called inside the check for an actual rating and the check for preview page.
1141
+		 *
1142
+		 * @since 1.0.0
1143
+		 * @param float $post_avgratings Average rating for the surrent post.
1144
+		 * @param int $post->ID Current post ID.
1145
+		 */
1146
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1147
+	}
1148
+	/**
1149
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1150
+	 *
1151
+	 * This is called outside the check for an actual rating and the check for preview page.
1152
+	 *
1153
+	 * @since 1.0.0
1154
+	 */
1155
+	do_action('geodir_after_detail_page_review_rating');
1156
+	$content_html = ob_get_clean();
1157
+	if (trim($content_html) != '') {
1158
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1159
+	}
1160
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1161
+		/**
1162
+		 * Filter the geodir_detail_page_review_rating() function content.
1163
+		 *
1164
+		 * @since 1.0.0
1165
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1166
+		 */
1167
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1168
+	}
1169 1169
 }
1170 1170
 
1171 1171
 /**
@@ -1177,35 +1177,35 @@  discard block
 block discarded – undo
1177 1177
  */
1178 1178
 function geodir_detail_page_more_info()
1179 1179
 {
1180
-    ob_start(); // Start  buffering;
1181
-    /**
1182
-     * This is called before the info section html.
1183
-     *
1184
-     * @since 1.0.0
1185
-     */
1186
-    do_action('geodir_before_detail_page_more_info');
1187
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1188
-        echo $geodir_post_detail_fields;
1189
-    }
1190
-    /**
1191
-     * This is called after the info section html.
1192
-     *
1193
-     * @since 1.0.0
1194
-     */
1195
-    do_action('geodir_after_detail_page_more_info');
1196
-
1197
-    $content_html = ob_get_clean();
1198
-    if (trim($content_html) != '')
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1200
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1201
-        /**
1202
-         * Filter the output html for function geodir_detail_page_more_info().
1203
-         *
1204
-         * @since 1.0.0
1205
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1206
-         */
1207
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1208
-    }
1180
+	ob_start(); // Start  buffering;
1181
+	/**
1182
+	 * This is called before the info section html.
1183
+	 *
1184
+	 * @since 1.0.0
1185
+	 */
1186
+	do_action('geodir_before_detail_page_more_info');
1187
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1188
+		echo $geodir_post_detail_fields;
1189
+	}
1190
+	/**
1191
+	 * This is called after the info section html.
1192
+	 *
1193
+	 * @since 1.0.0
1194
+	 */
1195
+	do_action('geodir_after_detail_page_more_info');
1196
+
1197
+	$content_html = ob_get_clean();
1198
+	if (trim($content_html) != '')
1199
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1200
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1201
+		/**
1202
+		 * Filter the output html for function geodir_detail_page_more_info().
1203
+		 *
1204
+		 * @since 1.0.0
1205
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1206
+		 */
1207
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1208
+	}
1209 1209
 }
1210 1210
 
1211 1211
 
@@ -1219,15 +1219,15 @@  discard block
 block discarded – undo
1219 1219
  */
1220 1220
 function geodir_localize_all_js_msg()
1221 1221
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1222
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1223
-        $ajax_url = admin_url('admin-ajax.php');
1224
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1225
-        $ajax_url = admin_url('admin-ajax.php');
1226
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1227
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1228
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1229
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1230
-    }
1222
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1223
+		$ajax_url = admin_url('admin-ajax.php');
1224
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1225
+		$ajax_url = admin_url('admin-ajax.php');
1226
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1227
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1228
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1229
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1230
+	}
1231 1231
 	
1232 1232
 	/**
1233 1233
 	 * Filter the allowed image type extensions for post images.
@@ -1237,60 +1237,60 @@  discard block
 block discarded – undo
1237 1237
 	 */
1238 1238
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1239 1239
 	
1240
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1241
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1242
-    $default_marker_width = $default_marker_size['w'];
1243
-    $default_marker_height = $default_marker_size['h'];
1240
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1241
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1242
+	$default_marker_width = $default_marker_size['w'];
1243
+	$default_marker_height = $default_marker_size['h'];
1244 1244
     
1245
-    $arr_alert_msg = array(
1246
-        'geodir_plugin_url' => geodir_plugin_url(),
1247
-        'geodir_admin_ajax_url' => $ajax_url,
1248
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1249
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1250
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1251
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1252
-        //start not show alert msg
1253
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1254
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1255
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1256
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1257
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1258
-        // end not show alert msg
1259
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1260
-        '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'),
1261
-        //start not show alert msg
1262
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1263
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1264
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1265
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1266
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1267
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1268
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1269
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1270
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1271
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1272
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1273
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1274
-        'geodir_default_marker_icon' => $default_marker_icon,
1275
-        'geodir_default_marker_w' => $default_marker_width,
1276
-        'geodir_default_marker_h' => $default_marker_height,
1277
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1278
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1279
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1280
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1281
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1282
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1283
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1284
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1285
-        /* on/off dragging for phone devices */
1286
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1287
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1288
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1289
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1290
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1291
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1292
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1293
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1245
+	$arr_alert_msg = array(
1246
+		'geodir_plugin_url' => geodir_plugin_url(),
1247
+		'geodir_admin_ajax_url' => $ajax_url,
1248
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1249
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1250
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1251
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1252
+		//start not show alert msg
1253
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1254
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1255
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1256
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1257
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1258
+		// end not show alert msg
1259
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1260
+		'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'),
1261
+		//start not show alert msg
1262
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1263
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1264
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1265
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1266
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1267
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1268
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1269
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1270
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1271
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1272
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1273
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1274
+		'geodir_default_marker_icon' => $default_marker_icon,
1275
+		'geodir_default_marker_w' => $default_marker_width,
1276
+		'geodir_default_marker_h' => $default_marker_height,
1277
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1278
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1279
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1280
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1281
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1282
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1283
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1284
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1285
+		/* on/off dragging for phone devices */
1286
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1287
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1288
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1289
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1290
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1291
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1292
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1293
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1294 1294
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1295 1295
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1296 1296
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1298,40 +1298,40 @@  discard block
 block discarded – undo
1298 1298
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1299 1299
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1300 1300
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1301
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1302
-        'geodir_map_name' => geodir_map_name(),
1303
-        'osmStart' => __('Start', 'geodirectory'),
1304
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1305
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1306
-        'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1307
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1308
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1309
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1310
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1311
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1312
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1313
-    );
1314
-
1315
-    /**
1316
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1317
-     *
1318
-     * With this filter you can add, remove or change translated JS strings.
1319
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1320
-     *
1321
-     * @since 1.0.0
1322
-     */
1323
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1324
-
1325
-    foreach ($arr_alert_msg as $key => $value) {
1326
-        if (!is_scalar($value))
1327
-            continue;
1328
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1329
-    }
1301
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1302
+		'geodir_map_name' => geodir_map_name(),
1303
+		'osmStart' => __('Start', 'geodirectory'),
1304
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1305
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1306
+		'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1307
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1308
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1309
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1310
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1311
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1312
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1313
+	);
1314
+
1315
+	/**
1316
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1317
+	 *
1318
+	 * With this filter you can add, remove or change translated JS strings.
1319
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1320
+	 *
1321
+	 * @since 1.0.0
1322
+	 */
1323
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1330 1324
 
1331
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1332
-    echo '<script>';
1333
-    echo $script;
1334
-    echo '</script>';
1325
+	foreach ($arr_alert_msg as $key => $value) {
1326
+		if (!is_scalar($value))
1327
+			continue;
1328
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1329
+	}
1330
+
1331
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1332
+	echo '<script>';
1333
+	echo $script;
1334
+	echo '</script>';
1335 1335
 }
1336 1336
 
1337 1337
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1347,11 +1347,11 @@  discard block
 block discarded – undo
1347 1347
  */
1348 1348
 function geodir_admin_bar_site_menu($wp_admin_bar)
1349 1349
 {
1350
-    if (get_option("geodir_installed")) {
1351
-        if (current_user_can('manage_options')) {
1352
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1353
-        }
1354
-    }
1350
+	if (get_option("geodir_installed")) {
1351
+		if (current_user_can('manage_options')) {
1352
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1353
+		}
1354
+	}
1355 1355
 }
1356 1356
 
1357 1357
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1377,25 +1377,25 @@  discard block
 block discarded – undo
1377 1377
  */
1378 1378
 function geodir_store_sidebars()
1379 1379
 {
1380
-    global $geodir_sidebars;
1381
-    global $sidebars_widgets;
1382
-
1383
-    if (!is_array($sidebars_widgets))
1384
-        $sidebars_widgets = wp_get_sidebars_widgets();
1385
-    $geodir_old_sidebars = array();
1386
-
1387
-    if (is_array($geodir_sidebars)) {
1388
-        foreach ($geodir_sidebars as $val) {
1389
-            if (is_array($sidebars_widgets)) {
1390
-                if (array_key_exists($val, $sidebars_widgets))
1391
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1392
-                else
1393
-                    $geodir_old_sidebars[$val] = array();
1394
-            }
1395
-        }
1396
-    }
1397
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1398
-    geodir_option_version_backup('geodir_sidebars');
1380
+	global $geodir_sidebars;
1381
+	global $sidebars_widgets;
1382
+
1383
+	if (!is_array($sidebars_widgets))
1384
+		$sidebars_widgets = wp_get_sidebars_widgets();
1385
+	$geodir_old_sidebars = array();
1386
+
1387
+	if (is_array($geodir_sidebars)) {
1388
+		foreach ($geodir_sidebars as $val) {
1389
+			if (is_array($sidebars_widgets)) {
1390
+				if (array_key_exists($val, $sidebars_widgets))
1391
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1392
+				else
1393
+					$geodir_old_sidebars[$val] = array();
1394
+			}
1395
+		}
1396
+	}
1397
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1398
+	geodir_option_version_backup('geodir_sidebars');
1399 1399
 
1400 1400
 }
1401 1401
 
@@ -1409,28 +1409,28 @@  discard block
 block discarded – undo
1409 1409
  */
1410 1410
 function geodir_restore_sidebars()
1411 1411
 {
1412
-    global $sidebars_widgets;
1413
-
1414
-    if (!is_array($sidebars_widgets))
1415
-        $sidebars_widgets = wp_get_sidebars_widgets();
1416
-
1417
-    if (is_array($sidebars_widgets)) {
1418
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1419
-        if (is_array($geodir_old_sidebars)) {
1420
-            foreach ($geodir_old_sidebars as $key => $val) {
1421
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1422
-                {
1423
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1424
-                }
1412
+	global $sidebars_widgets;
1425 1413
 
1414
+	if (!is_array($sidebars_widgets))
1415
+		$sidebars_widgets = wp_get_sidebars_widgets();
1426 1416
 
1427
-            }
1428
-        }
1417
+	if (is_array($sidebars_widgets)) {
1418
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1419
+		if (is_array($geodir_old_sidebars)) {
1420
+			foreach ($geodir_old_sidebars as $key => $val) {
1421
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1422
+				{
1423
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1424
+				}
1429 1425
 
1430
-    }
1431 1426
 
1432
-    update_option('sidebars_widgets', $sidebars_widgets);
1433
-    update_option('geodir_sidebars', '');
1427
+			}
1428
+		}
1429
+
1430
+	}
1431
+
1432
+	update_option('sidebars_widgets', $sidebars_widgets);
1433
+	update_option('geodir_sidebars', '');
1434 1434
 }
1435 1435
 
1436 1436
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1443,9 +1443,9 @@  discard block
 block discarded – undo
1443 1443
  */
1444 1444
 function geodir_after_listing_post_gridview()
1445 1445
 {
1446
-    global $gridview_columns;
1446
+	global $gridview_columns;
1447 1447
 
1448
-    $gridview_columns = '';
1448
+	$gridview_columns = '';
1449 1449
 
1450 1450
 }
1451 1451
 
@@ -1473,11 +1473,11 @@  discard block
 block discarded – undo
1473 1473
  */
1474 1474
 function so_handle_038($url, $original_url, $_context)
1475 1475
 {
1476
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1477
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1478
-    }
1476
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1477
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1478
+	}
1479 1479
 
1480
-    return $url;
1480
+	return $url;
1481 1481
 }
1482 1482
 
1483 1483
 
@@ -1493,34 +1493,34 @@  discard block
 block discarded – undo
1493 1493
 function geodir_after_main_form_fields() {
1494 1494
 	global $gd_session;
1495 1495
 	
1496
-    if (get_option('geodir_accept_term_condition')) {
1497
-        global $post;
1498
-        $term_condition = '';
1499
-        if (isset($_REQUEST['backandedit'])) {
1500
-            $post = (object)$gd_session->get('listing');
1501
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1502
-        }
1503
-
1504
-        ?>
1496
+	if (get_option('geodir_accept_term_condition')) {
1497
+		global $post;
1498
+		$term_condition = '';
1499
+		if (isset($_REQUEST['backandedit'])) {
1500
+			$post = (object)$gd_session->get('listing');
1501
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1502
+		}
1503
+
1504
+		?>
1505 1505
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1506 1506
             <label>&nbsp;</label>
1507 1507
 
1508 1508
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1509 1509
 				<span style="display:block"> 
1510 1510
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1511
-                    echo 'checked="checked"';
1512
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1511
+					echo 'checked="checked"';
1512
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1513 1513
                        class="geodir_textfield" value="1"
1514 1514
                        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>
1515 1515
 				</span>
1516 1516
             </div>
1517 1517
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1518
-                    _e($required_msg, 'geodirectory');
1519
-                } ?></span>
1518
+					_e($required_msg, 'geodirectory');
1519
+				} ?></span>
1520 1520
         </div>
1521 1521
     <?php
1522 1522
 
1523
-    }
1523
+	}
1524 1524
 }
1525 1525
 
1526 1526
 
@@ -1545,42 +1545,42 @@  discard block
 block discarded – undo
1545 1545
  */
1546 1546
 function geodir_detail_page_tab_is_display($is_display, $tab)
1547 1547
 {
1548
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1548
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1549 1549
 
1550
-    if ($tab == 'post_profile') {
1551
-        /** This action is documented in geodirectory_template_actions.php */
1552
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1550
+	if ($tab == 'post_profile') {
1551
+		/** This action is documented in geodirectory_template_actions.php */
1552
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1553 1553
         
1554
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1555
-            $is_display = false;
1556
-        }
1557
-    }
1554
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1555
+			$is_display = false;
1556
+		}
1557
+	}
1558 1558
     
1559
-    if ($tab == 'post_info')
1560
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1559
+	if ($tab == 'post_info')
1560
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1561 1561
     
1562
-    if ($tab == 'post_images')
1563
-        $is_display = (!empty($post_images)) ? true : false;
1562
+	if ($tab == 'post_images')
1563
+		$is_display = (!empty($post_images)) ? true : false;
1564 1564
 
1565
-    if ($tab == 'post_video')
1566
-        $is_display = (!empty($video)) ? true : false;
1565
+	if ($tab == 'post_video')
1566
+		$is_display = (!empty($video)) ? true : false;
1567 1567
 
1568
-    if ($tab == 'special_offers')
1569
-        $is_display = (!empty($special_offers)) ? true : false;
1568
+	if ($tab == 'special_offers')
1569
+		$is_display = (!empty($special_offers)) ? true : false;
1570 1570
 
1571
-    if ($tab == 'reviews')
1572
-        $is_display = (geodir_is_page('detail')) ? true : false;
1571
+	if ($tab == 'reviews')
1572
+		$is_display = (geodir_is_page('detail')) ? true : false;
1573 1573
 
1574
-    if ($tab == 'related_listing') {
1575
-       $message = __('No listings found which match your selection.', 'geodirectory');
1574
+	if ($tab == 'related_listing') {
1575
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1576 1576
        
1577
-       /** This action is documented in geodirectory-functions/template_functions.php */
1578
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1577
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1578
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1579 1579
        
1580
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1581
-    }
1580
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1581
+	}
1582 1582
 
1583
-    return $is_display;
1583
+	return $is_display;
1584 1584
 }
1585 1585
 
1586 1586
 
@@ -1596,69 +1596,69 @@  discard block
 block discarded – undo
1596 1596
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1597 1597
  */
1598 1598
 function geodir_changes_in_custom_fields_table() {
1599
-    global $wpdb, $plugin_prefix;
1599
+	global $wpdb, $plugin_prefix;
1600 1600
 	
1601 1601
 	// Remove unused virtual page
1602 1602
 	$listings_page_id = (int)get_option('geodir_listing_page');
1603 1603
 	if ($listings_page_id) {
1604 1604
 		$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')));
1605
-        delete_option('geodir_listing_page');
1605
+		delete_option('geodir_listing_page');
1606 1606
 	}
1607 1607
 
1608
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1609
-        $wpdb->query(
1610
-            $wpdb->prepare(
1611
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1612
-                array('1', '1', 'admin')
1613
-            )
1614
-        );
1608
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1609
+		$wpdb->query(
1610
+			$wpdb->prepare(
1611
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1612
+				array('1', '1', 'admin')
1613
+			)
1614
+		);
1615 1615
 
1616 1616
 
1617
-        /* --- terms meta value set --- */
1617
+		/* --- terms meta value set --- */
1618 1618
 
1619
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1619
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1620 1620
 
1621
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1621
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1622 1622
 
1623
-        if (!empty($options_data)) {
1623
+		if (!empty($options_data)) {
1624 1624
 
1625
-            foreach ($options_data as $optobj) {
1625
+			foreach ($options_data as $optobj) {
1626 1626
 
1627
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1627
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1628 1628
 
1629
-                $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)));
1629
+				$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)));
1630 1630
 
1631
-                if (!empty($taxonomies_data)) {
1631
+				if (!empty($taxonomies_data)) {
1632 1632
 
1633
-                    foreach ($taxonomies_data as $taxobj) {
1633
+					foreach ($taxonomies_data as $taxobj) {
1634 1634
 
1635
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1636
-                        $post_type = $taxObject->object_type[0];
1635
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1636
+						$post_type = $taxObject->object_type[0];
1637 1637
 
1638
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1638
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1639 1639
 
1640
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1640
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1641 1641
 
1642
-                        if ($duplicate_data) {
1642
+						if ($duplicate_data) {
1643 1643
 
1644
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1644
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1645 1645
 
1646
-                        } else {
1646
+						} else {
1647 1647
 
1648
-                            $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)));
1648
+							$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)));
1649 1649
 
1650
-                        }
1650
+						}
1651 1651
 
1652
-                    }
1652
+					}
1653 1653
 
1654
-                }
1654
+				}
1655 1655
 
1656
-            }
1657
-        }
1656
+			}
1657
+		}
1658 1658
 
1659
-        update_option('geodir_changes_in_custom_fields_table', '1');
1659
+		update_option('geodir_changes_in_custom_fields_table', '1');
1660 1660
 
1661
-    }
1661
+	}
1662 1662
 
1663 1663
 }
1664 1664
 
@@ -1677,24 +1677,24 @@  discard block
 block discarded – undo
1677 1677
 function geodir_location_slug_check($slug)
1678 1678
 {
1679 1679
 
1680
-    global $wpdb, $table_prefix;
1680
+	global $wpdb, $table_prefix;
1681 1681
 
1682
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1682
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1683 1683
 
1684
-    if ($slug_exists) {
1684
+	if ($slug_exists) {
1685 1685
 
1686
-        $suffix = 1;
1687
-        do {
1688
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1689
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1690
-            $suffix++;
1691
-        } while ($location_slug_check && $suffix < 100);
1686
+		$suffix = 1;
1687
+		do {
1688
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1689
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1690
+			$suffix++;
1691
+		} while ($location_slug_check && $suffix < 100);
1692 1692
 
1693
-        $slug = $alt_location_name;
1693
+		$slug = $alt_location_name;
1694 1694
 
1695
-    }
1695
+	}
1696 1696
 
1697
-    return $slug;
1697
+	return $slug;
1698 1698
 
1699 1699
 }
1700 1700
 
@@ -1719,42 +1719,42 @@  discard block
 block discarded – undo
1719 1719
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1720 1720
 {
1721 1721
 
1722
-    global $wpdb, $plugin_prefix, $table_prefix;
1722
+	global $wpdb, $plugin_prefix, $table_prefix;
1723 1723
 
1724
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1724
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1725 1725
 
1726
-    $slug = $tern_data->slug;
1726
+	$slug = $tern_data->slug;
1727 1727
 
1728
-    /**
1729
-     * Filter if a term slug exists.
1730
-     *
1731
-     * @since 1.0.0
1732
-     * @package GeoDirectory
1733
-     * @param bool $bool Default: false.
1734
-     * @param string $slug The term slug.
1735
-     * @param int $term_id The term ID.
1736
-     */
1737
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1728
+	/**
1729
+	 * Filter if a term slug exists.
1730
+	 *
1731
+	 * @since 1.0.0
1732
+	 * @package GeoDirectory
1733
+	 * @param bool $bool Default: false.
1734
+	 * @param string $slug The term slug.
1735
+	 * @param int $term_id The term ID.
1736
+	 */
1737
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1738 1738
 
1739
-    if ($slug_exists) {
1739
+	if ($slug_exists) {
1740 1740
 
1741
-        $suffix = 1;
1742
-        do {
1743
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1741
+		$suffix = 1;
1742
+		do {
1743
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1744 1744
 
1745
-            /** This action is documented in geodirectory_hooks_actions.php */
1746
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1745
+			/** This action is documented in geodirectory_hooks_actions.php */
1746
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1747 1747
 
1748
-            $suffix++;
1749
-        } while ($term_slug_check && $suffix < 100);
1748
+			$suffix++;
1749
+		} while ($term_slug_check && $suffix < 100);
1750 1750
 
1751
-        $slug = $new_slug;
1751
+		$slug = $new_slug;
1752 1752
 
1753
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1753
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1754 1754
 
1755
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1755
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1756 1756
 
1757
-    }
1757
+	}
1758 1758
 	
1759 1759
 	// Update tag in detail table.
1760 1760
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1795,21 +1795,21 @@  discard block
 block discarded – undo
1795 1795
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1796 1796
 {
1797 1797
 
1798
-    global $wpdb, $table_prefix;
1798
+	global $wpdb, $table_prefix;
1799 1799
 
1800
-    $default_location = geodir_get_default_location();
1800
+	$default_location = geodir_get_default_location();
1801 1801
 
1802
-    $country_slug = $default_location->country_slug;
1803
-    $region_slug = $default_location->region_slug;
1804
-    $city_slug = $default_location->city_slug;
1802
+	$country_slug = $default_location->country_slug;
1803
+	$region_slug = $default_location->region_slug;
1804
+	$city_slug = $default_location->city_slug;
1805 1805
 
1806
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1807
-        return $slug_exists = true;
1806
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1807
+		return $slug_exists = true;
1808 1808
 
1809
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1810
-        return $slug_exists = true;
1809
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1810
+		return $slug_exists = true;
1811 1811
 
1812
-    return $slug_exists;
1812
+	return $slug_exists;
1813 1813
 }
1814 1814
 
1815 1815
 
@@ -1828,75 +1828,75 @@  discard block
 block discarded – undo
1828 1828
  */
1829 1829
 function geodir_custom_page_title($title = '', $sep = '')
1830 1830
 {
1831
-    global $wp;
1832
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1833
-        return $title;
1834
-    }
1831
+	global $wp;
1832
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1833
+		return $title;
1834
+	}
1835 1835
 
1836
-    if ($sep == '') {
1837
-        /**
1838
-         * Filter the page title separator.
1839
-         *
1840
-         * @since 1.0.0
1841
-         * @package GeoDirectory
1842
-         * @param string $sep The separator, default: `|`.
1843
-         */
1844
-        $sep = apply_filters('geodir_page_title_separator', '|');
1845
-    }
1836
+	if ($sep == '') {
1837
+		/**
1838
+		 * Filter the page title separator.
1839
+		 *
1840
+		 * @since 1.0.0
1841
+		 * @package GeoDirectory
1842
+		 * @param string $sep The separator, default: `|`.
1843
+		 */
1844
+		$sep = apply_filters('geodir_page_title_separator', '|');
1845
+	}
1846 1846
 
1847 1847
 
1848
-    $gd_page = '';
1849
-    if(geodir_is_page('home')){
1850
-        $gd_page = 'home';
1851
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1852
-    }
1853
-    elseif(geodir_is_page('detail')){
1854
-        $gd_page = 'detail';
1855
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1856
-    }
1857
-    elseif(geodir_is_page('pt')){
1858
-        $gd_page = 'pt';
1859
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1860
-    }
1861
-    elseif(geodir_is_page('listing')){
1862
-        $gd_page = 'listing';
1863
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1864
-    }
1865
-    elseif(geodir_is_page('location')){
1866
-        $gd_page = 'location';
1867
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1868
-    }
1869
-    elseif(geodir_is_page('search')){
1870
-        $gd_page = 'search';
1871
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('add-listing')){
1874
-        $gd_page = 'add-listing';
1875
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1876
-    }
1877
-    elseif(geodir_is_page('author')){
1878
-        $gd_page = 'author';
1879
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1880
-    }
1881
-    elseif(geodir_is_page('login')){
1882
-        $gd_page = 'login';
1883
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1884
-    }
1885
-    elseif(geodir_is_page('listing-success')){
1886
-        $gd_page = 'listing-success';
1887
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1888
-    }
1848
+	$gd_page = '';
1849
+	if(geodir_is_page('home')){
1850
+		$gd_page = 'home';
1851
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1852
+	}
1853
+	elseif(geodir_is_page('detail')){
1854
+		$gd_page = 'detail';
1855
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1856
+	}
1857
+	elseif(geodir_is_page('pt')){
1858
+		$gd_page = 'pt';
1859
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1860
+	}
1861
+	elseif(geodir_is_page('listing')){
1862
+		$gd_page = 'listing';
1863
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1864
+	}
1865
+	elseif(geodir_is_page('location')){
1866
+		$gd_page = 'location';
1867
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1868
+	}
1869
+	elseif(geodir_is_page('search')){
1870
+		$gd_page = 'search';
1871
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1872
+	}
1873
+	elseif(geodir_is_page('add-listing')){
1874
+		$gd_page = 'add-listing';
1875
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1876
+	}
1877
+	elseif(geodir_is_page('author')){
1878
+		$gd_page = 'author';
1879
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1880
+	}
1881
+	elseif(geodir_is_page('login')){
1882
+		$gd_page = 'login';
1883
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1884
+	}
1885
+	elseif(geodir_is_page('listing-success')){
1886
+		$gd_page = 'listing-success';
1887
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1888
+	}
1889 1889
 
1890 1890
 
1891
-    /**
1892
-     * Filter page meta title to replace variables.
1893
-     *
1894
-     * @since 1.5.4
1895
-     * @param string $title The page title including variables.
1896
-     * @param string $gd_page The GeoDirectory page type if any.
1897
-     * @param string $sep The title separator symbol.
1898
-     */
1899
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1891
+	/**
1892
+	 * Filter page meta title to replace variables.
1893
+	 *
1894
+	 * @since 1.5.4
1895
+	 * @param string $title The page title including variables.
1896
+	 * @param string $gd_page The GeoDirectory page type if any.
1897
+	 * @param string $sep The title separator symbol.
1898
+	 */
1899
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1900 1900
 
1901 1901
 }
1902 1902
 
@@ -1912,36 +1912,36 @@  discard block
 block discarded – undo
1912 1912
 function geodir_set_post_attachment()
1913 1913
 {
1914 1914
 
1915
-    if (!get_option('geodir_set_post_attachments')) {
1915
+	if (!get_option('geodir_set_post_attachments')) {
1916 1916
 
1917
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1918
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1917
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1918
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1919 1919
 
1920
-        $all_postypes = geodir_get_posttypes();
1920
+		$all_postypes = geodir_get_posttypes();
1921 1921
 
1922
-        foreach($all_postypes as $post_type){
1923
-            $args = array(
1924
-                'posts_per_page' => -1,
1925
-                'post_type' => $post_type,
1926
-                'post_status' => 'publish');
1922
+		foreach($all_postypes as $post_type){
1923
+			$args = array(
1924
+				'posts_per_page' => -1,
1925
+				'post_type' => $post_type,
1926
+				'post_status' => 'publish');
1927 1927
 
1928
-            $posts_array = get_posts($args);
1928
+			$posts_array = get_posts($args);
1929 1929
 
1930
-            if (!empty($posts_array)) {
1930
+			if (!empty($posts_array)) {
1931 1931
 
1932
-                foreach ($posts_array as $post) {
1932
+				foreach ($posts_array as $post) {
1933 1933
 
1934
-                    geodir_set_wp_featured_image($post->ID);
1934
+					geodir_set_wp_featured_image($post->ID);
1935 1935
 
1936
-                }
1936
+				}
1937 1937
 
1938
-            }
1939
-        }
1938
+			}
1939
+		}
1940 1940
 
1941 1941
 
1942
-        update_option('geodir_set_post_attachments', '1');
1942
+		update_option('geodir_set_post_attachments', '1');
1943 1943
 
1944
-    }
1944
+	}
1945 1945
 
1946 1946
 }
1947 1947
 
@@ -1958,19 +1958,19 @@  discard block
 block discarded – undo
1958 1958
 function geodir_remove_url_seperator()
1959 1959
 {
1960 1960
 
1961
-    if (!get_option('geodir_remove_url_seperator')) {
1961
+	if (!get_option('geodir_remove_url_seperator')) {
1962 1962
 
1963
-        if (get_option('geodir_listingurl_separator'))
1964
-            delete_option('geodir_listingurl_separator');
1963
+		if (get_option('geodir_listingurl_separator'))
1964
+			delete_option('geodir_listingurl_separator');
1965 1965
 
1966
-        if (get_option('geodir_detailurl_separator'))
1967
-            delete_option('geodir_detailurl_separator');
1966
+		if (get_option('geodir_detailurl_separator'))
1967
+			delete_option('geodir_detailurl_separator');
1968 1968
 
1969
-        flush_rewrite_rules(false);
1969
+		flush_rewrite_rules(false);
1970 1970
 
1971
-        update_option('geodir_remove_url_seperator', '1');
1971
+		update_option('geodir_remove_url_seperator', '1');
1972 1972
 
1973
-    }
1973
+	}
1974 1974
 
1975 1975
 }
1976 1976
 
@@ -1986,19 +1986,19 @@  discard block
 block discarded – undo
1986 1986
  */
1987 1987
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
1988 1988
 {
1989
-    foreach ($permalink_arr as $key => $value) {
1989
+	foreach ($permalink_arr as $key => $value) {
1990 1990
 
1991
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1992
-            unset($permalink_arr[$key]);
1991
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1992
+			unset($permalink_arr[$key]);
1993 1993
 
1994
-    }
1994
+	}
1995 1995
 
1996
-    return $permalink_arr;
1996
+	return $permalink_arr;
1997 1997
 
1998 1998
 }
1999 1999
 
2000 2000
 if (!is_admin()) {
2001
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2001
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2002 2002
 }
2003 2003
 /**
2004 2004
  * Set status from draft to publish.
@@ -2011,16 +2011,16 @@  discard block
 block discarded – undo
2011 2011
  */
2012 2012
 function geodir_set_status_draft_to_publish_for_own_post($post)
2013 2013
 {
2014
-    $user_id = get_current_user_id();
2014
+	$user_id = get_current_user_id();
2015 2015
 
2016
-    if(!$user_id){return $post;}
2016
+	if(!$user_id){return $post;}
2017 2017
 
2018
-    $gd_post_types = geodir_get_posttypes();
2018
+	$gd_post_types = geodir_get_posttypes();
2019 2019
 
2020
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2021
-        $post[0]->post_status = 'publish';
2022
-    }
2023
-    return $post;
2020
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2021
+		$post[0]->post_status = 'publish';
2022
+	}
2023
+	return $post;
2024 2024
 }
2025 2025
 
2026 2026
 
@@ -2112,33 +2112,33 @@  discard block
 block discarded – undo
2112 2112
  */
2113 2113
 function geodir_detail_page_tab_headings_change($tabs_arr)
2114 2114
 {
2115
-    global $wpdb;
2115
+	global $wpdb;
2116 2116
 
2117
-    $post_type = geodir_get_current_posttype();
2117
+	$post_type = geodir_get_current_posttype();
2118 2118
 
2119
-    $all_postypes = geodir_get_posttypes();
2119
+	$all_postypes = geodir_get_posttypes();
2120 2120
 
2121
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2121
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2122 2122
 
2123
-        if (array_key_exists('post_video', $tabs_arr)) {
2123
+		if (array_key_exists('post_video', $tabs_arr)) {
2124 2124
 
2125
-            $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)));
2125
+			$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)));
2126 2126
 
2127
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2128
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2129
-        }
2127
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2128
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2129
+		}
2130 2130
 
2131
-        if (array_key_exists('special_offers', $tabs_arr)) {
2131
+		if (array_key_exists('special_offers', $tabs_arr)) {
2132 2132
 
2133
-            $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)));
2133
+			$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)));
2134 2134
 
2135
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2136
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2137
-        }
2135
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2136
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2137
+		}
2138 2138
 
2139
-    }
2139
+	}
2140 2140
 
2141
-    return $tabs_arr;
2141
+	return $tabs_arr;
2142 2142
 
2143 2143
 }
2144 2144
 
@@ -2151,10 +2151,10 @@  discard block
 block discarded – undo
2151 2151
  */
2152 2152
 function geodir_remove_template_redirect_actions()
2153 2153
 {
2154
-    if (geodir_is_page('login')){
2155
-        remove_all_actions('template_redirect');
2156
-        remove_action('init', 'avia_modify_front', 10);
2157
-    }
2154
+	if (geodir_is_page('login')){
2155
+		remove_all_actions('template_redirect');
2156
+		remove_action('init', 'avia_modify_front', 10);
2157
+	}
2158 2158
 }
2159 2159
 
2160 2160
 
@@ -2176,51 +2176,51 @@  discard block
 block discarded – undo
2176 2176
 function geodirectory_before_featured_image_delete($attachment_id)
2177 2177
 {
2178 2178
 
2179
-    global $wpdb, $plugin_prefix;
2179
+	global $wpdb, $plugin_prefix;
2180 2180
 
2181
-    $post_id = get_post_field('post_parent', $attachment_id);
2181
+	$post_id = get_post_field('post_parent', $attachment_id);
2182 2182
 
2183
-    $attachment_url = wp_get_attachment_url($attachment_id);
2183
+	$attachment_url = wp_get_attachment_url($attachment_id);
2184 2184
 
2185
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2185
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2186 2186
 
2187
-        $post_type = get_post_type($post_id);
2187
+		$post_type = get_post_type($post_id);
2188 2188
 
2189
-        $all_postypes = geodir_get_posttypes();
2189
+		$all_postypes = geodir_get_posttypes();
2190 2190
 
2191
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2192
-            return false;
2191
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2192
+			return false;
2193 2193
 
2194
-        $uploads = wp_upload_dir();
2194
+		$uploads = wp_upload_dir();
2195 2195
 
2196
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2196
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2197 2197
 
2198
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2198
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2199 2199
 
2200
-        $wpdb->query(
2201
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2202
-                array($post_id, $split_img_file_path)
2203
-            )
2204
-        );
2200
+		$wpdb->query(
2201
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2202
+				array($post_id, $split_img_file_path)
2203
+			)
2204
+		);
2205 2205
 
2206
-        $attachment_data = $wpdb->get_row(
2207
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2208
-                array($post_id)
2209
-            )
2210
-        );
2206
+		$attachment_data = $wpdb->get_row(
2207
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2208
+				array($post_id)
2209
+			)
2210
+		);
2211 2211
 
2212
-        if (!empty($attachment_data)) {
2213
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2214
-        }
2212
+		if (!empty($attachment_data)) {
2213
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2214
+		}
2215 2215
 
2216 2216
 
2217
-        $table_name = $plugin_prefix . $post_type . '_detail';
2217
+		$table_name = $plugin_prefix . $post_type . '_detail';
2218 2218
 
2219
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2219
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2220 2220
 
2221
-        geodir_set_wp_featured_image($post_id);
2221
+		geodir_set_wp_featured_image($post_id);
2222 2222
 
2223
-    }
2223
+	}
2224 2224
 
2225 2225
 }
2226 2226
 
@@ -2238,79 +2238,79 @@  discard block
 block discarded – undo
2238 2238
 function geodir_temp_set_post_attachment()
2239 2239
 {
2240 2240
 
2241
-    global $wpdb, $plugin_prefix;
2241
+	global $wpdb, $plugin_prefix;
2242 2242
 
2243
-    $all_postypes = geodir_get_posttypes();
2243
+	$all_postypes = geodir_get_posttypes();
2244 2244
 
2245
-    foreach ($all_postypes as $posttype) {
2245
+	foreach ($all_postypes as $posttype) {
2246 2246
 
2247
-        $tablename = $plugin_prefix . $posttype . '_detail';
2247
+		$tablename = $plugin_prefix . $posttype . '_detail';
2248 2248
 
2249
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2249
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2250 2250
 
2251
-        if (!empty($get_post_data)) {
2251
+		if (!empty($get_post_data)) {
2252 2252
 
2253
-            foreach ($get_post_data as $data) {
2253
+			foreach ($get_post_data as $data) {
2254 2254
 
2255
-                $post_id = $data->post_id;
2255
+				$post_id = $data->post_id;
2256 2256
 
2257
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2257
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2258 2258
 
2259
-                if (!empty($attachment_data)) {
2259
+				if (!empty($attachment_data)) {
2260 2260
 
2261
-                    foreach ($attachment_data as $attach) {
2261
+					foreach ($attachment_data as $attach) {
2262 2262
 
2263
-                        $file_info = pathinfo($attach->file);
2263
+						$file_info = pathinfo($attach->file);
2264 2264
 
2265
-                        $sub_dir = '';
2266
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2267
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2265
+						$sub_dir = '';
2266
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2267
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2268 2268
 
2269
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2270
-                        $uploads_path = $uploads['basedir'];
2269
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2270
+						$uploads_path = $uploads['basedir'];
2271 2271
 
2272
-                        $file_name = $file_info['basename'];
2272
+						$file_name = $file_info['basename'];
2273 2273
 
2274
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2274
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2275 2275
 
2276
-                        if (!file_exists($img_arr['path'])) {
2276
+						if (!file_exists($img_arr['path'])) {
2277 2277
 
2278
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2278
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2279 2279
 
2280
-                        }
2280
+						}
2281 2281
 
2282
-                    }
2282
+					}
2283 2283
 
2284
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2284
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2285 2285
 
2286
-                    if (!empty($attachment_data)) {
2286
+					if (!empty($attachment_data)) {
2287 2287
 
2288
-                        if ($attachment_data->ID)
2289
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2288
+						if ($attachment_data->ID)
2289
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2290 2290
 
2291
-                    } else {
2291
+					} else {
2292 2292
 
2293
-                        if (has_post_thumbnail($post_id)) {
2293
+						if (has_post_thumbnail($post_id)) {
2294 2294
 
2295
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2295
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2296 2296
 
2297
-                            wp_delete_attachment($post_thumbnail_id);
2297
+							wp_delete_attachment($post_thumbnail_id);
2298 2298
 
2299
-                        }
2299
+						}
2300 2300
 
2301
-                    }
2301
+					}
2302 2302
 
2303
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2303
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2304 2304
 
2305
-                    geodir_set_wp_featured_image($post_id);
2305
+					geodir_set_wp_featured_image($post_id);
2306 2306
 
2307
-                }
2307
+				}
2308 2308
 
2309
-            }
2309
+			}
2310 2310
 
2311
-        }
2311
+		}
2312 2312
 
2313
-    }
2313
+	}
2314 2314
 
2315 2315
 }
2316 2316
 
@@ -2328,9 +2328,9 @@  discard block
 block discarded – undo
2328 2328
 function geodir_default_rating_star_icon()
2329 2329
 {
2330 2330
 
2331
-    if (!get_option('geodir_default_rating_star_icon')) {
2332
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2333
-    }
2331
+	if (!get_option('geodir_default_rating_star_icon')) {
2332
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2333
+	}
2334 2334
 
2335 2335
 }
2336 2336
 
@@ -2348,27 +2348,27 @@  discard block
 block discarded – undo
2348 2348
  */
2349 2349
 function geodir_user_post_listing_count($user_id=null)
2350 2350
 {
2351
-    global $wpdb, $plugin_prefix, $current_user;
2352
-    if(!$user_id){
2353
-        $user_id = $current_user->ID;
2354
-    }
2351
+	global $wpdb, $plugin_prefix, $current_user;
2352
+	if(!$user_id){
2353
+		$user_id = $current_user->ID;
2354
+	}
2355 2355
 
2356
-    $user_id = $current_user->ID;
2357
-    $all_postypes = geodir_get_posttypes();
2358
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2356
+	$user_id = $current_user->ID;
2357
+	$all_postypes = geodir_get_posttypes();
2358
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2359 2359
 
2360
-    $user_listing = array();
2361
-    if (is_array($all_posts) && !empty($all_posts)) {
2362
-        foreach ($all_posts as $ptype) {
2363
-            $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' )");
2360
+	$user_listing = array();
2361
+	if (is_array($all_posts) && !empty($all_posts)) {
2362
+		foreach ($all_posts as $ptype) {
2363
+			$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' )");
2364 2364
 
2365
-            if ($total_posts > 0) {
2366
-                $user_listing[$ptype] = $total_posts;
2367
-            }
2368
-        }
2369
-    }
2365
+			if ($total_posts > 0) {
2366
+				$user_listing[$ptype] = $total_posts;
2367
+			}
2368
+		}
2369
+	}
2370 2370
 
2371
-    return $user_listing;
2371
+	return $user_listing;
2372 2372
 }
2373 2373
 
2374 2374
 
@@ -2388,189 +2388,189 @@  discard block
 block discarded – undo
2388 2388
  */
2389 2389
 function geodir_detail_page_custom_field_tab($tabs_arr)
2390 2390
 {
2391
-    global $post;
2392
-
2393
-    $post_type = geodir_get_current_posttype();
2394
-    $all_postypes = geodir_get_posttypes();
2395
-
2396
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2397
-        $package_info = array();
2398
-        $package_info = geodir_post_package_info($package_info, $post);
2399
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2400
-        $fields_location = 'owntab';
2401
-
2402
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2403
-        //remove video and special offers if it is already set to show
2404
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2405
-            $unset_video = true;
2406
-        }
2407
-
2408
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2409
-            $unset_special_offers = true;
2410
-        }
2411
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2412
-            foreach($custom_fields as $key => $custom_field){
2413
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2414
-                    unset($custom_fields[$key]);
2415
-                }
2416
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2417
-                    unset($custom_fields[$key]);
2418
-                }
2419
-            }
2420
-        }
2421
-
2422
-
2423
-        if (!empty($custom_fields)) {
2424
-            $parse_custom_fields = array();
2425
-            foreach ($custom_fields as $field) {
2426
-                $field = stripslashes_deep($field); // strip slashes
2427
-                $type = $field;
2428
-                $field_name = $field['htmlvar_name'];
2429
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2430
-                    $post->{$field_name} = $_REQUEST[$field_name];
2431
-                }
2391
+	global $post;
2432 2392
 
2433
-                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'))) {
2434
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2435
-                        continue;
2436
-                    }
2393
+	$post_type = geodir_get_current_posttype();
2394
+	$all_postypes = geodir_get_posttypes();
2437 2395
 
2438
-                    $parse_custom_fields[] = $field;
2439
-                }
2440
-            }
2441
-            $custom_fields = $parse_custom_fields;
2442
-        }
2443
-        //print_r($custom_fields);
2444
-        if (!empty($custom_fields)) {
2396
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2397
+		$package_info = array();
2398
+		$package_info = geodir_post_package_info($package_info, $post);
2399
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2400
+		$fields_location = 'owntab';
2445 2401
 
2446
-            global $field_set_start;
2402
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2403
+		//remove video and special offers if it is already set to show
2404
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2405
+			$unset_video = true;
2406
+		}
2447 2407
 
2448
-            $post = stripslashes_deep($post); // strip slashes
2449
-            
2450
-            $field_set_start = 0;
2451
-            $fieldset_count = 0;
2452
-            $fieldset = '';
2453
-            $total_fields = count($custom_fields);
2454
-            $count_field = 0;
2455
-            $fieldset_arr = array();
2456
-            $i = 0;
2457
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2458
-
2459
-            foreach ($custom_fields as $field) {
2460
-                $count_field++;
2461
-                $field_name = $field['htmlvar_name'];
2462
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2463
-                    $post->{$field_name} = $_REQUEST[$field_name];
2464
-                }
2408
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2409
+			$unset_special_offers = true;
2410
+		}
2411
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2412
+			foreach($custom_fields as $key => $custom_field){
2413
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2414
+					unset($custom_fields[$key]);
2415
+				}
2416
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2417
+					unset($custom_fields[$key]);
2418
+				}
2419
+			}
2420
+		}
2465 2421
 
2466
-                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'))) {
2467
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2468
-                    $site_title = trim($field['site_title']);
2469
-                    $type = $field;
2470
-                    $variables_array = array();
2471 2422
 
2472
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2473
-                        continue;
2474
-                    }
2423
+		if (!empty($custom_fields)) {
2424
+			$parse_custom_fields = array();
2425
+			foreach ($custom_fields as $field) {
2426
+				$field = stripslashes_deep($field); // strip slashes
2427
+				$type = $field;
2428
+				$field_name = $field['htmlvar_name'];
2429
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2430
+					$post->{$field_name} = $_REQUEST[$field_name];
2431
+				}
2475 2432
 
2476
-                    if ($type['type'] != 'fieldset') {
2477
-                        $i++;
2478
-                        $variables_array['post_id'] = $post->ID;
2479
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2480
-                        $variables_array['value'] = '';
2481
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2482
-                    }else{
2483
-                        $i = 0;
2484
-                        $fieldset_count++;
2485
-                        $field_set_start = 1;
2486
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2487
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2488
-                    }
2433
+				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'))) {
2434
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2435
+						continue;
2436
+					}
2489 2437
 
2438
+					$parse_custom_fields[] = $field;
2439
+				}
2440
+			}
2441
+			$custom_fields = $parse_custom_fields;
2442
+		}
2443
+		//print_r($custom_fields);
2444
+		if (!empty($custom_fields)) {
2490 2445
 
2491
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2492
-                    $type = stripslashes_deep($type); // strip slashes
2493
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2494
-                    $html = '';
2495
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2496
-                    if($html_var=='post'){$html_var='post_address';}
2497
-                    $field_icon = geodir_field_icon_proccess($type);
2498
-                    $filed_type = $type['type'];
2499
-
2500
-                    /**
2501
-                     * Filter the output for custom fields.
2502
-                     *
2503
-                     * Here we can remove or add new functions depending on the field type.
2504
-                     *
2505
-                     * @param string $html The html to be filtered (blank).
2506
-                     * @param string $fields_location The location the field is to be show.
2507
-                     * @param array $type The array of field values.
2508
-                     */
2509
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2510
-
2511
-
2512
-                    /**
2513
-                     * Filter custom field output in tab.
2514
-                     *
2515
-                     * @since 1.5.6
2516
-                     *
2517
-                     * @param string $html_var The HTML variable name for the field.
2518
-                     * @param string $html Custom field unfiltered HTML.
2519
-                     * @param array $variables_array Custom field variables array.
2520
-                     */
2521
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2522
-
2523
-                    $fieldset_html = '';
2524
-                    if ($field_set_start == 1) {
2525
-                        $add_html = false;
2526
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2527
-                            if ($fieldset != '') {
2528
-                                $add_html = true;
2529
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2530
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2531
-                            }
2532
-                            $fieldset_html = $fieldset;
2533
-                            $fieldset = '';
2534
-                        } else {
2535
-                            $fieldset .= $html;
2536
-                            if ($total_fields == $count_field && $fieldset != '') {
2537
-                                $add_html = true;
2538
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2539
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2540
-                                $fieldset_html = $fieldset;
2541
-                            }
2542
-                        }
2446
+			global $field_set_start;
2543 2447
 
2544
-                        if ($add_html) {
2545
-                            $tabs_arr[$htmlvar_name] = array(
2546
-                                'heading_text' => __($label, 'geodirectory'),
2547
-                                'is_active_tab' => false,
2548
-                                /**
2549
-                                 * Filter if a custom field should be displayed on the details page tab.
2550
-                                 *
2551
-                                 * @since 1.0.0
2552
-                                 * @param string $htmlvar_name The field HTML var name.
2553
-                                 */
2554
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2555
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2556
-                            );
2557
-                        }
2558
-                    } else {
2559
-                        if ($html != '') {
2560
-                            $tabs_arr[$html_var] = array(
2561
-                                'heading_text' => __($label, 'geodirectory'),
2562
-                                'is_active_tab' => false,
2563
-                                /** This action is documented in geodirectory_hooks_actions.php */
2564
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2565
-                                'tab_content' => $html
2566
-                            );
2567
-                        }
2568
-                    }
2569
-                }
2570
-            }
2571
-        }
2572
-    }
2573
-    return $tabs_arr;
2448
+			$post = stripslashes_deep($post); // strip slashes
2449
+            
2450
+			$field_set_start = 0;
2451
+			$fieldset_count = 0;
2452
+			$fieldset = '';
2453
+			$total_fields = count($custom_fields);
2454
+			$count_field = 0;
2455
+			$fieldset_arr = array();
2456
+			$i = 0;
2457
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2458
+
2459
+			foreach ($custom_fields as $field) {
2460
+				$count_field++;
2461
+				$field_name = $field['htmlvar_name'];
2462
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2463
+					$post->{$field_name} = $_REQUEST[$field_name];
2464
+				}
2465
+
2466
+				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'))) {
2467
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2468
+					$site_title = trim($field['site_title']);
2469
+					$type = $field;
2470
+					$variables_array = array();
2471
+
2472
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2473
+						continue;
2474
+					}
2475
+
2476
+					if ($type['type'] != 'fieldset') {
2477
+						$i++;
2478
+						$variables_array['post_id'] = $post->ID;
2479
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2480
+						$variables_array['value'] = '';
2481
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2482
+					}else{
2483
+						$i = 0;
2484
+						$fieldset_count++;
2485
+						$field_set_start = 1;
2486
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2487
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2488
+					}
2489
+
2490
+
2491
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2492
+					$type = stripslashes_deep($type); // strip slashes
2493
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2494
+					$html = '';
2495
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2496
+					if($html_var=='post'){$html_var='post_address';}
2497
+					$field_icon = geodir_field_icon_proccess($type);
2498
+					$filed_type = $type['type'];
2499
+
2500
+					/**
2501
+					 * Filter the output for custom fields.
2502
+					 *
2503
+					 * Here we can remove or add new functions depending on the field type.
2504
+					 *
2505
+					 * @param string $html The html to be filtered (blank).
2506
+					 * @param string $fields_location The location the field is to be show.
2507
+					 * @param array $type The array of field values.
2508
+					 */
2509
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2510
+
2511
+
2512
+					/**
2513
+					 * Filter custom field output in tab.
2514
+					 *
2515
+					 * @since 1.5.6
2516
+					 *
2517
+					 * @param string $html_var The HTML variable name for the field.
2518
+					 * @param string $html Custom field unfiltered HTML.
2519
+					 * @param array $variables_array Custom field variables array.
2520
+					 */
2521
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2522
+
2523
+					$fieldset_html = '';
2524
+					if ($field_set_start == 1) {
2525
+						$add_html = false;
2526
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2527
+							if ($fieldset != '') {
2528
+								$add_html = true;
2529
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2530
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2531
+							}
2532
+							$fieldset_html = $fieldset;
2533
+							$fieldset = '';
2534
+						} else {
2535
+							$fieldset .= $html;
2536
+							if ($total_fields == $count_field && $fieldset != '') {
2537
+								$add_html = true;
2538
+								$label = $fieldset_arr[$fieldset_count]['label'];
2539
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2540
+								$fieldset_html = $fieldset;
2541
+							}
2542
+						}
2543
+
2544
+						if ($add_html) {
2545
+							$tabs_arr[$htmlvar_name] = array(
2546
+								'heading_text' => __($label, 'geodirectory'),
2547
+								'is_active_tab' => false,
2548
+								/**
2549
+								 * Filter if a custom field should be displayed on the details page tab.
2550
+								 *
2551
+								 * @since 1.0.0
2552
+								 * @param string $htmlvar_name The field HTML var name.
2553
+								 */
2554
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2555
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2556
+							);
2557
+						}
2558
+					} else {
2559
+						if ($html != '') {
2560
+							$tabs_arr[$html_var] = array(
2561
+								'heading_text' => __($label, 'geodirectory'),
2562
+								'is_active_tab' => false,
2563
+								/** This action is documented in geodirectory_hooks_actions.php */
2564
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2565
+								'tab_content' => $html
2566
+							);
2567
+						}
2568
+					}
2569
+				}
2570
+			}
2571
+		}
2572
+	}
2573
+	return $tabs_arr;
2574 2574
 }
2575 2575
 
2576 2576
 /* display add listing page for wpml */
@@ -2594,39 +2594,39 @@  discard block
 block discarded – undo
2594 2594
  */
2595 2595
 function geodir_add_post_status_author_page()
2596 2596
 {
2597
-    global $wpdb, $post;
2598
-
2599
-    $html = '';
2600
-    if (get_current_user_id()) {
2601
-
2602
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2603
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2604
-
2605
-            // 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.
2606
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2607
-            $status = "<strong>(";
2608
-            $status_icon = '<i class="fa fa-play"></i>';
2609
-            if ($real_status == 'publish') {
2610
-                $status .= __('Published', 'geodirectory');
2611
-            } else {
2612
-                $status .= __('Not published', 'geodirectory');
2613
-                $status_icon = '<i class="fa fa-pause"></i>';
2614
-            }
2615
-            $status .= ")</strong>";
2597
+	global $wpdb, $post;
2598
+
2599
+	$html = '';
2600
+	if (get_current_user_id()) {
2601
+
2602
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2603
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2604
+
2605
+			// 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.
2606
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2607
+			$status = "<strong>(";
2608
+			$status_icon = '<i class="fa fa-play"></i>';
2609
+			if ($real_status == 'publish') {
2610
+				$status .= __('Published', 'geodirectory');
2611
+			} else {
2612
+				$status .= __('Not published', 'geodirectory');
2613
+				$status_icon = '<i class="fa fa-pause"></i>';
2614
+			}
2615
+			$status .= ")</strong>";
2616 2616
 
2617
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2618
-        }
2619
-    }
2617
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2618
+		}
2619
+	}
2620 2620
 
2621
-    if ($html != '') {
2622
-        /**
2623
-         * Filter the post status text on the author page.
2624
-         *
2625
-         * @since 1.0.0
2626
-         * @param string $html The HTML of the status.
2627
-         */
2628
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2629
-    }
2621
+	if ($html != '') {
2622
+		/**
2623
+		 * Filter the post status text on the author page.
2624
+		 *
2625
+		 * @since 1.0.0
2626
+		 * @param string $html The HTML of the status.
2627
+		 */
2628
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2629
+	}
2630 2630
 
2631 2631
 
2632 2632
 }
@@ -2640,9 +2640,9 @@  discard block
 block discarded – undo
2640 2640
  * @package GeoDirectory
2641 2641
  */
2642 2642
 function geodir_init_no_rating() {
2643
-    if (geodir_rating_disabled_post_types()) {
2644
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2645
-    }
2643
+	if (geodir_rating_disabled_post_types()) {
2644
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2645
+	}
2646 2646
 }
2647 2647
 
2648 2648
 /**
@@ -2656,22 +2656,22 @@  discard block
 block discarded – undo
2656 2656
  * @return array Modified sort options array.
2657 2657
  */
2658 2658
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2659
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2660
-        $new_options = array();
2659
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2660
+		$new_options = array();
2661 2661
         
2662
-        if (!empty($options)) {
2663
-            foreach ($options as $option) {
2664
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2665
-                    continue;
2666
-                }
2667
-                $new_options[] = $option;
2668
-            }
2662
+		if (!empty($options)) {
2663
+			foreach ($options as $option) {
2664
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2665
+					continue;
2666
+				}
2667
+				$new_options[] = $option;
2668
+			}
2669 2669
 
2670
-            $options = $new_options;
2671
-        }
2672
-    }
2670
+			$options = $new_options;
2671
+		}
2672
+	}
2673 2673
 
2674
-    return $options;
2674
+	return $options;
2675 2675
 }
2676 2676
 
2677 2677
 /**
@@ -2683,9 +2683,9 @@  discard block
 block discarded – undo
2683 2683
  * @return array Modified class array.
2684 2684
  */
2685 2685
 function geodir_body_class_active_map($classes = array()) {
2686
-    $classes[] = 'gd-map-' . geodir_map_name();
2686
+	$classes[] = 'gd-map-' . geodir_map_name();
2687 2687
 
2688
-    return $classes;
2688
+	return $classes;
2689 2689
 }
2690 2690
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2691 2691
 
@@ -2698,9 +2698,9 @@  discard block
 block discarded – undo
2698 2698
  * @return string Modified class string.
2699 2699
  */
2700 2700
 function geodir_admin_body_class_active_map($class = '') {    
2701
-    $class .= ' gd-map-' . geodir_map_name();
2701
+	$class .= ' gd-map-' . geodir_map_name();
2702 2702
 
2703
-    return $class;
2703
+	return $class;
2704 2704
 }
2705 2705
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2706 2706
 
@@ -2718,36 +2718,36 @@  discard block
 block discarded – undo
2718 2718
  * @return array Translation texts.
2719 2719
  */
2720 2720
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2721
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2722
-
2723
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2724
-
2725
-    /**
2726
-     * Filters the geodirectory option names that requires to add for translation.
2727
-     *
2728
-     * @since 1.5.7
2729
-     * @package GeoDirectory
2730
-     *
2731
-     * @param  array $gd_options Array of option names.
2732
-     */
2733
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2734
-    $gd_options = array_unique($gd_options);
2735
-
2736
-    if (!empty($gd_options)) {
2737
-        foreach ($gd_options as $gd_option) {
2738
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2739
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2721
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2722
+
2723
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2724
+
2725
+	/**
2726
+	 * Filters the geodirectory option names that requires to add for translation.
2727
+	 *
2728
+	 * @since 1.5.7
2729
+	 * @package GeoDirectory
2730
+	 *
2731
+	 * @param  array $gd_options Array of option names.
2732
+	 */
2733
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2734
+	$gd_options = array_unique($gd_options);
2735
+
2736
+	if (!empty($gd_options)) {
2737
+		foreach ($gd_options as $gd_option) {
2738
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2739
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2740 2740
                 
2741
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2742
-                    $translation_texts[] = stripslashes_deep($option_value);
2743
-                }
2744
-            }
2745
-        }
2746
-    }
2741
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2742
+					$translation_texts[] = stripslashes_deep($option_value);
2743
+				}
2744
+			}
2745
+		}
2746
+	}
2747 2747
 
2748
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2748
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2749 2749
 
2750
-    return $translation_texts;
2750
+	return $translation_texts;
2751 2751
 }
2752 2752
 
2753 2753
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2761,15 +2761,15 @@  discard block
 block discarded – undo
2761 2761
 
2762 2762
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2763 2763
 function gd_get_comments_link($comments_link, $post_id) {
2764
-    $post_type = get_post_type($post_id);
2764
+	$post_type = get_post_type($post_id);
2765 2765
 
2766
-    $all_postypes = geodir_get_posttypes();
2767
-    if (in_array($post_type, $all_postypes)) {
2768
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2769
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2770
-    }
2766
+	$all_postypes = geodir_get_posttypes();
2767
+	if (in_array($post_type, $all_postypes)) {
2768
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2769
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2770
+	}
2771 2771
 
2772
-    return $comments_link;
2772
+	return $comments_link;
2773 2773
 }
2774 2774
 
2775 2775
 
@@ -2787,11 +2787,11 @@  discard block
 block discarded – undo
2787 2787
 function geodir_add_nav_menu_class( $args )
2788 2788
 {
2789 2789
 
2790
-        if(isset($args['menu_class'])){
2791
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2792
-        }
2790
+		if(isset($args['menu_class'])){
2791
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2792
+		}
2793 2793
     
2794
-    return $args;
2794
+	return $args;
2795 2795
 }
2796 2796
 
2797 2797
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2808,15 +2808,15 @@  discard block
 block discarded – undo
2808 2808
  * @return string Filtered locale ID.
2809 2809
  */
2810 2810
 function geodir_wpml_filter_locale($locale) {
2811
-    global $sitepress;
2811
+	global $sitepress;
2812 2812
     
2813
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2813
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2814 2814
     
2815
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2816
-        $locale = $sitepress->get_locale($current_lang);
2817
-    }
2815
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2816
+		$locale = $sitepress->get_locale($current_lang);
2817
+	}
2818 2818
     
2819
-    return $locale;
2819
+	return $locale;
2820 2820
 }
2821 2821
 
2822 2822
 /**
@@ -2826,15 +2826,15 @@  discard block
 block discarded – undo
2826 2826
  * @package GeoDirectory
2827 2827
  */
2828 2828
 function geodir_wpml_set_filter() {
2829
-    if (function_exists('icl_object_id')) {
2830
-        global $sitepress;
2829
+	if (function_exists('icl_object_id')) {
2830
+		global $sitepress;
2831 2831
         
2832
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2833
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2834
-        }
2832
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2833
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2834
+		}
2835 2835
         
2836
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2837
-    }
2836
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2837
+	}
2838 2838
 }
2839 2839
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2840 2840
 
@@ -2847,37 +2847,37 @@  discard block
 block discarded – undo
2847 2847
  * @return array Filtered languages.
2848 2848
  */
2849 2849
 function geodir_wpml_filter_ls_languages($languages) {    
2850
-    if (geodir_is_geodir_page()) {        
2851
-        $keep_vars = array();
2850
+	if (geodir_is_geodir_page()) {        
2851
+		$keep_vars = array();
2852 2852
         
2853
-        if (geodir_is_page('add-listing')) {
2854
-            $keep_vars = array('listing_type', 'package_id');
2855
-        } else if (geodir_is_page('search')) {
2856
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2857
-        } else if (geodir_is_page('author')) {
2858
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2859
-        } else if (geodir_is_page('login')) {
2860
-            $keep_vars = array('forgot', 'signup');
2861
-        }        
2853
+		if (geodir_is_page('add-listing')) {
2854
+			$keep_vars = array('listing_type', 'package_id');
2855
+		} else if (geodir_is_page('search')) {
2856
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2857
+		} else if (geodir_is_page('author')) {
2858
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2859
+		} else if (geodir_is_page('login')) {
2860
+			$keep_vars = array('forgot', 'signup');
2861
+		}        
2862 2862
         
2863
-        if (!empty($keep_vars)) {
2864
-            foreach ( $languages as $code => $url) {
2865
-                $filter_url = $url['url'];
2863
+		if (!empty($keep_vars)) {
2864
+			foreach ( $languages as $code => $url) {
2865
+				$filter_url = $url['url'];
2866 2866
                 
2867
-                foreach ($keep_vars as $var) {
2868
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2869
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2870
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2871
-                    }
2872
-                }
2867
+				foreach ($keep_vars as $var) {
2868
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2869
+						$filter_url = remove_query_arg(array($var), $filter_url);
2870
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2871
+					}
2872
+				}
2873 2873
                 
2874
-                if ($filter_url != $url['url']) {
2875
-                    $languages[$code]['url'] = $filter_url;
2876
-                }
2877
-            }
2878
-        }
2879
-    }
2874
+				if ($filter_url != $url['url']) {
2875
+					$languages[$code]['url'] = $filter_url;
2876
+				}
2877
+			}
2878
+		}
2879
+	}
2880 2880
 
2881
-    return $languages;
2881
+	return $languages;
2882 2882
 }
2883 2883
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2884 2884
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +151 added lines, -151 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);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
226 226
     if ($geodir_theme_location) {
227 227
         update_option('geodir_theme_location_nav', $geodir_theme_location);
228 228
     } else {
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 
321 321
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
322 322
 
323
-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 
324
-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
323
+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 
324
+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
325 325
 
326 326
 // Detail page sidebar content 
327 327
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
     do_action('geodir_after_social_sharing_buttons');
422 422
     $content_html = ob_get_clean();
423 423
     if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
424
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
425
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
426 426
         /**
427 427
          * Filter the geodir_social_sharing_buttons() function content.
428 428
          *
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
             $post_id = $post->ID;
463 463
             
464 464
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
-                $post_id = (int)$_REQUEST['pid'];
465
+                $post_id = (int) $_REQUEST['pid'];
466 466
             }
467 467
 
468 468
             $postlink = get_permalink(geodir_add_listing_page_id());
469 469
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
470
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
471 471
         }
472 472
     }// end of if, if its a preview or not
473 473
     /**
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
     do_action('geodir_after_edit_post_link');
479 479
     $content_html = ob_get_clean();
480 480
     if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
481
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
482
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
483 483
         /**
484 484
          * Filter the geodir_edit_post_link() function content.
485 485
          *
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
  */
501 501
 function geodir_detail_page_google_analytics()
502 502
 {
503
-    global $post,$preview;
504
-    if($preview){return '';}
503
+    global $post, $preview;
504
+    if ($preview) {return ''; }
505 505
     $package_info = array();
506 506
     $package_info = geodir_post_package_info($package_info, $post);
507 507
 
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
     $hide_refresh = get_option('geodir_ga_auto_refresh');
534 534
     
535 535
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
536
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
537 537
         $page_url = urlencode($_SERVER['REQUEST_URI']);
538 538
         ?>
539 539
         <script type="text/javascript">
540 540
             var gd_gaTimeOut;
541
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
542
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
543
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
541
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
542
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
543
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
544 544
             ga_data1 = false;
545 545
             ga_data2 = false;
546 546
             ga_data3 = false;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             }
682 682
 
683 683
             function gdga_noResults() {
684
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
684
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
685 685
                 jQuery('#gdga-legend-container').html('');
686 686
             }
687 687
 
@@ -713,18 +713,18 @@  discard block
 block discarded – undo
713 713
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
714 714
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
715 715
 
716
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
717
-                        '<?php _e('Feb', 'geodirectory');?>',
718
-                        '<?php _e('Mar', 'geodirectory');?>',
719
-                        '<?php _e('Apr', 'geodirectory');?>',
720
-                        '<?php _e('May', 'geodirectory');?>',
721
-                        '<?php _e('Jun', 'geodirectory');?>',
722
-                        '<?php _e('Jul', 'geodirectory');?>',
723
-                        '<?php _e('Aug', 'geodirectory');?>',
724
-                        '<?php _e('Sep', 'geodirectory');?>',
725
-                        '<?php _e('Oct', 'geodirectory');?>',
726
-                        '<?php _e('Nov', 'geodirectory');?>',
727
-                        '<?php _e('Dec', 'geodirectory');?>'];
716
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
717
+                        '<?php _e('Feb', 'geodirectory'); ?>',
718
+                        '<?php _e('Mar', 'geodirectory'); ?>',
719
+                        '<?php _e('Apr', 'geodirectory'); ?>',
720
+                        '<?php _e('May', 'geodirectory'); ?>',
721
+                        '<?php _e('Jun', 'geodirectory'); ?>',
722
+                        '<?php _e('Jul', 'geodirectory'); ?>',
723
+                        '<?php _e('Aug', 'geodirectory'); ?>',
724
+                        '<?php _e('Sep', 'geodirectory'); ?>',
725
+                        '<?php _e('Oct', 'geodirectory'); ?>',
726
+                        '<?php _e('Nov', 'geodirectory'); ?>',
727
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
728 728
 
729 729
                     // Ensure the data arrays are at least as long as the labels array.
730 730
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
                         labels : labels,
738 738
                         datasets : [
739 739
                             {
740
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
740
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
741 741
                                 fillColor : "rgba(220,220,220,0.5)",
742 742
                                 strokeColor : "rgba(220,220,220,1)",
743 743
                                 data : data2
744 744
                             },
745 745
                             {
746
-                                label: '<?php _e('This Year', 'geodirectory');?>',
746
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
747 747
                                 fillColor : "rgba(151,187,205,0.5)",
748 748
                                 strokeColor : "rgba(151,187,205,1)",
749 749
                                 data : data1
@@ -788,30 +788,30 @@  discard block
 block discarded – undo
788 788
 
789 789
                     <?php
790 790
                     // Here we list the shorthand days of the week so it can be used in translation.
791
-                    __("Mon",'geodirectory');
792
-                    __("Tue",'geodirectory');
793
-                    __("Wed",'geodirectory');
794
-                    __("Thu",'geodirectory');
795
-                    __("Fri",'geodirectory');
796
-                    __("Sat",'geodirectory');
797
-                    __("Sun",'geodirectory');
791
+                    __("Mon", 'geodirectory');
792
+                    __("Tue", 'geodirectory');
793
+                    __("Wed", 'geodirectory');
794
+                    __("Thu", 'geodirectory');
795
+                    __("Fri", 'geodirectory');
796
+                    __("Sat", 'geodirectory');
797
+                    __("Sun", 'geodirectory');
798 798
                     ?>
799 799
 
800 800
                     labels = [
801
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
802
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
803
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
804
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
805
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
806
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
807
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
801
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
802
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
803
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
804
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
805
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
806
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
807
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
808 808
                     ];
809 809
 
810 810
                     var data = {
811 811
                         labels : labels,
812 812
                         datasets : [
813 813
                             {
814
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
814
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
815 815
                                 fillColor : "rgba(220,220,220,0.5)",
816 816
                                 strokeColor : "rgba(220,220,220,1)",
817 817
                                 pointColor : "rgba(220,220,220,1)",
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
                                 data : data2
820 820
                             },
821 821
                             {
822
-                                label: '<?php _e('This Week', 'geodirectory');?>',
822
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
823 823
                                 fillColor : "rgba(151,187,205,0.5)",
824 824
                                 strokeColor : "rgba(151,187,205,1)",
825 825
                                 pointColor : "rgba(151,187,205,1)",
@@ -1026,18 +1026,18 @@  discard block
 block discarded – undo
1026 1026
         </style>
1027 1027
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1028 1028
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1029
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1029
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1030 1030
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1031
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1031
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1032 1032
             <div id="gd-active-users-container">
1033
-                <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');?>
1033
+                <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'); ?>
1034 1034
                     <b class="gd-ActiveUsers-value">0</b>
1035 1035
                 </div>
1036 1036
             </div>
1037 1037
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1038
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1039
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1040
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1038
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1039
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1040
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1041 1041
             </select>
1042 1042
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1043 1043
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1053,8 +1053,8 @@  discard block
 block discarded – undo
1053 1053
     do_action('geodir_after_google_analytics');
1054 1054
     $content_html = ob_get_clean();
1055 1055
     if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1056
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1057
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1058 1058
         /**
1059 1059
          * Filter the geodir_edit_post_link() function content.
1060 1060
          *
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 {
1081 1081
     global $post, $preview, $post_images;
1082 1082
     
1083
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1083
+    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) {
1084 1084
         return;
1085 1085
     }
1086 1086
     ob_start(); // Start  buffering;
@@ -1115,10 +1115,10 @@  discard block
 block discarded – undo
1115 1115
        
1116 1116
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1117 1117
 	   
1118
-	   $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 />';
1118
+	   $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 />';
1119 1119
 
1120 1120
         $html .= '<span class="item">';
1121
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1121
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1122 1122
 
1123 1123
         if ($post_images) {
1124 1124
             foreach ($post_images as $img) {
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
         }
1129 1129
 
1130 1130
         if (isset($post_img) && $post_img) {
1131
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1131
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1132 1132
         }
1133 1133
 
1134 1134
         $html .= '</span>';
@@ -1155,9 +1155,9 @@  discard block
 block discarded – undo
1155 1155
     do_action('geodir_after_detail_page_review_rating');
1156 1156
     $content_html = ob_get_clean();
1157 1157
     if (trim($content_html) != '') {
1158
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1158
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1159 1159
     }
1160
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1160
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1161 1161
         /**
1162 1162
          * Filter the geodir_detail_page_review_rating() function content.
1163 1163
          *
@@ -1196,8 +1196,8 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
     $content_html = ob_get_clean();
1198 1198
     if (trim($content_html) != '')
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1200
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1199
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1200
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1201 1201
         /**
1202 1202
          * Filter the output html for function geodir_detail_page_more_info().
1203 1203
          *
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1297 1297
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1298 1298
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1299
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1299
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1300 1300
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1301 1301
         'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1302 1302
         'geodir_map_name' => geodir_map_name(),
@@ -1325,10 +1325,10 @@  discard block
 block discarded – undo
1325 1325
     foreach ($arr_alert_msg as $key => $value) {
1326 1326
         if (!is_scalar($value))
1327 1327
             continue;
1328
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1328
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1329 1329
     }
1330 1330
 
1331
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1331
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1332 1332
     echo '<script>';
1333 1333
     echo $script;
1334 1334
     echo '</script>';
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
         $geodir_old_sidebars = get_option('geodir_sidebars');
1419 1419
         if (is_array($geodir_old_sidebars)) {
1420 1420
             foreach ($geodir_old_sidebars as $key => $val) {
1421
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1421
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1422 1422
                 {
1423 1423
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1424 1424
                 }
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
         global $post;
1498 1498
         $term_condition = '';
1499 1499
         if (isset($_REQUEST['backandedit'])) {
1500
-            $post = (object)$gd_session->get('listing');
1500
+            $post = (object) $gd_session->get('listing');
1501 1501
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1502 1502
         }
1503 1503
 
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
                     echo 'checked="checked"';
1512 1512
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1513 1513
                        class="geodir_textfield" value="1"
1514
-                       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>
1514
+                       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>
1515 1515
 				</span>
1516 1516
             </div>
1517 1517
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
         /** This action is documented in geodirectory_template_actions.php */
1552 1552
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1553 1553
         
1554
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1554
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1555 1555
             $is_display = false;
1556 1556
         }
1557 1557
     }
@@ -1599,16 +1599,16 @@  discard block
 block discarded – undo
1599 1599
     global $wpdb, $plugin_prefix;
1600 1600
 	
1601 1601
 	// Remove unused virtual page
1602
-	$listings_page_id = (int)get_option('geodir_listing_page');
1602
+	$listings_page_id = (int) get_option('geodir_listing_page');
1603 1603
 	if ($listings_page_id) {
1604
-		$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')));
1604
+		$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')));
1605 1605
         delete_option('geodir_listing_page');
1606 1606
 	}
1607 1607
 
1608 1608
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1609 1609
         $wpdb->query(
1610 1610
             $wpdb->prepare(
1611
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1611
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1612 1612
                 array('1', '1', 'admin')
1613 1613
             )
1614 1614
         );
@@ -1616,9 +1616,9 @@  discard block
 block discarded – undo
1616 1616
 
1617 1617
         /* --- terms meta value set --- */
1618 1618
 
1619
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1619
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1620 1620
 
1621
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1621
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1622 1622
 
1623 1623
         if (!empty($options_data)) {
1624 1624
 
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 
1627 1627
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1628 1628
 
1629
-                $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)));
1629
+                $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)));
1630 1630
 
1631 1631
                 if (!empty($taxonomies_data)) {
1632 1632
 
@@ -1635,17 +1635,17 @@  discard block
 block discarded – undo
1635 1635
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1636 1636
                         $post_type = $taxObject->object_type[0];
1637 1637
 
1638
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1638
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1639 1639
 
1640
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1640
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1641 1641
 
1642 1642
                         if ($duplicate_data) {
1643 1643
 
1644
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1644
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1645 1645
 
1646 1646
                         } else {
1647 1647
 
1648
-                            $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)));
1648
+                            $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)));
1649 1649
 
1650 1650
                         }
1651 1651
 
@@ -1679,14 +1679,14 @@  discard block
 block discarded – undo
1679 1679
 
1680 1680
     global $wpdb, $table_prefix;
1681 1681
 
1682
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1682
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1683 1683
 
1684 1684
     if ($slug_exists) {
1685 1685
 
1686 1686
         $suffix = 1;
1687 1687
         do {
1688
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1689
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1688
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1689
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1690 1690
             $suffix++;
1691 1691
         } while ($location_slug_check && $suffix < 100);
1692 1692
 
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 
1741 1741
         $suffix = 1;
1742 1742
         do {
1743
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1743
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1744 1744
 
1745 1745
             /** This action is documented in geodirectory_hooks_actions.php */
1746 1746
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 
1753 1753
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1754 1754
 
1755
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1755
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1756 1756
 
1757 1757
     }
1758 1758
 	
@@ -1761,18 +1761,18 @@  discard block
 block discarded – undo
1761 1761
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1762 1762
 	
1763 1763
 	$post_types = geodir_get_posttypes();
1764
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1765
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1764
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1765
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1766 1766
 		
1767 1767
 		if (!empty($posts_obj)) {
1768 1768
 			foreach ($posts_obj as $post_obj) {
1769 1769
 				$post_id = $post_obj->object_id;
1770 1770
 				
1771
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1771
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1772 1772
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1773 1773
 				
1774
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1775
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1774
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1775
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1776 1776
 			}
1777 1777
 		}
1778 1778
 	}
@@ -1806,7 +1806,7 @@  discard block
 block discarded – undo
1806 1806
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1807 1807
         return $slug_exists = true;
1808 1808
 
1809
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1809
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1810 1810
         return $slug_exists = true;
1811 1811
 
1812 1812
     return $slug_exists;
@@ -1846,43 +1846,43 @@  discard block
 block discarded – undo
1846 1846
 
1847 1847
 
1848 1848
     $gd_page = '';
1849
-    if(geodir_is_page('home')){
1849
+    if (geodir_is_page('home')) {
1850 1850
         $gd_page = 'home';
1851 1851
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1852 1852
     }
1853
-    elseif(geodir_is_page('detail')){
1853
+    elseif (geodir_is_page('detail')) {
1854 1854
         $gd_page = 'detail';
1855 1855
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1856 1856
     }
1857
-    elseif(geodir_is_page('pt')){
1857
+    elseif (geodir_is_page('pt')) {
1858 1858
         $gd_page = 'pt';
1859 1859
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1860 1860
     }
1861
-    elseif(geodir_is_page('listing')){
1861
+    elseif (geodir_is_page('listing')) {
1862 1862
         $gd_page = 'listing';
1863 1863
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1864 1864
     }
1865
-    elseif(geodir_is_page('location')){
1865
+    elseif (geodir_is_page('location')) {
1866 1866
         $gd_page = 'location';
1867 1867
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1868 1868
     }
1869
-    elseif(geodir_is_page('search')){
1869
+    elseif (geodir_is_page('search')) {
1870 1870
         $gd_page = 'search';
1871 1871
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1872 1872
     }
1873
-    elseif(geodir_is_page('add-listing')){
1873
+    elseif (geodir_is_page('add-listing')) {
1874 1874
         $gd_page = 'add-listing';
1875 1875
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1876 1876
     }
1877
-    elseif(geodir_is_page('author')){
1877
+    elseif (geodir_is_page('author')) {
1878 1878
         $gd_page = 'author';
1879 1879
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1880 1880
     }
1881
-    elseif(geodir_is_page('login')){
1881
+    elseif (geodir_is_page('login')) {
1882 1882
         $gd_page = 'login';
1883 1883
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1884 1884
     }
1885
-    elseif(geodir_is_page('listing-success')){
1885
+    elseif (geodir_is_page('listing-success')) {
1886 1886
         $gd_page = 'listing-success';
1887 1887
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1888 1888
     }
@@ -1914,12 +1914,12 @@  discard block
 block discarded – undo
1914 1914
 
1915 1915
     if (!get_option('geodir_set_post_attachments')) {
1916 1916
 
1917
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1918
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1917
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1918
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1919 1919
 
1920 1920
         $all_postypes = geodir_get_posttypes();
1921 1921
 
1922
-        foreach($all_postypes as $post_type){
1922
+        foreach ($all_postypes as $post_type) {
1923 1923
             $args = array(
1924 1924
                 'posts_per_page' => -1,
1925 1925
                 'post_type' => $post_type,
@@ -2013,7 +2013,7 @@  discard block
 block discarded – undo
2013 2013
 {
2014 2014
     $user_id = get_current_user_id();
2015 2015
 
2016
-    if(!$user_id){return $post;}
2016
+    if (!$user_id) {return $post; }
2017 2017
 
2018 2018
     $gd_post_types = geodir_get_posttypes();
2019 2019
 
@@ -2122,7 +2122,7 @@  discard block
 block discarded – undo
2122 2122
 
2123 2123
         if (array_key_exists('post_video', $tabs_arr)) {
2124 2124
 
2125
-            $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)));
2125
+            $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)));
2126 2126
 
2127 2127
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2128 2128
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2130,7 +2130,7 @@  discard block
 block discarded – undo
2130 2130
 
2131 2131
         if (array_key_exists('special_offers', $tabs_arr)) {
2132 2132
 
2133
-            $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)));
2133
+            $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)));
2134 2134
 
2135 2135
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2136 2136
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
  */
2152 2152
 function geodir_remove_template_redirect_actions()
2153 2153
 {
2154
-    if (geodir_is_page('login')){
2154
+    if (geodir_is_page('login')) {
2155 2155
         remove_all_actions('template_redirect');
2156 2156
         remove_action('init', 'avia_modify_front', 10);
2157 2157
     }
@@ -2198,25 +2198,25 @@  discard block
 block discarded – undo
2198 2198
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2199 2199
 
2200 2200
         $wpdb->query(
2201
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2201
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2202 2202
                 array($post_id, $split_img_file_path)
2203 2203
             )
2204 2204
         );
2205 2205
 
2206 2206
         $attachment_data = $wpdb->get_row(
2207
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2207
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2208 2208
                 array($post_id)
2209 2209
             )
2210 2210
         );
2211 2211
 
2212 2212
         if (!empty($attachment_data)) {
2213
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2213
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2214 2214
         }
2215 2215
 
2216 2216
 
2217
-        $table_name = $plugin_prefix . $post_type . '_detail';
2217
+        $table_name = $plugin_prefix.$post_type.'_detail';
2218 2218
 
2219
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2219
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2220 2220
 
2221 2221
         geodir_set_wp_featured_image($post_id);
2222 2222
 
@@ -2244,9 +2244,9 @@  discard block
 block discarded – undo
2244 2244
 
2245 2245
     foreach ($all_postypes as $posttype) {
2246 2246
 
2247
-        $tablename = $plugin_prefix . $posttype . '_detail';
2247
+        $tablename = $plugin_prefix.$posttype.'_detail';
2248 2248
 
2249
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2249
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2250 2250
 
2251 2251
         if (!empty($get_post_data)) {
2252 2252
 
@@ -2254,7 +2254,7 @@  discard block
 block discarded – undo
2254 2254
 
2255 2255
                 $post_id = $data->post_id;
2256 2256
 
2257
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2257
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2258 2258
 
2259 2259
                 if (!empty($attachment_data)) {
2260 2260
 
@@ -2271,22 +2271,22 @@  discard block
 block discarded – undo
2271 2271
 
2272 2272
                         $file_name = $file_info['basename'];
2273 2273
 
2274
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2274
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2275 2275
 
2276 2276
                         if (!file_exists($img_arr['path'])) {
2277 2277
 
2278
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2278
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2279 2279
 
2280 2280
                         }
2281 2281
 
2282 2282
                     }
2283 2283
 
2284
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2284
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2285 2285
 
2286 2286
                     if (!empty($attachment_data)) {
2287 2287
 
2288 2288
                         if ($attachment_data->ID)
2289
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2289
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2290 2290
 
2291 2291
                     } else {
2292 2292
 
@@ -2300,7 +2300,7 @@  discard block
 block discarded – undo
2300 2300
 
2301 2301
                     }
2302 2302
 
2303
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2303
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2304 2304
 
2305 2305
                     geodir_set_wp_featured_image($post_id);
2306 2306
 
@@ -2329,7 +2329,7 @@  discard block
 block discarded – undo
2329 2329
 {
2330 2330
 
2331 2331
     if (!get_option('geodir_default_rating_star_icon')) {
2332
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2332
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2333 2333
     }
2334 2334
 
2335 2335
 }
@@ -2346,10 +2346,10 @@  discard block
 block discarded – undo
2346 2346
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2347 2347
  * @return array User listing count for each post type.
2348 2348
  */
2349
-function geodir_user_post_listing_count($user_id=null)
2349
+function geodir_user_post_listing_count($user_id = null)
2350 2350
 {
2351 2351
     global $wpdb, $plugin_prefix, $current_user;
2352
-    if(!$user_id){
2352
+    if (!$user_id) {
2353 2353
         $user_id = $current_user->ID;
2354 2354
     }
2355 2355
 
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
     $user_listing = array();
2361 2361
     if (is_array($all_posts) && !empty($all_posts)) {
2362 2362
         foreach ($all_posts as $ptype) {
2363
-            $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' )");
2363
+            $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' )");
2364 2364
 
2365 2365
             if ($total_posts > 0) {
2366 2366
                 $user_listing[$ptype] = $total_posts;
@@ -2401,19 +2401,19 @@  discard block
 block discarded – undo
2401 2401
 
2402 2402
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2403 2403
         //remove video and special offers if it is already set to show
2404
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2404
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2405 2405
             $unset_video = true;
2406 2406
         }
2407 2407
 
2408
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2408
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2409 2409
             $unset_special_offers = true;
2410 2410
         }
2411
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2412
-            foreach($custom_fields as $key => $custom_field){
2413
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2411
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2412
+            foreach ($custom_fields as $key => $custom_field) {
2413
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2414 2414
                     unset($custom_fields[$key]);
2415 2415
                 }
2416
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2416
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2417 2417
                     unset($custom_fields[$key]);
2418 2418
                 }
2419 2419
             }
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
                     $post->{$field_name} = $_REQUEST[$field_name];
2431 2431
                 }
2432 2432
 
2433
-                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'))) {
2433
+                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'))) {
2434 2434
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2435 2435
                         continue;
2436 2436
                     }
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
                     $post->{$field_name} = $_REQUEST[$field_name];
2464 2464
                 }
2465 2465
 
2466
-                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'))) {
2466
+                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'))) {
2467 2467
                     $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2468 2468
                     $site_title = trim($field['site_title']);
2469 2469
                     $type = $field;
@@ -2479,21 +2479,21 @@  discard block
 block discarded – undo
2479 2479
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2480 2480
                         $variables_array['value'] = '';
2481 2481
                         $variables_array['value'] = $post->{$type['htmlvar_name']};
2482
-                    }else{
2482
+                    } else {
2483 2483
                         $i = 0;
2484 2484
                         $fieldset_count++;
2485 2485
                         $field_set_start = 1;
2486
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2486
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2487 2487
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2488 2488
                     }
2489 2489
 
2490 2490
 
2491
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2491
+                    if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
2492 2492
                     $type = stripslashes_deep($type); // strip slashes
2493
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2493
+                    if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
2494 2494
                     $html = '';
2495 2495
                     $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2496
-                    if($html_var=='post'){$html_var='post_address';}
2496
+                    if ($html_var == 'post') {$html_var = 'post_address'; }
2497 2497
                     $field_icon = geodir_field_icon_proccess($type);
2498 2498
                     $filed_type = $type['type'];
2499 2499
 
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
                      * @param string $fields_location The location the field is to be show.
2507 2507
                      * @param array $type The array of field values.
2508 2508
                      */
2509
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2509
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2510 2510
 
2511 2511
 
2512 2512
                     /**
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
                                  * @param string $htmlvar_name The field HTML var name.
2553 2553
                                  */
2554 2554
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2555
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2555
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2556 2556
                             );
2557 2557
                         }
2558 2558
                     } else {
@@ -2614,7 +2614,7 @@  discard block
 block discarded – undo
2614 2614
             }
2615 2615
             $status .= ")</strong>";
2616 2616
 
2617
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2617
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2618 2618
         }
2619 2619
     }
2620 2620
 
@@ -2683,7 +2683,7 @@  discard block
 block discarded – undo
2683 2683
  * @return array Modified class array.
2684 2684
  */
2685 2685
 function geodir_body_class_active_map($classes = array()) {
2686
-    $classes[] = 'gd-map-' . geodir_map_name();
2686
+    $classes[] = 'gd-map-'.geodir_map_name();
2687 2687
 
2688 2688
     return $classes;
2689 2689
 }
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
  * @return string Modified class string.
2699 2699
  */
2700 2700
 function geodir_admin_body_class_active_map($class = '') {    
2701
-    $class .= ' gd-map-' . geodir_map_name();
2701
+    $class .= ' gd-map-'.geodir_map_name();
2702 2702
 
2703 2703
     return $class;
2704 2704
 }
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
  * @return array Translation texts.
2719 2719
  */
2720 2720
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2721
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2721
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2722 2722
 
2723 2723
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2724 2724
 
@@ -2784,17 +2784,17 @@  discard block
 block discarded – undo
2784 2784
  * @param array $args The array of menu arguments.
2785 2785
  * @return array The modified arguments.
2786 2786
  */
2787
-function geodir_add_nav_menu_class( $args )
2787
+function geodir_add_nav_menu_class($args)
2788 2788
 {
2789 2789
 
2790
-        if(isset($args['menu_class'])){
2790
+        if (isset($args['menu_class'])) {
2791 2791
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2792 2792
         }
2793 2793
     
2794 2794
     return $args;
2795 2795
 }
2796 2796
 
2797
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2797
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2798 2798
 
2799 2799
 /**
2800 2800
  * Filters WordPress locale ID.
@@ -2861,7 +2861,7 @@  discard block
 block discarded – undo
2861 2861
         }        
2862 2862
         
2863 2863
         if (!empty($keep_vars)) {
2864
-            foreach ( $languages as $code => $url) {
2864
+            foreach ($languages as $code => $url) {
2865 2865
                 $filter_url = $url['url'];
2866 2866
                 
2867 2867
                 foreach ($keep_vars as $var) {
@@ -2880,4 +2880,4 @@  discard block
 block discarded – undo
2880 2880
 
2881 2881
     return $languages;
2882 2882
 }
2883
-add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2884 2883
\ No newline at end of file
2884
+add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1);
2885 2885
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-templates/login_frm.php 3 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 if (isset($_GET['redirect_to']) && $_GET['redirect_to'] != '') {
13
-    $redirect_to = $_GET['redirect_to'];
13
+	$redirect_to = $_GET['redirect_to'];
14 14
 } else {
15
-    //echo $_SERVER['HTTP_HOST'] ;
16
-    $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
17
-    if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
18
-        $redirect_to = home_url();
19
-    }
15
+	//echo $_SERVER['HTTP_HOST'] ;
16
+	$redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
17
+	if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
18
+		$redirect_to = home_url();
19
+	}
20 20
 
21 21
 }
22 22
 
@@ -38,37 +38,37 @@  discard block
 block discarded – undo
38 38
     <h4>
39 39
         <?php
40 40
 
41
-            /**
42
-             * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template.
43
-             *
44
-             * @since 1.0.0
45
-             */
46
-            echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE);
41
+			/**
42
+			 * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template.
43
+			 *
44
+			 * @since 1.0.0
45
+			 */
46
+			echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE);
47 47
 
48
-        ?>
48
+		?>
49 49
     </h4>
50 50
     <?php
51
-    if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
-        echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
53
-    } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
-        echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55
-    }
51
+	if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
+		echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
53
+	} elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
+		echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55
+	}
56 56
 
57
-    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
57
+	if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
+		echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
59 59
 
60
-    do_action('geodir_login_error_messages');
60
+	do_action('geodir_login_error_messages');
61 61
 
62
-    ?>
62
+	?>
63 63
     <form name="cus_loginform" id="cus_loginform" method="post">
64 64
 
65 65
         <div class="form_row clearfix">
66 66
             <input placeholder='<?php echo USERNAME_TEXT; ?>' type="text" name="log" id="user_login"
67 67
                    value="<?php global $user_login;
68
-                   if (!isset($user_login)) {
69
-                       $user_login = '';
70
-                   }
71
-                   echo esc_attr($user_login); ?>" size="20" class="textfield"/>
68
+				   if (!isset($user_login)) {
69
+					   $user_login = '';
70
+				   }
71
+				   echo esc_attr($user_login); ?>" size="20" class="textfield"/>
72 72
             <span class="user_loginInfo"></span>
73 73
         </div>
74 74
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
         </div>
80 80
 
81 81
         <?php
82
-        /**
83
-         * This is a default WordPress action that calls any additional elements needed for any login forms.
84
-         *
85
-         * We use this action before the remember me checkbox on the sigin form.
86
-         *
87
-         * @since 1.0.0
88
-         */
89
-        do_action('login_form'); ?>
82
+		/**
83
+		 * This is a default WordPress action that calls any additional elements needed for any login forms.
84
+		 *
85
+		 * We use this action before the remember me checkbox on the sigin form.
86
+		 *
87
+		 * @since 1.0.0
88
+		 */
89
+		do_action('login_form'); ?>
90 90
         <p class="rember">
91 91
             <input name="rememberme" type="checkbox" id="rememberme" value="forever" class="fl"/>
92 92
             <?php echo REMEMBER_ON_COMPUTER_TEXT; ?>
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
                 <input placeholder='<?php echo USERNAME_EMAIL_TEXT; ?>' type="text" name="user_login"
111 111
                        value="<?php echo esc_attr($user_login); ?>" size="20" class="user_login1 textfield"/>
112 112
                 <?php
113
-                /**
114
-                 * Called before the get new password button in the login box template.
115
-                 *
116
-                 * @since 1.0.0
117
-                 */
118
-                do_action('lostpassword_form'); ?>
113
+				/**
114
+				 * Called before the get new password button in the login box template.
115
+				 *
116
+				 * @since 1.0.0
117
+				 */
118
+				do_action('lostpassword_form'); ?>
119 119
             </div>
120 120
             <input type="submit" name="get_new_password" value="<?php echo GET_NEW_PW_TEXT; ?>" class="geodir_button"/>
121 121
         </form>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@
 block discarded – undo
49 49
     </h4>
50 50
     <?php
51 51
     if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
-        echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
52
+        echo "<p class=\"error_msg\"> ".INVALID_USER_FPW_MSG." </p>";
53 53
     } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
-        echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
54
+        echo "<p class=\"error_msg\"> ".INVALID_USER_PW_MSG." </p>";
55 55
     }
56 56
 
57 57
     if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
58
+        echo '<p class="sucess_msg">'.PW_SEND_CONFIRM_MSG.'</p>';
59 59
 
60 60
     do_action('geodir_login_error_messages');
61 61
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
54 54
         echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55 55
     }
56 56
 
57
-    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
57
+    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') {
58
+            echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
59
+    }
59 60
 
60 61
     do_action('geodir_login_error_messages');
61 62
 
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Auth/OAuth2.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
    * @param [$issuer] the expected issues, defaults to Google
501 501
    * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
502 502
    * @throws Google_Auth_Exception
503
-   * @return mixed token information if valid, false if not
503
+   * @return Google_Auth_LoginTicket token information if valid, false if not
504 504
    */
505 505
   public function verifySignedJwtWithCerts(
506 506
       $jwt,
@@ -626,6 +626,7 @@  discard block
 block discarded – undo
626 626
 
627 627
   /**
628 628
    * Add a parameter to the auth params if not empty string.
629
+   * @param string $name
629 630
    */
630 631
   private function maybeAddParam($params, $name)
631 632
   {
Please login to merge, or discard this patch.
Indentation   +411 added lines, -411 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
    */
58 58
   public function __construct(Google_Client $client)
59 59
   {
60
-    $this->client = $client;
60
+	$this->client = $client;
61 61
   }
62 62
 
63 63
   /**
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
    */
73 73
   public function authenticatedRequest(Google_Http_Request $request)
74 74
   {
75
-    $request = $this->sign($request);
76
-    return $this->client->getIo()->makeRequest($request);
75
+	$request = $this->sign($request);
76
+	return $this->client->getIo()->makeRequest($request);
77 77
   }
78 78
 
79 79
   /**
@@ -84,52 +84,52 @@  discard block
 block discarded – undo
84 84
    */
85 85
   public function authenticate($code, $crossClient = false)
86 86
   {
87
-    if (strlen($code) == 0) {
88
-      throw new Google_Auth_Exception("Invalid code");
89
-    }
90
-
91
-    $arguments = array(
92
-          'code' => $code,
93
-          'grant_type' => 'authorization_code',
94
-          'client_id' => $this->client->getClassConfig($this, 'client_id'),
95
-          'client_secret' => $this->client->getClassConfig($this, 'client_secret')
96
-    );
97
-
98
-    if ($crossClient !== true) {
99
-        $arguments['redirect_uri'] = $this->client->getClassConfig($this, 'redirect_uri');
100
-    }
101
-
102
-    // We got here from the redirect from a successful authorization grant,
103
-    // fetch the access token
104
-    $request = new Google_Http_Request(
105
-        self::OAUTH2_TOKEN_URI,
106
-        'POST',
107
-        array(),
108
-        $arguments
109
-    );
110
-    $request->disableGzip();
111
-    $response = $this->client->getIo()->makeRequest($request);
112
-
113
-    if ($response->getResponseHttpCode() == 200) {
114
-      $this->setAccessToken($response->getResponseBody());
115
-      $this->token['created'] = time();
116
-      return $this->getAccessToken();
117
-    } else {
118
-      $decodedResponse = json_decode($response->getResponseBody(), true);
119
-      if ($decodedResponse != null && $decodedResponse['error']) {
120
-        $errorText = $decodedResponse['error'];
121
-        if (isset($decodedResponse['error_description'])) {
122
-          $errorText .= ": " . $decodedResponse['error_description'];
123
-        }
124
-      }
125
-      throw new Google_Auth_Exception(
126
-          sprintf(
127
-              "Error fetching OAuth2 access token, message: '%s'",
128
-              $errorText
129
-          ),
130
-          $response->getResponseHttpCode()
131
-      );
132
-    }
87
+	if (strlen($code) == 0) {
88
+	  throw new Google_Auth_Exception("Invalid code");
89
+	}
90
+
91
+	$arguments = array(
92
+		  'code' => $code,
93
+		  'grant_type' => 'authorization_code',
94
+		  'client_id' => $this->client->getClassConfig($this, 'client_id'),
95
+		  'client_secret' => $this->client->getClassConfig($this, 'client_secret')
96
+	);
97
+
98
+	if ($crossClient !== true) {
99
+		$arguments['redirect_uri'] = $this->client->getClassConfig($this, 'redirect_uri');
100
+	}
101
+
102
+	// We got here from the redirect from a successful authorization grant,
103
+	// fetch the access token
104
+	$request = new Google_Http_Request(
105
+		self::OAUTH2_TOKEN_URI,
106
+		'POST',
107
+		array(),
108
+		$arguments
109
+	);
110
+	$request->disableGzip();
111
+	$response = $this->client->getIo()->makeRequest($request);
112
+
113
+	if ($response->getResponseHttpCode() == 200) {
114
+	  $this->setAccessToken($response->getResponseBody());
115
+	  $this->token['created'] = time();
116
+	  return $this->getAccessToken();
117
+	} else {
118
+	  $decodedResponse = json_decode($response->getResponseBody(), true);
119
+	  if ($decodedResponse != null && $decodedResponse['error']) {
120
+		$errorText = $decodedResponse['error'];
121
+		if (isset($decodedResponse['error_description'])) {
122
+		  $errorText .= ": " . $decodedResponse['error_description'];
123
+		}
124
+	  }
125
+	  throw new Google_Auth_Exception(
126
+		  sprintf(
127
+			  "Error fetching OAuth2 access token, message: '%s'",
128
+			  $errorText
129
+		  ),
130
+		  $response->getResponseHttpCode()
131
+	  );
132
+	}
133 133
   }
134 134
 
135 135
   /**
@@ -141,37 +141,37 @@  discard block
 block discarded – undo
141 141
    */
142 142
   public function createAuthUrl($scope)
143 143
   {
144
-    $params = array(
145
-        'response_type' => 'code',
146
-        'redirect_uri' => $this->client->getClassConfig($this, 'redirect_uri'),
147
-        'client_id' => $this->client->getClassConfig($this, 'client_id'),
148
-        'scope' => $scope,
149
-        'access_type' => $this->client->getClassConfig($this, 'access_type'),
150
-    );
151
-
152
-    // Prefer prompt to approval prompt.
153
-    if ($this->client->getClassConfig($this, 'prompt')) {
154
-      $params = $this->maybeAddParam($params, 'prompt');
155
-    } else {
156
-      $params = $this->maybeAddParam($params, 'approval_prompt');
157
-    }
158
-    $params = $this->maybeAddParam($params, 'login_hint');
159
-    $params = $this->maybeAddParam($params, 'hd');
160
-    $params = $this->maybeAddParam($params, 'openid.realm');
161
-    $params = $this->maybeAddParam($params, 'include_granted_scopes');
162
-
163
-    // If the list of scopes contains plus.login, add request_visible_actions
164
-    // to auth URL.
165
-    $rva = $this->client->getClassConfig($this, 'request_visible_actions');
166
-    if (strpos($scope, 'plus.login') && strlen($rva) > 0) {
167
-        $params['request_visible_actions'] = $rva;
168
-    }
169
-
170
-    if (isset($this->state)) {
171
-      $params['state'] = $this->state;
172
-    }
173
-
174
-    return self::OAUTH2_AUTH_URL . "?" . http_build_query($params, '', '&');
144
+	$params = array(
145
+		'response_type' => 'code',
146
+		'redirect_uri' => $this->client->getClassConfig($this, 'redirect_uri'),
147
+		'client_id' => $this->client->getClassConfig($this, 'client_id'),
148
+		'scope' => $scope,
149
+		'access_type' => $this->client->getClassConfig($this, 'access_type'),
150
+	);
151
+
152
+	// Prefer prompt to approval prompt.
153
+	if ($this->client->getClassConfig($this, 'prompt')) {
154
+	  $params = $this->maybeAddParam($params, 'prompt');
155
+	} else {
156
+	  $params = $this->maybeAddParam($params, 'approval_prompt');
157
+	}
158
+	$params = $this->maybeAddParam($params, 'login_hint');
159
+	$params = $this->maybeAddParam($params, 'hd');
160
+	$params = $this->maybeAddParam($params, 'openid.realm');
161
+	$params = $this->maybeAddParam($params, 'include_granted_scopes');
162
+
163
+	// If the list of scopes contains plus.login, add request_visible_actions
164
+	// to auth URL.
165
+	$rva = $this->client->getClassConfig($this, 'request_visible_actions');
166
+	if (strpos($scope, 'plus.login') && strlen($rva) > 0) {
167
+		$params['request_visible_actions'] = $rva;
168
+	}
169
+
170
+	if (isset($this->state)) {
171
+	  $params['state'] = $this->state;
172
+	}
173
+
174
+	return self::OAUTH2_AUTH_URL . "?" . http_build_query($params, '', '&');
175 175
   }
176 176
 
177 177
   /**
@@ -180,38 +180,38 @@  discard block
 block discarded – undo
180 180
    */
181 181
   public function setAccessToken($token)
182 182
   {
183
-    $token = json_decode($token, true);
184
-    if ($token == null) {
185
-      throw new Google_Auth_Exception('Could not json decode the token');
186
-    }
187
-    if (! isset($token['access_token'])) {
188
-      throw new Google_Auth_Exception("Invalid token format");
189
-    }
190
-    $this->token = $token;
183
+	$token = json_decode($token, true);
184
+	if ($token == null) {
185
+	  throw new Google_Auth_Exception('Could not json decode the token');
186
+	}
187
+	if (! isset($token['access_token'])) {
188
+	  throw new Google_Auth_Exception("Invalid token format");
189
+	}
190
+	$this->token = $token;
191 191
   }
192 192
 
193 193
   public function getAccessToken()
194 194
   {
195
-    return json_encode($this->token);
195
+	return json_encode($this->token);
196 196
   }
197 197
 
198 198
   public function getRefreshToken()
199 199
   {
200
-    if (array_key_exists('refresh_token', $this->token)) {
201
-      return $this->token['refresh_token'];
202
-    } else {
203
-      return null;
204
-    }
200
+	if (array_key_exists('refresh_token', $this->token)) {
201
+	  return $this->token['refresh_token'];
202
+	} else {
203
+	  return null;
204
+	}
205 205
   }
206 206
 
207 207
   public function setState($state)
208 208
   {
209
-    $this->state = $state;
209
+	$this->state = $state;
210 210
   }
211 211
 
212 212
   public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
213 213
   {
214
-    $this->assertionCredentials = $creds;
214
+	$this->assertionCredentials = $creds;
215 215
   }
216 216
 
217 217
   /**
@@ -222,43 +222,43 @@  discard block
 block discarded – undo
222 222
    */
223 223
   public function sign(Google_Http_Request $request)
224 224
   {
225
-    // add the developer key to the request before signing it
226
-    if ($this->client->getClassConfig($this, 'developer_key')) {
227
-      $request->setQueryParam('key', $this->client->getClassConfig($this, 'developer_key'));
228
-    }
229
-
230
-    // Cannot sign the request without an OAuth access token.
231
-    if (null == $this->token && null == $this->assertionCredentials) {
232
-      return $request;
233
-    }
234
-
235
-    // Check if the token is set to expire in the next 30 seconds
236
-    // (or has already expired).
237
-    if ($this->isAccessTokenExpired()) {
238
-      if ($this->assertionCredentials) {
239
-        $this->refreshTokenWithAssertion();
240
-      } else {
241
-        $this->client->getLogger()->debug('OAuth2 access token expired');
242
-        if (! array_key_exists('refresh_token', $this->token)) {
243
-          $error = "The OAuth 2.0 access token has expired,"
244
-                  ." and a refresh token is not available. Refresh tokens"
245
-                  ." are not returned for responses that were auto-approved.";
246
-
247
-          $this->client->getLogger()->error($error);
248
-          throw new Google_Auth_Exception($error);
249
-        }
250
-        $this->refreshToken($this->token['refresh_token']);
251
-      }
252
-    }
253
-
254
-    $this->client->getLogger()->debug('OAuth2 authentication');
255
-
256
-    // Add the OAuth2 header to the request
257
-    $request->setRequestHeaders(
258
-        array('Authorization' => 'Bearer ' . $this->token['access_token'])
259
-    );
260
-
261
-    return $request;
225
+	// add the developer key to the request before signing it
226
+	if ($this->client->getClassConfig($this, 'developer_key')) {
227
+	  $request->setQueryParam('key', $this->client->getClassConfig($this, 'developer_key'));
228
+	}
229
+
230
+	// Cannot sign the request without an OAuth access token.
231
+	if (null == $this->token && null == $this->assertionCredentials) {
232
+	  return $request;
233
+	}
234
+
235
+	// Check if the token is set to expire in the next 30 seconds
236
+	// (or has already expired).
237
+	if ($this->isAccessTokenExpired()) {
238
+	  if ($this->assertionCredentials) {
239
+		$this->refreshTokenWithAssertion();
240
+	  } else {
241
+		$this->client->getLogger()->debug('OAuth2 access token expired');
242
+		if (! array_key_exists('refresh_token', $this->token)) {
243
+		  $error = "The OAuth 2.0 access token has expired,"
244
+				  ." and a refresh token is not available. Refresh tokens"
245
+				  ." are not returned for responses that were auto-approved.";
246
+
247
+		  $this->client->getLogger()->error($error);
248
+		  throw new Google_Auth_Exception($error);
249
+		}
250
+		$this->refreshToken($this->token['refresh_token']);
251
+	  }
252
+	}
253
+
254
+	$this->client->getLogger()->debug('OAuth2 authentication');
255
+
256
+	// Add the OAuth2 header to the request
257
+	$request->setRequestHeaders(
258
+		array('Authorization' => 'Bearer ' . $this->token['access_token'])
259
+	);
260
+
261
+	return $request;
262 262
   }
263 263
 
264 264
   /**
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
    */
269 269
   public function refreshToken($refreshToken)
270 270
   {
271
-    $this->refreshTokenRequest(
272
-        array(
273
-          'client_id' => $this->client->getClassConfig($this, 'client_id'),
274
-          'client_secret' => $this->client->getClassConfig($this, 'client_secret'),
275
-          'refresh_token' => $refreshToken,
276
-          'grant_type' => 'refresh_token'
277
-        )
278
-    );
271
+	$this->refreshTokenRequest(
272
+		array(
273
+		  'client_id' => $this->client->getClassConfig($this, 'client_id'),
274
+		  'client_secret' => $this->client->getClassConfig($this, 'client_secret'),
275
+		  'refresh_token' => $refreshToken,
276
+		  'grant_type' => 'refresh_token'
277
+		)
278
+	);
279 279
   }
280 280
 
281 281
   /**
@@ -285,83 +285,83 @@  discard block
 block discarded – undo
285 285
    */
286 286
   public function refreshTokenWithAssertion($assertionCredentials = null)
287 287
   {
288
-    if (!$assertionCredentials) {
289
-      $assertionCredentials = $this->assertionCredentials;
290
-    }
291
-
292
-    $cacheKey = $assertionCredentials->getCacheKey();
293
-
294
-    if ($cacheKey) {
295
-      // We can check whether we have a token available in the
296
-      // cache. If it is expired, we can retrieve a new one from
297
-      // the assertion.
298
-      $token = $this->client->getCache()->get($cacheKey);
299
-      if ($token) {
300
-        $this->setAccessToken($token);
301
-      }
302
-      if (!$this->isAccessTokenExpired()) {
303
-        return;
304
-      }
305
-    }
306
-
307
-    $this->client->getLogger()->debug('OAuth2 access token expired');
308
-    $this->refreshTokenRequest(
309
-        array(
310
-          'grant_type' => 'assertion',
311
-          'assertion_type' => $assertionCredentials->assertionType,
312
-          'assertion' => $assertionCredentials->generateAssertion(),
313
-        )
314
-    );
315
-
316
-    if ($cacheKey) {
317
-      // Attempt to cache the token.
318
-      $this->client->getCache()->set(
319
-          $cacheKey,
320
-          $this->getAccessToken()
321
-      );
322
-    }
288
+	if (!$assertionCredentials) {
289
+	  $assertionCredentials = $this->assertionCredentials;
290
+	}
291
+
292
+	$cacheKey = $assertionCredentials->getCacheKey();
293
+
294
+	if ($cacheKey) {
295
+	  // We can check whether we have a token available in the
296
+	  // cache. If it is expired, we can retrieve a new one from
297
+	  // the assertion.
298
+	  $token = $this->client->getCache()->get($cacheKey);
299
+	  if ($token) {
300
+		$this->setAccessToken($token);
301
+	  }
302
+	  if (!$this->isAccessTokenExpired()) {
303
+		return;
304
+	  }
305
+	}
306
+
307
+	$this->client->getLogger()->debug('OAuth2 access token expired');
308
+	$this->refreshTokenRequest(
309
+		array(
310
+		  'grant_type' => 'assertion',
311
+		  'assertion_type' => $assertionCredentials->assertionType,
312
+		  'assertion' => $assertionCredentials->generateAssertion(),
313
+		)
314
+	);
315
+
316
+	if ($cacheKey) {
317
+	  // Attempt to cache the token.
318
+	  $this->client->getCache()->set(
319
+		  $cacheKey,
320
+		  $this->getAccessToken()
321
+	  );
322
+	}
323 323
   }
324 324
 
325 325
   private function refreshTokenRequest($params)
326 326
   {
327
-    if (isset($params['assertion'])) {
328
-      $this->client->getLogger()->info(
329
-          'OAuth2 access token refresh with Signed JWT assertion grants.'
330
-      );
331
-    } else {
332
-      $this->client->getLogger()->info('OAuth2 access token refresh');
333
-    }
334
-
335
-    $http = new Google_Http_Request(
336
-        self::OAUTH2_TOKEN_URI,
337
-        'POST',
338
-        array(),
339
-        $params
340
-    );
341
-    $http->disableGzip();
342
-    $request = $this->client->getIo()->makeRequest($http);
343
-
344
-    $code = $request->getResponseHttpCode();
345
-    $body = $request->getResponseBody();
346
-    if (200 == $code) {
347
-      $token = json_decode($body, true);
348
-      if ($token == null) {
349
-        throw new Google_Auth_Exception("Could not json decode the access token");
350
-      }
351
-
352
-      if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
353
-        throw new Google_Auth_Exception("Invalid token format");
354
-      }
355
-
356
-      if (isset($token['id_token'])) {
357
-        $this->token['id_token'] = $token['id_token'];
358
-      }
359
-      $this->token['access_token'] = $token['access_token'];
360
-      $this->token['expires_in'] = $token['expires_in'];
361
-      $this->token['created'] = time();
362
-    } else {
363
-      throw new Google_Auth_Exception("Error refreshing the OAuth2 token, message: '$body'", $code);
364
-    }
327
+	if (isset($params['assertion'])) {
328
+	  $this->client->getLogger()->info(
329
+		  'OAuth2 access token refresh with Signed JWT assertion grants.'
330
+	  );
331
+	} else {
332
+	  $this->client->getLogger()->info('OAuth2 access token refresh');
333
+	}
334
+
335
+	$http = new Google_Http_Request(
336
+		self::OAUTH2_TOKEN_URI,
337
+		'POST',
338
+		array(),
339
+		$params
340
+	);
341
+	$http->disableGzip();
342
+	$request = $this->client->getIo()->makeRequest($http);
343
+
344
+	$code = $request->getResponseHttpCode();
345
+	$body = $request->getResponseBody();
346
+	if (200 == $code) {
347
+	  $token = json_decode($body, true);
348
+	  if ($token == null) {
349
+		throw new Google_Auth_Exception("Could not json decode the access token");
350
+	  }
351
+
352
+	  if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
353
+		throw new Google_Auth_Exception("Invalid token format");
354
+	  }
355
+
356
+	  if (isset($token['id_token'])) {
357
+		$this->token['id_token'] = $token['id_token'];
358
+	  }
359
+	  $this->token['access_token'] = $token['access_token'];
360
+	  $this->token['expires_in'] = $token['expires_in'];
361
+	  $this->token['created'] = time();
362
+	} else {
363
+	  throw new Google_Auth_Exception("Error refreshing the OAuth2 token, message: '$body'", $code);
364
+	}
365 365
   }
366 366
 
367 367
   /**
@@ -373,31 +373,31 @@  discard block
 block discarded – undo
373 373
    */
374 374
   public function revokeToken($token = null)
375 375
   {
376
-    if (!$token) {
377
-      if (!$this->token) {
378
-        // Not initialized, no token to actually revoke
379
-        return false;
380
-      } elseif (array_key_exists('refresh_token', $this->token)) {
381
-        $token = $this->token['refresh_token'];
382
-      } else {
383
-        $token = $this->token['access_token'];
384
-      }
385
-    }
386
-    $request = new Google_Http_Request(
387
-        self::OAUTH2_REVOKE_URI,
388
-        'POST',
389
-        array(),
390
-        "token=$token"
391
-    );
392
-    $request->disableGzip();
393
-    $response = $this->client->getIo()->makeRequest($request);
394
-    $code = $response->getResponseHttpCode();
395
-    if ($code == 200) {
396
-      $this->token = null;
397
-      return true;
398
-    }
399
-
400
-    return false;
376
+	if (!$token) {
377
+	  if (!$this->token) {
378
+		// Not initialized, no token to actually revoke
379
+		return false;
380
+	  } elseif (array_key_exists('refresh_token', $this->token)) {
381
+		$token = $this->token['refresh_token'];
382
+	  } else {
383
+		$token = $this->token['access_token'];
384
+	  }
385
+	}
386
+	$request = new Google_Http_Request(
387
+		self::OAUTH2_REVOKE_URI,
388
+		'POST',
389
+		array(),
390
+		"token=$token"
391
+	);
392
+	$request->disableGzip();
393
+	$response = $this->client->getIo()->makeRequest($request);
394
+	$code = $response->getResponseHttpCode();
395
+	if ($code == 200) {
396
+	  $this->token = null;
397
+	  return true;
398
+	}
399
+
400
+	return false;
401 401
   }
402 402
 
403 403
   /**
@@ -406,15 +406,15 @@  discard block
 block discarded – undo
406 406
    */
407 407
   public function isAccessTokenExpired()
408 408
   {
409
-    if (!$this->token || !isset($this->token['created'])) {
410
-      return true;
411
-    }
409
+	if (!$this->token || !isset($this->token['created'])) {
410
+	  return true;
411
+	}
412 412
 
413
-    // If the token is set to expire in the next 30 seconds.
414
-    $expired = ($this->token['created']
415
-        + ($this->token['expires_in'] - 30)) < time();
413
+	// If the token is set to expire in the next 30 seconds.
414
+	$expired = ($this->token['created']
415
+		+ ($this->token['expires_in'] - 30)) < time();
416 416
 
417
-    return $expired;
417
+	return $expired;
418 418
   }
419 419
 
420 420
   // Gets federated sign-on certificates to use for verifying identity tokens.
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
   // are PEM encoded certificates.
423 423
   private function getFederatedSignOnCerts()
424 424
   {
425
-    return $this->retrieveCertsFromLocation(
426
-        $this->client->getClassConfig($this, 'federated_signon_certs_url')
427
-    );
425
+	return $this->retrieveCertsFromLocation(
426
+		$this->client->getClassConfig($this, 'federated_signon_certs_url')
427
+	);
428 428
   }
429 429
 
430 430
   /**
@@ -436,36 +436,36 @@  discard block
 block discarded – undo
436 436
    */
437 437
   public function retrieveCertsFromLocation($url)
438 438
   {
439
-    // If we're retrieving a local file, just grab it.
440
-    if ("http" != substr($url, 0, 4)) {
441
-      $file = file_get_contents($url);
442
-      if ($file) {
443
-        return json_decode($file, true);
444
-      } else {
445
-        throw new Google_Auth_Exception(
446
-            "Failed to retrieve verification certificates: '" .
447
-            $url . "'."
448
-        );
449
-      }
450
-    }
451
-
452
-    // This relies on makeRequest caching certificate responses.
453
-    $request = $this->client->getIo()->makeRequest(
454
-        new Google_Http_Request(
455
-            $url
456
-        )
457
-    );
458
-    if ($request->getResponseHttpCode() == 200) {
459
-      $certs = json_decode($request->getResponseBody(), true);
460
-      if ($certs) {
461
-        return $certs;
462
-      }
463
-    }
464
-    throw new Google_Auth_Exception(
465
-        "Failed to retrieve verification certificates: '" .
466
-        $request->getResponseBody() . "'.",
467
-        $request->getResponseHttpCode()
468
-    );
439
+	// If we're retrieving a local file, just grab it.
440
+	if ("http" != substr($url, 0, 4)) {
441
+	  $file = file_get_contents($url);
442
+	  if ($file) {
443
+		return json_decode($file, true);
444
+	  } else {
445
+		throw new Google_Auth_Exception(
446
+			"Failed to retrieve verification certificates: '" .
447
+			$url . "'."
448
+		);
449
+	  }
450
+	}
451
+
452
+	// This relies on makeRequest caching certificate responses.
453
+	$request = $this->client->getIo()->makeRequest(
454
+		new Google_Http_Request(
455
+			$url
456
+		)
457
+	);
458
+	if ($request->getResponseHttpCode() == 200) {
459
+	  $certs = json_decode($request->getResponseBody(), true);
460
+	  if ($certs) {
461
+		return $certs;
462
+	  }
463
+	}
464
+	throw new Google_Auth_Exception(
465
+		"Failed to retrieve verification certificates: '" .
466
+		$request->getResponseBody() . "'.",
467
+		$request->getResponseHttpCode()
468
+	);
469 469
   }
470 470
 
471 471
   /**
@@ -480,15 +480,15 @@  discard block
 block discarded – undo
480 480
    */
481 481
   public function verifyIdToken($id_token = null, $audience = null)
482 482
   {
483
-    if (!$id_token) {
484
-      $id_token = $this->token['id_token'];
485
-    }
486
-    $certs = $this->getFederatedSignonCerts();
487
-    if (!$audience) {
488
-      $audience = $this->client->getClassConfig($this, 'client_id');
489
-    }
490
-
491
-    return $this->verifySignedJwtWithCerts($id_token, $certs, $audience, self::OAUTH2_ISSUER);
483
+	if (!$id_token) {
484
+	  $id_token = $this->token['id_token'];
485
+	}
486
+	$certs = $this->getFederatedSignonCerts();
487
+	if (!$audience) {
488
+	  $audience = $this->client->getClassConfig($this, 'client_id');
489
+	}
490
+
491
+	return $this->verifySignedJwtWithCerts($id_token, $certs, $audience, self::OAUTH2_ISSUER);
492 492
   }
493 493
 
494 494
   /**
@@ -503,125 +503,125 @@  discard block
 block discarded – undo
503 503
    * @return mixed token information if valid, false if not
504 504
    */
505 505
   public function verifySignedJwtWithCerts(
506
-      $jwt,
507
-      $certs,
508
-      $required_audience,
509
-      $issuer = null,
510
-      $max_expiry = null
506
+	  $jwt,
507
+	  $certs,
508
+	  $required_audience,
509
+	  $issuer = null,
510
+	  $max_expiry = null
511 511
   ) {
512
-    if (!$max_expiry) {
513
-      // Set the maximum time we will accept a token for.
514
-      $max_expiry = self::MAX_TOKEN_LIFETIME_SECS;
515
-    }
516
-
517
-    $segments = explode(".", $jwt);
518
-    if (count($segments) != 3) {
519
-      throw new Google_Auth_Exception("Wrong number of segments in token: $jwt");
520
-    }
521
-    $signed = $segments[0] . "." . $segments[1];
522
-    $signature = Google_Utils::urlSafeB64Decode($segments[2]);
523
-
524
-    // Parse envelope.
525
-    $envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
526
-    if (!$envelope) {
527
-      throw new Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
528
-    }
529
-
530
-    // Parse token
531
-    $json_body = Google_Utils::urlSafeB64Decode($segments[1]);
532
-    $payload = json_decode($json_body, true);
533
-    if (!$payload) {
534
-      throw new Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
535
-    }
536
-
537
-    // Check signature
538
-    $verified = false;
539
-    foreach ($certs as $keyName => $pem) {
540
-      $public_key = new Google_Verifier_Pem($pem);
541
-      if ($public_key->verify($signed, $signature)) {
542
-        $verified = true;
543
-        break;
544
-      }
545
-    }
546
-
547
-    if (!$verified) {
548
-      throw new Google_Auth_Exception("Invalid token signature: $jwt");
549
-    }
550
-
551
-    // Check issued-at timestamp
552
-    $iat = 0;
553
-    if (array_key_exists("iat", $payload)) {
554
-      $iat = $payload["iat"];
555
-    }
556
-    if (!$iat) {
557
-      throw new Google_Auth_Exception("No issue time in token: $json_body");
558
-    }
559
-    $earliest = $iat - self::CLOCK_SKEW_SECS;
560
-
561
-    // Check expiration timestamp
562
-    $now = time();
563
-    $exp = 0;
564
-    if (array_key_exists("exp", $payload)) {
565
-      $exp = $payload["exp"];
566
-    }
567
-    if (!$exp) {
568
-      throw new Google_Auth_Exception("No expiration time in token: $json_body");
569
-    }
570
-    if ($exp >= $now + $max_expiry) {
571
-      throw new Google_Auth_Exception(
572
-          sprintf("Expiration time too far in future: %s", $json_body)
573
-      );
574
-    }
575
-
576
-    $latest = $exp + self::CLOCK_SKEW_SECS;
577
-    if ($now < $earliest) {
578
-      throw new Google_Auth_Exception(
579
-          sprintf(
580
-              "Token used too early, %s < %s: %s",
581
-              $now,
582
-              $earliest,
583
-              $json_body
584
-          )
585
-      );
586
-    }
587
-    if ($now > $latest) {
588
-      throw new Google_Auth_Exception(
589
-          sprintf(
590
-              "Token used too late, %s > %s: %s",
591
-              $now,
592
-              $latest,
593
-              $json_body
594
-          )
595
-      );
596
-    }
597
-
598
-    $iss = $payload['iss'];
599
-    if ($issuer && $iss != $issuer) {
600
-      throw new Google_Auth_Exception(
601
-          sprintf(
602
-              "Invalid issuer, %s != %s: %s",
603
-              $iss,
604
-              $issuer,
605
-              $json_body
606
-          )
607
-      );
608
-    }
609
-
610
-    // Check audience
611
-    $aud = $payload["aud"];
612
-    if ($aud != $required_audience) {
613
-      throw new Google_Auth_Exception(
614
-          sprintf(
615
-              "Wrong recipient, %s != %s:",
616
-              $aud,
617
-              $required_audience,
618
-              $json_body
619
-          )
620
-      );
621
-    }
622
-
623
-    // All good.
624
-    return new Google_Auth_LoginTicket($envelope, $payload);
512
+	if (!$max_expiry) {
513
+	  // Set the maximum time we will accept a token for.
514
+	  $max_expiry = self::MAX_TOKEN_LIFETIME_SECS;
515
+	}
516
+
517
+	$segments = explode(".", $jwt);
518
+	if (count($segments) != 3) {
519
+	  throw new Google_Auth_Exception("Wrong number of segments in token: $jwt");
520
+	}
521
+	$signed = $segments[0] . "." . $segments[1];
522
+	$signature = Google_Utils::urlSafeB64Decode($segments[2]);
523
+
524
+	// Parse envelope.
525
+	$envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
526
+	if (!$envelope) {
527
+	  throw new Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
528
+	}
529
+
530
+	// Parse token
531
+	$json_body = Google_Utils::urlSafeB64Decode($segments[1]);
532
+	$payload = json_decode($json_body, true);
533
+	if (!$payload) {
534
+	  throw new Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
535
+	}
536
+
537
+	// Check signature
538
+	$verified = false;
539
+	foreach ($certs as $keyName => $pem) {
540
+	  $public_key = new Google_Verifier_Pem($pem);
541
+	  if ($public_key->verify($signed, $signature)) {
542
+		$verified = true;
543
+		break;
544
+	  }
545
+	}
546
+
547
+	if (!$verified) {
548
+	  throw new Google_Auth_Exception("Invalid token signature: $jwt");
549
+	}
550
+
551
+	// Check issued-at timestamp
552
+	$iat = 0;
553
+	if (array_key_exists("iat", $payload)) {
554
+	  $iat = $payload["iat"];
555
+	}
556
+	if (!$iat) {
557
+	  throw new Google_Auth_Exception("No issue time in token: $json_body");
558
+	}
559
+	$earliest = $iat - self::CLOCK_SKEW_SECS;
560
+
561
+	// Check expiration timestamp
562
+	$now = time();
563
+	$exp = 0;
564
+	if (array_key_exists("exp", $payload)) {
565
+	  $exp = $payload["exp"];
566
+	}
567
+	if (!$exp) {
568
+	  throw new Google_Auth_Exception("No expiration time in token: $json_body");
569
+	}
570
+	if ($exp >= $now + $max_expiry) {
571
+	  throw new Google_Auth_Exception(
572
+		  sprintf("Expiration time too far in future: %s", $json_body)
573
+	  );
574
+	}
575
+
576
+	$latest = $exp + self::CLOCK_SKEW_SECS;
577
+	if ($now < $earliest) {
578
+	  throw new Google_Auth_Exception(
579
+		  sprintf(
580
+			  "Token used too early, %s < %s: %s",
581
+			  $now,
582
+			  $earliest,
583
+			  $json_body
584
+		  )
585
+	  );
586
+	}
587
+	if ($now > $latest) {
588
+	  throw new Google_Auth_Exception(
589
+		  sprintf(
590
+			  "Token used too late, %s > %s: %s",
591
+			  $now,
592
+			  $latest,
593
+			  $json_body
594
+		  )
595
+	  );
596
+	}
597
+
598
+	$iss = $payload['iss'];
599
+	if ($issuer && $iss != $issuer) {
600
+	  throw new Google_Auth_Exception(
601
+		  sprintf(
602
+			  "Invalid issuer, %s != %s: %s",
603
+			  $iss,
604
+			  $issuer,
605
+			  $json_body
606
+		  )
607
+	  );
608
+	}
609
+
610
+	// Check audience
611
+	$aud = $payload["aud"];
612
+	if ($aud != $required_audience) {
613
+	  throw new Google_Auth_Exception(
614
+		  sprintf(
615
+			  "Wrong recipient, %s != %s:",
616
+			  $aud,
617
+			  $required_audience,
618
+			  $json_body
619
+		  )
620
+	  );
621
+	}
622
+
623
+	// All good.
624
+	return new Google_Auth_LoginTicket($envelope, $payload);
625 625
   }
626 626
 
627 627
   /**
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
    */
630 630
   private function maybeAddParam($params, $name)
631 631
   {
632
-    $param = $this->client->getClassConfig($this, $name);
633
-    if ($param != '') {
634
-      $params[$name] = $param;
635
-    }
636
-    return $params;
632
+	$param = $this->client->getClassConfig($this, $name);
633
+	if ($param != '') {
634
+	  $params[$name] = $param;
635
+	}
636
+	return $params;
637 637
   }
638 638
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
       if ($decodedResponse != null && $decodedResponse['error']) {
120 120
         $errorText = $decodedResponse['error'];
121 121
         if (isset($decodedResponse['error_description'])) {
122
-          $errorText .= ": " . $decodedResponse['error_description'];
122
+          $errorText .= ": ".$decodedResponse['error_description'];
123 123
         }
124 124
       }
125 125
       throw new Google_Auth_Exception(
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
       $params['state'] = $this->state;
172 172
     }
173 173
 
174
-    return self::OAUTH2_AUTH_URL . "?" . http_build_query($params, '', '&');
174
+    return self::OAUTH2_AUTH_URL."?".http_build_query($params, '', '&');
175 175
   }
176 176
 
177 177
   /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     if ($token == null) {
185 185
       throw new Google_Auth_Exception('Could not json decode the token');
186 186
     }
187
-    if (! isset($token['access_token'])) {
187
+    if (!isset($token['access_token'])) {
188 188
       throw new Google_Auth_Exception("Invalid token format");
189 189
     }
190 190
     $this->token = $token;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $this->refreshTokenWithAssertion();
240 240
       } else {
241 241
         $this->client->getLogger()->debug('OAuth2 access token expired');
242
-        if (! array_key_exists('refresh_token', $this->token)) {
242
+        if (!array_key_exists('refresh_token', $this->token)) {
243 243
           $error = "The OAuth 2.0 access token has expired,"
244 244
                   ." and a refresh token is not available. Refresh tokens"
245 245
                   ." are not returned for responses that were auto-approved.";
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
     // Add the OAuth2 header to the request
257 257
     $request->setRequestHeaders(
258
-        array('Authorization' => 'Bearer ' . $this->token['access_token'])
258
+        array('Authorization' => 'Bearer '.$this->token['access_token'])
259 259
     );
260 260
 
261 261
     return $request;
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         throw new Google_Auth_Exception("Could not json decode the access token");
350 350
       }
351 351
 
352
-      if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
352
+      if (!isset($token['access_token']) || !isset($token['expires_in'])) {
353 353
         throw new Google_Auth_Exception("Invalid token format");
354 354
       }
355 355
 
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
         return json_decode($file, true);
444 444
       } else {
445 445
         throw new Google_Auth_Exception(
446
-            "Failed to retrieve verification certificates: '" .
447
-            $url . "'."
446
+            "Failed to retrieve verification certificates: '".
447
+            $url."'."
448 448
         );
449 449
       }
450 450
     }
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
       }
463 463
     }
464 464
     throw new Google_Auth_Exception(
465
-        "Failed to retrieve verification certificates: '" .
466
-        $request->getResponseBody() . "'.",
465
+        "Failed to retrieve verification certificates: '".
466
+        $request->getResponseBody()."'.",
467 467
         $request->getResponseHttpCode()
468 468
     );
469 469
   }
@@ -518,20 +518,20 @@  discard block
 block discarded – undo
518 518
     if (count($segments) != 3) {
519 519
       throw new Google_Auth_Exception("Wrong number of segments in token: $jwt");
520 520
     }
521
-    $signed = $segments[0] . "." . $segments[1];
521
+    $signed = $segments[0].".".$segments[1];
522 522
     $signature = Google_Utils::urlSafeB64Decode($segments[2]);
523 523
 
524 524
     // Parse envelope.
525 525
     $envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
526 526
     if (!$envelope) {
527
-      throw new Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
527
+      throw new Google_Auth_Exception("Can't parse token envelope: ".$segments[0]);
528 528
     }
529 529
 
530 530
     // Parse token
531 531
     $json_body = Google_Utils::urlSafeB64Decode($segments[1]);
532 532
     $payload = json_decode($json_body, true);
533 533
     if (!$payload) {
534
-      throw new Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
534
+      throw new Google_Auth_Exception("Can't parse token payload: ".$segments[1]);
535 535
     }
536 536
 
537 537
     // Check signature
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Cache/File.php 3 patches
Doc Comments   +18 added lines patch added patch discarded remove patch
@@ -129,6 +129,9 @@  discard block
 block discarded – undo
129 129
     );
130 130
   }
131 131
 
132
+  /**
133
+   * @param string $file
134
+   */
132 135
   private function getWriteableCacheFile($file)
133 136
   {
134 137
     return $this->getCacheFile($file, true);
@@ -139,6 +142,9 @@  discard block
 block discarded – undo
139 142
     return $this->getCacheDir($file, $forWrite) . '/' . md5($file);
140 143
   }
141 144
 
145
+  /**
146
+   * @param boolean $forWrite
147
+   */
142 148
   private function getCacheDir($file, $forWrite)
143 149
   {
144 150
     // use the first 2 characters of the hash as a directory prefix
@@ -157,11 +163,17 @@  discard block
 block discarded – undo
157 163
     return $storageDir;
158 164
   }
159 165
 
166
+  /**
167
+   * @param string $storageFile
168
+   */
160 169
   private function acquireReadLock($storageFile)
161 170
   {
162 171
     return $this->acquireLock(LOCK_SH, $storageFile);
163 172
   }
164 173
 
174
+  /**
175
+   * @param string $storageFile
176
+   */
165 177
   private function acquireWriteLock($storageFile)
166 178
   {
167 179
     $rc = $this->acquireLock(LOCK_EX, $storageFile);
@@ -175,6 +187,9 @@  discard block
 block discarded – undo
175 187
     return $rc;
176 188
   }
177 189
 
190
+  /**
191
+   * @param integer $type
192
+   */
178 193
   private function acquireLock($type, $storageFile)
179 194
   {
180 195
     $mode = $type == LOCK_EX ? "w" : "r";
@@ -197,6 +212,9 @@  discard block
 block discarded – undo
197 212
     return true;
198 213
   }
199 214
 
215
+  /**
216
+   * @param string $storageFile
217
+   */
200 218
   public function unlock($storageFile)
201 219
   {
202 220
     if ($this->fh) {
Please login to merge, or discard this patch.
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -40,167 +40,167 @@
 block discarded – undo
40 40
 
41 41
   public function __construct(Google_Client $client)
42 42
   {
43
-    $this->client = $client;
44
-    $this->path = $this->client->getClassConfig($this, 'directory');
43
+	$this->client = $client;
44
+	$this->path = $this->client->getClassConfig($this, 'directory');
45 45
   }
46 46
 
47 47
   public function get($key, $expiration = false)
48 48
   {
49
-    $storageFile = $this->getCacheFile($key);
50
-    $data = false;
51
-
52
-    if (!file_exists($storageFile)) {
53
-      $this->client->getLogger()->debug(
54
-          'File cache miss',
55
-          array('key' => $key, 'file' => $storageFile)
56
-      );
57
-      return false;
58
-    }
59
-
60
-    if ($expiration) {
61
-      $mtime = filemtime($storageFile);
62
-      if ((time() - $mtime) >= $expiration) {
63
-        $this->client->getLogger()->debug(
64
-            'File cache miss (expired)',
65
-            array('key' => $key, 'file' => $storageFile)
66
-        );
67
-        $this->delete($key);
68
-        return false;
69
-      }
70
-    }
71
-
72
-    if ($this->acquireReadLock($storageFile)) {
73
-      if (filesize($storageFile) > 0) {
74
-        $data = fread($this->fh, filesize($storageFile));
75
-        $data =  unserialize($data);
76
-      } else {
77
-        $this->client->getLogger()->debug(
78
-            'Cache file was empty',
79
-            array('file' => $storageFile)
80
-        );
81
-      }
82
-      $this->unlock($storageFile);
83
-    }
84
-
85
-    $this->client->getLogger()->debug(
86
-        'File cache hit',
87
-        array('key' => $key, 'file' => $storageFile, 'var' => $data)
88
-    );
89
-
90
-    return $data;
49
+	$storageFile = $this->getCacheFile($key);
50
+	$data = false;
51
+
52
+	if (!file_exists($storageFile)) {
53
+	  $this->client->getLogger()->debug(
54
+		  'File cache miss',
55
+		  array('key' => $key, 'file' => $storageFile)
56
+	  );
57
+	  return false;
58
+	}
59
+
60
+	if ($expiration) {
61
+	  $mtime = filemtime($storageFile);
62
+	  if ((time() - $mtime) >= $expiration) {
63
+		$this->client->getLogger()->debug(
64
+			'File cache miss (expired)',
65
+			array('key' => $key, 'file' => $storageFile)
66
+		);
67
+		$this->delete($key);
68
+		return false;
69
+	  }
70
+	}
71
+
72
+	if ($this->acquireReadLock($storageFile)) {
73
+	  if (filesize($storageFile) > 0) {
74
+		$data = fread($this->fh, filesize($storageFile));
75
+		$data =  unserialize($data);
76
+	  } else {
77
+		$this->client->getLogger()->debug(
78
+			'Cache file was empty',
79
+			array('file' => $storageFile)
80
+		);
81
+	  }
82
+	  $this->unlock($storageFile);
83
+	}
84
+
85
+	$this->client->getLogger()->debug(
86
+		'File cache hit',
87
+		array('key' => $key, 'file' => $storageFile, 'var' => $data)
88
+	);
89
+
90
+	return $data;
91 91
   }
92 92
 
93 93
   public function set($key, $value)
94 94
   {
95
-    $storageFile = $this->getWriteableCacheFile($key);
96
-    if ($this->acquireWriteLock($storageFile)) {
97
-      // We serialize the whole request object, since we don't only want the
98
-      // responseContent but also the postBody used, headers, size, etc.
99
-      $data = serialize($value);
100
-      $result = fwrite($this->fh, $data);
101
-      $this->unlock($storageFile);
102
-
103
-      $this->client->getLogger()->debug(
104
-          'File cache set',
105
-          array('key' => $key, 'file' => $storageFile, 'var' => $value)
106
-      );
107
-    } else {
108
-      $this->client->getLogger()->notice(
109
-          'File cache set failed',
110
-          array('key' => $key, 'file' => $storageFile)
111
-      );
112
-    }
95
+	$storageFile = $this->getWriteableCacheFile($key);
96
+	if ($this->acquireWriteLock($storageFile)) {
97
+	  // We serialize the whole request object, since we don't only want the
98
+	  // responseContent but also the postBody used, headers, size, etc.
99
+	  $data = serialize($value);
100
+	  $result = fwrite($this->fh, $data);
101
+	  $this->unlock($storageFile);
102
+
103
+	  $this->client->getLogger()->debug(
104
+		  'File cache set',
105
+		  array('key' => $key, 'file' => $storageFile, 'var' => $value)
106
+	  );
107
+	} else {
108
+	  $this->client->getLogger()->notice(
109
+		  'File cache set failed',
110
+		  array('key' => $key, 'file' => $storageFile)
111
+	  );
112
+	}
113 113
   }
114 114
 
115 115
   public function delete($key)
116 116
   {
117
-    $file = $this->getCacheFile($key);
118
-    if (file_exists($file) && !unlink($file)) {
119
-      $this->client->getLogger()->error(
120
-          'File cache delete failed',
121
-          array('key' => $key, 'file' => $file)
122
-      );
123
-      throw new Google_Cache_Exception("Cache file could not be deleted");
124
-    }
125
-
126
-    $this->client->getLogger()->debug(
127
-        'File cache delete',
128
-        array('key' => $key, 'file' => $file)
129
-    );
117
+	$file = $this->getCacheFile($key);
118
+	if (file_exists($file) && !unlink($file)) {
119
+	  $this->client->getLogger()->error(
120
+		  'File cache delete failed',
121
+		  array('key' => $key, 'file' => $file)
122
+	  );
123
+	  throw new Google_Cache_Exception("Cache file could not be deleted");
124
+	}
125
+
126
+	$this->client->getLogger()->debug(
127
+		'File cache delete',
128
+		array('key' => $key, 'file' => $file)
129
+	);
130 130
   }
131 131
 
132 132
   private function getWriteableCacheFile($file)
133 133
   {
134
-    return $this->getCacheFile($file, true);
134
+	return $this->getCacheFile($file, true);
135 135
   }
136 136
 
137 137
   private function getCacheFile($file, $forWrite = false)
138 138
   {
139
-    return $this->getCacheDir($file, $forWrite) . '/' . md5($file);
139
+	return $this->getCacheDir($file, $forWrite) . '/' . md5($file);
140 140
   }
141 141
 
142 142
   private function getCacheDir($file, $forWrite)
143 143
   {
144
-    // use the first 2 characters of the hash as a directory prefix
145
-    // this should prevent slowdowns due to huge directory listings
146
-    // and thus give some basic amount of scalability
147
-    $storageDir = $this->path . '/' . substr(md5($file), 0, 2);
148
-    if ($forWrite && ! is_dir($storageDir)) {
149
-      if (! mkdir($storageDir, 0755, true)) {
150
-        $this->client->getLogger()->error(
151
-            'File cache creation failed',
152
-            array('dir' => $storageDir)
153
-        );
154
-        throw new Google_Cache_Exception("Could not create storage directory: $storageDir");
155
-      }
156
-    }
157
-    return $storageDir;
144
+	// use the first 2 characters of the hash as a directory prefix
145
+	// this should prevent slowdowns due to huge directory listings
146
+	// and thus give some basic amount of scalability
147
+	$storageDir = $this->path . '/' . substr(md5($file), 0, 2);
148
+	if ($forWrite && ! is_dir($storageDir)) {
149
+	  if (! mkdir($storageDir, 0755, true)) {
150
+		$this->client->getLogger()->error(
151
+			'File cache creation failed',
152
+			array('dir' => $storageDir)
153
+		);
154
+		throw new Google_Cache_Exception("Could not create storage directory: $storageDir");
155
+	  }
156
+	}
157
+	return $storageDir;
158 158
   }
159 159
 
160 160
   private function acquireReadLock($storageFile)
161 161
   {
162
-    return $this->acquireLock(LOCK_SH, $storageFile);
162
+	return $this->acquireLock(LOCK_SH, $storageFile);
163 163
   }
164 164
 
165 165
   private function acquireWriteLock($storageFile)
166 166
   {
167
-    $rc = $this->acquireLock(LOCK_EX, $storageFile);
168
-    if (!$rc) {
169
-      $this->client->getLogger()->notice(
170
-          'File cache write lock failed',
171
-          array('file' => $storageFile)
172
-      );
173
-      $this->delete($storageFile);
174
-    }
175
-    return $rc;
167
+	$rc = $this->acquireLock(LOCK_EX, $storageFile);
168
+	if (!$rc) {
169
+	  $this->client->getLogger()->notice(
170
+		  'File cache write lock failed',
171
+		  array('file' => $storageFile)
172
+	  );
173
+	  $this->delete($storageFile);
174
+	}
175
+	return $rc;
176 176
   }
177 177
 
178 178
   private function acquireLock($type, $storageFile)
179 179
   {
180
-    $mode = $type == LOCK_EX ? "w" : "r";
181
-    $this->fh = fopen($storageFile, $mode);
182
-    if (!$this->fh) {
183
-      $this->client->getLogger()->error(
184
-          'Failed to open file during lock acquisition',
185
-          array('file' => $storageFile)
186
-      );
187
-      return false;
188
-    }
189
-    $count = 0;
190
-    while (!flock($this->fh, $type | LOCK_NB)) {
191
-      // Sleep for 10ms.
192
-      usleep(10000);
193
-      if (++$count < self::MAX_LOCK_RETRIES) {
194
-        return false;
195
-      }
196
-    }
197
-    return true;
180
+	$mode = $type == LOCK_EX ? "w" : "r";
181
+	$this->fh = fopen($storageFile, $mode);
182
+	if (!$this->fh) {
183
+	  $this->client->getLogger()->error(
184
+		  'Failed to open file during lock acquisition',
185
+		  array('file' => $storageFile)
186
+	  );
187
+	  return false;
188
+	}
189
+	$count = 0;
190
+	while (!flock($this->fh, $type | LOCK_NB)) {
191
+	  // Sleep for 10ms.
192
+	  usleep(10000);
193
+	  if (++$count < self::MAX_LOCK_RETRIES) {
194
+		return false;
195
+	  }
196
+	}
197
+	return true;
198 198
   }
199 199
 
200 200
   public function unlock($storageFile)
201 201
   {
202
-    if ($this->fh) {
203
-      flock($this->fh, LOCK_UN);
204
-    }
202
+	if ($this->fh) {
203
+	  flock($this->fh, LOCK_UN);
204
+	}
205 205
   }
206 206
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /*
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     if ($this->acquireReadLock($storageFile)) {
73 73
       if (filesize($storageFile) > 0) {
74 74
         $data = fread($this->fh, filesize($storageFile));
75
-        $data =  unserialize($data);
75
+        $data = unserialize($data);
76 76
       } else {
77 77
         $this->client->getLogger()->debug(
78 78
             'Cache file was empty',
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
   private function getCacheFile($file, $forWrite = false)
138 138
   {
139
-    return $this->getCacheDir($file, $forWrite) . '/' . md5($file);
139
+    return $this->getCacheDir($file, $forWrite).'/'.md5($file);
140 140
   }
141 141
 
142 142
   private function getCacheDir($file, $forWrite)
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
     // use the first 2 characters of the hash as a directory prefix
145 145
     // this should prevent slowdowns due to huge directory listings
146 146
     // and thus give some basic amount of scalability
147
-    $storageDir = $this->path . '/' . substr(md5($file), 0, 2);
148
-    if ($forWrite && ! is_dir($storageDir)) {
149
-      if (! mkdir($storageDir, 0755, true)) {
147
+    $storageDir = $this->path.'/'.substr(md5($file), 0, 2);
148
+    if ($forWrite && !is_dir($storageDir)) {
149
+      if (!mkdir($storageDir, 0755, true)) {
150 150
         $this->client->getLogger()->error(
151 151
             'File cache creation failed',
152 152
             array('dir' => $storageDir)
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Client.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
   /**
193 193
    * @throws Google_Auth_Exception
194
-   * @return array
194
+   * @return string
195 195
    * @visible For Testing
196 196
    */
197 197
   public function prepareScopes()
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
    * @param $audience string the expected consumer of the token
491 491
    * @param $issuer string the expected issuer, defaults to Google
492 492
    * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
493
-   * @return mixed token information if valid, false if not
493
+   * @return Google_Auth_LoginTicket token information if valid, false if not
494 494
    */
495 495
   public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
496 496
   {
@@ -512,6 +512,7 @@  discard block
 block discarded – undo
512 512
    * Will remove any previously configured scopes.
513 513
    * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.login',
514 514
    * 'https://www.googleapis.com/auth/moderator')
515
+   * @param string[] $scopes
515 516
    */
516 517
   public function setScopes($scopes)
517 518
   {
Please login to merge, or discard this patch.
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -74,32 +74,32 @@  discard block
 block discarded – undo
74 74
    */
75 75
   public function __construct($config = null)
76 76
   {
77
-    if (is_string($config) && strlen($config)) {
78
-      $config = new Google_Config($config);
79
-    } else if ( !($config instanceof Google_Config)) {
80
-      $config = new Google_Config();
77
+	if (is_string($config) && strlen($config)) {
78
+	  $config = new Google_Config($config);
79
+	} else if ( !($config instanceof Google_Config)) {
80
+	  $config = new Google_Config();
81 81
 
82
-      if ($this->isAppEngine()) {
83
-        // Automatically use Memcache if we're in AppEngine.
84
-        $config->setCacheClass('Google_Cache_Memcache');
85
-      }
82
+	  if ($this->isAppEngine()) {
83
+		// Automatically use Memcache if we're in AppEngine.
84
+		$config->setCacheClass('Google_Cache_Memcache');
85
+	  }
86 86
 
87
-      if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
88
-        // Automatically disable compress.zlib, as currently unsupported.
89
-        $config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
90
-      }
91
-    }
87
+	  if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
88
+		// Automatically disable compress.zlib, as currently unsupported.
89
+		$config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
90
+	  }
91
+	}
92 92
 
93
-    if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
94
-      if (function_exists('curl_version') && function_exists('curl_exec')
95
-          && !$this->isAppEngine()) {
96
-        $config->setIoClass("Google_IO_Curl");
97
-      } else {
98
-        $config->setIoClass("Google_IO_Stream");
99
-      }
100
-    }
93
+	if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
94
+	  if (function_exists('curl_version') && function_exists('curl_exec')
95
+		  && !$this->isAppEngine()) {
96
+		$config->setIoClass("Google_IO_Curl");
97
+	  } else {
98
+		$config->setIoClass("Google_IO_Stream");
99
+	  }
100
+	}
101 101
 
102
-    $this->config = $config;
102
+	$this->config = $config;
103 103
   }
104 104
 
105 105
   /**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
    */
110 110
   public function getLibraryVersion()
111 111
   {
112
-    return self::LIBVER;
112
+	return self::LIBVER;
113 113
   }
114 114
 
115 115
   /**
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
    */
125 125
   public function authenticate($code, $crossClient = false)
126 126
   {
127
-    $this->authenticated = true;
128
-    return $this->getAuth()->authenticate($code, $crossClient);
127
+	$this->authenticated = true;
128
+	return $this->getAuth()->authenticate($code, $crossClient);
129 129
   }
130 130
   
131 131
   /**
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
    */
142 142
   public function loadServiceAccountJson($jsonLocation, $scopes)
143 143
   {
144
-    $data = json_decode(file_get_contents($jsonLocation));
145
-    if (isset($data->type) && $data->type == 'service_account') {
146
-      // Service Account format.
147
-      $cred = new Google_Auth_AssertionCredentials(
148
-          $data->client_email,
149
-          $scopes,
150
-          $data->private_key
151
-      );
152
-      return $cred;
153
-    } else {
154
-      throw new Google_Exception("Invalid service account JSON file.");
155
-    }
144
+	$data = json_decode(file_get_contents($jsonLocation));
145
+	if (isset($data->type) && $data->type == 'service_account') {
146
+	  // Service Account format.
147
+	  $cred = new Google_Auth_AssertionCredentials(
148
+		  $data->client_email,
149
+		  $scopes,
150
+		  $data->private_key
151
+	  );
152
+	  return $cred;
153
+	} else {
154
+	  throw new Google_Exception("Invalid service account JSON file.");
155
+	}
156 156
   }
157 157
 
158 158
   /**
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
    */
166 166
   public function setAuthConfig($json)
167 167
   {
168
-    $data = json_decode($json);
169
-    $key = isset($data->installed) ? 'installed' : 'web';
170
-    if (!isset($data->$key)) {
171
-      throw new Google_Exception("Invalid client secret JSON file.");
172
-    }
173
-    $this->setClientId($data->$key->client_id);
174
-    $this->setClientSecret($data->$key->client_secret);
175
-    if (isset($data->$key->redirect_uris)) {
176
-      $this->setRedirectUri($data->$key->redirect_uris[0]);
177
-    }
168
+	$data = json_decode($json);
169
+	$key = isset($data->installed) ? 'installed' : 'web';
170
+	if (!isset($data->$key)) {
171
+	  throw new Google_Exception("Invalid client secret JSON file.");
172
+	}
173
+	$this->setClientId($data->$key->client_id);
174
+	$this->setClientSecret($data->$key->client_secret);
175
+	if (isset($data->$key->redirect_uris)) {
176
+	  $this->setRedirectUri($data->$key->redirect_uris[0]);
177
+	}
178 178
   }
179 179
 
180 180
   /**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
    */
187 187
   public function setAuthConfigFile($file)
188 188
   {
189
-    $this->setAuthConfig(file_get_contents($file));
189
+	$this->setAuthConfig(file_get_contents($file));
190 190
   }
191 191
 
192 192
   /**
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
    */
197 197
   public function prepareScopes()
198 198
   {
199
-    if (empty($this->requestedScopes)) {
200
-      throw new Google_Auth_Exception("No scopes specified");
201
-    }
202
-    $scopes = implode(' ', $this->requestedScopes);
203
-    return $scopes;
199
+	if (empty($this->requestedScopes)) {
200
+	  throw new Google_Auth_Exception("No scopes specified");
201
+	}
202
+	$scopes = implode(' ', $this->requestedScopes);
203
+	return $scopes;
204 204
   }
205 205
 
206 206
   /**
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
    */
213 213
   public function setAccessToken($accessToken)
214 214
   {
215
-    if ($accessToken == 'null') {
216
-      $accessToken = null;
217
-    }
218
-    $this->getAuth()->setAccessToken($accessToken);
215
+	if ($accessToken == 'null') {
216
+	  $accessToken = null;
217
+	}
218
+	$this->getAuth()->setAccessToken($accessToken);
219 219
   }
220 220
 
221 221
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
    */
227 227
   public function setAuth(Google_Auth_Abstract $auth)
228 228
   {
229
-    $this->config->setAuthClass(get_class($auth));
230
-    $this->auth = $auth;
229
+	$this->config->setAuthClass(get_class($auth));
230
+	$this->auth = $auth;
231 231
   }
232 232
 
233 233
   /**
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
    */
237 237
   public function setIo(Google_IO_Abstract $io)
238 238
   {
239
-    $this->config->setIoClass(get_class($io));
240
-    $this->io = $io;
239
+	$this->config->setIoClass(get_class($io));
240
+	$this->io = $io;
241 241
   }
242 242
 
243 243
   /**
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
    */
247 247
   public function setCache(Google_Cache_Abstract $cache)
248 248
   {
249
-    $this->config->setCacheClass(get_class($cache));
250
-    $this->cache = $cache;
249
+	$this->config->setCacheClass(get_class($cache));
250
+	$this->cache = $cache;
251 251
   }
252 252
 
253 253
   /**
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
    */
257 257
   public function setLogger(Google_Logger_Abstract $logger)
258 258
   {
259
-    $this->config->setLoggerClass(get_class($logger));
260
-    $this->logger = $logger;
259
+	$this->config->setLoggerClass(get_class($logger));
260
+	$this->logger = $logger;
261 261
   }
262 262
 
263 263
   /**
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
    */
267 267
   public function createAuthUrl()
268 268
   {
269
-    $scopes = $this->prepareScopes();
270
-    return $this->getAuth()->createAuthUrl($scopes);
269
+	$scopes = $this->prepareScopes();
270
+	return $this->getAuth()->createAuthUrl($scopes);
271 271
   }
272 272
 
273 273
   /**
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
    */
279 279
   public function getAccessToken()
280 280
   {
281
-    $token = $this->getAuth()->getAccessToken();
282
-    // The response is json encoded, so could be the string null.
283
-    // It is arguable whether this check should be here or lower
284
-    // in the library.
285
-    return (null == $token || 'null' == $token || '[]' == $token) ? null : $token;
281
+	$token = $this->getAuth()->getAccessToken();
282
+	// The response is json encoded, so could be the string null.
283
+	// It is arguable whether this check should be here or lower
284
+	// in the library.
285
+	return (null == $token || 'null' == $token || '[]' == $token) ? null : $token;
286 286
   }
287 287
 
288 288
   /**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
    */
292 292
   public function getRefreshToken()
293 293
   {
294
-    return $this->getAuth()->getRefreshToken();
294
+	return $this->getAuth()->getRefreshToken();
295 295
   }
296 296
 
297 297
   /**
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
    */
301 301
   public function isAccessTokenExpired()
302 302
   {
303
-    return $this->getAuth()->isAccessTokenExpired();
303
+	return $this->getAuth()->isAccessTokenExpired();
304 304
   }
305 305
 
306 306
   /**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
    */
311 311
   public function setState($state)
312 312
   {
313
-    $this->getAuth()->setState($state);
313
+	$this->getAuth()->setState($state);
314 314
   }
315 315
 
316 316
   /**
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
    */
321 321
   public function setAccessType($accessType)
322 322
   {
323
-    $this->config->setAccessType($accessType);
323
+	$this->config->setAccessType($accessType);
324 324
   }
325 325
 
326 326
   /**
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
    */
331 331
   public function setApprovalPrompt($approvalPrompt)
332 332
   {
333
-    $this->config->setApprovalPrompt($approvalPrompt);
333
+	$this->config->setApprovalPrompt($approvalPrompt);
334 334
   }
335 335
 
336 336
   /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
    */
340 340
   public function setLoginHint($loginHint)
341 341
   {
342
-      $this->config->setLoginHint($loginHint);
342
+	  $this->config->setLoginHint($loginHint);
343 343
   }
344 344
 
345 345
   /**
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
    */
349 349
   public function setApplicationName($applicationName)
350 350
   {
351
-    $this->config->setApplicationName($applicationName);
351
+	$this->config->setApplicationName($applicationName);
352 352
   }
353 353
 
354 354
   /**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
    */
358 358
   public function setClientId($clientId)
359 359
   {
360
-    $this->config->setClientId($clientId);
360
+	$this->config->setClientId($clientId);
361 361
   }
362 362
 
363 363
   /**
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
    */
367 367
   public function setClientSecret($clientSecret)
368 368
   {
369
-    $this->config->setClientSecret($clientSecret);
369
+	$this->config->setClientSecret($clientSecret);
370 370
   }
371 371
 
372 372
   /**
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
    */
376 376
   public function setRedirectUri($redirectUri)
377 377
   {
378
-    $this->config->setRedirectUri($redirectUri);
378
+	$this->config->setRedirectUri($redirectUri);
379 379
   }
380 380
 
381 381
   /**
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
    */
389 389
   public function setRequestVisibleActions($requestVisibleActions)
390 390
   {
391
-    if (is_array($requestVisibleActions)) {
392
-      $requestVisibleActions = join(" ", $requestVisibleActions);
393
-    }
394
-    $this->config->setRequestVisibleActions($requestVisibleActions);
391
+	if (is_array($requestVisibleActions)) {
392
+	  $requestVisibleActions = join(" ", $requestVisibleActions);
393
+	}
394
+	$this->config->setRequestVisibleActions($requestVisibleActions);
395 395
   }
396 396
 
397 397
   /**
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
    */
402 402
   public function setDeveloperKey($developerKey)
403 403
   {
404
-    $this->config->setDeveloperKey($developerKey);
404
+	$this->config->setDeveloperKey($developerKey);
405 405
   }
406 406
 
407 407
   /**
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
    */
413 413
   public function setHostedDomain($hd)
414 414
   {
415
-    $this->config->setHostedDomain($hd);
415
+	$this->config->setHostedDomain($hd);
416 416
   }
417 417
 
418 418
   /**
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
    */
424 424
   public function setPrompt($prompt)
425 425
   {
426
-    $this->config->setPrompt($prompt);
426
+	$this->config->setPrompt($prompt);
427 427
   }
428 428
 
429 429
   /**
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
    */
435 435
   public function setOpenidRealm($realm)
436 436
   {
437
-    $this->config->setOpenidRealm($realm);
437
+	$this->config->setOpenidRealm($realm);
438 438
   }
439 439
 
440 440
   /**
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
    */
446 446
   public function setIncludeGrantedScopes($include)
447 447
   {
448
-    $this->config->setIncludeGrantedScopes($include);
448
+	$this->config->setIncludeGrantedScopes($include);
449 449
   }
450 450
 
451 451
   /**
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
    */
455 455
   public function refreshToken($refreshToken)
456 456
   {
457
-    $this->getAuth()->refreshToken($refreshToken);
457
+	$this->getAuth()->refreshToken($refreshToken);
458 458
   }
459 459
 
460 460
   /**
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
    */
467 467
   public function revokeToken($token = null)
468 468
   {
469
-    return $this->getAuth()->revokeToken($token);
469
+	return $this->getAuth()->revokeToken($token);
470 470
   }
471 471
 
472 472
   /**
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
    */
480 480
   public function verifyIdToken($token = null)
481 481
   {
482
-    return $this->getAuth()->verifyIdToken($token);
482
+	return $this->getAuth()->verifyIdToken($token);
483 483
   }
484 484
 
485 485
   /**
@@ -494,9 +494,9 @@  discard block
 block discarded – undo
494 494
    */
495 495
   public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
496 496
   {
497
-    $auth = new Google_Auth_OAuth2($this);
498
-    $certs = $auth->retrieveCertsFromLocation($cert_location);
499
-    return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
497
+	$auth = new Google_Auth_OAuth2($this);
498
+	$certs = $auth->retrieveCertsFromLocation($cert_location);
499
+	return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
500 500
   }
501 501
 
502 502
   /**
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
    */
505 505
   public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
506 506
   {
507
-    $this->getAuth()->setAssertionCredentials($creds);
507
+	$this->getAuth()->setAssertionCredentials($creds);
508 508
   }
509 509
 
510 510
   /**
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
    */
516 516
   public function setScopes($scopes)
517 517
   {
518
-    $this->requestedScopes = array();
519
-    $this->addScope($scopes);
518
+	$this->requestedScopes = array();
519
+	$this->addScope($scopes);
520 520
   }
521 521
 
522 522
   /**
@@ -528,13 +528,13 @@  discard block
 block discarded – undo
528 528
    */
529 529
   public function addScope($scope_or_scopes)
530 530
   {
531
-    if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
532
-      $this->requestedScopes[] = $scope_or_scopes;
533
-    } else if (is_array($scope_or_scopes)) {
534
-      foreach ($scope_or_scopes as $scope) {
535
-        $this->addScope($scope);
536
-      }
537
-    }
531
+	if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
532
+	  $this->requestedScopes[] = $scope_or_scopes;
533
+	} else if (is_array($scope_or_scopes)) {
534
+	  foreach ($scope_or_scopes as $scope) {
535
+		$this->addScope($scope);
536
+	  }
537
+	}
538 538
   }
539 539
 
540 540
   /**
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
    */
545 545
   public function getScopes()
546 546
   {
547
-     return $this->requestedScopes;
547
+	 return $this->requestedScopes;
548 548
   }
549 549
 
550 550
   /**
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
    */
557 557
   public function setUseBatch($useBatch)
558 558
   {
559
-    // This is actually an alias for setDefer.
560
-    $this->setDefer($useBatch);
559
+	// This is actually an alias for setDefer.
560
+	$this->setDefer($useBatch);
561 561
   }
562 562
 
563 563
   /**
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
    */
569 569
   public function setDefer($defer)
570 570
   {
571
-    $this->deferExecution = $defer;
571
+	$this->deferExecution = $defer;
572 572
   }
573 573
 
574 574
   /**
@@ -580,22 +580,22 @@  discard block
 block discarded – undo
580 580
    */
581 581
   public function execute($request)
582 582
   {
583
-    if ($request instanceof Google_Http_Request) {
584
-      $request->setUserAgent(
585
-          $this->getApplicationName()
586
-          . " " . self::USER_AGENT_SUFFIX
587
-          . $this->getLibraryVersion()
588
-      );
589
-      if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
590
-        $request->enableGzip();
591
-      }
592
-      $request->maybeMoveParametersToBody();
593
-      return Google_Http_REST::execute($this, $request);
594
-    } else if ($request instanceof Google_Http_Batch) {
595
-      return $request->execute();
596
-    } else {
597
-      throw new Google_Exception("Do not know how to execute this type of object.");
598
-    }
583
+	if ($request instanceof Google_Http_Request) {
584
+	  $request->setUserAgent(
585
+		  $this->getApplicationName()
586
+		  . " " . self::USER_AGENT_SUFFIX
587
+		  . $this->getLibraryVersion()
588
+	  );
589
+	  if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
590
+		$request->enableGzip();
591
+	  }
592
+	  $request->maybeMoveParametersToBody();
593
+	  return Google_Http_REST::execute($this, $request);
594
+	} else if ($request instanceof Google_Http_Batch) {
595
+	  return $request->execute();
596
+	} else {
597
+	  throw new Google_Exception("Do not know how to execute this type of object.");
598
+	}
599 599
   }
600 600
 
601 601
   /**
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
    */
605 605
   public function shouldDefer()
606 606
   {
607
-    return $this->deferExecution;
607
+	return $this->deferExecution;
608 608
   }
609 609
 
610 610
   /**
@@ -612,11 +612,11 @@  discard block
 block discarded – undo
612 612
    */
613 613
   public function getAuth()
614 614
   {
615
-    if (!isset($this->auth)) {
616
-      $class = $this->config->getAuthClass();
617
-      $this->auth = new $class($this);
618
-    }
619
-    return $this->auth;
615
+	if (!isset($this->auth)) {
616
+	  $class = $this->config->getAuthClass();
617
+	  $this->auth = new $class($this);
618
+	}
619
+	return $this->auth;
620 620
   }
621 621
 
622 622
   /**
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
    */
625 625
   public function getIo()
626 626
   {
627
-    if (!isset($this->io)) {
628
-      $class = $this->config->getIoClass();
629
-      $this->io = new $class($this);
630
-    }
631
-    return $this->io;
627
+	if (!isset($this->io)) {
628
+	  $class = $this->config->getIoClass();
629
+	  $this->io = new $class($this);
630
+	}
631
+	return $this->io;
632 632
   }
633 633
 
634 634
   /**
@@ -636,11 +636,11 @@  discard block
 block discarded – undo
636 636
    */
637 637
   public function getCache()
638 638
   {
639
-    if (!isset($this->cache)) {
640
-      $class = $this->config->getCacheClass();
641
-      $this->cache = new $class($this);
642
-    }
643
-    return $this->cache;
639
+	if (!isset($this->cache)) {
640
+	  $class = $this->config->getCacheClass();
641
+	  $this->cache = new $class($this);
642
+	}
643
+	return $this->cache;
644 644
   }
645 645
 
646 646
   /**
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
    */
649 649
   public function getLogger()
650 650
   {
651
-    if (!isset($this->logger)) {
652
-      $class = $this->config->getLoggerClass();
653
-      $this->logger = new $class($this);
654
-    }
655
-    return $this->logger;
651
+	if (!isset($this->logger)) {
652
+	  $class = $this->config->getLoggerClass();
653
+	  $this->logger = new $class($this);
654
+	}
655
+	return $this->logger;
656 656
   }
657 657
 
658 658
   /**
@@ -663,10 +663,10 @@  discard block
 block discarded – undo
663 663
    */
664 664
   public function getClassConfig($class, $key = null)
665 665
   {
666
-    if (!is_string($class)) {
667
-      $class = get_class($class);
668
-    }
669
-    return $this->config->getClassConfig($class, $key);
666
+	if (!is_string($class)) {
667
+	  $class = get_class($class);
668
+	}
669
+	return $this->config->getClassConfig($class, $key);
670 670
   }
671 671
 
672 672
   /**
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
    */
681 681
   public function setClassConfig($class, $config, $value = null)
682 682
   {
683
-    if (!is_string($class)) {
684
-      $class = get_class($class);
685
-    }
686
-    $this->config->setClassConfig($class, $config, $value);
683
+	if (!is_string($class)) {
684
+	  $class = get_class($class);
685
+	}
686
+	$this->config->setClassConfig($class, $config, $value);
687 687
 
688 688
   }
689 689
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
    */
693 693
   public function getBasePath()
694 694
   {
695
-    return $this->config->getBasePath();
695
+	return $this->config->getBasePath();
696 696
   }
697 697
 
698 698
   /**
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
    */
701 701
   public function getApplicationName()
702 702
   {
703
-    return $this->config->getApplicationName();
703
+	return $this->config->getApplicationName();
704 704
   }
705 705
 
706 706
   /**
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
    */
710 710
   public function isAppEngine()
711 711
   {
712
-    return (isset($_SERVER['SERVER_SOFTWARE']) &&
713
-        strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
712
+	return (isset($_SERVER['SERVER_SOFTWARE']) &&
713
+		strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
714 714
   }
715 715
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/autoload.php';
19
+  require_once dirname(__FILE__).'/autoload.php';
20 20
 }
21 21
 
22 22
 /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
   {
77 77
     if (is_string($config) && strlen($config)) {
78 78
       $config = new Google_Config($config);
79
-    } else if ( !($config instanceof Google_Config)) {
79
+    } else if (!($config instanceof Google_Config)) {
80 80
       $config = new Google_Config();
81 81
 
82 82
       if ($this->isAppEngine()) {
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
     if ($request instanceof Google_Http_Request) {
584 584
       $request->setUserAgent(
585 585
           $this->getApplicationName()
586
-          . " " . self::USER_AGENT_SUFFIX
586
+          . " ".self::USER_AGENT_SUFFIX
587 587
           . $this->getLibraryVersion()
588 588
       );
589 589
       if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Http/Request.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
   
80 80
   /**
81 81
    * Set the base URL that path and query parameters will be added to.
82
-   * @param $baseComponent string
82
+   * @param string $baseComponent string
83 83
    */
84 84
   public function setBaseComponent($baseComponent)
85 85
   {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
   /**
134 134
    * Set a new query parameter.
135
-   * @param $key - string to set, does not need to be URL encoded
135
+   * @param string $key - string to set, does not need to be URL encoded
136 136
    * @param $value - string to set, does not need to be URL encoded
137 137
    */
138 138
   public function setQueryParam($key, $value)
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
   }
142 142
 
143 143
   /**
144
-   * @return string HTTP Response Code.
144
+   * @return integer HTTP Response Code.
145 145
    */
146 146
   public function getResponseHttpCode()
147 147
   {
Please login to merge, or discard this patch.
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
   const GZIP_UA = " (gzip)";
33 33
 
34 34
   private $batchHeaders = array(
35
-    'Content-Type' => 'application/http',
36
-    'Content-Transfer-Encoding' => 'binary',
37
-    'MIME-Version' => '1.0',
35
+	'Content-Type' => 'application/http',
36
+	'Content-Transfer-Encoding' => 'binary',
37
+	'MIME-Version' => '1.0',
38 38
   );
39 39
 
40 40
   protected $queryParams;
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
   public $accessKey;
57 57
 
58 58
   public function __construct(
59
-      $url,
60
-      $method = 'GET',
61
-      $headers = array(),
62
-      $postBody = null
59
+	  $url,
60
+	  $method = 'GET',
61
+	  $headers = array(),
62
+	  $postBody = null
63 63
   ) {
64
-    $this->setUrl($url);
65
-    $this->setRequestMethod($method);
66
-    $this->setRequestHeaders($headers);
67
-    $this->setPostBody($postBody);
64
+	$this->setUrl($url);
65
+	$this->setRequestMethod($method);
66
+	$this->setRequestHeaders($headers);
67
+	$this->setPostBody($postBody);
68 68
   }
69 69
 
70 70
   /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
    */
75 75
   public function getBaseComponent()
76 76
   {
77
-    return $this->baseComponent;
77
+	return $this->baseComponent;
78 78
   }
79 79
   
80 80
   /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
    */
84 84
   public function setBaseComponent($baseComponent)
85 85
   {
86
-    $this->baseComponent = rtrim($baseComponent, '/');
86
+	$this->baseComponent = rtrim($baseComponent, '/');
87 87
   }
88 88
   
89 89
   /**
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
    */
92 92
   public function enableGzip()
93 93
   {
94
-    $this->setRequestHeaders(array("Accept-Encoding" => "gzip"));
95
-    $this->canGzip = true;
96
-    $this->setUserAgent($this->userAgent);
94
+	$this->setRequestHeaders(array("Accept-Encoding" => "gzip"));
95
+	$this->canGzip = true;
96
+	$this->setUserAgent($this->userAgent);
97 97
   }
98 98
   
99 99
   /**
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
    */
102 102
   public function disableGzip()
103 103
   {
104
-    if (
105
-        isset($this->requestHeaders['accept-encoding']) &&
106
-        $this->requestHeaders['accept-encoding'] == "gzip"
107
-    ) {
108
-      unset($this->requestHeaders['accept-encoding']);
109
-    }
110
-    $this->canGzip = false;
111
-    $this->userAgent = str_replace(self::GZIP_UA, "", $this->userAgent);
104
+	if (
105
+		isset($this->requestHeaders['accept-encoding']) &&
106
+		$this->requestHeaders['accept-encoding'] == "gzip"
107
+	) {
108
+	  unset($this->requestHeaders['accept-encoding']);
109
+	}
110
+	$this->canGzip = false;
111
+	$this->userAgent = str_replace(self::GZIP_UA, "", $this->userAgent);
112 112
   }
113 113
   
114 114
   /**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
    */
118 118
   public function canGzip()
119 119
   {
120
-    return $this->canGzip;
120
+	return $this->canGzip;
121 121
   }
122 122
 
123 123
   /**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
    */
128 128
   public function getQueryParams()
129 129
   {
130
-    return $this->queryParams;
130
+	return $this->queryParams;
131 131
   }
132 132
 
133 133
   /**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
    */
138 138
   public function setQueryParam($key, $value)
139 139
   {
140
-    $this->queryParams[$key] = $value;
140
+	$this->queryParams[$key] = $value;
141 141
   }
142 142
 
143 143
   /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
    */
146 146
   public function getResponseHttpCode()
147 147
   {
148
-    return (int) $this->responseHttpCode;
148
+	return (int) $this->responseHttpCode;
149 149
   }
150 150
 
151 151
   /**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
    */
154 154
   public function setResponseHttpCode($responseHttpCode)
155 155
   {
156
-    $this->responseHttpCode = $responseHttpCode;
156
+	$this->responseHttpCode = $responseHttpCode;
157 157
   }
158 158
 
159 159
   /**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
    */
162 162
   public function getResponseHeaders()
163 163
   {
164
-    return $this->responseHeaders;
164
+	return $this->responseHeaders;
165 165
   }
166 166
 
167 167
   /**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
    */
170 170
   public function getResponseBody()
171 171
   {
172
-    return $this->responseBody;
172
+	return $this->responseBody;
173 173
   }
174 174
   
175 175
   /**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
    */
180 180
   public function setExpectedClass($class)
181 181
   {
182
-    $this->expectedClass = $class;
182
+	$this->expectedClass = $class;
183 183
   }
184 184
   
185 185
   /**
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
    */
189 189
   public function getExpectedClass()
190 190
   {
191
-    return $this->expectedClass;
191
+	return $this->expectedClass;
192 192
   }
193 193
 
194 194
   /**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
    */
197 197
   public function enableExpectedRaw()
198 198
   {
199
-    $this->expectedRaw = true;
199
+	$this->expectedRaw = true;
200 200
   }
201 201
 
202 202
   /**
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
    */
205 205
   public function disableExpectedRaw()
206 206
   {
207
-    $this->expectedRaw = false;
207
+	$this->expectedRaw = false;
208 208
   }
209 209
 
210 210
   /**
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
    */
214 214
   public function getExpectedRaw()
215 215
   {
216
-    return $this->expectedRaw;
216
+	return $this->expectedRaw;
217 217
   }
218 218
 
219 219
   /**
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
    */
223 223
   public function setResponseHeaders($headers)
224 224
   {
225
-    $headers = Google_Utils::normalize($headers);
226
-    if ($this->responseHeaders) {
227
-      $headers = array_merge($this->responseHeaders, $headers);
228
-    }
225
+	$headers = Google_Utils::normalize($headers);
226
+	if ($this->responseHeaders) {
227
+	  $headers = array_merge($this->responseHeaders, $headers);
228
+	}
229 229
 
230
-    $this->responseHeaders = $headers;
230
+	$this->responseHeaders = $headers;
231 231
   }
232 232
 
233 233
   /**
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
    */
238 238
   public function getResponseHeader($key)
239 239
   {
240
-    return isset($this->responseHeaders[$key])
241
-        ? $this->responseHeaders[$key]
242
-        : false;
240
+	return isset($this->responseHeaders[$key])
241
+		? $this->responseHeaders[$key]
242
+		: false;
243 243
   }
244 244
 
245 245
   /**
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
    */
248 248
   public function setResponseBody($responseBody)
249 249
   {
250
-    $this->responseBody = $responseBody;
250
+	$this->responseBody = $responseBody;
251 251
   }
252 252
 
253 253
   /**
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
    */
256 256
   public function getUrl()
257 257
   {
258
-    return $this->baseComponent . $this->path .
259
-        (count($this->queryParams) ?
260
-            "?" . $this->buildQuery($this->queryParams) :
261
-            '');
258
+	return $this->baseComponent . $this->path .
259
+		(count($this->queryParams) ?
260
+			"?" . $this->buildQuery($this->queryParams) :
261
+			'');
262 262
   }
263 263
 
264 264
   /**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
    */
267 267
   public function getRequestMethod()
268 268
   {
269
-    return $this->requestMethod;
269
+	return $this->requestMethod;
270 270
   }
271 271
 
272 272
   /**
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
    */
275 275
   public function getRequestHeaders()
276 276
   {
277
-    return $this->requestHeaders;
277
+	return $this->requestHeaders;
278 278
   }
279 279
 
280 280
   /**
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
    */
285 285
   public function getRequestHeader($key)
286 286
   {
287
-    return isset($this->requestHeaders[$key])
288
-        ? $this->requestHeaders[$key]
289
-        : false;
287
+	return isset($this->requestHeaders[$key])
288
+		? $this->requestHeaders[$key]
289
+		: false;
290 290
   }
291 291
 
292 292
   /**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
    */
295 295
   public function getPostBody()
296 296
   {
297
-    return $this->postBody;
297
+	return $this->postBody;
298 298
   }
299 299
 
300 300
   /**
@@ -302,26 +302,26 @@  discard block
 block discarded – undo
302 302
    */
303 303
   public function setUrl($url)
304 304
   {
305
-    if (substr($url, 0, 4) != 'http') {
306
-      // Force the path become relative.
307
-      if (substr($url, 0, 1) !== '/') {
308
-        $url = '/' . $url;
309
-      }
310
-    }
311
-    $parts = parse_url($url);
312
-    if (isset($parts['host'])) {
313
-      $this->baseComponent = sprintf(
314
-          "%s%s%s",
315
-          isset($parts['scheme']) ? $parts['scheme'] . "://" : '',
316
-          isset($parts['host']) ? $parts['host'] : '',
317
-          isset($parts['port']) ? ":" . $parts['port'] : ''
318
-      );
319
-    }
320
-    $this->path = isset($parts['path']) ? $parts['path'] : '';
321
-    $this->queryParams = array();
322
-    if (isset($parts['query'])) {
323
-      $this->queryParams = $this->parseQuery($parts['query']);
324
-    }
305
+	if (substr($url, 0, 4) != 'http') {
306
+	  // Force the path become relative.
307
+	  if (substr($url, 0, 1) !== '/') {
308
+		$url = '/' . $url;
309
+	  }
310
+	}
311
+	$parts = parse_url($url);
312
+	if (isset($parts['host'])) {
313
+	  $this->baseComponent = sprintf(
314
+		  "%s%s%s",
315
+		  isset($parts['scheme']) ? $parts['scheme'] . "://" : '',
316
+		  isset($parts['host']) ? $parts['host'] : '',
317
+		  isset($parts['port']) ? ":" . $parts['port'] : ''
318
+	  );
319
+	}
320
+	$this->path = isset($parts['path']) ? $parts['path'] : '';
321
+	$this->queryParams = array();
322
+	if (isset($parts['query'])) {
323
+	  $this->queryParams = $this->parseQuery($parts['query']);
324
+	}
325 325
   }
326 326
 
327 327
   /**
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
    */
332 332
   public function setRequestMethod($method)
333 333
   {
334
-    $this->requestMethod = strtoupper($method);
334
+	$this->requestMethod = strtoupper($method);
335 335
   }
336 336
 
337 337
   /**
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
    */
341 341
   public function setRequestHeaders($headers)
342 342
   {
343
-    $headers = Google_Utils::normalize($headers);
344
-    if ($this->requestHeaders) {
345
-      $headers = array_merge($this->requestHeaders, $headers);
346
-    }
347
-    $this->requestHeaders = $headers;
343
+	$headers = Google_Utils::normalize($headers);
344
+	if ($this->requestHeaders) {
345
+	  $headers = array_merge($this->requestHeaders, $headers);
346
+	}
347
+	$this->requestHeaders = $headers;
348 348
   }
349 349
 
350 350
   /**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
    */
353 353
   public function setPostBody($postBody)
354 354
   {
355
-    $this->postBody = $postBody;
355
+	$this->postBody = $postBody;
356 356
   }
357 357
 
358 358
   /**
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
    */
362 362
   public function setUserAgent($userAgent)
363 363
   {
364
-    $this->userAgent = $userAgent;
365
-    if ($this->canGzip) {
366
-      $this->userAgent = $userAgent . self::GZIP_UA;
367
-    }
364
+	$this->userAgent = $userAgent;
365
+	if ($this->canGzip) {
366
+	  $this->userAgent = $userAgent . self::GZIP_UA;
367
+	}
368 368
   }
369 369
 
370 370
   /**
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
    */
373 373
   public function getUserAgent()
374 374
   {
375
-    return $this->userAgent;
375
+	return $this->userAgent;
376 376
   }
377 377
 
378 378
   /**
@@ -383,29 +383,29 @@  discard block
 block discarded – undo
383 383
    */
384 384
   public function getCacheKey()
385 385
   {
386
-    $key = $this->getUrl();
386
+	$key = $this->getUrl();
387 387
 
388
-    if (isset($this->accessKey)) {
389
-      $key .= $this->accessKey;
390
-    }
388
+	if (isset($this->accessKey)) {
389
+	  $key .= $this->accessKey;
390
+	}
391 391
 
392
-    if (isset($this->requestHeaders['authorization'])) {
393
-      $key .= $this->requestHeaders['authorization'];
394
-    }
392
+	if (isset($this->requestHeaders['authorization'])) {
393
+	  $key .= $this->requestHeaders['authorization'];
394
+	}
395 395
 
396
-    return md5($key);
396
+	return md5($key);
397 397
   }
398 398
 
399 399
   public function getParsedCacheControl()
400 400
   {
401
-    $parsed = array();
402
-    $rawCacheControl = $this->getResponseHeader('cache-control');
403
-    if ($rawCacheControl) {
404
-      $rawCacheControl = str_replace(', ', '&', $rawCacheControl);
405
-      parse_str($rawCacheControl, $parsed);
406
-    }
401
+	$parsed = array();
402
+	$rawCacheControl = $this->getResponseHeader('cache-control');
403
+	if ($rawCacheControl) {
404
+	  $rawCacheControl = str_replace(', ', '&', $rawCacheControl);
405
+	  parse_str($rawCacheControl, $parsed);
406
+	}
407 407
 
408
-    return $parsed;
408
+	return $parsed;
409 409
   }
410 410
 
411 411
   /**
@@ -414,29 +414,29 @@  discard block
 block discarded – undo
414 414
    */
415 415
   public function toBatchString($id)
416 416
   {
417
-    $str = '';
418
-    $path = parse_url($this->getUrl(), PHP_URL_PATH) . "?" .
419
-        http_build_query($this->queryParams);
420
-    $str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";
417
+	$str = '';
418
+	$path = parse_url($this->getUrl(), PHP_URL_PATH) . "?" .
419
+		http_build_query($this->queryParams);
420
+	$str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";
421 421
 
422
-    foreach ($this->getRequestHeaders() as $key => $val) {
423
-      $str .= $key . ': ' . $val . "\n";
424
-    }
422
+	foreach ($this->getRequestHeaders() as $key => $val) {
423
+	  $str .= $key . ': ' . $val . "\n";
424
+	}
425 425
 
426
-    if ($this->getPostBody()) {
427
-      $str .= "\n";
428
-      $str .= $this->getPostBody();
429
-    }
426
+	if ($this->getPostBody()) {
427
+	  $str .= "\n";
428
+	  $str .= $this->getPostBody();
429
+	}
430 430
     
431
-    $headers = '';
432
-    foreach ($this->batchHeaders as $key => $val) {
433
-      $headers .= $key . ': ' . $val . "\n";
434
-    }
431
+	$headers = '';
432
+	foreach ($this->batchHeaders as $key => $val) {
433
+	  $headers .= $key . ': ' . $val . "\n";
434
+	}
435 435
 
436
-    $headers .= "Content-ID: $id\n";
437
-    $str = $headers . "\n" . $str;
436
+	$headers .= "Content-ID: $id\n";
437
+	$str = $headers . "\n" . $str;
438 438
 
439
-    return $str;
439
+	return $str;
440 440
   }
441 441
   
442 442
   /**
@@ -446,21 +446,21 @@  discard block
 block discarded – undo
446 446
    */
447 447
   private function parseQuery($string)
448 448
   {
449
-    $return = array();
450
-    $parts = explode("&", $string);
451
-    foreach ($parts as $part) {
452
-      list($key, $value) = explode('=', $part, 2);
453
-      $value = urldecode($value);
454
-      if (isset($return[$key])) {
455
-        if (!is_array($return[$key])) {
456
-          $return[$key] = array($return[$key]);
457
-        }
458
-        $return[$key][] = $value;
459
-      } else {
460
-        $return[$key] = $value;
461
-      }
462
-    }
463
-    return $return;
449
+	$return = array();
450
+	$parts = explode("&", $string);
451
+	foreach ($parts as $part) {
452
+	  list($key, $value) = explode('=', $part, 2);
453
+	  $value = urldecode($value);
454
+	  if (isset($return[$key])) {
455
+		if (!is_array($return[$key])) {
456
+		  $return[$key] = array($return[$key]);
457
+		}
458
+		$return[$key][] = $value;
459
+	  } else {
460
+		$return[$key] = $value;
461
+	  }
462
+	}
463
+	return $return;
464 464
   }
465 465
   
466 466
   /**
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
    */
471 471
   private function buildQuery($parts)
472 472
   {
473
-    $return = array();
474
-    foreach ($parts as $key => $value) {
475
-      if (is_array($value)) {
476
-        foreach ($value as $v) {
477
-          $return[] = urlencode($key) . "=" . urlencode($v);
478
-        }
479
-      } else {
480
-        $return[] = urlencode($key) . "=" . urlencode($value);
481
-      }
482
-    }
483
-    return implode('&', $return);
473
+	$return = array();
474
+	foreach ($parts as $key => $value) {
475
+	  if (is_array($value)) {
476
+		foreach ($value as $v) {
477
+		  $return[] = urlencode($key) . "=" . urlencode($v);
478
+		}
479
+	  } else {
480
+		$return[] = urlencode($key) . "=" . urlencode($value);
481
+	  }
482
+	}
483
+	return implode('&', $return);
484 484
   }
485 485
   
486 486
   /**
@@ -490,15 +490,15 @@  discard block
 block discarded – undo
490 490
    */
491 491
   public function maybeMoveParametersToBody()
492 492
   {
493
-    if ($this->getRequestMethod() == "POST" && empty($this->postBody)) {
494
-      $this->setRequestHeaders(
495
-          array(
496
-            "content-type" =>
497
-                "application/x-www-form-urlencoded; charset=UTF-8"
498
-          )
499
-      );
500
-      $this->setPostBody($this->buildQuery($this->queryParams));
501
-      $this->queryParams = array();
502
-    }
493
+	if ($this->getRequestMethod() == "POST" && empty($this->postBody)) {
494
+	  $this->setRequestHeaders(
495
+		  array(
496
+			"content-type" =>
497
+				"application/x-www-form-urlencoded; charset=UTF-8"
498
+		  )
499
+	  );
500
+	  $this->setPostBody($this->buildQuery($this->queryParams));
501
+	  $this->queryParams = array();
502
+	}
503 503
   }
504 504
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
@@ -255,10 +255,9 @@  discard block
 block discarded – undo
255 255
    */
256 256
   public function getUrl()
257 257
   {
258
-    return $this->baseComponent . $this->path .
258
+    return $this->baseComponent.$this->path.
259 259
         (count($this->queryParams) ?
260
-            "?" . $this->buildQuery($this->queryParams) :
261
-            '');
260
+            "?".$this->buildQuery($this->queryParams) : '');
262 261
   }
263 262
 
264 263
   /**
@@ -305,16 +304,16 @@  discard block
 block discarded – undo
305 304
     if (substr($url, 0, 4) != 'http') {
306 305
       // Force the path become relative.
307 306
       if (substr($url, 0, 1) !== '/') {
308
-        $url = '/' . $url;
307
+        $url = '/'.$url;
309 308
       }
310 309
     }
311 310
     $parts = parse_url($url);
312 311
     if (isset($parts['host'])) {
313 312
       $this->baseComponent = sprintf(
314 313
           "%s%s%s",
315
-          isset($parts['scheme']) ? $parts['scheme'] . "://" : '',
314
+          isset($parts['scheme']) ? $parts['scheme']."://" : '',
316 315
           isset($parts['host']) ? $parts['host'] : '',
317
-          isset($parts['port']) ? ":" . $parts['port'] : ''
316
+          isset($parts['port']) ? ":".$parts['port'] : ''
318 317
       );
319 318
     }
320 319
     $this->path = isset($parts['path']) ? $parts['path'] : '';
@@ -363,7 +362,7 @@  discard block
 block discarded – undo
363 362
   {
364 363
     $this->userAgent = $userAgent;
365 364
     if ($this->canGzip) {
366
-      $this->userAgent = $userAgent . self::GZIP_UA;
365
+      $this->userAgent = $userAgent.self::GZIP_UA;
367 366
     }
368 367
   }
369 368
 
@@ -415,12 +414,12 @@  discard block
 block discarded – undo
415 414
   public function toBatchString($id)
416 415
   {
417 416
     $str = '';
418
-    $path = parse_url($this->getUrl(), PHP_URL_PATH) . "?" .
417
+    $path = parse_url($this->getUrl(), PHP_URL_PATH)."?".
419 418
         http_build_query($this->queryParams);
420
-    $str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";
419
+    $str .= $this->getRequestMethod().' '.$path." HTTP/1.1\n";
421 420
 
422 421
     foreach ($this->getRequestHeaders() as $key => $val) {
423
-      $str .= $key . ': ' . $val . "\n";
422
+      $str .= $key.': '.$val."\n";
424 423
     }
425 424
 
426 425
     if ($this->getPostBody()) {
@@ -430,11 +429,11 @@  discard block
 block discarded – undo
430 429
     
431 430
     $headers = '';
432 431
     foreach ($this->batchHeaders as $key => $val) {
433
-      $headers .= $key . ': ' . $val . "\n";
432
+      $headers .= $key.': '.$val."\n";
434 433
     }
435 434
 
436 435
     $headers .= "Content-ID: $id\n";
437
-    $str = $headers . "\n" . $str;
436
+    $str = $headers."\n".$str;
438 437
 
439 438
     return $str;
440 439
   }
@@ -474,10 +473,10 @@  discard block
 block discarded – undo
474 473
     foreach ($parts as $key => $value) {
475 474
       if (is_array($value)) {
476 475
         foreach ($value as $v) {
477
-          $return[] = urlencode($key) . "=" . urlencode($v);
476
+          $return[] = urlencode($key)."=".urlencode($v);
478 477
         }
479 478
       } else {
480
-        $return[] = urlencode($key) . "=" . urlencode($value);
479
+        $return[] = urlencode($key)."=".urlencode($value);
481 480
       }
482 481
     }
483 482
     return implode('&', $return);
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Logger/Abstract.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
   /**
262 262
    * Logs with an arbitrary level.
263 263
    *
264
-   * @param mixed $level    The log level
264
+   * @param string $level    The log level
265 265
    * @param string $message The log message
266 266
    * @param array $context  The log context
267 267
    */
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
   /**
381 381
    * Converts a given log level to the integer form.
382 382
    *
383
-   * @param  mixed $level   The logging level
383
+   * @param  integer $level   The logging level
384 384
    * @return integer $level The normalized level
385 385
    * @throws Google_Logger_Exception If $level is invalid
386 386
    */
Please login to merge, or discard this patch.
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
    * @var array $levels Logging levels
89 89
    */
90 90
   protected static $levels = array(
91
-      self::EMERGENCY  => 600,
92
-      self::ALERT => 550,
93
-      self::CRITICAL => 500,
94
-      self::ERROR => 400,
95
-      self::WARNING => 300,
96
-      self::NOTICE => 250,
97
-      self::INFO => 200,
98
-      self::DEBUG => 100,
91
+	  self::EMERGENCY  => 600,
92
+	  self::ALERT => 550,
93
+	  self::CRITICAL => 500,
94
+	  self::ERROR => 400,
95
+	  self::WARNING => 300,
96
+	  self::NOTICE => 250,
97
+	  self::INFO => 200,
98
+	  self::DEBUG => 100,
99 99
   );
100 100
 
101 101
   /**
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
    */
123 123
   public function __construct(Google_Client $client)
124 124
   {
125
-    $this->setLevel(
126
-        $client->getClassConfig('Google_Logger_Abstract', 'level')
127
-    );
125
+	$this->setLevel(
126
+		$client->getClassConfig('Google_Logger_Abstract', 'level')
127
+	);
128 128
 
129
-    $format = $client->getClassConfig('Google_Logger_Abstract', 'log_format');
130
-    $this->logFormat = $format ? $format : self::DEFAULT_LOG_FORMAT;
129
+	$format = $client->getClassConfig('Google_Logger_Abstract', 'log_format');
130
+	$this->logFormat = $format ? $format : self::DEFAULT_LOG_FORMAT;
131 131
 
132
-    $format = $client->getClassConfig('Google_Logger_Abstract', 'date_format');
133
-    $this->dateFormat = $format ? $format : self::DEFAULT_DATE_FORMAT;
132
+	$format = $client->getClassConfig('Google_Logger_Abstract', 'date_format');
133
+	$this->dateFormat = $format ? $format : self::DEFAULT_DATE_FORMAT;
134 134
 
135
-    $this->allowNewLines = (bool) $client->getClassConfig(
136
-        'Google_Logger_Abstract',
137
-        'allow_newlines'
138
-    );
135
+	$this->allowNewLines = (bool) $client->getClassConfig(
136
+		'Google_Logger_Abstract',
137
+		'allow_newlines'
138
+	);
139 139
   }
140 140
 
141 141
   /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
    */
146 146
   public function setLevel($level)
147 147
   {
148
-    $this->level = $this->normalizeLevel($level);
148
+	$this->level = $this->normalizeLevel($level);
149 149
   }
150 150
 
151 151
   /**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
    */
157 157
   public function shouldHandle($level)
158 158
   {
159
-    return $this->normalizeLevel($level) >= $this->level;
159
+	return $this->normalizeLevel($level) >= $this->level;
160 160
   }
161 161
 
162 162
   /**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
    */
168 168
   public function emergency($message, array $context = array())
169 169
   {
170
-    $this->log(self::EMERGENCY, $message, $context);
170
+	$this->log(self::EMERGENCY, $message, $context);
171 171
   }
172 172
 
173 173
   /**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
    */
182 182
   public function alert($message, array $context = array())
183 183
   {
184
-    $this->log(self::ALERT, $message, $context);
184
+	$this->log(self::ALERT, $message, $context);
185 185
   }
186 186
 
187 187
   /**
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
    */
195 195
   public function critical($message, array $context = array())
196 196
   {
197
-    $this->log(self::CRITICAL, $message, $context);
197
+	$this->log(self::CRITICAL, $message, $context);
198 198
   }
199 199
 
200 200
   /**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
    */
207 207
   public function error($message, array $context = array())
208 208
   {
209
-    $this->log(self::ERROR, $message, $context);
209
+	$this->log(self::ERROR, $message, $context);
210 210
   }
211 211
 
212 212
   /**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
    */
221 221
   public function warning($message, array $context = array())
222 222
   {
223
-    $this->log(self::WARNING, $message, $context);
223
+	$this->log(self::WARNING, $message, $context);
224 224
   }
225 225
 
226 226
   /**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
    */
232 232
   public function notice($message, array $context = array())
233 233
   {
234
-    $this->log(self::NOTICE, $message, $context);
234
+	$this->log(self::NOTICE, $message, $context);
235 235
   }
236 236
 
237 237
   /**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
    */
245 245
   public function info($message, array $context = array())
246 246
   {
247
-    $this->log(self::INFO, $message, $context);
247
+	$this->log(self::INFO, $message, $context);
248 248
   }
249 249
 
250 250
   /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
    */
256 256
   public function debug($message, array $context = array())
257 257
   {
258
-    $this->log(self::DEBUG, $message, $context);
258
+	$this->log(self::DEBUG, $message, $context);
259 259
   }
260 260
 
261 261
   /**
@@ -267,21 +267,21 @@  discard block
 block discarded – undo
267 267
    */
268 268
   public function log($level, $message, array $context = array())
269 269
   {
270
-    if (!$this->shouldHandle($level)) {
271
-      return false;
272
-    }
273
-
274
-    $levelName = is_int($level) ? array_search($level, self::$levels) : $level;
275
-    $message = $this->interpolate(
276
-        array(
277
-            'message' => $message,
278
-            'context' => $context,
279
-            'level' => strtoupper($levelName),
280
-            'datetime' => new DateTime(),
281
-        )
282
-    );
283
-
284
-    $this->write($message);
270
+	if (!$this->shouldHandle($level)) {
271
+	  return false;
272
+	}
273
+
274
+	$levelName = is_int($level) ? array_search($level, self::$levels) : $level;
275
+	$message = $this->interpolate(
276
+		array(
277
+			'message' => $message,
278
+			'context' => $context,
279
+			'level' => strtoupper($levelName),
280
+			'datetime' => new DateTime(),
281
+		)
282
+	);
283
+
284
+	$this->write($message);
285 285
   }
286 286
 
287 287
   /**
@@ -292,26 +292,26 @@  discard block
 block discarded – undo
292 292
    */
293 293
   protected function interpolate(array $variables = array())
294 294
   {
295
-    $template = $this->logFormat;
296
-
297
-    if (!$variables['context']) {
298
-      $template = str_replace('%context%', '', $template);
299
-      unset($variables['context']);
300
-    } else {
301
-      $this->reverseJsonInContext($variables['context']);
302
-    }
303
-
304
-    foreach ($variables as $key => $value) {
305
-      if (strpos($template, '%'. $key .'%') !== false) {
306
-        $template = str_replace(
307
-            '%' . $key . '%',
308
-            $this->export($value),
309
-            $template
310
-        );
311
-      }
312
-    }
313
-
314
-    return $template;
295
+	$template = $this->logFormat;
296
+
297
+	if (!$variables['context']) {
298
+	  $template = str_replace('%context%', '', $template);
299
+	  unset($variables['context']);
300
+	} else {
301
+	  $this->reverseJsonInContext($variables['context']);
302
+	}
303
+
304
+	foreach ($variables as $key => $value) {
305
+	  if (strpos($template, '%'. $key .'%') !== false) {
306
+		$template = str_replace(
307
+			'%' . $key . '%',
308
+			$this->export($value),
309
+			$template
310
+		);
311
+	  }
312
+	}
313
+
314
+	return $template;
315 315
   }
316 316
 
317 317
   /**
@@ -321,20 +321,20 @@  discard block
 block discarded – undo
321 321
    */
322 322
   protected function reverseJsonInContext(array &$context)
323 323
   {
324
-    if (!$context) {
325
-      return;
326
-    }
327
-
328
-    foreach ($context as $key => $val) {
329
-      if (!$val || !is_string($val) || !($val[0] == '{' || $val[0] == '[')) {
330
-        continue;
331
-      }
332
-
333
-      $json = @json_decode($val);
334
-      if (is_object($json) || is_array($json)) {
335
-        $context[$key] = $json;
336
-      }
337
-    }
324
+	if (!$context) {
325
+	  return;
326
+	}
327
+
328
+	foreach ($context as $key => $val) {
329
+	  if (!$val || !is_string($val) || !($val[0] == '{' || $val[0] == '[')) {
330
+		continue;
331
+	  }
332
+
333
+	  $json = @json_decode($val);
334
+	  if (is_object($json) || is_array($json)) {
335
+		$context[$key] = $json;
336
+	  }
337
+	}
338 338
   }
339 339
 
340 340
   /**
@@ -344,37 +344,37 @@  discard block
 block discarded – undo
344 344
    */
345 345
   protected function export($value)
346 346
   {
347
-    if (is_string($value)) {
348
-      if ($this->allowNewLines) {
349
-        return $value;
350
-      }
347
+	if (is_string($value)) {
348
+	  if ($this->allowNewLines) {
349
+		return $value;
350
+	  }
351 351
 
352
-      return preg_replace('/[\r\n]+/', ' ', $value);
353
-    }
352
+	  return preg_replace('/[\r\n]+/', ' ', $value);
353
+	}
354 354
 
355
-    if (is_resource($value)) {
356
-      return sprintf(
357
-          'resource(%d) of type (%s)',
358
-          $value,
359
-          get_resource_type($value)
360
-      );
361
-    }
355
+	if (is_resource($value)) {
356
+	  return sprintf(
357
+		  'resource(%d) of type (%s)',
358
+		  $value,
359
+		  get_resource_type($value)
360
+	  );
361
+	}
362 362
 
363
-    if ($value instanceof DateTime) {
364
-      return $value->format($this->dateFormat);
365
-    }
363
+	if ($value instanceof DateTime) {
364
+	  return $value->format($this->dateFormat);
365
+	}
366 366
 
367
-    if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
368
-      $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
367
+	if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
368
+	  $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
369 369
 
370
-      if ($this->allowNewLines) {
371
-        $options |= JSON_PRETTY_PRINT;
372
-      }
370
+	  if ($this->allowNewLines) {
371
+		$options |= JSON_PRETTY_PRINT;
372
+	  }
373 373
 
374
-      return @json_encode($value, $options);
375
-    }
374
+	  return @json_encode($value, $options);
375
+	}
376 376
 
377
-    return str_replace('\\/', '/', @json_encode($value));
377
+	return str_replace('\\/', '/', @json_encode($value));
378 378
   }
379 379
 
380 380
   /**
@@ -386,17 +386,17 @@  discard block
 block discarded – undo
386 386
    */
387 387
   protected function normalizeLevel($level)
388 388
   {
389
-    if (is_int($level) && array_search($level, self::$levels) !== false) {
390
-      return $level;
391
-    }
389
+	if (is_int($level) && array_search($level, self::$levels) !== false) {
390
+	  return $level;
391
+	}
392 392
 
393
-    if (is_string($level) && isset(self::$levels[$level])) {
394
-      return self::$levels[$level];
395
-    }
393
+	if (is_string($level) && isset(self::$levels[$level])) {
394
+	  return self::$levels[$level];
395
+	}
396 396
 
397
-    throw new Google_Logger_Exception(
398
-        sprintf("Unknown LogLevel: '%s'", $level)
399
-    );
397
+	throw new Google_Logger_Exception(
398
+		sprintf("Unknown LogLevel: '%s'", $level)
399
+	);
400 400
   }
401 401
 
402 402
   /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
     }
303 303
 
304 304
     foreach ($variables as $key => $value) {
305
-      if (strpos($template, '%'. $key .'%') !== false) {
305
+      if (strpos($template, '%'.$key.'%') !== false) {
306 306
         $template = str_replace(
307
-            '%' . $key . '%',
307
+            '%'.$key.'%',
308 308
             $this->export($value),
309 309
             $template
310 310
         );
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Model.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
   /**
222 222
    * Given a variable name, discover its type.
223 223
    *
224
-   * @param $name
224
+   * @param string $name
225 225
    * @param $item
226 226
    * @return object The object from the item.
227 227
    */
@@ -278,6 +278,9 @@  discard block
 block discarded – undo
278 278
     return $key . "Type";
279 279
   }
280 280
 
281
+  /**
282
+   * @param string $key
283
+   */
281 284
   protected function dataType($key)
282 285
   {
283 286
     return $key . "DataType";
Please login to merge, or discard this patch.
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
    */
39 39
   final public function __construct()
40 40
   {
41
-    if (func_num_args() == 1 && is_array(func_get_arg(0))) {
42
-      // Initialize the model with the array's contents.
43
-      $array = func_get_arg(0);
44
-      $this->mapTypes($array);
45
-    }
46
-    $this->gapiInit();
41
+	if (func_num_args() == 1 && is_array(func_get_arg(0))) {
42
+	  // Initialize the model with the array's contents.
43
+	  $array = func_get_arg(0);
44
+	  $this->mapTypes($array);
45
+	}
46
+	$this->gapiInit();
47 47
   }
48 48
 
49 49
   /**
@@ -53,39 +53,39 @@  discard block
 block discarded – undo
53 53
    */
54 54
   public function __get($key)
55 55
   {
56
-    $keyTypeName = $this->keyType($key);
57
-    $keyDataType = $this->dataType($key);
58
-    if (isset($this->$keyTypeName) && !isset($this->processed[$key])) {
59
-      if (isset($this->modelData[$key])) {
60
-        $val = $this->modelData[$key];
61
-      } else if (isset($this->$keyDataType) &&
62
-          ($this->$keyDataType == 'array' || $this->$keyDataType == 'map')) {
63
-        $val = array();
64
-      } else {
65
-        $val = null;
66
-      }
56
+	$keyTypeName = $this->keyType($key);
57
+	$keyDataType = $this->dataType($key);
58
+	if (isset($this->$keyTypeName) && !isset($this->processed[$key])) {
59
+	  if (isset($this->modelData[$key])) {
60
+		$val = $this->modelData[$key];
61
+	  } else if (isset($this->$keyDataType) &&
62
+		  ($this->$keyDataType == 'array' || $this->$keyDataType == 'map')) {
63
+		$val = array();
64
+	  } else {
65
+		$val = null;
66
+	  }
67 67
 
68
-      if ($this->isAssociativeArray($val)) {
69
-        if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) {
70
-          foreach ($val as $arrayKey => $arrayItem) {
71
-              $this->modelData[$key][$arrayKey] =
72
-                $this->createObjectFromName($keyTypeName, $arrayItem);
73
-          }
74
-        } else {
75
-          $this->modelData[$key] = $this->createObjectFromName($keyTypeName, $val);
76
-        }
77
-      } else if (is_array($val)) {
78
-        $arrayObject = array();
79
-        foreach ($val as $arrayIndex => $arrayItem) {
80
-          $arrayObject[$arrayIndex] =
81
-            $this->createObjectFromName($keyTypeName, $arrayItem);
82
-        }
83
-        $this->modelData[$key] = $arrayObject;
84
-      }
85
-      $this->processed[$key] = true;
86
-    }
68
+	  if ($this->isAssociativeArray($val)) {
69
+		if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) {
70
+		  foreach ($val as $arrayKey => $arrayItem) {
71
+			  $this->modelData[$key][$arrayKey] =
72
+				$this->createObjectFromName($keyTypeName, $arrayItem);
73
+		  }
74
+		} else {
75
+		  $this->modelData[$key] = $this->createObjectFromName($keyTypeName, $val);
76
+		}
77
+	  } else if (is_array($val)) {
78
+		$arrayObject = array();
79
+		foreach ($val as $arrayIndex => $arrayItem) {
80
+		  $arrayObject[$arrayIndex] =
81
+			$this->createObjectFromName($keyTypeName, $arrayItem);
82
+		}
83
+		$this->modelData[$key] = $arrayObject;
84
+	  }
85
+	  $this->processed[$key] = true;
86
+	}
87 87
 
88
-    return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
88
+	return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
89 89
   }
90 90
 
91 91
   /**
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
    */
97 97
   protected function mapTypes($array)
98 98
   {
99
-    // Hard initialise simple types, lazy load more complex ones.
100
-    foreach ($array as $key => $val) {
101
-      if ( !property_exists($this, $this->keyType($key)) &&
102
-        property_exists($this, $key)) {
103
-          $this->$key = $val;
104
-          unset($array[$key]);
105
-      } elseif (property_exists($this, $camelKey = Google_Utils::camelCase($key))) {
106
-          // This checks if property exists as camelCase, leaving it in array as snake_case
107
-          // in case of backwards compatibility issues.
108
-          $this->$camelKey = $val;
109
-      }
110
-    }
111
-    $this->modelData = $array;
99
+	// Hard initialise simple types, lazy load more complex ones.
100
+	foreach ($array as $key => $val) {
101
+	  if ( !property_exists($this, $this->keyType($key)) &&
102
+		property_exists($this, $key)) {
103
+		  $this->$key = $val;
104
+		  unset($array[$key]);
105
+	  } elseif (property_exists($this, $camelKey = Google_Utils::camelCase($key))) {
106
+		  // This checks if property exists as camelCase, leaving it in array as snake_case
107
+		  // in case of backwards compatibility issues.
108
+		  $this->$camelKey = $val;
109
+	  }
110
+	}
111
+	$this->modelData = $array;
112 112
   }
113 113
 
114 114
   /**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
    */
119 119
   protected function gapiInit()
120 120
   {
121
-    return;
121
+	return;
122 122
   }
123 123
 
124 124
   /**
@@ -129,29 +129,29 @@  discard block
 block discarded – undo
129 129
    */
130 130
   public function toSimpleObject()
131 131
   {
132
-    $object = new stdClass();
132
+	$object = new stdClass();
133 133
 
134
-    // Process all other data.
135
-    foreach ($this->modelData as $key => $val) {
136
-      $result = $this->getSimpleValue($val);
137
-      if ($result !== null) {
138
-        $object->$key = $this->nullPlaceholderCheck($result);
139
-      }
140
-    }
134
+	// Process all other data.
135
+	foreach ($this->modelData as $key => $val) {
136
+	  $result = $this->getSimpleValue($val);
137
+	  if ($result !== null) {
138
+		$object->$key = $this->nullPlaceholderCheck($result);
139
+	  }
140
+	}
141 141
 
142
-    // Process all public properties.
143
-    $reflect = new ReflectionObject($this);
144
-    $props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
145
-    foreach ($props as $member) {
146
-      $name = $member->getName();
147
-      $result = $this->getSimpleValue($this->$name);
148
-      if ($result !== null) {
149
-        $name = $this->getMappedName($name);
150
-        $object->$name = $this->nullPlaceholderCheck($result);
151
-      }
152
-    }
142
+	// Process all public properties.
143
+	$reflect = new ReflectionObject($this);
144
+	$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
145
+	foreach ($props as $member) {
146
+	  $name = $member->getName();
147
+	  $result = $this->getSimpleValue($this->$name);
148
+	  if ($result !== null) {
149
+		$name = $this->getMappedName($name);
150
+		$object->$name = $this->nullPlaceholderCheck($result);
151
+	  }
152
+	}
153 153
 
154
-    return $object;
154
+	return $object;
155 155
   }
156 156
 
157 157
   /**
@@ -160,20 +160,20 @@  discard block
 block discarded – undo
160 160
    */
161 161
   private function getSimpleValue($value)
162 162
   {
163
-    if ($value instanceof Google_Model) {
164
-      return $value->toSimpleObject();
165
-    } else if (is_array($value)) {
166
-      $return = array();
167
-      foreach ($value as $key => $a_value) {
168
-        $a_value = $this->getSimpleValue($a_value);
169
-        if ($a_value !== null) {
170
-          $key = $this->getMappedName($key);
171
-          $return[$key] = $this->nullPlaceholderCheck($a_value);
172
-        }
173
-      }
174
-      return $return;
175
-    }
176
-    return $value;
163
+	if ($value instanceof Google_Model) {
164
+	  return $value->toSimpleObject();
165
+	} else if (is_array($value)) {
166
+	  $return = array();
167
+	  foreach ($value as $key => $a_value) {
168
+		$a_value = $this->getSimpleValue($a_value);
169
+		if ($a_value !== null) {
170
+		  $key = $this->getMappedName($key);
171
+		  $return[$key] = $this->nullPlaceholderCheck($a_value);
172
+		}
173
+	  }
174
+	  return $return;
175
+	}
176
+	return $value;
177 177
   }
178 178
   
179 179
   /**
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
    */
182 182
   private function nullPlaceholderCheck($value)
183 183
   {
184
-    if ($value === self::NULL_VALUE) {
185
-      return null;
186
-    }
187
-    return $value;
184
+	if ($value === self::NULL_VALUE) {
185
+	  return null;
186
+	}
187
+	return $value;
188 188
   }
189 189
 
190 190
   /**
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
    */
193 193
   private function getMappedName($key)
194 194
   {
195
-    if (isset($this->internal_gapi_mappings) &&
196
-        isset($this->internal_gapi_mappings[$key])) {
197
-      $key = $this->internal_gapi_mappings[$key];
198
-    }
199
-    return $key;
195
+	if (isset($this->internal_gapi_mappings) &&
196
+		isset($this->internal_gapi_mappings[$key])) {
197
+	  $key = $this->internal_gapi_mappings[$key];
198
+	}
199
+	return $key;
200 200
   }
201 201
 
202 202
   /**
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
    */
207 207
   protected function isAssociativeArray($array)
208 208
   {
209
-    if (!is_array($array)) {
210
-      return false;
211
-    }
212
-    $keys = array_keys($array);
213
-    foreach ($keys as $key) {
214
-      if (is_string($key)) {
215
-        return true;
216
-      }
217
-    }
218
-    return false;
209
+	if (!is_array($array)) {
210
+	  return false;
211
+	}
212
+	$keys = array_keys($array);
213
+	foreach ($keys as $key) {
214
+	  if (is_string($key)) {
215
+		return true;
216
+	  }
217
+	}
218
+	return false;
219 219
   }
220 220
 
221 221
   /**
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
    */
228 228
   private function createObjectFromName($name, $item)
229 229
   {
230
-    $type = $this->$name;
231
-    return new $type($item);
230
+	$type = $this->$name;
231
+	return new $type($item);
232 232
   }
233 233
 
234 234
   /**
@@ -239,57 +239,57 @@  discard block
 block discarded – undo
239 239
    */
240 240
   public function assertIsArray($obj, $method)
241 241
   {
242
-    if ($obj && !is_array($obj)) {
243
-      throw new Google_Exception(
244
-          "Incorrect parameter type passed to $method(). Expected an array."
245
-      );
246
-    }
242
+	if ($obj && !is_array($obj)) {
243
+	  throw new Google_Exception(
244
+		  "Incorrect parameter type passed to $method(). Expected an array."
245
+	  );
246
+	}
247 247
   }
248 248
 
249 249
   public function offsetExists($offset)
250 250
   {
251
-    return isset($this->$offset) || isset($this->modelData[$offset]);
251
+	return isset($this->$offset) || isset($this->modelData[$offset]);
252 252
   }
253 253
 
254 254
   public function offsetGet($offset)
255 255
   {
256
-    return isset($this->$offset) ?
257
-        $this->$offset :
258
-        $this->__get($offset);
256
+	return isset($this->$offset) ?
257
+		$this->$offset :
258
+		$this->__get($offset);
259 259
   }
260 260
 
261 261
   public function offsetSet($offset, $value)
262 262
   {
263
-    if (property_exists($this, $offset)) {
264
-      $this->$offset = $value;
265
-    } else {
266
-      $this->modelData[$offset] = $value;
267
-      $this->processed[$offset] = true;
268
-    }
263
+	if (property_exists($this, $offset)) {
264
+	  $this->$offset = $value;
265
+	} else {
266
+	  $this->modelData[$offset] = $value;
267
+	  $this->processed[$offset] = true;
268
+	}
269 269
   }
270 270
 
271 271
   public function offsetUnset($offset)
272 272
   {
273
-    unset($this->modelData[$offset]);
273
+	unset($this->modelData[$offset]);
274 274
   }
275 275
 
276 276
   protected function keyType($key)
277 277
   {
278
-    return $key . "Type";
278
+	return $key . "Type";
279 279
   }
280 280
 
281 281
   protected function dataType($key)
282 282
   {
283
-    return $key . "DataType";
283
+	return $key . "DataType";
284 284
   }
285 285
 
286 286
   public function __isset($key)
287 287
   {
288
-    return isset($this->modelData[$key]);
288
+	return isset($this->modelData[$key]);
289 289
   }
290 290
 
291 291
   public function __unset($key)
292 292
   {
293
-    unset($this->modelData[$key]);
293
+	unset($this->modelData[$key]);
294 294
   }
295 295
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
   {
99 99
     // Hard initialise simple types, lazy load more complex ones.
100 100
     foreach ($array as $key => $val) {
101
-      if ( !property_exists($this, $this->keyType($key)) &&
101
+      if (!property_exists($this, $this->keyType($key)) &&
102 102
         property_exists($this, $key)) {
103 103
           $this->$key = $val;
104 104
           unset($array[$key]);
@@ -254,8 +254,7 @@  discard block
 block discarded – undo
254 254
   public function offsetGet($offset)
255 255
   {
256 256
     return isset($this->$offset) ?
257
-        $this->$offset :
258
-        $this->__get($offset);
257
+        $this->$offset : $this->__get($offset);
259 258
   }
260 259
 
261 260
   public function offsetSet($offset, $value)
@@ -275,12 +274,12 @@  discard block
 block discarded – undo
275 274
 
276 275
   protected function keyType($key)
277 276
   {
278
-    return $key . "Type";
277
+    return $key."Type";
279 278
   }
280 279
 
281 280
   protected function dataType($key)
282 281
   {
283
-    return $key . "DataType";
282
+    return $key."DataType";
284 283
   }
285 284
 
286 285
   public function __isset($key)
Please login to merge, or discard this patch.