Event Calendar WD – Responsive Event Calendar plugin - Version 1.1.17

Version Description

  • New: Calendar uninstall
  • Improved: Importing iCal all day events (Premium)
  • New: Respect event timezone when importing iCal (Premium, requires extension update)
  • Fixed: New lines in iCal events descriptions (Premium)
  • Improved: Default values of events metadata
  • Changed: Other optimizations under the hood
Download this release

Release Info

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

Code changes from version 1.1.16 to 1.1.17

changelog.txt CHANGED
@@ -1,4 +1,12 @@
1
- = 1.1.16 ==
 
 
 
 
 
 
 
 
2
  * New: GDPR compliance help
3
  * New: WD library updated
4
  * New: Use theme template for single event CPT
@@ -10,29 +18,29 @@
10
  * Changed: Other optimizations under the hood
11
 
12
 
13
- = 1.1.15 ==
14
  * Improved: Fully translatable calendar plugin and extensions. Suggest your translations here: https://translate.wordpress.org/projects/wp-plugins/event-calendar-wd
15
  * Improved: Frontend styles of single event, venue and organizer CPT
16
  * Changed: Styles of filters extension (Premium)
17
  * Changed: Some metaboxes moved to higher position
18
 
19
- = 1.1.14 ==
20
  * Changed: create_function is deprecated in PHP 7.2
21
  * Changed: Sort organizers and venues by title not slug in post type archive
22
  * Improved: Styles of Gutenberg block popup
23
  * Fixed: Styles of free and premium versions synchronized
24
 
25
- = 1.1.13 ==
26
  * Added: Gutenberg integration
27
  * Fixed: Google maps zoom
28
  * Improved: Russian translation
29
 
30
- = 1.1.12 ==
31
  * Improved: Change default calendar using calendar list in dashboard
32
  * Changed: Calendar add-ons and themes do not have separate menu anymore
33
  * Changed: Updates and functionality removed (Premium)
34
 
35
- = 1.1.11 ==
36
  Fixed: Bug on PHP 5.3 version
37
 
38
  = 1.1.10 =
1
+ = 1.1.17 =
2
+ * New: Calendar uninstall
3
+ * Improved: Importing iCal all day events (Premium)
4
+ * New: Respect event timezone when importing iCal (Premium, requires extension update)
5
+ * Fixed: New lines in iCal events descriptions (Premium)
6
+ * Improved: Default values of events metadata
7
+ * Changed: Other optimizations under the hood
8
+
9
+ = 1.1.16 =
10
  * New: GDPR compliance help
11
  * New: WD library updated
12
  * New: Use theme template for single event CPT
18
  * Changed: Other optimizations under the hood
19
 
20
 
21
+ = 1.1.15 =
22
  * Improved: Fully translatable calendar plugin and extensions. Suggest your translations here: https://translate.wordpress.org/projects/wp-plugins/event-calendar-wd
23
  * Improved: Frontend styles of single event, venue and organizer CPT
24
  * Changed: Styles of filters extension (Premium)
25
  * Changed: Some metaboxes moved to higher position
26
 
27
+ = 1.1.14 =
28
  * Changed: create_function is deprecated in PHP 7.2
29
  * Changed: Sort organizers and venues by title not slug in post type archive
30
  * Improved: Styles of Gutenberg block popup
31
  * Fixed: Styles of free and premium versions synchronized
32
 
33
+ = 1.1.13 =
34
  * Added: Gutenberg integration
35
  * Fixed: Google maps zoom
36
  * Improved: Russian translation
37
 
38
+ = 1.1.12 =
39
  * Improved: Change default calendar using calendar list in dashboard
40
  * Changed: Calendar add-ons and themes do not have separate menu anymore
41
  * Changed: Updates and functionality removed (Premium)
42
 
43
+ = 1.1.11 =
44
  Fixed: Bug on PHP 5.3 version
45
 
46
  = 1.1.10 =
css/admin/admin.css CHANGED
@@ -341,7 +341,7 @@ span.ecwd_error {
341
  font-size: 17px;
342
  }
343
 
344
- #ecwd-settings a.button :not(.wd_notice_button) {
345
  border: 1px solid #A1A1A1;
346
  padding: 0px 15px;
347
  box-shadow: none;
341
  font-size: 17px;
342
  }
343
 
344
+ #ecwd-settings a.button:not(.wd_notice_button) {
345
  border: 1px solid #A1A1A1;
346
  padding: 0px 15px;
347
  box-shadow: none;
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.1.16
7
  * Author: WebDorado
8
  * Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
9
  * Text Domain: event-calendar-wd
@@ -25,7 +25,7 @@ if (!defined('ECWD_URL')) {
25
  }
26
 
27
  if (!defined('ECWD_VERSION')) {
28
- define('ECWD_VERSION', "1.1.16");
29
  }
30
 
31
  if (!defined('ECWD_PLUGIN_MAIN_FILE')) {
@@ -39,17 +39,23 @@ if (!defined('ECWD_REST_NAMESPACE')) {
39
  define('ECWD_REST_NAMESPACE', 'ecwd/v1');
40
  }
41
 
42
- add_action('plugins_loaded', array('ECWD', 'get_instance'));
 
 
43
 
44
  if (is_admin()) {
45
  require_once('ecwd_admin_class.php');
46
 
47
- add_action('init', array( 'ECWD_Admin', 'check_silent_update' ));
 
 
 
 
48
 
49
  register_activation_hook(__FILE__, array('ECWD_Admin', 'global_activate'));
50
- register_uninstall_hook(__FILE__, array('ECWD_Admin', 'uninstall'));
51
- add_action('plugins_loaded', array('ECWD_Admin', 'get_instance'));
52
  add_action('init', array('ECWD_Admin', 'ecwd_freemius'), 9);
 
 
53
  }
54
 
55
  add_filter('wp_get_default_privacy_policy_content', 'ecwd_privacy_policy');
@@ -67,3 +73,5 @@ function ecwd_privacy_policy($content){
67
  }
68
 
69
 
 
 
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.1.17
7
  * Author: WebDorado
8
  * Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
9
  * Text Domain: event-calendar-wd
25
  }
26
 
27
  if (!defined('ECWD_VERSION')) {
28
+ define('ECWD_VERSION', "1.1.17");
29
  }
30
 
31
  if (!defined('ECWD_PLUGIN_MAIN_FILE')) {
39
  define('ECWD_REST_NAMESPACE', 'ecwd/v1');
40
  }
41
 
42
+ if(get_site_transient('ecwd_uninstall') === false) {
43
+ add_action('plugins_loaded', array('ECWD', 'get_instance'));
44
+ }
45
 
46
  if (is_admin()) {
47
  require_once('ecwd_admin_class.php');
48
 
49
+ add_action('admin_menu', array('ECWD_Admin', 'uninstall_menu'));
50
+ if(get_site_transient('ecwd_uninstall') === false) {
51
+ add_action('init', array('ECWD_Admin', 'check_silent_update'));
52
+ add_action('plugins_loaded', array('ECWD_Admin', 'get_instance'));
53
+ }
54
 
55
  register_activation_hook(__FILE__, array('ECWD_Admin', 'global_activate'));
 
 
56
  add_action('init', array('ECWD_Admin', 'ecwd_freemius'), 9);
57
+ register_deactivation_hook(__FILE__, array('ECWD_Admin', 'global_deactivate'));
58
+ //register_uninstall_hook(__FILE__, array('ECWD_Admin', 'uninstall'));
59
  }
60
 
61
  add_filter('wp_get_default_privacy_policy_content', 'ecwd_privacy_policy');
73
  }
74
 
75
 
76
+
77
+
ecwd_admin_class.php CHANGED
@@ -57,6 +57,7 @@ class ECWD_Admin {
57
  }
58
  add_filter('default_hidden_meta_boxes', array($this, 'default_hidden_meta_boxes'),2,2);
59
  add_filter("plugin_row_meta", array($this, 'ecwd_add_plugin_meta_links'), 10, 2);
 
60
  }
61
 
62
  public function wd_bp_install_notice(){
@@ -179,11 +180,30 @@ class ECWD_Admin {
179
  }
180
  }
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
  public static function activate() {
184
  if (!defined('ECWD_PLUGIN_PREFIX')) {
185
  define('ECWD_PLUGIN_PREFIX', 'ecwd');
186
  }
 
 
 
187
  $has_option = get_option('ecwd_old_events');
188
  if ($has_option === false) {
189
  $old_event = get_posts(array(
@@ -257,6 +277,37 @@ class ECWD_Admin {
257
 
258
  }
259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
  public static function check_silent_update(){
262
 
@@ -1213,6 +1264,8 @@ class ECWD_Admin {
1213
  require_once(ECWD_DIR . '/wd/start.php');
1214
  }
1215
 
 
 
1216
  $ecwd_options = array(
1217
  "prefix" => "ecwd",
1218
  "wd_plugin_id" => 86,
@@ -1355,7 +1408,13 @@ class ECWD_Admin {
1355
  "menu_position" => 25
1356
  );
1357
 
 
 
 
 
 
1358
  dorado_web_init($ecwd_options);
 
1359
 
1360
  }
1361
  }
57
  }
58
  add_filter('default_hidden_meta_boxes', array($this, 'default_hidden_meta_boxes'),2,2);
59
  add_filter("plugin_row_meta", array($this, 'ecwd_add_plugin_meta_links'), 10, 2);
60
+ add_action('untrashed_post', array($this, 'set_default_metas_to_restored_events'));
61
  }
62
 
63
  public function wd_bp_install_notice(){
180
  }
181
  }
182
 
183
+ public function set_default_metas_to_restored_events($post_id){
184
+
185
+ if(get_post_type($post_id) !== "ecwd_event") {
186
+ return;
187
+ }
188
+
189
+ $today = date('Y-m-d H:i');
190
+
191
+ $start_date = date('Y/m/d H:i', strtotime($today . "+1 days"));
192
+ $end_date = date('Y/m/d H:i', strtotime($start_date . "+1 hour"));
193
+
194
+ update_post_meta($post_id, 'ecwd_event_date_from', $start_date);
195
+ update_post_meta($post_id, 'ecwd_event_date_to', $end_date);
196
+ }
197
+
198
+
199
 
200
  public static function activate() {
201
  if (!defined('ECWD_PLUGIN_PREFIX')) {
202
  define('ECWD_PLUGIN_PREFIX', 'ecwd');
203
  }
204
+
205
+ delete_site_transient('ecwd_uninstall');
206
+ delete_option('ecwd_admin_notice');
207
  $has_option = get_option('ecwd_old_events');
208
  if ($has_option === false) {
209
  $old_event = get_posts(array(
277
 
278
  }
279
 
280
+ public static function uninstall_menu(){
281
+ $slug = ECWD_MENU_SLUG;
282
+ if(get_site_transient('ecwd_uninstall') === '1') {
283
+ add_menu_page(
284
+ 'Events',
285
+ 'Events',
286
+ 'manage_options',
287
+ 'ecwd_event_menu',
288
+ array('ECWD_Admin', 'display_uninstall_page'),
289
+ plugins_url('/assets/Insert-icon.png', ECWD_MAIN_FILE),
290
+ '25'
291
+ );
292
+ $slug = 'ecwd_event_menu';
293
+ }
294
+
295
+
296
+ add_submenu_page(
297
+ "",
298
+ __('Uninstall', 'event-calendar-wd'),
299
+ __('Uninstall', 'event-calendar-wd'),
300
+ 'manage_options',
301
+ 'ecwd_uninstall',
302
+ array('ECWD_Admin', 'display_uninstall_page')
303
+ );
304
+ }
305
+
306
+ public static function display_uninstall_page(){
307
+ include_once 'includes/ecwd-uninstall.php';
308
+ $uninstall = new ecwd_uninstall();
309
+ }
310
+
311
 
312
  public static function check_silent_update(){
313
 
1264
  require_once(ECWD_DIR . '/wd/start.php');
1265
  }
1266
 
1267
+ global $ecwd_wd_freemius_config;
1268
+
1269
  $ecwd_options = array(
1270
  "prefix" => "ecwd",
1271
  "wd_plugin_id" => 86,
1408
  "menu_position" => 25
1409
  );
1410
 
1411
+ if(get_site_transient('ecwd_uninstall') === '1') {
1412
+ $ecwd_options['subscribe'] = false;
1413
+ $ecwd_options['custom_post'] = null;
1414
+ }
1415
+
1416
  dorado_web_init($ecwd_options);
1417
+ $ecwd_wd_freemius_config = $ecwd_options;
1418
 
1419
  }
1420
  }
ecwd_class.php CHANGED
@@ -25,14 +25,18 @@ class ECWD {
25
  add_action('ecwd_show_related_events', array($this, 'show_related_events'), 10, 2);
26
  add_action('init', array($this, 'register_hooks'));
27
  }
 
28
  public function register_hooks(){
29
  add_action('rest_api_init', array($this, 'init_rest_api'));
30
  }
 
31
  public function init_rest_api(){
32
  require_once ECWD_DIR . '/includes/ecwd_class-rest-api.php';
33
  EcwdRestApi::get_instance();
34
  }
 
35
  public function show_related_events($events, $upcoming_events = false) {
 
36
  global $ecwd_options;
37
  if(!empty($events)) {
38
  usort($events, array($this, 'order_events'));
25
  add_action('ecwd_show_related_events', array($this, 'show_related_events'), 10, 2);
26
  add_action('init', array($this, 'register_hooks'));
27
  }
28
+
29
  public function register_hooks(){
30
  add_action('rest_api_init', array($this, 'init_rest_api'));
31
  }
32
+
33
  public function init_rest_api(){
34
  require_once ECWD_DIR . '/includes/ecwd_class-rest-api.php';
35
  EcwdRestApi::get_instance();
36
  }
37
+
38
  public function show_related_events($events, $upcoming_events = false) {
39
+
40
  global $ecwd_options;
41
  if(!empty($events)) {
42
  usort($events, array($this, 'order_events'));
includes/activation_settings_page.php CHANGED
@@ -5,7 +5,7 @@ if (isset($_POST["skip_wizard"])) {
5
  die;
6
  }
7
  if (isset($_POST["ecwd_settings_general"]) && isset($_POST["ecwd_settings_general"]["install_sample_data"]) && $_POST["ecwd_settings_general"]["install_sample_data"] == "1") {
8
- sample_data_creator();
9
  }
10
  if (isset($_POST["ecwd_settings_general"])) {
11
  $sett = get_option("ecwd_settings_general");
@@ -19,7 +19,7 @@ if (isset($_POST["ecwd_settings_general"])) {
19
  update_option("ecwd_settings_general", $sett);
20
  // header('Location: ?activate=false&plugin_status=all&paged=1&s=');
21
  header('Location: admin.php?page=ecwd_subscribe');
22
- update_option("activation_page_option", "ok");
23
  }
24
 
25
  function sample_data_creator() {
5
  die;
6
  }
7
  if (isset($_POST["ecwd_settings_general"]) && isset($_POST["ecwd_settings_general"]["install_sample_data"]) && $_POST["ecwd_settings_general"]["install_sample_data"] == "1") {
8
+ //sample_data_creator();
9
  }
10
  if (isset($_POST["ecwd_settings_general"])) {
11
  $sett = get_option("ecwd_settings_general");
19
  update_option("ecwd_settings_general", $sett);
20
  // header('Location: ?activate=false&plugin_status=all&paged=1&s=');
21
  header('Location: admin.php?page=ecwd_subscribe');
22
+ //update_option("activation_page_option", "ok");
23
  }
24
 
25
  function sample_data_creator() {
includes/ecwd-cpt-class.php CHANGED
@@ -12,6 +12,7 @@ class ECWD_Cpt {
12
  protected static $instance = null;
13
  public $rewriteSlugSingular;
14
  public $rewriteSlug;
 
15
 
16
  private function __construct() {
17
  global $ecwd_options;
@@ -717,7 +718,17 @@ class ECWD_Cpt {
717
  * Add Events post meta
718
  */
719
  public function events_cpt_meta($screen = null, $context = 'advanced') {
720
- add_meta_box(ECWD_PLUGIN_PREFIX . '_event_meta', __('Event Details', 'event-calendar-wd'), array(
 
 
 
 
 
 
 
 
 
 
721
  $this,
722
  'display_events_meta'
723
  ), ECWD_PLUGIN_PREFIX . '_event', 'normal', 'high');
@@ -985,7 +996,7 @@ class ECWD_Cpt {
985
  /**
986
  * Function to save post meta for the event CPT
987
  */
988
- public function save_meta($post_id, $post) {
989
  if (( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) || ( defined('DOING_AJAX') && DOING_AJAX )) {
990
  return $post_id;
991
  }
@@ -996,7 +1007,12 @@ class ECWD_Cpt {
996
  return $post_id;
997
  }
998
 
999
- $types = array(
 
 
 
 
 
1000
  ECWD_PLUGIN_PREFIX . '_calendar',
1001
  ECWD_PLUGIN_PREFIX . '_event',
1002
  ECWD_PLUGIN_PREFIX . '_theme',
@@ -1213,9 +1229,15 @@ class ECWD_Cpt {
1213
  include_once 'events/ecwd-events-controller.php';
1214
 
1215
  $event = new ecwd_single_event($post_id);
1216
- $event->start_date = $_POST['ecwd_event_date_from'];
1217
- $event->end_date = $_POST['ecwd_event_date_to'];
1218
- $event->all_day = ((isset($_POST['ecwd_all_day_event'])) && $_POST['ecwd_all_day_event'] === '1');
 
 
 
 
 
 
1219
  $event->calendars = !empty($_POST['ecwd_event_calendars']) ? $_POST['ecwd_event_calendars'] : array();
1220
  $event->set_venue($_POST['ecwd_event_venue']);
1221
  $event->organizers = !empty($_POST['ecwd_event_organizers']) ? $_POST['ecwd_event_organizers'] : array();
12
  protected static $instance = null;
13
  public $rewriteSlugSingular;
14
  public $rewriteSlug;
15
+ private $single_event_for_metas = null;
16
 
17
  private function __construct() {
18
  global $ecwd_options;
718
  * Add Events post meta
719
  */
720
  public function events_cpt_meta($screen = null, $context = 'advanced') {
721
+
722
+ global $post;
723
+ if(!empty($post->post_type) && $post->post_type === "ecwd_event"){
724
+ include_once 'events/ecwd-single-event.php';
725
+ $this->single_event_for_metas = new ecwd_single_event($post->ID, $post->title, $post->post_title, $post->post_content);
726
+ $this->single_event_for_metas->post = $post;
727
+ $this->single_event_for_metas->set_metas();
728
+ }
729
+
730
+
731
+ add_meta_box(ECWD_PLUGIN_PREFIX . '_event_meta', __('Event Details', 'event-calendar-wd'), array(
732
  $this,
733
  'display_events_meta'
734
  ), ECWD_PLUGIN_PREFIX . '_event', 'normal', 'high');
996
  /**
997
  * Function to save post meta for the event CPT
998
  */
999
+ public function save_meta($post_id, $post, $post_before) {
1000
  if (( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) || ( defined('DOING_AJAX') && DOING_AJAX )) {
1001
  return $post_id;
1002
  }
1007
  return $post_id;
1008
  }
1009
 
1010
+ if($post->post_status === "trash" || $post_before->post_status === "trash"){
1011
+ return $post_id;
1012
+ }
1013
+
1014
+
1015
+ $types = array(
1016
  ECWD_PLUGIN_PREFIX . '_calendar',
1017
  ECWD_PLUGIN_PREFIX . '_event',
1018
  ECWD_PLUGIN_PREFIX . '_theme',
1229
  include_once 'events/ecwd-events-controller.php';
1230
 
1231
  $event = new ecwd_single_event($post_id);
1232
+ $event->set_start_date($_POST['ecwd_event_date_from']);
1233
+ $event->set_end_date($_POST['ecwd_event_date_to']);
1234
+
1235
+ if((isset($_POST['ecwd_all_day_event'])) && $_POST['ecwd_all_day_event'] === '1') {
1236
+ $event->set_all_day(true);
1237
+ } else {
1238
+ $event->set_all_day(false);
1239
+ }
1240
+
1241
  $event->calendars = !empty($_POST['ecwd_event_calendars']) ? $_POST['ecwd_event_calendars'] : array();
1242
  $event->set_venue($_POST['ecwd_event_venue']);
1243
  $event->organizers = !empty($_POST['ecwd_event_organizers']) ? $_POST['ecwd_event_organizers'] : array();
includes/ecwd-uninstall.php ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ecwd_uninstall {
4
+
5
+ public function __construct(){
6
+
7
+ if(isset($_POST['ecwd_check_yes']) && $_POST['ecwd_check_yes'] === 'yes') {
8
+ $this->uninstall();
9
+ } else if(get_site_transient('ecwd_uninstall') === '1') {
10
+ $this->deactivate_plugin();
11
+ } else {
12
+ $this->ecwd_display_uninstall_page();
13
+ }
14
+
15
+ }
16
+
17
+ private function uninstall(){
18
+
19
+ if(!wp_verify_nonce($_POST['ecwd_uninstall'], 'ecwd_uninstall')) {
20
+ return;
21
+ }
22
+
23
+ $this->delete_options();
24
+ $this->delete_posts();
25
+ $this->delete_taxonomies();
26
+ set_site_transient('ecwd_uninstall', '1', 12 * 60 * 60);
27
+
28
+ die('<script>window.location.href="admin.php?page=ecwd_uninstall"</script>');
29
+ }
30
+
31
+ private function delete_options(){
32
+ $options = $this->get_options();
33
+ foreach($options['addons'] as $opt) {
34
+ delete_option($opt);
35
+ }
36
+
37
+ foreach($options['calendar_options'] as $opt) {
38
+ delete_option($opt);
39
+ }
40
+ }
41
+
42
+ private function delete_posts(){
43
+
44
+ $posts = get_posts(array(
45
+ 'numberposts' => -1,
46
+ 'post_type' => $this->get_post_types(),
47
+ 'post_status' => 'any'
48
+ )
49
+ );
50
+
51
+ foreach($posts as $post) {
52
+ wp_delete_post($post->ID, true);
53
+ }
54
+
55
+ }
56
+
57
+ private function delete_taxonomies(){
58
+ $terms = get_terms(array(
59
+ 'taxonomy' => $this->get_taxonomies(),
60
+ 'hide_empty' => false,
61
+ 'fields' => 'all',
62
+ 'hierarchical' => true,
63
+ 'child_of' => 0,
64
+ 'get' => 'all',
65
+ 'childless' => false
66
+ ));
67
+
68
+
69
+ foreach($terms as $term) {
70
+ wp_delete_term($term->term_id, $term->taxonomy);
71
+ if($term->taxonomy === "ecwd_event_category") {
72
+ delete_option('ecwd_event_category_' . $term->term_id);
73
+ }
74
+ }
75
+
76
+ }
77
+
78
+
79
+ private function ecwd_display_uninstall_page(){
80
+ $taxanomies = $this->get_taxonomies();
81
+ $options = $this->get_options();
82
+ $options = $options['calendar_options'];
83
+ $post_types = $this->get_post_types();
84
+
85
+ ?>
86
+
87
+ <style>
88
+ .goodbye-text {
89
+ font-size: 16px;
90
+ font-weight: bold;
91
+ background: #fff;
92
+ padding: 15px;
93
+ line-height: 22px;
94
+ }
95
+
96
+ .goodbye-text a {
97
+ font-size: 15px;
98
+ }
99
+
100
+ table.widefat {
101
+ margin-bottom: 8px;
102
+ }
103
+ </style>
104
+ <form class="sc_form" method="post" action="" style="width:99%;">
105
+ <?php wp_nonce_field('ecwd_uninstall', 'ecwd_uninstall'); ?>
106
+ <div class="wrap">
107
+ <h2><?php echo __('Uninstall Event Calendar WD', 'event-calendar-wd'); ?></h2>
108
+ <div class="goodbye-text">
109
+ Before uninstalling the plugin, please Contact our
110
+ <a href="https://web-dorado.com/support/contact-us.html" target="_blank">support team</a>. We'll do
111
+ our best to help you out with your issue. We value each and every user and value what’s right for our
112
+ users in everything we do.<br>
113
+ However, if anyway you have made a decision to uninstall the plugin, please take a minute to
114
+ <a href="https://web-dorado.com/support/contact-us.html" target="_blank">Contact us</a> and tell what
115
+ you didn't like for our plugins further improvement and development. Thank you !!!
116
+ </div>
117
+ <p>
118
+ <?php echo __('Deactivating Event Calendar WD plugin does not remove any data that may have been created. To completely remove this plugin, you can uninstall it here. Uninstalling Event Calendar WD will also remove the data of its extensions.', 'event-calendar-wd'); ?>
119
+ </p>
120
+ <p style="color: red;">
121
+ <strong><?php echo __('WARNING:', 'event-calendar-wd'); ?></strong>
122
+ <?php echo __("Once uninstalled, this can't be undone. You should use a Database Backup plugin of WordPress to back up all the data first.", 'event-calendar-wd'); ?>
123
+ </p>
124
+ <p style="color: red">
125
+ <strong><?php echo __('The following Database Tables will be deleted:', 'event-calendar-wd'); ?></strong>
126
+ </p>
127
+ <table class="widefat">
128
+ <thead>
129
+ <tr>
130
+ <th><?php echo __('Posts of these types', 'event-calendar-wd'); ?></th>
131
+ </tr>
132
+ </thead>
133
+ <tr>
134
+ <td valign="top">
135
+ <ol>
136
+ <?php foreach($post_types as $post_type) {
137
+
138
+ if($post_type !== 'ecwd_subscribe_page' || $post_type !== 'ecwd_countdown_theme') {
139
+ echo "<li>" . $post_type . "</li>";
140
+ }
141
+
142
+ } ?>
143
+ </ol>
144
+ </td>
145
+ </tr>
146
+ </table>
147
+ <table class="widefat">
148
+ <thead>
149
+ <tr>
150
+ <th><?php echo __('Terms of these taxonomies', 'event-calendar-wd'); ?></th>
151
+ </tr>
152
+ </thead>
153
+ <tr>
154
+ <td valign="top">
155
+ <ol>
156
+ <?php
157
+ foreach($taxanomies as $tax) {
158
+
159
+ echo "<li>" . $tax . "</li>";
160
+
161
+ } ?>
162
+ </ol>
163
+ </td>
164
+ </tr>
165
+ </table>
166
+ <table class="widefat">
167
+ <thead>
168
+ <tr>
169
+ <th><?php echo __('Database options', 'event-calendar-wd'); ?></th>
170
+ </tr>
171
+ </thead>
172
+ <tr>
173
+ <td valign="top">
174
+ <ol>
175
+ <?php
176
+ foreach($options as $option) {
177
+
178
+ echo "<li>" . $option . "</li>";
179
+
180
+ } ?>
181
+ </ol>
182
+ </td>
183
+ </tr>
184
+ </table>
185
+ <p style="text-align: center;">
186
+ <?php echo __('Do you really want to uninstall Event Calendar WD ?', 'event-calendar-wd'); ?>
187
+ </p>
188
+ <p style="text-align: center;">
189
+ <input type="checkbox" name="ecwd_check_yes" id="ecwd_check_yes" value="yes"/>&nbsp;
190
+ <label for="ecwd_check_yes"><?php echo __('Yes', 'event-calendar-wd'); ?></label>
191
+ </p>
192
+ <p style="text-align: center;">
193
+ <a id="ecwd_uninstall_btn" href="#" class="button-primary">UNINSTALL</a>
194
+ </p>
195
+ </div>
196
+ </form>
197
+ <script>
198
+ jQuery(document).ready(function () {
199
+ jQuery('#ecwd_uninstall_btn').on('click', function (e) {
200
+ e.preventDefault();
201
+
202
+ if (jQuery('#ecwd_check_yes').prop('checked') === false) {
203
+ return false;
204
+ }
205
+
206
+ var text = '<?php echo addslashes(__('You are About to Uninstall Event Calendar WD from WordPress. This Action Is Not Reversible.', 'event-calendar-wd')); ?>';
207
+ if (confirm(text)) {
208
+ jQuery(this).closest('form').submit();
209
+ } else {
210
+ return false;
211
+ }
212
+ });
213
+ });
214
+ </script>
215
+ <?php }
216
+
217
+ private function deactivate_plugin(){
218
+
219
+ /*DEACTIVATION POPUP*/
220
+ wp_enqueue_script('ecwd-deactivate-popup', ECWD_URL . '/wd/assets/js/deactivate_popup.js', array(), ECWD_VERSION, true);
221
+ $admin_data = wp_get_current_user();
222
+
223
+ wp_localize_script('ecwd-deactivate-popup', 'ecwdWDDeactivateVars', array(
224
+ "prefix" => "ecwd",
225
+ "deactivate_class" => 'ecwd_deactivate_link',
226
+ "email" => $admin_data->data->user_email,
227
+ "plugin_wd_url" => "https://web-dorado.com/products/wordpress-instagram-feed-wd.html",
228
+ ));
229
+ wp_enqueue_style('ecwd_deactivate-css', ECWD_URL . '/wd/assets/css/deactivate_popup.css', array(), ECWD_VERSION);
230
+
231
+
232
+ if(!class_exists("DoradoWebConfig")) {
233
+ include_once(ECWD_DIR . "/wd/config.php");
234
+ }
235
+
236
+ if(!class_exists("DoradoWebDeactivate")) {
237
+ include_once(ECWD_DIR . "/wd/includes/deactivate.php");
238
+ }
239
+ $config = new DoradoWebConfig();
240
+
241
+ global $ecwd_wd_freemius_config;
242
+ $config->set_options($ecwd_wd_freemius_config);
243
+ $deactivate_reasons = new DoradoWebDeactivate($config);
244
+ //$deactivate_reasons->add_deactivation_feedback_dialog_box();
245
+ $deactivate_reasons->submit_and_deactivate();
246
+
247
+
248
+ ?>
249
+ <style>
250
+ div.error {
251
+ display: none !important;
252
+ }
253
+ </style>
254
+ <div class="wrap">
255
+ <h2><?php echo __('Uninstall Event Calendar WD', 'event-calendar-wd'); ?></h2>
256
+ <p>
257
+ <strong>
258
+ <a class="ecwd_deactivate_link" data-uninstall="1"
259
+ href="<?php echo $this->get_deactivate_url(); ?>"><?php echo __('Click Here', 'event-calendar-wd'); ?></a> <?php echo __('To Finish the Uninstallation and Event Calendar WD will be Deactivated Automatically.', 'event-calendar-wd'); ?>
260
+ </strong>
261
+ </p>
262
+ </div>
263
+ <script>
264
+ /*DEACTIVATION POPUP*/
265
+ jQuery(document).ready(function () {
266
+ wdReady("ecwd");
267
+ });
268
+ </script>
269
+ <?php }
270
+
271
+
272
+ private function get_post_types(){
273
+ $post_types = array('ecwd_event', 'ecwd_organizer', 'ecwd_venue', 'ecwd_calendar', 'ecwd_theme', 'ecwd_subscribe_page', 'ecwd_countdown_theme');
274
+ return $post_types;
275
+ }
276
+
277
+ private function get_taxonomies(){
278
+ return array('ecwd_event_category', 'ecwd_event_tag');
279
+ }
280
+
281
+ private function get_options(){
282
+ $options = array(
283
+ 'calendar_options' => array(
284
+ 'ecwd_setup_default_themes',
285
+ 'ecwd_themes_files_created',
286
+ 'ecwd_settings_events',
287
+ 'ecwd_version',
288
+ 'ecwd_default_calendar',
289
+ 'ecwd_grey_theme_id',
290
+ // 'ecwd_admin_notice',
291
+ 'ecwd_scripts_key',
292
+ 'ecwd_settings_general',
293
+ 'ecwd_slug_changed',
294
+ 'ecwd_single_slug',
295
+ 'ecwd_slug',
296
+ 'ecwd_cpt_setup',
297
+ 'ecwd_not_writable_warning',
298
+ 'ecwd_subscribe_done',
299
+ 'ecwd_config',
300
+ 'widget_ecwd_widget',
301
+ 'ecwd_settings',
302
+ 'ecwd_settings_category_archive',
303
+ 'ecwd_settings_custom_css',
304
+ 'ecwd_settings_google_map',
305
+ 'ecwd_old_events',
306
+ 'ecwd_event_category_children',
307
+ 'widget_ecwd_events_widget',
308
+ ),
309
+ 'addons' => array(
310
+ 'tickets_ids',
311
+ 'ecwd_ticketing_email_template',
312
+ 'spider_categories',
313
+ 'spider_calendars',
314
+ 'ecwd_old_calendars',
315
+ 'ecwd_old_venues',
316
+ 'ecwd_old_organizers',
317
+ 'ecwd_old_categories',
318
+ 'ecwd_old_tags',
319
+ 'ecwd_send_mail_notification',
320
+ 'ecwd_subscribe_pages_ids',
321
+ 'ecwd_settings_ecwd_subscribe',
322
+ 'ecwd_wait_subscribers_data',
323
+ 'ecwd_subscribers_data',
324
+ 'ecwd_subscribe_notice',
325
+ 'ecwd_activate_subscriber_mail_template',
326
+ 'ecwd_subscribe_mail_template',
327
+ 'ecwd_cancle_event_mail_template',
328
+ 'ecwd_countdown_setup_default_theme',
329
+ 'ecwd_countdown_cpt_setup',
330
+ 'ecwd_fb_import',
331
+ 'ecwd_gcal_import',
332
+ 'ecwd_ical_import',
333
+ 'widget_ecwd_events_filter_widget',
334
+ 'ecwd_settings_fb',
335
+ 'ecwd_settings_gcal',
336
+ 'ecwd_settings_ical',
337
+ 'ecwd_settings_af',
338
+ 'ecwd_settings_filter_settings',
339
+ 'ecwd_settings_export',
340
+ )
341
+
342
+ );
343
+ return $options;
344
+ }
345
+
346
+ private function get_deactivate_url(){
347
+ $deactivate_url =
348
+ add_query_arg(
349
+ array(
350
+ 'action' => 'deactivate',
351
+ 'plugin' => plugin_basename(ECWD_PLUGIN_MAIN_FILE),
352
+ '_wpnonce' => wp_create_nonce('deactivate-plugin_' . plugin_basename(ECWD_PLUGIN_MAIN_FILE))
353
+ ),
354
+ admin_url('plugins.php')
355
+ );
356
+ return $deactivate_url;
357
+ }
358
+ }
359
+
360
+
361
+ ?>
362
+
includes/events/ecwd-events-controller.php CHANGED
@@ -6,8 +6,14 @@
6
  * Time: 4:26 PM
7
  */
8
 
 
 
 
9
  class ecwd_events_controller {
10
 
 
 
 
11
 
12
  public function create_event(){
13
  //insert post
@@ -17,14 +23,46 @@ class ecwd_events_controller {
17
  //title, contet, etc
18
  }
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * @param $ev ecwd_single_event
22
  * */
23
  public function update_meta_values($ev){
24
 
25
- update_post_meta($ev->id, 'ecwd_event_date_from', $this->sanitize_text($ev->start_date));
26
- update_post_meta($ev->id, 'ecwd_event_date_to', $this->sanitize_text($ev->end_date));
27
- if($ev->all_day === true) {
28
  update_post_meta($ev->id, 'ecwd_all_day_event', '1');
29
  } else {
30
  delete_post_meta($ev->id, 'ecwd_all_day_event');
6
  * Time: 4:26 PM
7
  */
8
 
9
+
10
+ include_once 'ecwd-single-event.php';
11
+
12
  class ecwd_events_controller {
13
 
14
+ public function __construct(){
15
+ }
16
+
17
 
18
  public function create_event(){
19
  //insert post
23
  //title, contet, etc
24
  }
25
 
26
+ public function get_events(){
27
+ include_once 'ecwd-events-query.php';
28
+ $ecwd_query = new ecwd_events_query();
29
+
30
+
31
+ //$ecwd_query->filter_by_taxonomies(array(25, 26), array(23));
32
+ // $ecwd_query->filter_by_calendars(['143', '166']);
33
+ // $ecwd_query->filter_by_venues(['51','145']);
34
+ // $ecwd_query->filter_by_organizers(['153','142']);
35
+ // $ecwd_query->filter_by_post_status(['publish','private']);
36
+ // $ecwd_query->search('');
37
+ $ecwd_query->filter_by_date('2018-07-01', '2018-07-31');
38
+ //$ecwd_query->meta_query_relation('AND');
39
+
40
+ $single_events_list = array();
41
+ $events = $ecwd_query->get_posts();
42
+ $events_id = array();
43
+
44
+ foreach($events as $event) {
45
+
46
+ $single_event = new ecwd_single_event($event->ID, $event->post_title, $event->post_content);
47
+ $single_event->post = $event;
48
+ $single_event->set_permalink();
49
+ $single_event->set_featured_image_url();
50
+ $single_event->set_categories();
51
+ $single_event->set_tags();
52
+ $single_event->set_metas();
53
+
54
+ $single_events_list[$event->ID] = $single_event;
55
+ }
56
+ }
57
+
58
  /**
59
  * @param $ev ecwd_single_event
60
  * */
61
  public function update_meta_values($ev){
62
 
63
+ update_post_meta($ev->id, 'ecwd_event_date_from', $this->sanitize_text($ev->get_start_date()));
64
+ update_post_meta($ev->id, 'ecwd_event_date_to', $this->sanitize_text($ev->get_end_date()));
65
+ if($ev->get_all_day() === true) {
66
  update_post_meta($ev->id, 'ecwd_all_day_event', '1');
67
  } else {
68
  delete_post_meta($ev->id, 'ecwd_all_day_event');
includes/events/ecwd-events-query.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: mher
5
+ * Date: 5/14/18
6
+ * Time: 4:26 PM
7
+ */
8
+
9
+ class ecwd_events_query {
10
+
11
+ private $query_args = array();
12
+
13
+ public function __construct(){
14
+ $this->set_default_query_args();
15
+ }
16
+
17
+ /**
18
+ * @param $events_ids array
19
+ * @return array
20
+ * */
21
+ public function get_metas($events_ids){
22
+ global $wpdb;
23
+
24
+ $ids = implode("','", $events_ids);
25
+ $ids = "'" . $ids . "'";
26
+
27
+
28
+ $table = $wpdb->postmeta;
29
+ $query = "SELECT * FROM " . $table . " where post_id IN (" . $ids . ") AND meta_key LIKE 'ecwd_%';";
30
+
31
+ return $wpdb->get_results($query, OBJECT);
32
+ }
33
+
34
+ /**
35
+ * @return array
36
+ * */
37
+ public function get_posts(){
38
+
39
+ $wp_query = new WP_Query();
40
+ $events = $wp_query->query($this->query_args);
41
+
42
+ $this->reset_query();
43
+ return $events;
44
+ }
45
+
46
+
47
+ /**
48
+ * Search on post title and description
49
+ * @param $search string
50
+ **/
51
+ public function search($search){
52
+ $this->set_query_arg('s', $search);
53
+ }
54
+
55
+ public function get_all_events(){
56
+ return $this->query();
57
+ }
58
+
59
+ /**
60
+ * @param $from string date format Y/m/d
61
+ * @param $to string date format Y/m/d
62
+ * */
63
+ public function filter_by_date($from = "", $to = ""){
64
+
65
+ $date_query = array();
66
+
67
+ $from_query = array();
68
+ if(!empty($from)) {
69
+
70
+ $from_query = array(
71
+ 'key' => 'ecwd_event_date_from',
72
+ 'value' => $from,
73
+ 'compare' => '>=',
74
+ 'type' => 'DATE'
75
+ );
76
+
77
+ }
78
+
79
+ $to_query = array();
80
+ if(!empty($to)) {
81
+
82
+ $to_query = array(
83
+ 'key' => 'ecwd_event_date_to',
84
+ 'value' => $to,
85
+ 'compare' => '<=',
86
+ 'type' => 'DATE'
87
+ );
88
+
89
+ }
90
+
91
+ if(!empty($to_query) && !empty($from_query)) {
92
+
93
+ $date_query = array(
94
+ 'relation' => 'AND',
95
+ $from_query,
96
+ $to_query,
97
+ );
98
+
99
+ } else if(!empty($to_query)) {
100
+ $date_query = $to_query;
101
+ } else if(!empty($from_query)) {
102
+ $date_query = $from_query;
103
+ }
104
+
105
+ $this->add_query_arg('meta_query', $date_query);
106
+ }
107
+
108
+ /**
109
+ * @param $calendar_id string|array
110
+ * @param $exclude boolean exclude authors no
111
+ * @param $relation string OR|AND
112
+ * */
113
+ public function filter_by_calendars($calendar_id, $exclude = false, $relation = 'OR'){
114
+
115
+ $compare = ($exclude === false) ? "LIKE" : "NOT LIKE";
116
+ if(!is_array($calendar_id)) {
117
+ $calendar_query = array(
118
+ 'key' => 'ecwd_event_calendars',
119
+ 'value' => serialize(strval($calendar_id)),
120
+ 'compare' => $compare
121
+ );
122
+ $this->add_query_arg('meta_query', $calendar_query);
123
+ return;
124
+ }
125
+
126
+
127
+ $calendar_query = array();
128
+ foreach($calendar_id as $cal_id) {
129
+ $calendar_query[] = array(
130
+ 'key' => 'ecwd_event_calendars',
131
+ 'value' => serialize(strval($cal_id)),
132
+ 'compare' => $compare
133
+ );
134
+ }
135
+
136
+ $calendar_query['relation'] = $relation;
137
+
138
+ $this->add_query_arg('meta_query', $calendar_query);
139
+ }
140
+
141
+ /**
142
+ * @param $venue_id string|array
143
+ * @param $relation string OR|AND
144
+ * */
145
+ public function filter_by_venues($venue_id){
146
+
147
+ if(!is_array($venue_id)) {
148
+ $calendar_query = array(
149
+ 'key' => 'ecwd_event_venue',
150
+ 'value' => $venue_id,
151
+ 'compare' => "="
152
+ );
153
+ $this->add_query_arg('meta_query', $calendar_query);
154
+ return;
155
+ }
156
+
157
+
158
+ $calendar_query = array();
159
+ foreach($venue_id as $v_id) {
160
+ $calendar_query[] = array(
161
+ 'key' => 'ecwd_event_venue',
162
+ 'value' => $v_id,
163
+ 'compare' => "="
164
+ );
165
+ }
166
+
167
+ $calendar_query['relation'] = 'OR';
168
+
169
+ $this->add_query_arg('meta_query', $calendar_query);
170
+ }
171
+
172
+ /**
173
+ * @param $organizer_id string|array
174
+ * @param $exclude boolean exclude authors no
175
+ * @param $relation string OR|AND
176
+ * */
177
+ public function filter_by_organizers($organizer_id, $exclude = false, $relation = 'OR'){
178
+
179
+ $compare = ($exclude === false) ? "LIKE" : "NOT LIKE";
180
+ if(!is_array($organizer_id)) {
181
+ $calendar_query = array(
182
+ 'key' => 'ecwd_event_organizers',
183
+ 'value' => serialize(strval($organizer_id)),
184
+ 'compare' => $compare
185
+ );
186
+ $this->add_query_arg('meta_query', $calendar_query);
187
+ return;
188
+ }
189
+
190
+
191
+ $calendar_query = array();
192
+ foreach($organizer_id as $cal_id) {
193
+ $calendar_query[] = array(
194
+ 'key' => 'ecwd_event_organizers',
195
+ 'value' => serialize(strval($cal_id)),
196
+ 'compare' => $compare
197
+ );
198
+ }
199
+
200
+ $calendar_query['relation'] = $relation;
201
+
202
+ $this->add_query_arg('meta_query', $calendar_query);
203
+ }
204
+
205
+ /**
206
+ * @param $from string date format Y/m/d
207
+ * @param $to string date format Y/m/d
208
+ * @param $relation string AND|OR
209
+ * */
210
+ public function filter_by_taxonomies($categories = array(), $tags = array(), $relation = 'OR'){
211
+
212
+ $tax_query = array();
213
+
214
+ if(!empty($categories)) {
215
+
216
+ $tax_query[] = array(
217
+ 'taxonomy' => 'ecwd_event_category',
218
+ 'terms' => $categories
219
+ );
220
+
221
+ }
222
+
223
+ if(!empty($tags)) {
224
+
225
+ $tax_query[] = array(
226
+ 'taxonomy' => 'ecwd_event_tag',
227
+ 'terms' => $tags
228
+ );
229
+
230
+ }
231
+
232
+ $tax_query['relation'] = $relation;
233
+ $this->set_query_arg('tax_query', $tax_query);
234
+ }
235
+
236
+
237
+ /**
238
+ * @param $value string|int|array author id or ids
239
+ * @param $exclude boolean exclude authors no
240
+ * */
241
+ public function filter_by_author($author_id, $exclude = false){
242
+
243
+ if(!is_array($author_id)) {
244
+ $author_id = array($author_id);
245
+ }
246
+
247
+ if($exclude === false) {
248
+ $this->set_query_arg('author__in', $author_id);
249
+ } else {
250
+ $this->set_query_arg('author__not_in', $author_id);
251
+ }
252
+
253
+ }
254
+
255
+ /**
256
+ * @param $status string|array ['publish','pending','draft','private','any',...]
257
+ * */
258
+ public function filter_by_post_status($status){
259
+ if(!is_array($status)) {
260
+ $status = array($status);
261
+ }
262
+ $this->set_query_arg('post_status', $status);
263
+ }
264
+
265
+ /**
266
+ * @param $relation string OR|AND
267
+ * */
268
+ public function meta_query_relation($relation){
269
+ if(!isset($this->query_args['meta_query'])) {
270
+ $this->query_args['meta_query'] = array();
271
+ }
272
+ $this->query_args['meta_query']['relation'] = $relation;
273
+ }
274
+
275
+ public function set_query_arg($key, $value){
276
+ $this->query_args[$key] = $value;
277
+ }
278
+
279
+ public function add_query_arg($key, $value){
280
+
281
+ if(!isset($this->query_args[$key])) {
282
+ $this->query_args[$key] = array();
283
+ }
284
+
285
+ $this->query_args[$key][] = $value;
286
+ }
287
+
288
+ public function get_query_args(){
289
+ return $this->query_args;
290
+ }
291
+
292
+ public function order($key, $value){
293
+
294
+ }
295
+
296
+ public function reset_query(){
297
+ $this->set_default_query_args();
298
+ }
299
+
300
+ private function set_default_query_args(){
301
+
302
+ $this->query_args = array(
303
+ 'posts_per_page' => -1,
304
+ 'post_type' => 'ecwd_event',
305
+ 'post_status' => array('publish'),
306
+ 'meta_key' => 'ecwd_event_date_from',
307
+ 'orderby' => 'meta_value',
308
+ 'order' => 'ASC',
309
+ 'suppress_filters' => false
310
+ );
311
+
312
+ }
313
+
314
+ private function sanitize_text($str){
315
+ if(!is_array($str)) {
316
+ return sanitize_text_field($str);
317
+ } else {
318
+ foreach($str as $key => $value) {
319
+ $str[$key] = $this->sanitize_text($value);
320
+ }
321
+ return $str;
322
+ }
323
+
324
+ }
325
+
326
+
327
+ }
includes/events/ecwd-single-event.php CHANGED
@@ -11,12 +11,11 @@ class ecwd_single_event {
11
  public $id;// null|int
12
  public $title;
13
  public $content;
14
- public $featured_image_id;
15
- public $featured_image_url;
16
- public $permalink;
17
- public $start_date;
18
- public $end_date;
19
- public $all_day;//boolean
20
  public $calendars = array();//array calendar ids
21
  public $organizers = array();//array organizers list (id, title, description, metas)
22
  public $venue = null;//null|array('post'=> WP_Post, 'metas' => array)
@@ -27,8 +26,8 @@ class ecwd_single_event {
27
  'ecwd_event_repeat_event' => "no_repeat",//no_repeat,daily,weekly,monthly,yearly
28
  'ecwd_event_day' => array(),//[monday,tuesday,wednesday,thursday,friday,saturday,sunday]
29
  'ecwd_event_repeat_how' => "",//number|""
30
- 'ecwd_event_repeat_month_on_days' => "1",//number
31
- 'ecwd_event_repeat_year_on_days' => "1",//number
32
  'ecwd_event_repeat_on_the_m' => null,
33
  'ecwd_event_repeat_on_the_y' => null,
34
  'ecwd_monthly_list_monthly' => null,
@@ -38,14 +37,34 @@ class ecwd_single_event {
38
  'ecwd_event_repeat_repeat_until' => "",
39
  'ecwd_event_year_month' => null,
40
  ); //array
41
- public $event_url;
42
- public $video_url;
43
  public $other_metas = array();//array meta_key:meta_value
 
44
 
45
  public function __construct($id = null, $title = "", $content = ""){
46
  $this->id = $id;
47
  $this->title = $title;
48
  $this->content = $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
 
51
  public function set_venue($venue_id){
@@ -56,11 +75,20 @@ class ecwd_single_event {
56
  }
57
 
58
  $venue = get_post($venue_id);
59
- $metas = get_post_meta($venue_id, "", true);
 
 
60
 
61
  $this->venue = array(
62
  'post' => $venue,
63
- 'metas' => $metas
 
 
 
 
 
 
 
64
  );
65
 
66
  }
@@ -75,6 +103,106 @@ class ecwd_single_event {
75
 
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  public function get_location_info(){
79
 
80
  $location_info = array(
@@ -85,7 +213,6 @@ class ecwd_single_event {
85
  'complete_data' => false
86
  );
87
 
88
-
89
  if($this->venue === null || $this->venue['post'] === null) {
90
  return $location_info;
91
  }
@@ -93,26 +220,26 @@ class ecwd_single_event {
93
  $location_info = array();
94
  $complete_data = true;
95
 
96
- if(!empty($this->venue['metas']['ecwd_venue_location'][0])) {
97
- $location_info['location'] = $this->venue['metas']['ecwd_venue_location'][0];
98
  } else {
99
  $complete_data = false;
100
  }
101
 
102
- if(!empty($this->venue['metas']['ecwd_venue_show_map'][0])) {
103
- $location_info['show_map'] = $this->venue['metas']['ecwd_venue_show_map'][0];
104
  } else {
105
  $complete_data = false;
106
  }
107
 
108
- if(!empty($this->venue['metas']['ecwd_venue_lat_long'][0])) {
109
- $location_info['lat_long'] = $this->venue['metas']['ecwd_venue_lat_long'][0];
110
  } else {
111
  $complete_data = false;
112
  }
113
 
114
- if(!empty($this->venue['metas']['ecwd_map_zoom'][0])) {
115
- $location_info['zoom'] = $this->venue['metas']['ecwd_map_zoom'][0];
116
  } else {
117
  $complete_data = false;
118
  }
@@ -121,4 +248,48 @@ class ecwd_single_event {
121
  return $location_info;
122
  }
123
 
124
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  public $id;// null|int
12
  public $title;
13
  public $content;
14
+ private $featured_image_url;
15
+ private $permalink;
16
+ private $start_date;
17
+ private $end_date;
18
+ private $all_day = false;//boolean
 
19
  public $calendars = array();//array calendar ids
20
  public $organizers = array();//array organizers list (id, title, description, metas)
21
  public $venue = null;//null|array('post'=> WP_Post, 'metas' => array)
26
  'ecwd_event_repeat_event' => "no_repeat",//no_repeat,daily,weekly,monthly,yearly
27
  'ecwd_event_day' => array(),//[monday,tuesday,wednesday,thursday,friday,saturday,sunday]
28
  'ecwd_event_repeat_how' => "",//number|""
29
+ 'ecwd_event_repeat_month_on_days' => "1",//1|2
30
+ 'ecwd_event_repeat_year_on_days' => "1",//1|2
31
  'ecwd_event_repeat_on_the_m' => null,
32
  'ecwd_event_repeat_on_the_y' => null,
33
  'ecwd_monthly_list_monthly' => null,
37
  'ecwd_event_repeat_repeat_until' => "",
38
  'ecwd_event_year_month' => null,
39
  ); //array
40
+ public $event_url = "";
41
+ public $video_url = "";
42
  public $other_metas = array();//array meta_key:meta_value
43
+ private $is_default_dates;
44
 
45
  public function __construct($id = null, $title = "", $content = ""){
46
  $this->id = $id;
47
  $this->title = $title;
48
  $this->content = $content;
49
+ $this->set_default_dates();
50
+ }
51
+
52
+ public function set_start_date($start_date){
53
+ $this->start_date = $start_date;
54
+ $this->is_default_dates = false;
55
+ }
56
+
57
+ public function set_end_date($end_date){
58
+ $this->end_date = $end_date;
59
+ $this->is_default_dates = false;
60
+ }
61
+
62
+ public function set_all_day($all_day){
63
+ if(is_string($all_day)) {
64
+ $this->all_day = ($all_day === '1');
65
+ } else {
66
+ $this->all_day = ($all_day === true);
67
+ }
68
  }
69
 
70
  public function set_venue($venue_id){
75
  }
76
 
77
  $venue = get_post($venue_id);
78
+ if($venue === null) {
79
+ return;
80
+ }
81
 
82
  $this->venue = array(
83
  'post' => $venue,
84
+ 'metas' => array(
85
+ 'location' => get_post_meta($venue_id, 'ecwd_venue_location', true),
86
+ 'show_map' => get_post_meta($venue_id, 'ecwd_venue_show_map', true),
87
+ 'lat_long' => get_post_meta($venue_id, 'ecwd_venue_lat_long', true),
88
+ 'map_zoom' => get_post_meta($venue_id, 'ecwd_map_zoom', true),
89
+ 'phone' => get_post_meta($venue_id, 'ecwd_venue_meta_phone', true),
90
+ 'website' => get_post_meta($venue_id, 'ecwd_venue_meta_website', true),
91
+ )
92
  );
93
 
94
  }
103
 
104
  }
105
 
106
+ public function set_permalink(){
107
+ if($this->post !== null) {
108
+ $this->permalink = get_the_permalink($this->post);
109
+ } else {
110
+ $this->permalink = get_the_permalink($this->id);
111
+ }
112
+ }
113
+
114
+ public function set_featured_image_url(){
115
+ if($this->post !== null) {
116
+ $this->featured_image_url = get_the_post_thumbnail_url($this->post);
117
+ } else {
118
+ $this->featured_image_url = get_the_post_thumbnail_url($this->id);
119
+ }
120
+ }
121
+
122
+ public function set_categories(){
123
+ if($this->post !== null) {
124
+ $this->categories = get_the_terms($this->post, 'ecwd_event_category');
125
+ } else {
126
+ $this->categories = get_the_terms($this->id, 'ecwd_event_category');
127
+ }
128
+ }
129
+
130
+ public function set_tags(){
131
+ if($this->post !== null) {
132
+ $this->tags = get_the_terms($this->post, 'ecwd_event_tag');
133
+ } else {
134
+ $this->tags = get_the_terms($this->id, 'ecwd_event_tag');
135
+ }
136
+ }
137
+
138
+ public function set_metas(){
139
+ $metas = get_post_meta($this->id);
140
+
141
+ foreach($metas as $key => $meta) {
142
+
143
+ switch($key) {
144
+ case "ecwd_event_date_from":
145
+ $this->set_start_date($meta[0]);
146
+ break;
147
+ case "ecwd_event_date_to":
148
+ $this->set_end_date($meta[0]);
149
+ break;
150
+ case "ecwd_all_day_event":
151
+ $this->all_day = ($meta[0] == '1');
152
+ break;
153
+ case "ecwd_event_calendars":
154
+ $this->calendars = maybe_unserialize($meta[0]);
155
+ break;
156
+ case "ecwd_event_organizers":
157
+ $this->organizers = maybe_unserialize($meta[0]);
158
+ break;
159
+ case "ecwd_event_venue":
160
+ if(!empty($meta[0])) {
161
+ $this->set_venue($meta[0]);
162
+ }
163
+ break;
164
+ case "ecwd_event_url":
165
+ $this->event_url = $meta[0];
166
+ break;
167
+ case "ecwd_event_video":
168
+ $this->video_url = $meta[0];
169
+ break;
170
+ case 'ecwd_event_repeat_event':
171
+ case 'ecwd_event_repeat_how':
172
+ case 'ecwd_event_repeat_on_the_m':
173
+ case 'ecwd_event_repeat_on_the_y':
174
+ case 'ecwd_monthly_list_monthly':
175
+ case 'ecwd_monthly_week_monthly':
176
+ case 'ecwd_monthly_list_yearly':
177
+ case 'ecwd_monthly_week_yearly':
178
+ case 'ecwd_event_repeat_repeat_until':
179
+ case 'ecwd_event_year_month':
180
+ $this->repeat[$key] = maybe_unserialize($meta[0]);
181
+ break;
182
+ case 'ecwd_event_day':
183
+ $val = maybe_unserialize($meta[0]);
184
+ if(!is_array($val)) {
185
+ $val = array();
186
+ }
187
+ $this->repeat[$key] = $val;
188
+ break;
189
+ case 'ecwd_event_repeat_month_on_days':
190
+ case 'ecwd_event_repeat_year_on_days':
191
+ $val = maybe_unserialize($meta[0]);
192
+
193
+ if(!($val === '1' || $val === '2')) {
194
+ $val = '1';
195
+ }
196
+ $this->repeat[$key] = $val;
197
+ break;
198
+ default:
199
+ $this->other_metas[$key] = maybe_unserialize($meta[0]);
200
+ }
201
+
202
+ }
203
+
204
+ }
205
+
206
  public function get_location_info(){
207
 
208
  $location_info = array(
213
  'complete_data' => false
214
  );
215
 
 
216
  if($this->venue === null || $this->venue['post'] === null) {
217
  return $location_info;
218
  }
220
  $location_info = array();
221
  $complete_data = true;
222
 
223
+ if(isset($this->venue['metas']['location'])) {
224
+ $location_info['location'] = $this->venue['metas']['location'];
225
  } else {
226
  $complete_data = false;
227
  }
228
 
229
+ if(isset($this->venue['metas']['show_map'])) {
230
+ $location_info['show_map'] = $this->venue['metas']['show_map'];
231
  } else {
232
  $complete_data = false;
233
  }
234
 
235
+ if(isset($this->venue['metas']['lat_long'])) {
236
+ $location_info['lat_long'] = $this->venue['metas']['lat_long'];
237
  } else {
238
  $complete_data = false;
239
  }
240
 
241
+ if(isset($this->venue['metas']['map_zoom'])) {
242
+ $location_info['zoom'] = $this->venue['metas']['map_zoom'];
243
  } else {
244
  $complete_data = false;
245
  }
248
  return $location_info;
249
  }
250
 
251
+ public function get_start_date(){
252
+ if($this->start_date === null) {
253
+ $this->set_default_dates();
254
+ }
255
+ return $this->start_date;
256
+ }
257
+
258
+ public function get_end_date(){
259
+ if($this->end_date === null) {
260
+ $this->set_default_dates();
261
+ }
262
+ return $this->end_date;
263
+ }
264
+
265
+ public function set_default_dates(){
266
+ $today = date('Y-m-d H:i');
267
+
268
+ $this->start_date = date('Y/m/d H:i', strtotime($today . "+1 days"));
269
+ $this->end_date = date('Y/m/d H:i', strtotime($this->start_date . "+1 hour"));
270
+ $this->is_default_dates = true;
271
+ }
272
+
273
+ public function get_all_day(){
274
+ return $this->all_day;
275
+ }
276
+
277
+ public function get_permalink(){
278
+ if($this->permalink === null) {
279
+ $this->set_permalink();
280
+ }
281
+ return $this->permalink;
282
+ }
283
+
284
+ public function get_featured_image_url(){
285
+ if($this->featured_image_url === null) {
286
+ $this->set_featured_image_url();
287
+ }
288
+ return $this->featured_image_url;
289
+ }
290
+
291
+ public function get_is_default_dates(){
292
+ return $this->is_default_dates;
293
+ }
294
+
295
+ }
includes/register-settings.php CHANGED
@@ -175,6 +175,14 @@ function ecwd_register_settings() {
175
  'size' => 'medium-text',
176
  'type' => 'text'
177
  ),
 
 
 
 
 
 
 
 
178
  ),
179
  'events' => array(
180
  'event_count_per_cell' => array(
175
  'size' => 'medium-text',
176
  'type' => 'text'
177
  ),
178
+ 'uninstall' => array(
179
+ 'id' => 'uninstall',
180
+ 'name' => __('Uninstall', 'event-calendar-wd'),
181
+ 'desc' => '',
182
+ 'size' => 'small-text',
183
+ 'type' => 'link',
184
+ 'href' => 'admin.php?page=ecwd_uninstall'
185
+ ),
186
  ),
187
  'events' => array(
188
  'event_count_per_cell' => array(
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: calendar, date, event, event calendar, events, events calendar, meeting, o
4
  Requires at least: 3.9
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
- Stable tag: 1.1.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -347,7 +347,15 @@ Event Calendar WD plugin optionally embeds Google Maps on front end to display e
347
 
348
  == Changelog ==
349
 
350
- = 1.1.16 ==
 
 
 
 
 
 
 
 
351
  * New: GDPR compliance help
352
  * New: WD library updated
353
  * New: Use theme template for single event CPT
@@ -358,7 +366,7 @@ Event Calendar WD plugin optionally embeds Google Maps on front end to display e
358
  * Changed: Date inputs hidden from event quick edit params
359
  * Changed: Other optimizations under the hood
360
 
361
- = 1.1.15 ==
362
  * Improved: Fully translatable calendar plugin and extensions. Suggest your translations here: https://translate.wordpress.org/projects/wp-plugins/event-calendar-wd
363
  * Improved: Frontend styles of single event, venue and organizer CPT
364
  * Changed: Styles of filters extension (Premium)
4
  Requires at least: 3.9
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
+ Stable tag: 1.1.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
347
 
348
  == Changelog ==
349
 
350
+ = 1.1.17 =
351
+ * New: Calendar uninstall
352
+ * Improved: Importing iCal all day events (Premium)
353
+ * New: Respect event timezone when importing iCal (Premium, requires extension update)
354
+ * Fixed: New lines in iCal events descriptions (Premium)
355
+ * Improved: Default values of events metadata
356
+ * Changed: Other optimizations under the hood
357
+
358
+ = 1.1.16 =
359
  * New: GDPR compliance help
360
  * New: WD library updated
361
  * New: Use theme template for single event CPT
366
  * Changed: Date inputs hidden from event quick edit params
367
  * Changed: Other optimizations under the hood
368
 
369
+ = 1.1.15 =
370
  * Improved: Fully translatable calendar plugin and extensions. Suggest your translations here: https://translate.wordpress.org/projects/wp-plugins/event-calendar-wd
371
  * Improved: Frontend styles of single event, venue and organizer CPT
372
  * Changed: Styles of filters extension (Premium)
views/admin/ecwd-event-calendars-meta.php CHANGED
@@ -3,6 +3,7 @@
3
  * Display for Event Custom Post Types
4
  */
5
  global $post;
 
6
 
7
  $post_id = $post->ID;
8
  $type = ECWD_PLUGIN_PREFIX.'_calendar';
@@ -25,7 +26,7 @@ if(current_user_can('read_private_posts')) {
25
  }
26
  }
27
 
28
- $event_calendars = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX.'_event_calendars', true);
29
  if(!$event_calendars){
30
  $event_calendars = array();
31
  }
3
  * Display for Event Custom Post Types
4
  */
5
  global $post;
6
+ $single_event = $this->single_event_for_metas;
7
 
8
  $post_id = $post->ID;
9
  $type = ECWD_PLUGIN_PREFIX.'_calendar';
26
  }
27
  }
28
 
29
+ $event_calendars = $event_calendars = $single_event->calendars;
30
  if(!$event_calendars){
31
  $event_calendars = array();
32
  }
views/admin/ecwd-event-meta.php CHANGED
@@ -4,42 +4,15 @@
4
  */
5
  global $post, $ecwd_options;
6
  $post_id = $post->ID;
7
- $meta = get_post_meta($post_id);
8
-
9
- // Load up all post meta data
10
-
11
- $ecwd_event_date_from = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_date_from', true);
12
- $ecwd_event_date_to = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_date_to', true);
13
- $ecwd_event_url = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_url', true);
14
- $ecwd_event_repeat_event = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_repeat_event', true);
15
- $ecwd_event_repeat_how = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_repeat_how', true);
16
- $ecwd_event_repeat_repeat_until = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_repeat_repeat_until', true);
17
- $ecwd_all_day_event = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_all_day_event', true);
18
- $ecwd_event_day = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_day', true);
19
- if (!is_array($ecwd_event_day)) {
20
- $ecwd_event_day = array();
21
- }
22
 
23
- $ecwd_event_repeat_month_on_days = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_repeat_month_on_days', true);
24
- if (!$ecwd_event_repeat_month_on_days) {
25
- $ecwd_event_repeat_month_on_days = 1;
26
- }
27
- $ecwd_event_repeat_year_on_days = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_repeat_year_on_days', true);
28
 
29
- if (!$ecwd_event_repeat_year_on_days) {
30
- $ecwd_event_repeat_year_on_days = 1;
 
 
31
  }
32
- $ecwd_event_repeat_on_the_m = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_repeat_on_the_m', true);
33
- $ecwd_event_repeat_on_the_y = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_repeat_on_the_y', true);
34
-
35
-
36
- $ecwd_monthly_list_monthly = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_monthly_list_monthly', true);
37
- $ecwd_monthly_week_monthly = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_monthly_week_monthly', true);
38
 
39
- $ecwd_monthly_list_yearly = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_monthly_list_yearly', true);
40
- $ecwd_monthly_week_yearly = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_monthly_week_yearly', true);
41
- $ecwd_event_year_month = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_year_month', true);
42
- $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video', true);
43
  ?>
44
 
45
 
@@ -51,14 +24,14 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
51
  <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date_from"
52
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date_from"
53
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date"
54
- value="<?php echo $ecwd_event_date_from; ?>"/>
55
  <!-- <p class="description">
56
  </p>-->
57
  <?php _e('To', 'event-calendar-wd'); ?>
58
  <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date_to"
59
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date_to"
60
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date"
61
- value="<?php echo $ecwd_event_date_to; ?>"/>
62
 
63
  <!-- <div id="-->
64
  <?php //echo ECWD_PLUGIN_PREFIX; ?><!--_event_pickup_date" class="button" value="">Days</div>-->
@@ -66,7 +39,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
66
  <?php //echo ECWD_PLUGIN_PREFIX; ?><!--_event_pickup_time" class="button" value="">Time</div>-->
67
  <div class="checkbox-div">
68
  <input type='checkbox' class='ecwd_all_day_event' id='ecwd_all_day_event'
69
- name='ecwd_all_day_event' value="1" <?php checked($ecwd_all_day_event, '1'); ?>/>
70
  <label for="ecwd_all_day_event"></label>
71
  </div>
72
  <label for="ecwd_all_day_event"><?php _e('All day', 'event-calendar-wd'); ?></label>
@@ -95,7 +68,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
95
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio"
96
  type="radio"
97
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
98
- value="no_repeat" <?php checked($ecwd_event_repeat_event, 'no_repeat') ?>/>
99
  <?php _e('Don\'t repeat', 'event-calendar-wd'); ?>
100
  </label>
101
  </p>
@@ -105,7 +78,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
105
  <label>
106
  <input class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio" type="radio"
107
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
108
- value="daily" <?php checked($ecwd_event_repeat_event, 'daily') ?>/>
109
  <?php _e('Daily', 'event-calendar-wd'); ?>
110
  </label>
111
 
@@ -117,7 +90,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
117
  <label>
118
  <input class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio" type="radio"
119
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
120
- value="weekly" <?php checked($ecwd_event_repeat_event, 'weekly') ?>/>
121
  <?php _e('Weekly', 'event-calendar-wd'); ?>
122
  </label>
123
 
@@ -132,7 +105,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
132
  <input class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio"
133
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_repeat_event_monthly" type="radio"
134
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
135
- value="monthly" <?php checked($ecwd_event_repeat_event, 'monthly') ?> />
136
  <?php _e('Monthly', 'event-calendar-wd'); ?>
137
  </label>
138
 
@@ -145,7 +118,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
145
  <label>
146
  <input class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio" type="radio"
147
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
148
- value="yearly" <?php checked($ecwd_event_repeat_event, 'yearly') ?>/>
149
  <?php _e('Yearly', 'event-calendar-wd'); ?>
150
  </label>
151
  </div>
@@ -154,7 +127,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
154
  <div id="ecwd_daily" class="hidden">
155
  <label class="repeat_format"><?php _e('Repeat every', 'event-calendar-wd'); ?></label>
156
  <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_how"
157
- value="<?php echo $ecwd_event_repeat_how ?>"/>
158
 
159
  <span id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_how_label_daily"
160
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_how_label hidden">
@@ -183,7 +156,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
183
  <div class="checkbox-div">
184
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
185
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_monday"
186
- value='monday' <?php if (in_array('monday', $ecwd_event_day)) {
187
  echo 'checked="checked"';
188
  } ?> />
189
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_monday"></label>
@@ -195,7 +168,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
195
  <div class="checkbox-div">
196
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
197
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_tuesday"
198
- value='tuesday' <?php if (in_array('tuesday', $ecwd_event_day)) {
199
  echo 'checked="checked"';
200
  } ?> />
201
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_tuesday"></label>
@@ -208,7 +181,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
208
  <div class="checkbox-div">
209
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
210
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_wednesday"
211
- value='wednesday' <?php if (in_array('wednesday', $ecwd_event_day)) {
212
  echo 'checked="checked"';
213
  } ?> />
214
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_wednesday"></label>
@@ -220,7 +193,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
220
  <div class="checkbox-div">
221
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
222
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_thursday"
223
- value='thursday' <?php if (in_array('thursday', $ecwd_event_day)) {
224
  echo 'checked="checked"';
225
  } ?> />
226
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_thursday"></label>
@@ -232,7 +205,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
232
  <div class="checkbox-div">
233
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
234
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_friday"
235
- value='friday' <?php if (in_array('friday', $ecwd_event_day)) {
236
  echo 'checked="checked"';
237
  } ?> />
238
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_friday"></label>
@@ -244,7 +217,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
244
  <div class="checkbox-div">
245
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
246
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_saturday"
247
- value='saturday' <?php if (in_array('saturday', $ecwd_event_day)) {
248
  echo 'checked="checked"';
249
  } ?> />
250
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_saturday"></label>
@@ -256,7 +229,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
256
  <div class="checkbox-div">
257
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
258
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_sunday"
259
- value='sunday' <?php if (in_array('sunday', $ecwd_event_day)) {
260
  echo 'checked="checked"';
261
  } ?> />
262
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_sunday"></label>
@@ -270,7 +243,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
270
  <div>
271
 
272
 
273
- <input type='radio' value="1" <?php checked($ecwd_event_repeat_month_on_days, '1') ?>
274
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days"
275
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days_1"
276
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_choose"/>
@@ -281,12 +254,11 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
281
  <!-- class='-->
282
  <?php //echo ECWD_PLUGIN_PREFIX; ?><!--_event_repeat_on_the'-->
283
  <!-- value="-->
284
- <?php //echo $ecwd_event_repeat_on_the_m; ?><!--"/>-->
285
  </div>
286
 
287
  <div class="ecwd_event_repeat_event_div">
288
 
289
- <input type='radio' value="2" <?php checked($ecwd_event_repeat_month_on_days, '2') ?>
290
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days"
291
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days_2"
292
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_list_radio"/>
@@ -295,32 +267,32 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
295
  for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days_2"><?php _e('On the: ', 'event-calendar-wd'); ?></label>
296
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_monthly_list_monthly"
297
  class="select_to_enable_disable">
298
- <option <?php selected($ecwd_monthly_list_monthly, 'first'); ?>
299
  value="first"><?php _e('First', 'event-calendar-wd'); ?> </option>
300
- <option <?php selected($ecwd_monthly_list_monthly, 'second'); ?>
301
  value="second"><?php _e('Second', 'event-calendar-wd'); ?></option>
302
- <option <?php selected($ecwd_monthly_list_monthly, 'third'); ?>
303
  value="third"><?php _e('Third', 'event-calendar-wd'); ?></option>
304
- <option <?php selected($ecwd_monthly_list_monthly, 'fourth'); ?>
305
  value="fourth"><?php _e('Fourth', 'event-calendar-wd'); ?></option>
306
- <option <?php selected($ecwd_monthly_list_monthly, 'last'); ?>
307
  value="last"><?php _e('Last', 'event-calendar-wd'); ?></option>
308
  </select>
309
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_monthly_week_monthly"
310
  class="select_to_enable_disable">
311
- <option <?php selected($ecwd_monthly_week_monthly, 'monday'); ?>
312
  value="monday"><?php _e('Monday', 'event-calendar-wd'); ?></option>
313
- <option <?php selected($ecwd_monthly_week_monthly, 'tuesday'); ?>
314
  value="tuesday"><?php _e('Tuesday', 'event-calendar-wd'); ?></option>
315
- <option <?php selected($ecwd_monthly_week_monthly, 'wednesday'); ?>
316
  value="wednesday"><?php _e('Wednesday', 'event-calendar-wd'); ?></option>
317
- <option <?php selected($ecwd_monthly_week_monthly, 'thursday'); ?>
318
  value="thursday"><?php _e('Thursday', 'event-calendar-wd'); ?></option>
319
- <option <?php selected($ecwd_monthly_week_monthly, 'friday'); ?>
320
  value="friday"><?php _e('Friday', 'event-calendar-wd'); ?></option>
321
- <option <?php selected($ecwd_monthly_week_monthly, 'saturday'); ?>
322
  value="saturday"><?php _e('Saturday', 'event-calendar-wd'); ?></option>
323
- <option <?php selected($ecwd_monthly_week_monthly, 'sunday'); ?>
324
  value="sunday"><?php _e('Sunday', 'event-calendar-wd'); ?></option>
325
  </select>
326
  </div>
@@ -329,34 +301,34 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
329
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_year_month"
330
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_year_month" disabled="disabled"
331
  class="select_to_enable_disable">
332
- <option <?php selected($ecwd_event_year_month, '1'); ?>
333
  value="1"><?php _e('January', 'event-calendar-wd'); ?></option>
334
- <option <?php selected($ecwd_event_year_month, '2'); ?>
335
  value="2"><?php _e('February', 'event-calendar-wd'); ?></option>
336
- <option <?php selected($ecwd_event_year_month, '3'); ?>
337
  value="3"><?php _e('March', 'event-calendar-wd'); ?></option>
338
- <option <?php selected($ecwd_event_year_month, '4'); ?>
339
  value="4"><?php _e('April', 'event-calendar-wd'); ?></option>
340
- <option <?php selected($ecwd_event_year_month, '5'); ?>
341
  value="5"><?php _e('May', 'event-calendar-wd'); ?></option>
342
- <option <?php selected($ecwd_event_year_month, '6'); ?>
343
  value="6"><?php _e('June', 'event-calendar-wd'); ?></option>
344
- <option <?php selected($ecwd_event_year_month, '7'); ?>
345
  value="7"><?php _e('July', 'event-calendar-wd'); ?></option>
346
- <option <?php selected($ecwd_event_year_month, '8'); ?>
347
  value="8"><?php _e('August', 'event-calendar-wd'); ?></option>
348
- <option <?php selected($ecwd_event_year_month, '9'); ?>
349
  value="9"><?php _e('September', 'event-calendar-wd'); ?></option>
350
- <option <?php selected($ecwd_event_year_month, '10'); ?>
351
  value="10"><?php _e('October', 'event-calendar-wd'); ?></option>
352
- <option <?php selected($ecwd_event_year_month, '11'); ?>
353
  value="11"><?php _e('November', 'event-calendar-wd'); ?></option>
354
- <option <?php selected($ecwd_event_year_month, '12'); ?>
355
  value="12"><?php _e('December', 'event-calendar-wd'); ?></option>
356
  </select>
357
 
358
  <div class="ecwd_event_repeat_event_div">
359
- <input type='radio' value="1" <?php checked($ecwd_event_repeat_year_on_days, '1') ?>
360
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days"
361
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days_1"
362
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_choose"/>
@@ -368,11 +340,10 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
368
  <!-- class='-->
369
  <?php //echo ECWD_PLUGIN_PREFIX; ?><!--_event_repeat_on_the'-->
370
  <!-- value="-->
371
- <?php //echo $ecwd_event_repeat_on_the_m; ?><!--"/>-->
372
  </div>
373
 
374
  <div class="ecwd_event_repeat_event_div">
375
- <input type='radio' value="2" <?php checked($ecwd_event_repeat_year_on_days, '2') ?>
376
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days"
377
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days_2"
378
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_list_radio"/>
@@ -381,32 +352,32 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
381
  for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days_2"><?php _e('On the: ', 'event-calendar-wd'); ?></label>
382
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_monthly_list_yearly"
383
  class="select_to_enable_disable">
384
- <option <?php selected($ecwd_monthly_list_yearly, 'first'); ?>
385
  value="first"> <?php _e('First', 'event-calendar-wd'); ?> </option>
386
- <option <?php selected($ecwd_monthly_list_yearly, 'second'); ?>
387
  value="second"><?php _e('Second', 'event-calendar-wd'); ?></option>
388
- <option <?php selected($ecwd_monthly_list_yearly, 'third'); ?>
389
  value="third"><?php _e('Third', 'event-calendar-wd'); ?></option>
390
- <option <?php selected($ecwd_monthly_list_yearly, 'fourth'); ?>
391
  value="fourth"><?php _e('Fourth', 'event-calendar-wd'); ?></option>
392
- <option <?php selected($ecwd_monthly_list_yearly, 'last'); ?>
393
  value="last"><?php _e('Last', 'event-calendar-wd'); ?></option>
394
  </select>
395
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_monthly_week_yearly"
396
  class="select_to_enable_disable">
397
- <option <?php selected($ecwd_monthly_week_yearly, 'monday'); ?>
398
  value="monday"><?php _e('Monday', 'event-calendar-wd'); ?></option>
399
- <option <?php selected($ecwd_monthly_week_yearly, 'tuesday'); ?>
400
  value="tuesday"><?php _e('Tuesday', 'event-calendar-wd'); ?></option>
401
- <option <?php selected($ecwd_monthly_week_yearly, 'wednesday'); ?>
402
  value="wednesday"><?php _e('Wednesday', 'event-calendar-wd'); ?></option>
403
- <option <?php selected($ecwd_monthly_week_yearly, 'thursday'); ?>
404
  value="thursday"><?php _e('Thursday', 'event-calendar-wd'); ?></option>
405
- <option <?php selected($ecwd_monthly_week_yearly, 'friday'); ?>
406
  value="friday"><?php _e('Friday', 'event-calendar-wd'); ?></option>
407
- <option <?php selected($ecwd_monthly_week_yearly, 'saturday'); ?>
408
  value="saturday"><?php _e('Saturday', 'event-calendar-wd'); ?></option>
409
- <option <?php selected($ecwd_monthly_week_yearly, 'sunday'); ?>
410
  value="sunday"><?php _e('Sunday', 'event-calendar-wd'); ?></option>
411
  </select>
412
  </div>
@@ -420,7 +391,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
420
  <label class="repeat_format"><?php _e('Repeat until', 'event-calendar-wd'); ?></label>
421
  <input id='<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_until_input' type="text"
422
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_repeat_until"
423
- value="<?php echo $ecwd_event_repeat_repeat_until; ?>"/>
424
  </div>
425
  </p>
426
  </div>
@@ -449,7 +420,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
449
  <tr>
450
  <th scope="row"><?php _e('Event URL', 'event-calendar-wd'); ?></th>
451
  <td>
452
- <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_url" value="<?php echo $ecwd_event_url; ?>"
453
  size="70">
454
 
455
  <p class="description">
@@ -461,7 +432,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
461
  <th scope="row"><?php _e('Event Video URL', 'event-calendar-wd'); ?></th>
462
  <td>
463
  <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_video"
464
- value="<?php echo $ecwd_event_video; ?>" size="70">
465
 
466
  <p class="description">
467
  <?php _e('Provide Youtube or Vimeo URL of the video to accompany the event.', 'event-calendar-wd'); ?>
4
  */
5
  global $post, $ecwd_options;
6
  $post_id = $post->ID;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
+ $single_event = $this->single_event_for_metas;
 
 
 
 
9
 
10
+ $start_date = $end_date = "";
11
+ if($single_event->get_is_default_dates() === false){
12
+ $start_date = $single_event->get_start_date();
13
+ $end_date = $single_event->get_end_date();
14
  }
 
 
 
 
 
 
15
 
 
 
 
 
16
  ?>
17
 
18
 
24
  <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date_from"
25
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date_from"
26
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date"
27
+ value="<?php echo $start_date; ?>"/>
28
  <!-- <p class="description">
29
  </p>-->
30
  <?php _e('To', 'event-calendar-wd'); ?>
31
  <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date_to"
32
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date_to"
33
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_date"
34
+ value="<?php echo $end_date; ?>"/>
35
 
36
  <!-- <div id="-->
37
  <?php //echo ECWD_PLUGIN_PREFIX; ?><!--_event_pickup_date" class="button" value="">Days</div>-->
39
  <?php //echo ECWD_PLUGIN_PREFIX; ?><!--_event_pickup_time" class="button" value="">Time</div>-->
40
  <div class="checkbox-div">
41
  <input type='checkbox' class='ecwd_all_day_event' id='ecwd_all_day_event'
42
+ name='ecwd_all_day_event' value="1" <?php checked($single_event->get_all_day(), true); ?>/>
43
  <label for="ecwd_all_day_event"></label>
44
  </div>
45
  <label for="ecwd_all_day_event"><?php _e('All day', 'event-calendar-wd'); ?></label>
68
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio"
69
  type="radio"
70
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
71
+ value="no_repeat" <?php checked($single_event->repeat['ecwd_event_repeat_event'], 'no_repeat') ?>/>
72
  <?php _e('Don\'t repeat', 'event-calendar-wd'); ?>
73
  </label>
74
  </p>
78
  <label>
79
  <input class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio" type="radio"
80
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
81
+ value="daily" <?php checked($single_event->repeat['ecwd_event_repeat_event'], 'daily') ?>/>
82
  <?php _e('Daily', 'event-calendar-wd'); ?>
83
  </label>
84
 
90
  <label>
91
  <input class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio" type="radio"
92
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
93
+ value="weekly" <?php checked($single_event->repeat['ecwd_event_repeat_event'], 'weekly') ?>/>
94
  <?php _e('Weekly', 'event-calendar-wd'); ?>
95
  </label>
96
 
105
  <input class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio"
106
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_repeat_event_monthly" type="radio"
107
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
108
+ value="monthly" <?php checked($single_event->repeat['ecwd_event_repeat_event'], 'monthly') ?> />
109
  <?php _e('Monthly', 'event-calendar-wd'); ?>
110
  </label>
111
 
118
  <label>
119
  <input class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event_radio" type="radio"
120
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_event"
121
+ value="yearly" <?php checked($single_event->repeat['ecwd_event_repeat_event'], 'yearly') ?>/>
122
  <?php _e('Yearly', 'event-calendar-wd'); ?>
123
  </label>
124
  </div>
127
  <div id="ecwd_daily" class="hidden">
128
  <label class="repeat_format"><?php _e('Repeat every', 'event-calendar-wd'); ?></label>
129
  <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_how"
130
+ value="<?php echo $single_event->repeat['ecwd_event_repeat_how']; ?>"/>
131
 
132
  <span id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_how_label_daily"
133
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_how_label hidden">
156
  <div class="checkbox-div">
157
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
158
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_monday"
159
+ value='monday' <?php if (in_array('monday', $single_event->repeat['ecwd_event_day'])) {
160
  echo 'checked="checked"';
161
  } ?> />
162
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_monday"></label>
168
  <div class="checkbox-div">
169
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
170
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_tuesday"
171
+ value='tuesday' <?php if (in_array('tuesday', $single_event->repeat['ecwd_event_day'])) {
172
  echo 'checked="checked"';
173
  } ?> />
174
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_tuesday"></label>
181
  <div class="checkbox-div">
182
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
183
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_wednesday"
184
+ value='wednesday' <?php if (in_array('wednesday', $single_event->repeat['ecwd_event_day'])) {
185
  echo 'checked="checked"';
186
  } ?> />
187
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_wednesday"></label>
193
  <div class="checkbox-div">
194
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
195
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_thursday"
196
+ value='thursday' <?php if (in_array('thursday', $single_event->repeat['ecwd_event_day'])) {
197
  echo 'checked="checked"';
198
  } ?> />
199
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_thursday"></label>
205
  <div class="checkbox-div">
206
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
207
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_friday"
208
+ value='friday' <?php if (in_array('friday', $single_event->repeat['ecwd_event_day'])) {
209
  echo 'checked="checked"';
210
  } ?> />
211
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_friday"></label>
217
  <div class="checkbox-div">
218
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
219
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_saturday"
220
+ value='saturday' <?php if (in_array('saturday', $single_event->repeat['ecwd_event_day'])) {
221
  echo 'checked="checked"';
222
  } ?> />
223
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_saturday"></label>
229
  <div class="checkbox-div">
230
  <input type='checkbox' name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_day[]"
231
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_sunday"
232
+ value='sunday' <?php if (in_array('sunday', $single_event->repeat['ecwd_event_day'])) {
233
  echo 'checked="checked"';
234
  } ?> />
235
  <label for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_sunday"></label>
243
  <div>
244
 
245
 
246
+ <input type='radio' value="1" <?php checked($single_event->repeat['ecwd_event_repeat_month_on_days'], '1') ?>
247
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days"
248
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days_1"
249
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_choose"/>
254
  <!-- class='-->
255
  <?php //echo ECWD_PLUGIN_PREFIX; ?><!--_event_repeat_on_the'-->
256
  <!-- value="-->
 
257
  </div>
258
 
259
  <div class="ecwd_event_repeat_event_div">
260
 
261
+ <input type='radio' value="2" <?php checked($single_event->repeat['ecwd_event_repeat_month_on_days'], '2') ?>
262
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days"
263
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days_2"
264
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_list_radio"/>
267
  for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_month_on_days_2"><?php _e('On the: ', 'event-calendar-wd'); ?></label>
268
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_monthly_list_monthly"
269
  class="select_to_enable_disable">
270
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_monthly'], 'first'); ?>
271
  value="first"><?php _e('First', 'event-calendar-wd'); ?> </option>
272
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_monthly'], 'second'); ?>
273
  value="second"><?php _e('Second', 'event-calendar-wd'); ?></option>
274
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_monthly'], 'third'); ?>
275
  value="third"><?php _e('Third', 'event-calendar-wd'); ?></option>
276
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_monthly'], 'fourth'); ?>
277
  value="fourth"><?php _e('Fourth', 'event-calendar-wd'); ?></option>
278
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_monthly'], 'last'); ?>
279
  value="last"><?php _e('Last', 'event-calendar-wd'); ?></option>
280
  </select>
281
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_monthly_week_monthly"
282
  class="select_to_enable_disable">
283
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_monthly'], 'monday'); ?>
284
  value="monday"><?php _e('Monday', 'event-calendar-wd'); ?></option>
285
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_monthly'], 'tuesday'); ?>
286
  value="tuesday"><?php _e('Tuesday', 'event-calendar-wd'); ?></option>
287
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_monthly'], 'wednesday'); ?>
288
  value="wednesday"><?php _e('Wednesday', 'event-calendar-wd'); ?></option>
289
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_monthly'], 'thursday'); ?>
290
  value="thursday"><?php _e('Thursday', 'event-calendar-wd'); ?></option>
291
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_monthly'], 'friday'); ?>
292
  value="friday"><?php _e('Friday', 'event-calendar-wd'); ?></option>
293
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_monthly'], 'saturday'); ?>
294
  value="saturday"><?php _e('Saturday', 'event-calendar-wd'); ?></option>
295
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_monthly'], 'sunday'); ?>
296
  value="sunday"><?php _e('Sunday', 'event-calendar-wd'); ?></option>
297
  </select>
298
  </div>
301
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_year_month"
302
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_year_month" disabled="disabled"
303
  class="select_to_enable_disable">
304
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '1'); ?>
305
  value="1"><?php _e('January', 'event-calendar-wd'); ?></option>
306
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '2'); ?>
307
  value="2"><?php _e('February', 'event-calendar-wd'); ?></option>
308
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '3'); ?>
309
  value="3"><?php _e('March', 'event-calendar-wd'); ?></option>
310
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '4'); ?>
311
  value="4"><?php _e('April', 'event-calendar-wd'); ?></option>
312
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '5'); ?>
313
  value="5"><?php _e('May', 'event-calendar-wd'); ?></option>
314
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '6'); ?>
315
  value="6"><?php _e('June', 'event-calendar-wd'); ?></option>
316
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '7'); ?>
317
  value="7"><?php _e('July', 'event-calendar-wd'); ?></option>
318
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '8'); ?>
319
  value="8"><?php _e('August', 'event-calendar-wd'); ?></option>
320
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '9'); ?>
321
  value="9"><?php _e('September', 'event-calendar-wd'); ?></option>
322
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '10'); ?>
323
  value="10"><?php _e('October', 'event-calendar-wd'); ?></option>
324
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '11'); ?>
325
  value="11"><?php _e('November', 'event-calendar-wd'); ?></option>
326
+ <option <?php selected($single_event->repeat['ecwd_event_year_month'], '12'); ?>
327
  value="12"><?php _e('December', 'event-calendar-wd'); ?></option>
328
  </select>
329
 
330
  <div class="ecwd_event_repeat_event_div">
331
+ <input type='radio' value="1" <?php checked($single_event->repeat['ecwd_event_repeat_year_on_days'], '1') ?>
332
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days"
333
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days_1"
334
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_choose"/>
340
  <!-- class='-->
341
  <?php //echo ECWD_PLUGIN_PREFIX; ?><!--_event_repeat_on_the'-->
342
  <!-- value="-->
 
343
  </div>
344
 
345
  <div class="ecwd_event_repeat_event_div">
346
+ <input type='radio' value="2" <?php checked($single_event->repeat['ecwd_event_repeat_year_on_days'], '2') ?>
347
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days"
348
  id="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days_2"
349
  class="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_list_radio"/>
352
  for="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_year_on_days_2"><?php _e('On the: ', 'event-calendar-wd'); ?></label>
353
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_monthly_list_yearly"
354
  class="select_to_enable_disable">
355
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_yearly'], 'first'); ?>
356
  value="first"> <?php _e('First', 'event-calendar-wd'); ?> </option>
357
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_yearly'], 'second'); ?>
358
  value="second"><?php _e('Second', 'event-calendar-wd'); ?></option>
359
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_yearly'], 'third'); ?>
360
  value="third"><?php _e('Third', 'event-calendar-wd'); ?></option>
361
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_yearly'], 'fourth'); ?>
362
  value="fourth"><?php _e('Fourth', 'event-calendar-wd'); ?></option>
363
+ <option <?php selected($single_event->repeat['ecwd_monthly_list_yearly'], 'last'); ?>
364
  value="last"><?php _e('Last', 'event-calendar-wd'); ?></option>
365
  </select>
366
  <select name="<?php echo ECWD_PLUGIN_PREFIX; ?>_monthly_week_yearly"
367
  class="select_to_enable_disable">
368
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_yearly'], 'monday'); ?>
369
  value="monday"><?php _e('Monday', 'event-calendar-wd'); ?></option>
370
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_yearly'], 'tuesday'); ?>
371
  value="tuesday"><?php _e('Tuesday', 'event-calendar-wd'); ?></option>
372
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_yearly'], 'wednesday'); ?>
373
  value="wednesday"><?php _e('Wednesday', 'event-calendar-wd'); ?></option>
374
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_yearly'], 'thursday'); ?>
375
  value="thursday"><?php _e('Thursday', 'event-calendar-wd'); ?></option>
376
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_yearly'], 'friday'); ?>
377
  value="friday"><?php _e('Friday', 'event-calendar-wd'); ?></option>
378
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_yearly'], 'saturday'); ?>
379
  value="saturday"><?php _e('Saturday', 'event-calendar-wd'); ?></option>
380
+ <option <?php selected($single_event->repeat['ecwd_monthly_week_yearly'], 'sunday'); ?>
381
  value="sunday"><?php _e('Sunday', 'event-calendar-wd'); ?></option>
382
  </select>
383
  </div>
391
  <label class="repeat_format"><?php _e('Repeat until', 'event-calendar-wd'); ?></label>
392
  <input id='<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_until_input' type="text"
393
  name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_repeat_repeat_until"
394
+ value="<?php echo $single_event->repeat['ecwd_event_repeat_repeat_until']; ?>"/>
395
  </div>
396
  </p>
397
  </div>
420
  <tr>
421
  <th scope="row"><?php _e('Event URL', 'event-calendar-wd'); ?></th>
422
  <td>
423
+ <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_url" value="<?php echo $single_event->event_url; ?>"
424
  size="70">
425
 
426
  <p class="description">
432
  <th scope="row"><?php _e('Event Video URL', 'event-calendar-wd'); ?></th>
433
  <td>
434
  <input type="text" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_event_video"
435
+ value="<?php echo $single_event->video_url; ?>" size="70">
436
 
437
  <p class="description">
438
  <?php _e('Provide Youtube or Vimeo URL of the video to accompany the event.', 'event-calendar-wd'); ?>
views/admin/ecwd-event-organizers-meta.php CHANGED
@@ -4,6 +4,9 @@
4
  */
5
  global $post;
6
 
 
 
 
7
  $post_id = $post->ID;
8
  $type = ECWD_PLUGIN_PREFIX . '_organizer';
9
  $args = array(
@@ -13,7 +16,7 @@ $args = array(
13
  'ignore_sticky_posts' => 1
14
  );
15
  $organizer_posts = get_posts($args);
16
- $event_organizers = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_organizers', true);
17
  if (!$event_organizers || $event_organizers == '' || !is_array($event_organizers)) {
18
  $event_organizers = array();
19
  }
4
  */
5
  global $post;
6
 
7
+ $single_event = $this->single_event_for_metas;
8
+
9
+
10
  $post_id = $post->ID;
11
  $type = ECWD_PLUGIN_PREFIX . '_organizer';
12
  $args = array(
16
  'ignore_sticky_posts' => 1
17
  );
18
  $organizer_posts = get_posts($args);
19
+ $event_organizers = $single_event->organizers;
20
  if (!$event_organizers || $event_organizers == '' || !is_array($event_organizers)) {
21
  $event_organizers = array();
22
  }
views/admin/ecwd-event-venues-meta.php CHANGED
@@ -2,12 +2,12 @@
2
 
3
  global $post, $ecwd_options;
4
  $post_id = $post->ID;
 
5
 
6
- $ecwd_event_venue = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_venue', true);
7
- $ecwd_event_location = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_location', true);
8
- $ecwd_event_show_map = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_show_map', true);
9
- //$ecwd_map_zoom = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_map_zoom', true);
10
- $ecwd_lat_long = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_lat_long', true);
11
 
12
  $long = '';
13
  $lat = '';
2
 
3
  global $post, $ecwd_options;
4
  $post_id = $post->ID;
5
+ $single_event = $this->single_event_for_metas;
6
 
7
+ $ecwd_event_venue = ($single_event->venue !== null) ? $single_event->venue['post']->ID : "";
8
+ $ecwd_event_location = ($single_event->venue !== null) ? $single_event->venue['metas']['location'] : "";
9
+ $ecwd_event_show_map = ($single_event->venue !== null) ? $single_event->venue['metas']['show_map'] : "";
10
+ $ecwd_lat_long = ($single_event->venue !== null) ? $single_event->venue['metas']['lat_long'] : "";
 
11
 
12
  $long = '';
13
  $lat = '';
views/ecwd-event-content.php CHANGED
@@ -36,8 +36,19 @@ if (isset($ecwd_options['social_icons']) && $ecwd_options['social_icons'] != '')
36
 
37
  $ecwd_event = $post;
38
  $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
39
- $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0];
40
- $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0];
 
 
 
 
 
 
 
 
 
 
 
41
  if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'])) {
42
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
43
  }
@@ -172,7 +183,7 @@ if (!empty($calendars_id)) {
172
  </span>
173
  </div>
174
  <?php
175
- if (isset($ecwd_options['show_repeat_rate'])) {
176
  $repeat_rate_text = $d->get_repeat_rate($post_id, '', $date_format);
177
  if ($repeat_rate_text != ''): ?>
178
  <div class="ecwd_repeat_rate_text">
36
 
37
  $ecwd_event = $post;
38
  $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
39
+ if(isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0])) {
40
+ $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0];
41
+ $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0];
42
+
43
+ $is_default_dates = false;
44
+ }else{
45
+ $today = date('Y-m-d H:i');
46
+
47
+ $ecwd_event_date_from = date('Y/m/d H:i', strtotime($today . "+1 days"));
48
+ $ecwd_event_date_to = date('Y/m/d H:i', strtotime($ecwd_event_date_from . "+1 hour"));
49
+
50
+ $is_default_dates = true;
51
+ }
52
  if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'])) {
53
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
54
  }
183
  </span>
184
  </div>
185
  <?php
186
+ if (isset($ecwd_options['show_repeat_rate']) && !$is_default_dates) {
187
  $repeat_rate_text = $d->get_repeat_rate($post_id, '', $date_format);
188
  if ($repeat_rate_text != ''): ?>
189
  <div class="ecwd_repeat_rate_text">
views/ecwd-event-popup.php CHANGED
@@ -36,8 +36,19 @@ if (isset($ecwd_options['social_icons']) && $ecwd_options['social_icons'] != '')
36
 
37
  $ecwd_event = $post;
38
  $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
39
- $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0];
40
- $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0];
 
 
 
 
 
 
 
 
 
 
 
41
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
42
  if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) {
43
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => '');
@@ -165,7 +176,7 @@ $event_categories = wp_get_post_terms($post->ID, 'ecwd_event_category', $args);
165
  <?php echo ECWD::get_ecwd_event_date_view($ecwd_event_date_from, $ecwd_event_date_to, $ecwd_all_day_event); ?>
166
  </span>
167
  </div>
168
- <?php if (isset($ecwd_options['show_repeat_rate'])) { ?>
169
  <div class="ecwd_repeat_rate_text">
170
  <span><?php echo $d->get_repeat_rate($post_id, '', $date_format); ?></span>
171
  </div>
36
 
37
  $ecwd_event = $post;
38
  $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
39
+ if(isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0])) {
40
+ $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0];
41
+ $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0];
42
+
43
+ $is_default_dates = false;
44
+ }else{
45
+ $today = date('Y-m-d H:i');
46
+
47
+ $ecwd_event_date_from = date('Y/m/d H:i', strtotime($today . "+1 days"));
48
+ $ecwd_event_date_to = date('Y/m/d H:i', strtotime($ecwd_event_date_from . "+1 hour"));
49
+
50
+ $is_default_dates = true;
51
+ }
52
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
53
  if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) {
54
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => '');
176
  <?php echo ECWD::get_ecwd_event_date_view($ecwd_event_date_from, $ecwd_event_date_to, $ecwd_all_day_event); ?>
177
  </span>
178
  </div>
179
+ <?php if (isset($ecwd_options['show_repeat_rate']) && !$is_default_dates) { ?>
180
  <div class="ecwd_repeat_rate_text">
181
  <span><?php echo $d->get_repeat_rate($post_id, '', $date_format); ?></span>
182
  </div>
views/single-event.php CHANGED
@@ -36,8 +36,21 @@ if (isset($ecwd_options['social_icons']) && $ecwd_options['social_icons'] != '')
36
 
37
  $ecwd_event = $post;
38
  $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
39
- $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0];
40
- $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0];
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'])) {
42
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
43
  }
@@ -193,7 +206,7 @@ if ( class_exists( 'WooCommerce' ) ) {
193
  </div>
194
 
195
  <?php
196
- if (isset($ecwd_options['show_repeat_rate'])) {
197
  $repeat_rate_text = $d->get_repeat_rate($post_id, '', $date_format);
198
  if ($repeat_rate_text != ''):
199
  ?>
36
 
37
  $ecwd_event = $post;
38
  $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
39
+
40
+ if(isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0])) {
41
+ $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0];
42
+ $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0];
43
+
44
+ $is_default_dates = false;
45
+ }else{
46
+ $today = date('Y-m-d H:i');
47
+
48
+ $ecwd_event_date_from = date('Y/m/d H:i', strtotime($today . "+1 days"));
49
+ $ecwd_event_date_to = date('Y/m/d H:i', strtotime($ecwd_event_date_from . "+1 hour"));
50
+
51
+ $is_default_dates = true;
52
+ }
53
+
54
  if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'])) {
55
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
56
  }
206
  </div>
207
 
208
  <?php
209
+ if (isset($ecwd_options['show_repeat_rate']) && !$is_default_dates) {
210
  $repeat_rate_text = $d->get_repeat_rate($post_id, '', $date_format);
211
  if ($repeat_rate_text != ''):
212
  ?>