Event Calendar WD – Responsive Event Calendar plugin - Version 1.1.0

Version Description

  • Changed: Improved UI of venue editor in event page
  • Fixed: Displayed date and time for one day event
  • Fixed: Fatal error if PHP Calendar module not loaded
  • Fixed: Add new venue from event editor page
Download this release

Release Info

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

Code changes from version 1.0.97 to 1.1.0

css/admin/admin.css CHANGED
@@ -358,6 +358,7 @@ span.ecwd_error {
358
 
359
  #ecwd_event_location{
360
  background-image: none !important;
 
361
  }
362
 
363
  .ecwd-admin-fields input[type="text"]:not(#ecwd_event_location),
@@ -368,7 +369,8 @@ span.ecwd_error {
368
  #ecwd_calendar_meta input[type="text"]:not(.ecwd-search),
369
  #ecwd_calendar_meta select,
370
  #ecwd_event_meta input[type="text"]:not(#ecwd_event_date_from):not(#ecwd_event_date_to):not(#ecwd_event_location),
371
- #ecwd_event_meta select,
 
372
  #ecwd_event_meta #ecwd_event_year_month,
373
  #ecwd-settings .form-field input, #ecwd-settings input.regular-text {
374
  width: 250px;
@@ -381,6 +383,7 @@ span.ecwd_error {
381
 
382
  #ecwd-settings input[type="checkbox"],
383
  #ecwd_event_meta input[type="checkbox"],
 
384
  #ecwd-settings input[type="radio"] {
385
  position: absolute;
386
  z-index: -1;
@@ -390,9 +393,14 @@ span.ecwd_error {
390
  min-width: 5px !important;
391
  }
392
 
 
 
 
 
393
  #ecwd_venue_meta .checkbox-div,
394
  #ecwd-settings .checkbox-div,
395
- #ecwd_event_meta .checkbox-div {
 
396
  width: 13px;
397
  height: 12px;
398
  background: #FDFDFD;
@@ -429,6 +437,13 @@ span.ecwd_error {
429
  padding: 8px 0;
430
  }
431
 
 
 
 
 
 
 
 
432
  .ecwd-hide-map {
433
  width: 100%;
434
  position: absolute;
@@ -445,6 +460,7 @@ span.ecwd_error {
445
 
446
  #ecwd-settings .checkbox-div input[type="checkbox"]:checked + label,
447
  #ecwd_event_meta .checkbox-div input[type="checkbox"]:checked + label,
 
448
  #ecwd-settings .checkbox-div input[type="radio"]:checked + label {
449
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
450
  filter: alpha(opacity=100);
@@ -466,6 +482,7 @@ span.ecwd_error {
466
  }
467
 
468
  #ecwd_event_meta .checkbox-div label,
 
469
  #ecwd-settings .checkbox-div label {
470
  cursor: pointer;
471
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
@@ -532,7 +549,8 @@ span.ecwd_error {
532
  margin: 10px 0;
533
  }
534
 
535
- #ecwd_event_meta .select_to_enable_disable {
 
536
  width: 122px !important;
537
  }
538
 
@@ -543,21 +561,34 @@ span.ecwd_error {
543
  #ecwd_event_organizers_meta .ecwd-organizers-list {
544
  margin-top: 15px;
545
  max-height: 250px;
546
- overflow-y: scroll;
547
  overflow-x: auto;
548
  }
549
 
550
  #ecwd_event_organizers_meta .ecwd-add-organizer-form input,
551
  #ecwd_event_meta .ecwd-venue-meta-fields #ecwd_venue_content,
 
 
552
  #ecwd_event_organizers_meta .ecwd-add-organizer-form textarea {
553
  width: 250px;
554
  }
555
 
556
  #ecwd_event_organizers_meta .ecwd-add-organizer-form #ecwd-add-organizer-content,
557
- #ecwd_event_meta .ecwd-venue-meta-fields #ecwd_venue_content{
 
 
 
558
  height: 100px;
559
  }
560
 
 
 
 
 
 
 
 
 
561
  #ecwd_event_organizers_meta .ecwd-add-organizer-form > div {
562
  margin-top: 5px;
563
  }
@@ -571,7 +602,8 @@ span.ecwd_error {
571
  font-size: 15px;
572
  }
573
 
574
- #ecwd_event_meta .ecwd-venue-meta-fields .ecwd-meta-field > label{
 
575
  display:inline-block;
576
  width: 150px;
577
  font-weight: normal;
358
 
359
  #ecwd_event_location{
360
  background-image: none !important;
361
+ width: 100%;
362
  }
363
 
364
  .ecwd-admin-fields input[type="text"]:not(#ecwd_event_location),
369
  #ecwd_calendar_meta input[type="text"]:not(.ecwd-search),
370
  #ecwd_calendar_meta select,
371
  #ecwd_event_meta input[type="text"]:not(#ecwd_event_date_from):not(#ecwd_event_date_to):not(#ecwd_event_location),
372
+ #ecwd_event_venue_meta input[type="text"]:not(#ecwd_event_date_from):not(#ecwd_event_date_to):not(#ecwd_event_location),
373
+ #ecwd_event_venue_meta select,
374
  #ecwd_event_meta #ecwd_event_year_month,
375
  #ecwd-settings .form-field input, #ecwd-settings input.regular-text {
376
  width: 250px;
383
 
384
  #ecwd-settings input[type="checkbox"],
385
  #ecwd_event_meta input[type="checkbox"],
386
+ #ecwd_event_venue_meta input[type="checkbox"],
387
  #ecwd-settings input[type="radio"] {
388
  position: absolute;
389
  z-index: -1;
393
  min-width: 5px !important;
394
  }
395
 
396
+ .ecwd_venue_show_map_checkbox_container .checkbox-div{
397
+ margin-left: 0px !important;
398
+ }
399
+
400
  #ecwd_venue_meta .checkbox-div,
401
  #ecwd-settings .checkbox-div,
402
+ #ecwd_event_meta .checkbox-div,
403
+ #ecwd_event_venue_meta .checkbox-div {
404
  width: 13px;
405
  height: 12px;
406
  background: #FDFDFD;
437
  padding: 8px 0;
438
  }
439
 
440
+ .ecwd-hide-map-td{
441
+ padding: 0 !important;
442
+ opacity: 0 !important;
443
+ height: 0px !important;
444
+ cursor: default;
445
+ }
446
+
447
  .ecwd-hide-map {
448
  width: 100%;
449
  position: absolute;
460
 
461
  #ecwd-settings .checkbox-div input[type="checkbox"]:checked + label,
462
  #ecwd_event_meta .checkbox-div input[type="checkbox"]:checked + label,
463
+ #ecwd_event_venue_meta .checkbox-div input[type="checkbox"]:checked + label,
464
  #ecwd-settings .checkbox-div input[type="radio"]:checked + label {
465
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
466
  filter: alpha(opacity=100);
482
  }
483
 
484
  #ecwd_event_meta .checkbox-div label,
485
+ #ecwd_event_venue_meta .checkbox-div label,
486
  #ecwd-settings .checkbox-div label {
487
  cursor: pointer;
488
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
549
  margin: 10px 0;
550
  }
551
 
552
+ #ecwd_event_meta .select_to_enable_disable,
553
+ #ecwd_event_venue_meta .select_to_enable_disable {
554
  width: 122px !important;
555
  }
556
 
561
  #ecwd_event_organizers_meta .ecwd-organizers-list {
562
  margin-top: 15px;
563
  max-height: 250px;
564
+ overflow-y: auto;
565
  overflow-x: auto;
566
  }
567
 
568
  #ecwd_event_organizers_meta .ecwd-add-organizer-form input,
569
  #ecwd_event_meta .ecwd-venue-meta-fields #ecwd_venue_content,
570
+ #ecwd_event_venue_meta .ecwd-venue-meta-fields #ecwd_venue_content,
571
+ #ecwd_event_venue_meta .ecwd_event_venue_form_content .ecwd_event_venue_content_field,
572
  #ecwd_event_organizers_meta .ecwd-add-organizer-form textarea {
573
  width: 250px;
574
  }
575
 
576
  #ecwd_event_organizers_meta .ecwd-add-organizer-form #ecwd-add-organizer-content,
577
+ #ecwd_event_venue_meta .ecwd_event_venue_form_content .ecwd_event_venue_content_field,
578
+ #ecwd_event_meta .ecwd-venue-meta-fields #ecwd_venue_content,
579
+ #ecwd_event_venue_meta .ecwd_event_venue_form_content .ecwd_event_venue_content_field,
580
+ #ecwd_event_venue_meta .ecwd-venue-meta-fields #ecwd_venue_content{
581
  height: 100px;
582
  }
583
 
584
+ .ecwd_event_venue_add_button_container th button,
585
+ .ecwd_event_venue_add_button_container .spinner,
586
+ .ecwd-organizer-meta-fields .ecwd-add-organizer-save,
587
+ .ecwd-organizer-meta-fields .spinner{
588
+ float: left;
589
+ }
590
+
591
+
592
  #ecwd_event_organizers_meta .ecwd-add-organizer-form > div {
593
  margin-top: 5px;
594
  }
602
  font-size: 15px;
603
  }
604
 
605
+ #ecwd_event_meta .ecwd-venue-meta-fields .ecwd-meta-field > label,
606
+ #ecwd_event_venue_meta .ecwd-venue-meta-fields .ecwd-meta-field > label{
607
  display:inline-block;
608
  width: 150px;
609
  font-weight: normal;
ecwd.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Plugin Name: Event Calendar WD
4
- * Plugin URI: https://web-dorado.com/products/wordpress-event-calendar-wd.html
5
  * Description: Event Calendar WD is an easy event management and planning tool with advanced features.
6
- * Version: 1.0.97
7
  * Author: WebDorado
8
- * Author URI: http://web-dorado.com
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
11
 
@@ -24,7 +24,7 @@ if (!defined('ECWD_URL')) {
24
  }
25
 
26
  if (!defined('ECWD_VERSION')) {
27
- define('ECWD_VERSION', "1.0.97");
28
  }
29
 
30
  if (!defined('ECWD_PLUGIN_MAIN_FILE')) {
1
  <?php
2
  /**
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.0
7
  * Author: WebDorado
8
+ * Author URI: https://web-dorado.com
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
11
 
24
  }
25
 
26
  if (!defined('ECWD_VERSION')) {
27
+ define('ECWD_VERSION', "1.1.0");
28
  }
29
 
30
  if (!defined('ECWD_PLUGIN_MAIN_FILE')) {
ecwd_admin_class.php CHANGED
@@ -6,7 +6,7 @@
6
  class ECWD_Admin {
7
 
8
  protected static $instance = null;
9
- protected $version = '1.0.97';
10
  protected $ecwd_page = null;
11
  protected $notices = null;
12
  protected static $default_shortcode = '[ecwd id="%s" type="full" page_items="5" event_search="yes" display="full" displays="full,list,week,day" filters=""]';
@@ -635,6 +635,20 @@ class ECWD_Admin {
635
  die(json_encode($response));
636
  }
637
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
638
  $post_args = array();
639
 
640
  $post_args['post_title'] = (!empty($post_data['title'])) ? sanitize_text_field($post_data['title']) : "";
6
  class ECWD_Admin {
7
 
8
  protected static $instance = null;
9
+ protected $version = '1.1.0';
10
  protected $ecwd_page = null;
11
  protected $notices = null;
12
  protected static $default_shortcode = '[ecwd id="%s" type="full" page_items="5" event_search="yes" display="full" displays="full,list,week,day" filters=""]';
635
  die(json_encode($response));
636
  }
637
 
638
+ if ($post_data['post_type'] == 'ecwd_venue') {
639
+ $venue_data = ECWD_Cpt::add_new_venue($post_data);
640
+
641
+ if ($venue_data['id'] == 0) {
642
+ die(json_encode($response));
643
+ }
644
+
645
+ $response['venue_data'] = $venue_data;
646
+ $response['venue_data']['edit_link'] = 'post.php?post=' . $venue_data['id'] . '&action=edit';
647
+ $response['success'] = true;
648
+ die(json_encode($response));
649
+ }
650
+
651
+
652
  $post_args = array();
653
 
654
  $post_args['post_title'] = (!empty($post_data['title'])) ? sanitize_text_field($post_data['title']) : "";
ecwd_class.php CHANGED
@@ -6,7 +6,7 @@
6
  */
7
  class ECWD {
8
 
9
- protected $version = '1.0.97';
10
  protected $plugin_name = 'event-calendar-wd';
11
  protected $prefix = 'ecwd';
12
  protected static $instance = null;
@@ -289,6 +289,57 @@ class ECWD {
289
  return $url;
290
  }
291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  /**
294
  * Return an instance of this class.
6
  */
7
  class ECWD {
8
 
9
+ protected $version = '1.1.0';
10
  protected $plugin_name = 'event-calendar-wd';
11
  protected $prefix = 'ecwd';
12
  protected static $instance = null;
289
  return $url;
290
  }
291
 
292
+ public static function get_ecwd_event_date_view($ecwd_event_date_from, $ecwd_event_date_to, $ecwd_all_day_event) {
293
+ global $ecwd_options;
294
+
295
+ $date_format = 'Y-m-d';
296
+ $time_format = 'H:i';
297
+ if (isset($ecwd_options['date_format']) && $ecwd_options['date_format'] != '') {
298
+ $date_format = $ecwd_options['date_format'];
299
+ }
300
+ if (isset($ecwd_options['time_format']) && $ecwd_options['time_format'] != '') {
301
+ $time_format = $ecwd_options['time_format'];
302
+ }
303
+ $time_format .= (isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : '');
304
+ if (isset($ecwd_options['time_type']) && $ecwd_options['time_type'] != '') {
305
+ $time_format = str_replace('H', 'g', $time_format);
306
+ $time_format = str_replace('h', 'g', $time_format);
307
+ }
308
+
309
+ $html = '';
310
+
311
+ if ($ecwd_all_day_event == 1) {
312
+ $html .= date($date_format, strtotime($ecwd_event_date_from));
313
+
314
+ if ($ecwd_event_date_to && date($date_format, strtotime($ecwd_event_date_from)) !== date($date_format, strtotime($ecwd_event_date_to))) {
315
+ $html .= ' - ' . date($date_format, strtotime($ecwd_event_date_to));
316
+ }
317
+ $html .= ' ' . __('All day', 'ecwd');
318
+
319
+ return $html;
320
+ }
321
+
322
+
323
+ $ecwd_event_date_from_sec = strtotime($ecwd_event_date_from);
324
+ $ecwd_event_date_to_sec = strtotime($ecwd_event_date_to);
325
+
326
+ $ecwd_event_date_from_date = date($date_format, $ecwd_event_date_from_sec);
327
+ $ecwd_event_date_to_date = date($date_format, $ecwd_event_date_to_sec);
328
+
329
+ $ecwd_event_date_from_time = date($time_format, $ecwd_event_date_from_sec);
330
+ $ecwd_event_date_to_time = date($time_format, $ecwd_event_date_to_sec);
331
+
332
+
333
+ if ($ecwd_event_date_from_date == $ecwd_event_date_to_date) {
334
+ $html .= $ecwd_event_date_from_date . ' <span style="width:5px;"></span> ' . $ecwd_event_date_from_time . ' - ' . $ecwd_event_date_to_time;
335
+ } else {
336
+ $html .= $ecwd_event_date_from_date . ' ' . $ecwd_event_date_from_time . ' - ';
337
+ $html .= $ecwd_event_date_to_date . ' ' . $ecwd_event_date_to_time;
338
+ }
339
+
340
+ return $html;
341
+ }
342
+
343
 
344
  /**
345
  * Return an instance of this class.
includes/ecwd-cpt-class.php CHANGED
@@ -629,7 +629,7 @@ class ECWD_Cpt {
629
  add_meta_box(ECWD_PLUGIN_PREFIX . '_calendar_meta', __('Calendar Settings', 'ecwd'), array(
630
  $this,
631
  'display_calendars_meta'
632
- ), ECWD_PLUGIN_PREFIX . '_calendar', 'advanced', 'core');
633
  }
634
 
635
  /**
@@ -692,20 +692,25 @@ class ECWD_Cpt {
692
  * Add Events post meta
693
  */
694
  public function events_cpt_meta($screen = null, $context = 'advanced') {
695
- add_meta_box(ECWD_PLUGIN_PREFIX . '_event_meta', __('Event Settings', 'ecwd'), array(
696
  $this,
697
  'display_events_meta'
698
- ), ECWD_PLUGIN_PREFIX . '_event', 'advanced', 'core');
699
 
700
  add_meta_box(ECWD_PLUGIN_PREFIX . '_event_calendars_meta', __('Calendars', 'ecwd'), array(
701
  $this,
702
  'display_events_calendars_meta'
703
- ), ECWD_PLUGIN_PREFIX . '_event', 'advanced', 'core');
 
 
 
 
 
704
 
705
  add_meta_box(ECWD_PLUGIN_PREFIX . '_event_organizers_meta', __('Organizers', 'ecwd'), array(
706
  $this,
707
  'display_events_organizers_meta'
708
- ), ECWD_PLUGIN_PREFIX . '_event', 'advanced', 'core');
709
 
710
  if (current_theme_supports('post-thumbnails', 'post') && post_type_supports('post', 'thumbnail')) {
711
  add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
@@ -716,17 +721,7 @@ class ECWD_Cpt {
716
  * Display Events post meta
717
  */
718
  public function display_events_meta() {
719
- $ip_addr = $_SERVER['REMOTE_ADDR'];
720
- $long = '';
721
- $lat = '';
722
  $is_ = $this->is();
723
- $args = array(
724
- 'post_type' => ECWD_PLUGIN_PREFIX . '_venue',
725
- 'post_status' => 'publish',
726
- 'posts_per_page' => - 1,
727
- 'ignore_sticky_posts' => 1
728
- );
729
- $venues = get_posts($args);
730
  include_once( ECWD_DIR . '/views/admin/ecwd-event-meta.php' );
731
  }
732
 
@@ -737,6 +732,10 @@ class ECWD_Cpt {
737
  include_once( ECWD_DIR . '/views/admin/ecwd-event-calendars-meta.php' );
738
  }
739
 
 
 
 
 
740
  public function display_events_organizers_meta() {
741
  include_once( ECWD_DIR . '/views/admin/ecwd-event-organizers-meta.php' );
742
  }
@@ -748,7 +747,7 @@ class ECWD_Cpt {
748
  add_meta_box(ECWD_PLUGIN_PREFIX . '_theme_meta', __('Calendar Theme Settings', 'ecwd'), array(
749
  $this,
750
  'display_theme_meta'
751
- ), ECWD_PLUGIN_PREFIX . '_theme', 'advanced', 'core');
752
  }
753
 
754
  /**
@@ -850,11 +849,11 @@ class ECWD_Cpt {
850
 
851
  add_meta_box(
852
  ECWD_PLUGIN_PREFIX . '_venue_meta',
853
- __('Venue Location', 'ecwd'),
854
  array($this, 'display_venue_meta'),
855
  ECWD_PLUGIN_PREFIX . '_venue',
856
- 'advanced',
857
- 'core'
858
  );
859
 
860
  }
@@ -863,11 +862,11 @@ class ECWD_Cpt {
863
  public function organizers_cpt_meta() {
864
  add_meta_box(
865
  ECWD_PLUGIN_PREFIX . '_organizer_meta',
866
- __('Organizer settings', 'ecwd'),
867
  array($this, 'display_organizer_meta'),
868
  ECWD_PLUGIN_PREFIX . '_organizer',
869
- 'advanced',
870
- 'core'
871
  );
872
 
873
  }
@@ -981,23 +980,22 @@ class ECWD_Cpt {
981
  $post_type = get_post_type($post_id);
982
 
983
  if ($post_type == "ecwd_event") {
984
- if (isset($_POST['ecwd_event_venue']) && ($_POST['ecwd_event_venue'] == '0' && isset($_POST['ecwd_venue_title']))) {
985
- $trim_title = trim(sanitize_text_field($_POST['ecwd_venue_title']));
986
- if (!empty($trim_title)) {
987
- $_POST['ecwd_event_venue'] = $this->add_new_venue();
988
- }else{
989
- $_POST['ecwd_event_location'] = "";
990
- $_POST['ecwd_lat_long'] = "40.712784,-74.005941";
991
- }
992
- }
993
- if(isset($_POST['ecwd_event_venue'])) {
994
- if ($_POST['ecwd_event_venue'] == '0') {
995
- $_POST['ecwd_event_show_map'] = 'no';
996
- } else {
997
- $_POST['ecwd_event_show_map'] = ($_POST['ecwd_venue_show_map'] == '1') ? '1' : 'no';
998
- }
999
  }
1000
 
 
 
 
 
 
 
 
 
 
 
 
1001
  }else if($post_type == 'ecwd_calendar'){
1002
  $this->save_default_calendar_meta($post_id);
1003
  }
@@ -1442,18 +1440,22 @@ class ECWD_Cpt {
1442
  }
1443
 
1444
 
1445
- private function add_new_venue(){
 
 
 
 
 
 
 
 
 
 
 
 
1446
 
1447
- $venue_title = (isset($_POST['ecwd_venue_title'])) ? sanitize_text_field($_POST['ecwd_venue_title']) : "";
1448
- $venue_content = (isset($_POST['ecwd_venue_content'])) ? sanitize_text_field($_POST['ecwd_venue_content']) : "";
1449
- $venue_location = (isset($_POST['ecwd_event_location'])) ? sanitize_text_field($_POST['ecwd_event_location']) : "";
1450
- $venue_phone = (isset($_POST['ecwd_venue_meta_phone'])) ? sanitize_text_field($_POST['ecwd_venue_meta_phone']) : "";
1451
- $venue_website = (isset($_POST['ecwd_venue_meta_website'])) ? sanitize_text_field($_POST['ecwd_venue_meta_website']) : "";
1452
- $venue_show_map = (isset($_POST['ecwd_venue_show_map'])) ? sanitize_text_field($_POST['ecwd_venue_show_map']) : "";
1453
- $venue_lat_long = (isset($_POST['ecwd_lat_long'])) ? sanitize_text_field($_POST['ecwd_lat_long']) : "";
1454
- $venue_zoom = (isset($_POST['ecwd_map_zoom'])) ? sanitize_text_field($_POST['ecwd_map_zoom']) : "";
1455
 
1456
- $post_data = array(
1457
  'post_title' => $venue_title,
1458
  'post_content' => $venue_content,
1459
  'post_status' => 'publish',
@@ -1468,8 +1470,13 @@ class ECWD_Cpt {
1468
  )
1469
  );
1470
 
1471
- $post_id = wp_insert_post($post_data);
1472
- return $post_id;
 
 
 
 
 
1473
  }
1474
 
1475
 
629
  add_meta_box(ECWD_PLUGIN_PREFIX . '_calendar_meta', __('Calendar Settings', 'ecwd'), array(
630
  $this,
631
  'display_calendars_meta'
632
+ ), ECWD_PLUGIN_PREFIX . '_calendar', 'normal', 'high');
633
  }
634
 
635
  /**
692
  * Add Events post meta
693
  */
694
  public function events_cpt_meta($screen = null, $context = 'advanced') {
695
+ add_meta_box(ECWD_PLUGIN_PREFIX . '_event_meta', __('Event Details', 'ecwd'), array(
696
  $this,
697
  'display_events_meta'
698
+ ), ECWD_PLUGIN_PREFIX . '_event', 'normal', 'high');
699
 
700
  add_meta_box(ECWD_PLUGIN_PREFIX . '_event_calendars_meta', __('Calendars', 'ecwd'), array(
701
  $this,
702
  'display_events_calendars_meta'
703
+ ), ECWD_PLUGIN_PREFIX . '_event', 'normal', 'high');
704
+
705
+ add_meta_box(ECWD_PLUGIN_PREFIX . '_event_venue_meta', __('Venue', 'ecwd'), array(
706
+ $this,
707
+ 'display_events_venue_meta'
708
+ ), ECWD_PLUGIN_PREFIX . '_event', 'normal', 'high');
709
 
710
  add_meta_box(ECWD_PLUGIN_PREFIX . '_event_organizers_meta', __('Organizers', 'ecwd'), array(
711
  $this,
712
  'display_events_organizers_meta'
713
+ ), ECWD_PLUGIN_PREFIX . '_event', 'normal', 'high');
714
 
715
  if (current_theme_supports('post-thumbnails', 'post') && post_type_supports('post', 'thumbnail')) {
716
  add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
721
  * Display Events post meta
722
  */
723
  public function display_events_meta() {
 
 
 
724
  $is_ = $this->is();
 
 
 
 
 
 
 
725
  include_once( ECWD_DIR . '/views/admin/ecwd-event-meta.php' );
726
  }
727
 
732
  include_once( ECWD_DIR . '/views/admin/ecwd-event-calendars-meta.php' );
733
  }
734
 
735
+ public function display_events_venue_meta() {
736
+ include_once( ECWD_DIR . '/views/admin/ecwd-event-venues-meta.php' );
737
+ }
738
+
739
  public function display_events_organizers_meta() {
740
  include_once( ECWD_DIR . '/views/admin/ecwd-event-organizers-meta.php' );
741
  }
747
  add_meta_box(ECWD_PLUGIN_PREFIX . '_theme_meta', __('Calendar Theme Settings', 'ecwd'), array(
748
  $this,
749
  'display_theme_meta'
750
+ ), ECWD_PLUGIN_PREFIX . '_theme', 'normal', 'high');
751
  }
752
 
753
  /**
849
 
850
  add_meta_box(
851
  ECWD_PLUGIN_PREFIX . '_venue_meta',
852
+ __('Venue Details', 'ecwd'),
853
  array($this, 'display_venue_meta'),
854
  ECWD_PLUGIN_PREFIX . '_venue',
855
+ 'normal',
856
+ 'high'
857
  );
858
 
859
  }
862
  public function organizers_cpt_meta() {
863
  add_meta_box(
864
  ECWD_PLUGIN_PREFIX . '_organizer_meta',
865
+ __('Organizer Details', 'ecwd'),
866
  array($this, 'display_organizer_meta'),
867
  ECWD_PLUGIN_PREFIX . '_organizer',
868
+ 'normal',
869
+ 'high'
870
  );
871
 
872
  }
980
  $post_type = get_post_type($post_id);
981
 
982
  if ($post_type == "ecwd_event") {
983
+
984
+ if($_POST['ecwd_event_venue'] == 'new'){
985
+ $_POST['ecwd_event_venue'] = '0';
 
 
 
 
 
 
 
 
 
 
 
 
986
  }
987
 
988
+ if(!isset($_POST['ecwd_event_venue']) || $_POST['ecwd_event_venue'] == '0' && $_POST['ecwd_event_venue'] == 'new'){
989
+ $_POST['ecwd_event_location'] = "";
990
+ $_POST['ecwd_lat_long'] = "40.712784,-74.005941";
991
+ $_POST['ecwd_event_show_map'] = 'no';
992
+ $_POST['ecwd_map_zoom'] = 17;
993
+ }else{
994
+ $_POST['ecwd_event_location'] = get_post_meta($_POST['ecwd_event_venue'], 'ecwd_venue_location', true);
995
+ $_POST['ecwd_lat_long'] = get_post_meta($_POST['ecwd_event_venue'], 'ecwd_venue_lat_long', true);
996
+ $_POST['ecwd_event_show_map'] = get_post_meta($_POST['ecwd_event_venue'], 'ecwd_venue_show_map', true);
997
+ $_POST['ecwd_map_zoom'] = get_post_meta($_POST['ecwd_event_venue'], 'ecwd_map_zoom', true);
998
+ }
999
  }else if($post_type == 'ecwd_calendar'){
1000
  $this->save_default_calendar_meta($post_id);
1001
  }
1440
  }
1441
 
1442
 
1443
+ public static function add_new_venue($post_data=null) {
1444
+ if($post_data == null){
1445
+ $post_data = $_POST;
1446
+ }
1447
+
1448
+ $venue_title = (isset($post_data['ecwd_venue_title'])) ? sanitize_text_field($post_data['ecwd_venue_title']) : "";
1449
+ $venue_content = (isset($post_data['ecwd_venue_content'])) ? sanitize_text_field($post_data['ecwd_venue_content']) : "";
1450
+ $venue_location = (isset($post_data['ecwd_event_location'])) ? sanitize_text_field($post_data['ecwd_event_location']) : "";
1451
+ $venue_phone = (isset($post_data['ecwd_venue_meta_phone'])) ? sanitize_text_field($post_data['ecwd_venue_meta_phone']) : "";
1452
+ $venue_website = (isset($post_data['ecwd_venue_meta_website'])) ? sanitize_text_field($post_data['ecwd_venue_meta_website']) : "";
1453
+ $venue_show_map = (isset($post_data['ecwd_venue_show_map'])) ? sanitize_text_field($post_data['ecwd_venue_show_map']) : "";
1454
+ $venue_lat_long = (isset($post_data['ecwd_lat_long'])) ? sanitize_text_field($post_data['ecwd_lat_long']) : "";
1455
+ $venue_zoom = (isset($post_data['ecwd_map_zoom'])) ? sanitize_text_field($post_data['ecwd_map_zoom']) : "";
1456
 
 
 
 
 
 
 
 
 
1457
 
1458
+ $post_args = array(
1459
  'post_title' => $venue_title,
1460
  'post_content' => $venue_content,
1461
  'post_status' => 'publish',
1470
  )
1471
  );
1472
 
1473
+ $post_id = wp_insert_post($post_args);
1474
+
1475
+ $response = $post_args['meta_input'];
1476
+ $response['post_title'] = $post_args['post_title'];
1477
+ $response['id'] = $post_id;
1478
+
1479
+ return $response;
1480
  }
1481
 
1482
 
includes/ecwd-functions.php CHANGED
@@ -2,6 +2,11 @@
2
 
3
  //if (!defined())
4
  function ecwd_print_calendar($calendar_ids, $display = 'mini', $args = array(), $widget = false, $ajax = false, $ecwd_views = array(), $preview = false) {
 
 
 
 
 
5
  global $ecwd_options;
6
  (isset($ecwd_options['events_in_popup']) && $ecwd_options['events_in_popup'] == "1") ? $popup = "yes" : $popup = "no";
7
  wp_enqueue_script(ECWD_PLUGIN_PREFIX . '-public');
2
 
3
  //if (!defined())
4
  function ecwd_print_calendar($calendar_ids, $display = 'mini', $args = array(), $widget = false, $ajax = false, $ecwd_views = array(), $preview = false) {
5
+
6
+ if(extension_loaded('calendar') === false){
7
+ return __("Event Calendar WD requires PHP Calendar module to display events. Contact your hosting provider or enable it manually.", "ecwd");
8
+ }
9
+
10
  global $ecwd_options;
11
  (isset($ecwd_options['events_in_popup']) && $ecwd_options['events_in_popup'] == "1") ? $popup = "yes" : $popup = "no";
12
  wp_enqueue_script(ECWD_PLUGIN_PREFIX . '-public');
includes/register-settings.php CHANGED
@@ -416,7 +416,7 @@ function ecwd_register_settings() {
416
  ),
417
  'gmap_marker_click' => array(
418
  'id' => 'gmap_marker_click',
419
- 'name' => __('Open Google map when Marker is clicked', 'ecwd'),
420
  'desc' => '',
421
  'type' => 'radio',
422
  'default' => 0
416
  ),
417
  'gmap_marker_click' => array(
418
  'id' => 'gmap_marker_click',
419
+ 'name' => __('Open Google Maps when Marker is clicked', 'ecwd'),
420
  'desc' => '',
421
  'type' => 'radio',
422
  'default' => 0
js/admin/admin.js CHANGED
@@ -1,11 +1,13 @@
1
  /**
2
  * Admin JS functions
3
  */
4
- (function ($) {
 
5
 
6
  $("#ecwd_category_color").ecolorpicker();
7
 
8
- $('#ecwd_event_repeat_dont_repeat_radio').click(function () {
 
9
  $("#ecwd_repeat_until").hide();
10
  });
11
 
@@ -16,7 +18,8 @@
16
  transparentColor: true
17
  });
18
 
19
- $("#ecwd_category_color, .ecwd_colour").on("change.color", function (event, color) {
 
20
  $(this).css('background-color', color);
21
  });
22
 
@@ -26,12 +29,14 @@
26
  var checked_el = $('.ecwd_event_repeat_event_radio:checked, .ecwd_event_repeat_list_radio:checked');
27
  show_fields(checked_el);
28
 
29
- $('.ecwd_event_repeat_event_radio').click(function (e) {
 
30
  show_fields($(this));
31
  });
32
 
33
 
34
- function show_fields(el) {
 
35
  allHiddens.attr('class', 'hidden');
36
  if (el.attr('id') != 'ecwd_event_repeat_dont_repeat_radio') {
37
  $("#ecwd_repeat_until").show();
@@ -53,11 +58,13 @@
53
  $(".ecwd_event_repeat_on_the").attr('disabled', true);
54
  }
55
 
56
- $("#ecwd_event_repeat_dont_repeat_radio").click(function () {
 
57
  $("#ecwd_repeat_until").attr('class', 'hidden');
58
  });
59
 
60
- $(".ecwd_event_repeat_choose").click(function () {
 
61
  $(".ecwd_event_repeat_on_the").attr('disabled', false);
62
  $(".select_to_enable_disable").attr('disabled', true);
63
  });
@@ -72,13 +79,15 @@
72
  $(".select_to_enable_disable").attr('disabled', false);
73
  $(".ecwd_event_year_month").attr('disabled', true);
74
  }
75
- $(".ecwd_event_repeat_list_radio").click(function () {
 
76
  $(".ecwd_event_repeat_on_the").attr('disabled', true);
77
  $(".select_to_enable_disable").attr('disabled', false);
78
  });
79
 
80
  // on adding event
81
- $("#ecwd_repeat_event_monthly").click(function () {
 
82
  $(".ecwd_event_repeat_choose").prop('checked', true);
83
  $(".ecwd_event_repeat_on_the").attr('disabled', false);
84
  $(".select_to_enable_disable").attr('disabled', true);
@@ -86,7 +95,8 @@
86
 
87
  //event validations
88
  if ($("#ecwd_event_meta").length > 0) {
89
- $("#post").submit(function (e) {
 
90
  var dateTo = Date.parse($("#ecwd_event_date_to").val()),
91
  dateFrom = Date.parse($("#ecwd_event_date_from").val());
92
  if (dateFrom == '' || isNaN(dateFrom) || isNaN(dateTo) || dateTo == '') {
@@ -116,32 +126,12 @@
116
  }
117
  }
118
 
119
- if ($("#ecwd_event_venue").val() == '0') {
120
- var title = ($("#ecwd_venue_title").val()).trim();
121
- if (title != "") {
122
- return;
123
- }
124
-
125
- var notification = "Please fill Venue title for save";
126
-
127
- var fields = [
128
- '#ecwd_venue_content',
129
- '#ecwd_event_location',
130
- '#ecwd_venue_meta_phone',
131
- '#ecwd_venue_meta_website'
132
- ];
133
-
134
- for (var i = 0; i < fields.length; i++) {
135
- var field_value = ($(fields[i]).val()).trim();
136
- if (field_value != "") {
137
- alert(notification);
138
- e.preventDefault();
139
- return false;
140
- }
141
- }
142
  }
143
 
144
-
145
  });
146
  }
147
 
@@ -157,7 +147,8 @@
157
 
158
  var wordpress_ver = ecwd_admin_params.version, upload_button;
159
 
160
- $(".ecwd_upload_image_button").click(function (event) {
 
161
  upload_button = $(this);
162
  var frame;
163
  if (wordpress_ver >= "3.5") {
@@ -167,7 +158,8 @@
167
  return;
168
  }
169
  frame = wp.media();
170
- frame.on("select", function () {
 
171
  // Grab the selected attachment.
172
  var attachment = frame.state().get("selection").first();
173
  frame.close();
@@ -186,7 +178,8 @@
186
  }
187
  });
188
 
189
- $(".ecwd_remove_image_button").click(function () {
 
190
  $("#ecwd_taxonomy_image").val("");
191
  $(this).parent().siblings(".title").children("img").attr("src", "' . Z_IMAGE_PLACEHOLDER . '");
192
  $(".inline-edit-col :input[name=\'ecwd_taxonomy_image\']").val("");
@@ -194,7 +187,8 @@
194
  });
195
 
196
  if (wordpress_ver < "3.5") {
197
- window.send_to_editor = function (html) {
 
198
  imgurl = $("img", html).attr("src");
199
  if (upload_button.parent().prev().children().hasClass("tax_list")) {
200
  upload_button.parent().prev().children().val(imgurl);
@@ -206,7 +200,8 @@
206
  }
207
  }
208
 
209
- $("body").on("click", '.editinline', function () {
 
210
  var tax_id = $(this).parents("tr").attr("id").substr(4);
211
  var thumb = $("#tag-" + tax_id + " .thumb img").attr("src");
212
  if (thumb != "' . Z_IMAGE_PLACEHOLDER . '") {
@@ -218,7 +213,8 @@
218
  return false;
219
  });
220
  ////////////Calendar add/remove events/////////////
221
- $(document).on('click', '.ecwd-events .ecwd-calendar-event-delete', function () {
 
222
  if (confirm('Sure?')) {
223
  var clicked_el = this;
224
  var element = $(this).closest('.ecwd-calendar-event');
@@ -229,7 +225,8 @@
229
  ecwd_event_id: event_id,
230
  ecwd_calendar_id: calendar_id,
231
  ecwd_action: 'delete'
232
- }).done(function (data) {
 
233
  res = JSON.parse(data);
234
  if (res.status == 'ok') {
235
  $(clicked_el).removeClass('ecwd-calendar-event-delete');
@@ -243,7 +240,8 @@
243
  }
244
  });
245
 
246
- $(document).on('click', '.ecwd-excluded-events .ecwd-calendar-event-add, #ecwd_add_event_to_calendar .ecwd-calendar-event-add', function () {
 
247
  var clicked_el = this;
248
  var element = $(this).closest('.ecwd-calendar-event');
249
  var calendar_id = $('#post_ID').val();
@@ -254,7 +252,8 @@
254
  ecwd_calendar_id: calendar_id,
255
  ecwd_action: 'add'
256
 
257
- }).done(function (data) {
 
258
  res = JSON.parse(data);
259
  if (res.status == 'ok') {
260
  $(clicked_el).addClass('ecwd-calendar-event-delete');
@@ -270,24 +269,29 @@
270
  ////////////////////////////////////////////////////////
271
 
272
  ////////////Calendar selectable add events/////////////
273
- $(document).on('click', '.event_cal_add .event_cal_add_close', function (e) {
 
274
  $('.event_cal_add').hide();
275
  });
276
- $(document).on('mouseup', '.day-with-date', function (e) {
 
277
  var position = $(this).position();
278
  $('.event_cal_add').css({"margin": "0 auto", "left": position.left});
279
  });
280
 
281
- $('body').on('mouseenter', '.ecwd_calendar_container', function () {
 
282
  $(this).selectable({
283
  filter: ".day-with-date",
284
- start: function () {
 
285
  $('.event_cal_add').hide();
286
  $('#add_event_to_cal').show();
287
  $('.ecwd_notification, .ecwd_error').empty();
288
  $('#ecwd_event_name').val('');
289
  },
290
- stop: function () {
 
291
 
292
  var result = $("#select-result").empty();
293
 
@@ -315,7 +319,8 @@
315
  }
316
  $('.event_cal_add').removeClass('hidden');
317
  $('.event_cal_add').show();
318
- setTimeout(function () {
 
319
  $('#ecwd_event_name').focus();
320
  }, 1);
321
  $('#ecwd-modal-preview').animate({
@@ -325,7 +330,8 @@
325
  }
326
  });
327
  });
328
- $(document).on('click', '#add_event_to_cal', function () {
 
329
  var start_date = $('#ecwd_event_date_from').val();
330
  var end_date = $('#ecwd_event_date_to').val();
331
  var name = $('#ecwd_event_name').val();
@@ -337,7 +343,8 @@
337
  ecwd_event_name: name,
338
  ecwd_event_date_from: start_date,
339
  ecwd_event_date_to: end_date
340
- }).done(function (data) {
 
341
  res = JSON.parse(data);
342
  if (res.status == 'success') {
343
  $('#add_event_to_cal').hide();
@@ -364,8 +371,10 @@
364
  $('#ecwd-tabs .ecwd-tabs li:first-child').addClass("ui-state-active");
365
  }
366
 
367
- $(".ecwd-tabs li a").each(function (indx, element) {
368
- $(element).click(function () {
 
 
369
  if (typeof(Storage) !== "undefined") {
370
  localStorage.currentItem = $(element).attr("href");
371
  }
@@ -377,85 +386,6 @@
377
  });
378
 
379
 
380
- //////////////////////////////////////////
381
- $('#ecwd_event_venue').change(function (e) {
382
- if ($(this).val() > 0) {
383
- var location = $(this).find(':selected').data('location');
384
- var markerLatLong = $(this).find(':selected').data('marker');
385
- var zoom = parseInt($(this).find(':selected').data('zoom'));
386
- if (!zoom) {
387
- zoom = 17;
388
- }
389
- if (typeof google !== "undefined" && typeof map !== "undefined") {
390
-
391
- var lat_long = markerLatLong.split(',');
392
- if (lat_long.length !== 2) {
393
- lat_long[0] = 40.7127837;
394
- lat_long[1] = -74.00594130000002;
395
- }
396
-
397
- var myLatlng = new google.maps.LatLng(parseFloat(lat_long[0]), parseFloat(lat_long[1]));
398
-
399
- deleteMarkers();
400
- addMarker(myLatlng);
401
-
402
- map.setCenter(myLatlng);
403
- map.setZoom(zoom);
404
- $('#ecwd_event_location').val(location);
405
- $('#ecwd_map_zoom').val(zoom);
406
-
407
- }
408
-
409
- var meta_container = $('.ecwd-venue-meta-fields');
410
-
411
- meta_container.find('#ecwd_venue_title').val("").closest('.ecwd-meta-field').hide();
412
- meta_container.find('#ecwd_venue_content').val("").closest('.ecwd-meta-field').hide();
413
- meta_container.find('#ecwd_venue_meta_phone').val("").closest('.ecwd-meta-field').hide();
414
- meta_container.find('#ecwd_venue_meta_website').val("").closest('.ecwd-meta-field').hide();
415
- meta_container.find('#ecwd_venue_show_map').closest('.ecwd-meta-field').hide();
416
-
417
- // meta_container.find('#ecwd_venue_title').val($(this).find(':selected').data('venuetitle'));
418
- // meta_container.find('#ecwd_venue_content').val($(this).find(':selected').data('venuecontent'));
419
- // meta_container.find('#ecwd_venue_meta_phone').val($(this).find(':selected').data('metaphone'));
420
- // meta_container.find('#ecwd_venue_meta_website').val($(this).find(':selected').data('metawebsite'));
421
-
422
- if ($(this).find(':selected').data('showmap') == '1') {
423
- meta_container.find('#ecwd_venue_show_map').prop('checked', true);
424
- meta_container.find('#ecwd_venue_show_map').trigger('change');
425
- } else {
426
- meta_container.find('#ecwd_venue_show_map').prop('checked', false);
427
- meta_container.find('#ecwd_venue_show_map').trigger('change');
428
- }
429
-
430
-
431
- } else {
432
- if(typeof google !== "undefined" && typeof map !== "undefined") {
433
- var myLatlng = new google.maps.LatLng(parseFloat(40.7127837), parseFloat(-74.00594130000002));
434
-
435
- deleteMarkers();
436
- addMarker(myLatlng);
437
-
438
- map.setCenter(myLatlng);
439
- map.setZoom(17);
440
- $('#ecwd_map_zoom').val(17);
441
- }
442
-
443
-
444
- var meta_container = $('.ecwd-venue-meta-fields');
445
-
446
- meta_container.find('#ecwd_venue_title').closest('.ecwd-meta-field').show();
447
- meta_container.find('#ecwd_venue_content').closest('.ecwd-meta-field').show();
448
- meta_container.find('#ecwd_venue_meta_phone').closest('.ecwd-meta-field').show();
449
- meta_container.find('#ecwd_venue_meta_website').closest('.ecwd-meta-field').show();
450
- meta_container.find('#ecwd_venue_show_map').closest('.ecwd-meta-field').show();
451
- meta_container.find('#ecwd_venue_show_map').prop('checked', false);
452
- meta_container.find('#ecwd_venue_show_map').trigger('change');
453
- }
454
-
455
-
456
-
457
- });
458
-
459
  $('.ecwd_add_event_to_calendar').ecwd_popup({
460
  button: $('.ecwd_events_popup_button'),
461
  title: 'Event List',
@@ -470,7 +400,8 @@
470
 
471
  if ($("#ecwd-settings-content").length == 1) {
472
  var color = "rgba(51,51,51,.5)";
473
- $('.ecwd_disabled_option').each(function () {
 
474
  $(this).closest("tr").find("th").css("color", color);
475
 
476
  $(this).closest("td").find("select").attr("disabled", true);
@@ -487,7 +418,7 @@
487
 
488
  var ecwd_venue_meta_box = $("#ecwd_venue_meta");
489
  if (ecwd_venue_meta_box.length == 0) {
490
- ecwd_venue_meta_box = $("#ecwd_event_meta .ecwd-venue-meta-fields").closest('td');
491
  }
492
 
493
  if (ecwd_venue_meta_box.length > 0) {
@@ -495,21 +426,282 @@
495
  venue_meta_controller.init(ecwd_venue_meta_box);
496
  }
497
 
498
- function ecwd_venue_meta_controller() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
 
500
  this.$container = null;
501
  this.$map_container = null;
502
  this.$description = null;
503
  var _this = this;
504
 
505
- this.init = function ($container) {
 
506
  this.$container = $container;
507
  this.$map_container = this.$container.find('.ecwd_google_map');
508
  this.$ecwd_venue_show_map = this.$container.find('#ecwd_venue_show_map');
509
  this.$description = this.$container.find('.ecwd_venue_meta_decription');
510
 
511
 
512
- this.$ecwd_venue_show_map.on("change", function () {
 
513
 
514
  if ($(this).is(':checked')) {
515
 
@@ -539,11 +731,13 @@
539
  add_organizer_form_event_page();
540
  }
541
 
542
- function add_organizer_form_event_page() {
 
543
  var container = $('.ecwd-add_organizer-container');
544
  var form = $('.ecwd-add_organizer-container').find('.ecwd-add-organizer-form');
545
 
546
- container.find('a.ecwd-add-organizer').on('click', function (e) {
 
547
  e.preventDefault();
548
 
549
  if (form.is(":visible")) {
@@ -555,13 +749,15 @@
555
  return false;
556
  });
557
 
558
- form.find('.ecwd-add-organizer-save').on('click', function (e) {
 
559
  e.preventDefault();
560
 
 
561
  var title = form.find('#ecwd-add-organizer-title');
562
 
563
  if (title.val() == "") {
564
- alert("Please fill Organizer title field");
565
  return false;
566
  }
567
 
@@ -585,7 +781,7 @@
585
  phone.attr('disabled', true);
586
  website.attr('disabled', true);
587
  jQuery(this).attr('disabled', true);
588
-
589
 
590
  var response = add_new_post(post_data);
591
 
@@ -610,6 +806,7 @@
610
  phone.attr('disabled', false);
611
  website.attr('disabled', false);
612
  jQuery(this).attr('disabled', false);
 
613
 
614
  form.hide();
615
  return false;
@@ -617,7 +814,8 @@
617
 
618
  }
619
 
620
- function add_new_post(post_data) {
 
621
 
622
  var response = null;
623
 
@@ -631,10 +829,12 @@
631
  nonce: ecwd.ajaxnonce,
632
  post_data: post_data,
633
  },
634
- success: function (data) {
 
635
  response = data;
636
  },
637
- error: function (data) {
 
638
  response = null;
639
  }
640
  });
@@ -648,18 +848,14 @@ var map;
648
  var markers = [];
649
  var geocoder;
650
 
651
- var change_event_location_obj = null;
652
- if (jQuery('#ecwd_event_location').length > 0) {
653
- change_event_location_obj = new change_event_location();
654
- change_event_location_obj.change_location();
655
- }
656
 
657
  var venue_metas_container = null;
658
  if (jQuery('.ecwd-venue-meta-fields').length > 0) {
659
  venue_metas_container = jQuery('.ecwd-venue-meta-fields');
660
  }
661
 
662
- function initialize() {
 
663
  geocoder = new google.maps.Geocoder();
664
 
665
  var lat_long = document.getElementById('ecwd_lat_long').value.split(',');
@@ -687,7 +883,8 @@ function initialize() {
687
  mapOptions);
688
 
689
  if (!lat_long_available && navigator.geolocation) {
690
- navigator.geolocation.getCurrentPosition(function (position) {
 
691
  initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
692
  map.setCenter(initialLocation);
693
  });
@@ -696,9 +893,11 @@ function initialize() {
696
  var ecwd_typing_timer = null;
697
  var $inputs = jQuery('#ecwd_longitude, #ecwd_latitude');
698
 
699
- $inputs.on('keyup', function () {
 
700
  clearTimeout(ecwd_typing_timer);
701
- ecwd_typing_timer = setTimeout(function () {
 
702
  var latlng = new google.maps.LatLng(jQuery('#ecwd_latitude').val(), jQuery('#ecwd_longitude').val());
703
  deleteMarkers();
704
  geocodePosition(latlng);
@@ -707,7 +906,8 @@ function initialize() {
707
  }, 1000);
708
  });
709
 
710
- $inputs.on('keydown', function () {
 
711
  clearTimeout(ecwd_typing_timer);
712
  });
713
 
@@ -716,7 +916,7 @@ function initialize() {
716
 
717
  var types = document.getElementById('type-selector');
718
  if (venue_metas_container == null) {
719
- map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
720
  }
721
  var autocomplete = new google.maps.places.Autocomplete(input);
722
  autocomplete.bindTo('bounds', map);
@@ -729,12 +929,11 @@ function initialize() {
729
  });
730
  markers.push(address_marker);
731
 
732
- google.maps.event.addListener(autocomplete, 'place_changed', function () {
 
733
  infowindow.close();
734
  address_marker.setVisible(false);
735
- if (change_event_location_obj !== null) {
736
- change_event_location_obj.is_changed_event_location();
737
- }
738
  var place = autocomplete.getPlace();
739
  if (!place.geometry) {
740
  return;
@@ -782,71 +981,60 @@ function initialize() {
782
  infowindow.open(map, address_marker);
783
  });
784
 
785
- google.maps.event.addListener(map, 'click', function (event) {
 
 
 
 
 
 
 
786
  deleteMarkers();
787
  geocodePosition(event.latLng);
788
  addMarker(event.latLng);
789
- if (change_event_location_obj !== null) {
790
- change_event_location_obj.is_changed_event_location();
791
- }
792
  });
793
- google.maps.event.addListener(address_marker, 'dragend', function () {
 
 
 
 
 
 
 
 
794
  setMarkerPosition(address_marker);
795
  geocodePosition(address_marker.getPosition());
796
- if (change_event_location_obj !== null) {
797
- change_event_location_obj.is_changed_event_location();
798
- }
799
  });
800
- google.maps.event.addListener(map, 'zoom_changed', function () {
 
801
  jQuery('#ecwd_map_zoom').val(map.getZoom());
802
  });
803
 
804
  if (ecwd_marker == 1) {
805
- var infowindow = new google.maps.InfoWindow();
806
- addMarker(myLatlng);
807
- var loc = document.getElementById('ecwd_event_location').value;
808
 
809
- }
810
- }
811
- /*IN EVENT META PAGE*/
812
- function change_event_location() {
813
- this.$venue_list = jQuery('#ecwd_event_venue');
814
- this.$event_location_fild = jQuery('#ecwd_event_location');
815
- this.event_location = '';
816
- this.replace = false;
817
-
818
- this.reset_venue_list = function () {
819
- if(this.$venue_list.val() != '0'){
820
- this.$venue_list.val('0').trigger('change');
821
  }
822
- };
823
 
824
- this.is_changed_event_location = function () {
825
- var val1 = this.$event_location_fild.val().replace(/\s+$/g, '');
826
- var val2 = this.event_location.replace(/\s+$/g, '');
827
- if (val1 !== val2 || this.replace === true) {
828
- this.reset_venue_list();
829
- this.set_event_location();
830
- this.replace = false;
831
- }
832
- };
833
 
834
- this.change_location = function () {
835
- var _this = this;
836
- _this.event_location = jQuery('#ecwd_event_location').val();
837
- jQuery(document).on('input', '#ecwd_event_location', function () {
838
- _this.is_changed_event_location();
839
- });
840
- }
841
 
842
- this.set_event_location = function () {
843
- this.event_location = this.$event_location_fild.val();
844
  }
845
-
846
  }
847
 
848
  // Add a marker to the map and push to the array.
849
- function addMarker(location) {
 
 
 
 
 
 
 
850
  var marker = new google.maps.Marker({
851
  position: location,
852
  map: map,
@@ -854,40 +1042,49 @@ function addMarker(location) {
854
  });
855
  markers.push(marker);
856
  setMarkerPosition(marker);
857
- google.maps.event.addListener(marker, 'dragend', function (event) {
 
 
 
 
 
 
 
858
  setMarkerPosition(marker);
859
  geocodePosition(marker.getPosition());
860
- if (change_event_location_obj !== null) {
861
- change_event_location_obj.is_changed_event_location();
862
- }
863
  });
864
- //google.maps.event.trigger(marker, 'dragend');
865
  }
866
 
867
  // Sets the map on all markers in the array.
868
- function setAllMap(map) {
 
869
  for (var i = 0; i < markers.length; i++) {
870
  markers[i].setMap(map);
871
  }
872
  }
873
 
874
  // Removes the markers from the map, but keeps them in the array.
875
- function clearMarkers() {
 
876
  setAllMap(null);
877
  }
878
 
879
  // Shows any markers currently in the array.
880
- function showMarkers() {
 
881
  setAllMap(map);
882
  }
883
 
884
  // Deletes all markers in the array by removing references to them.
885
- function deleteMarkers() {
 
886
  clearMarkers();
887
  markers = [];
888
  }
889
 
890
- function setMarkerPosition(marker) {
 
891
  var lat_long_val = marker.getPosition().toUrlValue();
892
  document.getElementById('ecwd_lat_long').value = lat_long_val;
893
  var lat_long_data = lat_long_val.split(',');
@@ -897,10 +1094,12 @@ function setMarkerPosition(marker) {
897
  }
898
  }
899
 
900
- function geocodePosition(pos) {
 
901
  geocoder.geocode({
902
  latLng: pos
903
- }, function (responses) {
 
904
  if (responses && responses.length > 0) {
905
  updateMarkerAddress(responses[0].formatted_address);
906
  } else {
@@ -908,12 +1107,14 @@ function geocodePosition(pos) {
908
  }
909
  });
910
  }
911
- function updateMarkerAddress(address) {
 
912
  document.getElementById('ecwd_event_location').value = address;
913
 
914
  }
915
 
916
- function loadScript() {
 
917
  if (ecwd.gmap_key == "") {
918
  return;
919
  }
1
  /**
2
  * Admin JS functions
3
  */
4
+ (function ($)
5
+ {
6
 
7
  $("#ecwd_category_color").ecolorpicker();
8
 
9
+ $('#ecwd_event_repeat_dont_repeat_radio').click(function ()
10
+ {
11
  $("#ecwd_repeat_until").hide();
12
  });
13
 
18
  transparentColor: true
19
  });
20
 
21
+ $("#ecwd_category_color, .ecwd_colour").on("change.color", function (event, color)
22
+ {
23
  $(this).css('background-color', color);
24
  });
25
 
29
  var checked_el = $('.ecwd_event_repeat_event_radio:checked, .ecwd_event_repeat_list_radio:checked');
30
  show_fields(checked_el);
31
 
32
+ $('.ecwd_event_repeat_event_radio').click(function (e)
33
+ {
34
  show_fields($(this));
35
  });
36
 
37
 
38
+ function show_fields(el)
39
+ {
40
  allHiddens.attr('class', 'hidden');
41
  if (el.attr('id') != 'ecwd_event_repeat_dont_repeat_radio') {
42
  $("#ecwd_repeat_until").show();
58
  $(".ecwd_event_repeat_on_the").attr('disabled', true);
59
  }
60
 
61
+ $("#ecwd_event_repeat_dont_repeat_radio").click(function ()
62
+ {
63
  $("#ecwd_repeat_until").attr('class', 'hidden');
64
  });
65
 
66
+ $(".ecwd_event_repeat_choose").click(function ()
67
+ {
68
  $(".ecwd_event_repeat_on_the").attr('disabled', false);
69
  $(".select_to_enable_disable").attr('disabled', true);
70
  });
79
  $(".select_to_enable_disable").attr('disabled', false);
80
  $(".ecwd_event_year_month").attr('disabled', true);
81
  }
82
+ $(".ecwd_event_repeat_list_radio").click(function ()
83
+ {
84
  $(".ecwd_event_repeat_on_the").attr('disabled', true);
85
  $(".select_to_enable_disable").attr('disabled', false);
86
  });
87
 
88
  // on adding event
89
+ $("#ecwd_repeat_event_monthly").click(function ()
90
+ {
91
  $(".ecwd_event_repeat_choose").prop('checked', true);
92
  $(".ecwd_event_repeat_on_the").attr('disabled', false);
93
  $(".select_to_enable_disable").attr('disabled', true);
95
 
96
  //event validations
97
  if ($("#ecwd_event_meta").length > 0) {
98
+ $("#post").submit(function (e)
99
+ {
100
  var dateTo = Date.parse($("#ecwd_event_date_to").val()),
101
  dateFrom = Date.parse($("#ecwd_event_date_from").val());
102
  if (dateFrom == '' || isNaN(dateFrom) || isNaN(dateTo) || dateTo == '') {
126
  }
127
  }
128
 
129
+ if($("#ecwd_event_venue").val() == 'new'){
130
+ alert('Please save your new venue before publishing the event.');
131
+ e.preventDefault();
132
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
 
 
135
  });
136
  }
137
 
147
 
148
  var wordpress_ver = ecwd_admin_params.version, upload_button;
149
 
150
+ $(".ecwd_upload_image_button").click(function (event)
151
+ {
152
  upload_button = $(this);
153
  var frame;
154
  if (wordpress_ver >= "3.5") {
158
  return;
159
  }
160
  frame = wp.media();
161
+ frame.on("select", function ()
162
+ {
163
  // Grab the selected attachment.
164
  var attachment = frame.state().get("selection").first();
165
  frame.close();
178
  }
179
  });
180
 
181
+ $(".ecwd_remove_image_button").click(function ()
182
+ {
183
  $("#ecwd_taxonomy_image").val("");
184
  $(this).parent().siblings(".title").children("img").attr("src", "' . Z_IMAGE_PLACEHOLDER . '");
185
  $(".inline-edit-col :input[name=\'ecwd_taxonomy_image\']").val("");
187
  });
188
 
189
  if (wordpress_ver < "3.5") {
190
+ window.send_to_editor = function (html)
191
+ {
192
  imgurl = $("img", html).attr("src");
193
  if (upload_button.parent().prev().children().hasClass("tax_list")) {
194
  upload_button.parent().prev().children().val(imgurl);
200
  }
201
  }
202
 
203
+ $("body").on("click", '.editinline', function ()
204
+ {
205
  var tax_id = $(this).parents("tr").attr("id").substr(4);
206
  var thumb = $("#tag-" + tax_id + " .thumb img").attr("src");
207
  if (thumb != "' . Z_IMAGE_PLACEHOLDER . '") {
213
  return false;
214
  });
215
  ////////////Calendar add/remove events/////////////
216
+ $(document).on('click', '.ecwd-events .ecwd-calendar-event-delete', function ()
217
+ {
218
  if (confirm('Sure?')) {
219
  var clicked_el = this;
220
  var element = $(this).closest('.ecwd-calendar-event');
225
  ecwd_event_id: event_id,
226
  ecwd_calendar_id: calendar_id,
227
  ecwd_action: 'delete'
228
+ }).done(function (data)
229
+ {
230
  res = JSON.parse(data);
231
  if (res.status == 'ok') {
232
  $(clicked_el).removeClass('ecwd-calendar-event-delete');
240
  }
241
  });
242
 
243
+ $(document).on('click', '.ecwd-excluded-events .ecwd-calendar-event-add, #ecwd_add_event_to_calendar .ecwd-calendar-event-add', function ()
244
+ {
245
  var clicked_el = this;
246
  var element = $(this).closest('.ecwd-calendar-event');
247
  var calendar_id = $('#post_ID').val();
252
  ecwd_calendar_id: calendar_id,
253
  ecwd_action: 'add'
254
 
255
+ }).done(function (data)
256
+ {
257
  res = JSON.parse(data);
258
  if (res.status == 'ok') {
259
  $(clicked_el).addClass('ecwd-calendar-event-delete');
269
  ////////////////////////////////////////////////////////
270
 
271
  ////////////Calendar selectable add events/////////////
272
+ $(document).on('click', '.event_cal_add .event_cal_add_close', function (e)
273
+ {
274
  $('.event_cal_add').hide();
275
  });
276
+ $(document).on('mouseup', '.day-with-date', function (e)
277
+ {
278
  var position = $(this).position();
279
  $('.event_cal_add').css({"margin": "0 auto", "left": position.left});
280
  });
281
 
282
+ $('body').on('mouseenter', '.ecwd_calendar_container', function ()
283
+ {
284
  $(this).selectable({
285
  filter: ".day-with-date",
286
+ start: function ()
287
+ {
288
  $('.event_cal_add').hide();
289
  $('#add_event_to_cal').show();
290
  $('.ecwd_notification, .ecwd_error').empty();
291
  $('#ecwd_event_name').val('');
292
  },
293
+ stop: function ()
294
+ {
295
 
296
  var result = $("#select-result").empty();
297
 
319
  }
320
  $('.event_cal_add').removeClass('hidden');
321
  $('.event_cal_add').show();
322
+ setTimeout(function ()
323
+ {
324
  $('#ecwd_event_name').focus();
325
  }, 1);
326
  $('#ecwd-modal-preview').animate({
330
  }
331
  });
332
  });
333
+ $(document).on('click', '#add_event_to_cal', function ()
334
+ {
335
  var start_date = $('#ecwd_event_date_from').val();
336
  var end_date = $('#ecwd_event_date_to').val();
337
  var name = $('#ecwd_event_name').val();
343
  ecwd_event_name: name,
344
  ecwd_event_date_from: start_date,
345
  ecwd_event_date_to: end_date
346
+ }).done(function (data)
347
+ {
348
  res = JSON.parse(data);
349
  if (res.status == 'success') {
350
  $('#add_event_to_cal').hide();
371
  $('#ecwd-tabs .ecwd-tabs li:first-child').addClass("ui-state-active");
372
  }
373
 
374
+ $(".ecwd-tabs li a").each(function (indx, element)
375
+ {
376
+ $(element).click(function ()
377
+ {
378
  if (typeof(Storage) !== "undefined") {
379
  localStorage.currentItem = $(element).attr("href");
380
  }
386
  });
387
 
388
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  $('.ecwd_add_event_to_calendar').ecwd_popup({
390
  button: $('.ecwd_events_popup_button'),
391
  title: 'Event List',
400
 
401
  if ($("#ecwd-settings-content").length == 1) {
402
  var color = "rgba(51,51,51,.5)";
403
+ $('.ecwd_disabled_option').each(function ()
404
+ {
405
  $(this).closest("tr").find("th").css("color", color);
406
 
407
  $(this).closest("td").find("select").attr("disabled", true);
418
 
419
  var ecwd_venue_meta_box = $("#ecwd_venue_meta");
420
  if (ecwd_venue_meta_box.length == 0) {
421
+ ecwd_venue_meta_box = $("#ecwd_event_venue_meta .ecwd_event_venue_map_content");
422
  }
423
 
424
  if (ecwd_venue_meta_box.length > 0) {
426
  venue_meta_controller.init(ecwd_venue_meta_box);
427
  }
428
 
429
+ if (jQuery('#ecwd_event_venue').length > 0) {
430
+ var ecwd_event_venue_controller = new ecwd_event_venue_controller();
431
+ ecwd_event_venue_controller.init(jQuery('#ecwd_event_venue'));
432
+ }
433
+
434
+ function ecwd_event_venue_controller()
435
+ {
436
+
437
+ this.$event_venue = null;
438
+ this.$infoTable = null;
439
+ this.$formTable = null;
440
+ this.$addVenueButtonContainer = null;
441
+ this.$editVenueButtonContainer = null;
442
+ this.$mapTable = null;
443
+ this.$location = null;
444
+ this.$latLongContainer = null;
445
+ this.$showMapContainer = null;
446
+ this.$showMapCheckbox = null;
447
+ this.$addVenueSpinner = null;
448
+
449
+ this.init = function (event_venue)
450
+ {
451
+ this.$event_venue = event_venue;
452
+
453
+ this.$infoTable = jQuery('.ecwd_event_venue_info_content');
454
+ this.$formTable = jQuery('.ecwd_event_venue_form_content');
455
+ this.$mapTable = jQuery('.ecwd_event_venue_map_content');
456
+
457
+ this.$latLongContainer = this.$mapTable.find('.ecwd_event_venue_lat_long');
458
+ this.$location = jQuery('#ecwd_event_location');
459
+ this.$showMapContainer = jQuery('.ecwd_venue_show_map_checkbox_container');
460
+ this.$showMapCheckbox = jQuery('#ecwd_venue_show_map');
461
+
462
+ this.$editVenueButtonContainer = jQuery('.ecwd_event_venue_edit_link_container');
463
+ this.$addVenueButtonContainer = jQuery('.ecwd_event_venue_add_button_container');
464
+
465
+ this.$addVenueSpinner = this.$addVenueButtonContainer.find('.spinner');
466
+
467
+ this.onChangeVenue();
468
+ this.addNewVenue();
469
+
470
+ this.$event_venue.trigger('change');
471
+ };
472
+
473
+ this.addNewVenue = function ()
474
+ {
475
+ var _this = this;
476
+
477
+ var newVenueFields = {
478
+ title: _this.$formTable.find('.ecwd_event_venue_title_field'),
479
+ content: _this.$formTable.find('.ecwd_event_venue_content_field'),
480
+ phone: _this.$formTable.find('.ecwd_event_venue_phone_field'),
481
+ website: _this.$formTable.find('.ecwd_event_venue_website_field'),
482
+ showMap: _this.$showMapCheckbox,
483
+ location: _this.$location,
484
+ latLng: _this.$mapTable.find('#ecwd_lat_long'),
485
+ zoom: _this.$mapTable.find('#ecwd_map_zoom'),
486
+ };
487
+
488
+ this.$addVenueButtonContainer.on('click', function (e)
489
+ {
490
+ e.preventDefault();
491
+
492
+ if (_this.$event_venue.val() !== "new") {
493
+ return false;
494
+ }
495
+
496
+ if (newVenueFields.title.val() == "") {
497
+ alert('Venue title is required');
498
+ return false;
499
+ }
500
+
501
+ var post_data = {
502
+ ecwd_venue_title: newVenueFields.title.val(),
503
+ ecwd_venue_content: newVenueFields.content.val(),
504
+ post_type: 'ecwd_venue',
505
+ ecwd_event_location: newVenueFields.location.val(),
506
+ ecwd_venue_meta_phone: newVenueFields.phone.val(),
507
+ ecwd_venue_meta_website: newVenueFields.website.val(),
508
+ ecwd_venue_show_map: (newVenueFields.showMap.is(':checked')) ? '1' : 'no',
509
+ ecwd_lat_long: newVenueFields.latLng.val(),
510
+ ecwd_map_zoom: newVenueFields.zoom.val()
511
+ };
512
+
513
+ for (var i in newVenueFields) {
514
+ newVenueFields[i].attr('disabled', true);
515
+ }
516
+ _this.$addVenueButtonContainer.attr('disabled', true);
517
+ _this.$latLongContainer.find('input').attr('disabled', true);
518
+
519
+ _this.$addVenueSpinner.addClass('is-active');
520
+
521
+ var response = add_new_post(post_data);
522
+
523
+ ecwd_venues[response.venue_data.id] = response.venue_data;
524
+
525
+ if (response.success == true) {
526
+ var option = "<option value='" + response.venue_data.id + "'>" + response.venue_data.post_title + "</option>";
527
+ _this.$event_venue.find('optgroup').prepend(option);
528
+ _this.$event_venue.val(response.venue_data.id);
529
+ } else {
530
+ _this.$event_venue.val('0');
531
+ }
532
+ _this.$event_venue.trigger('change');
533
+
534
+
535
+ for (var i in newVenueFields) {
536
+ newVenueFields[i].attr('disabled', false);
537
+
538
+ if (i == "ecwd_event_location" || i == "ecwd_venue_show_map") {
539
+ continue;
540
+ } else
541
+ if (i == "ecwd_map_zoom") {
542
+ newVenueFields[i].val('17');
543
+ } else {
544
+ newVenueFields[i].val('');
545
+ }
546
+
547
+ }
548
+ _this.$addVenueButtonContainer.attr('disabled', false);
549
+ _this.$latLongContainer.find('input').attr('disabled', false);
550
+ _this.$addVenueSpinner.removeClass('is-active');
551
+
552
+ jQuery('html, body').animate({
553
+ scrollTop: jQuery("#ecwd_event_venue_meta").offset().top
554
+ }, 1000);
555
+
556
+ return false;
557
+ });
558
+ };
559
+
560
+ this.onChangeVenue = function ()
561
+ {
562
+ var _this = this;
563
+ this.$event_venue.change(function (e)
564
+ {
565
+ var selectValue = $(this).val();
566
+
567
+ if (selectValue == "0") {
568
+ _this.noneVenue();
569
+ return;
570
+ }
571
+
572
+ if (selectValue == 'new') {
573
+ _this.newVenueForm();
574
+ return;
575
+ }
576
+
577
+ if (parseInt(selectValue) > 0) {
578
+
579
+ _this.changeVenueInfo(parseInt(selectValue));
580
+
581
+ }
582
+
583
+
584
+ });
585
+ };
586
+
587
+ this.noneVenue = function ()
588
+ {
589
+ this.$infoTable.addClass('ecwd_hidden');
590
+ this.$formTable.addClass('ecwd_hidden');
591
+ this.$editVenueButtonContainer.addClass('ecwd_hidden');
592
+ this.$addVenueButtonContainer.addClass('ecwd_hidden');
593
+ this.$location.addClass('ecwd_hidden');
594
+ this.$mapTable.find('.ecwd_google_map').addClass('ecwd-hide-map');
595
+ this.$mapTable.find('th, td').addClass('ecwd-hide-map-td');
596
+ this.$mapTable.find('.ecwd_venue_meta_decription').addClass('ecwd_hidden');
597
+ };
598
+
599
+ this.newVenueForm = function ()
600
+ {
601
+
602
+ if (typeof google !== "undefined" && typeof map !== "undefined") {
603
+ var myLatlng = new google.maps.LatLng(parseFloat(40.712784), parseFloat(-74.005941));
604
+
605
+ deleteMarkers();
606
+ addMarker(myLatlng, true);
607
+
608
+ map.setCenter(myLatlng);
609
+ map.setZoom(17);
610
+ $('#ecwd_map_zoom').val(17);
611
+
612
+ this.$latLongContainer.removeClass('ecwd_hidden');
613
+ }
614
+
615
+ this.$mapTable.find('.ecwd_venue_meta_decription').removeClass('ecwd_hidden');
616
+
617
+ this.$infoTable.addClass('ecwd_hidden');
618
+ this.$editVenueButtonContainer.addClass('ecwd_hidden');
619
+
620
+ this.$formTable.removeClass('ecwd_hidden');
621
+ this.$addVenueButtonContainer.removeClass('ecwd_hidden');
622
+
623
+ this.$location.removeClass('ecwd_hidden');
624
+ this.$showMapContainer.removeClass('ecwd_hidden');
625
+ this.$mapTable.find('th, td').removeClass('ecwd-hide-map-td');
626
+
627
+ this.$showMapCheckbox.prop('checked', false);
628
+ this.$showMapCheckbox.trigger('change');
629
+
630
+ };
631
+
632
+ this.changeVenueInfo = function (venueID)
633
+ {
634
+
635
+ this.$formTable.addClass('ecwd_hidden');
636
+ this.$addVenueButtonContainer.addClass('ecwd_hidden');
637
+
638
+ this.$infoTable.removeClass('ecwd_hidden');
639
+ this.$editVenueButtonContainer.removeClass('ecwd_hidden');
640
+
641
+ this.$mapTable.find('.ecwd_venue_meta_decription').removeClass('ecwd_hidden');
642
+
643
+ var venue = ecwd_venues[venueID];
644
+
645
+ this.$infoTable.find('.ecwd_venue_address_info').text((venue.ecwd_venue_location != "") ? venue.ecwd_venue_location : "None");
646
+ this.$infoTable.find('.ecwd_venue_phone_info').text((venue.ecwd_venue_meta_phone != "") ? venue.ecwd_venue_meta_phone : "None");
647
+ this.$infoTable.find('.ecwd_venue_website_info').text((venue.ecwd_venue_meta_website != "") ? venue.ecwd_venue_meta_website : "None");
648
+ this.$editVenueButtonContainer.find('.ecwd_edit_venue_link').attr('href', venue.edit_link);
649
+
650
+ this.$location.addClass('ecwd_hidden');
651
+ this.$latLongContainer.addClass('ecwd_hidden');
652
+ this.$showMapContainer.addClass('ecwd_hidden');
653
+
654
+ if (venue.ecwd_venue_show_map == '1') {
655
+
656
+ if (typeof google !== "undefined" && typeof map !== "undefined") {
657
+
658
+ var zoom = (venue.ecwd_map_zoom != "") ? parseInt(venue.ecwd_map_zoom) : 17;
659
+
660
+ var lat_long = venue.ecwd_venue_lat_long.split(',');
661
+ if (lat_long.length !== 2) {
662
+ lat_long[0] = 40.7127837;
663
+ lat_long[1] = -74.00594130000002;
664
+ }
665
+ var myLatlng = new google.maps.LatLng(parseFloat(lat_long[0]), parseFloat(lat_long[1]));
666
+
667
+ deleteMarkers();
668
+ addMarker(myLatlng, false);
669
+
670
+ map.setCenter(myLatlng);
671
+ map.setZoom(zoom);
672
+
673
+ }
674
+
675
+ this.$mapTable.find('th, td').removeClass('ecwd-hide-map-td');
676
+ this.$mapTable.find('.ecwd_google_map').removeClass('ecwd-hide-map');
677
+ } else {
678
+ this.$mapTable.find('.ecwd_google_map').addClass('ecwd-hide-map');
679
+ this.$mapTable.find('th, td').addClass('ecwd-hide-map-td');
680
+
681
+ }
682
+ };
683
+
684
+ }
685
+
686
+
687
+ function ecwd_venue_meta_controller()
688
+ {
689
 
690
  this.$container = null;
691
  this.$map_container = null;
692
  this.$description = null;
693
  var _this = this;
694
 
695
+ this.init = function ($container)
696
+ {
697
  this.$container = $container;
698
  this.$map_container = this.$container.find('.ecwd_google_map');
699
  this.$ecwd_venue_show_map = this.$container.find('#ecwd_venue_show_map');
700
  this.$description = this.$container.find('.ecwd_venue_meta_decription');
701
 
702
 
703
+ this.$ecwd_venue_show_map.on("change", function ()
704
+ {
705
 
706
  if ($(this).is(':checked')) {
707
 
731
  add_organizer_form_event_page();
732
  }
733
 
734
+ function add_organizer_form_event_page()
735
+ {
736
  var container = $('.ecwd-add_organizer-container');
737
  var form = $('.ecwd-add_organizer-container').find('.ecwd-add-organizer-form');
738
 
739
+ container.find('a.ecwd-add-organizer').on('click', function (e)
740
+ {
741
  e.preventDefault();
742
 
743
  if (form.is(":visible")) {
749
  return false;
750
  });
751
 
752
+ form.find('.ecwd-add-organizer-save').on('click', function (e)
753
+ {
754
  e.preventDefault();
755
 
756
+ var spinner = container.find('.spinner');
757
  var title = form.find('#ecwd-add-organizer-title');
758
 
759
  if (title.val() == "") {
760
+ alert("Organizer title is required");
761
  return false;
762
  }
763
 
781
  phone.attr('disabled', true);
782
  website.attr('disabled', true);
783
  jQuery(this).attr('disabled', true);
784
+ spinner.addClass('is-active');
785
 
786
  var response = add_new_post(post_data);
787
 
806
  phone.attr('disabled', false);
807
  website.attr('disabled', false);
808
  jQuery(this).attr('disabled', false);
809
+ spinner.removeClass('is-active');
810
 
811
  form.hide();
812
  return false;
814
 
815
  }
816
 
817
+ function add_new_post(post_data)
818
+ {
819
 
820
  var response = null;
821
 
829
  nonce: ecwd.ajaxnonce,
830
  post_data: post_data,
831
  },
832
+ success: function (data)
833
+ {
834
  response = data;
835
  },
836
+ error: function (data)
837
+ {
838
  response = null;
839
  }
840
  });
848
  var markers = [];
849
  var geocoder;
850
 
 
 
 
 
 
851
 
852
  var venue_metas_container = null;
853
  if (jQuery('.ecwd-venue-meta-fields').length > 0) {
854
  venue_metas_container = jQuery('.ecwd-venue-meta-fields');
855
  }
856
 
857
+ function initialize()
858
+ {
859
  geocoder = new google.maps.Geocoder();
860
 
861
  var lat_long = document.getElementById('ecwd_lat_long').value.split(',');
883
  mapOptions);
884
 
885
  if (!lat_long_available && navigator.geolocation) {
886
+ navigator.geolocation.getCurrentPosition(function (position)
887
+ {
888
  initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
889
  map.setCenter(initialLocation);
890
  });
893
  var ecwd_typing_timer = null;
894
  var $inputs = jQuery('#ecwd_longitude, #ecwd_latitude');
895
 
896
+ $inputs.on('keyup', function ()
897
+ {
898
  clearTimeout(ecwd_typing_timer);
899
+ ecwd_typing_timer = setTimeout(function ()
900
+ {
901
  var latlng = new google.maps.LatLng(jQuery('#ecwd_latitude').val(), jQuery('#ecwd_longitude').val());
902
  deleteMarkers();
903
  geocodePosition(latlng);
906
  }, 1000);
907
  });
908
 
909
+ $inputs.on('keydown', function ()
910
+ {
911
  clearTimeout(ecwd_typing_timer);
912
  });
913
 
916
 
917
  var types = document.getElementById('type-selector');
918
  if (venue_metas_container == null) {
919
+ // map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
920
  }
921
  var autocomplete = new google.maps.places.Autocomplete(input);
922
  autocomplete.bindTo('bounds', map);
929
  });
930
  markers.push(address_marker);
931
 
932
+ google.maps.event.addListener(autocomplete, 'place_changed', function ()
933
+ {
934
  infowindow.close();
935
  address_marker.setVisible(false);
936
+
 
 
937
  var place = autocomplete.getPlace();
938
  if (!place.geometry) {
939
  return;
981
  infowindow.open(map, address_marker);
982
  });
983
 
984
+ google.maps.event.addListener(map, 'click', function (event)
985
+ {
986
+
987
+ if (map.ecwd_draggable_marker == false) {
988
+ return;
989
+ }
990
+
991
+
992
  deleteMarkers();
993
  geocodePosition(event.latLng);
994
  addMarker(event.latLng);
 
 
 
995
  });
996
+
997
+ google.maps.event.addListener(address_marker, 'dragend', function ()
998
+ {
999
+
1000
+ if (map.ecwd_draggable_marker == false) {
1001
+ return;
1002
+ }
1003
+
1004
+
1005
  setMarkerPosition(address_marker);
1006
  geocodePosition(address_marker.getPosition());
 
 
 
1007
  });
1008
+ google.maps.event.addListener(map, 'zoom_changed', function ()
1009
+ {
1010
  jQuery('#ecwd_map_zoom').val(map.getZoom());
1011
  });
1012
 
1013
  if (ecwd_marker == 1) {
 
 
 
1014
 
1015
+ var draggable = true;
1016
+ var ecwd_event_venue_select = jQuery('#ecwd_event_venue');
1017
+ if (ecwd_event_venue_select.length > 0 && ecwd_event_venue_select.val() != '0' && ecwd_event_venue_select.val() != 'new') {
1018
+ draggable = false;
 
 
 
 
 
 
 
 
1019
  }
 
1020
 
 
 
 
 
 
 
 
 
 
1021
 
1022
+ var infowindow = new google.maps.InfoWindow();
1023
+ addMarker(myLatlng, draggable);
1024
+ var loc = document.getElementById('ecwd_event_location').value;
 
 
 
 
1025
 
 
 
1026
  }
 
1027
  }
1028
 
1029
  // Add a marker to the map and push to the array.
1030
+ function addMarker(location, draggable)
1031
+ {
1032
+ if (typeof draggable == "undefined") {
1033
+ draggable = draggable;
1034
+ }
1035
+
1036
+ map.ecwd_draggable_marker = draggable;
1037
+
1038
  var marker = new google.maps.Marker({
1039
  position: location,
1040
  map: map,
1042
  });
1043
  markers.push(marker);
1044
  setMarkerPosition(marker);
1045
+ google.maps.event.addListener(marker, 'dragend', function (event)
1046
+ {
1047
+
1048
+ if (map.ecwd_draggable_marker === false) {
1049
+ return;
1050
+ }
1051
+
1052
+
1053
  setMarkerPosition(marker);
1054
  geocodePosition(marker.getPosition());
 
 
 
1055
  });
1056
+ return marker;
1057
  }
1058
 
1059
  // Sets the map on all markers in the array.
1060
+ function setAllMap(map)
1061
+ {
1062
  for (var i = 0; i < markers.length; i++) {
1063
  markers[i].setMap(map);
1064
  }
1065
  }
1066
 
1067
  // Removes the markers from the map, but keeps them in the array.
1068
+ function clearMarkers()
1069
+ {
1070
  setAllMap(null);
1071
  }
1072
 
1073
  // Shows any markers currently in the array.
1074
+ function showMarkers()
1075
+ {
1076
  setAllMap(map);
1077
  }
1078
 
1079
  // Deletes all markers in the array by removing references to them.
1080
+ function deleteMarkers()
1081
+ {
1082
  clearMarkers();
1083
  markers = [];
1084
  }
1085
 
1086
+ function setMarkerPosition(marker)
1087
+ {
1088
  var lat_long_val = marker.getPosition().toUrlValue();
1089
  document.getElementById('ecwd_lat_long').value = lat_long_val;
1090
  var lat_long_data = lat_long_val.split(',');
1094
  }
1095
  }
1096
 
1097
+ function geocodePosition(pos)
1098
+ {
1099
  geocoder.geocode({
1100
  latLng: pos
1101
+ }, function (responses)
1102
+ {
1103
  if (responses && responses.length > 0) {
1104
  updateMarkerAddress(responses[0].formatted_address);
1105
  } else {
1107
  }
1108
  });
1109
  }
1110
+ function updateMarkerAddress(address)
1111
+ {
1112
  document.getElementById('ecwd_event_location').value = address;
1113
 
1114
  }
1115
 
1116
+ function loadScript()
1117
+ {
1118
  if (ecwd.gmap_key == "") {
1119
  return;
1120
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-event-calendar-wd.html
4
  Tags: calendar, date, event, event calendar, events, events calendar, meeting, organizer, recurring, reservation, responsive, schedule
5
  Requires at least: 3.9
6
  Tested up to: 4.8
7
- Stable tag: 1.0.97
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -247,6 +247,12 @@ After downloading the ZIP file of the Event Calendar WD plugin,
247
 
248
  == Changelog ==
249
 
 
 
 
 
 
 
250
  = 1.0.97 =
251
  * Fixed: Remove duplicated post contents form venues and organizers
252
 
4
  Tags: calendar, date, event, event calendar, events, events calendar, meeting, organizer, recurring, reservation, responsive, schedule
5
  Requires at least: 3.9
6
  Tested up to: 4.8
7
+ Stable tag: 1.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
247
 
248
  == Changelog ==
249
 
250
+ = 1.1.0 =
251
+ * Changed: Improved UI of venue editor in event page
252
+ * Fixed: Displayed date and time for one day event
253
+ * Fixed: Fatal error if PHP Calendar module not loaded
254
+ * Fixed: Add new venue from event editor page
255
+
256
  = 1.0.97 =
257
  * Fixed: Remove duplicated post contents form venues and organizers
258
 
views/admin/ecwd-event-meta.php CHANGED
@@ -7,12 +7,7 @@ $post_id = $post->ID;
7
  $meta = get_post_meta($post_id);
8
 
9
  // Load up all post meta data
10
- $ecwd_event_venue = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_venue', true);
11
- $ecwd_event_location = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_location', true);
12
- $ecwd_event_show_map = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_show_map', true);
13
- $ecwd_map_zoom = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_map_zoom', true);
14
 
15
- $ecwd_lat_long = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_lat_long', true);
16
  $ecwd_event_date_from = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_date_from', true);
17
  $ecwd_event_date_to = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_date_to', true);
18
  $ecwd_event_url = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_url', true);
@@ -24,43 +19,7 @@ $ecwd_event_day = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_day', tr
24
  if (!is_array($ecwd_event_day)) {
25
  $ecwd_event_day = array();
26
  }
27
- $ecwd_venue_meta_phone = $ecwd_venue_meta_website = $venue_meta_show_map = "";
28
- $venue_title = $venue_content = "";
29
-
30
- $venues_meta_data = array();
31
-
32
- $venue_meta_keys = array(
33
- 'ecwd_venue_meta_phone',
34
- 'ecwd_venue_meta_website',
35
- 'ecwd_venue_show_map',
36
- 'ecwd_venue_location',
37
- 'ecwd_venue_lat_long',
38
- 'ecwd_map_zoom'
39
- );
40
- $has_selected_venue = false;
41
- if (!empty($venues)) {
42
-
43
- foreach ($venues as $venue) {
44
- $venues_meta_data[$venue->ID] = array();
45
-
46
- foreach ($venue_meta_keys as $venue_meta_key) {
47
- $venues_meta_data[$venue->ID][$venue_meta_key] = get_post_meta($venue->ID, $venue_meta_key, true);
48
- }
49
-
50
- if ($venue->ID == $ecwd_event_venue) {
51
- $has_selected_venue = true;
52
- $venue_meta_show_map = $venues_meta_data[$ecwd_event_venue]['ecwd_venue_show_map'];
53
- }
54
-
55
- // if ($venue->ID == $ecwd_event_venue) {
56
- // $ecwd_venue_meta_phone = $venues_meta_data[$ecwd_event_venue]['ecwd_venue_meta_phone'];
57
- // $ecwd_venue_meta_website = $venues_meta_data[$ecwd_event_venue]['ecwd_venue_meta_website'];
58
-
59
- // $venue_title = $venue->post_title;
60
- // $venue_content = $venue->post_content;
61
- // }
62
- }
63
- }
64
  $ecwd_event_repeat_month_on_days = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_repeat_month_on_days', true);
65
  if (!$ecwd_event_repeat_month_on_days) {
66
  $ecwd_event_repeat_month_on_days = 1;
@@ -486,171 +445,7 @@ $ecwd_event_video = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_video'
486
  </tr>
487
  <?php } ?>
488
 
489
- <tr>
490
- <th scope="row"><?php _e('Event Venue', 'ecwd'); ?></th>
491
- <td>
492
-
493
- <select name="ecwd_event_venue" id="ecwd_event_venue">
494
- <option value="0">None</option>
495
- <?php
496
- if (!empty($venues)) {
497
- foreach ($venues as $venue) {
498
-
499
-
500
- $options_attr = "";
501
- $options_attr .= 'data-venuetitle="' . $venue->post_title . '" ';
502
- $options_attr .= 'data-venuecontent="' . $venue->post_content . '" ';
503
- $options_attr .= 'data-location="' . $venues_meta_data[$venue->ID]['ecwd_venue_location'] . '" ';
504
- $options_attr .= 'data-marker="' . $venues_meta_data[$venue->ID]['ecwd_venue_lat_long'] . '" ';
505
- $options_attr .= 'data-zoom="' . $venues_meta_data[$venue->ID]['ecwd_map_zoom'] . '" ';
506
- $options_attr .= 'data-metaphone="' . $venues_meta_data[$venue->ID]['ecwd_venue_meta_phone'] . '" ';
507
- $options_attr .= 'data-metawebsite="' . $venues_meta_data[$venue->ID]['ecwd_venue_meta_website'] . '" ';
508
- $options_attr .= 'data-showmap="' . $venues_meta_data[$venue->ID]['ecwd_venue_show_map'] . '" ';
509
-
510
- ?>
511
- <option
512
- value="<?php echo $venue->ID; ?>"
513
- <?php echo $options_attr; ?>
514
- <?php echo selected($venue->ID, $ecwd_event_venue); ?>>
515
- <?php echo $venue->post_title; ?>
516
- </option>
517
- <?php
518
- }
519
- }
520
- $venue_fields_style = ($has_selected_venue == '1') ? "style='display:none;'" : "";
521
- ?>
522
- </select>
523
-
524
- <p class="description">
525
- <?php _e('Select the venue of the event.', 'ecwd'); ?>
526
- </p>
527
-
528
- <div class="ecwd-venue-meta-fields">
529
- <!-- start ecwd_venue_title -->
530
- <div class="ecwd-meta-field" <?php echo $venue_fields_style; ?>>
531
- <label for="ecwd_venue_title">Venue Title:</label>
532
- <input type="text" name="ecwd_venue_title" id="ecwd_venue_title"
533
- value="<?php echo $venue_title; ?>" size="50"/>
534
- </div>
535
- <!-- end ecwd_venue_title -->
536
- <!-- start ecwd_venue_description -->
537
- <div class="ecwd-meta-field" <?php echo $venue_fields_style; ?>>
538
- <label style="vertical-align: top;" for="ecwd_venue_content">Venue Description:</label>
539
- <textarea name="ecwd_venue_content" id="ecwd_venue_content"><?php echo $venue_content; ?></textarea>
540
- </div>
541
- <!-- end ecwd_venue_description -->
542
- <!-- start ecwd_event_location -->
543
- <div class="ecwd-meta-field">
544
- <label for="ecwd_event_location">Address:</label>
545
- <input type="text" name="ecwd_event_location" id="ecwd_event_location"
546
- value="<?php echo $ecwd_event_location; ?>" size="40"/>
547
- </div>
548
- <!-- end ecwd_event_location -->
549
- <!-- start ecwd_venue_meta_phone -->
550
- <div class="ecwd-meta-field" <?php echo $venue_fields_style; ?>>
551
- <label for="ecwd_venue_meta_phone">Phone:</label>
552
- <input type="text" name="ecwd_venue_meta_phone"
553
- id="ecwd_venue_meta_phone" value="<?php echo $ecwd_venue_meta_phone; ?>"/>
554
- </div>
555
- <!-- end ecwd_venue_meta_phone -->
556
- <!-- start ecwd_venue_meta_website -->
557
- <div class="ecwd-meta-field" <?php echo $venue_fields_style; ?>>
558
- <label for="ecwd_venue_meta_website">Website:</label>
559
- <input type="text" name="ecwd_venue_meta_website"
560
- id="ecwd_venue_meta_website" value="<?php echo $ecwd_venue_meta_website; ?>"/>
561
- </div>
562
- <!-- end ecwd_venue_meta_website -->
563
- <div class="ecwd-meta-field" <?php echo $venue_fields_style; ?>>
564
- <label for="ecwd_venue_show_map">Show Google Map:</label>
565
- <div class="checkbox-div">
566
- <input type='checkbox' class='ecwd_venue_show_map' id='ecwd_venue_show_map'
567
- name='ecwd_venue_show_map' value="1" <?php checked($venue_meta_show_map, 1); ?>/>
568
- <label for="ecwd_venue_show_map"></label>
569
- </div>
570
- </div>
571
-
572
- </div>
573
- <?php
574
-
575
- $ecwd_marker = 1;
576
- if (!$ecwd_lat_long) {
577
- $ecwd_lat_long = $lat . ',' . $long;
578
- $ecwd_marker = 0;
579
- }
580
-
581
- $latitude = $longitude = '';
582
- if (!empty($ecwd_lat_long)) {
583
- $lat_long_data = explode(',', $ecwd_lat_long);
584
- if (is_array($lat_long_data) && count($lat_long_data) == 2) {
585
- $latitude = $lat_long_data[0];
586
- $longitude = $lat_long_data[1];
587
- }
588
- }
589
-
590
- $gmap_key = (isset($ecwd_options['gmap_key'])) ? trim($ecwd_options['gmap_key']) : "";
591
-
592
- $venue_description_class = ($venue_meta_show_map !== '1') ? 'ecwd_hidden' : '';
593
- $venue_description_class .= ' description ecwd_venue_meta_decription';
594
- if (!empty($gmap_key)) {
595
- $venue_map_class = ($venue_meta_show_map !== '1') ? "ecwd-hide-map" : "";
596
- ?>
597
-
598
- <div class="ecwd_google_map_wrapper">
599
- <div class="ecwd_google_map <?php echo $venue_map_class; ?>">
600
- <?php
601
-
602
- if (!$ecwd_map_zoom) {
603
- $ecwd_map_zoom = 17;
604
- }
605
-
606
- $ecwd_marker = 1;
607
- if (!$ecwd_lat_long) {
608
- $ecwd_map_zoom = 9;
609
- $ecwd_lat_long = $lat . ',' . $long;
610
- $ecwd_marker = 0;
611
- }
612
- ?>
613
- <input type="hidden" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_lat_long"
614
- id="<?php echo ECWD_PLUGIN_PREFIX; ?>_lat_long"
615
- value="<?php echo $ecwd_lat_long; ?>"/>
616
- <input type="hidden" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_marker"
617
- id="<?php echo ECWD_PLUGIN_PREFIX; ?>_marker" value="<?php echo $ecwd_marker; ?>"/>
618
- <input type="hidden" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_map_zoom"
619
- id="<?php echo ECWD_PLUGIN_PREFIX; ?>_map_zoom"
620
- value="<?php echo $ecwd_map_zoom; ?>"/>
621
-
622
- <div id="map-canvas" style="width: 100%; height: 300px; min-height: 300px;"></div>
623
-
624
- <?php
625
- $latitude = $longitude = '';
626
- if (!empty($ecwd_lat_long)) {
627
- $lat_long_data = explode(',', $ecwd_lat_long);
628
- if (is_array($lat_long_data) && count($lat_long_data) == 2) {
629
- $latitude = $lat_long_data[0];
630
- $longitude = $lat_long_data[1];
631
- }
632
- }
633
- ?>
634
-
635
- <label style="width:85px;display:inline-block;" for="ecwd_latitude">Latitude:</label>
636
- <input type="text" id="ecwd_latitude" value="<?php echo $latitude; ?>"/>
637
- <br/>
638
- <label style="width:85px;display:inline-block;" for="ecwd_longitude">Longitude:</label>
639
- <input type="text" id="ecwd_longitude" value="<?php echo $longitude; ?>"/>
640
- </div>
641
- </div>
642
- <p class="<?php echo $venue_description_class; ?>">
643
- <?php _e('If venue is not specified you can fill in the address of the event location or click on the map to drag and drop the marker to the event location.', 'ecwd'); ?>
644
- </p>
645
- <?php } else { ?>
646
- <label></label>
647
- <span class="<?php echo $venue_description_class; ?>">
648
- <?php _e('Gmap key does not exist', 'ecwd'); ?>
649
- <a href="edit.php?post_type=ecwd_event&page=ecwd_general_settings&tab=google_map">Settings page</a>
650
- </span>
651
- <?php } ?>
652
- </td>
653
- </tr>
654
  <tr>
655
  <th scope="row"><?php _e('Event URL', 'ecwd'); ?></th>
656
  <td>
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);
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;
445
  </tr>
446
  <?php } ?>
447
 
448
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  <tr>
450
  <th scope="row"><?php _e('Event URL', 'ecwd'); ?></th>
451
  <td>
views/admin/ecwd-event-organizers-meta.php CHANGED
@@ -27,7 +27,7 @@ if (!$event_organizers || $event_organizers == '' || !is_array($event_organizers
27
 
28
  <!-- start ecwd-add-organizer-title -->
29
  <div class="ecwd-meta-field">
30
- <label for="ecwd-add-organizer-title">Title:</label>
31
  <input type="text" name="ecwd-add-organizer-title" id="ecwd-add-organizer-title"/>
32
  </div>
33
  <!-- end ecwd-add-organizer-title -->
@@ -50,9 +50,11 @@ if (!$event_organizers || $event_organizers == '' || !is_array($event_organizers
50
  <label for="ecwd_organizer_meta_website">Website:</label>
51
  <input type="text" name="ecwd_organizer_meta_website" id="ecwd_organizer_meta_website"/>
52
  </div>
53
- <div>
54
- <button
55
- class="button button-primary button-large ecwd-add-organizer-save"><?php _e('Save', 'ecwd'); ?></button>
 
 
56
  </div>
57
  <div class="ecwd-organizer-template" style="display: none">
58
  <p>
27
 
28
  <!-- start ecwd-add-organizer-title -->
29
  <div class="ecwd-meta-field">
30
+ <label for="ecwd-add-organizer-title">Title:<span style="color:#c60d0d"> *</span></label>
31
  <input type="text" name="ecwd-add-organizer-title" id="ecwd-add-organizer-title"/>
32
  </div>
33
  <!-- end ecwd-add-organizer-title -->
50
  <label for="ecwd_organizer_meta_website">Website:</label>
51
  <input type="text" name="ecwd_organizer_meta_website" id="ecwd_organizer_meta_website"/>
52
  </div>
53
+ <div style="display: inline-block;">
54
+ <button class="button button-primary button-large ecwd-add-organizer-save">
55
+ <?php _e('Save Organizer', 'ecwd'); ?>
56
+ </button>
57
+ <span class="spinner"></span>
58
  </div>
59
  <div class="ecwd-organizer-template" style="display: none">
60
  <p>
views/admin/ecwd-event-venues-meta.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 = '';
14
+ $ecwd_venue_meta_phone = "";
15
+ $ecwd_venue_meta_website = "";
16
+ $venue_meta_show_map = "";
17
+ $venue_title = "";
18
+ $venue_content = "";
19
+
20
+ $venue_meta_keys = array(
21
+ 'ecwd_venue_meta_phone',
22
+ 'ecwd_venue_meta_website',
23
+ 'ecwd_venue_show_map',
24
+ 'ecwd_venue_location',
25
+ 'ecwd_venue_lat_long',
26
+ 'ecwd_map_zoom'
27
+ );
28
+ $has_selected_venue = false;
29
+
30
+ $args = array(
31
+ 'post_type' => ECWD_PLUGIN_PREFIX . '_venue',
32
+ 'post_status' => 'publish',
33
+ 'posts_per_page' => -1,
34
+ 'ignore_sticky_posts' => 1
35
+ );
36
+
37
+ $venues_meta_data = array();
38
+ $venues = get_posts($args);
39
+ $selected_venue_metadata = null;
40
+
41
+ if (!empty($venues)) {
42
+
43
+ foreach ($venues as $venue) {
44
+ $venues_meta_data[$venue->ID] = array();
45
+
46
+ $venues_meta_data[$venue->ID]['post_title'] = $venue->post_title;
47
+
48
+ foreach ($venue_meta_keys as $venue_meta_key) {
49
+ $venues_meta_data[$venue->ID][$venue_meta_key] = get_post_meta($venue->ID, $venue_meta_key, true);
50
+ }
51
+
52
+ $venues_meta_data[$venue->ID]['edit_link'] = 'post.php?post=' . $venue->ID . '&action=edit';
53
+
54
+ if ($venue->ID == $ecwd_event_venue) {
55
+ $selected_venue_metadata = $venues_meta_data[$ecwd_event_venue];
56
+ $has_selected_venue = true;
57
+ $venue_meta_show_map = $venues_meta_data[$ecwd_event_venue]['ecwd_venue_show_map'];
58
+ }
59
+
60
+ }
61
+ }
62
+
63
+
64
+ wp_localize_script('ecwd-admin-scripts', "ecwd_venues", $venues_meta_data);
65
+
66
+
67
+ $info_table_class = "ecwd_event_venue_info_content" . (($selected_venue_metadata == null) ? " ecwd_hidden" : "");
68
+ $form_table_class = "ecwd_event_venue_form_content" . (($selected_venue_metadata == null) ? "" : " ecwd_hidden");
69
+ $map_table_class = "ecwd_event_venue_map_content";
70
+ ?>
71
+ <table class="form-table">
72
+ <tr>
73
+ <th scope="row"><?php _e('Event Venue', 'ecwd'); ?>:</th>
74
+ <td>
75
+ <select name="ecwd_event_venue" id="ecwd_event_venue">
76
+ <option value="0">None</option>
77
+ <option value="new">Create New</option>
78
+ <optgroup label="Choose venue">
79
+ <?php
80
+ if (!empty($venues)) { ?>
81
+ <?php foreach ($venues as $venue) { ?>
82
+ <option value="<?php echo $venue->ID; ?>" <?php echo selected($venue->ID, $ecwd_event_venue); ?>>
83
+ <?php echo $venue->post_title; ?>
84
+ </option>
85
+ <?php
86
+ } ?>
87
+ <?php
88
+ }
89
+ ?>
90
+ </optgroup>
91
+ </select>
92
+ <p class="description"><?php _e('Select the venue of the event.', 'ecwd'); ?></p>
93
+ </td>
94
+ </tr>
95
+ <tbody class="<?php echo $info_table_class; ?>">
96
+ <tr class="ecwd_venue_info_field">
97
+ <th><?php _e('Address:', 'ecwd'); ?></th>
98
+ <td class="ecwd_venue_address_info">
99
+ <?php echo (isset($selected_venue_metadata['ecwd_venue_location'])) ? $selected_venue_metadata['ecwd_venue_location'] : ""; ?>
100
+ </td>
101
+ </tr>
102
+ <tr class="ecwd_venue_info_field">
103
+ <th><?php _e('Phone:', 'ecwd'); ?></th>
104
+ <td class="ecwd_venue_phone_info">
105
+ <?php echo (isset($selected_venue_metadata['ecwd_venue_meta_phone'])) ? $selected_venue_metadata['ecwd_venue_meta_phone'] : ""; ?>
106
+ </td>
107
+ </tr>
108
+ <tr class="ecwd_venue_info_field">
109
+ <th><?php _e('Website:', 'ecwd'); ?></th>
110
+ <td class="ecwd_venue_website_info">
111
+ <?php echo (isset($selected_venue_metadata['ecwd_venue_meta_website'])) ? $selected_venue_metadata['ecwd_venue_meta_website'] : ""; ?>
112
+ </td>
113
+ </tr>
114
+ </tbody>
115
+ <tbody class="<?php echo $form_table_class; ?>">
116
+ <tr class="ecwd_venue_form_field">
117
+ <th>Title:<span style="color:#c60d0d"> *</span></th>
118
+ <td class="ecwd_venue_phone_field">
119
+ <input type="text" class="ecwd_event_venue_title_field"/>
120
+ </td>
121
+ </tr>
122
+ <tr class="ecwd_venue_form_field">
123
+ <th>Description:</th>
124
+ <td class="ecwd_venue_phone_field">
125
+ <textarea class="ecwd_event_venue_content_field"></textarea>
126
+ </td>
127
+ </tr>
128
+ <tr class="ecwd_venue_form_field">
129
+ <th>Phone:</th>
130
+ <td class="ecwd_venue_phone_field">
131
+ <input type="text" class="ecwd_event_venue_phone_field"/>
132
+ </td>
133
+ </tr>
134
+ <tr class="ecwd_venue_form_field">
135
+ <th>Website:</th>
136
+ <td class="ecwd_venue_phone_field">
137
+ <input type="text" class="ecwd_event_venue_website_field"/>
138
+ </td>
139
+ </tr>
140
+ </tbody>
141
+ <tbody class="<?php echo $map_table_class; ?>">
142
+ <?php
143
+
144
+ $map_td_th_class = '';
145
+ if ($selected_venue_metadata !== null) {
146
+ if ($venue_meta_show_map !== '1') {
147
+ $map_td_th_class = 'ecwd-hide-map-td';
148
+ }
149
+ }
150
+
151
+ $location_field_class = ($selected_venue_metadata == null) ? '' : "ecwd_hidden";
152
+
153
+ ?>
154
+ <tr>
155
+ <th class="<?php echo $map_td_th_class; ?>">Address:</th>
156
+ <td class="<?php echo $map_td_th_class; ?>">
157
+ <!-- start ecwd_event_location -->
158
+ <div class="ecwd-meta-field">
159
+ <input type="text" name="ecwd_event_location" id="ecwd_event_location"
160
+ value="<?php echo $ecwd_event_location; ?>" class="<?php echo $location_field_class; ?>"
161
+ size="40"/>
162
+ </div>
163
+ <!-- end ecwd_event_location -->
164
+ </td>
165
+ </tr>
166
+ <tr>
167
+ <th class="<?php echo $map_td_th_class; ?>">Show Google Map:</th>
168
+ <td class="<?php echo $map_td_th_class; ?>">
169
+
170
+ <?php
171
+ $ecwd_marker = 1;
172
+ if (!$ecwd_lat_long) {
173
+ $ecwd_lat_long = ',';
174
+ $ecwd_marker = 0;
175
+ }
176
+
177
+ $latitude = $longitude = '';
178
+ if (!empty($ecwd_lat_long)) {
179
+ $lat_long_data = explode(',', $ecwd_lat_long);
180
+ if (is_array($lat_long_data) && count($lat_long_data) == 2) {
181
+ $latitude = $lat_long_data[0];
182
+ $longitude = $lat_long_data[1];
183
+ }
184
+ }
185
+
186
+ $gmap_key = (isset($ecwd_options['gmap_key'])) ? trim($ecwd_options['gmap_key']) : "";
187
+
188
+ $venue_description_class = 'description ecwd_venue_meta_decription';
189
+ if ($selected_venue_metadata !== null) {
190
+ $venue_description_class .= ' ecwd_hidden';
191
+ }
192
+
193
+ $show_map_container_class = 'ecwd-meta-field ecwd_venue_show_map_checkbox_container';
194
+ if ($selected_venue_metadata !== null) {
195
+ $show_map_container_class .= ' ecwd_hidden';
196
+ }
197
+ ?>
198
+ <div class="<?php echo $show_map_container_class; ?>">
199
+ <div class="checkbox-div">
200
+ <input type='checkbox' class='ecwd_venue_show_map' id='ecwd_venue_show_map'
201
+ name='ecwd_venue_show_map' value="1" <?php checked($venue_meta_show_map, 1); ?>/>
202
+ <label for="ecwd_venue_show_map"></label>
203
+ </div>
204
+ </div>
205
+ <?php
206
+ if (!empty($gmap_key)) {
207
+ $venue_map_class = ($venue_meta_show_map !== '1') ? "ecwd-hide-map" : "";
208
+ ?>
209
+ <div class="ecwd_google_map_wrapper">
210
+ <div class="ecwd_google_map <?php echo $venue_map_class; ?>">
211
+ <?php
212
+
213
+ if (!$ecwd_map_zoom) {
214
+ $ecwd_map_zoom = 17;
215
+ }
216
+
217
+ $ecwd_marker = 1;
218
+ if (!$ecwd_lat_long) {
219
+ $ecwd_map_zoom = 9;
220
+ $ecwd_lat_long = $lat . ',' . $long;
221
+ $ecwd_marker = 0;
222
+ }
223
+ ?>
224
+ <input type="hidden" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_lat_long"
225
+ id="<?php echo ECWD_PLUGIN_PREFIX; ?>_lat_long"
226
+ value="<?php echo $ecwd_lat_long; ?>"/>
227
+ <input type="hidden" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_marker"
228
+ id="<?php echo ECWD_PLUGIN_PREFIX; ?>_marker" value="<?php echo $ecwd_marker; ?>"/>
229
+ <input type="hidden" name="<?php echo ECWD_PLUGIN_PREFIX; ?>_map_zoom"
230
+ id="<?php echo ECWD_PLUGIN_PREFIX; ?>_map_zoom"
231
+ value="<?php echo $ecwd_map_zoom; ?>"/>
232
+ <div id="map-canvas" style="width: 100%; height: 300px; min-height: 300px;"></div>
233
+ <?php
234
+ $latitude = $longitude = '';
235
+ if (!empty($ecwd_lat_long)) {
236
+ $lat_long_data = explode(',', $ecwd_lat_long);
237
+ if (is_array($lat_long_data) && count($lat_long_data) == 2) {
238
+ $latitude = $lat_long_data[0];
239
+ $longitude = $lat_long_data[1];
240
+ }
241
+ }
242
+
243
+ $lat_long_container_class = 'ecwd_event_venue_lat_long';
244
+ if ($selected_venue_metadata !== null) {
245
+ $lat_long_container_class .= ' ecwd_hidden';
246
+ }
247
+ ?>
248
+ <div class="<?php echo $lat_long_container_class; ?>">
249
+ <label style="width:85px;display:inline-block;" for="ecwd_latitude">Latitude:</label>
250
+ <input type="text" id="ecwd_latitude" value="<?php echo $latitude; ?>"/>
251
+ <br/>
252
+ <label style="width:85px;display:inline-block;" for="ecwd_longitude">Longitude:</label>
253
+ <input type="text" id="ecwd_longitude" value="<?php echo $longitude; ?>"/>
254
+ </div>
255
+ </div>
256
+ </div>
257
+ <p class="<?php echo $venue_description_class; ?>">
258
+ <?php _e('If venue is not specified you can fill in the address of the event location or click on the map to drag and drop the marker to the event location.', 'ecwd'); ?>
259
+ </p>
260
+ <?php } else { ?>
261
+ <label></label>
262
+ <span class="<?php echo $venue_description_class; ?>">
263
+ <?php _e('You need Google Maps API key to display maps.', 'ecwd'); ?>
264
+ <a href="edit.php?post_type=ecwd_event&page=ecwd_general_settings&tab=google_map">Get a key</a>
265
+ </span>
266
+ <?php } ?>
267
+ </td>
268
+ </tr>
269
+ </tbody>
270
+ <?php
271
+
272
+ $edit_link_class = "ecwd_event_venue_edit_link_container" . (($selected_venue_metadata == null) ? " ecwd_hidden" : "");
273
+ $add_button_class = "ecwd_event_venue_add_button_container" . (($selected_venue_metadata == null) ? "" : " ecwd_hidden");
274
+
275
+ ?>
276
+ <tfoot class="<?php echo $edit_link_class; ?>">
277
+ <tr>
278
+ <th>
279
+ <a class="button ecwd_edit_venue_link"
280
+ href="<?php echo (isset($selected_venue_metadata['edit_link'])) ? $selected_venue_metadata['edit_link'] : '#' ?>"
281
+ target="_blank"><?php _e('Edit Venue', 'ecwd'); ?></a>
282
+ </th>
283
+ </tr>
284
+ </tfoot>
285
+ <tfoot class="<?php echo $add_button_class; ?>">
286
+ <th>
287
+ <button class="button button-primary button-large ecwd-add-venue-save">Save Venue</button>
288
+ <span class="spinner"></span>
289
+ </th>
290
+ </tfoot>
291
+
292
+ </table>
views/admin/ecwd-featured-plugins.php CHANGED
@@ -279,7 +279,7 @@
279
  <li class="google-maps">
280
  <div class="product"></div>
281
  <div class="title">
282
- <strong class="heading">Google Map</strong>
283
  </div>
284
  <div class="description">
285
  <p>Google Maps WD is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.</p>
279
  <li class="google-maps">
280
  <div class="product"></div>
281
  <div class="title">
282
+ <strong class="heading">Google Maps</strong>
283
  </div>
284
  <div class="description">
285
  <p>Google Maps WD is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.</p>
views/admin/ecwd-venue-meta.php CHANGED
@@ -49,7 +49,7 @@ if (!$ecwd_map_zoom) {
49
  </div>
50
  <!-- end ecwd_venue_meta_website -->
51
  <div class="ecwd-meta-field">
52
- <label for="ecwd_venue_show_map">Show Google Map:</label>
53
  <input type='checkbox' id='ecwd_venue_show_map' name='ecwd_venue_show_map' value="1"
54
  <?php checked($ecwd_venue_show_map, '1'); ?>/>
55
  </div>
@@ -109,8 +109,8 @@ if (!$ecwd_map_zoom) {
109
  <?php } else { ?>
110
  <label></label>
111
  <span class="<?php echo $description_class; ?>">
112
- <?php _e('Gmap key does not exist', 'ecwd'); ?>
113
- <a href="edit.php?post_type=ecwd_event&page=ecwd_general_settings&tab=google_map">Settings page</a>
114
  </span>
115
  <?php } ?>
116
 
49
  </div>
50
  <!-- end ecwd_venue_meta_website -->
51
  <div class="ecwd-meta-field">
52
+ <label for="ecwd_venue_show_map">Show Google Maps:</label>
53
  <input type='checkbox' id='ecwd_venue_show_map' name='ecwd_venue_show_map' value="1"
54
  <?php checked($ecwd_venue_show_map, '1'); ?>/>
55
  </div>
109
  <?php } else { ?>
110
  <label></label>
111
  <span class="<?php echo $description_class; ?>">
112
+ <?php _e('You need Google Maps API key to display maps.', 'ecwd'); ?>
113
+ <a href="edit.php?post_type=ecwd_event&page=ecwd_general_settings&tab=google_map">Get a key</a>
114
  </span>
115
  <?php } ?>
116
 
views/ecwd-event-popup.php CHANGED
@@ -162,22 +162,7 @@ $event_categories = wp_get_post_terms($post->ID, 'ecwd_event_category', $args);
162
  <span class="ecwd-event-date"
163
  itemprop="startDate"
164
  content="<?php echo date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) ?>">
165
- <?php
166
- if ($ecwd_all_day_event == 1) {
167
- echo date($date_format, strtotime($ecwd_event_date_from));
168
- if ($ecwd_all_day_event == 1) {
169
- if ($ecwd_event_date_to && date($date_format, strtotime($ecwd_event_date_from)) !== date($date_format, strtotime($ecwd_event_date_to))) {
170
- echo ' - ' . date($date_format, strtotime($ecwd_event_date_to));
171
- }
172
- echo ' ' . __('All day', 'ecwd');
173
- }
174
- } else {
175
- echo date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
176
- if ($ecwd_event_date_to) {
177
- echo ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
178
- }
179
- }
180
- ?>
181
  </span>
182
  </div>
183
  <?php if (isset($ecwd_options['show_repeat_rate'])) { ?>
@@ -308,18 +293,7 @@ $event_categories = wp_get_post_terms($post->ID, 'ecwd_event_category', $args);
308
  $map_events[0]['infow'] .= '<div class="event-detalis-date">
309
  <label class="ecwd-event-date-info" title="' . __('Date', 'ecwd') . '"></label>
310
  <span class="ecwd-event-date" itemprop="startDate" content="' . date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) . '">';
311
- if ($ecwd_all_day_event == 1) {
312
- $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_from));
313
- if ($ecwd_event_date_to) {
314
- $map_events[0]['infow'] .= ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . __('All day', 'ecwd');
315
- }
316
- } else {
317
- $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
318
-
319
- if ($ecwd_event_date_to) {
320
- $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
321
- }
322
- }
323
  $map_events[0]['infow'] .= ' </span>
324
  </div>';
325
 
162
  <span class="ecwd-event-date"
163
  itemprop="startDate"
164
  content="<?php echo date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) ?>">
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'])) { ?>
293
  $map_events[0]['infow'] .= '<div class="event-detalis-date">
294
  <label class="ecwd-event-date-info" title="' . __('Date', 'ecwd') . '"></label>
295
  <span class="ecwd-event-date" itemprop="startDate" content="' . date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) . '">';
296
+ $map_events[0]['infow'] .= ECWD::get_ecwd_event_date_view($ecwd_event_date_from, $ecwd_event_date_to, $ecwd_all_day_event);
 
 
 
 
 
 
 
 
 
 
 
297
  $map_events[0]['infow'] .= ' </span>
298
  </div>';
299
 
views/single-event.php CHANGED
@@ -198,22 +198,7 @@ get_header();
198
  class="ecwd-event-date"
199
  itemprop="startDate"
200
  content="<?php echo date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) ?>">
201
- <?php if ($ecwd_all_day_event == 1) {
202
- echo date($date_format, strtotime($ecwd_event_date_from));
203
- if ($ecwd_all_day_event == 1) {
204
- if ($ecwd_event_date_to && date($date_format, strtotime($ecwd_event_date_from)) !== date($date_format, strtotime($ecwd_event_date_to))) {
205
- echo ' - ' . date($date_format, strtotime($ecwd_event_date_to));
206
- }
207
- echo ' ' . __('All day', 'ecwd');
208
- }
209
- } else {
210
- echo date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
211
-
212
- if ($ecwd_event_date_to) {
213
- echo ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
214
- }
215
- }
216
- ?>
217
  </span>
218
  </div>
219
 
@@ -326,7 +311,7 @@ get_header();
326
  </span>
327
  <?php } ?>
328
  </div>
329
-
330
  <?php do_action('ecwd_view_ext'); ?>
331
  </div>
332
  </div>
@@ -362,18 +347,8 @@ get_header();
362
  $map_events[0]['infow'] .= '<div class="event-detalis-date">
363
  <label class="ecwd-event-date-info" title="' . __('Date', 'ecwd') . '"></label>
364
  <span class="ecwd-event-date" itemprop="startDate" content="' . date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) . '">';
365
- if ($ecwd_all_day_event == 1) {
366
- $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_from));
367
- if ($ecwd_event_date_to) {
368
- $map_events[0]['infow'] .= ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . __('All day', 'ecwd');
369
- }
370
- } else {
371
- $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
372
 
373
- if ($ecwd_event_date_to) {
374
- $map_events[0]['infow'] .= ' ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
375
- }
376
- }
377
  $map_events[0]['infow'] .= '</span></div>';
378
  $markers = json_encode($map_events);
379
  ?>
198
  class="ecwd-event-date"
199
  itemprop="startDate"
200
  content="<?php echo date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) ?>">
201
+ <?php echo ECWD::get_ecwd_event_date_view($ecwd_event_date_from, $ecwd_event_date_to, $ecwd_all_day_event); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  </span>
203
  </div>
204
 
311
  </span>
312
  <?php } ?>
313
  </div>
314
+
315
  <?php do_action('ecwd_view_ext'); ?>
316
  </div>
317
  </div>
347
  $map_events[0]['infow'] .= '<div class="event-detalis-date">
348
  <label class="ecwd-event-date-info" title="' . __('Date', 'ecwd') . '"></label>
349
  <span class="ecwd-event-date" itemprop="startDate" content="' . date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) . '">';
350
+ $map_events[0]['infow'] .= ECWD::get_ecwd_event_date_view($ecwd_event_date_from, $ecwd_event_date_to, $ecwd_all_day_event);
 
 
 
 
 
 
351
 
 
 
 
 
352
  $map_events[0]['infow'] .= '</span></div>';
353
  $markers = json_encode($map_events);
354
  ?>