/**
 * Testing the pmprosed_fixDate function.
 * 1. Make sure PMPro and PMPro Set Expiration Dates is active.
 * 2. Add this code to a custom plugin.
 * 3. Visit ?test_date_functions=1 to a URL
 * 4. Remember to remove the code when done.
 */
function test_set_expiration_dates() {
    if( empty( $_REQUEST['test_date_functions'] ) ) {
        return;
    }
    
    echo "Today is " . date( 'Y-m-d', current_time( 'timestamp' ) ) . "<hr />";
    
	if( ! function_exists( 'pmprosed_fixDate' ) && ! function_exists( 'pmprosd_daysUntilDate' ) ) {
		die( 'Please activate PMPro and the PMPro Set Expiration Dates or PMPro Subscription Delays Add Ons.' );
	}

    $dates = array(
        '2018-12-31',
        '2019-01-01',
        '2019-04-10',
        'Y1-M1-01',
        'Y1-M1-14',
        'Y1-M1-15',
        'Y1-12-01',
        'Y1-12-14',
        'Y1-12-15',
        'Y1-12-31',
        'Y1-01-01',
        'Y1-01-14',
        'Y1-01-15',
        'Y1-04-10',
        'Y2-01-01',
        'Y2-12-31',
        'Y2-M2-01',
        'Y1-M2-01',
    );
    
    foreach( $dates as $date ) {
        if( function_exists( 'pmprosed_fixDate' ) ) {
		echo "(" . $date . " => " . pmprosed_fixDate( $date ) . ")<br />";
	}
	if( function_exists( 'pmprosd_daysUntilDate' ) ) {
		echo "(" . $date . " => " . pmprosd_daysUntilDate( $date ) . ")<br />";
	}
	echo "<hr />";
    }
    
    exit;
}
add_action( 'init', 'test_set_expiration_dates' );