Test Failed
Push — master ( 4cd501...1b9ce5 )
by Stiofan
07:38
created
geodirectory-admin/option-pages/general_settings_array.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
 
123 123
     array('type' => 'sectionend', 'id' => 'general_options'),
124 124
 
125
-));/* General Options End*/
125
+)); /* General Options End*/
126 126
 
127 127
 /**
128 128
  * Filter GD Google Analytic Settings array.
Please login to merge, or discard this patch.
Indentation   +260 added lines, -260 removed lines patch added patch discarded remove patch
@@ -16,87 +16,87 @@  discard block
 block discarded – undo
16 16
  */
17 17
 $general_options = apply_filters('geodir_general_options', array(
18 18
 
19
-    array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
-
21
-    array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
-
23
-    array(
24
-        'name' => __('Sender name', 'geodirectory'),
25
-        'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
-        'id' => 'site_email_name',
27
-        'type' => 'text',
28
-        'css' => 'min-width:300px;',
29
-        'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
-    ),
31
-
32
-    array(
33
-        'name' => __('Email address', 'geodirectory'),
34
-        'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
-        'id' => 'site_email',
36
-        'type' => 'text',
37
-        'css' => 'min-width:300px;',
38
-        'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
-    ),
40
-    array(
41
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
-        'desc' => __('Yes', 'geodirectory'),
43
-        'id' => 'geodir_allow_wpadmin',
44
-        'std' => '1',
45
-        'type' => 'radio',
46
-        'value' => '1',
47
-        'radiogroup' => 'start'
48
-    ),
49
-    array(
50
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
-        'desc' => __('No', 'geodirectory'),
52
-        'id' => 'geodir_allow_wpadmin',
53
-        'std' => '0',
54
-        'type' => 'radio',
55
-        'value' => '0',
56
-        'radiogroup' => 'end'
57
-    ),
58
-
59
-    array(
60
-        'name' => __('Allow user to choose own password', 'geodirectory'),
61
-        'desc' => __('Yes', 'geodirectory'),
62
-        'id' => 'geodir_allow_cpass',
63
-        'std' => '1',
64
-        'type' => 'radio',
65
-        'value' => '1',
66
-        'radiogroup' => 'start'
67
-    ),
68
-    array(
69
-        'name' => __('Allow user to choose own password', 'geodirectory'),
70
-        'desc' => __('No', 'geodirectory'),
71
-        'id' => 'geodir_allow_cpass',
72
-        'std' => '0',
73
-        'type' => 'radio',
74
-        'value' => '0',
75
-        'radiogroup' => 'end'
76
-    ),
77
-    array(
78
-        'name' => __('Disable rating on comments', 'geodirectory'),
79
-        'desc' => __('Disable rating without disabling comments on listings', 'geodirectory'),
80
-        'id' => 'geodir_disable_rating',
81
-        'type' => 'checkbox',
82
-        'std' => '0'
83
-    ),
84
-    array(
85
-        'name' => __('User deleted posts go to trash', 'geodirectory'),
86
-        'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
87
-        'id' => 'geodir_disable_perm_delete',
88
-        'type' => 'checkbox',
89
-        'std' => '1'
90
-    ),
91
-    array(
92
-        'name' => __('Max upload file size(in mb)', 'geodirectory'),
93
-        'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
94
-        'id' => 'geodir_upload_max_filesize',
95
-        'type' => 'text',
96
-        'css' => 'min-width:300px;',
97
-        'std' => '2'
98
-    ),
99
-    array('type' => 'sectionend', 'id' => 'general_options'),
19
+	array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
+
21
+	array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
+
23
+	array(
24
+		'name' => __('Sender name', 'geodirectory'),
25
+		'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
+		'id' => 'site_email_name',
27
+		'type' => 'text',
28
+		'css' => 'min-width:300px;',
29
+		'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
+	),
31
+
32
+	array(
33
+		'name' => __('Email address', 'geodirectory'),
34
+		'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
+		'id' => 'site_email',
36
+		'type' => 'text',
37
+		'css' => 'min-width:300px;',
38
+		'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
+	),
40
+	array(
41
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
+		'desc' => __('Yes', 'geodirectory'),
43
+		'id' => 'geodir_allow_wpadmin',
44
+		'std' => '1',
45
+		'type' => 'radio',
46
+		'value' => '1',
47
+		'radiogroup' => 'start'
48
+	),
49
+	array(
50
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
+		'desc' => __('No', 'geodirectory'),
52
+		'id' => 'geodir_allow_wpadmin',
53
+		'std' => '0',
54
+		'type' => 'radio',
55
+		'value' => '0',
56
+		'radiogroup' => 'end'
57
+	),
58
+
59
+	array(
60
+		'name' => __('Allow user to choose own password', 'geodirectory'),
61
+		'desc' => __('Yes', 'geodirectory'),
62
+		'id' => 'geodir_allow_cpass',
63
+		'std' => '1',
64
+		'type' => 'radio',
65
+		'value' => '1',
66
+		'radiogroup' => 'start'
67
+	),
68
+	array(
69
+		'name' => __('Allow user to choose own password', 'geodirectory'),
70
+		'desc' => __('No', 'geodirectory'),
71
+		'id' => 'geodir_allow_cpass',
72
+		'std' => '0',
73
+		'type' => 'radio',
74
+		'value' => '0',
75
+		'radiogroup' => 'end'
76
+	),
77
+	array(
78
+		'name' => __('Disable rating on comments', 'geodirectory'),
79
+		'desc' => __('Disable rating without disabling comments on listings', 'geodirectory'),
80
+		'id' => 'geodir_disable_rating',
81
+		'type' => 'checkbox',
82
+		'std' => '0'
83
+	),
84
+	array(
85
+		'name' => __('User deleted posts go to trash', 'geodirectory'),
86
+		'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
87
+		'id' => 'geodir_disable_perm_delete',
88
+		'type' => 'checkbox',
89
+		'std' => '1'
90
+	),
91
+	array(
92
+		'name' => __('Max upload file size(in mb)', 'geodirectory'),
93
+		'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
94
+		'id' => 'geodir_upload_max_filesize',
95
+		'type' => 'text',
96
+		'css' => 'min-width:300px;',
97
+		'std' => '2'
98
+	),
99
+	array('type' => 'sectionend', 'id' => 'general_options'),
100 100
 
101 101
 ));/* General Options End*/
102 102
 
@@ -108,96 +108,96 @@  discard block
 block discarded – undo
108 108
  */
109 109
 $google_analytic_settings = apply_filters('geodir_google_analytic_settings', array(
110 110
 
111
-    array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
112
-
113
-    array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
114
-
115
-
116
-
117
-    array(
118
-        'name' => __('Show business owner google analytics stats?', 'geodirectory'),
119
-        'desc' => __('Yes', 'geodirectory'),
120
-        'id' => 'geodir_ga_stats',
121
-        'std' => '0',
122
-        'type' => 'radio',
123
-        'value' => '1',
124
-        'radiogroup' => 'start'
125
-    ),
126
-    array(
127
-        'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
128
-        'desc' => __('No', 'geodirectory'),
129
-        'id' => 'geodir_ga_stats',
130
-        'std' => '1',
131
-        'type' => 'radio',
132
-        'value' => '0',
133
-        'radiogroup' => 'end'
134
-    ),
135
-
136
-    array(
137
-        'name' => __('Google analytics access', 'geodirectory'),
138
-        'desc' => '',
139
-        'id' => 'geodir_ga_token',
140
-        'type' => 'google_analytics',
141
-        'css' => 'min-width:300px;',
142
-        'std' => '' // Default value for the page title - changed in settings
143
-    ),
144
-
145
-    array(
146
-        'name' => __('Google analytics Auth Code', 'geodirectory'),
147
-        'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
148
-        'id' => 'geodir_ga_auth_code',
149
-        'type' => 'text',
150
-        'css' => 'min-width:300px;',
151
-        'std' => '' // Default value for the page title - changed in settings
152
-    ),
153
-
154
-    array(
155
-        'name' => __('Analytics Account', 'geodirectory'),
156
-        'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
157
-        'id' => 'geodir_ga_account_id',
158
-        'css' => 'min-width:300px;',
159
-        'std' => 'gridview_onehalf',
160
-        'type' => 'select',
161
-        'class' => 'chosen_select',
162
-        'options' => geodir_gd_accounts()
163
-    ),
164
-
165
-
166
-    array(
167
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
168
-        'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
169
-        'id' => 'geodir_ga_add_tracking_code',
170
-        'std' => '0',
171
-        'type' => 'radio',
172
-        'value' => '1',
173
-        'radiogroup' => 'start'
174
-    ),
175
-    array(
176
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
177
-        'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
178
-        'id' => 'geodir_ga_add_tracking_code',
179
-        'std' => '1',
180
-        'type' => 'radio',
181
-        'value' => '0',
182
-        'radiogroup' => 'end'
183
-    ),
184
-
185
-    array(
186
-        'name' => __('Auto refresh active users?', 'geodirectory'),
187
-        'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
188
-        'id' => 'geodir_ga_auto_refresh',
189
-        'type' => 'checkbox',
190
-        'std' => '0'
191
-    ),
192
-    array(
193
-        'name' => __('Time interval for auto refresh active users', 'geodirectory'),
194
-        'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
195
-        'id' => 'geodir_ga_refresh_time',
196
-        'type' => 'text',
197
-        'std' => '5'
198
-    ),
199
-
200
-    array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
111
+	array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
112
+
113
+	array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
114
+
115
+
116
+
117
+	array(
118
+		'name' => __('Show business owner google analytics stats?', 'geodirectory'),
119
+		'desc' => __('Yes', 'geodirectory'),
120
+		'id' => 'geodir_ga_stats',
121
+		'std' => '0',
122
+		'type' => 'radio',
123
+		'value' => '1',
124
+		'radiogroup' => 'start'
125
+	),
126
+	array(
127
+		'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
128
+		'desc' => __('No', 'geodirectory'),
129
+		'id' => 'geodir_ga_stats',
130
+		'std' => '1',
131
+		'type' => 'radio',
132
+		'value' => '0',
133
+		'radiogroup' => 'end'
134
+	),
135
+
136
+	array(
137
+		'name' => __('Google analytics access', 'geodirectory'),
138
+		'desc' => '',
139
+		'id' => 'geodir_ga_token',
140
+		'type' => 'google_analytics',
141
+		'css' => 'min-width:300px;',
142
+		'std' => '' // Default value for the page title - changed in settings
143
+	),
144
+
145
+	array(
146
+		'name' => __('Google analytics Auth Code', 'geodirectory'),
147
+		'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
148
+		'id' => 'geodir_ga_auth_code',
149
+		'type' => 'text',
150
+		'css' => 'min-width:300px;',
151
+		'std' => '' // Default value for the page title - changed in settings
152
+	),
153
+
154
+	array(
155
+		'name' => __('Analytics Account', 'geodirectory'),
156
+		'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
157
+		'id' => 'geodir_ga_account_id',
158
+		'css' => 'min-width:300px;',
159
+		'std' => 'gridview_onehalf',
160
+		'type' => 'select',
161
+		'class' => 'chosen_select',
162
+		'options' => geodir_gd_accounts()
163
+	),
164
+
165
+
166
+	array(
167
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
168
+		'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
169
+		'id' => 'geodir_ga_add_tracking_code',
170
+		'std' => '0',
171
+		'type' => 'radio',
172
+		'value' => '1',
173
+		'radiogroup' => 'start'
174
+	),
175
+	array(
176
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
177
+		'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
178
+		'id' => 'geodir_ga_add_tracking_code',
179
+		'std' => '1',
180
+		'type' => 'radio',
181
+		'value' => '0',
182
+		'radiogroup' => 'end'
183
+	),
184
+
185
+	array(
186
+		'name' => __('Auto refresh active users?', 'geodirectory'),
187
+		'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
188
+		'id' => 'geodir_ga_auto_refresh',
189
+		'type' => 'checkbox',
190
+		'std' => '0'
191
+	),
192
+	array(
193
+		'name' => __('Time interval for auto refresh active users', 'geodirectory'),
194
+		'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
195
+		'id' => 'geodir_ga_refresh_time',
196
+		'type' => 'text',
197
+		'std' => '5'
198
+	),
199
+
200
+	array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
201 201
 
202 202
 )); // google_analytic_settings End
203 203
 
@@ -209,84 +209,84 @@  discard block
 block discarded – undo
209 209
  */
210 210
 $search_settings = apply_filters('geodir_search_settings', array(
211 211
 
212
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
213
-
214
-    array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
215
-
216
-    array(
217
-        'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
218
-        'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
219
-        'id' => 'geodir_search_dist',
220
-        'type' => 'text',
221
-        'css' => 'min-width:300px;',
222
-        'std' => '40' // Default value for the page title - changed in settings
223
-    ),
224
-
225
-    array(
226
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
227
-        'desc' => __('Miles', 'geodirectory'),
228
-        'id' => 'geodir_search_dist_1',
229
-        'std' => 'miles',
230
-        'type' => 'radio',
231
-        'value' => 'miles',
232
-        'radiogroup' => 'start'
233
-    ),
234
-    array(
235
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
236
-        'desc' => __('Kilometers', 'geodirectory'),
237
-        'id' => 'geodir_search_dist_1',
238
-        'std' => 'miles',
239
-        'type' => 'radio',
240
-        'value' => 'km',
241
-        'radiogroup' => 'end'
242
-    ),
243
-
244
-    array(
245
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
246
-        'desc' => __('Meters', 'geodirectory'),
247
-        'id' => 'geodir_search_dist_2',
248
-        'std' => 'meters',
249
-        'type' => 'radio',
250
-        'value' => 'meters',
251
-        'radiogroup' => 'start'
252
-    ),
253
-
254
-    array(
255
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
256
-        'desc' => __('Feet', 'geodirectory'),
257
-        'id' => 'geodir_search_dist_2',
258
-        'std' => 'meters',
259
-        'type' => 'radio',
260
-        'value' => 'feet',
261
-        'radiogroup' => 'end'
262
-    ),
263
-
264
-    array(
265
-        'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
266
-        'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
267
-        'id' => 'geodir_search_near_addition',
268
-        'type' => 'text',
269
-        'css' => 'min-width:300px;',
270
-        'std' => ''
271
-    ),
272
-    array(
273
-        'name' => __('Individual word search limit', 'geodirectory'),
274
-        'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
275
-        'id' => 'geodir_search_word_limit',
276
-        'css' => 'min-width:300px;',
277
-        'std' => 'gridview_onehalf',
278
-        'type' => 'select',
279
-        'class' => 'chosen_select',
280
-        'options' => array_unique(array(
281
-            '0' => __('Disabled', 'geodirectory'),
282
-            '1' => __('1 Character words excluded', 'geodirectory'),
283
-            '2' => __('2 Character words and less excluded', 'geodirectory'),
284
-            '3' => __('3 Character words and less excluded', 'geodirectory'),
285
-        ))
286
-    ),
287
-
288
-
289
-    array('type' => 'sectionend', 'id' => 'search_settings'),
212
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
213
+
214
+	array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
215
+
216
+	array(
217
+		'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
218
+		'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
219
+		'id' => 'geodir_search_dist',
220
+		'type' => 'text',
221
+		'css' => 'min-width:300px;',
222
+		'std' => '40' // Default value for the page title - changed in settings
223
+	),
224
+
225
+	array(
226
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
227
+		'desc' => __('Miles', 'geodirectory'),
228
+		'id' => 'geodir_search_dist_1',
229
+		'std' => 'miles',
230
+		'type' => 'radio',
231
+		'value' => 'miles',
232
+		'radiogroup' => 'start'
233
+	),
234
+	array(
235
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
236
+		'desc' => __('Kilometers', 'geodirectory'),
237
+		'id' => 'geodir_search_dist_1',
238
+		'std' => 'miles',
239
+		'type' => 'radio',
240
+		'value' => 'km',
241
+		'radiogroup' => 'end'
242
+	),
243
+
244
+	array(
245
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
246
+		'desc' => __('Meters', 'geodirectory'),
247
+		'id' => 'geodir_search_dist_2',
248
+		'std' => 'meters',
249
+		'type' => 'radio',
250
+		'value' => 'meters',
251
+		'radiogroup' => 'start'
252
+	),
253
+
254
+	array(
255
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
256
+		'desc' => __('Feet', 'geodirectory'),
257
+		'id' => 'geodir_search_dist_2',
258
+		'std' => 'meters',
259
+		'type' => 'radio',
260
+		'value' => 'feet',
261
+		'radiogroup' => 'end'
262
+	),
263
+
264
+	array(
265
+		'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
266
+		'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
267
+		'id' => 'geodir_search_near_addition',
268
+		'type' => 'text',
269
+		'css' => 'min-width:300px;',
270
+		'std' => ''
271
+	),
272
+	array(
273
+		'name' => __('Individual word search limit', 'geodirectory'),
274
+		'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
275
+		'id' => 'geodir_search_word_limit',
276
+		'css' => 'min-width:300px;',
277
+		'std' => 'gridview_onehalf',
278
+		'type' => 'select',
279
+		'class' => 'chosen_select',
280
+		'options' => array_unique(array(
281
+			'0' => __('Disabled', 'geodirectory'),
282
+			'1' => __('1 Character words excluded', 'geodirectory'),
283
+			'2' => __('2 Character words and less excluded', 'geodirectory'),
284
+			'3' => __('3 Character words and less excluded', 'geodirectory'),
285
+		))
286
+	),
287
+
288
+
289
+	array('type' => 'sectionend', 'id' => 'search_settings'),
290 290
 
291 291
 )); //search_settings End
292 292
 
@@ -298,17 +298,17 @@  discard block
 block discarded – undo
298 298
  */
299 299
 $dummy_data_settings = apply_filters('geodir_dummy_data_settings', array(
300 300
 
301
-    array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
302
-
303
-    array(
304
-        'name' => '',
305
-        'desc' => '',
306
-        'id' => 'geodir_dummy_data_installer',
307
-        'type' => 'dummy_installer',
308
-        'css' => 'min-width:300px;',
309
-        'std' => '40' // Default value for the page title - changed in settings
310
-    ),
311
-    array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
301
+	array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
302
+
303
+	array(
304
+		'name' => '',
305
+		'desc' => '',
306
+		'id' => 'geodir_dummy_data_installer',
307
+		'type' => 'dummy_installer',
308
+		'css' => 'min-width:300px;',
309
+		'std' => '40' // Default value for the page title - changed in settings
310
+	),
311
+	array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
312 312
 
313 313
 )); //dummy_data_settings End
314 314
 
Please login to merge, or discard this patch.
geodirectory-admin/class.analytics.stats.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -223,6 +223,9 @@
 block discarded – undo
223 223
 	 * @param filter - the property to filter on
224 224
 	 * @param limit - the number of items to get
225 225
 	 * @param realtime - if the realtime api should be used
226
+	 * @param string $metric
227
+	 * @param string $startDate
228
+	 * @param string $endDate
226 229
 	 * @return the specific metrics in array form
227 230
 	 **/
228 231
 	function getMetrics($metric, $startDate, $endDate, $dimensions = false, $sort = false, $filter = false, $limit = false, $realtime = false)
Please login to merge, or discard this patch.
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -34,138 +34,138 @@  discard block
 block discarded – undo
34 34
 				require_once 'google-api-php-client/src/contrib/Google_AnalyticsService.php';
35 35
 			}
36 36
 
37
-            $this->client = new Google_Client();
38
-            $this->client->setApprovalPrompt("force");
39
-            $this->client->setAccessType('offline');
40
-            $this->client->setClientId(GEODIR_GA_CLIENTID);
41
-            $this->client->setClientSecret(GEODIR_GA_CLIENTSECRET);
42
-            $this->client->setRedirectUri(GEODIR_GA_REDIRECT);
37
+			$this->client = new Google_Client();
38
+			$this->client->setApprovalPrompt("force");
39
+			$this->client->setAccessType('offline');
40
+			$this->client->setClientId(GEODIR_GA_CLIENTID);
41
+			$this->client->setClientSecret(GEODIR_GA_CLIENTSECRET);
42
+			$this->client->setRedirectUri(GEODIR_GA_REDIRECT);
43 43
 			
44
-            $this->client->setScopes(array("https://www.googleapis.com/auth/analytics"));
44
+			$this->client->setScopes(array("https://www.googleapis.com/auth/analytics"));
45 45
 
46
-            // Magic. Returns objects from the Analytics Service instead of associative arrays.
47
-            $this->client->setUseObjects(true);
46
+			// Magic. Returns objects from the Analytics Service instead of associative arrays.
47
+			$this->client->setUseObjects(true);
48 48
 
49
-            try {
50
-                    $this->analytics = new Google_AnalyticsService($this->client);
51
-                }
52
-            catch (Google_ServiceException $e)
53
-                {
54
-                    print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
49
+			try {
50
+					$this->analytics = new Google_AnalyticsService($this->client);
51
+				}
52
+			catch (Google_ServiceException $e)
53
+				{
54
+					print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
55 55
 					return false;
56
-                }
56
+				}
57 57
 	}
58 58
 
59 59
 	function checkLogin()
60 60
 	{
61
-            $ga_google_authtoken = get_option('geodir_ga_auth_token');
61
+			$ga_google_authtoken = get_option('geodir_ga_auth_token');
62 62
 
63
-            if (!empty($ga_google_authtoken))
64
-            {
63
+			if (!empty($ga_google_authtoken))
64
+			{
65 65
 				try
66
-                {
67
-                    $this->client->setAccessToken($ga_google_authtoken);
66
+				{
67
+					$this->client->setAccessToken($ga_google_authtoken);
68 68
 				}
69 69
 				catch( Google_AuthException $e )
70
-                {
71
-                    print '(cas:72) GeoDirectory was unable to authenticate you with
70
+				{
71
+					print '(cas:72) GeoDirectory was unable to authenticate you with
72 72
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
73 73
                             This could mean either you pasted the token wrong, or the time/date on your server is wrong,
74 74
                             or an SSL issue preventing Google from Authenticating. <br><br>
75 75
                             <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage();
76 76
 
77
-                    return false;
78
-                }
79
-            }
80
-            else
81
-            {
82
-                $authCode = get_option('geodir_ga_auth_code');
83
-
84
-                if (empty($authCode)) return false;
85
-
86
-                try
87
-                {
88
-                    $accessToken = $this->client->authenticate($authCode);
89
-                }
90
-                catch( Exception $e )
91
-                {
92
-                    print '(cas:72) GeoDirectory was unable to authenticate you with
77
+					return false;
78
+				}
79
+			}
80
+			else
81
+			{
82
+				$authCode = get_option('geodir_ga_auth_code');
83
+
84
+				if (empty($authCode)) return false;
85
+
86
+				try
87
+				{
88
+					$accessToken = $this->client->authenticate($authCode);
89
+				}
90
+				catch( Exception $e )
91
+				{
92
+					print '(cas:72) GeoDirectory was unable to authenticate you with
93 93
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
94 94
                             This could mean either you pasted the token wrong, or the time/date on your server is wrong,
95 95
                             or an SSL issue preventing Google from Authenticating. <br><br>
96 96
                             <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage();
97 97
 
98
-                    return false;
99
-                }
100
-
101
-                if($accessToken)
102
-                {
103
-                    $this->client->setAccessToken($accessToken);
104
-                    update_option('geodir_ga_auth_token', $accessToken);
105
-                }
106
-                else
107
-                {
108
-                    return false;
109
-                }
110
-            }
111
-
112
-            $this->token =  $this->client->getAccessToken();
113
-            return true;
98
+					return false;
99
+				}
100
+
101
+				if($accessToken)
102
+				{
103
+					$this->client->setAccessToken($accessToken);
104
+					update_option('geodir_ga_auth_token', $accessToken);
105
+				}
106
+				else
107
+				{
108
+					return false;
109
+				}
110
+			}
111
+
112
+			$this->token =  $this->client->getAccessToken();
113
+			return true;
114 114
 	}
115 115
 
116 116
 	function deauthorize()
117 117
 	{
118
-            update_option('geodir_ga_auth_code', '');
119
-            update_option('geodir_ga_auth_token', '');
118
+			update_option('geodir_ga_auth_code', '');
119
+			update_option('geodir_ga_auth_token', '');
120 120
 	}
121 121
 
122 122
 	function getSingleProfile()
123 123
 	{
124
-            $webproperty_id = get_option('geodir_ga_account_id');
125
-            list($pre, $account_id, $post) = explode('-',$webproperty_id);
126
-
127
-            if (empty($webproperty_id)) return false;
128
-
129
-            try {
130
-                $profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id);
131
-            }
132
-            catch (Google_ServiceException $e)
133
-            {
134
-                print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
135
-                return false;
136
-            }
137
-
138
-            $profile_id = $profiles->items[0]->id;
139
-            if (empty($profile_id)) return false;
140
-
141
-            $account_array = array();
142
-            array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id));
143
-            return $account_array;
124
+			$webproperty_id = get_option('geodir_ga_account_id');
125
+			list($pre, $account_id, $post) = explode('-',$webproperty_id);
126
+
127
+			if (empty($webproperty_id)) return false;
128
+
129
+			try {
130
+				$profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id);
131
+			}
132
+			catch (Google_ServiceException $e)
133
+			{
134
+				print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
135
+				return false;
136
+			}
137
+
138
+			$profile_id = $profiles->items[0]->id;
139
+			if (empty($profile_id)) return false;
140
+
141
+			$account_array = array();
142
+			array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id));
143
+			return $account_array;
144 144
 	}
145 145
 
146
-        function getAllProfiles()
147
-        {
148
-            $profile_array = array();
146
+		function getAllProfiles()
147
+		{
148
+			$profile_array = array();
149 149
             
150
-            try {
151
-                    $profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all');
152
-                }
153
-                catch (Google_ServiceException $e)
154
-                {
155
-                    print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
156
-                }
157
-
158
-
159
-            if( !empty( $profiles->items ) )
160
-            {
161
-                foreach( $profiles->items as $profile )
162
-                {
163
-                    $profile_array[ $profile->id ] = str_replace('http://','',$profile->name );
164
-                }
165
-            }
166
-
167
-            return $profile_array;
168
-        }
150
+			try {
151
+					$profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all');
152
+				}
153
+				catch (Google_ServiceException $e)
154
+				{
155
+					print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
156
+				}
157
+
158
+
159
+			if( !empty( $profiles->items ) )
160
+			{
161
+				foreach( $profiles->items as $profile )
162
+				{
163
+					$profile_array[ $profile->id ] = str_replace('http://','',$profile->name );
164
+				}
165
+			}
166
+
167
+			return $profile_array;
168
+		}
169 169
 
170 170
 	function getAnalyticsAccounts()
171 171
 	{
@@ -248,13 +248,13 @@  discard block
 block discarded – undo
248 248
 			$params['max-results'] = $limit;
249 249
 		}
250 250
            
251
-           // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking
252
-           $filtered_id = str_replace( 'ga:', '', $this->accountId );
251
+		   // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking
252
+		   $filtered_id = str_replace( 'ga:', '', $this->accountId );
253 253
            
254
-           if(!$filtered_id){
255
-                echo 'Error - Account ID is blank';
256
-                return false;
257
-           }
254
+		   if(!$filtered_id){
255
+				echo 'Error - Account ID is blank';
256
+				return false;
257
+		   }
258 258
 
259 259
 		if($realtime){
260 260
 			return $analytics->data_realtime->get(
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 	{
24 24
 
25 25
 			# Include SimplePie if it doesn't exist
26
-			if ( !class_exists('SimplePie') ) {
27
-				require_once (ABSPATH . WPINC . '/class-feed.php');
26
+			if (!class_exists('SimplePie')) {
27
+				require_once (ABSPATH.WPINC.'/class-feed.php');
28 28
 			}
29 29
 			
30
-			if ( !class_exists('Google_Client') ) {
30
+			if (!class_exists('Google_Client')) {
31 31
 				require_once 'google-api-php-client/src/Google_Client.php';
32 32
 			}
33
-			if ( !class_exists('Google_AnalyticsService') ) {
33
+			if (!class_exists('Google_AnalyticsService')) {
34 34
 				require_once 'google-api-php-client/src/contrib/Google_AnalyticsService.php';
35 35
 			}
36 36
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                 }
52 52
             catch (Google_ServiceException $e)
53 53
                 {
54
-                    print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
54
+                    print '(cas:48) There was an Analytics API service error '.$e->getCode().':'.$e->getMessage();
55 55
 					return false;
56 56
                 }
57 57
 	}
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
                 {
67 67
                     $this->client->setAccessToken($ga_google_authtoken);
68 68
 				}
69
-				catch( Google_AuthException $e )
69
+				catch (Google_AuthException $e)
70 70
                 {
71 71
                     print '(cas:72) GeoDirectory was unable to authenticate you with
72 72
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
73 73
                             This could mean either you pasted the token wrong, or the time/date on your server is wrong,
74 74
                             or an SSL issue preventing Google from Authenticating. <br><br>
75
-                            <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage();
75
+                            <br><br><strong>Tech Info </strong> ' . $e->getCode().':'.$e->getMessage();
76 76
 
77 77
                     return false;
78 78
                 }
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
                 {
88 88
                     $accessToken = $this->client->authenticate($authCode);
89 89
                 }
90
-                catch( Exception $e )
90
+                catch (Exception $e)
91 91
                 {
92 92
                     print '(cas:72) GeoDirectory was unable to authenticate you with
93 93
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
94 94
                             This could mean either you pasted the token wrong, or the time/date on your server is wrong,
95 95
                             or an SSL issue preventing Google from Authenticating. <br><br>
96
-                            <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage();
96
+                            <br><br><strong>Tech Info </strong> ' . $e->getCode().':'.$e->getMessage();
97 97
 
98 98
                     return false;
99 99
                 }
100 100
 
101
-                if($accessToken)
101
+                if ($accessToken)
102 102
                 {
103 103
                     $this->client->setAccessToken($accessToken);
104 104
                     update_option('geodir_ga_auth_token', $accessToken);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                 }
110 110
             }
111 111
 
112
-            $this->token =  $this->client->getAccessToken();
112
+            $this->token = $this->client->getAccessToken();
113 113
             return true;
114 114
 	}
115 115
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	function getSingleProfile()
123 123
 	{
124 124
             $webproperty_id = get_option('geodir_ga_account_id');
125
-            list($pre, $account_id, $post) = explode('-',$webproperty_id);
125
+            list($pre, $account_id, $post) = explode('-', $webproperty_id);
126 126
 
127 127
             if (empty($webproperty_id)) return false;
128 128
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             }
132 132
             catch (Google_ServiceException $e)
133 133
             {
134
-                print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
134
+                print 'There was an Analytics API service error '.$e->getCode().': '.$e->getMessage();
135 135
                 return false;
136 136
             }
137 137
 
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
                 }
153 153
                 catch (Google_ServiceException $e)
154 154
                 {
155
-                    print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
155
+                    print 'There was an Analytics API service error '.$e->getCode().': '.$e->getMessage();
156 156
                 }
157 157
 
158 158
 
159
-            if( !empty( $profiles->items ) )
159
+            if (!empty($profiles->items))
160 160
             {
161
-                foreach( $profiles->items as $profile )
161
+                foreach ($profiles->items as $profile)
162 162
                 {
163
-                    $profile_array[ $profile->id ] = str_replace('http://','',$profile->name );
163
+                    $profile_array[$profile->id] = str_replace('http://', '', $profile->name);
164 164
                 }
165 165
             }
166 166
 
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 		}
250 250
            
251 251
            // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking
252
-           $filtered_id = str_replace( 'ga:', '', $this->accountId );
252
+           $filtered_id = str_replace('ga:', '', $this->accountId);
253 253
            
254
-           if(!$filtered_id){
254
+           if (!$filtered_id) {
255 255
                 echo 'Error - Account ID is blank';
256 256
                 return false;
257 257
            }
258 258
 
259
-		if($realtime){
259
+		if ($realtime) {
260 260
 			return $analytics->data_realtime->get(
261 261
 				'ga:'.$filtered_id,
262 262
 				$metric,
263 263
 				$params
264 264
 			);
265
-		}else{
265
+		} else {
266 266
 			return $analytics->data_ga->get(
267 267
 				'ga:'.$filtered_id,
268 268
 				$startDate,
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 **/
287 287
 	function verifyStartDate($date)
288 288
 	{
289
-		if ( strtotime($date) > strtotime('2005-01-01') )
289
+		if (strtotime($date) > strtotime('2005-01-01'))
290 290
 			return $date;
291 291
 		else
292 292
 			return '2005-01-01';
Please login to merge, or discard this patch.
Braces   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
             try {
50 50
                     $this->analytics = new Google_AnalyticsService($this->client);
51
-                }
52
-            catch (Google_ServiceException $e)
51
+                } catch (Google_ServiceException $e)
53 52
                 {
54 53
                     print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
55 54
 					return false;
@@ -65,8 +64,7 @@  discard block
 block discarded – undo
65 64
 				try
66 65
                 {
67 66
                     $this->client->setAccessToken($ga_google_authtoken);
68
-				}
69
-				catch( Google_AuthException $e )
67
+				} catch( Google_AuthException $e )
70 68
                 {
71 69
                     print '(cas:72) GeoDirectory was unable to authenticate you with
72 70
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
@@ -76,18 +74,18 @@  discard block
 block discarded – undo
76 74
 
77 75
                     return false;
78 76
                 }
79
-            }
80
-            else
77
+            } else
81 78
             {
82 79
                 $authCode = get_option('geodir_ga_auth_code');
83 80
 
84
-                if (empty($authCode)) return false;
81
+                if (empty($authCode)) {
82
+                	return false;
83
+                }
85 84
 
86 85
                 try
87 86
                 {
88 87
                     $accessToken = $this->client->authenticate($authCode);
89
-                }
90
-                catch( Exception $e )
88
+                } catch( Exception $e )
91 89
                 {
92 90
                     print '(cas:72) GeoDirectory was unable to authenticate you with
93 91
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
@@ -102,8 +100,7 @@  discard block
 block discarded – undo
102 100
                 {
103 101
                     $this->client->setAccessToken($accessToken);
104 102
                     update_option('geodir_ga_auth_token', $accessToken);
105
-                }
106
-                else
103
+                } else
107 104
                 {
108 105
                     return false;
109 106
                 }
@@ -124,19 +121,22 @@  discard block
 block discarded – undo
124 121
             $webproperty_id = get_option('geodir_ga_account_id');
125 122
             list($pre, $account_id, $post) = explode('-',$webproperty_id);
126 123
 
127
-            if (empty($webproperty_id)) return false;
124
+            if (empty($webproperty_id)) {
125
+            	return false;
126
+            }
128 127
 
129 128
             try {
130 129
                 $profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id);
131
-            }
132
-            catch (Google_ServiceException $e)
130
+            } catch (Google_ServiceException $e)
133 131
             {
134 132
                 print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
135 133
                 return false;
136 134
             }
137 135
 
138 136
             $profile_id = $profiles->items[0]->id;
139
-            if (empty($profile_id)) return false;
137
+            if (empty($profile_id)) {
138
+            	return false;
139
+            }
140 140
 
141 141
             $account_array = array();
142 142
             array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id));
@@ -149,8 +149,7 @@  discard block
 block discarded – undo
149 149
             
150 150
             try {
151 151
                     $profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all');
152
-                }
153
-                catch (Google_ServiceException $e)
152
+                } catch (Google_ServiceException $e)
154 153
                 {
155 154
                     print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
156 155
                 }
@@ -262,7 +261,7 @@  discard block
 block discarded – undo
262 261
 				$metric,
263 262
 				$params
264 263
 			);
265
-		}else{
264
+		} else{
266 265
 			return $analytics->data_ga->get(
267 266
 				'ga:'.$filtered_id,
268 267
 				$startDate,
@@ -286,10 +285,11 @@  discard block
 block discarded – undo
286 285
 	 **/
287 286
 	function verifyStartDate($date)
288 287
 	{
289
-		if ( strtotime($date) > strtotime('2005-01-01') )
290
-			return $date;
291
-		else
292
-			return '2005-01-01';
288
+		if ( strtotime($date) > strtotime('2005-01-01') ) {
289
+					return $date;
290
+		} else {
291
+					return '2005-01-01';
292
+		}
293 293
 	}
294 294
 
295 295
 } // END class	
296 296
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/auth/Google_P12Signer.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -27,6 +27,10 @@  discard block
 block discarded – undo
27 27
   private $privateKey;
28 28
 
29 29
   // Creates a new signer from a .p12 file.
30
+
31
+  /**
32
+   * @param string $password
33
+   */
30 34
   function __construct($p12, $password) {
31 35
     if (!function_exists('openssl_x509_read')) {
32 36
       throw new Exception(
@@ -57,6 +61,9 @@  discard block
 block discarded – undo
57 61
     }
58 62
   }
59 63
 
64
+  /**
65
+   * @param string $data
66
+   */
60 67
   function sign($data) {
61 68
     if(version_compare(PHP_VERSION, '5.3.0') < 0) {
62 69
       throw new Google_AuthException(
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,43 +28,43 @@
 block discarded – undo
28 28
 
29 29
   // Creates a new signer from a .p12 file.
30 30
   function __construct($p12, $password) {
31
-    if (!function_exists('openssl_x509_read')) {
32
-      throw new Exception(
33
-          'The Google PHP API library needs the openssl PHP extension');
34
-    }
31
+	if (!function_exists('openssl_x509_read')) {
32
+	  throw new Exception(
33
+		  'The Google PHP API library needs the openssl PHP extension');
34
+	}
35 35
 
36
-    // This throws on error
37
-    $certs = array();
38
-    if (!openssl_pkcs12_read($p12, $certs, $password)) {
39
-      throw new Google_AuthException("Unable to parse the p12 file.  " .
40
-          "Is this a .p12 file?  Is the password correct?  OpenSSL error: " .
41
-          openssl_error_string());
42
-    }
43
-    // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
44
-    // method?  What happens if there are multiple private keys?  Do we care?
45
-    if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
46
-      throw new Google_AuthException("No private key found in p12 file.");
47
-    }
48
-    $this->privateKey = openssl_pkey_get_private($certs["pkey"]);
49
-    if (!$this->privateKey) {
50
-      throw new Google_AuthException("Unable to load private key in ");
51
-    }
36
+	// This throws on error
37
+	$certs = array();
38
+	if (!openssl_pkcs12_read($p12, $certs, $password)) {
39
+	  throw new Google_AuthException("Unable to parse the p12 file.  " .
40
+		  "Is this a .p12 file?  Is the password correct?  OpenSSL error: " .
41
+		  openssl_error_string());
42
+	}
43
+	// TODO(beaton): is this part of the contract for the openssl_pkcs12_read
44
+	// method?  What happens if there are multiple private keys?  Do we care?
45
+	if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
46
+	  throw new Google_AuthException("No private key found in p12 file.");
47
+	}
48
+	$this->privateKey = openssl_pkey_get_private($certs["pkey"]);
49
+	if (!$this->privateKey) {
50
+	  throw new Google_AuthException("Unable to load private key in ");
51
+	}
52 52
   }
53 53
 
54 54
   function __destruct() {
55
-    if ($this->privateKey) {
56
-      openssl_pkey_free($this->privateKey);
57
-    }
55
+	if ($this->privateKey) {
56
+	  openssl_pkey_free($this->privateKey);
57
+	}
58 58
   }
59 59
 
60 60
   function sign($data) {
61
-    if(version_compare(PHP_VERSION, '5.3.0') < 0) {
62
-      throw new Google_AuthException(
63
-        "PHP 5.3.0 or higher is required to use service accounts.");
64
-    }
65
-    if (!openssl_sign($data, $signature, $this->privateKey, "sha256")) {
66
-      throw new Google_AuthException("Unable to sign data");
67
-    }
68
-    return $signature;
61
+	if(version_compare(PHP_VERSION, '5.3.0') < 0) {
62
+	  throw new Google_AuthException(
63
+		"PHP 5.3.0 or higher is required to use service accounts.");
64
+	}
65
+	if (!openssl_sign($data, $signature, $this->privateKey, "sha256")) {
66
+	  throw new Google_AuthException("Unable to sign data");
67
+	}
68
+	return $signature;
69 69
   }
70 70
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
     // This throws on error
37 37
     $certs = array();
38 38
     if (!openssl_pkcs12_read($p12, $certs, $password)) {
39
-      throw new Google_AuthException("Unable to parse the p12 file.  " .
40
-          "Is this a .p12 file?  Is the password correct?  OpenSSL error: " .
39
+      throw new Google_AuthException("Unable to parse the p12 file.  ".
40
+          "Is this a .p12 file?  Is the password correct?  OpenSSL error: ".
41 41
           openssl_error_string());
42 42
     }
43 43
     // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
   }
59 59
 
60 60
   function sign($data) {
61
-    if(version_compare(PHP_VERSION, '5.3.0') < 0) {
61
+    if (version_compare(PHP_VERSION, '5.3.0') < 0) {
62 62
       throw new Google_AuthException(
63 63
         "PHP 5.3.0 or higher is required to use service accounts.");
64 64
     }
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/auth/Google_PemVerifier.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@
 block discarded – undo
51 51
    * Verifies the signature on data.
52 52
    *
53 53
    * Returns true if the signature is valid, false otherwise.
54
-   * @param $data
55
-   * @param $signature
54
+   * @param string $data
55
+   * @param string $signature
56 56
    * @throws Google_AuthException
57 57
    * @return bool
58 58
    */
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
    * @throws Google_Exception
33 33
    */
34 34
   function __construct($pem) {
35
-    if (!function_exists('openssl_x509_read')) {
36
-      throw new Google_Exception('Google API PHP client needs the openssl PHP extension');
37
-    }
38
-    $this->publicKey = openssl_x509_read($pem);
39
-    if (!$this->publicKey) {
40
-      throw new Google_AuthException("Unable to parse PEM: $pem");
41
-    }
35
+	if (!function_exists('openssl_x509_read')) {
36
+	  throw new Google_Exception('Google API PHP client needs the openssl PHP extension');
37
+	}
38
+	$this->publicKey = openssl_x509_read($pem);
39
+	if (!$this->publicKey) {
40
+	  throw new Google_AuthException("Unable to parse PEM: $pem");
41
+	}
42 42
   }
43 43
 
44 44
   function __destruct() {
45
-    if ($this->publicKey) {
46
-      openssl_x509_free($this->publicKey);
47
-    }
45
+	if ($this->publicKey) {
46
+	  openssl_x509_free($this->publicKey);
47
+	}
48 48
   }
49 49
 
50 50
   /**
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
    * @return bool
58 58
    */
59 59
   function verify($data, $signature) {
60
-    $status = openssl_verify($data, $signature, $this->publicKey, "sha256");
61
-    if ($status === -1) {
62
-      throw new Google_AuthException('Signature verification error: ' . openssl_error_string());
63
-    }
64
-    return $status === 1;
60
+	$status = openssl_verify($data, $signature, $this->publicKey, "sha256");
61
+	if ($status === -1) {
62
+	  throw new Google_AuthException('Signature verification error: ' . openssl_error_string());
63
+	}
64
+	return $status === 1;
65 65
   }
66 66
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
   function verify($data, $signature) {
60 60
     $status = openssl_verify($data, $signature, $this->publicKey, "sha256");
61 61
     if ($status === -1) {
62
-      throw new Google_AuthException('Signature verification error: ' . openssl_error_string());
62
+      throw new Google_AuthException('Signature verification error: '.openssl_error_string());
63 63
     }
64 64
     return $status === 1;
65 65
   }
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/cache/Google_FileCache.php 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@  discard block
 block discarded – undo
37 37
     return file_exists($storageFile . '.lock');
38 38
   }
39 39
 
40
+  /**
41
+   * @param string $storageFile
42
+   */
40 43
   private function createLock($storageFile) {
41 44
     $storageDir = dirname($storageFile);
42 45
     if (! is_dir($storageDir)) {
@@ -57,6 +60,9 @@  discard block
 block discarded – undo
57 60
     @unlink($storageFile . '.lock');
58 61
   }
59 62
 
63
+  /**
64
+   * @param string $storageFile
65
+   */
60 66
   private function waitForLock($storageFile) {
61 67
     // 20 x 250 = 5 seconds
62 68
     $tries = 20;
@@ -81,6 +87,9 @@  discard block
 block discarded – undo
81 87
     return $this->path . '/' . substr($hash, 0, 2);
82 88
   }
83 89
 
90
+  /**
91
+   * @param string $hash
92
+   */
84 93
   private function getCacheFile($hash) {
85 94
     return $this->getCacheDir($hash) . '/' . $hash;
86 95
   }
Please login to merge, or discard this patch.
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -28,110 +28,110 @@
 block discarded – undo
28 28
   private $path;
29 29
 
30 30
   public function __construct() {
31
-    global $apiConfig;
32
-    $this->path = $apiConfig['ioFileCache_directory'];
31
+	global $apiConfig;
32
+	$this->path = $apiConfig['ioFileCache_directory'];
33 33
   }
34 34
 
35 35
   private function isLocked($storageFile) {
36
-    // our lock file convention is simple: /the/file/path.lock
37
-    return file_exists($storageFile . '.lock');
36
+	// our lock file convention is simple: /the/file/path.lock
37
+	return file_exists($storageFile . '.lock');
38 38
   }
39 39
 
40 40
   private function createLock($storageFile) {
41
-    $storageDir = dirname($storageFile);
42
-    if (! is_dir($storageDir)) {
43
-      // @codeCoverageIgnoreStart
44
-      if (! @mkdir($storageDir, 0755, true)) {
45
-        // make sure the failure isn't because of a concurrency issue
46
-        if (! is_dir($storageDir)) {
47
-          throw new Google_CacheException("Could not create storage directory: $storageDir");
48
-        }
49
-      }
50
-      // @codeCoverageIgnoreEnd
51
-    }
52
-    @touch($storageFile . '.lock');
41
+	$storageDir = dirname($storageFile);
42
+	if (! is_dir($storageDir)) {
43
+	  // @codeCoverageIgnoreStart
44
+	  if (! @mkdir($storageDir, 0755, true)) {
45
+		// make sure the failure isn't because of a concurrency issue
46
+		if (! is_dir($storageDir)) {
47
+		  throw new Google_CacheException("Could not create storage directory: $storageDir");
48
+		}
49
+	  }
50
+	  // @codeCoverageIgnoreEnd
51
+	}
52
+	@touch($storageFile . '.lock');
53 53
   }
54 54
 
55 55
   private function removeLock($storageFile) {
56
-    // suppress all warnings, if some other process removed it that's ok too
57
-    @unlink($storageFile . '.lock');
56
+	// suppress all warnings, if some other process removed it that's ok too
57
+	@unlink($storageFile . '.lock');
58 58
   }
59 59
 
60 60
   private function waitForLock($storageFile) {
61
-    // 20 x 250 = 5 seconds
62
-    $tries = 20;
63
-    $cnt = 0;
64
-    do {
65
-      // make sure PHP picks up on file changes. This is an expensive action but really can't be avoided
66
-      clearstatcache();
67
-      // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
68
-      usleep(250);
69
-      $cnt ++;
70
-    } while ($cnt <= $tries && $this->isLocked($storageFile));
71
-    if ($this->isLocked($storageFile)) {
72
-      // 5 seconds passed, assume the owning process died off and remove it
73
-      $this->removeLock($storageFile);
74
-    }
61
+	// 20 x 250 = 5 seconds
62
+	$tries = 20;
63
+	$cnt = 0;
64
+	do {
65
+	  // make sure PHP picks up on file changes. This is an expensive action but really can't be avoided
66
+	  clearstatcache();
67
+	  // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
68
+	  usleep(250);
69
+	  $cnt ++;
70
+	} while ($cnt <= $tries && $this->isLocked($storageFile));
71
+	if ($this->isLocked($storageFile)) {
72
+	  // 5 seconds passed, assume the owning process died off and remove it
73
+	  $this->removeLock($storageFile);
74
+	}
75 75
   }
76 76
 
77 77
   private function getCacheDir($hash) {
78
-    // use the first 2 characters of the hash as a directory prefix
79
-    // this should prevent slowdowns due to huge directory listings
80
-    // and thus give some basic amount of scalability
81
-    return $this->path . '/' . substr($hash, 0, 2);
78
+	// use the first 2 characters of the hash as a directory prefix
79
+	// this should prevent slowdowns due to huge directory listings
80
+	// and thus give some basic amount of scalability
81
+	return $this->path . '/' . substr($hash, 0, 2);
82 82
   }
83 83
 
84 84
   private function getCacheFile($hash) {
85
-    return $this->getCacheDir($hash) . '/' . $hash;
85
+	return $this->getCacheDir($hash) . '/' . $hash;
86 86
   }
87 87
 
88 88
   public function get($key, $expiration = false) {
89
-    $storageFile = $this->getCacheFile(md5($key));
90
-    // See if this storage file is locked, if so we wait up to 5 seconds for the lock owning process to
91
-    // complete it's work. If the lock is not released within that time frame, it's cleaned up.
92
-    // This should give us a fair amount of 'Cache Stampeding' protection
93
-    if ($this->isLocked($storageFile)) {
94
-      $this->waitForLock($storageFile);
95
-    }
96
-    if (file_exists($storageFile) && is_readable($storageFile)) {
97
-      $now = time();
98
-      if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
99
-        if (($data = @file_get_contents($storageFile)) !== false) {
100
-          $data = unserialize($data);
101
-          return $data;
102
-        }
103
-      }
104
-    }
105
-    return false;
89
+	$storageFile = $this->getCacheFile(md5($key));
90
+	// See if this storage file is locked, if so we wait up to 5 seconds for the lock owning process to
91
+	// complete it's work. If the lock is not released within that time frame, it's cleaned up.
92
+	// This should give us a fair amount of 'Cache Stampeding' protection
93
+	if ($this->isLocked($storageFile)) {
94
+	  $this->waitForLock($storageFile);
95
+	}
96
+	if (file_exists($storageFile) && is_readable($storageFile)) {
97
+	  $now = time();
98
+	  if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
99
+		if (($data = @file_get_contents($storageFile)) !== false) {
100
+		  $data = unserialize($data);
101
+		  return $data;
102
+		}
103
+	  }
104
+	}
105
+	return false;
106 106
   }
107 107
 
108 108
   public function set($key, $value) {
109
-    $storageDir = $this->getCacheDir(md5($key));
110
-    $storageFile = $this->getCacheFile(md5($key));
111
-    if ($this->isLocked($storageFile)) {
112
-      // some other process is writing to this file too, wait until it's done to prevent hiccups
113
-      $this->waitForLock($storageFile);
114
-    }
115
-    if (! is_dir($storageDir)) {
116
-      if (! @mkdir($storageDir, 0755, true)) {
117
-        throw new Google_CacheException("Could not create storage directory: $storageDir");
118
-      }
119
-    }
120
-    // we serialize the whole request object, since we don't only want the
121
-    // responseContent but also the postBody used, headers, size, etc
122
-    $data = serialize($value);
123
-    $this->createLock($storageFile);
124
-    if (! @file_put_contents($storageFile, $data)) {
125
-      $this->removeLock($storageFile);
126
-      throw new Google_CacheException("Could not store data in the file");
127
-    }
128
-    $this->removeLock($storageFile);
109
+	$storageDir = $this->getCacheDir(md5($key));
110
+	$storageFile = $this->getCacheFile(md5($key));
111
+	if ($this->isLocked($storageFile)) {
112
+	  // some other process is writing to this file too, wait until it's done to prevent hiccups
113
+	  $this->waitForLock($storageFile);
114
+	}
115
+	if (! is_dir($storageDir)) {
116
+	  if (! @mkdir($storageDir, 0755, true)) {
117
+		throw new Google_CacheException("Could not create storage directory: $storageDir");
118
+	  }
119
+	}
120
+	// we serialize the whole request object, since we don't only want the
121
+	// responseContent but also the postBody used, headers, size, etc
122
+	$data = serialize($value);
123
+	$this->createLock($storageFile);
124
+	if (! @file_put_contents($storageFile, $data)) {
125
+	  $this->removeLock($storageFile);
126
+	  throw new Google_CacheException("Could not store data in the file");
127
+	}
128
+	$this->removeLock($storageFile);
129 129
   }
130 130
 
131 131
   public function delete($key) {
132
-    $file = $this->getCacheFile(md5($key));
133
-    if (! @unlink($file)) {
134
-      throw new Google_CacheException("Cache file could not be deleted");
135
-    }
132
+	$file = $this->getCacheFile(md5($key));
133
+	if (! @unlink($file)) {
134
+	  throw new Google_CacheException("Cache file could not be deleted");
135
+	}
136 136
   }
137 137
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,27 +34,27 @@  discard block
 block discarded – undo
34 34
 
35 35
   private function isLocked($storageFile) {
36 36
     // our lock file convention is simple: /the/file/path.lock
37
-    return file_exists($storageFile . '.lock');
37
+    return file_exists($storageFile.'.lock');
38 38
   }
39 39
 
40 40
   private function createLock($storageFile) {
41 41
     $storageDir = dirname($storageFile);
42
-    if (! is_dir($storageDir)) {
42
+    if (!is_dir($storageDir)) {
43 43
       // @codeCoverageIgnoreStart
44
-      if (! @mkdir($storageDir, 0755, true)) {
44
+      if (!@mkdir($storageDir, 0755, true)) {
45 45
         // make sure the failure isn't because of a concurrency issue
46
-        if (! is_dir($storageDir)) {
46
+        if (!is_dir($storageDir)) {
47 47
           throw new Google_CacheException("Could not create storage directory: $storageDir");
48 48
         }
49 49
       }
50 50
       // @codeCoverageIgnoreEnd
51 51
     }
52
-    @touch($storageFile . '.lock');
52
+    @touch($storageFile.'.lock');
53 53
   }
54 54
 
55 55
   private function removeLock($storageFile) {
56 56
     // suppress all warnings, if some other process removed it that's ok too
57
-    @unlink($storageFile . '.lock');
57
+    @unlink($storageFile.'.lock');
58 58
   }
59 59
 
60 60
   private function waitForLock($storageFile) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
       clearstatcache();
67 67
       // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
68 68
       usleep(250);
69
-      $cnt ++;
69
+      $cnt++;
70 70
     } while ($cnt <= $tries && $this->isLocked($storageFile));
71 71
     if ($this->isLocked($storageFile)) {
72 72
       // 5 seconds passed, assume the owning process died off and remove it
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
     // use the first 2 characters of the hash as a directory prefix
79 79
     // this should prevent slowdowns due to huge directory listings
80 80
     // and thus give some basic amount of scalability
81
-    return $this->path . '/' . substr($hash, 0, 2);
81
+    return $this->path.'/'.substr($hash, 0, 2);
82 82
   }
83 83
 
84 84
   private function getCacheFile($hash) {
85
-    return $this->getCacheDir($hash) . '/' . $hash;
85
+    return $this->getCacheDir($hash).'/'.$hash;
86 86
   }
87 87
 
88 88
   public function get($key, $expiration = false) {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     }
96 96
     if (file_exists($storageFile) && is_readable($storageFile)) {
97 97
       $now = time();
98
-      if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
98
+      if (!$expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
99 99
         if (($data = @file_get_contents($storageFile)) !== false) {
100 100
           $data = unserialize($data);
101 101
           return $data;
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
       // some other process is writing to this file too, wait until it's done to prevent hiccups
113 113
       $this->waitForLock($storageFile);
114 114
     }
115
-    if (! is_dir($storageDir)) {
116
-      if (! @mkdir($storageDir, 0755, true)) {
115
+    if (!is_dir($storageDir)) {
116
+      if (!@mkdir($storageDir, 0755, true)) {
117 117
         throw new Google_CacheException("Could not create storage directory: $storageDir");
118 118
       }
119 119
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     // responseContent but also the postBody used, headers, size, etc
122 122
     $data = serialize($value);
123 123
     $this->createLock($storageFile);
124
-    if (! @file_put_contents($storageFile, $data)) {
124
+    if (!@file_put_contents($storageFile, $data)) {
125 125
       $this->removeLock($storageFile);
126 126
       throw new Google_CacheException("Could not store data in the file");
127 127
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
   public function delete($key) {
132 132
     $file = $this->getCacheFile(md5($key));
133
-    if (! @unlink($file)) {
133
+    if (!@unlink($file)) {
134 134
       throw new Google_CacheException("Cache file could not be deleted");
135 135
     }
136 136
   }
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/external/URITemplateParser.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -43,6 +43,9 @@  discard block
 block discarded – undo
43 43
     public static $reserved;
44 44
     public static $reserved_pct;
45 45
 
46
+    /**
47
+     * @param string $template
48
+     */
46 49
     public function __construct($template) {
47 50
       self::$reserved = array_merge(self::$gen_delims, self::$sub_delims);
48 51
       self::$reserved_pct = array_merge(self::$gen_delims_pct, self::$sub_delims_pct);
@@ -150,6 +153,9 @@  discard block
 block discarded – undo
150 153
       return $this->expansion;
151 154
     }
152 155
 
156
+    /**
157
+     * @param stdClass $exp
158
+     */
153 159
     private function val_from_var($var, $exp) {
154 160
       $val = '';
155 161
       if (is_array($var->data)) {
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -31,30 +31,30 @@  discard block
 block discarded – undo
31 31
 if( ! class_exists( 'URI_Template_Parser' ) ) { 
32 32
   class URI_Template_Parser {
33 33
 
34
-    public static $operators = array('+', ';', '?', '/', '.');
35
-    public static $reserved_operators = array('|', '!', '@');
36
-    public static $explode_modifiers = array('+', '*');
37
-    public static $partial_modifiers = array(':', '^');
38
-
39
-    public static $gen_delims = array(':', '/', '?', '#', '[', ']', '@');
40
-    public static $gen_delims_pct = array('%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40');
41
-    public static $sub_delims = array('!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=');
42
-    public static $sub_delims_pct = array('%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', '%3B', '%3D');
43
-    public static $reserved;
44
-    public static $reserved_pct;
45
-
46
-    public function __construct($template) {
47
-      self::$reserved = array_merge(self::$gen_delims, self::$sub_delims);
48
-      self::$reserved_pct = array_merge(self::$gen_delims_pct, self::$sub_delims_pct);
49
-      $this->template = $template;
50
-    }
51
-
52
-    public function expand($data) {
53
-      // Modification to make this a bit more performant (since gettype is very slow)
54
-      if (! is_array($data)) {
55
-        $data = (array)$data;
56
-      }
57
-      /*
34
+	public static $operators = array('+', ';', '?', '/', '.');
35
+	public static $reserved_operators = array('|', '!', '@');
36
+	public static $explode_modifiers = array('+', '*');
37
+	public static $partial_modifiers = array(':', '^');
38
+
39
+	public static $gen_delims = array(':', '/', '?', '#', '[', ']', '@');
40
+	public static $gen_delims_pct = array('%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40');
41
+	public static $sub_delims = array('!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=');
42
+	public static $sub_delims_pct = array('%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', '%3B', '%3D');
43
+	public static $reserved;
44
+	public static $reserved_pct;
45
+
46
+	public function __construct($template) {
47
+	  self::$reserved = array_merge(self::$gen_delims, self::$sub_delims);
48
+	  self::$reserved_pct = array_merge(self::$gen_delims_pct, self::$sub_delims_pct);
49
+	  $this->template = $template;
50
+	}
51
+
52
+	public function expand($data) {
53
+	  // Modification to make this a bit more performant (since gettype is very slow)
54
+	  if (! is_array($data)) {
55
+		$data = (array)$data;
56
+	  }
57
+	  /*
58 58
       // Original code, which uses a slow gettype() statement, kept in place for if the assumption that is_array always works here is incorrect
59 59
       switch (gettype($data)) {
60 60
         case "boolean":
@@ -67,146 +67,146 @@  discard block
 block discarded – undo
67 67
       }
68 68
   */
69 69
 
70
-      // Resolve template vars
71
-      preg_match_all('/\{([^\}]*)\}/', $this->template, $em);
72
-
73
-      foreach ($em[1] as $i => $bare_expression) {
74
-        preg_match('/^([\+\;\?\/\.]{1})?(.*)$/', $bare_expression, $lm);
75
-        $exp = new StdClass();
76
-        $exp->expression = $em[0][$i];
77
-        $exp->operator = $lm[1];
78
-        $exp->variable_list = $lm[2];
79
-        $exp->varspecs = explode(',', $exp->variable_list);
80
-        $exp->vars = array();
81
-        foreach ($exp->varspecs as $varspec) {
82
-          preg_match('/^([a-zA-Z0-9_]+)([\*\+]{1})?([\:\^][0-9-]+)?(\=[^,]+)?$/', $varspec, $vm);
83
-          $var = new StdClass();
84
-          $var->name = $vm[1];
85
-          $var->modifier = isset($vm[2]) && $vm[2] ? $vm[2] : null;
86
-          $var->modifier = isset($vm[3]) && $vm[3] ? $vm[3] : $var->modifier;
87
-          $var->default = isset($vm[4]) ? substr($vm[4], 1) : null;
88
-          $exp->vars[] = $var;
89
-        }
90
-
91
-        // Add processing flags
92
-        $exp->reserved = false;
93
-        $exp->prefix = '';
94
-        $exp->delimiter = ',';
95
-        switch ($exp->operator) {
96
-          case '+':
97
-            $exp->reserved = 'true';
98
-            break;
99
-          case ';':
100
-            $exp->prefix = ';';
101
-            $exp->delimiter = ';';
102
-            break;
103
-          case '?':
104
-            $exp->prefix = '?';
105
-            $exp->delimiter = '&';
106
-            break;
107
-          case '/':
108
-            $exp->prefix = '/';
109
-            $exp->delimiter = '/';
110
-            break;
111
-          case '.':
112
-            $exp->prefix = '.';
113
-            $exp->delimiter = '.';
114
-            break;
115
-        }
116
-        $expressions[] = $exp;
117
-      }
118
-
119
-      // Expansion
120
-      $this->expansion = $this->template;
121
-
122
-      foreach ($expressions as $exp) {
123
-        $part = $exp->prefix;
124
-        $exp->one_var_defined = false;
125
-        foreach ($exp->vars as $var) {
126
-          $val = '';
127
-          if ($exp->one_var_defined && isset($data[$var->name])) {
128
-            $part .= $exp->delimiter;
129
-          }
130
-          // Variable present
131
-          if (isset($data[$var->name])) {
132
-            $exp->one_var_defined = true;
133
-            $var->data = $data[$var->name];
134
-
135
-            $val = self::val_from_var($var, $exp);
136
-
137
-          // Variable missing
138
-          } else {
139
-            if ($var->default) {
140
-              $exp->one_var_defined = true;
141
-              $val = $var->default;
142
-            }
143
-          }
144
-          $part .= $val;
145
-        }
146
-        if (! $exp->one_var_defined) $part = '';
147
-        $this->expansion = str_replace($exp->expression, $part, $this->expansion);
148
-      }
149
-
150
-      return $this->expansion;
151
-    }
152
-
153
-    private function val_from_var($var, $exp) {
154
-      $val = '';
155
-      if (is_array($var->data)) {
156
-        $i = 0;
157
-        if ($exp->operator == '?' && ! $var->modifier) {
158
-          $val .= $var->name . '=';
159
-        }
160
-        foreach ($var->data as $k => $v) {
161
-          $del = $var->modifier ? $exp->delimiter : ',';
162
-          $ek = rawurlencode($k);
163
-          $ev = rawurlencode($v);
164
-
165
-          // Array
166
-          if ($k !== $i) {
167
-            if ($var->modifier == '+') {
168
-              $val .= $var->name . '.';
169
-            }
170
-            if ($exp->operator == '?' && $var->modifier || $exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+') {
171
-              $val .= $ek . '=';
172
-            } else {
173
-              $val .= $ek . $del;
174
-            }
175
-
176
-          // List
177
-          } else {
178
-            if ($var->modifier == '+') {
179
-              if ($exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+' || $exp->operator == '?' && $var->modifier == '+') {
180
-                $val .= $var->name . '=';
181
-              } else {
182
-                $val .= $var->name . '.';
183
-              }
184
-            }
185
-          }
186
-          $val .= $ev . $del;
187
-          $i ++;
188
-        }
189
-        $val = trim($val, $del);
190
-
191
-      // Strings, numbers, etc.
192
-      } else {
193
-        if ($exp->operator == '?') {
194
-          $val = $var->name . (isset($var->data) ? '=' : '');
195
-        } else if ($exp->operator == ';') {
196
-          $val = $var->name . ($var->data ? '=' : '');
197
-        }
198
-        $val .= rawurlencode($var->data);
199
-        if ($exp->operator == '+') {
200
-          $val = str_replace(self::$reserved_pct, self::$reserved, $val);
201
-        }
202
-      }
203
-      return $val;
204
-    }
205
-
206
-    public function match($uri) {}
207
-
208
-    public function __toString() {
209
-      return $this->template;
210
-    }
70
+	  // Resolve template vars
71
+	  preg_match_all('/\{([^\}]*)\}/', $this->template, $em);
72
+
73
+	  foreach ($em[1] as $i => $bare_expression) {
74
+		preg_match('/^([\+\;\?\/\.]{1})?(.*)$/', $bare_expression, $lm);
75
+		$exp = new StdClass();
76
+		$exp->expression = $em[0][$i];
77
+		$exp->operator = $lm[1];
78
+		$exp->variable_list = $lm[2];
79
+		$exp->varspecs = explode(',', $exp->variable_list);
80
+		$exp->vars = array();
81
+		foreach ($exp->varspecs as $varspec) {
82
+		  preg_match('/^([a-zA-Z0-9_]+)([\*\+]{1})?([\:\^][0-9-]+)?(\=[^,]+)?$/', $varspec, $vm);
83
+		  $var = new StdClass();
84
+		  $var->name = $vm[1];
85
+		  $var->modifier = isset($vm[2]) && $vm[2] ? $vm[2] : null;
86
+		  $var->modifier = isset($vm[3]) && $vm[3] ? $vm[3] : $var->modifier;
87
+		  $var->default = isset($vm[4]) ? substr($vm[4], 1) : null;
88
+		  $exp->vars[] = $var;
89
+		}
90
+
91
+		// Add processing flags
92
+		$exp->reserved = false;
93
+		$exp->prefix = '';
94
+		$exp->delimiter = ',';
95
+		switch ($exp->operator) {
96
+		  case '+':
97
+			$exp->reserved = 'true';
98
+			break;
99
+		  case ';':
100
+			$exp->prefix = ';';
101
+			$exp->delimiter = ';';
102
+			break;
103
+		  case '?':
104
+			$exp->prefix = '?';
105
+			$exp->delimiter = '&';
106
+			break;
107
+		  case '/':
108
+			$exp->prefix = '/';
109
+			$exp->delimiter = '/';
110
+			break;
111
+		  case '.':
112
+			$exp->prefix = '.';
113
+			$exp->delimiter = '.';
114
+			break;
115
+		}
116
+		$expressions[] = $exp;
117
+	  }
118
+
119
+	  // Expansion
120
+	  $this->expansion = $this->template;
121
+
122
+	  foreach ($expressions as $exp) {
123
+		$part = $exp->prefix;
124
+		$exp->one_var_defined = false;
125
+		foreach ($exp->vars as $var) {
126
+		  $val = '';
127
+		  if ($exp->one_var_defined && isset($data[$var->name])) {
128
+			$part .= $exp->delimiter;
129
+		  }
130
+		  // Variable present
131
+		  if (isset($data[$var->name])) {
132
+			$exp->one_var_defined = true;
133
+			$var->data = $data[$var->name];
134
+
135
+			$val = self::val_from_var($var, $exp);
136
+
137
+		  // Variable missing
138
+		  } else {
139
+			if ($var->default) {
140
+			  $exp->one_var_defined = true;
141
+			  $val = $var->default;
142
+			}
143
+		  }
144
+		  $part .= $val;
145
+		}
146
+		if (! $exp->one_var_defined) $part = '';
147
+		$this->expansion = str_replace($exp->expression, $part, $this->expansion);
148
+	  }
149
+
150
+	  return $this->expansion;
151
+	}
152
+
153
+	private function val_from_var($var, $exp) {
154
+	  $val = '';
155
+	  if (is_array($var->data)) {
156
+		$i = 0;
157
+		if ($exp->operator == '?' && ! $var->modifier) {
158
+		  $val .= $var->name . '=';
159
+		}
160
+		foreach ($var->data as $k => $v) {
161
+		  $del = $var->modifier ? $exp->delimiter : ',';
162
+		  $ek = rawurlencode($k);
163
+		  $ev = rawurlencode($v);
164
+
165
+		  // Array
166
+		  if ($k !== $i) {
167
+			if ($var->modifier == '+') {
168
+			  $val .= $var->name . '.';
169
+			}
170
+			if ($exp->operator == '?' && $var->modifier || $exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+') {
171
+			  $val .= $ek . '=';
172
+			} else {
173
+			  $val .= $ek . $del;
174
+			}
175
+
176
+		  // List
177
+		  } else {
178
+			if ($var->modifier == '+') {
179
+			  if ($exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+' || $exp->operator == '?' && $var->modifier == '+') {
180
+				$val .= $var->name . '=';
181
+			  } else {
182
+				$val .= $var->name . '.';
183
+			  }
184
+			}
185
+		  }
186
+		  $val .= $ev . $del;
187
+		  $i ++;
188
+		}
189
+		$val = trim($val, $del);
190
+
191
+	  // Strings, numbers, etc.
192
+	  } else {
193
+		if ($exp->operator == '?') {
194
+		  $val = $var->name . (isset($var->data) ? '=' : '');
195
+		} else if ($exp->operator == ';') {
196
+		  $val = $var->name . ($var->data ? '=' : '');
197
+		}
198
+		$val .= rawurlencode($var->data);
199
+		if ($exp->operator == '+') {
200
+		  $val = str_replace(self::$reserved_pct, self::$reserved, $val);
201
+		}
202
+	  }
203
+	  return $val;
204
+	}
205
+
206
+	public function match($uri) {}
207
+
208
+	public function __toString() {
209
+	  return $this->template;
210
+	}
211 211
   }
212 212
 }
213 213
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  * Source: http://github.com/KevBurnsJr/php-uri-template-parser
29 29
  */
30 30
 
31
-if( ! class_exists( 'URI_Template_Parser' ) ) { 
31
+if (!class_exists('URI_Template_Parser')) { 
32 32
   class URI_Template_Parser {
33 33
 
34 34
     public static $operators = array('+', ';', '?', '/', '.');
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function expand($data) {
53 53
       // Modification to make this a bit more performant (since gettype is very slow)
54
-      if (! is_array($data)) {
55
-        $data = (array)$data;
54
+      if (!is_array($data)) {
55
+        $data = (array) $data;
56 56
       }
57 57
       /*
58 58
       // Original code, which uses a slow gettype() statement, kept in place for if the assumption that is_array always works here is incorrect
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
           }
144 144
           $part .= $val;
145 145
         }
146
-        if (! $exp->one_var_defined) $part = '';
146
+        if (!$exp->one_var_defined) $part = '';
147 147
         $this->expansion = str_replace($exp->expression, $part, $this->expansion);
148 148
       }
149 149
 
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
       $val = '';
155 155
       if (is_array($var->data)) {
156 156
         $i = 0;
157
-        if ($exp->operator == '?' && ! $var->modifier) {
158
-          $val .= $var->name . '=';
157
+        if ($exp->operator == '?' && !$var->modifier) {
158
+          $val .= $var->name.'=';
159 159
         }
160 160
         foreach ($var->data as $k => $v) {
161 161
           $del = $var->modifier ? $exp->delimiter : ',';
@@ -165,35 +165,35 @@  discard block
 block discarded – undo
165 165
           // Array
166 166
           if ($k !== $i) {
167 167
             if ($var->modifier == '+') {
168
-              $val .= $var->name . '.';
168
+              $val .= $var->name.'.';
169 169
             }
170 170
             if ($exp->operator == '?' && $var->modifier || $exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+') {
171
-              $val .= $ek . '=';
171
+              $val .= $ek.'=';
172 172
             } else {
173
-              $val .= $ek . $del;
173
+              $val .= $ek.$del;
174 174
             }
175 175
 
176 176
           // List
177 177
           } else {
178 178
             if ($var->modifier == '+') {
179 179
               if ($exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+' || $exp->operator == '?' && $var->modifier == '+') {
180
-                $val .= $var->name . '=';
180
+                $val .= $var->name.'=';
181 181
               } else {
182
-                $val .= $var->name . '.';
182
+                $val .= $var->name.'.';
183 183
               }
184 184
             }
185 185
           }
186
-          $val .= $ev . $del;
187
-          $i ++;
186
+          $val .= $ev.$del;
187
+          $i++;
188 188
         }
189 189
         $val = trim($val, $del);
190 190
 
191 191
       // Strings, numbers, etc.
192 192
       } else {
193 193
         if ($exp->operator == '?') {
194
-          $val = $var->name . (isset($var->data) ? '=' : '');
194
+          $val = $var->name.(isset($var->data) ? '=' : '');
195 195
         } else if ($exp->operator == ';') {
196
-          $val = $var->name . ($var->data ? '=' : '');
196
+          $val = $var->name.($var->data ? '=' : '');
197 197
         }
198 198
         $val .= rawurlencode($var->data);
199 199
         if ($exp->operator == '+') {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,9 @@
 block discarded – undo
143 143
           }
144 144
           $part .= $val;
145 145
         }
146
-        if (! $exp->one_var_defined) $part = '';
146
+        if (! $exp->one_var_defined) {
147
+        	$part = '';
148
+        }
147 149
         $this->expansion = str_replace($exp->expression, $part, $this->expansion);
148 150
       }
149 151
 
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, -1 removed lines patch added patch discarded remove patch
@@ -108,6 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
   /**
110 110
    * Add a service
111
+   * @param string $service
111 112
    */
112 113
   public function addService($service, $version = false) {
113 114
     global $apiConfig;
@@ -316,7 +317,7 @@  discard block
 block discarded – undo
316 317
    * token, if a token isn't provided.
317 318
    * @throws Google_AuthException
318 319
    * @param string|null $token The token (access token or a refresh token) that should be revoked.
319
-   * @return boolean Returns True if the revocation was successful, otherwise False.
320
+   * @return boolean|null Returns True if the revocation was successful, otherwise False.
320 321
    */
321 322
   public function revokeToken($token = null) {
322 323
     self::$auth->revokeToken($token);
@@ -347,6 +348,7 @@  discard block
 block discarded – undo
347 348
    * so that you can ask for more or less permission in the auth flow
348 349
    * Set this before you call authenticate() though!
349 350
    * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/moderator')
351
+   * @param string[] $scopes
350 352
    */
351 353
   public function setScopes($scopes) {
352 354
     $this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes;
Please login to merge, or discard this patch.
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -99,32 +99,32 @@  discard block
 block discarded – undo
99 99
   private $authenticated = false;
100 100
 
101 101
   public function __construct($config = array()) {
102
-    global $apiConfig;
103
-    $apiConfig = array_merge($apiConfig, $config);
104
-    self::$cache = new $apiConfig['cacheClass']();
105
-    self::$auth = new $apiConfig['authClass']();
106
-    self::$io = new $apiConfig['ioClass']();
102
+	global $apiConfig;
103
+	$apiConfig = array_merge($apiConfig, $config);
104
+	self::$cache = new $apiConfig['cacheClass']();
105
+	self::$auth = new $apiConfig['authClass']();
106
+	self::$io = new $apiConfig['ioClass']();
107 107
   }
108 108
 
109 109
   /**
110 110
    * Add a service
111 111
    */
112 112
   public function addService($service, $version = false) {
113
-    global $apiConfig;
114
-    if ($this->authenticated) {
115
-      throw new Google_Exception('Cant add services after having authenticated');
116
-    }
117
-    $this->services[$service] = array();
118
-    if (isset($apiConfig['services'][$service])) {
119
-      // Merge the service descriptor with the default values
120
-      $this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]);
121
-    }
113
+	global $apiConfig;
114
+	if ($this->authenticated) {
115
+	  throw new Google_Exception('Cant add services after having authenticated');
116
+	}
117
+	$this->services[$service] = array();
118
+	if (isset($apiConfig['services'][$service])) {
119
+	  // Merge the service descriptor with the default values
120
+	  $this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]);
121
+	}
122 122
   }
123 123
 
124 124
   public function authenticate($code = null) {
125
-    $service = $this->prepareService();
126
-    $this->authenticated = true;
127
-    return self::$auth->authenticate($service, $code);
125
+	$service = $this->prepareService();
126
+	$this->authenticated = true;
127
+	return self::$auth->authenticate($service, $code);
128 128
   }
129 129
 
130 130
   /**
@@ -132,28 +132,28 @@  discard block
 block discarded – undo
132 132
    * @visible For Testing
133 133
    */
134 134
   public function prepareService() {
135
-    $service = array();
136
-    $scopes = array();
137
-    if ($this->scopes) {
138
-      $scopes = $this->scopes;
139
-    } else {
140
-      foreach ($this->services as $key => $val) {
141
-        if (isset($val['scope'])) {
142
-          if (is_array($val['scope'])) {
143
-            $scopes = array_merge($val['scope'], $scopes);
144
-          } else {
145
-            $scopes[] = $val['scope'];
146
-          }
147
-        } else {
148
-          $scopes[] = 'https://www.googleapis.com/auth/' . $key;
149
-        }
150
-        unset($val['discoveryURI']);
151
-        unset($val['scope']);
152
-        $service = array_merge($service, $val);
153
-      }
154
-    }
155
-    $service['scope'] = implode(' ', $scopes);
156
-    return $service;
135
+	$service = array();
136
+	$scopes = array();
137
+	if ($this->scopes) {
138
+	  $scopes = $this->scopes;
139
+	} else {
140
+	  foreach ($this->services as $key => $val) {
141
+		if (isset($val['scope'])) {
142
+		  if (is_array($val['scope'])) {
143
+			$scopes = array_merge($val['scope'], $scopes);
144
+		  } else {
145
+			$scopes[] = $val['scope'];
146
+		  }
147
+		} else {
148
+		  $scopes[] = 'https://www.googleapis.com/auth/' . $key;
149
+		}
150
+		unset($val['discoveryURI']);
151
+		unset($val['scope']);
152
+		$service = array_merge($service, $val);
153
+	  }
154
+	}
155
+	$service['scope'] = implode(' ', $scopes);
156
+	return $service;
157 157
   }
158 158
 
159 159
   /**
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
    *  "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
165 165
    */
166 166
   public function setAccessToken($accessToken) {
167
-    if ($accessToken == null || 'null' == $accessToken) {
168
-      $accessToken = null;
169
-    }
170
-    self::$auth->setAccessToken($accessToken);
167
+	if ($accessToken == null || 'null' == $accessToken) {
168
+	  $accessToken = null;
169
+	}
170
+	self::$auth->setAccessToken($accessToken);
171 171
   }
172 172
 
173 173
   /**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
    * @param string $authClassName
176 176
    */
177 177
   public function setAuthClass($authClassName) {
178
-    self::$auth = new $authClassName();
178
+	self::$auth = new $authClassName();
179 179
   }
180 180
 
181 181
   /**
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
    * @return string
184 184
    */
185 185
   public function createAuthUrl() {
186
-    $service = $this->prepareService();
187
-    return self::$auth->createAuthUrl($service['scope']);
186
+	$service = $this->prepareService();
187
+	return self::$auth->createAuthUrl($service['scope']);
188 188
   }
189 189
 
190 190
   /**
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
    *  "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
195 195
    */
196 196
   public function getAccessToken() {
197
-    $token = self::$auth->getAccessToken();
198
-    return (null == $token || 'null' == $token) ? null : $token;
197
+	$token = self::$auth->getAccessToken();
198
+	return (null == $token || 'null' == $token) ? null : $token;
199 199
   }
200 200
 
201 201
   /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
    * @return bool Returns True if the access_token is expired.
204 204
    */
205 205
   public function isAccessTokenExpired() {
206
-    return self::$auth->isAccessTokenExpired();
206
+	return self::$auth->isAccessTokenExpired();
207 207
   }
208 208
 
209 209
   /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
    * @param string $developerKey
213 213
    */
214 214
   public function setDeveloperKey($developerKey) {
215
-    self::$auth->setDeveloperKey($developerKey);
215
+	self::$auth->setDeveloperKey($developerKey);
216 216
   }
217 217
 
218 218
   /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
    * @param string $state
222 222
    */
223 223
   public function setState($state) {
224
-    self::$auth->setState($state);
224
+	self::$auth->setState($state);
225 225
   }
226 226
 
227 227
   /**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
    *  {@code "online"} to request online access from the user.
231 231
    */
232 232
   public function setAccessType($accessType) {
233
-    self::$auth->setAccessType($accessType);
233
+	self::$auth->setAccessType($accessType);
234 234
   }
235 235
 
236 236
   /**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
    *  {@code "auto"} to request auto-approval when possible.
240 240
    */
241 241
   public function setApprovalPrompt($approvalPrompt) {
242
-    self::$auth->setApprovalPrompt($approvalPrompt);
242
+	self::$auth->setApprovalPrompt($approvalPrompt);
243 243
   }
244 244
 
245 245
   /**
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
    * @param string $applicationName
248 248
    */
249 249
   public function setApplicationName($applicationName) {
250
-    global $apiConfig;
251
-    $apiConfig['application_name'] = $applicationName;
250
+	global $apiConfig;
251
+	$apiConfig['application_name'] = $applicationName;
252 252
   }
253 253
 
254 254
   /**
@@ -256,16 +256,16 @@  discard block
 block discarded – undo
256 256
    * @param string $clientId
257 257
    */
258 258
   public function setClientId($clientId) {
259
-    global $apiConfig;
260
-    $apiConfig['oauth2_client_id'] = $clientId;
261
-    self::$auth->clientId = $clientId;
259
+	global $apiConfig;
260
+	$apiConfig['oauth2_client_id'] = $clientId;
261
+	self::$auth->clientId = $clientId;
262 262
   }
263 263
 
264 264
   /**
265 265
    * Get the OAuth 2.0 Client ID.
266 266
    */
267 267
   public function getClientId() {
268
-    return self::$auth->clientId;
268
+	return self::$auth->clientId;
269 269
   }
270 270
 
271 271
   /**
@@ -273,16 +273,16 @@  discard block
 block discarded – undo
273 273
    * @param string $clientSecret
274 274
    */
275 275
   public function setClientSecret($clientSecret) {
276
-    global $apiConfig;
277
-    $apiConfig['oauth2_client_secret'] = $clientSecret;
278
-    self::$auth->clientSecret = $clientSecret;
276
+	global $apiConfig;
277
+	$apiConfig['oauth2_client_secret'] = $clientSecret;
278
+	self::$auth->clientSecret = $clientSecret;
279 279
   }
280 280
 
281 281
   /**
282 282
    * Get the OAuth 2.0 Client Secret.
283 283
    */
284 284
   public function getClientSecret() {
285
-    return self::$auth->clientSecret;
285
+	return self::$auth->clientSecret;
286 286
   }
287 287
 
288 288
   /**
@@ -290,16 +290,16 @@  discard block
 block discarded – undo
290 290
    * @param string $redirectUri
291 291
    */
292 292
   public function setRedirectUri($redirectUri) {
293
-    global $apiConfig;
294
-    $apiConfig['oauth2_redirect_uri'] = $redirectUri;
295
-    self::$auth->redirectUri = $redirectUri;
293
+	global $apiConfig;
294
+	$apiConfig['oauth2_redirect_uri'] = $redirectUri;
295
+	self::$auth->redirectUri = $redirectUri;
296 296
   }
297 297
 
298 298
   /**
299 299
    * Get the OAuth 2.0 Redirect URI.
300 300
    */
301 301
   public function getRedirectUri() {
302
-    return self::$auth->redirectUri;
302
+	return self::$auth->redirectUri;
303 303
   }
304 304
 
305 305
   /**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
    * @return void
309 309
    */
310 310
   public function refreshToken($refreshToken) {
311
-    self::$auth->refreshToken($refreshToken);
311
+	self::$auth->refreshToken($refreshToken);
312 312
   }
313 313
 
314 314
   /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
    * @return boolean Returns True if the revocation was successful, otherwise False.
320 320
    */
321 321
   public function revokeToken($token = null) {
322
-    self::$auth->revokeToken($token);
322
+	self::$auth->revokeToken($token);
323 323
   }
324 324
 
325 325
   /**
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
    * successful.
332 332
    */
333 333
   public function verifyIdToken($token = null) {
334
-    return self::$auth->verifyIdToken($token);
334
+	return self::$auth->verifyIdToken($token);
335 335
   }
336 336
 
337 337
   /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
    * @return void
340 340
    */
341 341
   public function setAssertionCredentials(Google_AssertionCredentials $creds) {
342
-    self::$auth->setAssertionCredentials($creds);
342
+	self::$auth->setAssertionCredentials($creds);
343 343
   }
344 344
 
345 345
   /**
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
    * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/moderator')
350 350
    */
351 351
   public function setScopes($scopes) {
352
-    $this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes;
352
+	$this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes;
353 353
   }
354 354
 
355 355
   /**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
    *
359 359
    */
360 360
   public function getScopes() {
361
-     return $this->scopes;
361
+	 return $this->scopes;
362 362
   }
363 363
 
364 364
   /**
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
    * @param array $requestVisibleActions Array of app activity types
371 371
    */
372 372
   public function setRequestVisibleActions($requestVisibleActions) {
373
-    self::$auth->requestVisibleActions =
374
-            join(" ", $requestVisibleActions);
373
+	self::$auth->requestVisibleActions =
374
+			join(" ", $requestVisibleActions);
375 375
   }
376 376
 
377 377
   /**
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
    * @experimental
383 383
    */
384 384
   public function setUseObjects($useObjects) {
385
-    global $apiConfig;
386
-    $apiConfig['use_objects'] = $useObjects;
385
+	global $apiConfig;
386
+	$apiConfig['use_objects'] = $useObjects;
387 387
   }
388 388
 
389 389
   /**
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
    * @experimental
395 395
    */
396 396
   public function setUseBatch($useBatch) {
397
-    self::$useBatch = $useBatch;
397
+	self::$useBatch = $useBatch;
398 398
   }
399 399
 
400 400
   /**
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
    * @return Google_Auth the implementation of apiAuth.
403 403
    */
404 404
   public static function getAuth() {
405
-    return Google_Client::$auth;
405
+	return Google_Client::$auth;
406 406
   }
407 407
 
408 408
   /**
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
    * @return Google_IO the implementation of apiIo.
411 411
    */
412 412
   public static function getIo() {
413
-    return Google_Client::$io;
413
+	return Google_Client::$io;
414 414
   }
415 415
 
416 416
   /**
417 417
    * @return Google_Cache the implementation of apiCache.
418 418
    */
419 419
   public function getCache() {
420
-    return Google_Client::$cache;
420
+	return Google_Client::$cache;
421 421
   }
422 422
 }
423 423
 
@@ -442,14 +442,14 @@  discard block
 block discarded – undo
442 442
    * response.  Defaults to [].
443 443
    */
444 444
   public function __construct($message, $code = 0, Exception $previous = null,
445
-                              $errors = array()) {
446
-    if(version_compare(PHP_VERSION, '5.3.0') >= 0) {
447
-      parent::__construct($message, $code, $previous);
448
-    } else {
449
-      parent::__construct($message, $code);
450
-    }
445
+							  $errors = array()) {
446
+	if(version_compare(PHP_VERSION, '5.3.0') >= 0) {
447
+	  parent::__construct($message, $code, $previous);
448
+	} else {
449
+	  parent::__construct($message, $code);
450
+	}
451 451
 
452
-    $this->errors = $errors;
452
+	$this->errors = $errors;
453 453
   }
454 454
 
455 455
   /**
@@ -466,6 +466,6 @@  discard block
 block discarded – undo
466 466
    * @return [{string, string}] List of errors return in an HTTP response or [].
467 467
    */
468 468
   public function getErrors() {
469
-    return $this->errors;
469
+	return $this->errors;
470 470
   }
471 471
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -17,42 +17,42 @@  discard block
 block discarded – undo
17 17
 
18 18
 // Check for the json extension, the Google APIs PHP Client won't function
19 19
 // without it.
20
-if (! function_exists('json_decode')) {
20
+if (!function_exists('json_decode')) {
21 21
   throw new Exception('Google PHP API Client requires the JSON PHP extension');
22 22
 }
23 23
 
24
-if (! function_exists('http_build_query')) {
24
+if (!function_exists('http_build_query')) {
25 25
   throw new Exception('Google PHP API Client requires http_build_query()');
26 26
 }
27 27
 
28
-if (! ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
28
+if (!ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
29 29
   date_default_timezone_set('UTC');
30 30
 }
31
-define("GA_API_Path", dirname(__FILE__) .'/');
31
+define("GA_API_Path", dirname(__FILE__).'/');
32 32
 // hack around with the include paths a bit so the library 'just works'
33 33
 //set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
34 34
 
35
-require_once (dirname(__FILE__) . "/config.php");
35
+require_once (dirname(__FILE__)."/config.php");
36 36
 // If a local configuration file is found, merge it's values with the default configuration
37
-if (file_exists(dirname(__FILE__)  . '/local_config.php')) {
37
+if (file_exists(dirname(__FILE__).'/local_config.php')) {
38 38
   $defaultConfig = $apiConfig;
39
-  require_once (dirname(__FILE__)  . '/local_config.php');
39
+  require_once (dirname(__FILE__).'/local_config.php');
40 40
   $apiConfig = array_merge($defaultConfig, $apiConfig);
41 41
 }
42 42
 
43 43
 // Include the top level classes, they each include their own dependencies
44
-require_once GA_API_Path. 'service/Google_Model.php';
45
-require_once GA_API_Path. 'service/Google_Service.php';
46
-require_once GA_API_Path. 'service/Google_ServiceResource.php';
47
-require_once GA_API_Path. 'auth/Google_AssertionCredentials.php';
48
-require_once GA_API_Path. 'auth/Google_Signer.php';
49
-require_once GA_API_Path. 'auth/Google_P12Signer.php';
50
-require_once GA_API_Path. 'service/Google_BatchRequest.php';
51
-require_once GA_API_Path. 'external/URITemplateParser.php';
52
-require_once GA_API_Path. 'auth/Google_Auth.php';
53
-require_once GA_API_Path. 'cache/Google_Cache.php';
54
-require_once GA_API_Path. 'io/Google_IO.php';
55
-require_once(GA_API_Path. 'service/Google_MediaFileUpload.php');
44
+require_once GA_API_Path.'service/Google_Model.php';
45
+require_once GA_API_Path.'service/Google_Service.php';
46
+require_once GA_API_Path.'service/Google_ServiceResource.php';
47
+require_once GA_API_Path.'auth/Google_AssertionCredentials.php';
48
+require_once GA_API_Path.'auth/Google_Signer.php';
49
+require_once GA_API_Path.'auth/Google_P12Signer.php';
50
+require_once GA_API_Path.'service/Google_BatchRequest.php';
51
+require_once GA_API_Path.'external/URITemplateParser.php';
52
+require_once GA_API_Path.'auth/Google_Auth.php';
53
+require_once GA_API_Path.'cache/Google_Cache.php';
54
+require_once GA_API_Path.'io/Google_IO.php';
55
+require_once(GA_API_Path.'service/Google_MediaFileUpload.php');
56 56
 
57 57
 /**
58 58
  * The Google API Client
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             $scopes[] = $val['scope'];
146 146
           }
147 147
         } else {
148
-          $scopes[] = 'https://www.googleapis.com/auth/' . $key;
148
+          $scopes[] = 'https://www.googleapis.com/auth/'.$key;
149 149
         }
150 150
         unset($val['discoveryURI']);
151 151
         unset($val['scope']);
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
    */
444 444
   public function __construct($message, $code = 0, Exception $previous = null,
445 445
                               $errors = array()) {
446
-    if(version_compare(PHP_VERSION, '5.3.0') >= 0) {
446
+    if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
447 447
       parent::__construct($message, $code, $previous);
448 448
     } else {
449 449
       parent::__construct($message, $code);
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/io/Google_HttpRequest.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,6 +44,9 @@  discard block
 block discarded – undo
44 44
   
45 45
   public $accessKey;
46 46
 
47
+  /**
48
+   * @param string|boolean $url
49
+   */
47 50
   public function __construct($url, $method = 'GET', $headers = array(), $postBody = null) {
48 51
     $this->setUrl($url);
49 52
     $this->setRequestMethod($method);
@@ -87,7 +90,7 @@  discard block
 block discarded – undo
87 90
   }
88 91
 
89 92
   /**
90
-   * @return string HTTP Response Code.
93
+   * @return integer HTTP Response Code.
91 94
    */
92 95
   public function getResponseHttpCode() {
93 96
     return (int) $this->responseHttpCode;
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 class Google_HttpRequest {
27 27
   const USER_AGENT_SUFFIX = "google-api-php-client/0.6.5";
28 28
   private $batchHeaders = array(
29
-    'Content-Type' => 'application/http',
30
-    'Content-Transfer-Encoding' => 'binary',
31
-    'MIME-Version' => '1.0',
32
-    'Content-Length' => ''
29
+	'Content-Type' => 'application/http',
30
+	'Content-Transfer-Encoding' => 'binary',
31
+	'MIME-Version' => '1.0',
32
+	'Content-Length' => ''
33 33
   );
34 34
 
35 35
   protected $url;
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
   public $accessKey;
46 46
 
47 47
   public function __construct($url, $method = 'GET', $headers = array(), $postBody = null) {
48
-    $this->setUrl($url);
49
-    $this->setRequestMethod($method);
50
-    $this->setRequestHeaders($headers);
51
-    $this->setPostBody($postBody);
52
-
53
-    global $apiConfig;
54
-    if (empty($apiConfig['application_name'])) {
55
-      $this->userAgent = self::USER_AGENT_SUFFIX;
56
-    } else {
57
-      $this->userAgent = $apiConfig['application_name'] . " " . self::USER_AGENT_SUFFIX;
58
-    }
48
+	$this->setUrl($url);
49
+	$this->setRequestMethod($method);
50
+	$this->setRequestHeaders($headers);
51
+	$this->setPostBody($postBody);
52
+
53
+	global $apiConfig;
54
+	if (empty($apiConfig['application_name'])) {
55
+	  $this->userAgent = self::USER_AGENT_SUFFIX;
56
+	} else {
57
+	  $this->userAgent = $apiConfig['application_name'] . " " . self::USER_AGENT_SUFFIX;
58
+	}
59 59
   }
60 60
 
61 61
   /**
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
    * @see http://oauth.net/core/1.0a/#anchor13
66 66
    */
67 67
   public function getBaseUrl() {
68
-    if ($pos = strpos($this->url, '?')) {
69
-      return substr($this->url, 0, $pos);
70
-    }
71
-    return $this->url;
68
+	if ($pos = strpos($this->url, '?')) {
69
+	  return substr($this->url, 0, $pos);
70
+	}
71
+	return $this->url;
72 72
   }
73 73
 
74 74
   /**
@@ -77,41 +77,41 @@  discard block
 block discarded – undo
77 77
    * @return array Query parameters in the query string.
78 78
    */
79 79
   public function getQueryParams() {
80
-    if ($pos = strpos($this->url, '?')) {
81
-      $queryStr = substr($this->url, $pos + 1);
82
-      $params = array();
83
-      parse_str($queryStr, $params);
84
-      return $params;
85
-    }
86
-    return array();
80
+	if ($pos = strpos($this->url, '?')) {
81
+	  $queryStr = substr($this->url, $pos + 1);
82
+	  $params = array();
83
+	  parse_str($queryStr, $params);
84
+	  return $params;
85
+	}
86
+	return array();
87 87
   }
88 88
 
89 89
   /**
90 90
    * @return string HTTP Response Code.
91 91
    */
92 92
   public function getResponseHttpCode() {
93
-    return (int) $this->responseHttpCode;
93
+	return (int) $this->responseHttpCode;
94 94
   }
95 95
 
96 96
   /**
97 97
    * @param int $responseHttpCode HTTP Response Code.
98 98
    */
99 99
   public function setResponseHttpCode($responseHttpCode) {
100
-    $this->responseHttpCode = $responseHttpCode;
100
+	$this->responseHttpCode = $responseHttpCode;
101 101
   }
102 102
 
103 103
   /**
104 104
    * @return $responseHeaders (array) HTTP Response Headers.
105 105
    */
106 106
   public function getResponseHeaders() {
107
-    return $this->responseHeaders;
107
+	return $this->responseHeaders;
108 108
   }
109 109
 
110 110
   /**
111 111
    * @return string HTTP Response Body
112 112
    */
113 113
   public function getResponseBody() {
114
-    return $this->responseBody;
114
+	return $this->responseBody;
115 115
   }
116 116
 
117 117
   /**
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
    * to be normalized.
120 120
    */
121 121
   public function setResponseHeaders($headers) {
122
-    $headers = Google_Utils::normalize($headers);
123
-    if ($this->responseHeaders) {
124
-      $headers = array_merge($this->responseHeaders, $headers);
125
-    }
122
+	$headers = Google_Utils::normalize($headers);
123
+	if ($this->responseHeaders) {
124
+	  $headers = array_merge($this->responseHeaders, $headers);
125
+	}
126 126
 
127
-    $this->responseHeaders = $headers;
127
+	$this->responseHeaders = $headers;
128 128
   }
129 129
 
130 130
   /**
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
    * false if unavailable.
134 134
    */
135 135
   public function getResponseHeader($key) {
136
-    return isset($this->responseHeaders[$key])
137
-        ? $this->responseHeaders[$key]
138
-        : false;
136
+	return isset($this->responseHeaders[$key])
137
+		? $this->responseHeaders[$key]
138
+		: false;
139 139
   }
140 140
 
141 141
   /**
142 142
    * @param string $responseBody The HTTP response body.
143 143
    */
144 144
   public function setResponseBody($responseBody) {
145
-    $this->responseBody = $responseBody;
145
+	$this->responseBody = $responseBody;
146 146
   }
147 147
 
148 148
   /**
@@ -150,21 +150,21 @@  discard block
 block discarded – undo
150 150
    */
151 151
 
152 152
   public function getUrl() {
153
-    return $this->url;
153
+	return $this->url;
154 154
   }
155 155
 
156 156
   /**
157 157
    * @return string $method HTTP Request Method.
158 158
    */
159 159
   public function getRequestMethod() {
160
-    return $this->requestMethod;
160
+	return $this->requestMethod;
161 161
   }
162 162
 
163 163
   /**
164 164
    * @return array $headers HTTP Request Headers.
165 165
    */
166 166
   public function getRequestHeaders() {
167
-    return $this->requestHeaders;
167
+	return $this->requestHeaders;
168 168
   }
169 169
 
170 170
   /**
@@ -173,32 +173,32 @@  discard block
 block discarded – undo
173 173
    * false if unavailable.
174 174
    */
175 175
   public function getRequestHeader($key) {
176
-    return isset($this->requestHeaders[$key])
177
-        ? $this->requestHeaders[$key]
178
-        : false;
176
+	return isset($this->requestHeaders[$key])
177
+		? $this->requestHeaders[$key]
178
+		: false;
179 179
   }
180 180
 
181 181
   /**
182 182
    * @return string $postBody HTTP Request Body.
183 183
    */
184 184
   public function getPostBody() {
185
-    return $this->postBody;
185
+	return $this->postBody;
186 186
   }
187 187
 
188 188
   /**
189 189
    * @param string $url the url to set
190 190
    */
191 191
   public function setUrl($url) {
192
-    if (substr($url, 0, 4) == 'http') {
193
-      $this->url = $url;
194
-    } else {
195
-      // Force the path become relative.
196
-      if (substr($url, 0, 1) !== '/') {
197
-        $url = '/' . $url;
198
-      }
199
-      global $apiConfig;
200
-      $this->url = $apiConfig['basePath'] . $url;
201
-    }
192
+	if (substr($url, 0, 4) == 'http') {
193
+	  $this->url = $url;
194
+	} else {
195
+	  // Force the path become relative.
196
+	  if (substr($url, 0, 1) !== '/') {
197
+		$url = '/' . $url;
198
+	  }
199
+	  global $apiConfig;
200
+	  $this->url = $apiConfig['basePath'] . $url;
201
+	}
202 202
   }
203 203
 
204 204
   /**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
    *
208 208
    */
209 209
   public function setRequestMethod($method) {
210
-    $this->requestMethod = strtoupper($method);
210
+	$this->requestMethod = strtoupper($method);
211 211
   }
212 212
 
213 213
   /**
@@ -215,18 +215,18 @@  discard block
 block discarded – undo
215 215
    * to be set and normalized.
216 216
    */
217 217
   public function setRequestHeaders($headers) {
218
-    $headers = Google_Utils::normalize($headers);
219
-    if ($this->requestHeaders) {
220
-      $headers = array_merge($this->requestHeaders, $headers);
221
-    }
222
-    $this->requestHeaders = $headers;
218
+	$headers = Google_Utils::normalize($headers);
219
+	if ($this->requestHeaders) {
220
+	  $headers = array_merge($this->requestHeaders, $headers);
221
+	}
222
+	$this->requestHeaders = $headers;
223 223
   }
224 224
 
225 225
   /**
226 226
    * @param string $postBody the postBody to set
227 227
    */
228 228
   public function setPostBody($postBody) {
229
-    $this->postBody = $postBody;
229
+	$this->postBody = $postBody;
230 230
   }
231 231
 
232 232
   /**
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
    * @param string $userAgent The User-Agent.
235 235
    */
236 236
   public function setUserAgent($userAgent) {
237
-    $this->userAgent = $userAgent;
237
+	$this->userAgent = $userAgent;
238 238
   }
239 239
 
240 240
   /**
241 241
    * @return string The User-Agent.
242 242
    */
243 243
   public function getUserAgent() {
244
-    return $this->userAgent;
244
+	return $this->userAgent;
245 245
   }
246 246
 
247 247
   /**
@@ -251,28 +251,28 @@  discard block
 block discarded – undo
251 251
    * @return string The md5 hash of the request cache key.
252 252
    */
253 253
   public function getCacheKey() {
254
-    $key = $this->getUrl();
254
+	$key = $this->getUrl();
255 255
 
256
-    if (isset($this->accessKey)) {
257
-      $key .= $this->accessKey;
258
-    }
256
+	if (isset($this->accessKey)) {
257
+	  $key .= $this->accessKey;
258
+	}
259 259
 
260
-    if (isset($this->requestHeaders['authorization'])) {
261
-      $key .= $this->requestHeaders['authorization'];
262
-    }
260
+	if (isset($this->requestHeaders['authorization'])) {
261
+	  $key .= $this->requestHeaders['authorization'];
262
+	}
263 263
 
264
-    return md5($key);
264
+	return md5($key);
265 265
   }
266 266
 
267 267
   public function getParsedCacheControl() {
268
-    $parsed = array();
269
-    $rawCacheControl = $this->getResponseHeader('cache-control');
270
-    if ($rawCacheControl) {
271
-      $rawCacheControl = str_replace(', ', '&', $rawCacheControl);
272
-      parse_str($rawCacheControl, $parsed);
273
-    }
274
-
275
-    return $parsed;
268
+	$parsed = array();
269
+	$rawCacheControl = $this->getResponseHeader('cache-control');
270
+	if ($rawCacheControl) {
271
+	  $rawCacheControl = str_replace(', ', '&', $rawCacheControl);
272
+	  parse_str($rawCacheControl, $parsed);
273
+	}
274
+
275
+	return $parsed;
276 276
   }
277 277
 
278 278
   /**
@@ -280,25 +280,25 @@  discard block
 block discarded – undo
280 280
    * @return string A string representation of the HTTP Request.
281 281
    */
282 282
   public function toBatchString($id) {
283
-    $str = '';
284
-    foreach($this->batchHeaders as $key => $val) {
285
-      $str .= $key . ': ' . $val . "\n";
286
-    }
287
-
288
-    $str .= "Content-ID: $id\n";
289
-    $str .= "\n";
290
-
291
-    $path = parse_url($this->getUrl(), PHP_URL_PATH);
292
-    $str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";
293
-    foreach($this->getRequestHeaders() as $key => $val) {
294
-      $str .= $key . ': ' . $val . "\n";
295
-    }
296
-
297
-    if ($this->getPostBody()) {
298
-      $str .= "\n";
299
-      $str .= $this->getPostBody();
300
-    }
301
-
302
-    return $str;
283
+	$str = '';
284
+	foreach($this->batchHeaders as $key => $val) {
285
+	  $str .= $key . ': ' . $val . "\n";
286
+	}
287
+
288
+	$str .= "Content-ID: $id\n";
289
+	$str .= "\n";
290
+
291
+	$path = parse_url($this->getUrl(), PHP_URL_PATH);
292
+	$str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";
293
+	foreach($this->getRequestHeaders() as $key => $val) {
294
+	  $str .= $key . ': ' . $val . "\n";
295
+	}
296
+
297
+	if ($this->getPostBody()) {
298
+	  $str .= "\n";
299
+	  $str .= $this->getPostBody();
300
+	}
301
+
302
+	return $str;
303 303
   }
304 304
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     if (empty($apiConfig['application_name'])) {
55 55
       $this->userAgent = self::USER_AGENT_SUFFIX;
56 56
     } else {
57
-      $this->userAgent = $apiConfig['application_name'] . " " . self::USER_AGENT_SUFFIX;
57
+      $this->userAgent = $apiConfig['application_name']." ".self::USER_AGENT_SUFFIX;
58 58
     }
59 59
   }
60 60
 
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
     } else {
195 195
       // Force the path become relative.
196 196
       if (substr($url, 0, 1) !== '/') {
197
-        $url = '/' . $url;
197
+        $url = '/'.$url;
198 198
       }
199 199
       global $apiConfig;
200
-      $this->url = $apiConfig['basePath'] . $url;
200
+      $this->url = $apiConfig['basePath'].$url;
201 201
     }
202 202
   }
203 203
 
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
    */
282 282
   public function toBatchString($id) {
283 283
     $str = '';
284
-    foreach($this->batchHeaders as $key => $val) {
285
-      $str .= $key . ': ' . $val . "\n";
284
+    foreach ($this->batchHeaders as $key => $val) {
285
+      $str .= $key.': '.$val."\n";
286 286
     }
287 287
 
288 288
     $str .= "Content-ID: $id\n";
289 289
     $str .= "\n";
290 290
 
291 291
     $path = parse_url($this->getUrl(), PHP_URL_PATH);
292
-    $str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";
293
-    foreach($this->getRequestHeaders() as $key => $val) {
294
-      $str .= $key . ': ' . $val . "\n";
292
+    $str .= $this->getRequestMethod().' '.$path." HTTP/1.1\n";
293
+    foreach ($this->getRequestHeaders() as $key => $val) {
294
+      $str .= $key.': '.$val."\n";
295 295
     }
296 296
 
297 297
     if ($this->getPostBody()) {
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/io/Google_HttpStreamIO.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -140,6 +140,9 @@
 block discarded – undo
140 140
   public function setOptions($options) {
141 141
   }
142 142
 
143
+  /**
144
+   * @return integer
145
+   */
143 146
   private function getHttpResponseCode($response_headers) {
144 147
     $header_count = count($response_headers);
145 148
 
Please login to merge, or discard this patch.
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
   private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
29 29
 
30 30
   private static $DEFAULT_HTTP_CONTEXT = array(
31
-    "follow_location" => 0,
32
-    "ignore_errors" => 1,
31
+	"follow_location" => 0,
32
+	"ignore_errors" => 1,
33 33
   );
34 34
 
35 35
   private static $DEFAULT_SSL_CONTEXT = array(
36
-    "verify_peer" => true,
36
+	"verify_peer" => true,
37 37
   );
38 38
 
39 39
   /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
    * responseHttpCode, responseHeaders and responseBody.
48 48
    */
49 49
   public function authenticatedRequest(Google_HttpRequest $request) {
50
-    $request = Google_Client::$auth->sign($request);
51
-    return $this->makeRequest($request);
50
+	$request = Google_Client::$auth->sign($request);
51
+	return $this->makeRequest($request);
52 52
   }
53 53
 
54 54
   /**
@@ -60,77 +60,77 @@  discard block
 block discarded – undo
60 60
    * @throws Google_IOException on curl or IO error
61 61
    */
62 62
   public function makeRequest(Google_HttpRequest $request) {
63
-    // First, check to see if we have a valid cached version.
64
-    $cached = $this->getCachedRequest($request);
65
-    if ($cached !== false) {
66
-      if (!$this->checkMustRevaliadateCachedRequest($cached, $request)) {
67
-        return $cached;
68
-      }
69
-    }
70
-
71
-    $default_options = stream_context_get_options(stream_context_get_default());
72
-
73
-    $requestHttpContext = array_key_exists('http', $default_options) ?
74
-        $default_options['http'] : array();
75
-    if (array_key_exists($request->getRequestMethod(),
76
-          self::$ENTITY_HTTP_METHODS)) {
77
-      $request = $this->processEntityRequest($request);
78
-    }
79
-
80
-    if ($request->getPostBody()) {
81
-      $requestHttpContext["content"] = $request->getPostBody();
82
-    }
83
-
84
-    $requestHeaders = $request->getRequestHeaders();
85
-    if ($requestHeaders && is_array($requestHeaders)) {
86
-      $headers = "";
87
-      foreach($requestHeaders as $k => $v) {
88
-        $headers .= "$k: $v\n";
89
-      }
90
-      $requestHttpContext["header"] = $headers;
91
-    }
92
-
93
-    $requestHttpContext["method"] = $request->getRequestMethod();
94
-    $requestHttpContext["user_agent"] = $request->getUserAgent();
95
-
96
-    $requestSslContext = array_key_exists('ssl', $default_options) ?
97
-        $default_options['ssl'] : array();
98
-
99
-    if (!array_key_exists("cafile", $requestSslContext)) {
100
-      $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
101
-    }
102
-
103
-    $options = array("http" => array_merge(self::$DEFAULT_HTTP_CONTEXT,
104
-                                                 $requestHttpContext),
105
-                     "ssl" => array_merge(self::$DEFAULT_SSL_CONTEXT,
106
-                                          $requestSslContext));
107
-
108
-    $context = stream_context_create($options);
109
-
110
-    $response_data = file_get_contents($request->getUrl(),
111
-                                       false,
112
-                                       $context);
113
-
114
-    if (false === $response_data) {
115
-      throw new Google_IOException("HTTP Error: Unable to connect");
116
-    }
117
-
118
-    $respHttpCode = $this->getHttpResponseCode($http_response_header);
119
-    $responseHeaders = $this->getHttpResponseHeaders($http_response_header);
120
-
121
-    if ($respHttpCode == 304 && $cached) {
122
-      // If the server responded NOT_MODIFIED, return the cached request.
123
-      $this->updateCachedRequest($cached, $responseHeaders);
124
-      return $cached;
125
-    }
126
-
127
-    $request->setResponseHttpCode($respHttpCode);
128
-    $request->setResponseHeaders($responseHeaders);
129
-    $request->setResponseBody($response_data);
130
-    // Store the request in cache (the function checks to see if the request
131
-    // can actually be cached)
132
-    $this->setCachedRequest($request);
133
-    return $request;
63
+	// First, check to see if we have a valid cached version.
64
+	$cached = $this->getCachedRequest($request);
65
+	if ($cached !== false) {
66
+	  if (!$this->checkMustRevaliadateCachedRequest($cached, $request)) {
67
+		return $cached;
68
+	  }
69
+	}
70
+
71
+	$default_options = stream_context_get_options(stream_context_get_default());
72
+
73
+	$requestHttpContext = array_key_exists('http', $default_options) ?
74
+		$default_options['http'] : array();
75
+	if (array_key_exists($request->getRequestMethod(),
76
+		  self::$ENTITY_HTTP_METHODS)) {
77
+	  $request = $this->processEntityRequest($request);
78
+	}
79
+
80
+	if ($request->getPostBody()) {
81
+	  $requestHttpContext["content"] = $request->getPostBody();
82
+	}
83
+
84
+	$requestHeaders = $request->getRequestHeaders();
85
+	if ($requestHeaders && is_array($requestHeaders)) {
86
+	  $headers = "";
87
+	  foreach($requestHeaders as $k => $v) {
88
+		$headers .= "$k: $v\n";
89
+	  }
90
+	  $requestHttpContext["header"] = $headers;
91
+	}
92
+
93
+	$requestHttpContext["method"] = $request->getRequestMethod();
94
+	$requestHttpContext["user_agent"] = $request->getUserAgent();
95
+
96
+	$requestSslContext = array_key_exists('ssl', $default_options) ?
97
+		$default_options['ssl'] : array();
98
+
99
+	if (!array_key_exists("cafile", $requestSslContext)) {
100
+	  $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
101
+	}
102
+
103
+	$options = array("http" => array_merge(self::$DEFAULT_HTTP_CONTEXT,
104
+												 $requestHttpContext),
105
+					 "ssl" => array_merge(self::$DEFAULT_SSL_CONTEXT,
106
+										  $requestSslContext));
107
+
108
+	$context = stream_context_create($options);
109
+
110
+	$response_data = file_get_contents($request->getUrl(),
111
+									   false,
112
+									   $context);
113
+
114
+	if (false === $response_data) {
115
+	  throw new Google_IOException("HTTP Error: Unable to connect");
116
+	}
117
+
118
+	$respHttpCode = $this->getHttpResponseCode($http_response_header);
119
+	$responseHeaders = $this->getHttpResponseHeaders($http_response_header);
120
+
121
+	if ($respHttpCode == 304 && $cached) {
122
+	  // If the server responded NOT_MODIFIED, return the cached request.
123
+	  $this->updateCachedRequest($cached, $responseHeaders);
124
+	  return $cached;
125
+	}
126
+
127
+	$request->setResponseHttpCode($respHttpCode);
128
+	$request->setResponseHeaders($responseHeaders);
129
+	$request->setResponseBody($response_data);
130
+	// Store the request in cache (the function checks to see if the request
131
+	// can actually be cached)
132
+	$this->setCachedRequest($request);
133
+	return $request;
134 134
   }
135 135
 
136 136
   /**
@@ -141,30 +141,30 @@  discard block
 block discarded – undo
141 141
   }
142 142
 
143 143
   private function getHttpResponseCode($response_headers) {
144
-    $header_count = count($response_headers);
145
-
146
-    for ($i = 0; $i < $header_count; $i++) {
147
-      $header = $response_headers[$i];
148
-      if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
149
-        $response = explode(' ', $header);
150
-        return $response[1];
151
-      }
152
-    }
153
-    return 'UNKNOWN';
144
+	$header_count = count($response_headers);
145
+
146
+	for ($i = 0; $i < $header_count; $i++) {
147
+	  $header = $response_headers[$i];
148
+	  if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
149
+		$response = explode(' ', $header);
150
+		return $response[1];
151
+	  }
152
+	}
153
+	return 'UNKNOWN';
154 154
   }
155 155
 
156 156
   private function getHttpResponseHeaders($response_headers) {
157
-    $header_count = count($response_headers);
158
-    $headers = array();
159
-
160
-    for ($i = 0; $i < $header_count; $i++) {
161
-      $header = $response_headers[$i];
162
-      $header_parts = explode(':', $header);
163
-      if (count($header_parts) == 2) {
164
-        $headers[$header_parts[0]] = $header_parts[1];
165
-      }
166
-    }
167
-
168
-    return $headers;
157
+	$header_count = count($response_headers);
158
+	$headers = array();
159
+
160
+	for ($i = 0; $i < $header_count; $i++) {
161
+	  $header = $response_headers[$i];
162
+	  $header_parts = explode(':', $header);
163
+	  if (count($header_parts) == 2) {
164
+		$headers[$header_parts[0]] = $header_parts[1];
165
+	  }
166
+	}
167
+
168
+	return $headers;
169 169
   }
170 170
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     $requestHeaders = $request->getRequestHeaders();
85 85
     if ($requestHeaders && is_array($requestHeaders)) {
86 86
       $headers = "";
87
-      foreach($requestHeaders as $k => $v) {
87
+      foreach ($requestHeaders as $k => $v) {
88 88
         $headers .= "$k: $v\n";
89 89
       }
90 90
       $requestHttpContext["header"] = $headers;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $default_options['ssl'] : array();
98 98
 
99 99
     if (!array_key_exists("cafile", $requestSslContext)) {
100
-      $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
100
+      $requestSslContext["cafile"] = dirname(__FILE__).'/cacerts.pem';
101 101
     }
102 102
 
103 103
     $options = array("http" => array_merge(self::$DEFAULT_HTTP_CONTEXT,
Please login to merge, or discard this patch.