Event Calendar WD – Responsive Event Calendar plugin - Version 1.0.54

Version Description

New: Related events count option

Download this release

Release Info

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

Code changes from version 1.0.53 to 1.0.54

css/style.css CHANGED
@@ -288,7 +288,7 @@ div.ecwd-page-month table.cal_blue tr td:nth-child(5) div.event-details-containe
288
  div.ecwd-page-month table.cal_blue tr td:nth-child(6) div.event-details-container, div.ecwd-page-full table.cal_blue tr td:nth-child(6) div.event-details-container,
289
  div.ecwd-page-month table.cal_blue tr td:nth-child(7) div.event-details-container, div.ecwd-page-full table.cal_blue tr td:nth-child(7) div.event-details-container {
290
  left: auto;
291
- right: 100%;
292
  margin-right: 11px;
293
  }
294
  div.ecwd-page-month table.cal_blue tr td:nth-child(5) div.event-details-container, div.ecwd-page-full table.cal_blue tr td:nth-child(5) div.event-details-container .ecwd-event-arrow-right,
288
  div.ecwd-page-month table.cal_blue tr td:nth-child(6) div.event-details-container, div.ecwd-page-full table.cal_blue tr td:nth-child(6) div.event-details-container,
289
  div.ecwd-page-month table.cal_blue tr td:nth-child(7) div.event-details-container, div.ecwd-page-full table.cal_blue tr td:nth-child(7) div.event-details-container {
290
  left: auto;
291
+ /*right: 100%;*/
292
  margin-right: 11px;
293
  }
294
  div.ecwd-page-month table.cal_blue tr td:nth-child(5) div.event-details-container, div.ecwd-page-full table.cal_blue tr td:nth-child(5) div.event-details-container .ecwd-event-arrow-right,
ecwd.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Event Calendar WD
4
  * Plugin URI: https://web-dorado.com/products/wordpress-event-calendar-wd.html
5
  * Description: Event Calendar WD is an easy event management and planning tool with advanced features.
6
- * Version: 1.0.53
7
  * Author: WebDorado
8
  * Author URI: http://web-dorado.com
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
3
  * Plugin Name: Event Calendar WD
4
  * Plugin URI: https://web-dorado.com/products/wordpress-event-calendar-wd.html
5
  * Description: Event Calendar WD is an easy event management and planning tool with advanced features.
6
+ * Version: 1.0.54
7
  * Author: WebDorado
8
  * Author URI: http://web-dorado.com
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
ecwd_admin_class.php CHANGED
@@ -6,7 +6,7 @@
6
  class ECWD_Admin {
7
 
8
  protected static $instance = null;
9
- protected $version = '1.0.53';
10
  protected $ecwd_page = null;
11
  protected $notices = null;
12
 
6
  class ECWD_Admin {
7
 
8
  protected static $instance = null;
9
+ protected $version = '1.0.54';
10
  protected $ecwd_page = null;
11
  protected $notices = null;
12
 
ecwd_class.php CHANGED
@@ -6,199 +6,219 @@
6
  */
7
  class ECWD {
8
 
9
- protected $version = '1.0.53';
10
- protected $plugin_name = 'event-calendar-wd';
11
- protected $prefix = 'ecwd';
12
- protected static $instance = null;
13
-
14
- private function __construct() {
15
-
16
- $this->setup_constants();
17
- add_action( 'init', array( $this, 'add_localization' ), 1 );
18
- include_once( 'includes/ecwd-shortcodes.php' );
19
- $this->includes();
20
- $cpt_instance = ECWD_Cpt::get_instance();
21
- $this->user_info();
22
-
23
- add_filter( 'body_class', array( $this, 'theme_body_class' ) );
24
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 );
25
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
26
- }
27
-
28
-
29
- /**
30
- * Setup constants
31
- */
32
- public function setup_constants() {
33
- if ( ! defined( 'ECWD_PLUGIN_DIR' ) ) {
34
- define( 'ECWD_PLUGIN_DIR', dirname( __FILE__ ) );
35
- }
36
-
37
- if ( ! defined( 'ECWD_PLUGIN_PREFIX' ) ) {
38
- define( 'ECWD_PLUGIN_PREFIX', $this->prefix );
39
- }
40
- if ( ! defined( 'ECWD_PLUGIN_NAME' ) ) {
41
- define( 'ECWD_PLUGIN_NAME', $this->plugin_name );
42
- }
43
- if(! defined( 'ECWD_URL' ) ){
44
- define ('ECWD_URL',plugins_url(plugin_basename(dirname(__FILE__))));
45
- }if(! defined( 'ECWD_VERSION' ) ){
46
- define ('ECWD_VERSION', $this->version);
47
- }
48
- }
49
-
50
-
51
-
52
-
53
- public function add_localization() {
54
- $path = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
55
- $loaded = load_plugin_textdomain( 'ecwd', false, $path );
56
- if ( isset( $_GET['page'] ) && $_GET['page'] == basename( __FILE__ ) && ! $loaded ) {
57
- echo '<div class="error">Event calendar WD ' . __( 'Could not load the localization file: ' . $path, 'ecwd' ) . '</div>';
58
-
59
- return;
60
- }
61
- }
62
-
63
- public function user_info() {
64
- //detect timezone
65
-
66
- }
67
-
68
-
69
- public static function theme_body_class(
70
- $classes
71
- ) {
72
- $child_theme = get_option( 'stylesheet' );
73
- $parent_theme = get_option( 'template' );
74
- if(! defined( 'ECWD_TEHEME' ) ){
75
- define ('ECWD_TEHEME', $parent_theme);
76
- }
77
-
78
- if ( $child_theme == $parent_theme ) {
79
- $child_theme = false;
80
- }
81
-
82
- if ( $child_theme ) {
83
- $theme_classes = "ecwd-theme-parent-$parent_theme ecwd-theme-child-$child_theme";
84
- } else {
85
- $theme_classes = "ecwd-theme-$parent_theme";
86
- }
87
- $classes[] = $theme_classes;
88
-
89
- return $classes;
90
- }
91
-
92
- /**
93
- * Include all necessary files
94
- */
95
- public static function includes() {
96
- global $ecwd_options;
97
-
98
- include_once( 'includes/ecwd-cpt-class.php' );
99
- include_once( 'includes/register-settings.php' );
100
- $ecwd_options = ecwd_get_settings();
101
- $default_timezone = self::isValidTimezone( @ini_get( 'date.timezone' ) ) ? ini_get( 'date.timezone' ) : 'Europe/Berlin';
102
- $timezone = ( isset( $ecwd_options['time_zone'] ) && self::isValidTimezone( $ecwd_options['time_zone'] ) ) ? $ecwd_options['time_zone'] : $default_timezone;
103
- date_default_timezone_set( $timezone );
104
- include_once('includes/ecwd-notices-class.php');
105
- require_once('includes/notices.php');
106
- include_once( 'includes/ecwd-functions.php' );
107
- include_once( 'includes/ecwd-event-class.php' );
108
- include_once( 'includes/ecwd-display-class.php' );
109
-
110
- include_once( 'views/widgets.php' );
111
- }
112
-
113
- /**
114
- * Load public facing scripts
115
- */
116
- public function enqueue_scripts() {
117
- global $wp_scripts, $post;
118
- $map_included = false;
119
- if(is_object($post))
120
- if(isset($post->post_type) && ($post->post_type == 'ecwd_event' || $post->post_type == 'ecwd_venue' || strpos($post->post_content, 'ecwd id') !== false)){
121
- if ( isset( $wp_scripts->registered ) && $wp_scripts->registered ) {
122
- foreach ( $wp_scripts->registered as $wp_script ) {
123
- if (isset( $wp_scripts->src ) && $wp_script->src && ( strpos( $wp_script->src, 'maps.googleapis.com' ) || strpos( $wp_script->src, 'maps.google.com' ) ) !== false ) {
124
- if ( is_array( $wp_scripts->queue ) && in_array( $wp_script->handle, $wp_scripts->queue ) ) {
125
- $map_included = true;
126
- break;
127
- }
128
-
129
- }
130
- }
131
- }
132
-
133
- if ( ! $map_included ) {
134
- wp_enqueue_script( $this->prefix . '-maps-public', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places', array( 'jquery' ), $this->version, false );
135
- }
136
- }
137
-
138
- wp_enqueue_script( $this->prefix . '-gmap-public', plugins_url( 'js/gmap/gmap3.js', __FILE__ ), array( 'jquery' ), $this->version, true );
139
- wp_enqueue_script($this->prefix . '-popup', plugins_url('js/ecwd_popup.js', __FILE__), array('jquery'), $this->version, true);
140
- wp_enqueue_script( $this->prefix . '-public', plugins_url( 'js/scripts.js', __FILE__ ), array(
141
- 'jquery',
142
- 'jquery-ui-draggable',
143
- 'masonry',
144
- $this->prefix . '-popup'
145
- ), $this->version, true );
146
- wp_localize_script( ECWD_PLUGIN_PREFIX . '-public', 'ecwd', array(
147
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
148
- 'ajaxnonce' => wp_create_nonce( ECWD_PLUGIN_PREFIX . '_ajax_nonce' ),
149
- 'loadingText' => __( 'Loading...', 'ecwd' ),
150
- 'plugin_url' => ECWD_URL
151
- ) );
152
- }
153
-
154
- /*
155
- * Load public facing styles
156
- */
157
-
158
- public function enqueue_styles() {
159
- global $ecwd_options;
160
- wp_enqueue_style($this->prefix . '-popup-style', plugins_url('/css/ecwd_popup.css', __FILE__), '', $this->version, 'all');
161
- wp_enqueue_style( $this->prefix . '_font-awesome', plugins_url( '/css/font-awesome/font-awesome.css', __FILE__ ), '', $this->version, 'all' );
162
- wp_enqueue_style( $this->prefix . '-public', plugins_url( 'css/style.css', __FILE__ ), '', $this->version, 'all' );
163
- $css = (isset($ecwd_options['custom_css'])) ? $ecwd_options['custom_css'] : "";
164
- wp_add_inline_style($this->prefix . '-public',$css);
165
- }
166
-
167
-
168
- public static function isValidTimezone( $timezone ) {
169
- return in_array( $timezone, timezone_identifiers_list() );
170
- }
171
-
172
- /**
173
- * Return the plugin name.
174
- */
175
- public function get_name() {
176
- return $this->plugin_name;
177
- }
178
-
179
- /**
180
- * Return the plugin prefix.
181
- */
182
- public function get_prefix() {
183
- return $this->prefix;
184
- }
185
-
186
- /**
187
- * Return the plugin version.
188
- */
189
- public function get_version() {
190
- return $this->version;
191
- }
192
-
193
- /**
194
- * Return an instance of this class.
195
- */
196
- public static function get_instance() {
197
- if ( null == self::$instance ) {
198
- self::$instance = new self;
199
- }
200
-
201
- return self::$instance;
202
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  }
6
  */
7
  class ECWD {
8
 
9
+ protected $version = '1.0.54';
10
+ protected $plugin_name = 'event-calendar-wd';
11
+ protected $prefix = 'ecwd';
12
+ protected static $instance = null;
13
+
14
+ private function __construct() {
15
+
16
+ $this->setup_constants();
17
+ add_action('init', array($this, 'add_localization'), 1);
18
+ include_once( 'includes/ecwd-shortcodes.php' );
19
+ $this->includes();
20
+ $cpt_instance = ECWD_Cpt::get_instance();
21
+ $this->user_info();
22
+
23
+ add_filter('body_class', array($this, 'theme_body_class'));
24
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5);
25
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
26
+ add_action('ecwd_show_related_events', array($this, 'show_related_events'), 10,2);
27
+ }
28
+
29
+ public function show_related_events($events, $upcoming_events = false) {
30
+ global $ecwd_options;
31
+ $today = date('Y-m-d');
32
+ $date_format = 'Y-m-d';
33
+ $time_format = 'H:i';
34
+ if (isset($ecwd_options['date_format']) && $ecwd_options['date_format'] != '') {
35
+ $date_format = $ecwd_options['date_format'];
36
+ }
37
+ if (isset($ecwd_options['time_format']) && $ecwd_options['time_format'] != '') {
38
+ $time_format = $ecwd_options['time_format'];
39
+ }
40
+ $time_format .= (isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : '');
41
+ if (isset($ecwd_options['time_type']) && $ecwd_options['time_type'] != '') {
42
+ $time_format = str_replace('H', 'g', $time_format);
43
+ $time_format = str_replace('h', 'g', $time_format);
44
+ }
45
+
46
+
47
+ if (isset($ecwd_options['related_events_count']) && intval($ecwd_options['related_events_count'])) {
48
+ $related_events_count = intval($ecwd_options['related_events_count']);
49
+ } else {
50
+ $related_events_count = -1;
51
+ }
52
+ $related_events_count -= 1;
53
+ include_once 'views/related_events.php';
54
+ }
55
+
56
+ /**
57
+ * Setup constants
58
+ */
59
+ public function setup_constants() {
60
+ if (!defined('ECWD_PLUGIN_DIR')) {
61
+ define('ECWD_PLUGIN_DIR', dirname(__FILE__));
62
+ }
63
+
64
+ if (!defined('ECWD_PLUGIN_PREFIX')) {
65
+ define('ECWD_PLUGIN_PREFIX', $this->prefix);
66
+ }
67
+ if (!defined('ECWD_PLUGIN_NAME')) {
68
+ define('ECWD_PLUGIN_NAME', $this->plugin_name);
69
+ }
70
+ if (!defined('ECWD_URL')) {
71
+ define('ECWD_URL', plugins_url(plugin_basename(dirname(__FILE__))));
72
+ }if (!defined('ECWD_VERSION')) {
73
+ define('ECWD_VERSION', $this->version);
74
+ }
75
+ }
76
+
77
+ public function add_localization() {
78
+ $path = dirname(plugin_basename(__FILE__)) . '/languages/';
79
+ $loaded = load_plugin_textdomain('ecwd', false, $path);
80
+ if (isset($_GET['page']) && $_GET['page'] == basename(__FILE__) && !$loaded) {
81
+ echo '<div class="error">Event calendar WD ' . __('Could not load the localization file: ' . $path, 'ecwd') . '</div>';
82
+
83
+ return;
84
+ }
85
+ }
86
+
87
+ public function user_info() {
88
+ //detect timezone
89
+ }
90
+
91
+ public static function theme_body_class(
92
+ $classes
93
+ ) {
94
+ $child_theme = get_option('stylesheet');
95
+ $parent_theme = get_option('template');
96
+ if (!defined('ECWD_TEHEME')) {
97
+ define('ECWD_TEHEME', $parent_theme);
98
+ }
99
+
100
+ if ($child_theme == $parent_theme) {
101
+ $child_theme = false;
102
+ }
103
+
104
+ if ($child_theme) {
105
+ $theme_classes = "ecwd-theme-parent-$parent_theme ecwd-theme-child-$child_theme";
106
+ } else {
107
+ $theme_classes = "ecwd-theme-$parent_theme";
108
+ }
109
+ $classes[] = $theme_classes;
110
+
111
+ return $classes;
112
+ }
113
+
114
+ /**
115
+ * Include all necessary files
116
+ */
117
+ public static function includes() {
118
+ global $ecwd_options;
119
+
120
+ include_once( 'includes/ecwd-cpt-class.php' );
121
+ include_once( 'includes/register-settings.php' );
122
+ $ecwd_options = ecwd_get_settings();
123
+ $default_timezone = self::isValidTimezone(@ini_get('date.timezone')) ? ini_get('date.timezone') : 'Europe/Berlin';
124
+ $timezone = ( isset($ecwd_options['time_zone']) && self::isValidTimezone($ecwd_options['time_zone']) ) ? $ecwd_options['time_zone'] : $default_timezone;
125
+ date_default_timezone_set($timezone);
126
+ include_once('includes/ecwd-notices-class.php');
127
+ require_once('includes/notices.php');
128
+ include_once( 'includes/ecwd-functions.php' );
129
+ include_once( 'includes/ecwd-event-class.php' );
130
+ include_once( 'includes/ecwd-display-class.php' );
131
+
132
+ include_once( 'views/widgets.php' );
133
+ }
134
+
135
+ /**
136
+ * Load public facing scripts
137
+ */
138
+ public function enqueue_scripts() {
139
+ global $wp_scripts, $post;
140
+ $map_included = false;
141
+ if (is_object($post))
142
+ if (isset($post->post_type) && ($post->post_type == 'ecwd_event' || $post->post_type == 'ecwd_venue' || strpos($post->post_content, 'ecwd id') !== false)) {
143
+ if (isset($wp_scripts->registered) && $wp_scripts->registered) {
144
+ foreach ($wp_scripts->registered as $wp_script) {
145
+ if (isset($wp_scripts->src) && $wp_script->src && ( strpos($wp_script->src, 'maps.googleapis.com') || strpos($wp_script->src, 'maps.google.com') ) !== false) {
146
+ if (is_array($wp_scripts->queue) && in_array($wp_script->handle, $wp_scripts->queue)) {
147
+ $map_included = true;
148
+ break;
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ if (!$map_included) {
155
+ wp_enqueue_script($this->prefix . '-maps-public', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places', array('jquery'), $this->version, false);
156
+ }
157
+ }
158
+
159
+ wp_enqueue_script($this->prefix . '-gmap-public', plugins_url('js/gmap/gmap3.js', __FILE__), array('jquery'), $this->version, true);
160
+ wp_enqueue_script($this->prefix . '-popup', plugins_url('js/ecwd_popup.js', __FILE__), array('jquery'), $this->version, true);
161
+ wp_enqueue_script($this->prefix . '-public', plugins_url('js/scripts.js', __FILE__), array(
162
+ 'jquery',
163
+ 'jquery-ui-draggable',
164
+ 'masonry',
165
+ $this->prefix . '-popup'
166
+ ), $this->version, true);
167
+ wp_localize_script(ECWD_PLUGIN_PREFIX . '-public', 'ecwd', array(
168
+ 'ajaxurl' => admin_url('admin-ajax.php'),
169
+ 'ajaxnonce' => wp_create_nonce(ECWD_PLUGIN_PREFIX . '_ajax_nonce'),
170
+ 'loadingText' => __('Loading...', 'ecwd'),
171
+ 'plugin_url' => ECWD_URL
172
+ ));
173
+ }
174
+
175
+ /*
176
+ * Load public facing styles
177
+ */
178
+
179
+ public function enqueue_styles() {
180
+ global $ecwd_options;
181
+ wp_enqueue_style($this->prefix . '-popup-style', plugins_url('/css/ecwd_popup.css', __FILE__), '', $this->version, 'all');
182
+ wp_enqueue_style($this->prefix . '_font-awesome', plugins_url('/css/font-awesome/font-awesome.css', __FILE__), '', $this->version, 'all');
183
+ wp_enqueue_style($this->prefix . '-public', plugins_url('css/style.css', __FILE__), '', $this->version, 'all');
184
+ $css = (isset($ecwd_options['custom_css'])) ? $ecwd_options['custom_css'] : "";
185
+ wp_add_inline_style($this->prefix . '-public', $css);
186
+ }
187
+
188
+ public static function isValidTimezone($timezone) {
189
+ return in_array($timezone, timezone_identifiers_list());
190
+ }
191
+
192
+ /**
193
+ * Return the plugin name.
194
+ */
195
+ public function get_name() {
196
+ return $this->plugin_name;
197
+ }
198
+
199
+ /**
200
+ * Return the plugin prefix.
201
+ */
202
+ public function get_prefix() {
203
+ return $this->prefix;
204
+ }
205
+
206
+ /**
207
+ * Return the plugin version.
208
+ */
209
+ public function get_version() {
210
+ return $this->version;
211
+ }
212
+
213
+ /**
214
+ * Return an instance of this class.
215
+ */
216
+ public static function get_instance() {
217
+ if (null == self::$instance) {
218
+ self::$instance = new self;
219
+ }
220
+
221
+ return self::$instance;
222
+ }
223
 
224
  }
includes/calendar-class.php CHANGED
@@ -398,7 +398,7 @@ class Calendar {
398
 
399
  foreach ($events_for_list as $date_key => $events) {
400
 
401
- foreach ($events as $event) {
402
  if ($date_key >= $start_date && $date_key <= strtotime($end_date)) {
403
  if ($page_index >= $page * $this->listlimit) {
404
  break 1;
398
 
399
  foreach ($events_for_list as $date_key => $events) {
400
 
401
+ foreach ($events as $event) {
402
  if ($date_key >= $start_date && $date_key <= strtotime($end_date)) {
403
  if ($page_index >= $page * $this->listlimit) {
404
  break 1;
includes/ecwd-display-class.php CHANGED
@@ -300,11 +300,13 @@ class ECWD_Display {
300
  if (!$events) {
301
  $events = $this->merged_events;
302
  }
303
- if ($start_date && $end_date) {
304
  $this->start_date = $start_date;
305
- $this->end_date = $end_date;
306
  }
307
 
 
 
 
308
  foreach ($events as $id => $arr) {
309
 
310
  if (is_int($arr->start_time)) {
@@ -479,7 +481,7 @@ class ECWD_Display {
479
  $to = date('Y-m-d', strtotime($from . ' + ' . $eventdayslong . ' days'));
480
 
481
 
482
- if (!$current_month || ( strtotime($from) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
483
  $this->set_event($eventdate, $from, $to);
484
  }
485
  }
@@ -508,7 +510,7 @@ class ECWD_Display {
508
  $from = $date;
509
  $to = date('Y-m-d', strtotime($from . ' + ' . $eventdayslong . ' days'));
510
 
511
- if (!$current_month || ( strtotime($from) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
512
  $this->set_event($date, $from, $to);
513
  }
514
  }
@@ -553,7 +555,7 @@ class ECWD_Display {
553
  $from = $date;
554
  $to = strtotime(( date("Y-m-d", ( strtotime($from))) . " +" . ( $eventdayslong ) . " days"));
555
  $to = date('Y-m-d', $to);
556
- if (!$current_month || ( strtotime($from) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
557
  $this->set_event($date, $from, $to);
558
  }
559
  }
@@ -611,7 +613,7 @@ class ECWD_Display {
611
  $from = $date;
612
  $to = strtotime(( date("Y-m-d", ( strtotime($from_date))) . " +" . ( $eventdayslong ) . " days"));
613
  $to = date('Y-m-d', $to);
614
- if (!$current_month || ( strtotime($from) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
615
  $this->set_event($date, $from, $to);
616
  }
617
  }
@@ -621,7 +623,7 @@ class ECWD_Display {
621
  $eventdays = $this->dateDiff($from, $to); // get the difference in days between the two dates
622
  $date = strtotime(date("Y-m-d", strtotime($from)));
623
  $date = date("Y-n-j", $date);
624
- if (!$current_month || ( strtotime($from) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
625
  $this->set_event($date, $from, $to);
626
  }
627
  }
@@ -1027,6 +1029,7 @@ class ECWD_Display {
1027
  }
1028
  $this->events[] = $event_data;
1029
  }
 
1030
  function literalDate($timestamp, $weekday) {
1031
  $timestamp = is_numeric($timestamp) ? $timestamp : strtotime($timestamp);
1032
  $month = date('M', $timestamp);
@@ -1246,15 +1249,16 @@ class ECWD_Display {
1246
  }
1247
 
1248
  function events_unique($array) {
1249
- $events_ids = array();
1250
- foreach ($array as $key => $event) {
1251
- if (!in_array($event['id'], $events_ids)) {
1252
- $events_ids[] = $event['id'];
1253
- } else {
1254
- unset($array[$key]);
 
 
1255
  }
1256
  }
1257
-
1258
  return $array;
1259
  }
1260
 
300
  if (!$events) {
301
  $events = $this->merged_events;
302
  }
303
+ if ($start_date) {
304
  $this->start_date = $start_date;
 
305
  }
306
 
307
+ if ($end_date) {
308
+ $this->end_date = $end_date;
309
+ }
310
  foreach ($events as $id => $arr) {
311
 
312
  if (is_int($arr->start_time)) {
481
  $to = date('Y-m-d', strtotime($from . ' + ' . $eventdayslong . ' days'));
482
 
483
 
484
+ if (!$current_month || (strtotime($to) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
485
  $this->set_event($eventdate, $from, $to);
486
  }
487
  }
510
  $from = $date;
511
  $to = date('Y-m-d', strtotime($from . ' + ' . $eventdayslong . ' days'));
512
 
513
+ if (!$current_month || (strtotime($to) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
514
  $this->set_event($date, $from, $to);
515
  }
516
  }
555
  $from = $date;
556
  $to = strtotime(( date("Y-m-d", ( strtotime($from))) . " +" . ( $eventdayslong ) . " days"));
557
  $to = date('Y-m-d', $to);
558
+ if (!$current_month || (strtotime($to) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
559
  $this->set_event($date, $from, $to);
560
  }
561
  }
613
  $from = $date;
614
  $to = strtotime(( date("Y-m-d", ( strtotime($from_date))) . " +" . ( $eventdayslong ) . " days"));
615
  $to = date('Y-m-d', $to);
616
+ if (!$current_month || (strtotime($to) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
617
  $this->set_event($date, $from, $to);
618
  }
619
  }
623
  $eventdays = $this->dateDiff($from, $to); // get the difference in days between the two dates
624
  $date = strtotime(date("Y-m-d", strtotime($from)));
625
  $date = date("Y-n-j", $date);
626
+ if (!$current_month || (strtotime($to) <= strtotime($this->end_date) && strtotime($from) >= strtotime($this->start_date) && in_array(strtolower(date('l', strtotime($from))), $weekdays) )) {
627
  $this->set_event($date, $from, $to);
628
  }
629
  }
1029
  }
1030
  $this->events[] = $event_data;
1031
  }
1032
+
1033
  function literalDate($timestamp, $weekday) {
1034
  $timestamp = is_numeric($timestamp) ? $timestamp : strtotime($timestamp);
1035
  $month = date('M', $timestamp);
1249
  }
1250
 
1251
  function events_unique($array) {
1252
+ if (is_array($array) && !empty($array)) {
1253
+ $events_ids = array();
1254
+ foreach ($array as $key => $event) {
1255
+ if (!in_array($event['id'], $events_ids)) {
1256
+ $events_ids[] = $event['id'];
1257
+ } else {
1258
+ unset($array[$key]);
1259
+ }
1260
  }
1261
  }
 
1262
  return $array;
1263
  }
1264
 
includes/register-settings.php CHANGED
@@ -229,6 +229,13 @@ function ecwd_register_settings() {
229
  'type' => 'radio',
230
  'default' => 0
231
  ),
 
 
 
 
 
 
 
232
  ),
233
  'category_archive' => array(
234
  'category_archive_slug' => array(
229
  'type' => 'radio',
230
  'default' => 0
231
  ),
232
+ 'related_events_count' => array(
233
+ 'id' => 'related_events_count',
234
+ 'name' => __('Related events count', 'ecwd'),
235
+ 'desc' => 'empty for all events',
236
+ 'type' => 'text',
237
+ 'default' => ''
238
+ )
239
  ),
240
  'category_archive' => array(
241
  'category_archive_slug' => array(
js/ecwd_popup.js CHANGED
@@ -28,31 +28,38 @@
28
  var el = $(this);
29
 
30
  el.hide();
31
- params.button.on('click', function (e) {
32
  e.preventDefault();
33
- var data = params.get_ajax_data($(this));
34
- if (data) {
35
- jQuery.post(ecwd.ajaxurl, data, function (response) {
36
- if (response != 0) {
37
- open_popup(response);
38
- show_gmap();
39
  }
40
- });
41
- } else if (params.fillhtml.length > 0 && params.fillhtml) {
42
- open_popup(params.fillhtml.val());
43
- } else {
44
- open_popup(el.html());
45
- }
46
- el.on('click', '.ecwd_close_popup', function () {
47
- el.hide();
48
- params.popup_close(el);
49
- });
50
- $(document).keyup(function(e) {
51
- if (e.keyCode == 27) { // escape key maps to keycode `27`
52
  el.hide();
53
  params.popup_close(el);
54
- }
55
- });
 
 
 
 
 
 
 
 
56
  });
57
 
58
  function open_popup(html) {
@@ -61,6 +68,7 @@
61
  }
62
  el.show();
63
  params.after_popup_show(el);
 
64
  }
65
 
66
  function add_popup(html) {
28
  var el = $(this);
29
 
30
  el.hide();
31
+ params.button.on('click', function (e) {
32
  e.preventDefault();
33
+ if (!el.hasClass('ecwd_popup_el')) {
34
+ var data = params.get_ajax_data($(this));
35
+ if (data) {
36
+ if (params.fillhtml) {
37
+ data.html = params.fillhtml.val();
 
38
  }
39
+ jQuery.post(ecwd.ajaxurl, data, function (response) {
40
+ if (response != 0) {
41
+ open_popup(response);
42
+ show_gmap();
43
+ }
44
+ });
45
+ } else if (params.fillhtml.length > 0 && params.fillhtml) {
46
+ open_popup(params.fillhtml.val());
47
+ } else {
48
+ open_popup(el.html());
49
+ }
50
+ el.on('click', '.ecwd_close_popup', function () {
51
  el.hide();
52
  params.popup_close(el);
53
+ });
54
+ $(document).keyup(function (e) {
55
+ if (e.keyCode == 27) { // escape key maps to keycode `27`
56
+ el.hide();
57
+ params.popup_close(el);
58
+ }
59
+ });
60
+ } else {
61
+ el.show();
62
+ }
63
  });
64
 
65
  function open_popup(html) {
68
  }
69
  el.show();
70
  params.after_popup_show(el);
71
+ el.addClass('ecwd_popup_el');
72
  }
73
 
74
  function add_popup(html) {
js/scripts.js CHANGED
@@ -55,30 +55,18 @@ if (typeof ecwd_js_init != "function")
55
  container_class: "ecwd_more_event",
56
  after_popup_show: function (el) {
57
  el.find('li.inmore').show();
58
- el.find('li').on('click', function () {
59
  el.find('li').find('.event-details-container').slideUp();
60
  if (jQuery(this).find('.event-details-container').is(":visible"))
61
  jQuery(this).find('.event-details-container').slideUp();
62
  else
63
  jQuery(this).find('.event-details-container').slideDown();
64
  });
65
- }
 
66
  });
67
  });
68
- jQuery('.single_event_popup').ecwd_popup({
69
- button: jQuery('.ecwd_open_event_popup'),
70
- body_class: "ecwd-excluded-events ecwd_popup_body_scroll",
71
- title: "Event Details",
72
- get_ajax_data: function (el) {
73
- var date = el.attr('start-date-data');
74
- var data = {
75
- action: 'ecwd_event_popup_ajax',
76
- id: el.attr('class').split('event')[2],
77
- date: date
78
- };
79
- return data;
80
- }
81
- });
82
 
83
  jQuery('.ecwd_calendar_prev_next .next, .ecwd_calendar_prev_next .previous, .ecwd_calendar .type, .cpage, .current-month a, .ecwd_filter, .ecwd_reset_filters').on('click', function (e) {
84
  var days = jQuery('input[name="ecwd_weekdays[]"]:checked').map(function () {
@@ -517,6 +505,29 @@ if (typeof ecwd_js_init != "function")
517
  }
518
 
519
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  setTimeout(function () {
521
  if (parseInt(jQuery('body').width()) <= 768 || jQuery(".calendar_full_content").width() <= 550) {
522
  jQuery('.calendar_main').each(function (k, v) {
55
  container_class: "ecwd_more_event",
56
  after_popup_show: function (el) {
57
  el.find('li.inmore').show();
58
+ el.find('.more_events').find('li').on('click', function () {
59
  el.find('li').find('.event-details-container').slideUp();
60
  if (jQuery(this).find('.event-details-container').is(":visible"))
61
  jQuery(this).find('.event-details-container').slideUp();
62
  else
63
  jQuery(this).find('.event-details-container').slideDown();
64
  });
65
+ add_single_events_popup();
66
+ },
67
  });
68
  });
69
+ add_single_events_popup();
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  jQuery('.ecwd_calendar_prev_next .next, .ecwd_calendar_prev_next .previous, .ecwd_calendar .type, .cpage, .current-month a, .ecwd_filter, .ecwd_reset_filters').on('click', function (e) {
72
  var days = jQuery('input[name="ecwd_weekdays[]"]:checked').map(function () {
505
  }
506
 
507
  }
508
+ function add_single_events_popup() {
509
+ jQuery('.single_event_popup').each(function () {
510
+ jQuery(this).ecwd_popup({
511
+ button: jQuery('.ecwd_open_event_popup'),
512
+ body_class: "ecwd-excluded-events ecwd_popup_body_scroll",
513
+ title: "Event Details",
514
+ get_ajax_data: function (el) {
515
+ var date = el.attr('start-date-data');
516
+ if (date) {
517
+ var data = {
518
+ action: 'ecwd_event_popup_ajax',
519
+ id: el.attr('class').split('event')[2],
520
+ date: date
521
+ };
522
+ return data;
523
+ } else {
524
+ return {};
525
+ }
526
+ }
527
+ });
528
+ });
529
+ }
530
+
531
  setTimeout(function () {
532
  if (parseInt(jQuery('body').width()) <= 768 || jQuery(".calendar_full_content").width() <= 550) {
533
  jQuery('.calendar_main').each(function (k, v) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-event-calendar-wd.html
4
  Tags: calendar, calendars, event, event calendar, event manager, events calendar, calendar widget, event registration, event management,events, agenda, holiday calendar , scheduling, free calendar, Calender, upcoming events , event widget , event list, calendar localization, Organizer, editorial calendar, Interactive Calendar, news calendar, meeting , appointment, event tracking, event organizer, upcoming events widget, event page, event bookings, recurring, recurring events, conference, date, dates, schedule, times, venue, AJAX, responsive, shortcode, seminar, summit, facebook integration, widget
5
  Requires at least: 3.9
6
  Tested up to: 4.4
7
- Stable tag: 1.0.53
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -153,6 +153,10 @@ After downloading the ZIP file of the Event Calendar WD plugin,
153
 
154
  == Changelog ==
155
 
 
 
 
 
156
  = 1.0.53 =
157
  Added: Export to GCal/ICal
158
 
4
  Tags: calendar, calendars, event, event calendar, event manager, events calendar, calendar widget, event registration, event management,events, agenda, holiday calendar , scheduling, free calendar, Calender, upcoming events , event widget , event list, calendar localization, Organizer, editorial calendar, Interactive Calendar, news calendar, meeting , appointment, event tracking, event organizer, upcoming events widget, event page, event bookings, recurring, recurring events, conference, date, dates, schedule, times, venue, AJAX, responsive, shortcode, seminar, summit, facebook integration, widget
5
  Requires at least: 3.9
6
  Tested up to: 4.4
7
+ Stable tag: 1.0.54
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
153
 
154
  == Changelog ==
155
 
156
+
157
+ = 1.0.54 =
158
+ New: Related events count option
159
+
160
  = 1.0.53 =
161
  Added: Export to GCal/ICal
162
 
views/ecwd-organizer-content.php CHANGED
@@ -2,173 +2,115 @@
2
  /**
3
  * Display for Organiser Custom Post Types
4
  */
5
-
6
-
7
  $post_id = $post->ID;
8
 
9
- $date_format = 'Y-m-d';
10
- $time_format = 'H:i';
11
  $ecwd_social_icons = false;
12
- $events = array();
13
- if ( isset( $ecwd_options['date_format'] ) && $ecwd_options['date_format'] != '' ) {
14
- $date_format = $ecwd_options['date_format'];
15
  }
16
- if ( isset( $ecwd_options['time_format'] ) && $ecwd_options['time_format'] != '' ) {
17
- $time_format = $ecwd_options['time_format'];
18
  }
19
- $time_format .= (isset( $ecwd_options['time_type'])?' '.$ecwd_options['time_type']: '');
20
- if(isset($ecwd_options['time_type']) && $ecwd_options['time_type'] !=''){
21
- $time_format = str_replace('H', 'g', $time_format);
22
- $time_format = str_replace('h', 'g', $time_format);
23
  }
24
- if ( isset( $ecwd_options['social_icons'] ) && $ecwd_options['social_icons'] != '' ) {
25
- $ecwd_social_icons = $ecwd_options['social_icons'];
26
  }
27
- $organizer_url = get_permalink( $post_id );
28
 
29
 
30
  //$args = array('numberposts' => -1, 'post_type' => ECWD_PLUGIN_PREFIX.'_event', 'meta_key' => ECWD_PLUGIN_PREFIX.'_event_organizers', 'meta_value' => $post->ID, 'meta_compare' => 'LIKE');
31
  //$ecwd_events = get_posts($args);
32
- $today = date( 'Y-m-d' );
33
-
34
- $args = array(
35
- 'numberposts' => - 1,
36
- 'post_type' => ECWD_PLUGIN_PREFIX . '_event',
37
- 'meta_query' => array(
38
- array(
39
- 'key' => ECWD_PLUGIN_PREFIX . '_event_organizers',
40
- 'value' => serialize( strval( $post->ID ) ),
41
- 'compare' => 'LIKE'
42
- ),
43
- ),
44
- 'meta_key' => ECWD_PLUGIN_PREFIX . '_event_date_from',
45
- 'orderby' => 'meta_value',
46
- 'order' => 'ASC'
47
  );
48
- $ecwd_events = get_posts( $args );
49
-
50
-
51
- foreach ( $ecwd_events as $ecwd_event ) {
52
- $term_metas = '';
53
- $categories = get_the_terms( $ecwd_event->ID, ECWD_PLUGIN_PREFIX . '_event_category' );
54
- if ( is_array( $categories ) ) {
55
- foreach ( $categories as $category ) {
56
- $term_metas = get_option( "ecwd_event_category_$category->term_id" );
57
- $term_metas['id'] = $category->term_id;
58
- $term_metas['name'] = $category->name;
59
- $term_metas['slug'] = $category->slug;
60
- }
61
- }
62
- $ecwd_event_metas = get_post_meta( $ecwd_event->ID, '', true );
63
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_url' ] = array( 0 => '' );
64
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_location' ] ) ) {
65
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_location' ] = array( 0 => '' );
66
- }
67
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_lat_long' ] ) ) {
68
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_lat_long' ] = array( 0 => '' );
69
- }
70
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_to' ] ) ) {
71
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_to' ] = array( 0 => '' );
72
- }
73
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_from' ] ) ) {
74
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_from' ] = array( 0 => '' );
75
- }
76
-
77
- $permalink = get_permalink( $ecwd_event->ID );
78
- $events[ $ecwd_event->ID ] = new ECWD_Event( $ecwd_event->ID, 0, $ecwd_event->post_title, $ecwd_event->post_content, $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_location' ][0], $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_from' ][0], $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_to' ][0], $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_url' ][0], $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_lat_long' ][0], $permalink, $ecwd_event, $term_metas, $ecwd_event_metas );
79
  }
80
 
81
- $d = new ECWD_Display( 0, '', '', $today );
82
  $max_date = date('Y-m-d', strtotime(( date("Y-m-t", ( strtotime(date('Y-m-d')))) . " +" . ( ( 12 ) ) . " month")));
83
- $events = $d->get_event_days( $events, 0, date('Y-m-d'), $max_date );
 
84
 
85
 
86
  echo $content;
87
  ?>
88
 
89
  <div class="ecwd-organizer">
90
- <?php if ( $ecwd_social_icons ) { ?>
91
- <div class="ecwd-social">
92
- <span class="share-links">
93
- <a href="http://twitter.com/home?status=<?php echo get_permalink( $post_id ) ?>" class="ecwd-twitter"
94
- target="_blank" data-original-title="Tweet It">
95
- <span class="visuallyhidden">Twitter</span></a>
96
-
97
- <a href="http://www.facebook.com/sharer.php?u=<?php echo get_permalink( $post_id ) ?>" class="ecwd-facebook"
98
- target="_blank" data-original-title="Share on Facebook">
99
- <span class="visuallyhidden">Facebook</span></a>
100
-
101
- <a href="http://plus.google.com/share?url=<?php echo get_permalink( $post_id ) ?>" class="ecwd-google-plus"
102
- target="_blank" data-original-title="Share on Google+">
103
- <span class="visuallyhidden">Google+</span></a>
104
-
105
- </span>
106
- </div>
107
- <?php } ?>
108
- <?php if ( count( $events ) > 0 ) {
109
- ?>
110
- <div class="ecwd-organizer-events">
111
- <h3> <?php echo $post->post_title ?> <?php _e( 'upcoming events', 'ecwd' ) ?></h3>
112
-
113
- <div class="upcoming_events_slider">
114
- <div class="upcoming_events_slider-arrow-left"><a href="#left"></a></div>
115
- <div class="upcoming_events_slider-arrow-right"><a href="#right"></a></div>
116
- <ul>
117
- <?php
118
- foreach ( $events as $ecwd_event ) {
119
- if ( strtotime( $ecwd_event['from'] ) >= strtotime( $today ) ) {
120
- ?>
121
- <li itemscope itemtype="http://schema.org/Event" class="upcoming_events_item">
122
- <div class="upcoming_event_container">
123
- <?php $image_class = '';
124
- $image = getAndReplaceFirstImage( $ecwd_event['post']->post_content );
125
- if ( ! has_post_thumbnail( $ecwd_event['id'] ) && $image['image'] == "" ) {
126
- $image_class = "ecwd-no-image";
127
- }
128
- echo '<div class="upcoming_events_item-img ' . $image_class . '">';
129
- if ( get_the_post_thumbnail( $ecwd_event['id'] ) ) {
130
- echo get_the_post_thumbnail( $ecwd_event['id'], 'thumb' );
131
- } elseif ( $image['image'] != null ) {
132
- echo '<img src="' . $image['image'] . '" />';
133
- $ecwd_event['post']->post_content = $image['content'];
134
- }
135
- echo '</div>'; ?>
136
- <div class="event-title" itemprop="name">
137
- <a href="<?php echo $ecwd_event['permalink'] ?>"><?php echo $ecwd_event['title'] ?></a>
138
- </div>
139
- <div class="event-date" itemprop="startDate"
140
- content="<?php echo date( 'Y-m-d', strtotime( $ecwd_event['from'] ) ) . 'T' . date( 'H:i', strtotime( $ecwd_event['starttime'] ) ) ?>">
141
- <?php
142
- if ( isset( $ecwd_event['all_day_event'] ) && $ecwd_event['all_day_event'] == 1 ) {
143
- echo date( $date_format, strtotime( $ecwd_event['from'] ) );
144
- if ( $ecwd_event['to'] && date( $date_format, strtotime( $ecwd_event['from'] ) ) !== date( $date_format, strtotime( $ecwd_event['to'] ) ) ) {
145
- echo ' - ' . date( $date_format, strtotime( $ecwd_event['to'] ) );
146
- }
147
- echo ' ' . __( 'All day', 'ecwd' );
148
- } else {
149
-
150
- echo date( $date_format, strtotime( $ecwd_event['from'] ) ) . ' ' . date( $time_format, strtotime( $ecwd_event['starttime'] ) );
151
-
152
- if ( $ecwd_event['to'] ) {
153
- echo ' - ' . date( $date_format, strtotime( $ecwd_event['to'] ) ) . ' ' . date( $time_format, strtotime( $ecwd_event['endtime'] ) );
154
- }
155
- } ?>
156
- </div>
157
- <div class="upcoming_events_item-content"><?php echo( $ecwd_event['post']->post_content ? $ecwd_event['post']->post_content : 'No additional details for this event.' ); ?> </div>
158
- </div>
159
- </li>
160
- <?php
161
- }
162
- }
163
- ?>
164
- </ul>
165
- </div>
166
- </div>
167
- <?php } ?>
168
  </div>
169
  <script id="ecwd_script_handler" type="text/javascript">
170
  if (typeof ecwd_js_init_call == "object") {
171
- ecwd_js_init_call = new ecwd_js_init();
172
- }
173
  </script>
174
 
2
  /**
3
  * Display for Organiser Custom Post Types
4
  */
 
 
5
  $post_id = $post->ID;
6
 
7
+ $date_format = 'Y-m-d';
8
+ $time_format = 'H:i';
9
  $ecwd_social_icons = false;
10
+ $events = array();
11
+ if (isset($ecwd_options['date_format']) && $ecwd_options['date_format'] != '') {
12
+ $date_format = $ecwd_options['date_format'];
13
  }
14
+ if (isset($ecwd_options['time_format']) && $ecwd_options['time_format'] != '') {
15
+ $time_format = $ecwd_options['time_format'];
16
  }
17
+ $time_format .= (isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : '');
18
+ if (isset($ecwd_options['time_type']) && $ecwd_options['time_type'] != '') {
19
+ $time_format = str_replace('H', 'g', $time_format);
20
+ $time_format = str_replace('h', 'g', $time_format);
21
  }
22
+ if (isset($ecwd_options['social_icons']) && $ecwd_options['social_icons'] != '') {
23
+ $ecwd_social_icons = $ecwd_options['social_icons'];
24
  }
25
+ $organizer_url = get_permalink($post_id);
26
 
27
 
28
  //$args = array('numberposts' => -1, 'post_type' => ECWD_PLUGIN_PREFIX.'_event', 'meta_key' => ECWD_PLUGIN_PREFIX.'_event_organizers', 'meta_value' => $post->ID, 'meta_compare' => 'LIKE');
29
  //$ecwd_events = get_posts($args);
30
+ $today = date('Y-m-d');
31
+
32
+ $args = array(
33
+ 'numberposts' => - 1,
34
+ 'post_type' => ECWD_PLUGIN_PREFIX . '_event',
35
+ 'meta_query' => array(
36
+ array(
37
+ 'key' => ECWD_PLUGIN_PREFIX . '_event_organizers',
38
+ 'value' => serialize(strval($post->ID)),
39
+ 'compare' => 'LIKE'
40
+ ),
41
+ ),
42
+ 'meta_key' => ECWD_PLUGIN_PREFIX . '_event_date_from',
43
+ 'orderby' => 'meta_value',
44
+ 'order' => 'ASC'
45
  );
46
+ $ecwd_events = get_posts($args);
47
+
48
+
49
+ foreach ($ecwd_events as $ecwd_event) {
50
+ $term_metas = '';
51
+ $categories = get_the_terms($ecwd_event->ID, ECWD_PLUGIN_PREFIX . '_event_category');
52
+ if (is_array($categories)) {
53
+ foreach ($categories as $category) {
54
+ $term_metas = get_option("ecwd_event_category_$category->term_id");
55
+ $term_metas['id'] = $category->term_id;
56
+ $term_metas['name'] = $category->name;
57
+ $term_metas['slug'] = $category->slug;
58
+ }
59
+ }
60
+ $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
61
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
62
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) {
63
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => '');
64
+ }
65
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'])) {
66
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'] = array(0 => '');
67
+ }
68
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'])) {
69
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'] = array(0 => '');
70
+ }
71
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'])) {
72
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'] = array(0 => '');
73
+ }
74
+
75
+ $permalink = get_permalink($ecwd_event->ID);
76
+ $events[$ecwd_event->ID] = new ECWD_Event($ecwd_event->ID, 0, $ecwd_event->post_title, $ecwd_event->post_content, $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'][0], $permalink, $ecwd_event, $term_metas, $ecwd_event_metas);
77
  }
78
 
79
+ $d = new ECWD_Display(0, '', '', $today);
80
  $max_date = date('Y-m-d', strtotime(( date("Y-m-t", ( strtotime(date('Y-m-d')))) . " +" . ( ( 12 ) ) . " month")));
81
+ $events = $d->get_event_days($events, 1, date('Y-m-d'), $max_date);
82
+ $events = $d->events_unique($events);
83
 
84
 
85
  echo $content;
86
  ?>
87
 
88
  <div class="ecwd-organizer">
89
+ <?php if ($ecwd_social_icons) { ?>
90
+ <div class="ecwd-social">
91
+ <span class="share-links">
92
+ <a href="http://twitter.com/home?status=<?php echo get_permalink($post_id) ?>" class="ecwd-twitter"
93
+ target="_blank" data-original-title="Tweet It">
94
+ <span class="visuallyhidden">Twitter</span></a>
95
+
96
+ <a href="http://www.facebook.com/sharer.php?u=<?php echo get_permalink($post_id) ?>" class="ecwd-facebook"
97
+ target="_blank" data-original-title="Share on Facebook">
98
+ <span class="visuallyhidden">Facebook</span></a>
99
+
100
+ <a href="http://plus.google.com/share?url=<?php echo get_permalink($post_id) ?>" class="ecwd-google-plus"
101
+ target="_blank" data-original-title="Share on Google+">
102
+ <span class="visuallyhidden">Google+</span></a>
103
+
104
+ </span>
105
+ </div>
106
+ <?php
107
+ }
108
+ do_action('ecwd_show_related_events', $events, true);
109
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  </div>
111
  <script id="ecwd_script_handler" type="text/javascript">
112
  if (typeof ecwd_js_init_call == "object") {
113
+ ecwd_js_init_call = new ecwd_js_init();
114
+ }
115
  </script>
116
 
views/ecwd-venue-content.php CHANGED
@@ -2,207 +2,144 @@
2
  /**
3
  * Display for Venue Custom Post Types
4
  */
5
-
6
- $date_format = 'Y-m-d';
7
- $time_format = 'H:i';
8
  $ecwd_social_icons = false;
9
- if ( isset( $ecwd_options['date_format'] ) && $ecwd_options['date_format'] != '' ) {
10
- $date_format = $ecwd_options['date_format'];
11
  }
12
- if ( isset( $ecwd_options['time_format'] ) && $ecwd_options['time_format'] != '' ) {
13
- $time_format = $ecwd_options['time_format'];
14
  }
15
- $time_format .= (isset( $ecwd_options['time_type'])?' '.$ecwd_options['time_type']: '');
16
- if(isset($ecwd_options['time_type']) && $ecwd_options['time_type'] !=''){
17
- $time_format = str_replace('H', 'g', $time_format);
18
- $time_format = str_replace('h', 'g', $time_format);
19
  }
20
- if ( isset( $ecwd_options['social_icons'] ) && $ecwd_options['social_icons'] != '' ) {
21
- $ecwd_social_icons = $ecwd_options['social_icons'];
22
  }
23
 
24
- $post_id = $post->ID;
25
- $venue_url = get_permalink( $post_id );
26
- $meta = get_post_meta( $post_id );
27
- $events = array();
28
 
29
  // Load up all post meta data
30
- $ecwd_venue_location = get_post_meta( $post->ID, ECWD_PLUGIN_PREFIX . '_venue_location', true );
31
- $ecwd_venue_latlong = get_post_meta( $post->ID, ECWD_PLUGIN_PREFIX . '_venue_lat_long', true );
32
- $ecwd_venue_zoom = get_post_meta( $post->ID, ECWD_PLUGIN_PREFIX . '_map_zoom', true );
33
- if(!$ecwd_venue_zoom){
34
- $ecwd_venue_zoom = 17;
35
  }
36
 
37
- $today = date( 'Y-m-d' );
38
-
39
- $args = array(
40
- 'numberposts' => - 1,
41
- 'post_type' => ECWD_PLUGIN_PREFIX . '_event',
42
- 'meta_query' => array(
43
- array(
44
- 'key' => ECWD_PLUGIN_PREFIX . '_event_venue',
45
- 'value' => $post->ID
46
- )
47
- ),
48
- 'meta_key' => ECWD_PLUGIN_PREFIX . '_event_date_from',
49
- 'orderby' => 'meta_value',
50
- 'order' => 'ASC'
51
  );
52
- $ecwd_events = get_posts( $args );
53
 
54
  //var_dump($ecwd_events);
55
- foreach ( $ecwd_events as $ecwd_event ) {
56
-
57
- $term_metas = '';
58
- $categories = get_the_terms( $ecwd_event->ID, ECWD_PLUGIN_PREFIX . '_event_category' );
59
- if ( is_array( $categories ) ) {
60
- foreach ( $categories as $category ) {
61
- $term_metas = get_option( "ecwd_event_category_$category->term_id" );
62
- $term_metas['id'] = $category->term_id;
63
- $term_metas['name'] = $category->name;
64
- $term_metas['slug'] = $category->slug;
65
- }
66
- }
67
- $ecwd_event_metas = get_post_meta( $ecwd_event->ID, '', true );
68
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_url' ] = array( 0 => '' );
69
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_location' ] ) ) {
70
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_location' ] = array( 0 => '' );
71
- }
72
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_lat_long' ] ) ) {
73
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_lat_long' ] = array( 0 => '' );
74
- }
75
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_to' ] ) ) {
76
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_to' ] = array( 0 => '' );
77
- }
78
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_from' ] ) ) {
79
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_from' ] = array( 0 => '' );
80
- }
81
-
82
-
83
- $permalink = get_permalink( $ecwd_event->ID );
84
-
85
-
86
- $events[ $ecwd_event->ID ] = new ECWD_Event( $ecwd_event->ID, 0, $ecwd_event->post_title, $ecwd_event->post_content, $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_location' ][0], $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_from' ][0], $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_date_to' ][0], $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_url' ][0], $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_lat_long' ][0], $permalink, $ecwd_event, $term_metas, $ecwd_event_metas );
87
-
88
  }
89
 
90
- $d = new ECWD_Display( 0, '', '', $today );
91
  $max_date = date('Y-m-d', strtotime(( date("Y-m-t", ( strtotime(date('Y-m-d')))) . " +" . ( ( 12 ) ) . " month")));
92
- $events = $d->get_event_days( $events, 0, date('Y-m-d'), $max_date );
93
-
94
  ?>
95
  <?php
96
-
97
  echo $content;
98
  ?>
99
 
100
  <div class="ecwd-venue">
101
- <?php if ( $ecwd_social_icons ) { ?>
102
- <div class="ecwd-social">
103
  <span class="share-links">
104
- <a href="http://twitter.com/home?status=<?php echo get_permalink( $post_id ) ?>" class="ecwd-twitter"
105
- target="_blank" data-original-title="Tweet It">
106
- <span class="visuallyhidden">Twitter</span></a>
107
-
108
- <a href="http://www.facebook.com/sharer.php?u=<?php echo get_permalink( $post_id ) ?>" class="ecwd-facebook"
109
- target="_blank" data-original-title="Share on Facebook">
110
- <span class="visuallyhidden">Facebook</span></a>
111
-
112
- <a href="http://plus.google.com/share?url=<?php echo get_permalink( $post_id ) ?>" class="ecwd-google-plus"
113
- target="_blank" data-original-title="Share on Google+">
114
- <span class="visuallyhidden">Google+</span></a>
115
-
116
- </span>
117
- </div>
118
- <?php } ?>
119
-
120
-
121
- <?php
122
- if ( $ecwd_venue_latlong ) {
123
- $map_events = array();
124
- $map_events[0]['latlong'] = explode( ',', $ecwd_venue_latlong );
125
- $map_events[0]['zoom'] = $ecwd_venue_zoom;
126
- $map_events[0]['infow'] = '<div class="ecwd_map_venue">';
127
- $map_events[0]['infow'] .= '<span class="name">' . $post->post_title . '</span><br />';
128
- $map_events[0]['infow'] .= '<span class="location">' . $ecwd_venue_location . '</span>';
129
- $map_events[0]['infow'] .= '</div>';
130
- $markers = json_encode( $map_events );
131
- ?>
132
- <div class="ecwd-show-map">
133
- <div id="ecwd_map_div" class="ecwd_map_div">
134
- </div>
135
- <textarea id="ecwd_markers" class="hidden" style="display: none;"><?php echo $markers; ?></textarea>
136
- </div>
137
- <?php } ?>
138
-
139
- <?php if ( count( $events ) > 0 ) { ?>
140
-
141
- <div class="ecwd-venue-events">
142
- <h3> <?php echo $post->post_title ?> <?php _e( 'events', 'ecwd' ) ?></h3>
143
-
144
- <div class="upcoming_events_slider">
145
- <div class="upcoming_events_slider-arrow-left"><a href="#left"></a></div>
146
- <div class="upcoming_events_slider-arrow-right"><a href="#right"></a></div>
147
- <ul>
148
- <?php
149
- foreach ( $events as $ecwd_event ) {
150
- if ( strtotime( $ecwd_event['from'] ) >= strtotime( $today ) ) {
151
- ?>
152
- <li itemscope itemtype="http://schema.org/Event" class="upcoming_events_item">
153
- <div class="upcoming_event_container">
154
- <?php $image_class = '';
155
- $image = getAndReplaceFirstImage( $ecwd_event['post']->post_content );
156
- if ( ! has_post_thumbnail( $ecwd_event['id'] ) && $image['image'] == "" ) {
157
- $image_class = "ecwd-no-image";
158
- }
159
- echo '<div class="upcoming_events_item-img ' . $image_class . '">';
160
- if ( get_the_post_thumbnail( $ecwd_event['id'] ) ) {
161
- echo get_the_post_thumbnail( $ecwd_event['id'], 'thumb' );
162
- } elseif ( $image['image'] != null ) {
163
- echo '<img src="' . $image['image'] . '" />';
164
- $ecwd_event['post']->post_content = $image['content'];
165
- }
166
- echo '</div>'; ?>
167
- <div class="event-title" itemprop="name">
168
- <a href="<?php echo $ecwd_event['permalink'] ?>"><?php echo $ecwd_event['title'] ?></a>
169
- </div>
170
-
171
- <div class="event-date" itemprop="startDate"
172
- content="<?php echo date( 'Y-m-d', strtotime( $ecwd_event['from'] ) ) . 'T' . date( 'H:i', strtotime( $ecwd_event['starttime'] ) ) ?>">
173
- <?php
174
- if ( isset( $ecwd_event['all_day_event'] ) && $ecwd_event['all_day_event'] == 1 ) {
175
- echo date( $date_format, strtotime( $ecwd_event['from'] ) );
176
- if ( $ecwd_event['to'] && date( $date_format, strtotime( $ecwd_event['from'] ) ) !== date( $date_format, strtotime( $ecwd_event['to'] ) ) ) {
177
- echo ' - ' . date( $date_format, strtotime( $ecwd_event['to'] ) );
178
- }
179
- echo ' ' . __( 'All day', 'ecwd' );
180
- } else {
181
-
182
- echo date( $date_format, strtotime( $ecwd_event['from'] ) ) . ' ' . date( $time_format, strtotime( $ecwd_event['starttime'] ) );
183
-
184
- if ( $ecwd_event['to'] ) {
185
- echo ' - ' . date( $date_format, strtotime( $ecwd_event['to'] ) ) . ' ' . date( $time_format, strtotime( $ecwd_event['endtime'] ) );
186
- }
187
- } ?>
188
- </div>
189
- <div
190
- class="upcoming_events_item-content"><?php echo( $ecwd_event['post']->post_content ? $ecwd_event['post']->post_content : 'No additional details for this event.' ); ?> </div>
191
- </div>
192
- </li>
193
- <?php
194
- }
195
- }
196
- ?>
197
- </ul>
198
- </div>
199
- </div>
200
- <?php } ?>
201
 
202
  </div>
203
  <script id="ecwd_script_handler" type="text/javascript">
204
  if (typeof ecwd_js_init_call == "object") {
205
- ecwd_js_init_call = new ecwd_js_init();
206
- ecwd_js_init_call.showMap();
207
- }
208
  </script>
2
  /**
3
  * Display for Venue Custom Post Types
4
  */
5
+ $date_format = 'Y-m-d';
6
+ $time_format = 'H:i';
 
7
  $ecwd_social_icons = false;
8
+ if (isset($ecwd_options['date_format']) && $ecwd_options['date_format'] != '') {
9
+ $date_format = $ecwd_options['date_format'];
10
  }
11
+ if (isset($ecwd_options['time_format']) && $ecwd_options['time_format'] != '') {
12
+ $time_format = $ecwd_options['time_format'];
13
  }
14
+ $time_format .= (isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : '');
15
+ if (isset($ecwd_options['time_type']) && $ecwd_options['time_type'] != '') {
16
+ $time_format = str_replace('H', 'g', $time_format);
17
+ $time_format = str_replace('h', 'g', $time_format);
18
  }
19
+ if (isset($ecwd_options['social_icons']) && $ecwd_options['social_icons'] != '') {
20
+ $ecwd_social_icons = $ecwd_options['social_icons'];
21
  }
22
 
23
+ $post_id = $post->ID;
24
+ $venue_url = get_permalink($post_id);
25
+ $meta = get_post_meta($post_id);
26
+ $events = array();
27
 
28
  // Load up all post meta data
29
+ $ecwd_venue_location = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_venue_location', true);
30
+ $ecwd_venue_latlong = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_venue_lat_long', true);
31
+ $ecwd_venue_zoom = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_map_zoom', true);
32
+ if (!$ecwd_venue_zoom) {
33
+ $ecwd_venue_zoom = 17;
34
  }
35
 
36
+ $today = date('Y-m-d');
37
+
38
+ $args = array(
39
+ 'numberposts' => - 1,
40
+ 'post_type' => ECWD_PLUGIN_PREFIX . '_event',
41
+ 'meta_query' => array(
42
+ array(
43
+ 'key' => ECWD_PLUGIN_PREFIX . '_event_venue',
44
+ 'value' => $post->ID
45
+ )
46
+ ),
47
+ 'meta_key' => ECWD_PLUGIN_PREFIX . '_event_date_from',
48
+ 'orderby' => 'meta_value',
49
+ 'order' => 'ASC'
50
  );
51
+ $ecwd_events = get_posts($args);
52
 
53
  //var_dump($ecwd_events);
54
+ foreach ($ecwd_events as $ecwd_event) {
55
+
56
+ $term_metas = '';
57
+ $categories = get_the_terms($ecwd_event->ID, ECWD_PLUGIN_PREFIX . '_event_category');
58
+ if (is_array($categories)) {
59
+ foreach ($categories as $category) {
60
+ $term_metas = get_option("ecwd_event_category_$category->term_id");
61
+ $term_metas['id'] = $category->term_id;
62
+ $term_metas['name'] = $category->name;
63
+ $term_metas['slug'] = $category->slug;
64
+ }
65
+ }
66
+ $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
67
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
68
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) {
69
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => '');
70
+ }
71
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'])) {
72
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'] = array(0 => '');
73
+ }
74
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'])) {
75
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'] = array(0 => '');
76
+ }
77
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'])) {
78
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'] = array(0 => '');
79
+ }
80
+
81
+
82
+ $permalink = get_permalink($ecwd_event->ID);
83
+
84
+
85
+ $events[$ecwd_event->ID] = new ECWD_Event($ecwd_event->ID, 0, $ecwd_event->post_title, $ecwd_event->post_content, $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'][0], $permalink, $ecwd_event, $term_metas, $ecwd_event_metas);
 
86
  }
87
 
88
+ $d = new ECWD_Display(0, '', '', $today);
89
  $max_date = date('Y-m-d', strtotime(( date("Y-m-t", ( strtotime(date('Y-m-d')))) . " +" . ( ( 12 ) ) . " month")));
90
+ $events = $d->get_event_days($events, 1, date('Y-m-d'), $max_date);
91
+ $events = $d->events_unique($events);
92
  ?>
93
  <?php
 
94
  echo $content;
95
  ?>
96
 
97
  <div class="ecwd-venue">
98
+ <?php if ($ecwd_social_icons) { ?>
99
+ <div class="ecwd-social">
100
  <span class="share-links">
101
+ <a href="http://twitter.com/home?status=<?php echo get_permalink($post_id) ?>" class="ecwd-twitter"
102
+ target="_blank" data-original-title="Tweet It">
103
+ <span class="visuallyhidden">Twitter</span></a>
104
+
105
+ <a href="http://www.facebook.com/sharer.php?u=<?php echo get_permalink($post_id) ?>" class="ecwd-facebook"
106
+ target="_blank" data-original-title="Share on Facebook">
107
+ <span class="visuallyhidden">Facebook</span></a>
108
+
109
+ <a href="http://plus.google.com/share?url=<?php echo get_permalink($post_id) ?>" class="ecwd-google-plus"
110
+ target="_blank" data-original-title="Share on Google+">
111
+ <span class="visuallyhidden">Google+</span></a>
112
+
113
+ </span>
114
+ </div>
115
+ <?php } ?>
116
+
117
+
118
+ <?php
119
+ if ($ecwd_venue_latlong) {
120
+ $map_events = array();
121
+ $map_events[0]['latlong'] = explode(',', $ecwd_venue_latlong);
122
+ $map_events[0]['zoom'] = $ecwd_venue_zoom;
123
+ $map_events[0]['infow'] = '<div class="ecwd_map_venue">';
124
+ $map_events[0]['infow'] .= '<span class="name">' . $post->post_title . '</span><br />';
125
+ $map_events[0]['infow'] .= '<span class="location">' . $ecwd_venue_location . '</span>';
126
+ $map_events[0]['infow'] .= '</div>';
127
+ $markers = json_encode($map_events);
128
+ ?>
129
+ <div class="ecwd-show-map">
130
+ <div id="ecwd_map_div" class="ecwd_map_div">
131
+ </div>
132
+ <textarea id="ecwd_markers" class="hidden" style="display: none;"><?php echo $markers; ?></textarea>
133
+ </div>
134
+ <?php
135
+ }
136
+ do_action('ecwd_show_related_events', $events, false);
137
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  </div>
140
  <script id="ecwd_script_handler" type="text/javascript">
141
  if (typeof ecwd_js_init_call == "object") {
142
+ ecwd_js_init_call = new ecwd_js_init();
143
+ ecwd_js_init_call.showMap();
144
+ }
145
  </script>
views/related_events.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (count($events) > 0) {
3
+ global $post;
4
+ if ($upcoming_events) {
5
+ $evs_text = 'Related upcoming events';
6
+ } else {
7
+ $evs_text = 'Upcoming events';
8
+ }
9
+ ?>
10
+ <div class="ecwd-organizer-events">
11
+ <h3><?php _e($evs_text, 'ecwd') ?></h3>
12
+
13
+ <div class="upcoming_events_slider">
14
+ <div class="upcoming_events_slider-arrow-left"><a href="#left"></a></div>
15
+ <div class="upcoming_events_slider-arrow-right"><a href="#right"></a></div>
16
+ <ul>
17
+ <?php
18
+ $events_count = 0;
19
+ foreach ($events as $key => $ecwd_event) {
20
+ if ($related_events_count >= 0 && $events_count > $related_events_count) {
21
+ break;
22
+ }
23
+ if ($upcoming_events == false || ($upcoming_events == true && strtotime($ecwd_event['from']) >= strtotime($today))) {
24
+ $events_count++;
25
+ ?>
26
+ <li itemscope itemtype="http://schema.org/Event" class="upcoming_events_item">
27
+ <div class="upcoming_event_container">
28
+ <?php
29
+ $image_class = '';
30
+ $image = getAndReplaceFirstImage($ecwd_event['post']->post_content);
31
+ if (!has_post_thumbnail($ecwd_event['id']) && $image['image'] == "") {
32
+ $image_class = "ecwd-no-image";
33
+ }
34
+ echo '<div class="upcoming_events_item-img ' . $image_class . '">';
35
+ if (get_the_post_thumbnail($ecwd_event['id'])) {
36
+ echo get_the_post_thumbnail($ecwd_event['id'], 'thumb');
37
+ } elseif ($image['image'] != null) {
38
+ echo '<img src="' . $image['image'] . '" />';
39
+ $ecwd_event['post']->post_content = $image['content'];
40
+ }
41
+ echo '</div>';
42
+ ?>
43
+ <div class="event-title" itemprop="name">
44
+ <a href="<?php echo $ecwd_event['permalink'] ?>"><?php echo $ecwd_event['title'] ?></a>
45
+ </div>
46
+ <div class="event-date" itemprop="startDate"
47
+ content="<?php echo date('Y-m-d', strtotime($ecwd_event['from'])) . 'T' . date('H:i', strtotime($ecwd_event['starttime'])) ?>">
48
+ <?php
49
+ if (isset($ecwd_event['all_day_event']) && $ecwd_event['all_day_event'] == 1) {
50
+ echo date($date_format, strtotime($ecwd_event['from']));
51
+ if ($ecwd_event['to'] && date($date_format, strtotime($ecwd_event['from'])) !== date($date_format, strtotime($ecwd_event['to']))) {
52
+ echo ' - ' . date($date_format, strtotime($ecwd_event['to']));
53
+ }
54
+ echo ' ' . __('All day', 'ecwd');
55
+ } else {
56
+
57
+ echo date($date_format, strtotime($ecwd_event['from'])) . ' ' . date($time_format, strtotime($ecwd_event['starttime']));
58
+
59
+ if ($ecwd_event['to']) {
60
+ echo ' - ' . date($date_format, strtotime($ecwd_event['to'])) . ' ' . date($time_format, strtotime($ecwd_event['endtime']));
61
+ }
62
+ }
63
+ ?>
64
+ </div>
65
+ <div class="upcoming_events_item-content"><?php echo( $ecwd_event['post']->post_content ? $ecwd_event['post']->post_content : 'No additional details for this event.' ); ?> </div>
66
+ </div>
67
+ </li>
68
+ <?php
69
+ }
70
+ }
71
+ ?>
72
+ </ul>
73
+ </div>
74
+ </div>
75
+ <?php } ?>
views/single-event.php CHANGED
@@ -24,7 +24,7 @@ if (isset($ecwd_options['time_format']) && $ecwd_options['time_format'] != '') {
24
  $time_format = $ecwd_options['time_format'];
25
  }
26
  $time_format .= (isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : '');
27
- if(isset($ecwd_options['time_type']) && $ecwd_options['time_type'] !='') {
28
  $time_format = str_replace('H', 'g', $time_format);
29
  $time_format = str_replace('h', 'g', $time_format);
30
  }
@@ -38,8 +38,8 @@ $ecwd_event = $post;
38
  $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
39
  $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0];
40
  $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0];
41
- if ( ! isset( $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_url' ] ) ) {
42
- $ecwd_event_metas[ ECWD_PLUGIN_PREFIX . '_event_url' ] = array( 0 => '' );
43
  }
44
  if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) {
45
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => '');
@@ -121,16 +121,16 @@ $event_tags = wp_get_post_terms($post->ID, 'ecwd_event_tag', $args);
121
  $event_categories = wp_get_post_terms($post->ID, 'ecwd_event_category', $args);
122
 
123
  $event_title_style = '';
124
- if(isset($ecwd_options['cat_title_color']) && $ecwd_options['cat_title_color']==1) {
125
- if ( ! empty( $event_categories ) ) {
126
- if ( isset( $event_categories[0] ) ) {
127
- $cat = $event_categories[0];
128
- $metas = get_option( "ecwd_event_category_$cat->term_id" );
129
- if ( isset( $metas['color'] ) ) {
130
- $event_title_style = 'style = "color: ' . $metas['color'] . '"';
131
- }
132
- }
133
- }
134
  }
135
 
136
  get_header();
@@ -143,424 +143,363 @@ get_header();
143
  the_post();
144
  ?>
145
  <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
146
- <article>
147
- <div class="ecwd-event" itemscope itemtype="http://schema.org/Event">
148
- <header class="entry-header">
149
- <?php the_title( '<h1 itemprop="name" class="ecwd-events-single-event-title summary entry-title" ' . $event_title_style . '>', '</h1>' ); ?>
150
- </header>
151
- <?php if ( isset( $_SERVER['HTTP_REFERER'] ) && $_SERVER['HTTP_REFERER'] ) {
152
- if ( parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST ) == parse_url( site_url(), PHP_URL_HOST ) ) {?>
153
- <a id="ecwd_back_link" href="#">Back</a>
154
- <?php }
155
- }?>
156
- <div class="event-detalis">
157
-
158
- <?php ?>
159
- <?php if ($featured_image && $featured_image !== '') { ?>
160
- <div class="event-featured-image">
161
- <img src="<?php echo $featured_image; ?>"/>
162
- </div>
163
- <?php } ?>
164
- <div class="ecwd-event-details">
165
- <div class="event-detalis-date">
166
- <label class="ecwd-event-date-info"
167
- title="<?php _e('Date', 'ecwd'); ?>"></label>
168
- <span class="ecwd-event-date" itemprop="startDate"
169
- content="<?php echo date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) ?>">
170
- <?php
171
- if ($ecwd_all_day_event == 1) {
172
- echo date($date_format, strtotime($ecwd_event_date_from));
 
 
173
  if ($ecwd_all_day_event == 1) {
174
- if ($ecwd_event_date_to && date($date_format, strtotime($ecwd_event_date_from)) !== date($date_format, strtotime($ecwd_event_date_to))) {
175
- echo ' - ' . date($date_format, strtotime($ecwd_event_date_to));
 
 
 
 
176
  }
177
- echo ' ' . __('All day', 'ecwd');
178
- }
179
- } else {
180
- echo date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
181
 
182
- if ($ecwd_event_date_to) {
183
- echo ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
 
184
  }
185
- }
186
- ?>
187
- </span>
188
- </div>
189
- <?php
190
- if (isset($ecwd_options['show_repeat_rate'])) {
191
- $repeat_rate_text = $d->get_repeat_rate($post_id, '', $date_format);
192
- if ($repeat_rate_text != ''):
193
- ?>
194
- <div class="ecwd_repeat_rate_text">
195
- <span><?php echo $d->get_repeat_rate($post_id, '', $date_format); ?></span>
196
- </div>
197
- <?php
198
- endif;
199
- }
200
- ?>
201
- <?php if ($ecwd_event_url) { ?>
202
- <div class="ecwd-url">
203
-
204
- <a href="<?php echo $ecwd_event_url; ?>" target="_blank"><label
205
- class="ecwd-event-url-info"
206
- title="<?php _e('Url', 'ecwd'); ?>"></label> <?php echo $ecwd_event_url; ?>
207
- </a>
208
  </div>
209
- <?php } ?>
210
- <?php if (count($organizers) > 0) { ?>
211
- <div class="event-detalis-org">
212
- <label class="ecwd-event-org-info"
213
- title="<?php _e('Organizers', 'ecwd'); ?>"></label>
214
- <?php foreach ($organizers as $organizer) { ?>
215
- <span itemprop="organizer">
216
- <a href="<?php echo get_permalink($organizer['ID']) ?>"><?php echo $organizer['post_title'] ?></a>
217
- </span>
 
 
 
 
 
 
 
 
 
 
 
218
  <?php } ?>
219
- </div>
220
- <?php } ?>
221
- <div class="event-venue" itemprop="location" itemscope
222
- itemtype="http://schema.org/Place">
223
- <?php if ($venue_post_id) { ?>
224
- <label class="ecwd-venue-info"
225
- title="<?php _e('Venue', 'ecwd'); ?>"></label>
226
- <span itemprop="name"><a
227
- href="<?php echo $venue_permalink ?>"><?php echo $venue; ?></a></span>
228
- <div class="address" itemprop="address" itemscope
229
- itemtype="http://schema.org/PostalAddress">
230
- <?php echo $ecwd_event_location; ?>
231
  </div>
232
-
233
- <?php } elseif ($ecwd_event_location) { ?>
234
- <span class="ecwd_hidden" itemprop="name"><?php echo $ecwd_event_location; ?></span>
235
- <label class="ecwd-venue-info"
236
- title="<?php _e('Location', 'ecwd'); ?>"></label>
237
- <span class="address" itemprop="address" itemscope
238
- itemtype="http://schema.org/PostalAddress">
239
- <?php echo $ecwd_event_location; ?>
240
- </span>
241
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  </div>
243
- <?php do_action('ecwd_view_ext'); ?>
244
  </div>
245
- </div>
246
- <?php if ($ecwd_social_icons) {
247
- ?>
248
 
249
- <div class="ecwd-social">
250
- <span class="share-links">
251
- <a href="http://twitter.com/home?status=<?php echo get_permalink($post_id) ?>"
252
- class="ecwd-twitter"
253
- target="_blank" data-original-title="Tweet It">
254
- <span class="visuallyhidden">Twitter</span></a>
255
- <a href="http://www.facebook.com/sharer.php?u=<?php echo get_permalink($post_id) ?>"
256
- class="ecwd-facebook"
257
- target="_blank" data-original-title="Share on Facebook">
258
- <span class="visuallyhidden">Facebook</span></a>
259
- <a href="http://plus.google.com/share?url=<?php echo get_permalink($post_id) ?>"
260
- class="ecwd-google-plus"
261
- target="_blank" data-original-title="Share on Google+">
262
- <span class="visuallyhidden">Google+</span></a>
263
- </span>
264
- </div>
265
- <?php } ?>
266
- <?php
267
- if ($ecwd_event_show_map == 1 && $ecwd_event_latlong) {
268
- $map_events = array();
269
- $map_events[0]['latlong'] = explode(',', $ecwd_event_latlong);
270
- if ($ecwd_event_location != '') {
271
- $map_events[0]['location'] = $ecwd_event_location;
272
- }
273
- $map_events[0]['zoom'] = $ecwd_event_zoom;
274
- $map_events[0]['infow'] = '<div class="ecwd_map_event">';
275
- $map_events[0]['infow'] .= '<span class="location">' . $ecwd_event_location . '</span>';
276
- $map_events[0]['infow'] .= '</div>';
277
- $map_events[0]['infow'] .= '<div class="event-detalis-date">
278
  <label class="ecwd-event-date-info" title="' . __('Date', 'ecwd') . '"></label>
279
  <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)) . '">';
280
- if ($ecwd_all_day_event == 1) {
281
- $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_from));
282
- if ($ecwd_event_date_to) {
283
- $map_events[0]['infow'] .= ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . __('All day', 'ecwd');
284
- }
285
- } else {
286
- $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
287
 
288
- if ($ecwd_event_date_to) {
289
- $map_events[0]['infow'] .= ' '.date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
 
290
  }
291
- }
292
- $map_events[0]['infow'] .= ' </span>
293
  </div>';
294
 
295
- $markers = json_encode($map_events);
296
- ?>
297
- <div class="ecwd-show-map">
298
- <div class="ecwd_map_div">
 
 
 
299
  </div>
300
- <textarea class="hidden ecwd_markers"
301
- style="display: none;"><?php echo $markers; ?></textarea>
302
- </div>
303
- <?php } ?>
304
- <div class="clear"></div>
305
 
306
 
307
- <div class="ecwd-event-video">
308
- <?php
309
- if (strpos($ecwd_event_video, 'youtube') > 0) {
310
- parse_str(parse_url($ecwd_event_video, PHP_URL_QUERY), $video_array_of_vars);
311
- if (isset($video_array_of_vars['v']) && $video_array_of_vars['v']) {
312
- ?>
313
- <object data="http://www.youtube.com/v/<?php echo $video_array_of_vars['v'] ?>"
314
- type="application/x-shockwave-flash" width="400" height="300">
315
- <param name="src"
316
- value="http://www.youtube.com/v/<?php echo $video_array_of_vars['v'] ?>"/>
317
- </object>
318
- <?php
319
- }
320
- } elseif (strpos($ecwd_event_video, 'vimeo') > 0) {
321
- $videoID = explode('/', $ecwd_event_video);
322
- $videoID = $videoID[count($videoID) - 1];
323
- if ($videoID) {
324
- ?>
325
- <iframe
326
- src="http://player.vimeo.com/video/<?php echo $videoID; ?>?title=0&amp;byline=0&amp;portrait=0&amp;badge=0&amp;color=ffffff"
327
- width="" height="" frameborder="0" webkitAllowFullScreen mozallowfullscreen
328
- allowFullScreen></iframe>
329
  <?php
330
  }
331
- }
332
- ?>
333
- </div>
334
- <!-- Content -->
335
- <div>
336
- <?php the_content(); ?>
337
- </div>
338
- <!-- End Content -->
339
- <!-- Categories and tags -->
340
- <?php if ($category_and_tags == 1) { ?>
341
- <div class="event_cageory_and_tags">
342
-
343
- <?php if (!empty($event_categories)) { ?>
344
- <ul class="event_categories">
345
- <?php
346
- foreach ($event_categories as $category) {
347
-
348
- $metas = get_option("ecwd_event_category_$category->term_id");
349
- ?>
350
- <li class="event_category event-details-title">
351
- <?php if ($metas['color']) { ?>
352
- <span class="event-metalabel"
353
- style="background:<?php echo $metas['color']; ?>"></span>
354
- <span class="event_catgeory_name"> <a
355
- href="<?php echo get_category_link($category); ?>"
356
- style="color:<?php echo $metas['color']; ?>"><?php echo $category->name; ?> </a></span>
357
- <?php } else { ?>
358
- <span class="event_catgeory_name"> <a
359
- href="<?php echo get_category_link($category); ?>"><?php echo $category->name; ?> </a></span>
360
- <?php } ?>
361
- </li>
362
  <?php
363
  }
364
- ?>
365
- </ul>
366
- <?php
367
- }
368
- ?>
369
-
370
-
371
- <?php
372
- if (!empty($event_tags)) {
373
  ?>
 
 
 
 
 
 
 
 
 
374
 
375
- <ul class="event_tags">
 
 
 
376
 
377
- <?php
378
- foreach ($event_tags as $tag) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  ?>
380
- <li class="event_tag">
381
- <span class="event_tag_name">
382
- <a href="<?php echo get_tag_link($tag); ?>">#<?php echo $tag->name; ?> </a>
383
- </span>
384
- </li>
385
- <?php
386
- }
387
- ?></ul>
388
- <?php
389
- }
390
- ?>
391
- </div>
392
- <?php } ?>
393
- <!-- END Categories and tags -->
394
-
395
-
396
-
397
- <?php
398
- if (!isset($ecwd_options['related_events']) || $ecwd_options['related_events'] == 1) {
399
- $post_cats = wp_get_post_terms($post_id, ECWD_PLUGIN_PREFIX . '_event_category');
400
- $cat_ids = wp_list_pluck($post_cats, 'term_id');
401
- $post_tags = wp_get_post_terms($post_id, ECWD_PLUGIN_PREFIX . '_event_tag');
402
- $tag_ids = wp_list_pluck($post_tags, 'term_id');
403
- $events = array();
404
- $today = date('Y-m-d');
405
-
406
- $args = array(
407
- 'numberposts' => - 1,
408
- 'post_type' => ECWD_PLUGIN_PREFIX . '_event',
409
- 'tax_query' => array(
410
- array(
411
- 'taxonomy' => ECWD_PLUGIN_PREFIX . '_event_category',
412
- 'terms' => $cat_ids,
413
- 'field' => 'term_id',
414
- )
415
- ),
416
- 'orderby' => 'meta_value',
417
- 'order' => 'ASC'
418
- );
419
- $ecwd_events_by_cats = get_posts($args);
420
- $args = array(
421
- 'numberposts' => - 1,
422
- 'post_type' => ECWD_PLUGIN_PREFIX . '_event',
423
- 'tax_query' => array(
424
- array(
425
- 'taxonomy' => ECWD_PLUGIN_PREFIX . '_event_tag',
426
- 'terms' => $tag_ids,
427
- 'field' => 'term_id',
428
- ),
429
- ),
430
- 'orderby' => 'meta_value',
431
- 'order' => 'ASC'
432
- );
433
- $ecwd_events_by_tags = get_posts($args);
434
- $ecwd_events = array_merge($ecwd_events_by_tags, $ecwd_events_by_cats);
435
- $ecwd_events = array_map("unserialize", array_unique(array_map("serialize", $ecwd_events)));
436
- wp_reset_postdata();
437
- wp_reset_query();
438
-
439
- foreach ($ecwd_events as $ecwd_event) {
440
- if ($ecwd_event->ID != $post_id) {
441
- $term_metas = '';
442
- $categories = get_the_terms($ecwd_event->ID, ECWD_PLUGIN_PREFIX . '_event_category');
443
- if (is_array($categories)) {
444
- foreach ($categories as $category) {
445
- $term_metas = get_option("ecwd_event_category_$category->term_id");
446
- $term_metas['id'] = $category->term_id;
447
- $term_metas['name'] = $category->name;
448
- $term_metas['slug'] = $category->slug;
449
- }
450
- }
451
- $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
452
- $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
453
- if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) {
454
- $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => '');
455
- }
456
- if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'])) {
457
- $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'] = array(0 => '');
458
- }
459
- if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'])) {
460
- $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'] = array(0 => '');
461
- }
462
- if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'])) {
463
- $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'] = array(0 => '');
464
  }
 
465
 
466
- $permalink = get_permalink($ecwd_event->ID);
467
- $events[$ecwd_event->ID] = new ECWD_Event($ecwd_event->ID, 0, $ecwd_event->post_title, $ecwd_event->post_content, $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'][0], $permalink, $ecwd_event, $term_metas, $ecwd_event_metas);
468
- }
469
- }
470
-
471
- $d = new ECWD_Display(0, '', '', $today);
472
- $events = $d->get_event_days($events, 0);
473
- ?>
474
 
475
- <?php
476
- if (count($events) > 0) {
477
- $events = $d->events_unique($events);
478
- ?>
479
- <!-- Related Events-->
480
- <div class="ecwd-upcoming-events">
481
- <h3> <?php _e('Related events', 'ecwd') ?></h3>
482
 
483
- <div class="upcoming_events_slider">
484
 
485
- <div class="upcoming_events_slider-arrow-left"><a href="#left"></a></div>
486
- <div class="upcoming_events_slider-arrow-right"><a href="#right"></a></div>
487
- <ul>
488
  <?php
489
- foreach ($events as $ecwd_event) {
490
  ?>
491
- <li itemscope itemtype="http://schema.org/Event" class="upcoming_events_item"
492
- data-date="<?php echo date('Y-m-d', strtotime($ecwd_event['from'])); ?>">
493
- <div class="upcoming_event_container">
494
- <?php
495
- $image_class = '';
496
- $image = getAndReplaceFirstImage($ecwd_event['post']->post_content);
497
- if (!has_post_thumbnail($ecwd_event['id']) && $image['image'] == "") {
498
- $image_class = "ecwd-no-image";
499
- }
500
- echo '<div class="upcoming_events_item-img ' . $image_class . '">';
501
- if (get_the_post_thumbnail($ecwd_event['id'])) {
502
- echo get_the_post_thumbnail($ecwd_event['id'], 'thumb');
503
- } elseif ($image['image'] != null) {
504
- echo '<img src="' . $image['image'] . '" />';
505
- $ecwd_event['post']->post_content = $image['content'];
506
- }
507
- echo '</div>';
508
- ?>
509
- <div class="event-title" itemprop="name">
510
- <a href="<?php echo $ecwd_event['permalink'] ?>"><?php echo $ecwd_event['title'] ?></a>
511
- </div>
512
- <div class="event-date" itemprop="startDate"
513
- content="<?php echo date('Y-m-d', strtotime($ecwd_event['from'])) . 'T' . date('H:i', strtotime($ecwd_event['starttime'])) ?>">
514
-
515
- <?php
516
- if (isset($ecwd_event['all_day_event']) && $ecwd_event['all_day_event'] == 1) {
517
- echo date($date_format, strtotime($ecwd_event['from']));
518
- if ($ecwd_event['to'] && date($date_format, strtotime($ecwd_event['from'])) !== date($date_format, strtotime($ecwd_event['to']))) {
519
- echo ' - ' . date($date_format, strtotime($ecwd_event['to']));
520
- }
521
- echo ' ' . __('All day', 'ecwd');
522
- } else {
523
-
524
- echo date($date_format, strtotime($ecwd_event['from'])) . ' ' . date($time_format, strtotime($ecwd_event['starttime']));
525
-
526
- if ($ecwd_event['to']) {
527
- echo ' - ' . date($date_format, strtotime($ecwd_event['to'])) . ' ' . date($time_format, strtotime($ecwd_event['endtime']));
528
- }
529
- }
530
- ?>
531
- </div>
532
-
533
-
534
- <div
535
- class="upcoming_events_item-content"><?php echo( $ecwd_event['post']->post_content ? $ecwd_event['post']->post_content : 'No additional details for this event.' ); ?> </div>
536
- </div>
537
  </li>
538
  <?php
539
  }
540
- ?>
541
- </ul>
542
- </div>
 
543
  </div>
544
-
545
  <?php } ?>
546
- <?php } ?>
547
 
548
- </div>
549
- <!-- #Related Events-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
550
  </article>
551
  </div> <!-- #post-x -->
552
- <?php if (comments_open() && $post->comment_status == 'open') { ?>
553
  <div class="ecwd-comments">
554
 
555
- <?php echo comments_template(); ?>
556
  </div>
557
  <?php } ?>
558
- <?php endwhile; ?>
559
 
560
  </div>
561
- <script id="ecwd_script_handler" type="text/javascript">if(typeof ecwd_js_init_call=="object"){ecwd_js_init_call = new ecwd_js_init();}</script>
 
 
562
  <?php
563
- if(defined( 'ECWD_TEHEME' ) && ECWD_TEHEME=='twentyfourteen') {
564
- get_sidebar();
565
  }
566
- get_footer(); ?>
 
24
  $time_format = $ecwd_options['time_format'];
25
  }
26
  $time_format .= (isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : '');
27
+ if (isset($ecwd_options['time_type']) && $ecwd_options['time_type'] != '') {
28
  $time_format = str_replace('H', 'g', $time_format);
29
  $time_format = str_replace('h', 'g', $time_format);
30
  }
38
  $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
39
  $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0];
40
  $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0];
41
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'])) {
42
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
43
  }
44
  if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) {
45
  $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => '');
121
  $event_categories = wp_get_post_terms($post->ID, 'ecwd_event_category', $args);
122
 
123
  $event_title_style = '';
124
+ if (isset($ecwd_options['cat_title_color']) && $ecwd_options['cat_title_color'] == 1) {
125
+ if (!empty($event_categories)) {
126
+ if (isset($event_categories[0])) {
127
+ $cat = $event_categories[0];
128
+ $metas = get_option("ecwd_event_category_$cat->term_id");
129
+ if (isset($metas['color'])) {
130
+ $event_title_style = 'style = "color: ' . $metas['color'] . '"';
131
+ }
132
+ }
133
+ }
134
  }
135
 
136
  get_header();
143
  the_post();
144
  ?>
145
  <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
146
+ <article>
147
+ <div class="ecwd-event" itemscope itemtype="http://schema.org/Event">
148
+ <header class="entry-header">
149
+ <?php the_title('<h1 itemprop="name" class="ecwd-events-single-event-title summary entry-title" ' . $event_title_style . '>', '</h1>'); ?>
150
+ </header>
151
+ <?php
152
+ if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) {
153
+ if (parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) == parse_url(site_url(), PHP_URL_HOST)) {
154
+ ?>
155
+ <a id="ecwd_back_link" href="#">Back</a>
156
+ <?php
157
+ }
158
+ }
159
+ ?>
160
+ <div class="event-detalis">
161
+
162
+ <?php ?>
163
+ <?php if ($featured_image && $featured_image !== '') { ?>
164
+ <div class="event-featured-image">
165
+ <img src="<?php echo $featured_image; ?>"/>
166
+ </div>
167
+ <?php } ?>
168
+ <div class="ecwd-event-details">
169
+ <div class="event-detalis-date">
170
+ <label class="ecwd-event-date-info"
171
+ title="<?php _e('Date', 'ecwd'); ?>"></label>
172
+ <span class="ecwd-event-date" itemprop="startDate"
173
+ content="<?php echo date('Y-m-d', strtotime($ecwd_event_date_from)) . 'T' . date('H:i', strtotime($ecwd_event_date_from)) ?>">
174
+ <?php
175
  if ($ecwd_all_day_event == 1) {
176
+ echo date($date_format, strtotime($ecwd_event_date_from));
177
+ if ($ecwd_all_day_event == 1) {
178
+ if ($ecwd_event_date_to && date($date_format, strtotime($ecwd_event_date_from)) !== date($date_format, strtotime($ecwd_event_date_to))) {
179
+ echo ' - ' . date($date_format, strtotime($ecwd_event_date_to));
180
+ }
181
+ echo ' ' . __('All day', 'ecwd');
182
  }
183
+ } else {
184
+ echo date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
 
 
185
 
186
+ if ($ecwd_event_date_to) {
187
+ echo ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
188
+ }
189
  }
190
+ ?>
191
+ </span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  </div>
193
+ <?php
194
+ if (isset($ecwd_options['show_repeat_rate'])) {
195
+ $repeat_rate_text = $d->get_repeat_rate($post_id, '', $date_format);
196
+ if ($repeat_rate_text != ''):
197
+ ?>
198
+ <div class="ecwd_repeat_rate_text">
199
+ <span><?php echo $d->get_repeat_rate($post_id, '', $date_format); ?></span>
200
+ </div>
201
+ <?php
202
+ endif;
203
+ }
204
+ ?>
205
+ <?php if ($ecwd_event_url) { ?>
206
+ <div class="ecwd-url">
207
+
208
+ <a href="<?php echo $ecwd_event_url; ?>" target="_blank"><label
209
+ class="ecwd-event-url-info"
210
+ title="<?php _e('Url', 'ecwd'); ?>"></label> <?php echo $ecwd_event_url; ?>
211
+ </a>
212
+ </div>
213
  <?php } ?>
214
+ <?php if (count($organizers) > 0) { ?>
215
+ <div class="event-detalis-org">
216
+ <label class="ecwd-event-org-info"
217
+ title="<?php _e('Organizers', 'ecwd'); ?>"></label>
218
+ <?php foreach ($organizers as $organizer) { ?>
219
+ <span itemprop="organizer">
220
+ <a href="<?php echo get_permalink($organizer['ID']) ?>"><?php echo $organizer['post_title'] ?></a>
221
+ </span>
222
+ <?php } ?>
 
 
 
223
  </div>
224
+ <?php } ?>
225
+ <div class="event-venue" itemprop="location" itemscope
226
+ itemtype="http://schema.org/Place">
227
+ <?php if ($venue_post_id) { ?>
228
+ <label class="ecwd-venue-info"
229
+ title="<?php _e('Venue', 'ecwd'); ?>"></label>
230
+ <span itemprop="name"><a
231
+ href="<?php echo $venue_permalink ?>"><?php echo $venue; ?></a></span>
232
+ <div class="address" itemprop="address" itemscope
233
+ itemtype="http://schema.org/PostalAddress">
234
+ <?php echo $ecwd_event_location; ?>
235
+ </div>
236
+
237
+ <?php } elseif ($ecwd_event_location) { ?>
238
+ <span class="ecwd_hidden" itemprop="name"><?php echo $ecwd_event_location; ?></span>
239
+ <label class="ecwd-venue-info"
240
+ title="<?php _e('Location', 'ecwd'); ?>"></label>
241
+ <span class="address" itemprop="address" itemscope
242
+ itemtype="http://schema.org/PostalAddress">
243
+ <?php echo $ecwd_event_location; ?>
244
+ </span>
245
+ <?php } ?>
246
+ </div>
247
+ <?php do_action('ecwd_view_ext'); ?>
248
  </div>
 
249
  </div>
250
+ <?php if ($ecwd_social_icons) {
251
+ ?>
 
252
 
253
+ <div class="ecwd-social">
254
+ <span class="share-links">
255
+ <a href="http://twitter.com/home?status=<?php echo get_permalink($post_id) ?>"
256
+ class="ecwd-twitter"
257
+ target="_blank" data-original-title="Tweet It">
258
+ <span class="visuallyhidden">Twitter</span></a>
259
+ <a href="http://www.facebook.com/sharer.php?u=<?php echo get_permalink($post_id) ?>"
260
+ class="ecwd-facebook"
261
+ target="_blank" data-original-title="Share on Facebook">
262
+ <span class="visuallyhidden">Facebook</span></a>
263
+ <a href="http://plus.google.com/share?url=<?php echo get_permalink($post_id) ?>"
264
+ class="ecwd-google-plus"
265
+ target="_blank" data-original-title="Share on Google+">
266
+ <span class="visuallyhidden">Google+</span></a>
267
+ </span>
268
+ </div>
269
+ <?php } ?>
270
+ <?php
271
+ if ($ecwd_event_show_map == 1 && $ecwd_event_latlong) {
272
+ $map_events = array();
273
+ $map_events[0]['latlong'] = explode(',', $ecwd_event_latlong);
274
+ if ($ecwd_event_location != '') {
275
+ $map_events[0]['location'] = $ecwd_event_location;
276
+ }
277
+ $map_events[0]['zoom'] = $ecwd_event_zoom;
278
+ $map_events[0]['infow'] = '<div class="ecwd_map_event">';
279
+ $map_events[0]['infow'] .= '<span class="location">' . $ecwd_event_location . '</span>';
280
+ $map_events[0]['infow'] .= '</div>';
281
+ $map_events[0]['infow'] .= '<div class="event-detalis-date">
282
  <label class="ecwd-event-date-info" title="' . __('Date', 'ecwd') . '"></label>
283
  <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)) . '">';
284
+ if ($ecwd_all_day_event == 1) {
285
+ $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_from));
286
+ if ($ecwd_event_date_to) {
287
+ $map_events[0]['infow'] .= ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . __('All day', 'ecwd');
288
+ }
289
+ } else {
290
+ $map_events[0]['infow'] .= date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
291
 
292
+ if ($ecwd_event_date_to) {
293
+ $map_events[0]['infow'] .= ' ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
294
+ }
295
  }
296
+ $map_events[0]['infow'] .= ' </span>
 
297
  </div>';
298
 
299
+ $markers = json_encode($map_events);
300
+ ?>
301
+ <div class="ecwd-show-map">
302
+ <div class="ecwd_map_div">
303
+ </div>
304
+ <textarea class="hidden ecwd_markers"
305
+ style="display: none;"><?php echo $markers; ?></textarea>
306
  </div>
307
+ <?php } ?>
308
+ <div class="clear"></div>
 
 
 
309
 
310
 
311
+ <div class="ecwd-event-video">
312
+ <?php
313
+ if (strpos($ecwd_event_video, 'youtube') > 0) {
314
+ parse_str(parse_url($ecwd_event_video, PHP_URL_QUERY), $video_array_of_vars);
315
+ if (isset($video_array_of_vars['v']) && $video_array_of_vars['v']) {
316
+ ?>
317
+ <object data="http://www.youtube.com/v/<?php echo $video_array_of_vars['v'] ?>"
318
+ type="application/x-shockwave-flash" width="400" height="300">
319
+ <param name="src"
320
+ value="http://www.youtube.com/v/<?php echo $video_array_of_vars['v'] ?>"/>
321
+ </object>
 
 
 
 
 
 
 
 
 
 
 
322
  <?php
323
  }
324
+ } elseif (strpos($ecwd_event_video, 'vimeo') > 0) {
325
+ $videoID = explode('/', $ecwd_event_video);
326
+ $videoID = $videoID[count($videoID) - 1];
327
+ if ($videoID) {
328
+ ?>
329
+ <iframe
330
+ src="http://player.vimeo.com/video/<?php echo $videoID; ?>?title=0&amp;byline=0&amp;portrait=0&amp;badge=0&amp;color=ffffff"
331
+ width="" height="" frameborder="0" webkitAllowFullScreen mozallowfullscreen
332
+ allowFullScreen></iframe>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  <?php
334
  }
335
+ }
 
 
 
 
 
 
 
 
336
  ?>
337
+ </div>
338
+ <!-- Content -->
339
+ <div>
340
+ <?php the_content(); ?>
341
+ </div>
342
+ <!-- End Content -->
343
+ <!-- Categories and tags -->
344
+ <?php if ($category_and_tags == 1) { ?>
345
+ <div class="event_cageory_and_tags">
346
 
347
+ <?php if (!empty($event_categories)) { ?>
348
+ <ul class="event_categories">
349
+ <?php
350
+ foreach ($event_categories as $category) {
351
 
352
+ $metas = get_option("ecwd_event_category_$category->term_id");
353
+ ?>
354
+ <li class="event_category event-details-title">
355
+ <?php if ($metas['color']) { ?>
356
+ <span class="event-metalabel"
357
+ style="background:<?php echo $metas['color']; ?>"></span>
358
+ <span class="event_catgeory_name"> <a
359
+ href="<?php echo get_category_link($category); ?>"
360
+ style="color:<?php echo $metas['color']; ?>"><?php echo $category->name; ?> </a></span>
361
+ <?php } else { ?>
362
+ <span class="event_catgeory_name"> <a
363
+ href="<?php echo get_category_link($category); ?>"><?php echo $category->name; ?> </a></span>
364
+ <?php } ?>
365
+ </li>
366
+ <?php
367
+ }
368
  ?>
369
+ </ul>
370
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  }
372
+ ?>
373
 
 
 
 
 
 
 
 
 
374
 
375
+ <?php
376
+ if (!empty($event_tags)) {
377
+ ?>
 
 
 
 
378
 
379
+ <ul class="event_tags">
380
 
 
 
 
381
  <?php
382
+ foreach ($event_tags as $tag) {
383
  ?>
384
+ <li class="event_tag">
385
+ <span class="event_tag_name">
386
+ <a href="<?php echo get_tag_link($tag); ?>">#<?php echo $tag->name; ?> </a>
387
+ </span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  </li>
389
  <?php
390
  }
391
+ ?></ul>
392
+ <?php
393
+ }
394
+ ?>
395
  </div>
 
396
  <?php } ?>
397
+ <!-- END Categories and tags -->
398
 
399
+
400
+
401
+ <?php
402
+ if (!isset($ecwd_options['related_events']) || $ecwd_options['related_events'] == 1) {
403
+ $post_cats = wp_get_post_terms($post_id, ECWD_PLUGIN_PREFIX . '_event_category');
404
+ $cat_ids = wp_list_pluck($post_cats, 'term_id');
405
+ $post_tags = wp_get_post_terms($post_id, ECWD_PLUGIN_PREFIX . '_event_tag');
406
+ $tag_ids = wp_list_pluck($post_tags, 'term_id');
407
+ $events = array();
408
+ $today = date('Y-m-d');
409
+
410
+ $args = array(
411
+ 'numberposts' => - 1,
412
+ 'post_type' => ECWD_PLUGIN_PREFIX . '_event',
413
+ 'tax_query' => array(
414
+ array(
415
+ 'taxonomy' => ECWD_PLUGIN_PREFIX . '_event_category',
416
+ 'terms' => $cat_ids,
417
+ 'field' => 'term_id',
418
+ )
419
+ ),
420
+ 'orderby' => 'meta_value',
421
+ 'order' => 'ASC'
422
+ );
423
+ $ecwd_events_by_cats = get_posts($args);
424
+ $args = array(
425
+ 'numberposts' => - 1,
426
+ 'post_type' => ECWD_PLUGIN_PREFIX . '_event',
427
+ 'tax_query' => array(
428
+ array(
429
+ 'taxonomy' => ECWD_PLUGIN_PREFIX . '_event_tag',
430
+ 'terms' => $tag_ids,
431
+ 'field' => 'term_id',
432
+ ),
433
+ ),
434
+ 'orderby' => 'meta_value',
435
+ 'order' => 'ASC'
436
+ );
437
+ $ecwd_events_by_tags = get_posts($args);
438
+ $ecwd_events = array_merge($ecwd_events_by_tags, $ecwd_events_by_cats);
439
+ $ecwd_events = array_map("unserialize", array_unique(array_map("serialize", $ecwd_events)));
440
+ wp_reset_postdata();
441
+ wp_reset_query();
442
+
443
+ foreach ($ecwd_events as $ecwd_event) {
444
+ if ($ecwd_event->ID != $post_id) {
445
+ $term_metas = '';
446
+ $categories = get_the_terms($ecwd_event->ID, ECWD_PLUGIN_PREFIX . '_event_category');
447
+ if (is_array($categories)) {
448
+ foreach ($categories as $category) {
449
+ $term_metas = get_option("ecwd_event_category_$category->term_id");
450
+ $term_metas['id'] = $category->term_id;
451
+ $term_metas['name'] = $category->name;
452
+ $term_metas['slug'] = $category->slug;
453
+ }
454
+ }
455
+ $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true);
456
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => '');
457
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) {
458
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => '');
459
+ }
460
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'])) {
461
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'] = array(0 => '');
462
+ }
463
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'])) {
464
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'] = array(0 => '');
465
+ }
466
+ if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'])) {
467
+ $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'] = array(0 => '');
468
+ }
469
+
470
+ $permalink = get_permalink($ecwd_event->ID);
471
+ $events[$ecwd_event->ID] = new ECWD_Event($ecwd_event->ID, 0, $ecwd_event->post_title, $ecwd_event->post_content, $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'][0], $permalink, $ecwd_event, $term_metas, $ecwd_event_metas);
472
+ }
473
+ }
474
+ $d = new ECWD_Display(0, '', '', $today);
475
+ $start_date = date('Y-m-d');
476
+ $end_date = date('Y-m-d', strtotime("+1 year", strtotime($start_date)));
477
+ $events = $d->get_event_days($events, 1, $start_date, $end_date);
478
+ ?>
479
+
480
+ <?php
481
+ $events = $d->events_unique($events);
482
+ do_action('ecwd_show_related_events', $events,true);
483
+ }
484
+ ?> </div>
485
+ <!-- #Related Events-->
486
  </article>
487
  </div> <!-- #post-x -->
488
+ <?php if (comments_open() && $post->comment_status == 'open') { ?>
489
  <div class="ecwd-comments">
490
 
491
+ <?php echo comments_template(); ?>
492
  </div>
493
  <?php } ?>
494
+ <?php endwhile; ?>
495
 
496
  </div>
497
+ <script id="ecwd_script_handler" type="text/javascript">if (typeof ecwd_js_init_call == "object") {
498
+ ecwd_js_init_call = new ecwd_js_init();
499
+ }</script>
500
  <?php
501
+ if (defined('ECWD_TEHEME') && ECWD_TEHEME == 'twentyfourteen') {
502
+ get_sidebar();
503
  }
504
+ get_footer();
505
+ ?>