Event List - Version 0.3.3

Version Description

(2013-03-01) =

  • fixed event creation/modification problem with php versions < 5.3
  • improved truncate of details in admin event table
Download this release

Release Info

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

Code changes from version 0.3.2 to 0.3.3

Files changed (4) hide show
  1. event-list.php +1 -1
  2. php/admin_event_table.php +7 -4
  3. php/db.php +68 -24
  4. readme.txt +13 -7
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.3.2
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.3.3
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
php/admin_event_table.php CHANGED
@@ -272,7 +272,7 @@ class Admin_Event_Table extends WP_List_Table {
272
  * @param string $html The html code which should be shortened
273
  ***************************************************************************/
274
  private static function truncate( $max_length, $html ) {
275
- if( strlen( $html ) > $max_length ) {
276
  $printedLength = 0;
277
  $position = 0;
278
  $tags = array();
@@ -320,11 +320,14 @@ class Admin_Event_Table extends WP_List_Table {
320
  if ($printedLength < $max_length && $position < strlen($html)) {
321
  $out .= substr($html, $position, $max_length - $printedLength);
322
  }
323
- $out .= '...';
324
- // Close any open tags.
 
 
 
325
  while (!empty($tags)) {
326
  $out .= '</'.array_pop($tags).'>';
327
- }
328
  return $out;
329
  }
330
  else {
272
  * @param string $html The html code which should be shortened
273
  ***************************************************************************/
274
  private static function truncate( $max_length, $html ) {
275
+ if( strlen( $html ) > $max_length ) {
276
  $printedLength = 0;
277
  $position = 0;
278
  $tags = array();
320
  if ($printedLength < $max_length && $position < strlen($html)) {
321
  $out .= substr($html, $position, $max_length - $printedLength);
322
  }
323
+ // Print "..." if the html is not complete
324
+ if( strlen( $html) != $position ) {
325
+ $out .= ' ...';
326
+ }
327
+ // Close any open tags.
328
  while (!empty($tags)) {
329
  $out .= '</'.array_pop($tags).'>';
330
+ }
331
  return $out;
332
  }
333
  else {
php/db.php CHANGED
@@ -168,14 +168,7 @@ class el_db {
168
  $date_array = date_parse( $datestring );
169
  }
170
  else {
171
- if( function_exists( 'date_parse_from_format' ) ) {
172
- // for php version >= 5.3.0
173
- $date_array = date_parse_from_format( $dateformat, $datestring );
174
- }
175
- else {
176
- // for older php versions
177
- $date_array = $this->date_parse_from_format( $dateformat, $datestring );
178
- }
179
  }
180
  if( !empty( $date_array['errors']) ) {
181
  return false;
@@ -192,25 +185,76 @@ class el_db {
192
  }
193
  return date( $ret_format, $timestamp );
194
  }
 
195
 
196
- /*
197
- * date_parse_from_format function is only required for php versions < 5.3.0
198
- * see http://php.net/manual/en/function.date-parse-from-format.php for details
199
- */
200
- private function date_parse_from_format( string $format, string $date ) {
201
- $dMask = array(
202
- 'H'=>'hour',
203
- 'i'=>'minute',
204
- 's'=>'second',
205
- 'y'=>'year',
206
- 'm'=>'month',
207
- 'd'=>'day'
 
 
 
 
 
 
 
 
 
 
208
  );
209
- $format = preg_split('//', $format, -1, PREG_SPLIT_NO_EMPTY);
210
- $date = preg_split('//', $date, -1, PREG_SPLIT_NO_EMPTY);
211
- foreach ($date as $k => $v) {
212
- if ($dMask[$format[$k]]) $dt[$dMask[$format[$k]]] .= $v;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  }
 
 
 
 
 
 
 
214
  return $dt;
215
  }
216
  }
168
  $date_array = date_parse( $datestring );
169
  }
170
  else {
171
+ $date_array = date_parse_from_format( $dateformat, $datestring );
 
 
 
 
 
 
 
172
  }
173
  if( !empty( $date_array['errors']) ) {
174
  return false;
185
  }
186
  return date( $ret_format, $timestamp );
187
  }
188
+ }
189
 
190
+ // Define "date_parse_from_format" (This is required for php versions < 5.3)
191
+ if( !function_exists('date_parse_from_format') ){
192
+ function date_parse_from_format($format, $date) {
193
+ // reverse engineer date formats
194
+ $keys = array(
195
+ 'Y' => array('year', '\d{4}'), // A full numeric representation of a year, 4 digits
196
+ 'y' => array('year', '\d{2}'), // A two digit representation of a year
197
+ 'm' => array('month', '\d{2}'), // Numeric representation of a month, with leading zeros
198
+ 'n' => array('month', '\d{1,2}'), // Numeric representation of a month, without leading zeros
199
+ 'M' => array('month', '[A-Z][a-z]{3}'), // A short textual representation of a month, three letters
200
+ 'F' => array('month', '[A-Z][a-z]{2,8}'), // A full textual representation of a month, such as January or March
201
+ 'd' => array('day', '\d{2}'), // Day of the month, 2 digits with leading zeros
202
+ 'j' => array('day', '\d{1,2}'), // Day of the month without leading zeros
203
+ 'D' => array('day', '[A-Z][a-z]{2}'), // A textual representation of a day, three letters
204
+ 'l' => array('day', '[A-Z][a-z]{6,9}'), // A full textual representation of the day of the week
205
+ 'u' => array('hour', '\d{1,6}'), // Microsecondes
206
+ 'h' => array('hour', '\d{2}'), // 12-hour format of an hour with leading zeros
207
+ 'H' => array('hour', '\d{2}'), // 24-hour format of an hour with leading zeros
208
+ 'g' => array('hour', '\d{1,2}'), // 12-hour format of an hour without leading zeros
209
+ 'G' => array('hour', '\d{1,2}'), // 24-hour format of an hour without leading zeros
210
+ 'i' => array('minute', '\d{2}'), // Minutes with leading zeros
211
+ 's' => array('second', '\d{2}') // Seconds, with leading zeros
212
  );
213
+
214
+ // convert format string to regex
215
+ $regex = '';
216
+ $chars = str_split($format);
217
+ foreach ( $chars AS $n => $char ) {
218
+ $lastChar = isset($chars[$n-1]) ? $chars[$n-1] : '';
219
+ $skipCurrent = '\\' == $lastChar;
220
+ if ( !$skipCurrent && isset($keys[$char]) ) {
221
+ $regex .= '(?P<'.$keys[$char][0].'>'.$keys[$char][1].')';
222
+ }
223
+ else if ( '\\' == $char ) {
224
+ $regex .= $char;
225
+ }
226
+ else {
227
+ $regex .= preg_quote($char);
228
+ }
229
+ }
230
+
231
+ // create array
232
+ $dt = array();
233
+ $dt['error_count'] = 0;
234
+ $dt['errors'] = array();
235
+ // now try to match it
236
+ if( preg_match('#^'.$regex.'$#', $date, $dt) ){
237
+ foreach ( $dt AS $k => $v ){
238
+ if ( is_int($k) ){
239
+ unset($dt[$k]);
240
+ }
241
+ }
242
+ if( !checkdate($dt['month'], $dt['day'], $dt['year']) ){
243
+ $dt['error_count'] = 1;
244
+ array_push( $dt['errors'], 'ERROR' );
245
+ }
246
+ }
247
+ else {
248
+ $dt['error_count'] = 1;
249
+ array_push( $dt['errors'], 'ERROR' );
250
  }
251
+ $dt['fraction'] = '';
252
+ $dt['warning_count'] = 0;
253
+ $dt['warnings'] = array();
254
+ $dt['is_localtime'] = 0;
255
+ $dt['zone_type'] = 0;
256
+ $dt['zone'] = 0;
257
+ $dt['is_dst'] = '';
258
  return $dt;
259
  }
260
  }
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.3.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
@@ -15,19 +15,20 @@ Manage your events and show them in a list view on your site.
15
  == Description ==
16
 
17
  The purpose of this plugin is to to show a list of events with date, time, description, place, etc. on your site by using a shortcode or a widget.
18
- There are also admin sites available to access the plugin-settings and to manage the events.
19
 
20
  = Current Features =
21
- * beginning and end dates for multiple-day events
22
- * Wordpress's WYSIWYG editor for the event description so you can include styled text, links, images and other media in your event list
23
- * a duplicate function for events
24
- * an possibility to view past events by year
 
 
25
 
26
  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:
27
 
28
  ‘[event-list]’
29
 
30
- With the existing attributes it is possible to modify the listed events and their style.
31
  There is also a widget available to view the upcoming events in a sidebar.
32
 
33
  If you want to follow the development status have a look at the [git-repository on github](https://github.com/mibuthu/wp-event-list "wp-event-list git-repository").
@@ -63,6 +64,11 @@ Yes, you can create an instance of the "sc_event_list" class which located in "p
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
66
  = 0.3.2 (2013-02-24) =
67
 
68
  * removed empty settings page (will be added again when settings are available)
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.3.3
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
15
  == Description ==
16
 
17
  The purpose of this plugin is to to show a list of events with date, time, description, place, etc. on your site by using a shortcode or a widget.
 
18
 
19
  = Current Features =
20
+ * Admin pages to view/create/manage/modify events
21
+ * Available event data fields: event title, event start time, event location, event details
22
+ * Beginning and end dates for multiple-day events
23
+ * Wordpress's WYSIWYG editor for the event details. So you can include styled text, links, images and other media in your event list.
24
+ * A duplicate function for events
25
+ * Event navigation to view only upcoming events or past/future events filtered by year
26
 
27
  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:
28
 
29
  ‘[event-list]’
30
 
31
+ You can modify the listed events and their style with attributes. All available attributes can be found on the Event List -> About page.
32
  There is also a widget available to view the upcoming events in a sidebar.
33
 
34
  If you want to follow the development status have a look at the [git-repository on github](https://github.com/mibuthu/wp-event-list "wp-event-list git-repository").
64
 
65
  == Changelog ==
66
 
67
+ = 0.3.3 (2013-03-01) =
68
+
69
+ * fixed event creation/modification problem with php versions < 5.3
70
+ * improved truncate of details in admin event table
71
+
72
  = 0.3.2 (2013-02-24) =
73
 
74
  * removed empty settings page (will be added again when settings are available)