PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | includes/class-give-stats.php +23 -46 2.3.14.16.9 View file →
@@ -129,9 +129,8 @@
129 129
130 130 if ( empty( $_end_date ) ) {
131 131 $_end_date = $_start_date;
132 132 }
133 -
134 133 $this->start_date = $this->convert_date( $_start_date );
135 134 $this->end_date = $this->convert_date( $_end_date, true );
136 135 }
137 136
@@ -162,10 +161,9 @@
162 161
163 162 // This is a predefined date rate, such as last_week
164 163 switch ( $date ) {
165 164
166 - case 'this_month' :
167 -
165 + case 'this_month':
168 166 if ( $end_date ) {
169 167
170 168 $day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
171 169 $hour = 23;
@@ -174,10 +172,9 @@
174 172 }
175 173
176 174 break;
177 175
178 - case 'last_month' :
179 -
176 + case 'last_month':
180 177 if ( $month == 1 ) {
181 178
182 179 $month = 12;
183 180 $year --;
@@ -193,10 +190,9 @@
193 190 }
194 191
195 192 break;
196 193
197 - case 'today' :
198 -
194 + case 'today':
199 195 $day = date( 'd', current_time( 'timestamp' ) );
200 196
201 197 if ( $end_date ) {
202 198 $hour = 23;
@@ -205,10 +201,9 @@
205 201 }
206 202
207 203 break;
208 204
209 - case 'yesterday' :
210 -
205 + case 'yesterday':
211 206 $day = date( 'd', current_time( 'timestamp' ) ) - 1;
212 207
213 208 // Check if Today is the first day of the month (meaning subtracting one will get us 0)
214 209 if ( $day < 1 ) {
@@ -223,9 +218,9 @@
223 218 } else {
224 219
225 220 // Go back one month and get the last day of the month
226 221 $month -= 1;
227 - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
222 + $day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
228 223
229 224 }
230 225 }
231 226
@@ -230,10 +225,9 @@
230 225 }
231 226
232 227 break;
233 228
234 - case 'this_week' :
235 -
229 + case 'this_week':
236 230 $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
237 231 $today = date( 'j', current_time( 'timestamp' ) ) * 60 * 60 * 24;
238 232
239 233 if ( $today <= $days_to_week_start ) {
@@ -242,9 +236,8 @@
242 236 $month -= 1;
243 237 } else {
244 238 $month = 12;
245 239 }
246 -
247 240 }
248 241
249 242 if ( ! $end_date ) {
250 243
@@ -249,9 +242,9 @@
249 242 if ( ! $end_date ) {
250 243
251 244 // Getting the start day
252 245
253 - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
246 + $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
254 247 $day += get_option( 'start_of_week' );
255 248
256 249 } else {
257 250
@@ -256,9 +249,9 @@
256 249 } else {
257 250
258 251 // Getting the end day
259 252
260 - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
253 + $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
261 254 $day += get_option( 'start_of_week' ) + 6;
262 255
263 256 }
264 257
@@ -263,10 +256,9 @@
263 256 }
264 257
265 258 break;
266 259
267 - case 'last_week' :
268 -
260 + case 'last_week':
269 261 $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
270 262 $today = date( 'j', current_time( 'timestamp' ) ) * 60 * 60 * 24;
271 263
272 264 if ( $today <= $days_to_week_start ) {
@@ -275,9 +267,8 @@
275 267 $month -= 1;
276 268 } else {
277 269 $month = 12;
278 270 }
279 -
280 271 }
281 272
282 273 if ( ! $end_date ) {
283 274
@@ -282,9 +273,9 @@
282 273 if ( ! $end_date ) {
283 274
284 275 // Getting the start day
285 276
286 - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
277 + $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
287 278 $day += get_option( 'start_of_week' );
288 279
289 280 } else {
290 281
@@ -289,9 +280,9 @@
289 280 } else {
290 281
291 282 // Getting the end day
292 283
293 - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
284 + $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
294 285 $day += get_option( 'start_of_week' ) + 6;
295 286
296 287 }
297 288
@@ -296,10 +287,9 @@
296 287 }
297 288
298 289 break;
299 290
300 - case 'this_quarter' :
301 -
291 + case 'this_quarter':
302 292 $month_now = date( 'n', current_time( 'timestamp' ) );
303 293
304 294 if ( $month_now <= 3 ) {
305 295
@@ -311,11 +301,10 @@
311 301 $hour = 23;
312 302 $minute = 59;
313 303 $second = 59;
314 304 }
305 + } elseif ( $month_now <= 6 ) {
315 306
316 - } else if ( $month_now <= 6 ) {
317 -
318 307 if ( ! $end_date ) {
319 308 $month = 4;
320 309 } else {
321 310 $month = 6;
@@ -323,11 +312,10 @@
323 312 $hour = 23;
324 313 $minute = 59;
325 314 $second = 59;
326 315 }
316 + } elseif ( $month_now <= 9 ) {
327 317
328 - } else if ( $month_now <= 9 ) {
329 -
330 318 if ( ! $end_date ) {
331 319 $month = 7;
332 320 } else {
333 321 $month = 9;
@@ -335,9 +323,8 @@
335 323 $hour = 23;
336 324 $minute = 59;
337 325 $second = 59;
338 326 }
339 -
340 327 } else {
341 328
342 329 if ( ! $end_date ) {
343 330 $month = 10;
@@ -347,15 +334,13 @@
347 334 $hour = 23;
348 335 $minute = 59;
349 336 $second = 59;
350 337 }
351 -
352 338 }
353 339
354 340 break;
355 341
356 - case 'last_quarter' :
357 -
342 + case 'last_quarter':
358 343 $month_now = date( 'n', current_time( 'timestamp' ) );
359 344
360 345 if ( $month_now <= 3 ) {
361 346
@@ -361,9 +346,9 @@
361 346
362 347 if ( ! $end_date ) {
363 348 $month = 10;
364 349 } else {
365 - $year -= 1;
350 + $year -= 1;
366 351 $month = 12;
367 352 $day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
368 353 $hour = 23;
369 354 $minute = 59;
@@ -368,11 +353,10 @@
368 353 $hour = 23;
369 354 $minute = 59;
370 355 $second = 59;
371 356 }
357 + } elseif ( $month_now <= 6 ) {
372 358
373 - } else if ( $month_now <= 6 ) {
374 -
375 359 if ( ! $end_date ) {
376 360 $month = 1;
377 361 } else {
378 362 $month = 3;
@@ -380,11 +364,10 @@
380 364 $hour = 23;
381 365 $minute = 59;
382 366 $second = 59;
383 367 }
368 + } elseif ( $month_now <= 9 ) {
384 369
385 - } else if ( $month_now <= 9 ) {
386 -
387 370 if ( ! $end_date ) {
388 371 $month = 4;
389 372 } else {
390 373 $month = 6;
@@ -392,9 +375,8 @@
392 375 $hour = 23;
393 376 $minute = 59;
394 377 $second = 59;
395 378 }
396 -
397 379 } else {
398 380
399 381 if ( ! $end_date ) {
400 382 $month = 7;
@@ -404,15 +386,13 @@
404 386 $hour = 23;
405 387 $minute = 59;
406 388 $second = 59;
407 389 }
408 -
409 390 }
410 391
411 392 break;
412 393
413 - case 'this_year' :
414 -
394 + case 'this_year':
415 395 if ( ! $end_date ) {
416 396 $month = 1;
417 397 } else {
418 398 $month = 12;
@@ -423,10 +403,9 @@
423 403 }
424 404
425 405 break;
426 406
427 - case 'last_year' :
428 -
407 + case 'last_year':
429 408 $year -= 1;
430 409 if ( ! $end_date ) {
431 410 $month = 1;
432 411 } else {
@@ -439,16 +418,14 @@
439 418
440 419 break;
441 420
442 421 }
422 + } elseif ( is_numeric( $date ) ) {
443 423
444 -
445 - } else if ( is_numeric( $date ) ) {
446 -
447 424 // return $date unchanged since it is a timestamp
448 425 $this->timestamp = true;
449 426
450 - } else if ( false !== strtotime( $date ) ) {
427 + } elseif ( false !== strtotime( $date ) ) {
451 428
452 429 $date = strtotime( $date, current_time( 'timestamp' ) );
453 430 $year = date( 'Y', $date );
454 431 $month = date( 'm', $date );
@@ -477,9 +454,9 @@
477 454 * @since 1.0
478 455 * @access public
479 456 *
480 457 * @param string $where SQL WHERE statment.
481 - *
458 + *
482 459 * @return string
483 460 */
484 461 public function count_where( $where = '' ) {
485 462 // Only get payments in our date range