Guest User

Untitled

a guest
Dec 14th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. /**
  2. * Testing the pmprosed_fixDate function.
  3. * 1. Make sure PMPro and PMPro Set Expiration Dates is active.
  4. * 2. Add this code to a custom plugin.
  5. * 3. Visit ?test_date_functions=1 to a URL
  6. * 4. Remember to remove the code when done.
  7. */
  8. function test_set_expiration_dates() {
  9. if( empty( $_REQUEST['test_date_functions'] ) ) {
  10. return;
  11. }
  12.  
  13. echo "Today is " . date( 'Y-m-d', current_time( 'timestamp' ) ) . "<hr />";
  14.  
  15. if( ! function_exists( 'pmprosed_fixDate' ) && ! function_exists( 'pmprosd_daysUntilDate' ) ) {
  16. die( 'Please activate PMPro and the PMPro Set Expiration Dates or PMPro Subscription Delays Add Ons.' );
  17. }
  18.  
  19. $dates = array(
  20. '2018-12-31',
  21. '2019-01-01',
  22. '2019-04-10',
  23. 'Y1-M1-01',
  24. 'Y1-M1-14',
  25. 'Y1-M1-15',
  26. 'Y1-12-01',
  27. 'Y1-12-14',
  28. 'Y1-12-15',
  29. 'Y1-12-31',
  30. 'Y1-01-01',
  31. 'Y1-01-14',
  32. 'Y1-01-15',
  33. 'Y1-04-10',
  34. 'Y2-01-01',
  35. 'Y2-12-31',
  36. 'Y2-M2-01',
  37. 'Y1-M2-01',
  38. );
  39.  
  40. foreach( $dates as $date ) {
  41. if( function_exists( 'pmprosed_fixDate' ) ) {
  42. echo "(" . $date . " => " . pmprosed_fixDate( $date ) . ")<br />";
  43. }
  44. if( function_exists( 'pmprosd_daysUntilDate' ) ) {
  45. echo "(" . $date . " => " . pmprosd_daysUntilDate( $date ) . ")<br />";
  46. }
  47. echo "<hr />";
  48. }
  49.  
  50. exit;
  51. }
  52. add_action( 'init', 'test_set_expiration_dates' );
Add Comment
Please, Sign In to add comment