PluginProbe
Event Post / 5.0
Event Post v5.0
6.1.1 6.1.0 6.0.1 6.0.0 5.12.0 trunk 3.9 4.0 4.2 4.3 4.4 4.5 5.0 5.1 5.10.0 5.10.1 5.10.2 5.10.3 5.10.4 5.11.0 5.11.1 5.2 5.5 5.6 5.6.1 All 46 releases
← All changes | eventpost.php +68 -209 5.15.0 View file →
@@ -2,9 +2,9 @@
2 2 /*
3 3 Plugin Name: Event Post
4 4 Plugin URI: http://event-post.com
5 5 Description: Add calendar and/or geolocation metadata on posts. For a better experience, we recommand to use it with <a href="https://wordpress.org/plugins/shortcode-ui/" target="_blank">Shortcake (shortcode UI)</a> installed.
6 - Version: 5.1
6 + Version: 5.0.2
7 7 Author: N.O.U.S. Open Useful and Simple
8 8 Contributors: bastho, ecolosites
9 9 Author URI: http://avecnous.eu
10 10 License: GPLv2
@@ -38,9 +38,8 @@
38 38 public $settings;
39 39 public $dateformat;
40 40
41 41 public $version = '4.5';
42 - private $script_sufix;
43 42
44 43 public $map_interactions;
45 44 public $quick_edit_fields;
46 45
@@ -48,9 +47,9 @@
48 47
49 48 public function __construct() {
50 49 load_plugin_textdomain('event-post', false, 'event-post/languages');
51 50
52 - add_action('widgets_init', array(&$this,'init'), 1);
51 + add_action('widgets_init', array(&$this,'init'), 1);
53 52 add_action('save_post', array(&$this, 'save_postdata'));
54 53 add_action('admin_menu', array(&$this, 'manage_options'));
55 54 add_filter('dashboard_glance_items', array(&$this, 'dashboard_right_now'));
56 55
@@ -69,10 +68,8 @@
69 68
70 69 // Ajax
71 70 add_action('wp_ajax_EventPostGetLatLong', array(&$this, 'GetLatLong'));
72 71 add_action('wp_ajax_EventPostHumanDate', array(&$this, 'HumanDate'));
73 - add_action('wp_ajax_EventPostList', array(&$this, 'ajaxlist'));
74 - add_action('wp_ajax_EventPostMap', array(&$this, 'ajaxmap'));
75 72 add_action('wp_ajax_EventPostCalendar', array(&$this, 'ajaxcal'));
76 73 add_action('wp_ajax_nopriv_EventPostCalendar', array(&$this, 'ajaxcal'));
77 74 add_action('wp_ajax_EventPostCalendarDate', array(&$this, 'ajaxdate'));
78 75 add_action('wp_ajax_nopriv_EventPostCalendarDate', array(&$this, 'ajaxdate'));
@@ -107,9 +104,8 @@
107 104 include_once ($inc_path . 'shortcodes.php');
108 105 include_once ($inc_path . 'openweathermap.php');
109 106 include_once ($inc_path . 'children.php');
110 107
111 - $this->script_sufix = (defined('WP_DEBUG') && WP_DEBUG) ? '' : '.min';
112 108 }
113 109
114 110 /**
115 111 * PHP4 constructor
@@ -137,21 +133,14 @@
137 133 $this->NomDuMois = array('', __('Jan', 'event-post'), __('Feb', 'event-post'), __('Mar', 'event-post'), __('Apr', 'event-post'), __('May', 'event-post'), __('Jun', 'event-post'), __('Jul', 'event-post'), __('Aug', 'event-post'), __('Sept', 'event-post'), __('Oct', 'event-post'), __('Nov', 'event-post'), __('Dec', 'event-post'));
138 134 $this->Week = array(__('Sunday', 'event-post'), __('Monday', 'event-post'), __('Tuesday', 'event-post'), __('Wednesday', 'event-post'), __('Thursday', 'event-post'), __('Friday', 'event-post'), __('Saturday', 'event-post'));
139 135
140 136 $this->maps = $this->get_maps();
141 - $this->settings = $this->get_settings();
137 + $this->settings = $this->get_settings();
142 138
143 139 do_action('evenpost_init', $this);
144 140
145 141 $this->Shortcodes = new EventPost_Shortcodes();
146 142
147 - if(function_exists('gutenberg_pre_init')){
148 - $block_path = plugin_dir_path(__FILE__).'blocks/';
149 - include_once ($block_path . 'eventslist.php');
150 - include_once ($block_path . 'eventsmap.php');
151 - include_once ($block_path . 'eventscalendar.php');
152 - }
153 -
154 143 // Edit
155 144 add_action('add_meta_boxes', array(&$this, 'add_custom_box'));
156 145 foreach($this->settings['posttypes'] as $posttype){
157 146 add_filter('manage_'.$posttype.'_posts_columns', array(&$this, 'columns_head'), 2);
@@ -303,12 +292,8 @@
303 292 if (!isset($ep_settings['export']) || empty($ep_settings['export'])) {
304 293 $ep_settings['export'] = 'both';
305 294 $reg_settings=true;
306 295 }
307 - if (!isset($ep_settings['export_when']) || empty($ep_settings['export_when'])) {
308 - $ep_settings['export_when'] = 'future';
309 - $reg_settings=true;
310 - }
311 296 if (!isset($ep_settings['dateforhumans'])) {
312 297 $ep_settings['dateforhumans'] = 1;
313 298 $reg_settings=true;
314 299 }
@@ -462,10 +447,10 @@
462 447 elseif(is_file(get_stylesheet_directory().'/event-post.css') || is_file(get_template_directory().'/event-post.css')){
463 448 wp_enqueue_style('event-post-custom', get_theme_file_uri('event-post.css'));
464 449 }
465 450 else{
466 - wp_register_style('event-post', plugins_url('/css/eventpost'.$this->script_sufix.'.css', __FILE__), false, $this->version);
467 - wp_enqueue_style('event-post', plugins_url('/css/eventpost'.$this->script_sufix.'.css', __FILE__), false, $this->version);
451 + wp_register_style('event-post', plugins_url('/css/eventpost.min.css', __FILE__), false, $this->version);
452 + wp_enqueue_style('event-post', plugins_url('/css/eventpost.min.css', __FILE__), false, $this->version);
468 453 }
469 454
470 455 // Lib scripts
471 456 wp_enqueue_style('openlayers', plugins_url('/css/openlayers.css', __FILE__), false, $this->version);
@@ -474,9 +459,9 @@
474 459 /**
475 460 * Enqueue Editor style
476 461 */
477 462 public function editor_styles() {
478 - add_editor_style( plugins_url('/css/eventpost'.$this->script_sufix.'.css', __FILE__) );
463 + add_editor_style( plugins_url('/css/eventpost.min.css', __FILE__) );
479 464 }
480 465
481 466 /**
482 467 * Enqueue JS files
@@ -483,9 +468,9 @@
483 468 */
484 469 public function load_scripts($deps = array('jquery')) {
485 470 // JS
486 471 wp_enqueue_script('jquery', false, false, false, true);
487 - wp_enqueue_script('event-post', plugins_url('/js/eventpost'.$this->script_sufix.'.js', __FILE__), $deps, $this->version, true);
472 + wp_enqueue_script('event-post', plugins_url('/js/eventpost.min.js', __FILE__), $deps, $this->version, true);
488 473 wp_localize_script('event-post', 'eventpost_params', array(
489 474 'imgpath' => plugins_url('/img/', __FILE__),
490 475 'maptiles' => $this->maps,
491 476 'defaulttile' => $this->settings['tile'],
@@ -536,9 +521,9 @@
536 521 if($this->settings['datepicker']=='simple' || !is_admin() || (isset($_GET['page']) && $_GET['page']=='event-settings')){
537 522 wp_enqueue_script('jquery-ui-datepicker');
538 523 $deps[] = 'jquery-ui-datepicker';
539 524 }
540 - wp_enqueue_script('event-post-admin', plugins_url('/js/eventpost-admin'.$this->script_sufix.'.js', __FILE__), $deps, $this->version, true);
525 + wp_enqueue_script('event-post-admin', plugins_url('/js/eventpost-admin.min.js', __FILE__), $deps, $this->version, true);
541 526 $language = get_bloginfo('language');
542 527 if (strpos($language, '-') > -1) {
543 528 $language = strtolower(substr($language, 0, 2));
544 529 }
@@ -550,9 +535,9 @@
550 535 'more_icons' => __('More icons', 'event-post'),
551 536 'pick_a_date'=>__('Pick a date','event-post'),
552 537 'use_current_location'=>__('Use my current location','event-post'),
553 538 'start_drag'=>__('Click to<br>drag the map<br>and change location','event-post'),
554 - 'empty_address'=>__('Be kind to fill a non empty address:)', 'event-post'),
539 + 'empty_address'=>__('Be kind to fill a non empty address :)', 'event-post'),
555 540 'search'=>__('Type an address', 'event-post'),
556 541 'stop_drag'=>_x('Done','Stop allowing to drag the map', 'event-post'),
557 542 'datepickeri18n'=>array(
558 543 'order'=>__( '%1$s %2$s, %3$s @ %4$s:%5$s', 'event-post'),
@@ -592,29 +577,22 @@
592 577 * Add custom header meta for single events
593 578 */
594 579 public function single_header() {
595 580 if (is_single()) {
596 - $twitter_label_id=0;
597 581 $event = $this->retreive();
598 582 if ($event->address != '' || ($event->lat != '' && $event->long != '')) {
599 - $twitter_label_id++;
600 583 ?>
601 -<meta name="geo.placename" content="<?php echo esc_attr($event->address) ?>" />
602 -<meta name="geo.position" content="<?php echo esc_attr($event->lat) ?>;<?php echo esc_attr($event->long) ?>" />
603 -<meta name="ICBM" content="<?php echo $event->lat ?>;<?php echo esc_attr($event->long) ?>" />
604 -<meta property="place:location:latitude" content="<?php echo esc_attr($event->lat) ?>" />
605 -<meta property="place:location:longitude" content="<?php echo esc_attr($event->long) ?>" />
606 - <meta name="twitter:label<?php echo $twitter_label_id; ?>" content="<?php _e('Location', 'event-post'); ?>"/>
607 - <meta name="twitter:data<?php echo $twitter_label_id; ?>" content="<?php echo esc_attr($event->address) ?>"/>
584 +<meta name="geo.placename" content="<?php echo $event->address ?>" />
585 +<meta name="geo.position" content="<?php echo $event->lat ?>;<?php echo $event->long ?>" />
586 +<meta name="ICBM" content="<?php echo $event->lat ?>;<?php echo $event->long ?>" />
587 +<meta property="place:location:latitude" content="<?php echo $event->lat ?>" />
588 +<meta property="place:location:longitude" content="<?php echo $event->long ?>" />
608 589 <?php
609 590 }
610 591 if ($event->start != '' && $event->end != '') {
611 - $twitter_label_id++;
612 592 ?>
613 593 <meta name="datetime-coverage-start" content="<?php echo date('c', $event->time_start) ?>" />
614 594 <meta name="datetime-coverage-end" content="<?php echo date('c', $event->time_end) ?>" />
615 - <meta name="twitter:label<?php echo $twitter_label_id; ?>" content="<?php _e('Date', 'event-post'); ?>"/>
616 - <meta name="twitter:data<?php echo $twitter_label_id; ?>" content="<?php echo esc_attr($this->human_date($event->time_start)) ?>"/>
617 595 <?php
618 596 }
619 597 }
620 598 }
@@ -687,27 +665,27 @@
687 665 if (date('d/m/Y', $time_start) == date('d/m/Y', $time_end)) { // same day
688 666 $dates.= "\n\t\t\t\t\t\t\t".'<time itemprop="dtstart" datetime="' . date_i18n('c', $time_start) . '">'
689 667 . '<span class="date date-single">' . $this->human_date($time_end, $this->settings['dateformat']) . "</span>";
690 668 if (date('H:i', $time_start) != date('H:i', $time_end) && date('H:i', $time_start) != '00:00' && date('H:i', $time_end) != '00:00') {
691 - $dates.=' <span class="linking_word linking_word-from">' . _x('from', 'Time', 'event-post') . '</span>
669 + $dates.=' <span class="linking_word linking_word-from">' . __('from', 'event-post') . '</span>
692 670 <span class="time time-start">' . date_i18n($this->settings['timeformat'], $time_start) . '</span>
693 - <span class="linking_word linking_word-to">' . _x('to', 'Time', 'event-post') . '</span>
671 + <span class="linking_word linking_word-t">' . __('to', 'event-post') . '</span>
694 672 <span class="time time-end">' . date_i18n($this->settings['timeformat'], $time_end) . '</span>';
695 673 }
696 674 elseif (date('H:i', $time_start) != '00:00') {
697 - $dates.=' <span class="linking_word">' . _x('at', 'Time', 'event-post') . '</span>
675 + $dates.=' <span class="linking_word">' . __('at', 'event-post') . '</span>
698 676 <time class="time time-single" itemprop="dtstart" datetime="' . date_i18n('c', $time_start) . '">' . date_i18n($this->settings['timeformat'], $time_start) . '</time>';
699 677 }
700 678 $dates.="\n\t\t\t\t\t\t\t".'</time>';
701 679 } else { // not same day
702 680 $dates.= '
703 - <span class="linking_word linking_word-from">' . _x('from', 'Date', 'event-post') . '</span>
681 + <span class="linking_word linking_word-from">' . __('from', 'event-post') . '</span>
704 682 <time class="date date-start" itemprop="dtstart" datetime="' . date('c', $time_start) . '">' . $this->human_date($time_start, $this->settings['dateformat']);
705 683 if (date('H:i:s', $time_start) != '00:00:00' || date('H:i:s', $time_end) != '00:00:00'){
706 684 $dates.= ', ' . date_i18n($this->settings['timeformat'], $time_start);
707 685 }
708 686 $dates.='</time>
709 - <span class="linking_word linking_word-to">' . _x('to', 'Date', 'event-post') . '</span>
687 + <span class="linking_word linking_word-to">' . __('to', 'event-post') . '</span>
710 688 <time class="date date-end" itemprop="dtend" datetime="' . date('c', $time_end) . '">' . $this->human_date($time_end, $this->settings['dateformat']);
711 689 if (date('H:i:s', $time_start) != '00:00:00' || date('H:i:s', $time_end) != '00:00:00') {
712 690 $dates.= ', ' . date_i18n($this->settings['timeformat'], $time_end);
713 691 }
@@ -732,21 +710,14 @@
732 710
733 711 $timezone_string = get_option('timezone_string');
734 712 $gmt_offset = $gmt = $this->get_gmt_offset();
735 713
736 - if (
737 - !is_admin()
738 - && ( // Export when setting
739 - $this->settings['export_when'] == 'both' ||
740 - ( $this->settings['export_when'] == 'future' && $this->is_future($event) ) ||
741 - ( $this->settings['export_when'] == 'past' && $this->is_past($event) )
742 - )
743 - && ( // Export setting
714 + if (!is_admin() && $event->time_end > current_time('timestamp') && (
744 715 $this->settings['export'] == 'both' ||
745 716 ($this->settings['export'] == 'single' && is_single() ) ||
746 717 ($this->settings['export'] == 'list' && !is_single() )
747 - )
748 - ) {
718 + )) {
719 +
749 720 // Export event
750 721 $title = urlencode($post->post_title);
751 722 $address = urlencode($post->address);
752 723 $url = urlencode($post->guid);
@@ -776,15 +747,11 @@
776 747 'text'=>$title,
777 748 'dates'=>$d_s.'Z/'.$d_e.'Z',
778 749 'location'=>$address,
779 750 'details'=>$url,
751 + 'ctz'=>$timezone_string,
780 752 'gmt'=> urlencode($gmt_offset)
781 753 ), 'https://www.google.com/calendar/event');
782 - if(!empty($timezone_string)){
783 - $google_url = add_query_arg(array(
784 - 'ctz'=>$timezone_string,
785 - ), $google_url);
786 - }
787 754
788 755 // format de date VCS
789 756 $vcs_url = add_query_arg(array(
790 757 't'=>$title,
@@ -1056,9 +1023,9 @@
1056 1023 $list.=sprintf('<%1$s class="event_geolist_icon_loader"><p><span class="dashicons dashicons-location-alt"></span></p><p class="screen-reader-text">'.__('An events map', 'event-post').'</p></%1$s>', $type);
1057 1024 }
1058 1025
1059 1026 foreach ($events as $event) {
1060 - $class_item = $this->is_future($event) ? 'event_future' : 'event_past';
1027 + $class_item = ($event->time_end >= current_time('timestamp')) ? 'event_future' : 'event_past';
1061 1028 if ($ep_settings['emptylink'] == 0 && empty($event->post_content)) {
1062 1029 $event->permalink = '#' . $id . $this->list_id;
1063 1030 }
1064 1031 elseif(empty($ob->permalink)){
@@ -1150,9 +1117,8 @@
1150 1117 extract($requete);
1151 1118 wp_reset_query();
1152 1119
1153 1120 $arg = array(
1154 - 'post_status' => 'publish',
1155 1121 'post_type' => $post_type,
1156 1122 'posts_per_page' => $nb,
1157 1123 'meta_key' => $orderbykey,
1158 1124 'orderby' => $orderby,
@@ -1291,42 +1257,9 @@
1291 1257 return apply_filters('eventpost_get_items', $events, $requete, $arg);
1292 1258 }
1293 1259
1294 1260 /**
1295 - * Checks if the given event is in the future or not
1296 1261 *
1297 - * @param object $event
1298 - * @param boolean $exact Future status has to be calculated against time or entire day
1299 - * @return boolean
1300 - */
1301 - function is_future($event, $exact=false){
1302 - $match = current_time('timestamp');
1303 - // if EXACT is false, end date is set to begining of the current day
1304 - if(!$exact){
1305 - $match = mktime(0, 0, 0, date('m', $match), date('d', $match), date('Y', $match));
1306 - }
1307 - return ($event->time_end >= $match);
1308 - }
1309 -
1310 - /**
1311 - * Checks if the given event is completed or not
1312 - *
1313 - * @param object $event
1314 - * @param boolean $exact Past status has to be calculated against time or entire day
1315 - * @return boolean
1316 - */
1317 - function is_past($event, $exact=false){
1318 - $match = current_time('timestamp');
1319 - // if EXACT is false or full day event, end date is set to end of the current day
1320 - if(!$exact || ( date('H:i:s', $event->time_start) == '00:00:00' && date('H:i:s', $event->time_end) == '00:00:00' )){
1321 - $match = mktime(23, 59, 59, date('m', $match), date('d', $match), date('Y', $match));
1322 - }
1323 - return ($event->time_end < $match);
1324 - }
1325 -
1326 -
1327 - /**
1328 - *
1329 1262 * @param object $event
1330 1263 * @return object
1331 1264 */
1332 1265 public function retreive($event = null) {
@@ -1488,9 +1421,9 @@
1488 1421 </p>
1489 1422 </div>
1490 1423 <?php if (sizeof($colors) > 0): ?>
1491 1424 <div class="eventpost-misc-pub-section event-color-section">
1492 - <span class="screen-reader-text"><?php _e('Color:', 'event-post'); ?></span>
1425 + <span class="screen-reader-text"><?php _e('Color:', 'event-post'); ?></span><?php echo $key_color; ?>
1493 1426 <p>
1494 1427 <img src="<?php echo $this->markurl.$eventcolor.'.png'; ?>" id="eventpost-color-preview" data-url="<?php echo $this->markurl; ?>">
1495 1428 <span id="eventpost-color-dropdown">
1496 1429 <?php foreach ($colors as $color => $file): ?>
@@ -1565,9 +1498,9 @@
1565 1498 ?>
1566 1499 <?php do_action('before_eventpost_generator'); ?>
1567 1500 <div class="all">
1568 1501 <p>
1569 - <label for="ep_sce_type"><?php _e('Type:', 'event-post'); ?>
1502 + <label for="ep_sce_type"><?php _e('Type :', 'event-post'); ?>
1570 1503 <select id="ep_sce_type">
1571 1504 <option value='list'><?php _e('List', 'event-post') ?></option>
1572 1505 <option value='map'><?php _e('Map', 'event-post') ?></option>
1573 1506 </select>
@@ -1581,9 +1514,9 @@
1581 1514 </label>
1582 1515 </p>
1583 1516
1584 1517 <p>
1585 - <label for="ep_sce_cat"><?php _e('Only in:', 'event-post'); ?>
1518 + <label for="ep_sce_cat"><?php _e('Only in :', 'event-post'); ?>
1586 1519 <select id="ep_sce_cat" data-att="cat">
1587 1520 <option value=''><?php _e('All', 'event-post') ?></option>
1588 1521 <?php
1589 1522 $cats = get_categories();
@@ -1831,49 +1764,33 @@
1831 1764 * @param string $cat
1832 1765 * @param boolean $display
1833 1766 * @return boolean
1834 1767 */
1835 - public function display_caldate($date, $cat = '', $display = false, $colored=true, $thumbnail='', $title='') {
1768 + public function display_caldate($date, $cat = '', $display = false, $colored=true, $thumbnail='') {
1836 1769 $events = $this->get_events(array('nb' => -1, 'date' => $date, 'cat' => $cat, 'retreive' => true));
1837 1770 $nb = count($events);
1838 - if(!$display && !$nb){
1839 - return date('j', $date);
1840 - }
1841 - if(!$nb){
1842 - return '';
1843 - }
1844 -
1845 - if ($display || $title) {
1846 - $ret='<ul>';
1847 - foreach ($events as $event) {
1848 - if ($this->settings['emptylink'] == 0 && empty($event->post_content)) {
1849 - $event->guid = '#';
1771 + if ($display) {
1772 + if ($nb > 0) {
1773 + $ret.='<ul>';
1774 + foreach ($events as $event) {
1775 + if ($this->settings['emptylink'] == 0 && empty($event->post_content)) {
1776 + $event->guid = '#';
1777 + }
1778 + $ret.='<li>'
1779 + . '<a href="' . $event->permalink . '" title="'.esc_attr(sprintf(__('View event: %s', 'event-post'), $event->post_title)).'">'
1780 + . '<h4>' . $event->post_title . '</h4>'
1781 + .$this->get_single($event)
1782 + . (!empty($thumbnail) ? '<span class="event_thumbnail_wrap">' . get_the_post_thumbnail($event->ID, $thumbnail) . '</span>' : '')
1783 + .'</a>'
1784 + . '</li>';
1850 1785 }
1851 - $ret.='<li>'
1852 - . '<a href="' . $event->permalink . '" title="'.esc_attr(sprintf(__('View event: %s', 'event-post'), $event->post_title)).'">'
1853 - . '<h4>' . $event->post_title . '</h4>'
1854 - .$this->get_single($event)
1855 - . (!empty($thumbnail) ? '<span class="event_thumbnail_wrap">' . get_the_post_thumbnail($event->ID, $thumbnail) . '</span>' : '')
1856 - .'</a>'
1857 - . '</li>';
1786 + $ret.='</ul>';
1787 + return $ret;
1858 1788 }
1859 - $ret.='</ul>';
1789 + return'';
1790 + } else {
1791 + return $nb > 0 ? '<button data-date="' . date('Y-m-d', $date) . '" class="eventpost_cal_link"'.($colored?' style="background-color:#'.$events[0]->color.'"':'').' title="'.esc_attr(sprintf(_n('View %1$d event at date %2$s', 'View %1$d events at date %2$s', $nb, 'event-post'), $nb, $this->human_date($date, $this->settings['dateformat']))).'">' . date('j', $date) . '</button>' : date('j', $date);
1860 1792 }
1861 - if ($display) {
1862 - return $ret;
1863 - }
1864 - elseif($title) {
1865 - return '<span '.($colored?' style="color:#'.$events[0]->color.'"':'').'>'.date('j', $date).'</span>'.$ret;
1866 - }
1867 - else {
1868 - return '<button data-date="' . date('Y-m-d', $date).'"'
1869 - .' class="eventpost_cal_link"'.($colored?' style="background-color:#'.$events[0]->color.'"':'')
1870 - .' title="'.esc_attr(sprintf(_n('View %1$d event at date %2$s', 'View %1$d events at date %2$s', $nb, 'event-post'), $nb, $this->human_date($date, $this->settings['dateformat']))).'"'
1871 - .'>'
1872 - . date('j', $date)
1873 - . '</button>';
1874 - }
1875 -
1876 1793 }
1877 1794
1878 1795
1879 1796 /**
@@ -1887,19 +1804,11 @@
1887 1804 'cat' => '',
1888 1805 'mondayfirst' => 0, //1 : weeks starts on monday
1889 1806 'datepicker' => 1,
1890 1807 'colored' => 1,
1891 - 'display_title'=>0,
1892 1808 'thumbnail'=>'',
1893 1809 ), 'calendar'), $atts));
1894 1810
1895 - if($date && !preg_match('#[0-9][0-9][0-9][0-9]-[0-9][0-9]?#i', $date)){
1896 - $date = date('Y-n', strtotime($date));
1897 - }
1898 - if(!$date){
1899 - $date = date('Y-n');
1900 - }
1901 -
1902 1811 $annee = substr($date, 0, 4);
1903 1812 $mois = substr($date, 5);
1904 1813
1905 1814 $time = mktime(0, 0, 0, $mois, 1, $annee);
@@ -1926,14 +1835,14 @@
1926 1835 . '</caption>';
1927 1836 $ret.='<thead><tr><th colspan="7">';
1928 1837 if ($datepicker == 1) {
1929 1838 $ret.='<div>';
1930 - $ret.='<button data-date="' . date('Y-n', $prev_year) . '" tabindex="0" title="'.sprintf(__('Switch to %s', 'event-post'), date('Y', $prev_year)).'" class="eventpost_cal_bt">&laquo;</button>&nbsp;';
1839 + $ret.='<button data-date="' . date('Y-n', $prev_year) . '" tabindex="0" title="'.sprintf(__('Switch to %s', 'event-post'), date('Y', $prev_year)).'" class="eventpost_cal_bt">&lt;&lt;</button> ';
1931 1840 $ret.=$annee;
1932 - $ret.='&nbsp;<button data-date="' . date('Y-n', $next_year) . '" title="'.sprintf(__('Switch to %s', 'event-post'), date('Y', $next_year)).'" class="eventpost_cal_bt">&raquo;</button>';
1933 - $ret.='<button data-date="' . date('Y-n', $prev_month) . '" title="'.sprintf(__('Switch to %s', 'event-post'), date_i18n('F Y', $prev_month)).'" class="eventpost_cal_bt">&laquo;</button>&nbsp;';
1841 + $ret.='<button data-date="' . date('Y-n', $next_year) . '" title="'.sprintf(__('Switch to %s', 'event-post'), date('Y', $next_year)).'" class="eventpost_cal_bt">&gt;&gt;</button> ';
1842 + $ret.='<button data-date="' . date('Y-n', $prev_month) . '" title="'.sprintf(__('Switch to %s', 'event-post'), date_i18n('F Y', $prev_month)).'" class="eventpost_cal_bt">&lt;</button> ';
1934 1843 $ret.=$this->NomDuMois[abs($mois)];
1935 - $ret.='&nbsp;<button data-date="' . date('Y-n', $next_month) . '" title="'.sprintf(__('Switch to %s', 'event-post'), date_i18n('F Y', $next_month)).'" class="eventpost_cal_bt">&raquo;</button> ';
1844 + $ret.='<button data-date="' . date('Y-n', $next_month) . '" title="'.sprintf(__('Switch to %s', 'event-post'), date_i18n('F Y', $next_month)).'" class="eventpost_cal_bt">&gt;</button> ';
1936 1845 $ret.='<button data-date="' . date('Y-n') . '" class="eventpost_cal_bt">' . __('Today', 'event-post') . '</button>';
1937 1846 $ret.='</div>';
1938 1847 }
1939 1848 $ret.='</th></tr><tr class="event_post_cal_days">';
@@ -1946,9 +1855,9 @@
1946 1855 $ret.='<tbody>';
1947 1856 $sqldate = date('Y-m', $time);
1948 1857 $cejour = date('Y-m-d');
1949 1858 for ($semaine = 0; $semaine <= 5; $semaine++) { // 6 semaines par mois
1950 - $tr_row_content ='';
1859 + $ret.='<tr>';
1951 1860 for ($journee = 0; $journee <= 6; $journee++) { // 7 jours par semaine
1952 1861 if ($NoJour > 0 && $NoJour <= $JourMax) { // si le jour est valide a afficher
1953 1862 $td = '<td class="event_post_day">';
1954 1863 if ($sqldate . '-' . ($NoJour<10?'0':'').$NoJour == $cejour) {
@@ -1956,65 +1865,34 @@
1956 1865 }
1957 1866 if ($sqldate . '-' . ($NoJour<10?'0':'').$NoJour < $cejour){
1958 1867 $td = '<td class="event_post_day_over">'; // Patch ahf
1959 1868 }
1960 - $tr_row_content.=$td;
1961 - $tr_row_content.= $this->display_caldate(mktime(0, 0, 0, $mois, $NoJour, $annee), $cat, false, $colored, $thumbnail, $display_title);
1962 - $tr_row_content.='</td>';
1869 + $ret.=$td;
1870 +
1871 + $ret.= $this->display_caldate(mktime(0, 0, 0, $mois, $NoJour, $annee), $cat, false, $colored, $thumbnail);
1872 + $ret.='</td>';
1963 1873 } else {
1964 - $tr_row_content.='<td></td>';
1874 + $ret.='<td></td>';
1965 1875 }
1966 1876 $NoJour ++;
1967 1877 }
1968 - if($tr_row_content){
1969 - $ret.='<tr>'.$tr_row_content.'</tr>';
1970 - }
1971 -
1878 + $ret.='</tr>';
1972 1879 }
1973 1880 $ret.='</tbody></table>';
1974 1881 return $ret;
1975 1882 }
1976 1883
1977 - public function ajaxlist(){
1978 - echo $this->list_events(array(
1979 - 'nb' => esc_attr(FILTER_INPUT(INPUT_POST, 'nb')),
1980 - 'future' => esc_attr(FILTER_INPUT(INPUT_POST, 'future')),
1981 - 'past' => esc_attr(FILTER_INPUT(INPUT_POST, 'past')),
1982 - 'geo' => esc_attr(FILTER_INPUT(INPUT_POST, 'geo')),
1983 - 'width' => esc_attr(FILTER_INPUT(INPUT_POST, 'width')),
1984 - 'height' => esc_attr(FILTER_INPUT(INPUT_POST, 'height')),
1985 - 'zoom' => esc_attr(FILTER_INPUT(INPUT_POST, 'zoom')),
1986 - 'tile' => esc_attr(FILTER_INPUT(INPUT_POST, 'tile')),
1987 - 'title' => esc_attr(FILTER_INPUT(INPUT_POST, 'title')),
1988 - 'before_title' => esc_attr(FILTER_INPUT(INPUT_POST, 'before_title')),
1989 - 'after_title' => esc_attr(FILTER_INPUT(INPUT_POST, 'after_title')),
1990 - 'cat' => esc_attr(FILTER_INPUT(INPUT_POST, 'cat')),
1991 - 'tag' => esc_attr(FILTER_INPUT(INPUT_POST, 'tag')),
1992 - 'events' => esc_attr(FILTER_INPUT(INPUT_POST, 'events')),
1993 - 'style' => esc_attr(FILTER_INPUT(INPUT_POST, 'style')),
1994 - 'thumbnail' => esc_attr(FILTER_INPUT(INPUT_POST, 'thumbnail')),
1995 - 'thumbnail_size' => esc_attr(FILTER_INPUT(INPUT_POST, 'thumbnail_size')),
1996 - 'excerpt' => esc_attr(FILTER_INPUT(INPUT_POST, 'excerpt')),
1997 - 'orderby' => esc_attr(FILTER_INPUT(INPUT_POST, 'orderby')),
1998 - 'order' => esc_attr(FILTER_INPUT(INPUT_POST, 'order')),
1999 - 'class' => esc_attr(FILTER_INPUT(INPUT_POST, 'class')),
2000 - ), esc_attr(FILTER_INPUT(INPUT_POST, 'list_type')));
2001 - exit;
2002 - }
2003 -
2004 1884 /**
2005 1885 * echoes the content of the calendar in ajax context
2006 1886 */
2007 1887 public function ajaxcal() {
2008 - $method = isset($_GET['action']) ? INPUT_GET : INPUT_POST;
2009 1888 echo $this->calendar(array(
2010 - 'date' => esc_attr(FILTER_INPUT($method, 'date')),
2011 - 'cat' => esc_attr(FILTER_INPUT($method, 'cat')),
2012 - 'mondayfirst' => esc_attr(FILTER_INPUT($method, 'mf')),
2013 - 'datepicker' => esc_attr(FILTER_INPUT($method, 'dp')),
2014 - 'colored' => esc_attr(FILTER_INPUT($method, 'color')),
2015 - 'display_title' => esc_attr(FILTER_INPUT($method, 'display_title')),
2016 - 'thumbnail' => esc_attr(FILTER_INPUT($method, 'thumbnail')),
1889 + 'date' => esc_attr(FILTER_INPUT(INPUT_GET, 'date')),
1890 + 'cat' => esc_attr(FILTER_INPUT(INPUT_GET, 'cat')),
1891 + 'mondayfirst' => esc_attr(FILTER_INPUT(INPUT_GET, 'mf')),
1892 + 'datepicker' => esc_attr(FILTER_INPUT(INPUT_GET, 'dp')),
1893 + 'colored' => esc_attr(FILTER_INPUT(INPUT_GET, 'color')),
1894 + 'thumbnail' => esc_attr(FILTER_INPUT(INPUT_GET, 'thumbnail')),
2017 1895 ));
2018 1896 exit();
2019 1897 }
2020 1898
@@ -2021,16 +1899,9 @@
2021 1899 /**
2022 1900 * echoes the date of the calendar in ajax context
2023 1901 */
2024 1902 public function ajaxdate() {
2025 - echo $this->display_caldate(
2026 - strtotime(esc_attr(FILTER_INPUT(INPUT_GET, 'date'))),
2027 - esc_attr(FILTER_INPUT(INPUT_GET, 'cat')),
2028 - true,
2029 - esc_attr(FILTER_INPUT(INPUT_GET, 'color')),
2030 - esc_attr(FILTER_INPUT(INPUT_GET, 'thumbnail')),
2031 - esc_attr(FILTER_INPUT(INPUT_GET, 'display_title'))
2032 - );
1903 + echo $this->display_caldate(strtotime(esc_attr(FILTER_INPUT(INPUT_GET, 'date'))), esc_attr(FILTER_INPUT(INPUT_GET, 'cat')), true, esc_attr(FILTER_INPUT(INPUT_GET, 'color')), esc_attr(FILTER_INPUT(INPUT_GET, 'thumbnail')));
2033 1904 exit();
2034 1905 }
2035 1906
2036 1907 /**
@@ -2304,9 +2175,9 @@
2304 2175 __('Use this custom CSS file', 'event-post'),
2305 2176 array(&$this, 'settings_field_default_callback'),
2306 2177 'eventpost-settings',
2307 2178 'eventpost-settings-general',
2308 - array( 'name' => 'customcss', 'description'=>sprintf(__('Leave empty to use the <a href="%s" target="_blank">default CSS file</a>.', 'event-post'), plugins_url('/css/eventpost'.$this->script_sufix.'css', __FILE__)).'<br>'
2179 + array( 'name' => 'customcss', 'description'=>sprintf(__('Leave empty to use the <a href="%s" target="_blank">default CSS file</a>.', 'event-post'), plugins_url('/css/eventpost.min.css', __FILE__)).'<br>'
2309 2180 . (is_file(get_stylesheet_directory().'/event-post.css') || is_file(get_template_directory().'/event-post.css')
2310 2181 ? __('Your theme contains an <code>event-post.css</code> file. It will be used as default stylesheet.', 'event-post')
2311 2182 : __('You can also add a <code>event-post.css</code> in your theme directory. It will be used as default stylesheet.', 'event-post')))
2312 2183 );
@@ -2348,21 +2219,8 @@
2348 2219 'none'=>__('None', 'event-post'),
2349 2220 ) )
2350 2221 );
2351 2222 add_settings_field(
2352 - 'export_when',
2353 - __('Show export buttons on:', 'event-post'),
2354 - array(&$this, 'settings_field_select_callback'),
2355 - 'eventpost-settings',
2356 - 'eventpost-settings-date',
2357 - array( 'name' => 'export_when', 'options'=>array(
2358 - 'future'=>__('Future only', 'event-post'),
2359 - 'past'=>__('Past only', 'event-post'),
2360 - 'both'=>__('Both', 'event-post'),
2361 - 'none'=>__('None', 'event-post'),
2362 - ) )
2363 - );
2364 - add_settings_field(
2365 2223 'dateforhumans',
2366 2224 __('Relative human dates:', 'event-post'),
2367 2225 array(&$this, 'settings_field_select_callback'),
2368 2226 'eventpost-settings',
@@ -2579,9 +2437,10 @@
2579 2437 public function manage_settings() {
2580 2438 $ep_settings = $this->settings;
2581 2439 ?>
2582 2440 <div class="wrap">
2583 - <h2><?php _e('Events settings', 'event-post'); ?></h2>
2441 + <?php screen_icon(); ?>
2442 + <h2><?php _e('Event settings', 'event-post'); ?></h2>
2584 2443 <form action="options.php" method="post">
2585 2444 <?php settings_fields( 'eventpost-settings' ); ?>
2586 2445 <?php do_settings_sections('eventpost-settings'); ?>
2587 2446 <?php do_action('eventpost_settings_form', $ep_settings); ?>