Amazon_S3_And_CloudFront::get_year_month_directory_name PHP Method

get_year_month_directory_name() public method

Generate the year and month sub-directory from $time if provided, then POST time if available, otherwise use current time
public get_year_month_directory_name ( string $time = null ) : string
$time string
return string
    function get_year_month_directory_name($time = null)
    {
        if (!$time && isset($_POST['post_id'])) {
            $time = get_post_field('post_date', $_POST['post_id']);
        }
        if (!$time) {
            $time = current_time('mysql');
        }
        $y = substr($time, 0, 4);
        $m = substr($time, 5, 2);
        $subdir = "/{$y}/{$m}";
        if (false === strpos($subdir, '//')) {
            return $subdir;
        }
        return '';
    }
Amazon_S3_And_CloudFront