Event List - Version 0.4.2

Version Description

(2013-06-09) =

  • fixed links urls to events in eventlist-widget
  • added option to show date only once per day
Download this release

Release Info

Developer mibuthu
Plugin Icon 128x128 Event List
Version 0.4.2
Comparing to
See all releases

Code changes from version 0.4.1 to 0.4.2

event-list.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Event List
4
  Plugin URI: http://wordpress.org/extend/plugins/event-list/
5
  Description: Manage your events and show them in a list view on your site.
6
- Version: 0.4.1
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
3
  Plugin Name: Event List
4
  Plugin URI: http://wordpress.org/extend/plugins/event-list/
5
  Description: Manage your events and show them in a list view on your site.
6
+ Version: 0.4.2
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
includes/options.php CHANGED
@@ -24,26 +24,34 @@ class EL_Options {
24
  $this->group = 'event-list';
25
 
26
  $this->options = array(
27
- 'el_db_version' => array( 'section' => 'system',
28
- 'type' => 'text',
29
- 'std_val' => '',
30
- 'label' => '',
31
- 'caption' => '',
32
- 'desc' => 'Database version' ),
33
 
34
- 'el_categories' => array( 'section' => 'categories',
35
- 'type' => 'category',
36
- 'std_val' => null,
37
- 'label' => 'Event Categories',
38
- 'caption' => '',
39
- 'desc' => 'This option specifies all event category data.' ),
40
 
41
- 'el_no_event_text' => array( 'section' => 'general',
42
- 'type' => 'text',
43
- 'std_val' => 'no event',
44
- 'label' => 'Text for no events',
45
- 'caption' => '',
46
- 'desc' => 'This option defines the text which is displayed if no events are available for the selected view.' )
 
 
 
 
 
 
 
 
47
  );
48
  }
49
 
24
  $this->group = 'event-list';
25
 
26
  $this->options = array(
27
+ 'el_db_version' => array( 'section' => 'system',
28
+ 'type' => 'text',
29
+ 'std_val' => '',
30
+ 'label' => '',
31
+ 'caption' => '',
32
+ 'desc' => 'Database version' ),
33
 
34
+ 'el_categories' => array( 'section' => 'categories',
35
+ 'type' => 'category',
36
+ 'std_val' => null,
37
+ 'label' => 'Event Categories',
38
+ 'caption' => '',
39
+ 'desc' => 'This option specifies all event category data.' ),
40
 
41
+ 'el_no_event_text' => array( 'section' => 'general',
42
+ 'type' => 'text',
43
+ 'std_val' => 'no event',
44
+ 'label' => 'Text for no events',
45
+ 'caption' => '',
46
+ 'desc' => 'This option defines the text which is displayed if no events are available for the selected view.' ),
47
+
48
+ 'el_date_once_per_day' => array( 'section' => 'general',
49
+ 'type' => 'checkbox',
50
+ 'std_val' => '',
51
+ 'label' => 'Date display',
52
+ 'caption' => 'Show date only once per day',
53
+ 'desc' => 'With this option you can display the date only once per day if multiple events are available on the same day.<br />
54
+ If this option is enabled the events are ordered in a different way (end date before start time) to allow using the same date for as much events as possible.' ),
55
  );
56
  }
57
 
includes/sc_event-list.php CHANGED
@@ -200,7 +200,15 @@ class SC_Event_List {
200
  $a['num_events'] = 0;
201
  }
202
  $cat_filter = 'none' === $a['cat_filter'] ? null : explode( ',', $a['cat_filter'] );
203
- $events = $this->db->get_events( $a['ytd'], $a['num_events'], $cat_filter );
 
 
 
 
 
 
 
 
204
  $out = '';
205
  // TODO: add rss feed
206
  // if ($mfgigcal_settings['rss']) {
@@ -228,10 +236,13 @@ class SC_Event_List {
228
  }
229
 
230
  private function html_event( &$event, &$a, $single_day_only=false ) {
 
231
  $max_length = is_numeric( $a['event_id'] ) ? 0 : 999999;
232
  $out = '
233
  <li class="event">';
234
- $out .= $this->html_fulldate( $event->start_date, $event->end_date, $single_day_only );
 
 
235
  $out .= '
236
  <div class="event-info';
237
  if( $single_day_only ) {
@@ -244,7 +255,7 @@ class SC_Event_List {
244
 
245
  $title = $this->db->truncate( min( $max_length, $a['title_length'] ), $event->title );
246
  if( $this->is_visible( $a['link_to_event'] ) ) {
247
- $out .= '<a href="'.$this->get_url( $a ).'event_id_'.$a['sc_id_for_url'].'='.$event->id.'">'.$title.'</a>';
248
  }
249
  else {
250
  $out .= $title;
@@ -269,6 +280,8 @@ class SC_Event_List {
269
  }
270
  $out .= '</div>
271
  </li>';
 
 
272
  return $out;
273
  }
274
 
@@ -321,7 +334,7 @@ class SC_Event_List {
321
  $url = $this->get_url( $a );
322
  $out .= '<div class="subsubsub">';
323
  if( is_numeric( $a['ytd'] ) || is_numeric( $a['event_id'] ) ) {
324
- $out .= '<a href="'.$url.'ytd_'.$a['sc_id_for_url'].'=upcoming">Upcoming</a>';
325
  }
326
  else {
327
  $out .= '<strong>Upcoming</strong>';
@@ -332,7 +345,7 @@ class SC_Event_List {
332
  $out .= '<strong>'.$year.'</strong>';
333
  }
334
  else {
335
- $out .= '<a href="'.$url.'ytd_'.$a['sc_id_for_url'].'='.$year.'">'.$year.'</a>';
336
  }
337
  }
338
  $out .= '</div><br />';
@@ -362,18 +375,13 @@ class SC_Event_List {
362
  if( '' !== $a['url_to_page'] ) {
363
  // use given url
364
  $url = $a['url_to_page'];
365
- $url .= get_option( 'permalink_structure' ) ? '?' : '&amp;';
366
- }
367
- elseif( get_option( 'permalink_structure' ) ) {
368
- // permalink structure
369
- $url = get_permalink().'?';
370
  }
371
  else {
372
- // no permalink structure
373
- $url ='?';
374
  foreach( $_GET as $k => $v ) {
375
  if( 'ytd_'.$a['sc_id'] !== $k && 'event_id_'.$a['sc_id'] !== $k && 'link_'.$a['sc_id'] !== $k ) {
376
- $url .= $k.'='.$v.'&amp;';
377
  }
378
  }
379
  }
200
  $a['num_events'] = 0;
201
  }
202
  $cat_filter = 'none' === $a['cat_filter'] ? null : explode( ',', $a['cat_filter'] );
203
+ if( '1' !== $this->options->get( 'el_date_once_per_day' ) ) {
204
+ // normal sort
205
+ $sort_array = array( 'start_date ASC', 'time ASC', 'end_date ASC' );
206
+ }
207
+ else {
208
+ // sort according end_date before start time (required for option el_date_once_per_day)
209
+ $sort_array = array( 'start_date ASC', 'end_date ASC', 'time ASC' );
210
+ }
211
+ $events = $this->db->get_events( $a['ytd'], $a['num_events'], $cat_filter, $sort_array );
212
  $out = '';
213
  // TODO: add rss feed
214
  // if ($mfgigcal_settings['rss']) {
236
  }
237
 
238
  private function html_event( &$event, &$a, $single_day_only=false ) {
239
+ static $last_event_startdate, $last_event_enddate;
240
  $max_length = is_numeric( $a['event_id'] ) ? 0 : 999999;
241
  $out = '
242
  <li class="event">';
243
+ if( '1' !== $this->options->get( 'el_date_once_per_day' ) || $last_event_startdate !== $event->start_date || $last_event_enddate !== $event->end_date ) {
244
+ $out .= $this->html_fulldate( $event->start_date, $event->end_date, $single_day_only );
245
+ }
246
  $out .= '
247
  <div class="event-info';
248
  if( $single_day_only ) {
255
 
256
  $title = $this->db->truncate( min( $max_length, $a['title_length'] ), $event->title );
257
  if( $this->is_visible( $a['link_to_event'] ) ) {
258
+ $out .= '<a href="'.add_query_arg( 'event_id_'.$a['sc_id_for_url'], $event->id, $this->get_url( $a ) ).'">'.$title.'</a>';
259
  }
260
  else {
261
  $out .= $title;
280
  }
281
  $out .= '</div>
282
  </li>';
283
+ $last_event_startdate = $event->start_date;
284
+ $last_event_enddate = $event->end_date;
285
  return $out;
286
  }
287
 
334
  $url = $this->get_url( $a );
335
  $out .= '<div class="subsubsub">';
336
  if( is_numeric( $a['ytd'] ) || is_numeric( $a['event_id'] ) ) {
337
+ $out .= '<a href="'.add_query_arg( 'ytd_'.$a['sc_id_for_url'], 'upcoming', $url ).'">Upcoming</a>';
338
  }
339
  else {
340
  $out .= '<strong>Upcoming</strong>';
345
  $out .= '<strong>'.$year.'</strong>';
346
  }
347
  else {
348
+ $out .= '<a href="'.add_query_arg( 'ytd_'.$a['sc_id_for_url'], $year, $url ).'">'.$year.'</a>';
349
  }
350
  }
351
  $out .= '</div><br />';
375
  if( '' !== $a['url_to_page'] ) {
376
  // use given url
377
  $url = $a['url_to_page'];
 
 
 
 
 
378
  }
379
  else {
380
+ // use actual page
381
+ $url = get_permalink();
382
  foreach( $_GET as $k => $v ) {
383
  if( 'ytd_'.$a['sc_id'] !== $k && 'event_id_'.$a['sc_id'] !== $k && 'link_'.$a['sc_id'] !== $k ) {
384
+ $url = add_query_arg( $k, $v, $url );
385
  }
386
  }
387
  }
includes/widget.php CHANGED
@@ -143,8 +143,8 @@ class EL_Widget extends WP_Widget {
143
  $shortcode .= ' details_length='.$instance['details_length'];
144
  if( $linked_page_is_set && $linked_page_id_is_set ) {
145
  $shortcode .= ' link_to_event='.$instance['link_to_event'];
146
- $shortcode .= ' url_to_page="'.$instance['url_to_page'];
147
- $shortcode .= ' sc_id_for_url="'.$instance['sc_id_for_url'];
148
  }
149
  else {
150
  $shortcode .= ' link_to_event=false';
143
  $shortcode .= ' details_length='.$instance['details_length'];
144
  if( $linked_page_is_set && $linked_page_id_is_set ) {
145
  $shortcode .= ' link_to_event='.$instance['link_to_event'];
146
+ $shortcode .= ' url_to_page="'.$instance['url_to_page'].'"';
147
+ $shortcode .= ' sc_id_for_url='.$instance['sc_id_for_url'];
148
  }
149
  else {
150
  $shortcode .= ' link_to_event=false';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, admin, attribute, widget, sidebar
5
  Requires at least: 3.3
6
  Tested up to: 3.5.1
7
- Stable tag: 0.4.1
8
  Plugin URI: http://wordpress.org/extend/plugins/event-list
9
  Licence: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -66,6 +66,11 @@ Yes, you can create an instance of the "SC_Event_List" class which located in "p
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
69
  = 0.4.1 (2013-05-31) =
70
 
71
  * fixed deleting of categories
4
  Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, admin, attribute, widget, sidebar
5
  Requires at least: 3.3
6
  Tested up to: 3.5.1
7
+ Stable tag: 0.4.2
8
  Plugin URI: http://wordpress.org/extend/plugins/event-list
9
  Licence: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
66
 
67
  == Changelog ==
68
 
69
+ = 0.4.2 (2013-06-09) =
70
+
71
+ * fixed links urls to events in eventlist-widget
72
+ * added option to show date only once per day
73
+
74
  = 0.4.1 (2013-05-31) =
75
 
76
  * fixed deleting of categories