Event List - Version 0.5.0

Version Description

(2013-10-26) =

  • added event feed with a lot of options
  • added widget option for cat filter
Download this release

Release Info

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

Code changes from version 0.4.5 to 0.5.0

admin/includes/admin-settings.php CHANGED
@@ -57,7 +57,8 @@ class EL_Admin_Settings {
57
  }
58
  */
59
  private function show_tabs($current = 'category') {
60
- $tabs = array('general' => 'General');
 
61
  $out = '<h3 class="nav-tab-wrapper">';
62
  foreach($tabs as $tab => $name){
63
  $class = ($tab == $current) ? ' nav-tab-active' : '';
57
  }
58
  */
59
  private function show_tabs($current = 'category') {
60
+ $tabs = array('general' => 'General',
61
+ 'feed' => 'Feed Settings');
62
  $out = '<h3 class="nav-tab-wrapper">';
63
  foreach($tabs as $tab => $name){
64
  $class = ($tab == $current) ? ' nav-tab-active' : '';
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.5
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
@@ -33,6 +33,7 @@ if( !defined( 'ABSPATH' ) ) {
33
  define( 'EL_URL', plugin_dir_url( __FILE__ ) );
34
  define( 'EL_PATH', plugin_dir_path( __FILE__ ) );
35
 
 
36
 
37
  // MAIN PLUGIN CLASS
38
  class Event_List {
@@ -50,6 +51,13 @@ class Event_List {
50
  add_shortcode( 'event-list', array( &$this, 'shortcode_event_list' ) );
51
  // Register widgets
52
  add_action( 'widgets_init', array( &$this, 'widget_init' ) );
 
 
 
 
 
 
 
53
 
54
  // ADMIN PAGE:
55
  if ( is_admin() ) {
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.5.0
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
33
  define( 'EL_URL', plugin_dir_url( __FILE__ ) );
34
  define( 'EL_PATH', plugin_dir_path( __FILE__ ) );
35
 
36
+ require_once(EL_PATH.'includes/options.php');
37
 
38
  // MAIN PLUGIN CLASS
39
  class Event_List {
51
  add_shortcode( 'event-list', array( &$this, 'shortcode_event_list' ) );
52
  // Register widgets
53
  add_action( 'widgets_init', array( &$this, 'widget_init' ) );
54
+ // Add RSS Feed page
55
+ $options = EL_Options::get_instance();
56
+ if($options->get('el_enable_feed')) {
57
+ include_once(EL_PATH.'includes/feed.php');
58
+ $feed = EL_Feed::get_instance();
59
+ //echo $feed->create_events_feed();
60
+ }
61
 
62
  // ADMIN PAGE:
63
  if ( is_admin() ) {
includes/css/event-list.css CHANGED
@@ -1,21 +1,9 @@
1
- /*
2
- a.rss-link {
3
- display:block;
4
- height:16px;
5
- float:right;
6
- background:transparent url(images/icon-rss.png) right top no-repeat;
7
- padding-right:20px;
8
- line-height:16px;
9
- }
10
- */
11
-
12
  ul.event-list-view, ul.single-event-view {
13
  list-style: none;
14
  margin: 1em 0 1.5em 0;
15
  padding: 0;
16
  }
17
 
18
-
19
  li.event {
20
  clear: both;
21
  }
@@ -96,3 +84,15 @@ li.event {
96
  .event-details {
97
  font-size: 0.8em;
98
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ul.event-list-view, ul.single-event-view {
2
  list-style: none;
3
  margin: 1em 0 1.5em 0;
4
  padding: 0;
5
  }
6
 
 
7
  li.event {
8
  clear: both;
9
  }
84
  .event-details {
85
  font-size: 0.8em;
86
  }
87
+
88
+ div.feed {
89
+ display: block;
90
+ }
91
+
92
+ div.feed a * {
93
+ vertical-align: middle;
94
+ }
95
+
96
+ div.feed img {
97
+ margin: 0px 5px 0px 2px;
98
+ }
includes/feed.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!defined('ABSPATH')) {
3
+ exit;
4
+ }
5
+
6
+ require_once(EL_PATH.'includes/db.php');
7
+ require_once(EL_PATH.'includes/options.php');
8
+
9
+ // This class handles rss feeds
10
+ class EL_Feed {
11
+
12
+ private static $instance;
13
+ private $db;
14
+ private $options;
15
+
16
+ public static function &get_instance() {
17
+ // Create class instance if required
18
+ if(!isset(self::$instance)) {
19
+ self::$instance = new self();
20
+ self::$instance->init();
21
+ }
22
+ // Return class instance
23
+ return self::$instance;
24
+ }
25
+
26
+ private function __construct() {
27
+ $this->db = EL_Db::get_instance();
28
+ $this->options = EL_Options::get_instance();
29
+ }
30
+
31
+ public function init() {
32
+ if($this->options->get('el_head_feed_link')) {
33
+ add_action('wp_head', array(&$this, 'print_head_feed_link'));
34
+ }
35
+ add_action('do_feed_eventlist', array(&$this, 'create_eventlist_feed'), 10, 1);
36
+ add_filter('generate_rewrite_rules', array(&$this, 'eventlist_feed_rewrite'));
37
+ }
38
+
39
+ public function print_head_feed_link() {
40
+ echo '<link rel="alternate" type="application/rss+xml" title=" &raquo; Eventlist Feed" href="http://zeus/wp-plugins/?feed=eventlist" />';
41
+ }
42
+
43
+ public function create_eventlist_feed() {
44
+ header('Content-Type: '.feed_content_type('rss-http').'; charset='.get_option('blog_charset'), true);
45
+ $events = $this->db->get_events();
46
+
47
+ // Print feeds
48
+ echo
49
+ '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?>
50
+ <rss version="2.0"
51
+ xmlns:content="http://purl.org/rss/1.0/modules/content/"
52
+ xmlns:wfw="http://wellformedweb.org/CommentAPI/"
53
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
54
+ xmlns:atom="http://www.w3.org/2005/Atom"
55
+ xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
56
+ xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
57
+ >
58
+ <channel>
59
+ <title>'.get_bloginfo_rss('name').'</title>
60
+ <atom:link href="'.apply_filters('self_link', get_bloginfo()).'" rel="self" type="application/rss+xml" />
61
+ <link>'.get_bloginfo_rss('url').'</link>
62
+ <description>'.__('Eventlist').'</description>
63
+ <lastBuildDate>'.mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false).'</lastBuildDate>
64
+ <language>'.get_option('rss_language').'</language>
65
+ <sy:updatePeriod>'.apply_filters('rss_update_period', 'hourly').'</sy:updatePeriod>
66
+ <sy:updateFrequency>'.apply_filters('rss_update_frequency', '1').'</sy:updateFrequency>
67
+ '; do_action('rss2_head');
68
+ if(!empty($events)) {
69
+ foreach ($events as $event) {
70
+ echo '
71
+ <item>
72
+ <title>'.esc_attr($this->format_date($event->start_date, $event->end_date).' - '.$event->title).'</title>
73
+ <pubDate>'.mysql2date('D, d M Y H:i:s +0000', $event->start_date, false).'</pubDate>
74
+ <description>'.esc_attr($this->format_date($event->start_date, $event->end_date).' '.
75
+ ('' != $event->time ? $event->time : '').('' != $event->location ? ' - '.$event->location : '')).'</description>
76
+ '.('' != $event->details ?
77
+ '<content:encoded><![CDATA['.esc_attr($this->format_date($event->start_date, $event->end_date).' '.
78
+ ('' != $event->time ? $event->time : '').('' != $event->location ? ' - '.$event->location : '')).
79
+ $event->details.']]></content:encoded>' : '').'
80
+ </item>';
81
+ }
82
+ }
83
+ echo '
84
+ </channel>
85
+ </rss>';
86
+ }
87
+
88
+ function eventlist_feed_rewrite() {
89
+ global $wp_rewrite;
90
+ $feed_rules = array('feed/(.+)' => 'index.php?feed='.$wp_rewrite->preg_index(1),
91
+ '(.+).xml' => 'index.php?feed='.$wp_rewrite->preg_index(1));
92
+ $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
93
+ return $wp_rewrite->rules;
94
+ }
95
+
96
+ function format_date($start_date, $end_date) {
97
+ $startArray = explode("-", $start_date);
98
+ $start_date = mktime(0,0,0,$startArray[1],$startArray[2],$startArray[0]);
99
+
100
+ $endArray = explode("-", $end_date);
101
+ $end_date = mktime(0,0,0,$endArray[1],$endArray[2],$endArray[0]);
102
+
103
+ $event_date = '';
104
+
105
+ if ($start_date == $end_date) {
106
+ if ($startArray[2] == "00") {
107
+ $start_date = mktime(0,0,0,$startArray[1],15,$startArray[0]);
108
+ $event_date .= date("F, Y", $start_date);
109
+ return $event_date;
110
+ }
111
+ $event_date .= date("M j, Y", $start_date);
112
+ return $event_date;
113
+ }
114
+
115
+ if ($startArray[0] == $endArray[0]) {
116
+ if ($startArray[1] == $endArray[1]) {
117
+ $event_date .= date("M j", $start_date) . "-" . date("j, Y", $end_date);
118
+ return $event_date;
119
+ }
120
+ $event_date .= date("M j", $start_date) . "-" . date("M j, Y", $end_date);
121
+ return $event_date;
122
+
123
+ }
124
+
125
+ $event_date .= date("M j, Y", $start_date) . "-" . date("M j, Y", $end_date);
126
+ return $event_date;
127
+ }
128
+ }
129
+ ?>
includes/options.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if( !defined( 'ABSPATH' ) ) {
3
  exit;
4
  }
5
 
@@ -12,7 +12,7 @@ class EL_Options {
12
 
13
  public static function &get_instance() {
14
  // Create class instance if required
15
- if( !isset( self::$instance ) ) {
16
  self::$instance = new EL_Options();
17
  self::$instance->init();
18
  }
@@ -20,71 +20,124 @@ class EL_Options {
20
  return self::$instance;
21
  }
22
 
23
- public function __construct() {
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_sync_cats' => array( 'section' => 'categories',
42
- 'type' => 'checkbox',
43
- 'std_val' => '',
44
- 'label' => __('Sync Categories'),
45
- 'caption' => __('Keep event categories in sync with post categories automatically'),
46
- 'desc' => '<table><tr style="vertical-align:top"><td><strong>'.__('Attention').':</strong></td>
47
- <td>'.__('Please note that this option will delete all categories which are not available in the post categories! Existing Categories with the same slug will be updated.').'</td></tr></table>'),
48
-
49
- 'el_no_event_text' => array( 'section' => 'general',
50
- 'type' => 'text',
51
- 'std_val' => 'no event',
52
- 'label' => __('Text for no events'),
53
- 'caption' => '',
54
- 'desc' => __('This option defines the text which is displayed if no events are available for the selected view.')),
55
-
56
- 'el_date_once_per_day' => array( 'section' => 'general',
57
- 'type' => 'checkbox',
58
- 'std_val' => '',
59
- 'label' => __('Date display'),
60
- 'caption' => __('Show date only once per day'),
61
- 'desc' => __('With this option you can display the date only once per day if multiple events are available on the same day.<br />
62
- 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.')),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  );
64
  }
65
 
66
  public function init() {
67
- add_action( 'admin_init', array( &$this, 'register' ) );
68
  }
69
 
70
  public function register() {
71
- foreach( $this->options as $oname => $o ) {
72
- register_setting( 'el_'.$o['section'], $oname );
73
  }
74
  }
75
 
76
- public function set( $name, $value ) {
77
- if( isset( $this->options[$name] ) ) {
78
- return update_option( $name, $value );
79
  }
80
  else {
81
  return false;
82
  }
83
  }
84
 
85
- public function get( $name ) {
86
- if( isset( $this->options[$name] ) ) {
87
- return get_option( $name, $this->options[$name]['std_val'] );
88
  }
89
  else {
90
  return null;
1
  <?php
2
+ if(!defined('ABSPATH')) {
3
  exit;
4
  }
5
 
12
 
13
  public static function &get_instance() {
14
  // Create class instance if required
15
+ if(!isset(self::$instance)) {
16
  self::$instance = new EL_Options();
17
  self::$instance->init();
18
  }
20
  return self::$instance;
21
  }
22
 
23
+ private function __construct() {
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_sync_cats' => array('section' => 'categories',
42
+ 'type' => 'checkbox',
43
+ 'std_val' => '',
44
+ 'label' => __('Sync Categories'),
45
+ 'caption' => __('Keep event categories in sync with post categories automatically'),
46
+ 'desc' => '<table><tr style="vertical-align:top"><td><strong>'.__('Attention').':</strong></td>
47
+ <td>'.__('Please note that this option will delete all categories which are not available in the post categories! Existing Categories with the same slug will be updated.').'</td></tr></table>'),
48
+
49
+ 'el_no_event_text' => array('section' => 'general',
50
+ 'type' => 'text',
51
+ 'std_val' => 'no event',
52
+ 'label' => __('Text for no events'),
53
+ 'caption' => '',
54
+ 'desc' => __('This option defines the text which is displayed if no events are available for the selected view.')),
55
+
56
+ 'el_date_once_per_day' => array('section' => 'general',
57
+ 'type' => 'checkbox',
58
+ 'std_val' => '',
59
+ 'label' => __('Date display'),
60
+ 'caption' => __('Show date only once per day'),
61
+ 'desc' => __('With this option you can display the date only once per day if multiple events are available on the same day.<br />
62
+ 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.')),
63
+
64
+ 'el_enable_feed' => array('section' => 'feed',
65
+ 'type' => 'checkbox',
66
+ 'std_val' => '',
67
+ 'label' => __('Enable RSS feed'),
68
+ 'caption' => __('Enable support for an event RSS feed'),
69
+ 'desc' => __('This option activates a RSS feed for the events.<br />
70
+ You have to enable this option if you want to use one of the RSS feed features.')),
71
+
72
+ 'el_head_feed_link' => array('section' => 'feed',
73
+ 'type' => 'checkbox',
74
+ 'std_val' => '',
75
+ 'label' => __('Add RSS feed link in head'),
76
+ 'caption' => __('Add RSS feed link in the html head'),
77
+ 'desc' => __('This option adds a RSS feed in the html head for the events.<br />
78
+ You have 2 possibilities to include the RSS feed:<br />
79
+ The first option is to use this option to include a link in the html head. This link will be recognized by browers or feed readers.<br />
80
+ The second possibility is to include a visible feed link directly in the event list. This can be done by setting the shortcode attribute "add_feed_link" to "true"<br />
81
+ This option is only valid if the option "Enable RSS feed" is enabled.')),
82
+
83
+ 'el_feed_link_pos' => array('section' => 'feed',
84
+ 'type' => 'radio',
85
+ 'std_val' => 'bottom',
86
+ 'label' => __('Position of the RSS feed link'),
87
+ 'caption' => array('top' => 'at the top (above the navigation bar)', 'below_nav' => 'between navigation bar and events', 'bottom' => 'at the bottom'),
88
+ 'desc' => __('This option specifies the position of the RSS feed link in the event list.<br />
89
+ The options are to display the link at the top, at the bottom or between the navigation bar and the event list.<br />
90
+ You have to set the shortcode attribute "add_feed_link" to "true" if you want to show the feed link.')),
91
+
92
+ 'el_feed_link_align' => array('section' => 'feed',
93
+ 'type' => 'radio',
94
+ 'std_val' => 'left',
95
+ 'label' => __('Align of the RSS feed link'),
96
+ 'caption' => array('left' => 'left', 'center' => 'center', 'right' => 'right'),
97
+ 'desc' => __('This option specifies the align of the RSS feed link in the event list.<br />
98
+ The link can be displayed on the left side, centered or on the right.<br />
99
+ You have to set the shortcode attribute "add_feed_link" to "true" if you want to show the feed link.')),
100
+
101
+ 'el_feed_link_text' => array('section' => 'feed',
102
+ 'type' => 'text',
103
+ 'std_val' => 'RSS Feed',
104
+ 'label' => __('Feed link text'),
105
+ 'desc' => __('This option specifies the caption of the RSS feed link in the event list.<br />
106
+ Insert an empty text to hide any text if you only want to show the rss image.<br />
107
+ You have to set the shortcode attribute "add_feed_link" to "true" if you want to show the feed link.')),
108
+
109
+ 'el_feed_link_img' => array('section' => 'feed',
110
+ 'type' => 'checkbox',
111
+ 'std_val' => '1',
112
+ 'label' => __('Feed link image'),
113
+ 'caption' => __('Show rss image in feed link'),
114
+ 'desc' => __('This option specifies if the an image should be dispayed in the feed link in front of the text.<br />
115
+ You have to set the shortcode attribute "add_feed_link" to "true" if you want to show the feed link.')),
116
  );
117
  }
118
 
119
  public function init() {
120
+ add_action('admin_init', array(&$this, 'register'));
121
  }
122
 
123
  public function register() {
124
+ foreach($this->options as $oname => $o) {
125
+ register_setting('el_'.$o['section'], $oname);
126
  }
127
  }
128
 
129
+ public function set($name, $value) {
130
+ if(isset($this->options[$name])) {
131
+ return update_option($name, $value);
132
  }
133
  else {
134
  return false;
135
  }
136
  }
137
 
138
+ public function get($name) {
139
+ if(isset($this->options[$name])) {
140
+ return get_option($name, $this->options[$name]['std_val']);
141
  }
142
  else {
143
  return null;
includes/sc_event-list.php CHANGED
@@ -43,7 +43,7 @@ class SC_Event_List {
43
  'cat_filter' => array( 'val' => 'none<br />category slug',
44
  'std_val' => 'none',
45
  'visible' => true,
46
- 'desc' => 'This attribute specifies events of which categories are shown. The standard is "none" to show all events.<br />
47
  Specify a category slug or a list of category slugs separated by a comma "," e.g. "tennis,hockey" to only show events of the specified categories.' ),
48
 
49
  'num_events' => array( 'val' => 'number',
@@ -100,6 +100,15 @@ class SC_Event_List {
100
  'desc' => 'This attribute specifies if a link to the single event should be added onto the event name in the event list.<br />
101
  Choose "false" to never add and "true" to always add the link.<br />
102
  With "event_list_only" the link is only added in the event list and with "single_event_only" only for a single event'),
 
 
 
 
 
 
 
 
 
103
  // Invisible attributes ('visibe' = false): This attributes are required for the widget but will not be listed in the attributes table on the admin info page
104
  'title_length' => array( 'val' => 'number',
105
  'std_val' => '0',
@@ -213,15 +222,12 @@ class SC_Event_List {
213
  $sort_array = array( 'start_date ASC', 'end_date ASC', 'time ASC' );
214
  }
215
  $events = $this->db->get_events( $a['ytd'], $a['num_events'], $cat_filter, $sort_array );
216
- $out = '';
217
- // TODO: add rss feed
218
- // if ($mfgigcal_settings['rss']) {
219
- // (get_option('permalink_structure')) ? $feed_link = "/feed/events" : $feed_link = "/?feed=events";
220
- // $out .= "<a href=\"$feed_link\" class=\"rss-link\">RSS</a>";
221
- // }
222
 
223
  // generate output
 
 
224
  $out .= $this->html_calendar_nav( $a );
 
225
  if( empty( $events ) ) {
226
  // no events found
227
  $out .= '<p>'.$this->options->get( 'el_no_event_text' ).'</p>';
@@ -236,6 +242,7 @@ class SC_Event_List {
236
  }
237
  $out .= '</ul>';
238
  }
 
239
  return $out;
240
  }
241
 
@@ -257,9 +264,9 @@ class SC_Event_List {
257
  }
258
  $out .= '"><h3>';
259
 
260
- $title = $this->db->truncate( min( $max_length, $a['title_length'] ), $event->title );
261
  if( $this->is_visible( $a['link_to_event'] ) ) {
262
- $out .= '<a href="'.add_query_arg( 'event_id_'.$a['sc_id_for_url'], $event->id, $this->get_url( $a ) ).'">'.$title.'</a>';
263
  }
264
  else {
265
  $out .= $title;
@@ -271,13 +278,13 @@ class SC_Event_List {
271
  if( empty( $date_array['errors']) && is_numeric( $date_array['hour'] ) && is_numeric( $date_array['minute'] ) ) {
272
  $event->time = mysql2date( get_option( 'time_format' ), $event->time );
273
  }
274
- $out .= '<span class="event-time">'.$event->time.'</span>';
275
  }
276
  if( $this->is_visible( $a['show_location'] ) ) {
277
- $out .= '<span class="event-location">'.$this->db->truncate( min( $max_length, $a['location_length'] ), $event->location ).'</span>';
278
  }
279
  if( $this->is_visible( $a['show_cat'] ) ) {
280
- $out .= '<div class="event-cat">'.$this->categories->get_category_string( $event->categories ).'</div>';
281
  }
282
  if( $this->is_visible( $a['show_details'] ) ) {
283
  $out .= '<div class="event-details">'.$this->db->truncate( min( $max_length, $a['details_length'] ), do_shortcode( $event->details ) ).'</div>';
@@ -356,6 +363,37 @@ class SC_Event_List {
356
  return $out;
357
  }
358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  private function get_ytd( &$a ) {
360
  if( isset( $_GET['ytd_'.$a['sc_id']] ) && 'upcoming' === $_GET['ytd_'.$a['sc_id']] ){
361
  // ytd is 'upcoming'
43
  'cat_filter' => array( 'val' => 'none<br />category slug',
44
  'std_val' => 'none',
45
  'visible' => true,
46
+ 'desc' => 'This attribute specifies the categories of which events are shown. The standard is "none" to show all events.<br />
47
  Specify a category slug or a list of category slugs separated by a comma "," e.g. "tennis,hockey" to only show events of the specified categories.' ),
48
 
49
  'num_events' => array( 'val' => 'number',
100
  'desc' => 'This attribute specifies if a link to the single event should be added onto the event name in the event list.<br />
101
  Choose "false" to never add and "true" to always add the link.<br />
102
  With "event_list_only" the link is only added in the event list and with "single_event_only" only for a single event'),
103
+
104
+ 'add_feed_link' => array( 'val' => 'false<br />true<br />event_list_only<br />single_event_only',
105
+ 'std_val' => 'false',
106
+ 'visible' => true,
107
+ 'desc' => 'This attribute specifies if a rss feed link should be added.<br />
108
+ You have to enable the feed in the eventlist options to make this attribute workable.<br />
109
+ In the options you can also find some settings to modify the output.<br />
110
+ Choose "false" to never add and "true" to always add the link.<br />
111
+ With "event_list_only" the link is only added in the event list and with "single_event_only" only for a single event'),
112
  // Invisible attributes ('visibe' = false): This attributes are required for the widget but will not be listed in the attributes table on the admin info page
113
  'title_length' => array( 'val' => 'number',
114
  'std_val' => '0',
222
  $sort_array = array( 'start_date ASC', 'end_date ASC', 'time ASC' );
223
  }
224
  $events = $this->db->get_events( $a['ytd'], $a['num_events'], $cat_filter, $sort_array );
 
 
 
 
 
 
225
 
226
  // generate output
227
+ $out = '';
228
+ $out .= $this->html_feed_link($a, 'top');
229
  $out .= $this->html_calendar_nav( $a );
230
+ $out .= $this->html_feed_link($a, 'below_nav');
231
  if( empty( $events ) ) {
232
  // no events found
233
  $out .= '<p>'.$this->options->get( 'el_no_event_text' ).'</p>';
242
  }
243
  $out .= '</ul>';
244
  }
245
+ $out .= $this->html_feed_link($a, 'bottom');
246
  return $out;
247
  }
248
 
264
  }
265
  $out .= '"><h3>';
266
 
267
+ $title = esc_attr($this->db->truncate(min($max_length, $a['title_length']), $event->title));
268
  if( $this->is_visible( $a['link_to_event'] ) ) {
269
+ $out .= '<a href="'.esc_html(add_query_arg('event_id_'.$a['sc_id_for_url'], $event->id, $this->get_url($a))).'">'.$title.'</a>';
270
  }
271
  else {
272
  $out .= $title;
278
  if( empty( $date_array['errors']) && is_numeric( $date_array['hour'] ) && is_numeric( $date_array['minute'] ) ) {
279
  $event->time = mysql2date( get_option( 'time_format' ), $event->time );
280
  }
281
+ $out .= '<span class="event-time">'.esc_attr($event->time).'</span>';
282
  }
283
  if( $this->is_visible( $a['show_location'] ) ) {
284
+ $out .= '<span class="event-location">'.esc_attr($this->db->truncate(min($max_length, $a['location_length']), $event->location)).'</span>';
285
  }
286
  if( $this->is_visible( $a['show_cat'] ) ) {
287
+ $out .= '<div class="event-cat">'.esc_attr($this->categories->get_category_string($event->categories)).'</div>';
288
  }
289
  if( $this->is_visible( $a['show_details'] ) ) {
290
  $out .= '<div class="event-details">'.$this->db->truncate( min( $max_length, $a['details_length'] ), do_shortcode( $event->details ) ).'</div>';
363
  return $out;
364
  }
365
 
366
+ private function html_feed_link(&$a, $pos) {
367
+ $out = '';
368
+ if($this->options->get('el_enable_feed') && 'true' === $a['add_feed_link'] && $pos === $this->options->get('el_feed_link_pos')) {
369
+ // prepare url
370
+ if(get_option('permalink_structure')) {
371
+ $feed_link = get_bloginfo('url').'/feed/eventlist';
372
+ }
373
+ else {
374
+ $feed_link = get_bloginfo('url').'/?feed=eventlist';
375
+ }
376
+ // prepare align
377
+ $align = $this->options->get('el_feed_link_align');
378
+ if('left' !== $align && 'center' !== $align && 'right' !== $align) {
379
+ $align = 'left';
380
+ }
381
+ // prepare image
382
+ $image = '';
383
+ if('' !== $this->options->get('el_feed_link_img')) {
384
+ $image = '<img src="'.includes_url('images/rss.png').'" alt="rss" />';
385
+ }
386
+ // prepare text
387
+ $text = $image.esc_attr($this->options->get('el_feed_link_text'));
388
+ // create html
389
+ $out .= '<div class="feed" style="text-align:'.$align.'">
390
+ <a href="'.$feed_link.'">'.$text.'
391
+ </a>
392
+ </div>';
393
+ }
394
+ return $out;
395
+ }
396
+
397
  private function get_ytd( &$a ) {
398
  if( isset( $_GET['ytd_'.$a['sc_id']] ) && 'upcoming' === $_GET['ytd_'.$a['sc_id']] ){
399
  // ytd is 'upcoming'
includes/widget.php CHANGED
@@ -30,12 +30,20 @@ class EL_Widget extends WP_Widget {
30
  'form_style' => null,
31
  'form_width' => null ),
32
 
 
 
 
 
 
 
 
 
33
  'num_events' => array( 'type' => 'text',
34
  'std_value' => '3',
35
- 'caption' => __( 'Number of upcoming events:' ),
36
  'caption_after' => null,
37
- 'tooltip' => __( 'The number of events to display' ),
38
- 'form_style' => null,
39
  'form_width' => 30 ),
40
 
41
  'title_length' => array( 'type' => 'text',
@@ -147,6 +155,7 @@ class EL_Widget extends WP_Widget {
147
  $linked_page_is_set = 0 < strlen( $instance['url_to_page'] );
148
  $linked_page_id_is_set = 0 < (int)$instance['sc_id_for_url'];
149
  $shortcode = '[event-list show_nav=false';
 
150
  $shortcode .= ' num_events="'.$instance['num_events'].'"';
151
  $shortcode .= ' title_length='.$instance['title_length'];
152
  $shortcode .= ' show_starttime='.$instance['show_starttime'];
30
  'form_style' => null,
31
  'form_width' => null ),
32
 
33
+ 'cat_filter' => array( 'type' => 'text',
34
+ 'std_value' => 'none',
35
+ 'caption' => __('Category Filter:'),
36
+ 'caption_after' => null,
37
+ 'tooltip' => __('This attribute specifies the categories of which events are shown. The standard is \'none\' to show all events. Specify a category slug or a list of category slugs separated by a comma to only show events of the specified categories.'),
38
+ 'form_style' => 'margin:0 0 0.8em 0',
39
+ 'form_width' => null ),
40
+
41
  'num_events' => array( 'type' => 'text',
42
  'std_value' => '3',
43
+ 'caption' => __('Number of listed events:'),
44
  'caption_after' => null,
45
+ 'tooltip' => __('The number of upcoming events to display'),
46
+ 'form_style' => '',
47
  'form_width' => 30 ),
48
 
49
  'title_length' => array( 'type' => 'text',
155
  $linked_page_is_set = 0 < strlen( $instance['url_to_page'] );
156
  $linked_page_id_is_set = 0 < (int)$instance['sc_id_for_url'];
157
  $shortcode = '[event-list show_nav=false';
158
+ $shortcode .= ' cat_filter='.$instance['cat_filter'];
159
  $shortcode .= ' num_events="'.$instance['num_events'].'"';
160
  $shortcode .= ' title_length='.$instance['title_length'];
161
  $shortcode .= ' show_starttime='.$instance['show_starttime'];
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Event List ===
2
  Contributors: mibuthu
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W54LNZMWF9KW2
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.6
7
- Stable tag: 0.4.5
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
@@ -25,6 +25,7 @@ The purpose of this plugin is to to show a list of events with date, time, descr
25
  * Event navigation to view only upcoming events or past/future events filtered by year
26
  * Event categories
27
  * Sync event categories with post categories
 
28
 
29
  The event list can be placed in any page or post on your Wordpress site. Just include the following short code where you want the calendar to appear:
30
 
@@ -57,16 +58,23 @@ Yes, you can create an instance of the "SC_Event_List" class which located in "i
57
 
58
  == Screenshots ==
59
 
60
- 1. Admin page: Main page with the event list table
61
  2. Admin page: New/edit event form
62
- 3. Admin page: Settings page (category tab)
63
- 4. Admin page: About page with help and shortcode attributes list
64
- 5. Admin page: Widget with the available options
65
- 6. Example page created with [event-list] shortcode
 
 
66
 
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
70
  = 0.4.5 (2013-08-05) =
71
 
72
  * added capability to sync the event categories with the post categories (manually or automatically)
1
  === Event List ===
2
  Contributors: mibuthu
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W54LNZMWF9KW2
4
+ Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, admin, attribute, widget, sidebar, feed, rss
5
  Requires at least: 3.3
6
+ Tested up to: 3.7
7
+ Stable tag: 0.5.0
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
25
  * Event navigation to view only upcoming events or past/future events filtered by year
26
  * Event categories
27
  * Sync event categories with post categories
28
+ * Event feed
29
 
30
  The event list can be placed in any page or post on your Wordpress site. Just include the following short code where you want the calendar to appear:
31
 
58
 
59
  == Screenshots ==
60
 
61
+ 1. Admin page: Event list table
62
  2. Admin page: New/edit event form
63
+ 3. Admin page: Categories
64
+ 4. Admin page: Settings (general tab)
65
+ 5. Admin page: Settings (feed tab)
66
+ 6. Admin page: About page with help and shortcode attributes list
67
+ 7. Admin page: Widget with the available options
68
+ 8. Example page created with [event-list] shortcode
69
 
70
 
71
  == Changelog ==
72
 
73
+ = 0.5.0 (2013-10-26) =
74
+
75
+ * added event feed with a lot of options
76
+ * added widget option for cat filter
77
+
78
  = 0.4.5 (2013-08-05) =
79
 
80
  * added capability to sync the event categories with the post categories (manually or automatically)
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
screenshot-5.png CHANGED
Binary file
screenshot-6.png CHANGED
Binary file
screenshot-7.png ADDED
Binary file
screenshot-8.png ADDED
Binary file