Event Calendar WD – Responsive Event Calendar plugin - Version 1.0.1

Version Description

Fixed: Bug in Week view
Fixed: Permalink bug

Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Event Calendar WD – Responsive Event Calendar plugin
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0.0 to 1.0.1

ecwd.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Event Calendar WD
4
  * Plugin URI: https://web-dorado.com/products/wordpress-event-calendar-wd.html
5
  * Description: Event Calendar WD is an easy event management and planning tool with advanced features.
6
- * Version: 1.0.0
7
  * Author: WebDorado
8
  * Author URI: http://web-dorado.com
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
3
  * Plugin Name: Event Calendar WD
4
  * Plugin URI: https://web-dorado.com/products/wordpress-event-calendar-wd.html
5
  * Description: Event Calendar WD is an easy event management and planning tool with advanced features.
6
+ * Version: 1.0.1
7
  * Author: WebDorado
8
  * Author URI: http://web-dorado.com
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
ecwd_admin_class.php CHANGED
@@ -6,7 +6,7 @@
6
  class ECWD_Admin {
7
 
8
  protected static $instance = null;
9
- protected $version = '1.0.0';
10
  protected $ecwd_page = null;
11
 
12
  private function __construct() {
6
  class ECWD_Admin {
7
 
8
  protected static $instance = null;
9
+ protected $version = '1.0.1';
10
  protected $ecwd_page = null;
11
 
12
  private function __construct() {
ecwd_class.php CHANGED
@@ -7,7 +7,7 @@
7
 
8
  class ECWD {
9
 
10
- protected $version = '1.0';
11
  protected $plugin_name = 'event-calendar-wd';
12
  protected $prefix = 'ecwd';
13
  protected $old_version = '1.4.11';
7
 
8
  class ECWD {
9
 
10
+ protected $version = '1.0.1';
11
  protected $plugin_name = 'event-calendar-wd';
12
  protected $prefix = 'ecwd';
13
  protected $old_version = '1.4.11';
includes/ecwd-cpt-class.php CHANGED
@@ -350,7 +350,7 @@ class ECWD_Cpt {
350
 
351
 
352
  register_post_type( self::VENUE_POST_TYPE, $venues_args );
353
-
354
  if ( false === get_option( ECWD_PLUGIN_PREFIX . '_cpt_setup' ) || 1 == get_option( ECWD_PLUGIN_PREFIX . '_slug_changed' ) ) {
355
  update_option( ECWD_PLUGIN_PREFIX . '_cpt_setup', 1 );
356
  update_option( ECWD_PLUGIN_PREFIX . '_slug_changed', 0 );
350
 
351
 
352
  register_post_type( self::VENUE_POST_TYPE, $venues_args );
353
+ flush_rewrite_rules();
354
  if ( false === get_option( ECWD_PLUGIN_PREFIX . '_cpt_setup' ) || 1 == get_option( ECWD_PLUGIN_PREFIX . '_slug_changed' ) ) {
355
  update_option( ECWD_PLUGIN_PREFIX . '_cpt_setup', 1 );
356
  update_option( ECWD_PLUGIN_PREFIX . '_slug_changed', 0 );
includes/ecwd-display-class.php CHANGED
@@ -8,7 +8,7 @@ class ECWD_Display {
8
  private $events, $merged_events, $goole_events, $date, $month, $year, $day;
9
 
10
 
11
- public function __construct( $ids, $title_text = null, $sort_order = 'asc', $date = '', $page = 1, $search_params = array(), $displays = null, $filters = null, $page_items = 5, $event_search = 'yes', $display) {
12
  $this->id = $ids;
13
  $this->title = $title_text;
14
  $this->sort = $sort_order;
@@ -20,10 +20,9 @@ class ECWD_Display {
20
  $this->event_search = $event_search;
21
  //$this->date = $date;
22
  $this->page = $page;
23
-
24
- if($display) {
25
  $this->display = $display;
26
- }else{
27
  $this->display = 'full';
28
  }
29
 
@@ -35,12 +34,12 @@ class ECWD_Display {
35
  if ( $date == '' && ! isset( $_REQUEST['date'] ) ) {
36
  $date = date( 'Y-n-j' );
37
  }
38
-
39
- $date = date( 'Y-n-t', strtotime( $date ) ); // format the date for parsing
40
- $date_part = explode( '-', $date ); // separate year/month/day
41
- $year = $date_part[0];
42
- $month = $date_part[1];
43
- $day = $date_part[2];
44
  if ( isset( $_REQUEST['y'] ) && $_REQUEST['y'] != '' ) {
45
  $year = $_REQUEST['y'];
46
  } // if year is set in querystring it takes precedence
@@ -60,10 +59,22 @@ class ECWD_Display {
60
  if ( $day == '' ) {
61
  $day = date( 'j' ); // set to the 1st is year and month is known
62
  }
63
- $this->date = $date;
64
- $this->month = (int) $month;
65
- $this->year = (int) $year;
66
- $this->day = (int) $day;
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  if ( $this->id ) {
69
  $this->get_events();
@@ -74,20 +85,12 @@ class ECWD_Display {
74
  public function get_events() {
75
 
76
  //get events by calendars
77
- $date = $this->date;
78
  if ( ! $this->date ) {
79
  $this->date = $date = date( 'Y-m-t' );
80
  }
 
81
 
82
 
83
- if (( isset( $_REQUEST['t']) && $_REQUEST['t'] == 'week') || $this->display=='week') {
84
- $this->date=$date = date('Y-m-t', strtotime( date( "Y-m-d", strtotime( $date ) ) . " + 1 week" ));
85
-
86
- $this->year = date('Y', strtotime($this->date));
87
- $this->month = date('m', strtotime($this->date));
88
-
89
- }
90
-
91
  $query = ( isset( $this->search['query'] ) ? $this->search['query'] : '' );
92
 
93
  foreach ( $this->id as $id ) {
@@ -195,7 +198,7 @@ class ECWD_Display {
195
  ),
196
  array(
197
  'key' => ECWD_PLUGIN_PREFIX . '_event_date_from',
198
- 'value' => $date,
199
  'compare' => '<=',
200
  'type' => 'DATE'
201
  ),
@@ -234,8 +237,16 @@ class ECWD_Display {
234
 
235
  $ecwd_events += $ecwd_events_title;
236
  wp_reset_query();
 
237
  $events = array();
 
 
 
 
 
 
238
  foreach ( $ecwd_events as $ecwd_event ) {
 
239
  $term_metas = '';
240
  $categories = get_the_terms( $ecwd_event->ID, ECWD_PLUGIN_PREFIX . '_event_category' );
241
  if ( is_array( $categories ) ) {
@@ -276,8 +287,8 @@ class ECWD_Display {
276
  }
277
  }
278
  }
 
279
 
280
- $this->merged_events += $events;
281
  //$this->merged_events += $events;
282
  $this->get_event_days();
283
  }
@@ -303,8 +314,6 @@ class ECWD_Display {
303
  $events = $this->merged_events;
304
 
305
  }
306
-
307
-
308
  foreach ( $events as $id => $arr ) {
309
 
310
  if ( is_int( $arr->start_time ) ) {
@@ -347,7 +356,15 @@ class ECWD_Display {
347
  $organizers = array();
348
  $organizersIDs = array();
349
  if ( $metas && isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_organizers' ][0] ) ) {
 
 
350
  $organizers_ids = unserialize( $metas[ ECWD_PLUGIN_PREFIX . '_event_organizers' ][0] );
 
 
 
 
 
 
351
  foreach ( $organizers_ids as $organizer_id ) {
352
  if ( $organizer_id ) {
353
  $opost = get_post( $organizer_id );
@@ -402,19 +419,23 @@ class ECWD_Display {
402
  $weekdays = $this->search['weekdays'];
403
  }
404
 
 
405
  if ( $metas && isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] ) && $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] !== 'no_repeat' && $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] != '' ) {
406
  $event_week_last_day = '';
407
  if ( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] == 'weekly' ) {
408
-
409
  if ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0] ) && $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0] != '' ) {
410
- if(is_serialized($metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0])) {
 
 
411
  $days = unserialize( $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0] );
412
- }elseif(is_array($metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0])){
413
  $days = $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0];
414
  }
415
  } else {
416
  $days = array( strtolower( date( 'l', strtotime( $from ) ) ) );
417
  }
 
418
  $until = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] : $to );
419
  $how = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_how' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_how' ][0] : 1 );
420
  if ( count( $days ) ) {
@@ -426,32 +447,28 @@ class ECWD_Display {
426
  continue;
427
  }
428
  $from_date = $from;
 
429
  for ( $i = 0; $i <= $eventdays; $i ++ ) {
430
  $eventdate = strtotime( date( "Y-m-d", strtotime( $from_date ) ) . " +" . $i . " day" );
431
  $week_day = strtolower( date( 'l', $eventdate ) );
432
  $eventdate = date( "Y-n-j", $eventdate );
433
- if (is_array($days) && in_array( $week_day, $days ) ) {
 
434
  if ( $how > 1 && $week_day == $event_week_last_day ) {
435
  $from_date = strtotime( ( date( "Y-m-d", ( strtotime( $from_date ) ) ) . " +" . ( ( $how * 7 ) - 7 ) . " days" ) );
436
  $from_date = date( 'Y-m-d', $from_date );
437
  $next_week = date( "Y-m-d", strtotime( 'next monday', strtotime( $from_date ) ) );
438
  }
439
  $from = $eventdate;
 
440
  if ( strtotime( $until ) >= strtotime( date( 'Y-m-d', strtotime( $from ) ) ) ) {
441
 
442
- // if ($week_day == $event_week_last_day) {
443
- // $from_date = strtotime((date("Y-m-d", (strtotime($from_date))) . " +" . (($how * 7) - 7) . " days"));
444
- // //$next_week = (date("Y-m-d", (strtotime($from_date))) . " next monday");
445
- // $next_week = date("Y-m-d",strtotime('next monday', $from_date));
446
- // echo $week_day.'----'.$date.'-----'.$next_week.'<br />';
447
- // $from_date = date('Y-m-d', strtotime($next_week));
448
- //
449
- // $from = $date;
450
- // $to = date('Y-m-d', strtotime($from . ' + ' . $eventdayslong . ' days'));
451
- // }
452
 
453
  $to = date( 'Y-m-d', strtotime( $from . ' + ' . $eventdayslong . ' days' ) );
454
- if ( ! $current_month || ( strtotime( $from ) <= strtotime( date( 'Y-m-t', strtotime( $this->date ) ) ) && strtotime( $from ) >= strtotime( $this->year . '-' . $this->month . '-1' ) && in_array( strtolower( date( 'l', strtotime( $from ) ) ), $weekdays ) ) ) {
 
 
 
455
  $this->events[] = array(
456
  'color' => $color,
457
  'title' => $title,
@@ -477,7 +494,6 @@ class ECWD_Display {
477
 
478
  }
479
  }
480
- //if(in_array())
481
  }
482
  } elseif ( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] == 'daily' ) {
483
  $until = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] : $to );
@@ -498,7 +514,7 @@ class ECWD_Display {
498
  $from_date = date( 'Y-m-d', $from_date );
499
  $from = $date;
500
  $to = date( 'Y-m-d', strtotime( $from . ' + ' . $eventdayslong . ' days' ) );
501
- if ( ! $current_month || ( strtotime( $from ) <= strtotime( date( 'Y-m-t', strtotime( $this->date ) ) ) && strtotime( $from ) >= strtotime( $this->year . '-' . $this->month . '-1' ) && in_array( strtolower( date( 'l', strtotime( $from ) ) ), $weekdays ) ) ) {
502
  $this->events[] = array(
503
  'color' => $color,
504
  'title' => $title,
@@ -546,7 +562,7 @@ class ECWD_Display {
546
  if ( $i > 0 ) {
547
  if ( $repeat_days == 2 && $repeat_day && $repeat_when && date( 'Y-m', strtotime( $event_from ) ) !== date( 'Y-m', $date ) ) {
548
  $monthyear = date( "F Y", $date );
549
- $repeat_date = date( 'Y-m-d', strtotime($repeat_when.' '.ucfirst( $repeat_day ).' of '.$monthyear) );
550
 
551
  $date = strtotime( $repeat_date );
552
  }
@@ -563,7 +579,7 @@ class ECWD_Display {
563
  $from = $date;
564
  $to = strtotime( ( date( "Y-m-d", ( strtotime( $from ) ) ) . " +" . ( $eventdayslong ) . " days" ) );
565
  $to = date( 'Y-m-d', $to );
566
- if ( ! $current_month || ( strtotime( $from ) <= strtotime( date( 'Y-m-t', strtotime( $this->date ) ) ) && strtotime( $from ) >= strtotime( $this->year . '-' . $this->month . '-1' ) && in_array( strtolower( date( 'l', strtotime( $from ) ) ), $weekdays ) ) ) {
567
 
568
  $this->events[] = array(
569
  'color' => $color,
@@ -593,7 +609,6 @@ class ECWD_Display {
593
  }
594
 
595
  } else if ( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] == 'yearly' ) {
596
-
597
  $until = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] : $to );
598
  $how = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_how' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_how' ][0] : 1 );
599
  $eventdays = $this->dateDiff( $from, $until );
@@ -603,10 +618,10 @@ class ECWD_Display {
603
  $repeat_days = isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_year_on_days' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_year_on_days' ][0] : 1;
604
  $repeat_when = isset( $metas[ ECWD_PLUGIN_PREFIX . '_monthly_list_yearly' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_monthly_list_yearly' ][0] : false;
605
  $repeat_day = isset( $metas[ ECWD_PLUGIN_PREFIX . '_monthly_week_yearly' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_monthly_week_yearly' ][0] : false;
606
- if(isset($metas[ ECWD_PLUGIN_PREFIX . '_event_year_month' ][0]) && $repeat_days == 2) {
607
  $month = $metas[ ECWD_PLUGIN_PREFIX . '_event_year_month' ][0];
608
  $monthName = date( 'F', strtotime( '2015-' . $month . '-1' ) );
609
- }else {
610
  $monthName = date( 'F', strtotime( $from_date ) );
611
  }
612
  $min_date = strtotime( $event_from );
@@ -622,15 +637,15 @@ class ECWD_Display {
622
 
623
  }
624
  if ( $repeat_days == 2 && $repeat_day && $repeat_when ) {
625
- $monthyear = $monthName . ' ' . date( "Y", $date );
626
  //echo $repeat_when.' '.ucfirst( $repeat_day ).' of '.$monthyear.'<br />';
627
- $repeat_date = strtotime(date( 'Y-m-d', strtotime($repeat_when.' '.ucfirst( $repeat_day ).' of '.$monthyear) ));
628
  //$repeat_date = date( 'Y-m-d', strtotime($repeat_when.' '.ucfirst( $repeat_day ).' of '.$monthyear) );
629
  //don't know why, but "last sunday,last monday... returns last s,m of previous month"
630
  if ( $repeat_when == 'last' ) {
631
- $repeat_date = strtotime($repeat_when.' '.ucfirst( $repeat_day ).' of '.$monthyear, strtotime( "+1 MONTH", $repeat_date ));
632
  }
633
- $date = $repeat_date ;
634
 
635
  }
636
  }
@@ -644,7 +659,7 @@ class ECWD_Display {
644
  $from = $date;
645
  $to = strtotime( ( date( "Y-m-d", ( strtotime( $from_date ) ) ) . " +" . ( $eventdayslong ) . " days" ) );
646
  $to = date( 'Y-m-d', $to );
647
- if ( ! $current_month || ( strtotime( $from ) <= strtotime( date( 'Y-m-t', strtotime( $this->date ) ) ) && strtotime( $from ) >= strtotime( $this->year . '-' . $this->month . '-1' ) && in_array( strtolower( date( 'l', strtotime( $from ) ) ), $weekdays ) ) ) {
648
 
649
  $this->events[] = array(
650
  'color' => $color,
@@ -716,21 +731,23 @@ class ECWD_Display {
716
 
717
  if ( $events ) {
718
  return $this->events;
 
719
  }
720
  }
721
 
722
 
723
- function literalDate($timestamp, $weekday) {
724
- $timestamp = is_numeric($timestamp) ? $timestamp : strtotime($timestamp);
725
- $month = date('M', $timestamp);
726
  $ord = 0;
727
 
728
- while(date('M', ($timestamp = strtotime('-1 week', $timestamp))) == $month) {
729
- $ord++;
730
  }
731
 
732
- $lit = array('first', 'second', 'third', 'fourth', 'fifth');
733
- return strtolower($lit[$ord].' '.$weekday);
 
734
  }
735
 
736
  /**
@@ -739,7 +756,7 @@ class ECWD_Display {
739
  public function get_view( $date = '', $type = '', $widget = 0 ) {
740
  require_once 'calendar-class.php';
741
  $categories = get_categories( array( 'taxonomy' => ECWD_PLUGIN_PREFIX . '_event_category' ) );
742
- $tags = get_terms('ecwd_event_tag', array('hide_empty' => false));
743
 
744
  //Get events data
745
  //Generate the calendar markup and return it
8
  private $events, $merged_events, $goole_events, $date, $month, $year, $day;
9
 
10
 
11
+ public function __construct( $ids, $title_text = null, $sort_order = 'asc', $date = '', $page = 1, $search_params = array(), $displays = null, $filters = null, $page_items = 5, $event_search = 'yes', $display = '' ) {
12
  $this->id = $ids;
13
  $this->title = $title_text;
14
  $this->sort = $sort_order;
20
  $this->event_search = $event_search;
21
  //$this->date = $date;
22
  $this->page = $page;
23
+ if ( $display ) {
 
24
  $this->display = $display;
25
+ } else {
26
  $this->display = 'full';
27
  }
28
 
34
  if ( $date == '' && ! isset( $_REQUEST['date'] ) ) {
35
  $date = date( 'Y-n-j' );
36
  }
37
+ $start_date = date( 'Y-n-d', strtotime( $date ) );
38
+ $date = date( 'Y-n-t', strtotime( $date ) ); // format the date for parsing
39
+ $date_part = explode( '-', $date ); // separate year/month/day
40
+ $year = $date_part[0];
41
+ $month = $date_part[1];
42
+ $day = $date_part[2];
43
  if ( isset( $_REQUEST['y'] ) && $_REQUEST['y'] != '' ) {
44
  $year = $_REQUEST['y'];
45
  } // if year is set in querystring it takes precedence
59
  if ( $day == '' ) {
60
  $day = date( 'j' ); // set to the 1st is year and month is known
61
  }
62
+ $this->date = $date;
63
+ $this->month = (int) $month;
64
+ $this->year = (int) $year;
65
+ $this->day = (int) $day;
66
+ $this->start_date = $this->year . '-' . $this->month . '-1';
67
+ $this->end_date = date( 'Y-m-t', strtotime( $this->date ) );
68
+ if ( ( isset( $_REQUEST['t'] ) && $_REQUEST['t'] == 'week' ) || $this->display == 'week' ) {
69
+ $this->start_date = $start_date;
70
+ $this->end_date = date( "Y-m-d", strtotime( '+7 days', strtotime( $start_date ) ) );
71
+ $this->date = date( 'Y-n-t', strtotime( $this->end_date ) );
72
+ } elseif ( ( isset( $_REQUEST['t'] ) && $_REQUEST['t'] == '4day' ) || $this->display == '4day' ) {
73
+ $this->start_date = $start_date;
74
+ $this->end_date = date( "Y-m-d", strtotime( '+4 days', strtotime( $start_date ) ) );
75
+ $this->date = date( 'Y-n-t', strtotime( $this->end_date ) );
76
+ }
77
+
78
 
79
  if ( $this->id ) {
80
  $this->get_events();
85
  public function get_events() {
86
 
87
  //get events by calendars
 
88
  if ( ! $this->date ) {
89
  $this->date = $date = date( 'Y-m-t' );
90
  }
91
+ $date = $this->date;
92
 
93
 
 
 
 
 
 
 
 
 
94
  $query = ( isset( $this->search['query'] ) ? $this->search['query'] : '' );
95
 
96
  foreach ( $this->id as $id ) {
198
  ),
199
  array(
200
  'key' => ECWD_PLUGIN_PREFIX . '_event_date_from',
201
+ 'value' => $this->end_date,
202
  'compare' => '<=',
203
  'type' => 'DATE'
204
  ),
237
 
238
  $ecwd_events += $ecwd_events_title;
239
  wp_reset_query();
240
+ $google_events = array();
241
  $events = array();
242
+ $ical_events = array();
243
+ $facebook_events = array();
244
+ //fetch google calendar events
245
+
246
+
247
+
248
  foreach ( $ecwd_events as $ecwd_event ) {
249
+
250
  $term_metas = '';
251
  $categories = get_the_terms( $ecwd_event->ID, ECWD_PLUGIN_PREFIX . '_event_category' );
252
  if ( is_array( $categories ) ) {
287
  }
288
  }
289
  }
290
+ $this->merged_events += $google_events + $facebook_events + $ical_events + $events;
291
 
 
292
  //$this->merged_events += $events;
293
  $this->get_event_days();
294
  }
314
  $events = $this->merged_events;
315
 
316
  }
 
 
317
  foreach ( $events as $id => $arr ) {
318
 
319
  if ( is_int( $arr->start_time ) ) {
356
  $organizers = array();
357
  $organizersIDs = array();
358
  if ( $metas && isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_organizers' ][0] ) ) {
359
+
360
+ if ( is_serialized( $metas[ ECWD_PLUGIN_PREFIX . '_event_organizers' ][0] ) ) {
361
  $organizers_ids = unserialize( $metas[ ECWD_PLUGIN_PREFIX . '_event_organizers' ][0] );
362
+ }elseif(is_array($metas[ ECWD_PLUGIN_PREFIX . '_event_organizers' ][0] )){
363
+ $organizers_ids = $metas[ ECWD_PLUGIN_PREFIX . '_event_organizers' ][0];
364
+ }else{
365
+ $organizers_ids = array();
366
+ }
367
+
368
  foreach ( $organizers_ids as $organizer_id ) {
369
  if ( $organizer_id ) {
370
  $opost = get_post( $organizer_id );
419
  $weekdays = $this->search['weekdays'];
420
  }
421
 
422
+
423
  if ( $metas && isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] ) && $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] !== 'no_repeat' && $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] != '' ) {
424
  $event_week_last_day = '';
425
  if ( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] == 'weekly' ) {
426
+ $days = array();
427
  if ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0] ) && $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0] != '' ) {
428
+
429
+
430
+ if ( is_serialized( $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0] ) ) {
431
  $days = unserialize( $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0] );
432
+ } elseif ( is_array( $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0] ) ) {
433
  $days = $metas[ ECWD_PLUGIN_PREFIX . '_event_day' ][0];
434
  }
435
  } else {
436
  $days = array( strtolower( date( 'l', strtotime( $from ) ) ) );
437
  }
438
+
439
  $until = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] : $to );
440
  $how = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_how' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_how' ][0] : 1 );
441
  if ( count( $days ) ) {
447
  continue;
448
  }
449
  $from_date = $from;
450
+
451
  for ( $i = 0; $i <= $eventdays; $i ++ ) {
452
  $eventdate = strtotime( date( "Y-m-d", strtotime( $from_date ) ) . " +" . $i . " day" );
453
  $week_day = strtolower( date( 'l', $eventdate ) );
454
  $eventdate = date( "Y-n-j", $eventdate );
455
+
456
+ if ( is_array( $days ) && in_array( $week_day, $days ) ) {
457
  if ( $how > 1 && $week_day == $event_week_last_day ) {
458
  $from_date = strtotime( ( date( "Y-m-d", ( strtotime( $from_date ) ) ) . " +" . ( ( $how * 7 ) - 7 ) . " days" ) );
459
  $from_date = date( 'Y-m-d', $from_date );
460
  $next_week = date( "Y-m-d", strtotime( 'next monday', strtotime( $from_date ) ) );
461
  }
462
  $from = $eventdate;
463
+
464
  if ( strtotime( $until ) >= strtotime( date( 'Y-m-d', strtotime( $from ) ) ) ) {
465
 
 
 
 
 
 
 
 
 
 
 
466
 
467
  $to = date( 'Y-m-d', strtotime( $from . ' + ' . $eventdayslong . ' days' ) );
468
+ //var_dump();
469
+
470
+
471
+ if ( ! $current_month || ( strtotime( $from ) <= strtotime( $this->end_date ) && strtotime( $from ) >= strtotime( $this->start_date ) && in_array( strtolower( date( 'l', strtotime( $from ) ) ), $weekdays ) ) ) {
472
  $this->events[] = array(
473
  'color' => $color,
474
  'title' => $title,
494
 
495
  }
496
  }
 
497
  }
498
  } elseif ( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] == 'daily' ) {
499
  $until = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] : $to );
514
  $from_date = date( 'Y-m-d', $from_date );
515
  $from = $date;
516
  $to = date( 'Y-m-d', strtotime( $from . ' + ' . $eventdayslong . ' days' ) );
517
+ if ( ! $current_month || ( strtotime( $from ) <= strtotime( $this->end_date ) && strtotime( $from ) >= strtotime( $this->start_date ) && in_array( strtolower( date( 'l', strtotime( $from ) ) ), $weekdays ) ) ) {
518
  $this->events[] = array(
519
  'color' => $color,
520
  'title' => $title,
562
  if ( $i > 0 ) {
563
  if ( $repeat_days == 2 && $repeat_day && $repeat_when && date( 'Y-m', strtotime( $event_from ) ) !== date( 'Y-m', $date ) ) {
564
  $monthyear = date( "F Y", $date );
565
+ $repeat_date = date( 'Y-m-d', strtotime( $repeat_when . ' ' . ucfirst( $repeat_day ) . ' of ' . $monthyear ) );
566
 
567
  $date = strtotime( $repeat_date );
568
  }
579
  $from = $date;
580
  $to = strtotime( ( date( "Y-m-d", ( strtotime( $from ) ) ) . " +" . ( $eventdayslong ) . " days" ) );
581
  $to = date( 'Y-m-d', $to );
582
+ if ( ! $current_month || ( strtotime( $from ) <= strtotime( $this->end_date ) && strtotime( $from ) >= strtotime( $this->start_date ) && in_array( strtolower( date( 'l', strtotime( $from ) ) ), $weekdays ) ) ) {
583
 
584
  $this->events[] = array(
585
  'color' => $color,
609
  }
610
 
611
  } else if ( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_event' ][0] == 'yearly' ) {
 
612
  $until = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until' ][0] : $to );
613
  $how = ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_how' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_how' ][0] : 1 );
614
  $eventdays = $this->dateDiff( $from, $until );
618
  $repeat_days = isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_year_on_days' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_event_repeat_year_on_days' ][0] : 1;
619
  $repeat_when = isset( $metas[ ECWD_PLUGIN_PREFIX . '_monthly_list_yearly' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_monthly_list_yearly' ][0] : false;
620
  $repeat_day = isset( $metas[ ECWD_PLUGIN_PREFIX . '_monthly_week_yearly' ][0] ) ? $metas[ ECWD_PLUGIN_PREFIX . '_monthly_week_yearly' ][0] : false;
621
+ if ( isset( $metas[ ECWD_PLUGIN_PREFIX . '_event_year_month' ][0] ) && $repeat_days == 2 ) {
622
  $month = $metas[ ECWD_PLUGIN_PREFIX . '_event_year_month' ][0];
623
  $monthName = date( 'F', strtotime( '2015-' . $month . '-1' ) );
624
+ } else {
625
  $monthName = date( 'F', strtotime( $from_date ) );
626
  }
627
  $min_date = strtotime( $event_from );
637
 
638
  }
639
  if ( $repeat_days == 2 && $repeat_day && $repeat_when ) {
640
+ $monthyear = $monthName . ' ' . date( "Y", $date );
641
  //echo $repeat_when.' '.ucfirst( $repeat_day ).' of '.$monthyear.'<br />';
642
+ $repeat_date = strtotime( date( 'Y-m-d', strtotime( $repeat_when . ' ' . ucfirst( $repeat_day ) . ' of ' . $monthyear ) ) );
643
  //$repeat_date = date( 'Y-m-d', strtotime($repeat_when.' '.ucfirst( $repeat_day ).' of '.$monthyear) );
644
  //don't know why, but "last sunday,last monday... returns last s,m of previous month"
645
  if ( $repeat_when == 'last' ) {
646
+ $repeat_date = strtotime( $repeat_when . ' ' . ucfirst( $repeat_day ) . ' of ' . $monthyear, strtotime( "+1 MONTH", $repeat_date ) );
647
  }
648
+ $date = $repeat_date;
649
 
650
  }
651
  }
659
  $from = $date;
660
  $to = strtotime( ( date( "Y-m-d", ( strtotime( $from_date ) ) ) . " +" . ( $eventdayslong ) . " days" ) );
661
  $to = date( 'Y-m-d', $to );
662
+ if ( ! $current_month || ( strtotime( $from ) <= strtotime( $this->end_date ) && strtotime( $from ) >= strtotime( $this->start_date ) && in_array( strtolower( date( 'l', strtotime( $from ) ) ), $weekdays ) ) ) {
663
 
664
  $this->events[] = array(
665
  'color' => $color,
731
 
732
  if ( $events ) {
733
  return $this->events;
734
+
735
  }
736
  }
737
 
738
 
739
+ function literalDate( $timestamp, $weekday ) {
740
+ $timestamp = is_numeric( $timestamp ) ? $timestamp : strtotime( $timestamp );
741
+ $month = date( 'M', $timestamp );
742
  $ord = 0;
743
 
744
+ while ( date( 'M', ( $timestamp = strtotime( '-1 week', $timestamp ) ) ) == $month ) {
745
+ $ord ++;
746
  }
747
 
748
+ $lit = array( 'first', 'second', 'third', 'fourth', 'fifth' );
749
+
750
+ return strtolower( $lit[ $ord ] . ' ' . $weekday );
751
  }
752
 
753
  /**
756
  public function get_view( $date = '', $type = '', $widget = 0 ) {
757
  require_once 'calendar-class.php';
758
  $categories = get_categories( array( 'taxonomy' => ECWD_PLUGIN_PREFIX . '_event_category' ) );
759
+ $tags = get_terms( 'ecwd_event_tag', array( 'hide_empty' => false ) );
760
 
761
  //Get events data
762
  //Generate the calendar markup and return it
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-event-calendar-wd.html
4
  Tags: calendar, calendars, event, event calendar, event manager, events calendar, calendar widget, event registration, event management,events, agenda, holiday calendar , scheduling, free calendar, Calender, upcoming events , event widget , event list, calendar localization, Organizer, editorial calendar, Interactive Calendar, news calendar, meeting , appointment, event tracking, event organizer, upcoming events widget, event page, event bookings, recurring, recurring events, conference, date, dates, schedule, times, venue, AJAX, responsive, shortcode, seminar, summit
5
  Requires at least: 3.9
6
  Tested up to: 4.2
7
- Stable tag: 1.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -110,6 +110,10 @@ After downloading the ZIP file of the Event Calendar WD plugin,
110
 
111
  == Changelog ==
112
 
 
 
 
 
113
  = 1.0.0 =
114
  Initial version
115
 
4
  Tags: calendar, calendars, event, event calendar, event manager, events calendar, calendar widget, event registration, event management,events, agenda, holiday calendar , scheduling, free calendar, Calender, upcoming events , event widget , event list, calendar localization, Organizer, editorial calendar, Interactive Calendar, news calendar, meeting , appointment, event tracking, event organizer, upcoming events widget, event page, event bookings, recurring, recurring events, conference, date, dates, schedule, times, venue, AJAX, responsive, shortcode, seminar, summit
5
  Requires at least: 3.9
6
  Tested up to: 4.2
7
+ Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
110
 
111
  == Changelog ==
112
 
113
+ = 1.0.1 =
114
+ Fixed: Bug in Week view
115
+ Fixed: Permalink bug
116
+
117
  = 1.0.0 =
118
  Initial version
119
 
views/widgets.php CHANGED
@@ -16,7 +16,7 @@ class ECWD_Widget extends WP_Widget {
16
 
17
  function __construct() {
18
  parent::__construct(
19
- false, $name = __('Event Calendar WD', 'ecwd'), array('description' => __('A calendar of your events', 'ecwd'))
20
  );
21
  }
22
 
16
 
17
  function __construct() {
18
  parent::__construct(
19
+ false, $name = __('Event Calendar WD', 'ecwd'), array('description' => __('Descr', 'ecwd'))
20
  );
21
  }
22