Version Description
(2013-10-27) =
- added site name in eventlist feed name (similar to standard feed captions)
- fixed not working feed link in header
- fixed problem with new widget options after upgrade
- fixed not working permalink for the eventlist feed
Download this release
Release Info
Developer | mibuthu |
Plugin | Event List |
Version | 0.5.1 |
Comparing to | |
See all releases |
Code changes from version 0.5.0 to 0.5.1
- event-list.php +1 -1
- includes/db.php +10 -12
- includes/feed.php +23 -9
- includes/sc_event-list.php +3 -8
- includes/widget.php +19 -5
- readme.txt +8 -1
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.5.
|
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.5.1
|
7 |
Author: Michael Burtscher
|
8 |
Author URI: http://wordpress.org/extend/plugins/event-list/
|
9 |
License: GPLv2
|
includes/db.php
CHANGED
@@ -314,7 +314,7 @@ class EL_Db {
|
|
314 |
|
315 |
|
316 |
// Define "date_parse_from_format" (This is required for php versions < 5.3)
|
317 |
-
if(
|
318 |
function date_parse_from_format($format, $date) {
|
319 |
// reverse engineer date formats
|
320 |
$keys = array(
|
@@ -336,43 +336,41 @@ if( !function_exists('date_parse_from_format') ){
|
|
336 |
'i' => array('minute', '\d{2}'), // Minutes with leading zeros
|
337 |
's' => array('second', '\d{2}') // Seconds, with leading zeros
|
338 |
);
|
339 |
-
|
340 |
// convert format string to regex
|
341 |
$regex = '';
|
342 |
$chars = str_split($format);
|
343 |
-
foreach
|
344 |
$lastChar = isset($chars[$n-1]) ? $chars[$n-1] : '';
|
345 |
$skipCurrent = '\\' == $lastChar;
|
346 |
-
if
|
347 |
$regex .= '(?P<'.$keys[$char][0].'>'.$keys[$char][1].')';
|
348 |
}
|
349 |
-
else if
|
350 |
$regex .= $char;
|
351 |
}
|
352 |
else {
|
353 |
$regex .= preg_quote($char);
|
354 |
}
|
355 |
}
|
356 |
-
|
357 |
// create array
|
358 |
$dt = array();
|
359 |
$dt['error_count'] = 0;
|
360 |
$dt['errors'] = array();
|
361 |
// now try to match it
|
362 |
-
if(
|
363 |
-
foreach
|
364 |
-
if
|
365 |
unset($dt[$k]);
|
366 |
}
|
367 |
}
|
368 |
-
if(
|
369 |
$dt['error_count'] = 1;
|
370 |
-
|
371 |
}
|
372 |
}
|
373 |
else {
|
374 |
$dt['error_count'] = 1;
|
375 |
-
|
376 |
}
|
377 |
$dt['fraction'] = '';
|
378 |
$dt['warning_count'] = 0;
|
314 |
|
315 |
|
316 |
// Define "date_parse_from_format" (This is required for php versions < 5.3)
|
317 |
+
if(!function_exists('date_parse_from_format')){
|
318 |
function date_parse_from_format($format, $date) {
|
319 |
// reverse engineer date formats
|
320 |
$keys = array(
|
336 |
'i' => array('minute', '\d{2}'), // Minutes with leading zeros
|
337 |
's' => array('second', '\d{2}') // Seconds, with leading zeros
|
338 |
);
|
|
|
339 |
// convert format string to regex
|
340 |
$regex = '';
|
341 |
$chars = str_split($format);
|
342 |
+
foreach($chars as $n => $char) {
|
343 |
$lastChar = isset($chars[$n-1]) ? $chars[$n-1] : '';
|
344 |
$skipCurrent = '\\' == $lastChar;
|
345 |
+
if(!$skipCurrent && isset($keys[$char])) {
|
346 |
$regex .= '(?P<'.$keys[$char][0].'>'.$keys[$char][1].')';
|
347 |
}
|
348 |
+
else if('\\' == $char) {
|
349 |
$regex .= $char;
|
350 |
}
|
351 |
else {
|
352 |
$regex .= preg_quote($char);
|
353 |
}
|
354 |
}
|
|
|
355 |
// create array
|
356 |
$dt = array();
|
357 |
$dt['error_count'] = 0;
|
358 |
$dt['errors'] = array();
|
359 |
// now try to match it
|
360 |
+
if(preg_match('#^'.$regex.'$#', $date, $dt)){
|
361 |
+
foreach($dt as $k => $v) {
|
362 |
+
if(is_int($k)){
|
363 |
unset($dt[$k]);
|
364 |
}
|
365 |
}
|
366 |
+
if(!checkdate($dt['month'], $dt['day'], $dt['year'])) {
|
367 |
$dt['error_count'] = 1;
|
368 |
+
$dt['errors'][] = 'ERROR';
|
369 |
}
|
370 |
}
|
371 |
else {
|
372 |
$dt['error_count'] = 1;
|
373 |
+
$dt['errors'][] = 'ERROR';
|
374 |
}
|
375 |
$dt['fraction'] = '';
|
376 |
$dt['warning_count'] = 0;
|
includes/feed.php
CHANGED
@@ -29,18 +29,17 @@ class EL_Feed {
|
|
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=" » Eventlist Feed" href="
|
41 |
}
|
42 |
|
43 |
-
public function
|
44 |
header('Content-Type: '.feed_content_type('rss-http').'; charset='.get_option('blog_charset'), true);
|
45 |
$events = $this->db->get_events();
|
46 |
|
@@ -85,15 +84,30 @@ class EL_Feed {
|
|
85 |
</rss>';
|
86 |
}
|
87 |
|
88 |
-
function
|
89 |
global $wp_rewrite;
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
|
93 |
-
return $wp_rewrite->rules;
|
94 |
}
|
95 |
|
96 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
$startArray = explode("-", $start_date);
|
98 |
$start_date = mktime(0,0,0,$startArray[1],$startArray[2],$startArray[0]);
|
99 |
|
29 |
}
|
30 |
|
31 |
public function init() {
|
32 |
+
add_action('init', array(&$this, 'add_eventlist_feed'));
|
33 |
if($this->options->get('el_head_feed_link')) {
|
34 |
add_action('wp_head', array(&$this, 'print_head_feed_link'));
|
35 |
}
|
|
|
|
|
36 |
}
|
37 |
|
38 |
public function print_head_feed_link() {
|
39 |
+
echo '<link rel="alternate" type="application/rss+xml" title="'.get_bloginfo_rss('name').' » Eventlist Feed" href="'.$this->eventlist_feed_url().'" />';
|
40 |
}
|
41 |
|
42 |
+
public function print_eventlist_feed() {
|
43 |
header('Content-Type: '.feed_content_type('rss-http').'; charset='.get_option('blog_charset'), true);
|
44 |
$events = $this->db->get_events();
|
45 |
|
84 |
</rss>';
|
85 |
}
|
86 |
|
87 |
+
public function add_eventlist_feed() {
|
88 |
global $wp_rewrite;
|
89 |
+
add_feed('eventlist', array(&$this, 'print_eventlist_feed'));
|
90 |
+
add_action('generate_rewrite_rules', array(&$this, 'eventlist_feed_rewrite'));
|
91 |
+
$wp_rewrite->flush_rules();
|
92 |
+
}
|
93 |
+
|
94 |
+
public function eventlist_feed_rewrite() {
|
95 |
+
global $wp_rewrite;
|
96 |
+
$feed_rules = array('feed/(.+)' => 'index.php?feed='.$wp_rewrite->preg_index(1));
|
97 |
$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
|
|
|
98 |
}
|
99 |
|
100 |
+
public function eventlist_feed_url() {
|
101 |
+
if(get_option('permalink_structure')) {
|
102 |
+
$feed_link = get_bloginfo('url').'/feed/eventlist';
|
103 |
+
}
|
104 |
+
else {
|
105 |
+
$feed_link = get_bloginfo('url').'/?feed=eventlist';
|
106 |
+
}
|
107 |
+
return $feed_link;
|
108 |
+
}
|
109 |
+
|
110 |
+
private function format_date($start_date, $end_date) {
|
111 |
$startArray = explode("-", $start_date);
|
112 |
$start_date = mktime(0,0,0,$startArray[1],$startArray[2],$startArray[0]);
|
113 |
|
includes/sc_event-list.php
CHANGED
@@ -367,12 +367,8 @@ class SC_Event_List {
|
|
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 |
-
|
371 |
-
|
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) {
|
@@ -387,8 +383,7 @@ class SC_Event_List {
|
|
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;
|
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 |
+
require_once( EL_PATH.'includes/feed.php' );
|
371 |
+
$feed_link = EL_Feed::get_instance()->eventlist_feed_url();
|
|
|
|
|
|
|
|
|
372 |
// prepare align
|
373 |
$align = $this->options->get('el_feed_link_align');
|
374 |
if('left' !== $align && 'center' !== $align && 'right' !== $align) {
|
383 |
$text = $image.esc_attr($this->options->get('el_feed_link_text'));
|
384 |
// create html
|
385 |
$out .= '<div class="feed" style="text-align:'.$align.'">
|
386 |
+
<a href="'.$feed_link.'">'.$text.'</a>
|
|
|
387 |
</div>';
|
388 |
}
|
389 |
return $out;
|
includes/widget.php
CHANGED
@@ -145,12 +145,12 @@ class EL_Widget extends WP_Widget {
|
|
145 |
* @param array $instance Saved values from database.
|
146 |
*/
|
147 |
public function widget( $args, $instance ) {
|
148 |
-
|
149 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
150 |
-
echo $before_widget;
|
151 |
if ( ! empty( $title ) )
|
152 |
{
|
153 |
-
echo $before_title
|
154 |
}
|
155 |
$linked_page_is_set = 0 < strlen( $instance['url_to_page'] );
|
156 |
$linked_page_id_is_set = 0 < (int)$instance['sc_id_for_url'];
|
@@ -176,7 +176,7 @@ class EL_Widget extends WP_Widget {
|
|
176 |
if( 'true' === $instance['link_to_page'] && $linked_page_is_set ) {
|
177 |
echo '<div style="clear:both"><a title="'.$instance['link_to_page_caption'].'" href="'.$instance[ 'url_to_page'].'">'.$instance['link_to_page_caption'].'</a></div>';
|
178 |
}
|
179 |
-
echo $after_widget;
|
180 |
}
|
181 |
|
182 |
/**
|
@@ -236,5 +236,19 @@ class EL_Widget extends WP_Widget {
|
|
236 |
echo $out;
|
237 |
}
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
-
?>
|
145 |
* @param array $instance Saved values from database.
|
146 |
*/
|
147 |
public function widget( $args, $instance ) {
|
148 |
+
$this->prepare_instance($instance);
|
149 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
150 |
+
echo $args['before_widget'];
|
151 |
if ( ! empty( $title ) )
|
152 |
{
|
153 |
+
echo $args['before_title'].$title.$args['after_title'];
|
154 |
}
|
155 |
$linked_page_is_set = 0 < strlen( $instance['url_to_page'] );
|
156 |
$linked_page_id_is_set = 0 < (int)$instance['sc_id_for_url'];
|
176 |
if( 'true' === $instance['link_to_page'] && $linked_page_is_set ) {
|
177 |
echo '<div style="clear:both"><a title="'.$instance['link_to_page_caption'].'" href="'.$instance[ 'url_to_page'].'">'.$instance['link_to_page_caption'].'</a></div>';
|
178 |
}
|
179 |
+
echo $args['after_widget'];
|
180 |
}
|
181 |
|
182 |
/**
|
236 |
echo $out;
|
237 |
}
|
238 |
|
239 |
+
/**
|
240 |
+
* Prepare the instance array and add not available items with std_value
|
241 |
+
*
|
242 |
+
* This is required for a plugin upgrades: In existing widgets probably added widget options are not available.
|
243 |
+
*
|
244 |
+
* @param array &$instance Previously saved values from database.
|
245 |
+
*/
|
246 |
+
private function prepare_instance(&$instance) {
|
247 |
+
foreach($this->items as $itemname => $item) {
|
248 |
+
if(!isset($instance[$itemname])) {
|
249 |
+
$instance[$itemname] = $item['std_value'];
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
253 |
}
|
254 |
+
?>
|
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, feed, rss
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.7
|
7 |
-
Stable tag: 0.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
|
@@ -70,6 +70,13 @@ Yes, you can create an instance of the "SC_Event_List" class which located in "i
|
|
70 |
|
71 |
== Changelog ==
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
= 0.5.0 (2013-10-26) =
|
74 |
|
75 |
* added event feed with a lot of options
|
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.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
|
70 |
|
71 |
== Changelog ==
|
72 |
|
73 |
+
= 0.5.1 (2013-10-27) =
|
74 |
+
|
75 |
+
* added site name in eventlist feed name (similar to standard feed captions)
|
76 |
+
* fixed not working feed link in header
|
77 |
+
* fixed problem with new widget options after upgrade
|
78 |
+
* fixed not working permalink for the eventlist feed
|
79 |
+
|
80 |
= 0.5.0 (2013-10-26) =
|
81 |
|
82 |
* added event feed with a lot of options
|