Version Description
(2014-11-09) = * added months option in filterbar items * added a class for each category slug in each event li element * fixed error due to wrong function name when using daterange in date filter
Download this release
Release Info
Developer | mibuthu |
Plugin | Event List |
Version | 0.6.9 |
Comparing to | |
See all releases |
Code changes from version 0.6.8 to 0.6.9
- event-list.php +1 -1
- includes/categories.php +12 -7
- includes/db.php +12 -6
- includes/filterbar.php +29 -0
- includes/sc_event-list.php +7 -4
- readme.txt +7 -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.6.
|
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.6.9
|
7 |
Author: Michael Burtscher
|
8 |
Author URI: http://wordpress.org/extend/plugins/event-list/
|
9 |
License: GPLv2
|
includes/categories.php
CHANGED
@@ -280,16 +280,21 @@ class EL_Categories {
|
|
280 |
return $this->cat_array[$slug];
|
281 |
}
|
282 |
|
283 |
-
public function get_category_string($slug_text) {
|
284 |
if(2 >= strlen($slug_text)) {
|
285 |
return '';
|
286 |
}
|
287 |
$slug_array = explode('|', substr( $slug_text, 1, -1));
|
288 |
-
|
289 |
-
|
290 |
-
$name_array[] = $this->cat_array[$slug]['name'];
|
291 |
}
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
-
}
|
280 |
return $this->cat_array[$slug];
|
281 |
}
|
282 |
|
283 |
+
public function get_category_string($slug_text, $type='name', $glue=', ') {
|
284 |
if(2 >= strlen($slug_text)) {
|
285 |
return '';
|
286 |
}
|
287 |
$slug_array = explode('|', substr( $slug_text, 1, -1));
|
288 |
+
if('slug' == $type) {
|
289 |
+
$catlist = $slug_array;
|
|
|
290 |
}
|
291 |
+
else { // use cat name
|
292 |
+
$catlist = array();
|
293 |
+
foreach($slug_array as $slug) {
|
294 |
+
$catlist[] = $this->cat_array[$slug]['name'];
|
295 |
+
}
|
296 |
+
sort($catlist, SORT_STRING);
|
297 |
+
}
|
298 |
+
return implode($glue, $catlist);
|
299 |
}
|
300 |
+
}
|
includes/db.php
CHANGED
@@ -66,6 +66,12 @@ class EL_Db {
|
|
66 |
$sql = 'SELECT * FROM '.$this->table.' WHERE id = '.$id.' LIMIT 1';
|
67 |
return $wpdb->get_row( $sql );
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
public function get_event_date( $event ) {
|
71 |
global $wpdb;
|
@@ -263,9 +269,9 @@ class EL_Db {
|
|
263 |
}
|
264 |
|
265 |
private function sql_date_filter($element) {
|
266 |
-
$range = $this->
|
267 |
if(null === $range) {
|
268 |
-
$range = $this->
|
269 |
}
|
270 |
if(null === $range) {
|
271 |
//set to standard (upcoming)
|
@@ -278,7 +284,7 @@ class EL_Db {
|
|
278 |
return 'categories LIKE "%|'.$element.'|%"';
|
279 |
}
|
280 |
|
281 |
-
private function
|
282 |
foreach($this->options->date_formats as $date_type) {
|
283 |
if(preg_match('@'.$date_type['regex'].'@', $element)) {
|
284 |
return $this->get_date_range($element, $date_type);
|
@@ -287,14 +293,14 @@ class EL_Db {
|
|
287 |
return null;
|
288 |
}
|
289 |
|
290 |
-
private function
|
291 |
foreach($this->options->daterange_formats as $key => $daterange_type) {
|
292 |
if(preg_match('@'.$daterange_type['regex'].'@', $element)) {
|
293 |
//check for date_range which requires special handling
|
294 |
if('date_range' == $key) {
|
295 |
$sep_pos = strpos($element, "~");
|
296 |
-
$startrange = $this->
|
297 |
-
$endrange = $this->
|
298 |
return array($startrange[0], $endrange[1]);
|
299 |
}
|
300 |
return $this->get_date_range($element, $daterange_type);
|
66 |
$sql = 'SELECT * FROM '.$this->table.' WHERE id = '.$id.' LIMIT 1';
|
67 |
return $wpdb->get_row( $sql );
|
68 |
}
|
69 |
+
|
70 |
+
public function get_event_months() {
|
71 |
+
global $wpdb;
|
72 |
+
$sql = 'SELECT DISTINCT substr(`start_date`,1,7)as a FROM '.$this->table.' WHERE 1 order by a asc';
|
73 |
+
return $wpdb->get_results($sql);
|
74 |
+
}
|
75 |
|
76 |
public function get_event_date( $event ) {
|
77 |
global $wpdb;
|
269 |
}
|
270 |
|
271 |
private function sql_date_filter($element) {
|
272 |
+
$range = $this->check_date_format($element);
|
273 |
if(null === $range) {
|
274 |
+
$range = $this->check_daterange_format($element);
|
275 |
}
|
276 |
if(null === $range) {
|
277 |
//set to standard (upcoming)
|
284 |
return 'categories LIKE "%|'.$element.'|%"';
|
285 |
}
|
286 |
|
287 |
+
private function check_date_format($element) {
|
288 |
foreach($this->options->date_formats as $date_type) {
|
289 |
if(preg_match('@'.$date_type['regex'].'@', $element)) {
|
290 |
return $this->get_date_range($element, $date_type);
|
293 |
return null;
|
294 |
}
|
295 |
|
296 |
+
private function check_daterange_format($element) {
|
297 |
foreach($this->options->daterange_formats as $key => $daterange_type) {
|
298 |
if(preg_match('@'.$daterange_type['regex'].'@', $element)) {
|
299 |
//check for date_range which requires special handling
|
300 |
if('date_range' == $key) {
|
301 |
$sep_pos = strpos($element, "~");
|
302 |
+
$startrange = $this->check_date_format(substr($element, 0, $sep_pos));
|
303 |
+
$endrange = $this->check_date_format(substr($element, $sep_pos+1));
|
304 |
return array($startrange[0], $endrange[1]);
|
305 |
}
|
306 |
return $this->get_date_range($element, $daterange_type);
|
includes/filterbar.php
CHANGED
@@ -73,6 +73,9 @@ class EL_Filterbar {
|
|
73 |
case 'cats':
|
74 |
$out .= $this->show_cats($url, $args, $item_array[1], 'std', $options);
|
75 |
break;
|
|
|
|
|
|
|
76 |
case 'reset':
|
77 |
$out .= $this->show_reset($url, $args, $options);
|
78 |
}
|
@@ -140,6 +143,32 @@ class EL_Filterbar {
|
|
140 |
}
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
public function show_daterange($url, &$args, $type='hlist', $subtype='std', $options) {
|
144 |
$args = $this->parse_args($args);
|
145 |
$argname = 'date'.$args['sc_id_for_url'];
|
73 |
case 'cats':
|
74 |
$out .= $this->show_cats($url, $args, $item_array[1], 'std', $options);
|
75 |
break;
|
76 |
+
case 'months':
|
77 |
+
$out .= $this->show_months($url, $args, $item_array[1], 'std', $options);
|
78 |
+
break;
|
79 |
case 'reset':
|
80 |
$out .= $this->show_reset($url, $args, $options);
|
81 |
}
|
143 |
}
|
144 |
}
|
145 |
|
146 |
+
|
147 |
+
public function show_months($url, &$args, $type='dropdown', $subtype='std', $options=array()) {
|
148 |
+
$args = $this->parse_args($args);
|
149 |
+
$argname = 'date'.$args['sc_id_for_url'];
|
150 |
+
// set actual selection
|
151 |
+
if(is_numeric($args['event_id'])) {
|
152 |
+
$actual = null;
|
153 |
+
}
|
154 |
+
elseif('all' === $args['actual_date'] || 'upcoming' === $args['actual_date'] || 'past' === $args['actual_date']) {
|
155 |
+
$actual = $args['actual_date'];
|
156 |
+
}
|
157 |
+
else {
|
158 |
+
$actual = $args["actual_date"];//null;
|
159 |
+
}
|
160 |
+
$event_months = $this->db->get_event_months();
|
161 |
+
foreach($event_months as $mon) {
|
162 |
+
$elements[] = array('slug' => $mon->a, 'name' => $mon->a);
|
163 |
+
}
|
164 |
+
if('hlist' === $type) {
|
165 |
+
return $this->show_hlist($elements, $url, $argname, $actual);
|
166 |
+
}
|
167 |
+
else {
|
168 |
+
return $this->show_dropdown($elements, $argname, $subtype, $actual, $args['sc_id_for_url']);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
public function show_daterange($url, &$args, $type='hlist', $subtype='std', $options) {
|
173 |
$args = $this->parse_args($args);
|
174 |
$argname = 'date'.$args['sc_id_for_url'];
|
includes/sc_event-list.php
CHANGED
@@ -76,13 +76,14 @@ class SC_Event_List {
|
|
76 |
Choose "false" to always hide and "true" to always show the navigation.<br />
|
77 |
With "event_list_only" the filterbar is only visible in the event list and with "single_event_only" only for a single event'),
|
78 |
|
79 |
-
'filterbar_items' => array('val' => 'years_hlist<br />years_dropdown<br />daterange_hlist<br />daterange_dropdown<br />cats_hlist<br />cats_dropdown<br />reset_link',
|
80 |
'std_val' => 'years_hlist',
|
81 |
'desc' => 'This attribute specifies the available items in the filterbar. This options are only valid if the filterbar is displayed (see show_filterbar attribute).<br /><br />
|
82 |
Find below an overview of the available filterbar items and their options:<br />
|
83 |
<small><table class="el-filterbar-table">
|
84 |
<th class="el-filterbar-item">filterbar item</th><th class="el-filterbar-desc">description</th><th class="el-filterbar-options">item options</th><th class="el-filterbar-values">option values</th><th class="el-filterbar-default">default value</th><th class="el-filterbar-desc2">option description</th></thead>
|
85 |
<tr><td>years</td><td>Show a list of all available years. Additional there are some special entries available (see item options).</td><td>show_all<br />show_upcoming<br />show_past<br />years_order</td><td>true | false<br />true | false<br />true | false<br />desc | asc</td><td>true<br />true<br />false<br />desc</td><td>Add an entry to show all events.<br />Add an entry to show all upcoming events.<br />Add an entry to show events in the past.<br />Set descending or ascending order of year entries.</tr>
|
|
|
86 |
<tr><td>daterange</td><td>With this item you can display the special entries "all", "upcoming" and "past". You can use all or only some of the available values and you can specify their order.</td><td>item_order</td><td>all | upcoming | past</td><td>all&upcoming&past</td><td>Specifies the displayed values and their order. The items must be seperated by "&".</td></tr>
|
87 |
<tr><td>cats</td><td>Show a list of all available categories.</td><td>show_all</td><td>true | false</td><td>true</td><td>Add an entry to show events from all categories.</td></tr>
|
88 |
<tr><td>reset</td><td>Only a link to reset the eventlist filter to standard.</td><td>caption</td><td>any text</td><td>Reset</td><td>Set the caption of the link.</td></tr>
|
@@ -90,8 +91,8 @@ class SC_Event_List {
|
|
90 |
Find below an overview of the available filterbar display options:<br />
|
91 |
<small><table class="el-filterbar-table">
|
92 |
<th class="el-filterbar-doption">display option</th><th class="el-filterbar-desc3">description</th><th class="el-filterbar-for">available for</th></thead>
|
93 |
-
<tr><td>hlist</td><td>"hlist" shows a horizonal list seperated by "|" with a link to each item</td><td>years, daterange, cats</td></tr>
|
94 |
-
<tr><td>dropdown</td><td>"dropdown" shows a select box where an item can be choosen. After the selection of an item the page is reloaded via javascript to show the filtered events.</td><td>years, daterange, cats</td></tr>
|
95 |
<tr><td>link</td><td>"link" shows a simple link which can be clicked.</td><td>reset</td></tr>
|
96 |
</table></small>
|
97 |
<p>Find below some declaration examples with descriptions:</p>
|
@@ -296,8 +297,10 @@ class SC_Event_List {
|
|
296 |
|
297 |
private function html_event( &$event, &$a, $single_day_only=false ) {
|
298 |
static $last_event_startdate=null, $last_event_enddate=null;
|
|
|
|
|
299 |
$out = '
|
300 |
-
<li class="event">';
|
301 |
// event date
|
302 |
if( '1' !== $this->options->get( 'el_date_once_per_day' ) || $last_event_startdate !== $event->start_date || $last_event_enddate !== $event->end_date ) {
|
303 |
$out .= $this->html_fulldate( $event->start_date, $event->end_date, $single_day_only );
|
76 |
Choose "false" to always hide and "true" to always show the navigation.<br />
|
77 |
With "event_list_only" the filterbar is only visible in the event list and with "single_event_only" only for a single event'),
|
78 |
|
79 |
+
'filterbar_items' => array('val' => 'years_hlist<br />years_dropdown<br />months_hlist<br />months_dropdown<br />daterange_hlist<br />daterange_dropdown<br />cats_hlist<br />cats_dropdown<br />reset_link',
|
80 |
'std_val' => 'years_hlist',
|
81 |
'desc' => 'This attribute specifies the available items in the filterbar. This options are only valid if the filterbar is displayed (see show_filterbar attribute).<br /><br />
|
82 |
Find below an overview of the available filterbar items and their options:<br />
|
83 |
<small><table class="el-filterbar-table">
|
84 |
<th class="el-filterbar-item">filterbar item</th><th class="el-filterbar-desc">description</th><th class="el-filterbar-options">item options</th><th class="el-filterbar-values">option values</th><th class="el-filterbar-default">default value</th><th class="el-filterbar-desc2">option description</th></thead>
|
85 |
<tr><td>years</td><td>Show a list of all available years. Additional there are some special entries available (see item options).</td><td>show_all<br />show_upcoming<br />show_past<br />years_order</td><td>true | false<br />true | false<br />true | false<br />desc | asc</td><td>true<br />true<br />false<br />desc</td><td>Add an entry to show all events.<br />Add an entry to show all upcoming events.<br />Add an entry to show events in the past.<br />Set descending or ascending order of year entries.</tr>
|
86 |
+
<tr><td>months</td><td>Show a list of all available months.</td><td></td><td></td><td></td><td></td></tr>
|
87 |
<tr><td>daterange</td><td>With this item you can display the special entries "all", "upcoming" and "past". You can use all or only some of the available values and you can specify their order.</td><td>item_order</td><td>all | upcoming | past</td><td>all&upcoming&past</td><td>Specifies the displayed values and their order. The items must be seperated by "&".</td></tr>
|
88 |
<tr><td>cats</td><td>Show a list of all available categories.</td><td>show_all</td><td>true | false</td><td>true</td><td>Add an entry to show events from all categories.</td></tr>
|
89 |
<tr><td>reset</td><td>Only a link to reset the eventlist filter to standard.</td><td>caption</td><td>any text</td><td>Reset</td><td>Set the caption of the link.</td></tr>
|
91 |
Find below an overview of the available filterbar display options:<br />
|
92 |
<small><table class="el-filterbar-table">
|
93 |
<th class="el-filterbar-doption">display option</th><th class="el-filterbar-desc3">description</th><th class="el-filterbar-for">available for</th></thead>
|
94 |
+
<tr><td>hlist</td><td>"hlist" shows a horizonal list seperated by "|" with a link to each item</td><td>years, months, daterange, cats</td></tr>
|
95 |
+
<tr><td>dropdown</td><td>"dropdown" shows a select box where an item can be choosen. After the selection of an item the page is reloaded via javascript to show the filtered events.</td><td>years, months, daterange, cats</td></tr>
|
96 |
<tr><td>link</td><td>"link" shows a simple link which can be clicked.</td><td>reset</td></tr>
|
97 |
</table></small>
|
98 |
<p>Find below some declaration examples with descriptions:</p>
|
297 |
|
298 |
private function html_event( &$event, &$a, $single_day_only=false ) {
|
299 |
static $last_event_startdate=null, $last_event_enddate=null;
|
300 |
+
$cat_string = $this->categories->get_category_string($event->categories, 'slug', ' ');
|
301 |
+
// add class with each category slug
|
302 |
$out = '
|
303 |
+
<li class="event '.$cat_string.'">';
|
304 |
// event date
|
305 |
if( '1' !== $this->options->get( 'el_date_once_per_day' ) || $last_event_startdate !== $event->start_date || $last_event_enddate !== $event->end_date ) {
|
306 |
$out .= $this->html_fulldate( $event->start_date, $event->end_date, $single_day_only );
|
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, filter, admin, attribute, widget, sidebar, feed, rss
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.0
|
7 |
-
Stable tag: 0.6.
|
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
|
@@ -53,7 +53,7 @@ Insert the shortcode [event-list] in your page or post. You can modify the outpu
|
|
53 |
Event List uses the built-in Wordpress WYSIWYG editor. It's exactly the same process like in creating Posts or Pages.
|
54 |
|
55 |
= Can I call the shortcode directly via php e.g. for my own template, theme or plugin? =
|
56 |
-
Yes, you can create an instance of the "SC_Event_List" class which is located in the plugin folder under "includes/sc_event-list.php" and call the function show_html($atts).With $atts you can specify all the shortcode attributes you require.
|
57 |
Another possibility would be to call the wordpress function "do_shortcode()".
|
58 |
|
59 |
|
@@ -72,6 +72,11 @@ Another possibility would be to call the wordpress function "do_shortcode()".
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
= 0.6.8 (2014-10-14) =
|
76 |
* added filterbar item "daterange" (to view all, upcoming and past)
|
77 |
* added options to change feed name and feed description
|
4 |
Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, filter, admin, attribute, widget, sidebar, feed, rss
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 0.6.9
|
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
|
53 |
Event List uses the built-in Wordpress WYSIWYG editor. It's exactly the same process like in creating Posts or Pages.
|
54 |
|
55 |
= Can I call the shortcode directly via php e.g. for my own template, theme or plugin? =
|
56 |
+
Yes, you can create an instance of the "SC_Event_List" class which is located in the plugin folder under "includes/sc_event-list.php" and call the function show_html($atts). With $atts you can specify all the shortcode attributes you require.
|
57 |
Another possibility would be to call the wordpress function "do_shortcode()".
|
58 |
|
59 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 0.6.9 (2014-11-09) =
|
76 |
+
* added months option in filterbar items
|
77 |
+
* added a class for each category slug in each event li element
|
78 |
+
* fixed error due to wrong function name when using daterange in date filter
|
79 |
+
|
80 |
= 0.6.8 (2014-10-14) =
|
81 |
* added filterbar item "daterange" (to view all, upcoming and past)
|
82 |
* added options to change feed name and feed description
|