@@ 776-804 (lines=29) @@ | ||
773 | $dates['year'] = date( 'Y', $current_time ); |
|
774 | break; |
|
775 | ||
776 | case 'yesterday' : |
|
777 | ||
778 | $year = date( 'Y', $current_time ); |
|
779 | $month = date( 'n', $current_time ); |
|
780 | $day = date( 'd', $current_time ); |
|
781 | ||
782 | if ( $month == 1 && $day == 1 ) { |
|
783 | ||
784 | $year -= 1; |
|
785 | $month = 12; |
|
786 | $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
787 | ||
788 | } elseif ( $month > 1 && $day == 1 ) { |
|
789 | ||
790 | $month -= 1; |
|
791 | $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
792 | ||
793 | } else { |
|
794 | ||
795 | $day -= 1; |
|
796 | ||
797 | } |
|
798 | ||
799 | $dates['day'] = $day; |
|
800 | $dates['m_start'] = $month; |
|
801 | $dates['m_end'] = $month; |
|
802 | $dates['year'] = $year; |
|
803 | ||
804 | break; |
|
805 | ||
806 | case 'this_quarter' : |
|
807 | $month_now = date( 'n', $current_time ); |
@@ 663-691 (lines=29) @@ | ||
660 | $dates['year_end'] = date( 'Y', $current_time ); |
|
661 | break; |
|
662 | ||
663 | case 'yesterday': |
|
664 | $year = date( 'Y', $current_time ); |
|
665 | $month = date( 'n', $current_time ); |
|
666 | $day = date( 'd', $current_time ); |
|
667 | ||
668 | if ( $month == 1 && $day == 1 ) { |
|
669 | ||
670 | $year -= 1; |
|
671 | $month = 12; |
|
672 | $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
673 | ||
674 | } elseif ( $month > 1 && $day == 1 ) { |
|
675 | ||
676 | $month -= 1; |
|
677 | $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
678 | ||
679 | } else { |
|
680 | ||
681 | $day -= 1; |
|
682 | ||
683 | } |
|
684 | ||
685 | $dates['day'] = $day; |
|
686 | $dates['m_start'] = $month; |
|
687 | $dates['m_end'] = $month; |
|
688 | $dates['year'] = $year; |
|
689 | $dates['year_end'] = $year; |
|
690 | break; |
|
691 | ||
692 | case 'this_week': |
|
693 | $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
694 | $dates['day'] += get_option( 'start_of_week' ); |