WordPress.org

Plugin Directory

Changeset 610511


Ignore:
Timestamp:
10/10/12 21:44:10 (18 months ago)
Author:
joedolson
Message:

Hot fix to remove a PHP warning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • my-calendar/trunk/my-calendar-output.php

    r610194 r610511  
    1616function mc_set_date_array( $events ) { 
    1717    $event_array = array(); 
    18     foreach ( $events as $event ) { 
    19         $date = date( 'Y-m-d',strtotime($event->occur_begin) ); 
    20         $end = date( 'Y-m-d',strtotime($event->occur_end) ); 
    21         if ( $date != $end ) { 
    22             $start = strtotime($date); 
    23             $end = strtotime($end); 
    24             do { 
    25                 $date = date('Y-m-d',$start); 
     18    if ( is_array($events) ) { 
     19        foreach ( $events as $event ) { 
     20            $date = date( 'Y-m-d',strtotime($event->occur_begin) ); 
     21            $end = date( 'Y-m-d',strtotime($event->occur_end) ); 
     22            if ( $date != $end ) { 
     23                $start = strtotime($date); 
     24                $end = strtotime($end); 
     25                do { 
     26                    $date = date('Y-m-d',$start); 
     27                    $event_array[$date][] = $event;  
     28                    $start = strtotime( "+1 day",$start );           
     29                } while ( $start <= $end );  
     30            } else { 
    2631                $event_array[$date][] = $event;  
    27                 $start = strtotime( "+1 day",$start );           
    28             } while ( $start <= $end );  
    29         } else { 
    30             $event_array[$date][] = $event;  
     32            } 
    3133        } 
    3234    } 
Note: See TracChangeset for help on using the changeset viewer.