Version Description
- Added: Order of events archive page option
- Fixed: Minor bug
Download this release
Release Info
| Developer | webdorado |
| Plugin | |
| Version | 1.0.58 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.57 to 1.0.58
- ecwd.php +1 -1
- ecwd_admin_class.php +1 -1
- ecwd_class.php +1 -1
- includes/ecwd-cpt-class.php +19 -1
- includes/ecwd-functions.php +401 -411
- includes/register-settings.php +44 -2
- readme.txt +25 -21
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.
|
| 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.58
|
| 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.
|
| 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.58';
|
| 10 |
protected $ecwd_page = null;
|
| 11 |
protected $notices = null;
|
| 12 |
|
ecwd_class.php
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
*/
|
| 7 |
class ECWD {
|
| 8 |
|
| 9 |
-
protected $version = '1.0.
|
| 10 |
protected $plugin_name = 'event-calendar-wd';
|
| 11 |
protected $prefix = 'ecwd';
|
| 12 |
protected static $instance = null;
|
| 6 |
*/
|
| 7 |
class ECWD {
|
| 8 |
|
| 9 |
+
protected $version = '1.0.58';
|
| 10 |
protected $plugin_name = 'event-calendar-wd';
|
| 11 |
protected $prefix = 'ecwd';
|
| 12 |
protected static $instance = null;
|
includes/ecwd-cpt-class.php
CHANGED
|
@@ -23,6 +23,7 @@ class ECWD_Cpt {
|
|
| 23 |
|
| 24 |
add_action('pre_get_posts', array($this, 'add_custom_post_type_to_query'));
|
| 25 |
add_action('pre_get_posts', array($this, 'category_archive_page_query'));
|
|
|
|
| 26 |
add_action('add_meta_boxes', array($this, 'calendars_cpt_meta'));
|
| 27 |
add_action('add_meta_boxes', array($this, 'events_cpt_meta'));
|
| 28 |
add_action('add_meta_boxes', array($this, 'themes_cpt_meta'));
|
|
@@ -109,7 +110,7 @@ class ECWD_Cpt {
|
|
| 109 |
$post_metas = get_post_meta($id);
|
| 110 |
$ecwd_event_date_from = isset($post_metas['ecwd_event_date_from'][0]) ? $post_metas['ecwd_event_date_from'][0] : '';
|
| 111 |
$ecwd_event_date_to = isset($post_metas['ecwd_event_date_to'][0]) ? $post_metas['ecwd_event_date_to'][0] : '';
|
| 112 |
-
return $title . "<p class='ecwd_events_date'>" . $ecwd_event_date_from . " - " . $ecwd_event_date_to . "
|
| 113 |
}
|
| 114 |
};
|
| 115 |
}
|
|
@@ -1318,6 +1319,23 @@ class ECWD_Cpt {
|
|
| 1318 |
$query->query_vars['posts_per_page'] = 5;
|
| 1319 |
}
|
| 1320 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1321 |
|
| 1322 |
public function delete_transient() {
|
| 1323 |
try {
|
| 23 |
|
| 24 |
add_action('pre_get_posts', array($this, 'add_custom_post_type_to_query'));
|
| 25 |
add_action('pre_get_posts', array($this, 'category_archive_page_query'));
|
| 26 |
+
add_action('pre_get_posts', array($this, 'events_archive_page_query'));
|
| 27 |
add_action('add_meta_boxes', array($this, 'calendars_cpt_meta'));
|
| 28 |
add_action('add_meta_boxes', array($this, 'events_cpt_meta'));
|
| 29 |
add_action('add_meta_boxes', array($this, 'themes_cpt_meta'));
|
| 110 |
$post_metas = get_post_meta($id);
|
| 111 |
$ecwd_event_date_from = isset($post_metas['ecwd_event_date_from'][0]) ? $post_metas['ecwd_event_date_from'][0] : '';
|
| 112 |
$ecwd_event_date_to = isset($post_metas['ecwd_event_date_to'][0]) ? $post_metas['ecwd_event_date_to'][0] : '';
|
| 113 |
+
return $title . "<p class='ecwd_events_date'>" . $ecwd_event_date_from . " - " . $ecwd_event_date_to . "</p>";
|
| 114 |
}
|
| 115 |
};
|
| 116 |
}
|
| 1319 |
$query->query_vars['posts_per_page'] = 5;
|
| 1320 |
}
|
| 1321 |
}
|
| 1322 |
+
|
| 1323 |
+
public function events_archive_page_query($query) {
|
| 1324 |
+
if (is_archive()) {
|
| 1325 |
+
if (isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'ecwd_event') {
|
| 1326 |
+
global $ecwd_options;
|
| 1327 |
+
$query->set('meta_key', 'ecwd_event_date_from');
|
| 1328 |
+
$query->set('orderby', 'meta_value');
|
| 1329 |
+
if (isset($ecwd_options['events_archive_page_order']) && $ecwd_options['events_archive_page_order'] == '1') {
|
| 1330 |
+
$order = "ASC";
|
| 1331 |
+
}else{
|
| 1332 |
+
$order = "DESC";
|
| 1333 |
+
}
|
| 1334 |
+
$query->set('order',$order);
|
| 1335 |
+
}
|
| 1336 |
+
}
|
| 1337 |
+
}
|
| 1338 |
+
|
| 1339 |
|
| 1340 |
public function delete_transient() {
|
| 1341 |
try {
|
includes/ecwd-functions.php
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
//if (!defined())
|
| 3 |
function ecwd_print_calendar($calendar_ids, $display = 'mini', $args = array(), $widget = false, $ajax = false, $ecwd_views = array(), $preview = false) {
|
| 4 |
global $ecwd_options;
|
|
@@ -8,123 +9,119 @@ function ecwd_print_calendar($calendar_ids, $display = 'mini', $args = array(),
|
|
| 8 |
'ajaxurl' => admin_url('admin-ajax.php'),
|
| 9 |
'ajaxnonce' => wp_create_nonce(ECWD_PLUGIN_PREFIX . '_ajax_nonce'),
|
| 10 |
'loadingText' => __('Loading...', 'ecwd'),
|
| 11 |
-
|
| 12 |
));
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
/* if ( $ecwd_calendar_theme && file_exists( ECWD_DIR . '/css/themes/' . $css_file . ".css" ) ) {
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
$markup .= $d->get_view($date, $display, $widget, $ecwd_views, $preview);
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
if ($preview == false) {
|
| 118 |
$markup .= '<div class="single_event_popup"></div>';
|
| 119 |
}
|
| 120 |
-
|
| 121 |
|
| 122 |
-
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
}
|
| 129 |
|
| 130 |
/**
|
|
@@ -132,142 +129,142 @@ function ecwd_print_calendar($calendar_ids, $display = 'mini', $args = array(),
|
|
| 132 |
*/
|
| 133 |
function ecwd_ajax() {
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
// if ( ! check_ajax_referer( ECWD_PLUGIN_PREFIX . '_ajax_nonce', ECWD_PLUGIN_PREFIX . '_nonce' ) ) {
|
| 138 |
// die( 'Request has failed.' );
|
| 139 |
// }
|
| 140 |
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
}
|
| 210 |
|
| 211 |
-
add_action(
|
| 212 |
-
add_action(
|
| 213 |
|
| 214 |
/**
|
| 215 |
* AJAX function for mini pagination
|
| 216 |
*/
|
| 217 |
function ecwd_ajax_list() {
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
}
|
| 263 |
|
| 264 |
-
add_action(
|
| 265 |
-
add_action(
|
| 266 |
|
| 267 |
-
function replaceFirstImages(
|
| 268 |
-
|
| 269 |
|
| 270 |
-
|
| 271 |
}
|
| 272 |
|
| 273 |
function ecwd_event_popup_ajax() {
|
|
@@ -282,204 +279,197 @@ function ecwd_event_popup_ajax() {
|
|
| 282 |
add_action('wp_ajax_nopriv_ecwd_event_popup_ajax', ECWD_PLUGIN_PREFIX . '_event_popup_ajax');
|
| 283 |
add_action('wp_ajax_ecwd_event_popup_ajax', ECWD_PLUGIN_PREFIX . '_event_popup_ajax');
|
| 284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
|
| 286 |
-
|
| 287 |
-
global $post;
|
| 288 |
-
global $wp;
|
| 289 |
-
global $ecwd_options;
|
| 290 |
-
//echo $content;
|
| 291 |
-
if ( is_single() ) {
|
| 292 |
-
$feat_image = '';
|
| 293 |
-
if ( $post->post_type == ECWD_PLUGIN_PREFIX . '_organizer' ) {
|
| 294 |
-
$organizer_content = '';
|
| 295 |
-
include( ECWD_DIR . '/views/ecwd-organizer-content.php' );
|
| 296 |
-
$organizer_content .= ob_get_clean();
|
| 297 |
-
$content = $organizer_content;
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
} elseif ( $post->post_type == ECWD_PLUGIN_PREFIX . '_venue' ) {
|
| 301 |
-
$venue_content = '';
|
| 302 |
-
ob_start();
|
| 303 |
-
include( ECWD_DIR . '/views/ecwd-venue-content.php' );
|
| 304 |
-
$venue_content .= ob_get_clean();
|
| 305 |
-
$content = $venue_content;
|
| 306 |
-
}
|
| 307 |
-
}
|
| 308 |
-
|
| 309 |
-
return $content;
|
| 310 |
}
|
| 311 |
|
| 312 |
-
function getAndReplaceFirstImage(
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
}
|
| 332 |
|
| 333 |
-
add_filter(
|
|
|
|
| 334 |
//add_filter('template_include', ECWD_PLUGIN_PREFIX . '_set_template');
|
| 335 |
|
| 336 |
-
function ecwd_set_template(
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
|
| 341 |
-
|
| 342 |
}
|
| 343 |
|
| 344 |
-
function ecwd_event_post(
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
|
| 353 |
-
|
| 354 |
}
|
| 355 |
|
| 356 |
-
add_action(
|
| 357 |
|
| 358 |
function ecwd_add_meta_tags() {
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
}
|
| 404 |
|
| 405 |
-
add_action(
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
function ecwd_print_countdown( $event_id, $widget = 1, $theme_id = null, $args = array() ) {
|
| 409 |
-
global $ecwd_options;
|
| 410 |
-
|
| 411 |
-
$date_format = 'Y-m-d';
|
| 412 |
-
$time_format = 'H:i';
|
| 413 |
-
if ( isset( $ecwd_options['date_format'] ) && $ecwd_options['date_format'] != '' ) {
|
| 414 |
-
$date_format = $ecwd_options['date_format'];
|
| 415 |
-
}
|
| 416 |
-
if ( isset( $ecwd_options['time_format'] ) && $ecwd_options['time_format'] != '' ) {
|
| 417 |
-
$time_format = $ecwd_options['time_format'];
|
| 418 |
-
}
|
| 419 |
-
$time_format .= ( isset( $ecwd_options['time_type'] ) ? ' ' . $ecwd_options['time_type'] : '' );
|
| 420 |
-
if ( isset( $ecwd_options['time_type'] ) && $ecwd_options['time_type'] != '' ) {
|
| 421 |
-
$time_format = str_replace( 'H', 'g', $time_format );
|
| 422 |
-
$time_format = str_replace( 'h', 'g', $time_format );
|
| 423 |
-
}
|
| 424 |
-
$defaults = array(
|
| 425 |
-
'title_text' => '',
|
| 426 |
-
'sort' => 'asc',
|
| 427 |
-
'grouped' => 0
|
| 428 |
-
);
|
| 429 |
-
|
| 430 |
-
$args = array_merge( $defaults, $args );
|
| 431 |
-
extract( $args );
|
| 432 |
-
$finish_text = isset( $args['finish_text'] ) ? $args['finish_text'] : '';
|
| 433 |
-
|
| 434 |
-
$date = ( isset( $args['date'] ) ? $args['date'] : '' );
|
| 435 |
-
$d = new ECWD_Display( '', $title_text, $sort );
|
| 436 |
-
$markup = '';
|
| 437 |
-
|
| 438 |
-
$next_event = $d->get_countdown( $event_id, $date, '', $widget );
|
| 439 |
-
if ( $next_event ) {
|
| 440 |
-
$gmt = gmdate( "Y-m-d H:i:s" );
|
| 441 |
-
$currentgmt = date( 'Y-m-d H:i:s' );
|
| 442 |
-
$diff = ( strtotime( $currentgmt ) - strtotime( $gmt ) ) / 60 / 60;
|
| 443 |
-
$start = date( 'Y/m/d H:i:s', strtotime( $next_event['from'] . 'T' . $next_event['starttime'] ) );
|
| 444 |
-
$markup .= '<div class="ecwd_countdown_container">';
|
| 445 |
-
$markup .= '<div class="ecwd_countdown_info">';
|
| 446 |
-
$markup .= '<div class="ecwd-date">';
|
| 447 |
-
$markup .= '<span class="metainfo">' . date( $date_format . ' ' . $time_format, strtotime( $start ) ) . ' (UTC ' . $diff . ')</span>';
|
| 448 |
-
$markup .= '</div>';
|
| 449 |
-
$markup .= '<div class="info">';
|
| 450 |
-
if ( $next_event['permalink'] !== '' ) {
|
| 451 |
-
$markup .= '<span><a href="' . $next_event['permalink'] . '">' . $next_event['title'] . '</a></span>';
|
| 452 |
-
} else {
|
| 453 |
-
$markup .= '<span>' . $next_event['title'] . '</span>';
|
| 454 |
-
|
| 455 |
-
}
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
$markup .= '<span>' . $next_event['location'] . '</span>';
|
| 459 |
-
$markup .= ' </div>';
|
| 460 |
-
$markup .= '<div class="clear"></div>';
|
| 461 |
-
$markup .= ' </div>';
|
| 462 |
-
$markup .= '<div class="ecwd_countdown">';
|
| 463 |
-
$markup .= '<input type="hidden" name="ecwd_end_time" value="' . $start . '"/>';
|
| 464 |
-
$markup .= '<input type="hidden" name="ecwd_timezone" value="' . $diff . '"/>';
|
| 465 |
-
$markup .= '<input type="hidden" name="ecwd_text_days" value="' . __( 'DAYS', 'ecwd' ) . '"/>';
|
| 466 |
-
$markup .= '<input type="hidden" name="ecwd_text_hours" value="' . __( 'HOURS', 'ecwd' ) . '"/>';
|
| 467 |
-
$markup .= '<input type="hidden" name="ecwd_text_minutes" value="' . __( 'MINUTES', 'ecwd' ) . '"/>';
|
| 468 |
-
$markup .= '<input type="hidden" name="ecwd_text_seconds" value="' . __( 'SECONDS', 'ecwd' ) . '"/>';
|
| 469 |
-
$markup .= '<input type="hidden" name="ecwd_finish_text" value="' . $finish_text . '"/>';
|
| 470 |
-
if ( $theme_id ) {
|
| 471 |
-
$theme = get_post_meta( $theme_id, 'ecwd_countdown_theme', true );
|
| 472 |
-
$markup .= '<textarea class="hidden" name="ecwd_theme">' . $theme . '</textarea>';
|
| 473 |
-
|
| 474 |
-
}
|
| 475 |
-
|
| 476 |
-
$markup .= '<div class="clear"></div>';
|
| 477 |
-
$markup .= '</div>';
|
| 478 |
-
$markup .= '</div>';
|
| 479 |
-
$markup .= '<div class="clear"></div>';
|
| 480 |
-
}
|
| 481 |
-
|
| 482 |
-
return $markup;
|
| 483 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
|
|
|
|
| 485 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
//if (!defined())
|
| 4 |
function ecwd_print_calendar($calendar_ids, $display = 'mini', $args = array(), $widget = false, $ajax = false, $ecwd_views = array(), $preview = false) {
|
| 5 |
global $ecwd_options;
|
| 9 |
'ajaxurl' => admin_url('admin-ajax.php'),
|
| 10 |
'ajaxnonce' => wp_create_nonce(ECWD_PLUGIN_PREFIX . '_ajax_nonce'),
|
| 11 |
'loadingText' => __('Loading...', 'ecwd'),
|
| 12 |
+
'plugin_url' => ECWD_URL
|
| 13 |
));
|
| 14 |
|
| 15 |
+
$defaults = array(
|
| 16 |
+
'title_text' => '',
|
| 17 |
+
'sort' => 'asc',
|
| 18 |
+
'grouped' => 0
|
| 19 |
+
);
|
| 20 |
+
|
| 21 |
+
$args = array_merge($defaults, $args);
|
| 22 |
+
|
| 23 |
+
extract($args);
|
| 24 |
+
if (!is_array($calendar_ids)) {
|
| 25 |
+
$ids = explode('-', str_replace(' ', '', $calendar_ids));
|
| 26 |
+
} else {
|
| 27 |
+
$ids = $calendar_ids;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
$ecwd_calendar_theme = get_post_meta($ids[0], ECWD_PLUGIN_PREFIX . '_calendar_theme', true);
|
| 31 |
+
$css_file = $ids[0] . '_' . $ecwd_calendar_theme;
|
| 32 |
+
$ecwd_default_color = $ecwd_calendar_theme && $ecwd_calendar_theme == 'calendar_grey' ? $ecwd_calendar_theme : 'Default';
|
| 33 |
+
// wp_enqueue_style( 'ecwd-calendar-main', plugins_url( '../css/calendar.css', __FILE__ ), '', 1 );
|
| 34 |
+
|
| 35 |
+
/* if ( $ecwd_calendar_theme && file_exists( ECWD_DIR . '/css/themes/' . $css_file . ".css" ) ) {
|
| 36 |
+
wp_enqueue_style( 'ecwd-calendar-theme_' . $css_file, plugins_url( '../css/themes/' . $css_file . '.css', __FILE__ ), '', 1 );
|
| 37 |
+
} */
|
| 38 |
+
if ($ecwd_default_color && file_exists(ECWD_DIR . '/css/' . $ecwd_default_color . ".css")) {
|
| 39 |
+
wp_enqueue_style('ecwd-calendar-main', plugins_url('../css/' . $ecwd_default_color . '.css', __FILE__), '', 1);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
$calendar_ids_html = implode('-', $ids);
|
| 44 |
+
$date = ( isset($args['date']) ? $args['date'] : '' );
|
| 45 |
+
$prev_display = ( isset($args['prev_display']) ? $args['prev_display'] : '' );
|
| 46 |
+
$page = ( isset($args['cpage']) ? $args['cpage'] : 1 );
|
| 47 |
+
$page_items = ( isset($args['page_items']) ? $args['page_items'] : 5 );
|
| 48 |
+
$displays = ( isset($args['displays']) ? $args['displays'] : null );
|
| 49 |
+
$filters = ( isset($args['filters']) ? $args['filters'] : null );
|
| 50 |
+
$event_search = ( isset($args['event_search']) ? $args['event_search'] : 'yes' );
|
| 51 |
+
if (!isset($args['search_params'])) {
|
| 52 |
+
$args['search_params'] = array();
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
//Create new display object, passing array of calendar id(s)
|
| 56 |
+
$d = new ECWD_Display($ids, $title_text, $sort, $date, $page, $args['search_params'], $displays, $filters, $page_items, $event_search, $display);
|
| 57 |
+
$markup = '';
|
| 58 |
+
$start = current_time('timestamp');
|
| 59 |
+
|
| 60 |
+
if (!$display && !$prev_display) {
|
| 61 |
+
if ($widget == 1) {
|
| 62 |
+
$display = 'mini';
|
| 63 |
+
} else {
|
| 64 |
+
$display = 'full';
|
| 65 |
+
}
|
| 66 |
+
} elseif (!$display && $prev_display) {
|
| 67 |
+
$display = $prev_display;
|
| 68 |
+
}
|
| 69 |
+
if ($ajax == false) {
|
| 70 |
+
if ($widget == 1) {
|
| 71 |
+
$markup .= '<div class="ecwd_' . $calendar_ids_html . ' calendar_widget_content calendar_main">';
|
| 72 |
+
} else {
|
| 73 |
+
$markup .= '<div class="ecwd_' . $calendar_ids_html . ' calendar_full_content calendar_main">';
|
| 74 |
+
}
|
| 75 |
+
if ($widget !== 1) {
|
| 76 |
+
if (defined('ECWD_FILTERS_EVENT_MAIN_FILE') && is_plugin_active(ECWD_FILTERS_EVENT_MAIN_FILE)) {
|
| 77 |
+
if (defined('ECWD_FILTERS_EVENT_DIR')) {
|
| 78 |
+
require_once( ECWD_FILTERS_EVENT_DIR . 'ecwd_display_filters_class.php' );
|
| 79 |
+
$filters_obj = ECWD_Display_Filters::get_instance();
|
| 80 |
+
$filters_obj->set_filters($filters);
|
| 81 |
+
$markup .= $filters_obj->show_filters();
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
if ($widget == 1) {
|
| 87 |
+
$markup .= '<div class="ecwd-widget-mini ecwd_calendar">';
|
| 88 |
+
$markup .= '<div class="ecwd-widget-' . $calendar_ids_html . '">';
|
| 89 |
+
} else {
|
| 90 |
+
|
| 91 |
+
$markup .= '<div class="ecwd-page-' . $display . ' ecwd_calendar">';
|
| 92 |
+
$markup .= '<div class="ecwd-page-' . $calendar_ids_html . '">';
|
| 93 |
+
}
|
| 94 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
$markup .= $d->get_view($date, $display, $widget, $ecwd_views, $preview);
|
| 96 |
+
$markup .= '</div>';
|
| 97 |
+
$markup .= '<div class="ecwd-events-day-details"></div>';
|
| 98 |
+
if ($displays) {
|
| 99 |
+
$markup .= '<input type="hidden" class="ecwd_displays" value="' . $displays . '"/>';
|
| 100 |
+
}
|
| 101 |
+
if ($event_search) {
|
| 102 |
+
$markup .= '<input type="hidden" class="event_search" value="' . $event_search . '"/>';
|
| 103 |
+
}
|
| 104 |
+
if ($filters) {
|
| 105 |
+
$markup .= '<input type="hidden" class="ecwd_filters" value="' . $filters . '"/>';
|
| 106 |
+
}
|
| 107 |
+
if ($page_items) {
|
| 108 |
+
$markup .= '<input type="hidden" class="ecwd_page_items" value="' . $page_items . '"/>';
|
| 109 |
+
}
|
| 110 |
+
if ($date) {
|
| 111 |
+
$markup .= '<input type="hidden" class="ecwd_date" value="' . $date . '"/>';
|
| 112 |
+
}
|
| 113 |
+
$markup .= '<div class="ecwd_loader"></div>';
|
| 114 |
if ($preview == false) {
|
| 115 |
$markup .= '<div class="single_event_popup"></div>';
|
| 116 |
}
|
| 117 |
+
$markup .= '</div>';
|
| 118 |
|
| 119 |
+
if (!$ajax) {
|
| 120 |
|
| 121 |
+
$markup .= '</div>';
|
| 122 |
+
}
|
| 123 |
+
$markup .= '<script id="ecwd_script_handler" type="text/javascript">if(typeof ecwd_js_init_call=="object"){ecwd_js_init_call = new ecwd_js_init();}</script>';
|
| 124 |
+
return do_shortcode($markup);
|
| 125 |
}
|
| 126 |
|
| 127 |
/**
|
| 129 |
*/
|
| 130 |
function ecwd_ajax() {
|
| 131 |
|
| 132 |
+
// check to see if the submitted nonce matches with the
|
| 133 |
+
// generated nonce
|
| 134 |
// if ( ! check_ajax_referer( ECWD_PLUGIN_PREFIX . '_ajax_nonce', ECWD_PLUGIN_PREFIX . '_nonce' ) ) {
|
| 135 |
// die( 'Request has failed.' );
|
| 136 |
// }
|
| 137 |
|
| 138 |
+
$ids = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_calendar_ids']);
|
| 139 |
+
$args = array();
|
| 140 |
+
$display = '';
|
| 141 |
+
if (isset($_POST[ECWD_PLUGIN_PREFIX . '_link'])) {
|
| 142 |
+
$link = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_link']);
|
| 143 |
+
parse_str($link, $link_arr);
|
| 144 |
+
$date = $link_arr['?date'];
|
| 145 |
+
$page = isset($link_arr['amp;cpage']) ? $link_arr['amp;cpage'] : 1;
|
| 146 |
+
|
| 147 |
+
$display = isset($link_arr['amp;t']) ? $link_arr['amp;t'] : 'full';
|
| 148 |
+
} else {
|
| 149 |
+
if (isset($_POST[ECWD_PLUGIN_PREFIX . '_prev_display'])) {
|
| 150 |
+
$display = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_prev_display']);
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
$type = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_type']);
|
| 154 |
+
if (isset($_POST[ECWD_PLUGIN_PREFIX . '_date']) && $_POST[ECWD_PLUGIN_PREFIX . '_date'] == 1 && !empty($date)) {
|
| 155 |
+
$args['date'] = $date;
|
| 156 |
+
} else {
|
| 157 |
+
$args['date'] = '';
|
| 158 |
+
}
|
| 159 |
+
if ($args['date'] == '' && isset($_POST[ECWD_PLUGIN_PREFIX . '_date_filter'])) {
|
| 160 |
+
$args['date'] = $_POST[ECWD_PLUGIN_PREFIX . '_date_filter'];
|
| 161 |
+
}
|
| 162 |
+
if (isset($_POST[ECWD_PLUGIN_PREFIX . '_prev_display']) && $_POST[ECWD_PLUGIN_PREFIX . '_prev_display'] != '') {
|
| 163 |
+
$args['prev_display'] = $_POST[ECWD_PLUGIN_PREFIX . '_prev_display'];
|
| 164 |
+
} else {
|
| 165 |
+
$args['prev_display'] = '';
|
| 166 |
+
}
|
| 167 |
+
$args['widget'] = 0;
|
| 168 |
+
if ('widget' == $type) {
|
| 169 |
+
$args['widget'] = 1;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
if ($display == '') {
|
| 173 |
+
if ($args['widget'] == 1) {
|
| 174 |
+
$display = 'mini';
|
| 175 |
+
} else {
|
| 176 |
+
$display = 'full';
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
if (isset($page)) {
|
| 180 |
+
$args['cpage'] = $page;
|
| 181 |
+
} else {
|
| 182 |
+
$args['cpage'] = 1;
|
| 183 |
+
}
|
| 184 |
+
$args['search_params'] = array();
|
| 185 |
+
if (( isset($_POST[ECWD_PLUGIN_PREFIX . '_query']) && $_POST[ECWD_PLUGIN_PREFIX . '_query'] != '' ) || isset($_POST[ECWD_PLUGIN_PREFIX . '_categories']) || ( isset($_POST[ECWD_PLUGIN_PREFIX . '_tags']) ) || isset($_POST[ECWD_PLUGIN_PREFIX . '_venues']) || isset($_POST[ECWD_PLUGIN_PREFIX . '_organizers']) || isset($_POST[ECWD_PLUGIN_PREFIX . '_weekdays'])) {
|
| 186 |
+
|
| 187 |
+
$args['search_params']['query'] = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_query']) ? $_POST[ECWD_PLUGIN_PREFIX . '_query'] : 0 );
|
| 188 |
+
$args['search_params']['categories'] = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_categories']) ? $_POST[ECWD_PLUGIN_PREFIX . '_categories'] : 0 );
|
| 189 |
+
$args['search_params']['weekdays'] = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_weekdays']) ? $_POST[ECWD_PLUGIN_PREFIX . '_weekdays'] : 0 );
|
| 190 |
+
$args['search_params']['tags'] = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_tags']) ? $_POST[ECWD_PLUGIN_PREFIX . '_tags'] : 0 );
|
| 191 |
+
$args['search_params']['venues'] = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_venues']) ? $_POST[ECWD_PLUGIN_PREFIX . '_venues'] : 0 );
|
| 192 |
+
$args['search_params']['organizers'] = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_organizers']) ? $_POST[ECWD_PLUGIN_PREFIX . '_organizers'] : 0 );
|
| 193 |
+
$args['search'] = 1;
|
| 194 |
+
//$display = 'list';
|
| 195 |
+
}
|
| 196 |
+
$displays = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_displays']) ? $_POST[ECWD_PLUGIN_PREFIX . '_displays'] : null );
|
| 197 |
+
$filters = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_filters']) ? $_POST[ECWD_PLUGIN_PREFIX . '_filters'] : null );
|
| 198 |
+
$page_items = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_page_items']) ? $_POST[ECWD_PLUGIN_PREFIX . '_page_items'] : null );
|
| 199 |
+
$event_search = ( isset($_POST[ECWD_PLUGIN_PREFIX . '_event_search']) ? $_POST[ECWD_PLUGIN_PREFIX . '_event_search'] : null );
|
| 200 |
+
$args['displays'] = $displays;
|
| 201 |
+
$args['filters'] = $filters;
|
| 202 |
+
$args['event_search'] = $event_search;
|
| 203 |
+
$args['page_items'] = $page_items;
|
| 204 |
+
echo ecwd_print_calendar($ids, $display, $args, $args['widget'], true);
|
| 205 |
+
wp_die();
|
| 206 |
}
|
| 207 |
|
| 208 |
+
add_action('wp_ajax_nopriv_ecwd_ajax', ECWD_PLUGIN_PREFIX . '_ajax', 999999);
|
| 209 |
+
add_action('wp_ajax_ecwd_ajax', ECWD_PLUGIN_PREFIX . '_ajax', 999999);
|
| 210 |
|
| 211 |
/**
|
| 212 |
* AJAX function for mini pagination
|
| 213 |
*/
|
| 214 |
function ecwd_ajax_list() {
|
| 215 |
+
if (!check_ajax_referer(ECWD_PLUGIN_PREFIX . '_ajax_nonce', ECWD_PLUGIN_PREFIX . '_nonce')) {
|
| 216 |
+
die('Request has failed.');
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
$grouped = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_grouped']);
|
| 220 |
+
$start = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_start']);
|
| 221 |
+
$ids = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_event_ids']);
|
| 222 |
+
$title_text = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_title_text']);
|
| 223 |
+
$sort = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_sort']);
|
| 224 |
+
//$paging = esc_html($_POST[ECWD_PLUGIN_PREFIX.'_paging']);
|
| 225 |
+
//$paging_interval = esc_html($_POST[ECWD_PLUGIN_PREFIX.'_paging_interval']);
|
| 226 |
+
//$paging_direction = esc_html($_POST[ECWD_PLUGIN_PREFIX.'_paging_direction']);
|
| 227 |
+
$start_offset = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_start_offset']);
|
| 228 |
+
$paging_type = esc_html($_POST[ECWD_PLUGIN_PREFIX . '_paging_type']);
|
| 229 |
+
|
| 230 |
+
if ($paging_direction == 'back') {
|
| 231 |
+
if ($paging_type == 'month') {
|
| 232 |
+
$this_month = mktime(0, 0, 0, date('m', $start) - 1, 1, date('Y', $start));
|
| 233 |
+
$prev_month = mktime(0, 0, 0, date('m', $start) - 2, 1, date('Y', $start));
|
| 234 |
+
$prev_interval_days = date('t', $prev_month);
|
| 235 |
+
$month_days = date('t', $this_month);
|
| 236 |
+
|
| 237 |
+
$int = $month_days + $prev_interval_days;
|
| 238 |
+
$int = $int * 86400;
|
| 239 |
+
|
| 240 |
+
$start = $start - ( $int );
|
| 241 |
+
|
| 242 |
+
$changed_month_days = date('t', $start);
|
| 243 |
+
$paging_interval = $changed_month_days * 86400;
|
| 244 |
+
} else {
|
| 245 |
+
$start = $start - ( $paging_interval * 2 );
|
| 246 |
+
}
|
| 247 |
+
} else {
|
| 248 |
+
if ($paging_type == 'month') {
|
| 249 |
+
$days_in_month = date('t', $start);
|
| 250 |
+
$paging_interval = 86400 * $days_in_month;
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
$d = new ECWD_Display(explode('-', $ids), $title_text, $sort);
|
| 255 |
+
|
| 256 |
+
echo $d->get_list($grouped, $start, $paging, $paging_interval, $start_offset);
|
| 257 |
+
|
| 258 |
+
die();
|
| 259 |
}
|
| 260 |
|
| 261 |
+
add_action('wp_ajax_nopriv_ecwd_ajax_list', ECWD_PLUGIN_PREFIX . '_ajax_list');
|
| 262 |
+
add_action('wp_ajax_ecwd_ajax_list', ECWD_PLUGIN_PREFIX . '_ajax_list');
|
| 263 |
|
| 264 |
+
function replaceFirstImages($content) {
|
| 265 |
+
$content = preg_replace("/<img[^>]+\>/i", " ", $content, 1);
|
| 266 |
|
| 267 |
+
return $content;
|
| 268 |
}
|
| 269 |
|
| 270 |
function ecwd_event_popup_ajax() {
|
| 279 |
add_action('wp_ajax_nopriv_ecwd_event_popup_ajax', ECWD_PLUGIN_PREFIX . '_event_popup_ajax');
|
| 280 |
add_action('wp_ajax_ecwd_event_popup_ajax', ECWD_PLUGIN_PREFIX . '_event_popup_ajax');
|
| 281 |
|
| 282 |
+
function ecwd_event_content($content) {
|
| 283 |
+
global $post;
|
| 284 |
+
global $wp;
|
| 285 |
+
global $ecwd_options;
|
| 286 |
+
//echo $content;
|
| 287 |
+
if (is_single()) {
|
| 288 |
+
$feat_image = '';
|
| 289 |
+
if ($post->post_type == ECWD_PLUGIN_PREFIX . '_organizer') {
|
| 290 |
+
$organizer_content = '';
|
| 291 |
+
include( ECWD_DIR . '/views/ecwd-organizer-content.php' );
|
| 292 |
+
$organizer_content .= ob_get_clean();
|
| 293 |
+
$content = $organizer_content;
|
| 294 |
+
} elseif ($post->post_type == ECWD_PLUGIN_PREFIX . '_venue') {
|
| 295 |
+
$venue_content = '';
|
| 296 |
+
ob_start();
|
| 297 |
+
include( ECWD_DIR . '/views/ecwd-venue-content.php' );
|
| 298 |
+
$venue_content .= ob_get_clean();
|
| 299 |
+
$content = $venue_content;
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
|
| 303 |
+
return $content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
}
|
| 305 |
|
| 306 |
+
function getAndReplaceFirstImage($content) {
|
| 307 |
+
$first_img = '';
|
| 308 |
+
ob_start();
|
| 309 |
+
ob_end_clean();
|
| 310 |
+
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
|
| 311 |
+
if (isset($matches [1] [0])) {
|
| 312 |
+
$first_img = $matches [1] [0];
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
if (empty($first_img)) { //Defines a default image
|
| 316 |
+
return false;
|
| 317 |
+
} else {
|
| 318 |
+
$content = replaceFirstImages($content);
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
return array(
|
| 322 |
+
'image' => $first_img,
|
| 323 |
+
'content' => $content
|
| 324 |
+
);
|
| 325 |
}
|
| 326 |
|
| 327 |
+
add_filter('the_content', ECWD_PLUGIN_PREFIX . '_event_content');
|
| 328 |
+
|
| 329 |
//add_filter('template_include', ECWD_PLUGIN_PREFIX . '_set_template');
|
| 330 |
|
| 331 |
+
function ecwd_set_template($template) {
|
| 332 |
+
if (is_singular(ECWD_PLUGIN_PREFIX . '_event') && ECWD_DIR . '/views/ecwd-event-content.php' != $template) {
|
| 333 |
+
$template = ECWD_DIR . '/views/ecwd-event-content.php';
|
| 334 |
+
}
|
| 335 |
|
| 336 |
+
return $template;
|
| 337 |
}
|
| 338 |
|
| 339 |
+
function ecwd_event_post($post) {
|
| 340 |
+
global $ecwd_options;
|
| 341 |
+
if (is_single() && isset($post->comment_status) && $post->post_type == ECWD_PLUGIN_PREFIX . '_event') {
|
| 342 |
+
$post->comment_status = 'closed';
|
| 343 |
+
if (isset($ecwd_options['event_comments']) && $ecwd_options['event_comments'] == 1) {
|
| 344 |
+
$post->comment_status = 'open';
|
| 345 |
+
}
|
| 346 |
+
}
|
| 347 |
|
| 348 |
+
return $post;
|
| 349 |
}
|
| 350 |
|
| 351 |
+
add_action('the_post', ECWD_PLUGIN_PREFIX . '_event_post');
|
| 352 |
|
| 353 |
function ecwd_add_meta_tags() {
|
| 354 |
+
global $post, $ecwd_options;
|
| 355 |
+
if (is_single() && $post->post_type == ECWD_PLUGIN_PREFIX . '_event' && isset($ecwd_options['social_icons']) && $ecwd_options['social_icons'] != '') {
|
| 356 |
+
echo '<meta property="og:title" content="' . $post->post_title . '"/>';
|
| 357 |
+
$ecwd_event_date_from = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_date_from', true);
|
| 358 |
+
$ecwd_event_date_to = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_date_to', true);
|
| 359 |
+
$ecwd_all_day_event = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_all_day_event', true);
|
| 360 |
+
$date_format = 'Y-m-d';
|
| 361 |
+
$time_format = 'H:i';
|
| 362 |
+
if (isset($ecwd_options['date_format']) && $ecwd_options['date_format'] != '') {
|
| 363 |
+
$date_format = $ecwd_options['date_format'];
|
| 364 |
+
}
|
| 365 |
+
if (isset($ecwd_options['time_format']) && $ecwd_options['time_format'] != '') {
|
| 366 |
+
$time_format = $ecwd_options['time_format'];
|
| 367 |
+
}
|
| 368 |
+
$time_format .= ( isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : '' );
|
| 369 |
+
if (isset($ecwd_options['time_type']) && $ecwd_options['time_type'] != '') {
|
| 370 |
+
$time_format = str_replace('H', 'g', $time_format);
|
| 371 |
+
$time_format = str_replace('h', 'g', $time_format);
|
| 372 |
+
}
|
| 373 |
+
$ecwd_event_location = get_post_meta($post->ID, ECWD_PLUGIN_PREFIX . '_event_location', true);
|
| 374 |
+
$description = '';
|
| 375 |
+
if ($ecwd_all_day_event == 1) {
|
| 376 |
+
$description .= date($date_format, strtotime($ecwd_event_date_from));
|
| 377 |
+
if ($ecwd_all_day_event == 1) {
|
| 378 |
+
if ($ecwd_event_date_to && date($date_format, strtotime($ecwd_event_date_from)) !== date($date_format, strtotime($ecwd_event_date_to))) {
|
| 379 |
+
$description .= ' - ' . date($date_format, strtotime($ecwd_event_date_to));
|
| 380 |
+
}
|
| 381 |
+
$description .= ' ' . __('All day', 'ecwd') . ' ';
|
| 382 |
+
}
|
| 383 |
+
} else {
|
| 384 |
+
$description .= date($date_format, strtotime($ecwd_event_date_from)) . ' ' . date($time_format, strtotime($ecwd_event_date_from));
|
| 385 |
+
|
| 386 |
+
if ($ecwd_event_date_to) {
|
| 387 |
+
$description .= ' - ' . date($date_format, strtotime($ecwd_event_date_to)) . ' ' . date($time_format, strtotime($ecwd_event_date_to));
|
| 388 |
+
}
|
| 389 |
+
}
|
| 390 |
+
$description .= ' ' . $ecwd_event_location;
|
| 391 |
+
echo '<meta property="og:description" content="' . $description . '"/>';
|
| 392 |
+
$feat_image = '';
|
| 393 |
+
if (has_post_thumbnail($post->ID)) {
|
| 394 |
+
$feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'pull'));
|
| 395 |
+
}
|
| 396 |
+
echo '<meta property="og:image" content="' . $feat_image . '"/>';
|
| 397 |
+
}
|
| 398 |
}
|
| 399 |
|
| 400 |
+
add_action('wp_head', 'ecwd_add_meta_tags', 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
|
| 402 |
+
function ecwd_print_countdown($event_id, $widget = 1, $theme_id = null, $args = array()) {
|
| 403 |
+
global $ecwd_options;
|
| 404 |
+
|
| 405 |
+
$date_format = 'Y-m-d';
|
| 406 |
+
$time_format = 'H:i';
|
| 407 |
+
if (isset($ecwd_options['date_format']) && $ecwd_options['date_format'] != '') {
|
| 408 |
+
$date_format = $ecwd_options['date_format'];
|
| 409 |
+
}
|
| 410 |
+
if (isset($ecwd_options['time_format']) && $ecwd_options['time_format'] != '') {
|
| 411 |
+
$time_format = $ecwd_options['time_format'];
|
| 412 |
+
}
|
| 413 |
+
$time_format .= ( isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : '' );
|
| 414 |
+
if (isset($ecwd_options['time_type']) && $ecwd_options['time_type'] != '') {
|
| 415 |
+
$time_format = str_replace('H', 'g', $time_format);
|
| 416 |
+
$time_format = str_replace('h', 'g', $time_format);
|
| 417 |
+
}
|
| 418 |
+
$defaults = array(
|
| 419 |
+
'title_text' => '',
|
| 420 |
+
'sort' => 'asc',
|
| 421 |
+
'grouped' => 0
|
| 422 |
+
);
|
| 423 |
+
|
| 424 |
+
$args = array_merge($defaults, $args);
|
| 425 |
+
extract($args);
|
| 426 |
+
$finish_text = isset($args['finish_text']) ? $args['finish_text'] : '';
|
| 427 |
+
|
| 428 |
+
$date = ( isset($args['date']) ? $args['date'] : '' );
|
| 429 |
+
$d = new ECWD_Display('', $title_text, $sort);
|
| 430 |
+
$markup = '';
|
| 431 |
+
|
| 432 |
+
$next_event = $d->get_countdown($event_id, $date, '', $widget);
|
| 433 |
+
if ($next_event) {
|
| 434 |
+
$gmt = gmdate("Y-m-d H:i:s");
|
| 435 |
+
$currentgmt = date('Y-m-d H:i:s');
|
| 436 |
+
$diff = ( strtotime($currentgmt) - strtotime($gmt) ) / 60 / 60;
|
| 437 |
+
$start = date('Y/m/d H:i:s', strtotime($next_event['from'] . 'T' . $next_event['starttime']));
|
| 438 |
+
$markup .= '<div class="ecwd_countdown_container">';
|
| 439 |
+
$markup .= '<div class="ecwd_countdown_info">';
|
| 440 |
+
$markup .= '<div class="ecwd-date">';
|
| 441 |
+
$markup .= '<span class="metainfo">' . date($date_format . ' ' . $time_format, strtotime($start)) . ' (UTC ' . $diff . ')</span>';
|
| 442 |
+
$markup .= '</div>';
|
| 443 |
+
$markup .= '<div class="info">';
|
| 444 |
+
if ($next_event['permalink'] !== '') {
|
| 445 |
+
$markup .= '<span><a href="' . $next_event['permalink'] . '">' . $next_event['title'] . '</a></span>';
|
| 446 |
+
} else {
|
| 447 |
+
$markup .= '<span>' . $next_event['title'] . '</span>';
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
|
| 451 |
+
$markup .= '<span>' . $next_event['location'] . '</span>';
|
| 452 |
+
$markup .= ' </div>';
|
| 453 |
+
$markup .= '<div class="clear"></div>';
|
| 454 |
+
$markup .= ' </div>';
|
| 455 |
+
$markup .= '<div class="ecwd_countdown">';
|
| 456 |
+
$markup .= '<input type="hidden" name="ecwd_end_time" value="' . $start . '"/>';
|
| 457 |
+
$markup .= '<input type="hidden" name="ecwd_timezone" value="' . $diff . '"/>';
|
| 458 |
+
$markup .= '<input type="hidden" name="ecwd_text_days" value="' . __('DAYS', 'ecwd') . '"/>';
|
| 459 |
+
$markup .= '<input type="hidden" name="ecwd_text_hours" value="' . __('HOURS', 'ecwd') . '"/>';
|
| 460 |
+
$markup .= '<input type="hidden" name="ecwd_text_minutes" value="' . __('MINUTES', 'ecwd') . '"/>';
|
| 461 |
+
$markup .= '<input type="hidden" name="ecwd_text_seconds" value="' . __('SECONDS', 'ecwd') . '"/>';
|
| 462 |
+
$markup .= '<input type="hidden" name="ecwd_finish_text" value="' . $finish_text . '"/>';
|
| 463 |
+
if ($theme_id) {
|
| 464 |
+
$theme = get_post_meta($theme_id, 'ecwd_countdown_theme', true);
|
| 465 |
+
$markup .= '<textarea class="hidden" name="ecwd_theme">' . $theme . '</textarea>';
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
$markup .= '<div class="clear"></div>';
|
| 469 |
+
$markup .= '</div>';
|
| 470 |
+
$markup .= '</div>';
|
| 471 |
+
$markup .= '<div class="clear"></div>';
|
| 472 |
+
}
|
| 473 |
|
| 474 |
+
return $markup;
|
| 475 |
}
|
includes/register-settings.php
CHANGED
|
@@ -235,7 +235,15 @@ function ecwd_register_settings() {
|
|
| 235 |
'desc' => 'empty for all events',
|
| 236 |
'type' => 'text',
|
| 237 |
'default' => ''
|
| 238 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
),
|
| 240 |
'category_archive' => array(
|
| 241 |
'category_archive_slug' => array(
|
|
@@ -341,7 +349,8 @@ function ecwd_get_settings_field_args($option, $section) {
|
|
| 341 |
'href' => isset($option['href']) ? $option['href'] : '',
|
| 342 |
'default' => isset($option['default']) ? $option['default'] : '',
|
| 343 |
'cols' => isset($option['cols']) ? $option['cols'] : '',
|
| 344 |
-
'rows' => isset($option['rows']) ? $option['rows'] : ''
|
|
|
|
| 345 |
);
|
| 346 |
|
| 347 |
// Link label to input using 'label_for' argument if text, textarea, password, select, or variations of.
|
|
@@ -484,6 +493,39 @@ function ecwd_radio_callback($args) {
|
|
| 484 |
echo $html;
|
| 485 |
}
|
| 486 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
/*
|
| 488 |
* Multiple checkboxs callback function
|
| 489 |
*/
|
| 235 |
'desc' => 'empty for all events',
|
| 236 |
'type' => 'text',
|
| 237 |
'default' => ''
|
| 238 |
+
),
|
| 239 |
+
'events_archive_page_order' => array(
|
| 240 |
+
'id' => 'events_archive_page_order',
|
| 241 |
+
'name' => __('Order of events archive page', 'ecwd'),
|
| 242 |
+
'desc' => __('Sort by event start', 'ecwd'),
|
| 243 |
+
'type' => 'custom_radio',
|
| 244 |
+
'default' => '0',
|
| 245 |
+
'labels' => array('DESC', 'ASC')
|
| 246 |
+
),
|
| 247 |
),
|
| 248 |
'category_archive' => array(
|
| 249 |
'category_archive_slug' => array(
|
| 349 |
'href' => isset($option['href']) ? $option['href'] : '',
|
| 350 |
'default' => isset($option['default']) ? $option['default'] : '',
|
| 351 |
'cols' => isset($option['cols']) ? $option['cols'] : '',
|
| 352 |
+
'rows' => isset($option['rows']) ? $option['rows'] : '',
|
| 353 |
+
'labels' => isset($option['labels']) ? $option['labels'] : array(),
|
| 354 |
);
|
| 355 |
|
| 356 |
// Link label to input using 'label_for' argument if text, textarea, password, select, or variations of.
|
| 493 |
echo $html;
|
| 494 |
}
|
| 495 |
|
| 496 |
+
/*
|
| 497 |
+
* Custom Radio callback function
|
| 498 |
+
*/
|
| 499 |
+
|
| 500 |
+
function ecwd_custom_radio_callback($args) {
|
| 501 |
+
global $ecwd_options;
|
| 502 |
+
|
| 503 |
+
$html = "\n";
|
| 504 |
+
if (isset($ecwd_options['events_archive_page_order'])) {
|
| 505 |
+
$checked_item_id = intval($ecwd_options['events_archive_page_order']);
|
| 506 |
+
} else {
|
| 507 |
+
if (isset($args['default'])) {
|
| 508 |
+
$checked_item_id = intval($args['default']);
|
| 509 |
+
} else {
|
| 510 |
+
$checked_item_id = 0;
|
| 511 |
+
}
|
| 512 |
+
}
|
| 513 |
+
foreach ($args['labels'] as $key => $label) {
|
| 514 |
+
if ($checked_item_id == $key) {
|
| 515 |
+
$check_text = 'checked';
|
| 516 |
+
} else {
|
| 517 |
+
$check_text = '';
|
| 518 |
+
}
|
| 519 |
+
$html .= '<div class="checkbox-div"> <input type="radio" id="ecwd_settings_' . $args['section'] . '[' . $args['id'] . ']_' . $key . '" name="ecwd_settings_' . $args['section'] . '[' . $args['id'] . ']" value="' . $key . '" ' . $check_text . ' /><label for="ecwd_settings_' . $args['section'] . '[' . $args['id'] . ']_' . $key . '"></label></div> <label for="ecwd_settings_' . $args['section'] . '[' . $args['id'] . ']_' . $key . '">' . $label . '</label>' . "\n";
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
// Render description text directly to the right in a label if it exists.
|
| 523 |
+
if (!empty($args['desc'])) {
|
| 524 |
+
$html .= '<p class="description">' . $args['desc'] . '</p>' . "\n";
|
| 525 |
+
}
|
| 526 |
+
echo $html;
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
/*
|
| 530 |
* Multiple checkboxs callback function
|
| 531 |
*/
|
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, reservation
|
| 5 |
Requires at least: 3.9
|
| 6 |
Tested up to: 4.5
|
| 7 |
-
Stable tag: 1.0.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -154,43 +154,47 @@ After downloading the ZIP file of the Event Calendar WD plugin,
|
|
| 154 |
|
| 155 |
== Changelog ==
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
= 1.0.57 =
|
| 158 |
-
Fixed: Translation
|
| 159 |
|
| 160 |
= 1.0.56 =
|
| 161 |
-
Fixed: Minor bug
|
| 162 |
-
Changed: Event popup position
|
| 163 |
|
| 164 |
= 1.0.55 =
|
| 165 |
-
Fixed: List view events order
|
| 166 |
-
Added: Organaizer on single event
|
| 167 |
-
Added: Portuguese (Brazil) Translation
|
| 168 |
-
Fixed: Description formatting
|
| 169 |
|
| 170 |
= 1.0.54 =
|
| 171 |
-
New: Related events count option
|
| 172 |
|
| 173 |
= 1.0.53 =
|
| 174 |
-
Added: Export to GCal/ICal
|
| 175 |
|
| 176 |
= 1.0.52 =
|
| 177 |
-
Added: Mark all days of multi-day event option
|
| 178 |
|
| 179 |
= 1.0.51 =
|
| 180 |
-
Added: Config page
|
| 181 |
-
Changed: Spanish Translation
|
| 182 |
-
Changed: German Translation
|
| 183 |
-
Changed: Featured plugins/themes page
|
| 184 |
-
Changed: Event details popup direction for 4th day
|
| 185 |
-
Fixed: Scroll issue in mobile
|
| 186 |
|
| 187 |
= 1.0.50 =
|
| 188 |
-
Added: Event Subscribe add-on
|
| 189 |
|
| 190 |
= 1.0.49 =
|
| 191 |
-
Added: Swedish translation by Marcel Króča and Slovak translation by Magnus Juven
|
| 192 |
-
Fixed: Issue with featured image
|
| 193 |
-
Fixed: Pointer bug
|
| 194 |
|
| 195 |
= 1.0.48 =
|
| 196 |
* Added: Wizard
|
| 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, reservation
|
| 5 |
Requires at least: 3.9
|
| 6 |
Tested up to: 4.5
|
| 7 |
+
Stable tag: 1.0.58
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 154 |
|
| 155 |
== Changelog ==
|
| 156 |
|
| 157 |
+
= 1.0.58 =
|
| 158 |
+
* Added: Order of events archive page option
|
| 159 |
+
* Fixed: Minor bug
|
| 160 |
+
|
| 161 |
= 1.0.57 =
|
| 162 |
+
* Fixed: Translation
|
| 163 |
|
| 164 |
= 1.0.56 =
|
| 165 |
+
* Fixed: Minor bug
|
| 166 |
+
* Changed: Event popup position
|
| 167 |
|
| 168 |
= 1.0.55 =
|
| 169 |
+
* Fixed: List view events order
|
| 170 |
+
* Added: Organaizer on single event
|
| 171 |
+
* Added: Portuguese (Brazil) Translation
|
| 172 |
+
* Fixed: Description formatting
|
| 173 |
|
| 174 |
= 1.0.54 =
|
| 175 |
+
* New: Related events count option
|
| 176 |
|
| 177 |
= 1.0.53 =
|
| 178 |
+
* Added: Export to GCal/ICal
|
| 179 |
|
| 180 |
= 1.0.52 =
|
| 181 |
+
* Added: Mark all days of multi-day event option
|
| 182 |
|
| 183 |
= 1.0.51 =
|
| 184 |
+
* Added: Config page
|
| 185 |
+
* Changed: Spanish Translation
|
| 186 |
+
* Changed: German Translation
|
| 187 |
+
* Changed: Featured plugins/themes page
|
| 188 |
+
* Changed: Event details popup direction for 4th day
|
| 189 |
+
* Fixed: Scroll issue in mobile
|
| 190 |
|
| 191 |
= 1.0.50 =
|
| 192 |
+
* Added: Event Subscribe add-on
|
| 193 |
|
| 194 |
= 1.0.49 =
|
| 195 |
+
* Added: Swedish translation by Marcel Króča and Slovak translation by Magnus Juven
|
| 196 |
+
* Fixed: Issue with featured image
|
| 197 |
+
* Fixed: Pointer bug
|
| 198 |
|
| 199 |
= 1.0.48 =
|
| 200 |
* Added: Wizard
|
