corrideat
Forum Replies Created
-
Forum: Plugins
In reply to: [Simple Calendar - Google Calendar Plugin] Add 'last of day shortcodes
--- class-gce-event.orig.php 2015-04-09 16:55:13.091716545 -0400
+++ class-gce-event.php 2015-04-22 19:20:54.866423462 -0400
@@ -96,7 +96,7 @@ class GCE_Event {
*
* @since 2.0.0
*/
- function get_event_markup( $display_type, $num_in_day, $num ) {
+ function get_event_markup( $display_type, $num_in_day, $num, $last = 0) {
//Set the display type (either tooltip or list)
$this->type = $display_type;@@ -106,6 +106,9 @@ class GCE_Event {
//Set the position of this event in array of events currently being processed
$this->pos = $num;+ //Is last
+ $this->last = $last;
+
$this->time_now = current_time( 'timestamp' );// First check if we use the builder or not
@@ -257,6 +260,8 @@ class GCE_Event {
'if-not-ended', //The event has not ended (and even if it hasn't started)
'if-first', //The event is the first in the day
'if-not-first', //The event is not the first in the day
+ 'if-last', //The event is the last in the day
+ 'if-not-last', //The event is not the last in the day
'if-multi-day', //The event spans multiple days
'if-single-day' //The event does not span multiple days
);
@@ -502,6 +507,18 @@ class GCE_Event {return '';
+ case 'if-last':
+ if ( true == $this->last )
+ return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6];
+
+ return '';
+
+ case 'if-not-last':
+ if ( false == $this->last )
+ return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6];
+
+ return '';
+
case 'if-multi-day':
if ( 'MPD' == $this->day_type || 'MWD' == $this->day_type )
return $m[1] . $this->look_for_shortcodes( $m[5] ) . $m[6];
@@ -561,4 +578,4 @@ class GCE_Event {
return sprintf( $smallest[0], 1 );
}
}
-}
\ No newline at end of file
+}Then calls to get_event_markup in class-gce-display.php look like
$event->get_event_markup( 'list', $num_in_day, $i, ($num_in_day === (count($event_day) - 1))?1:0 ).Thanks,