Events Manager - Version 3.0.8

Version Description

  • Event lists now have pagination links for both admin and public areas!
  • Fixed timezone issue with calendars, now taking time from WP settings, not server
  • Added option to show long events if showing a calendar on events page.
  • Multiple maps on one page will now show up.
  • Modified styling of map balloons to not use #content (if you modded your theme, look at the CSS to override).
  • Media uploads in GUI now working as expected
  • Orderby ordering in events widget
Download this release

Release Info

Developer netweblogic
Plugin Icon 128x128 Events Manager
Version 3.0.8
Comparing to
See all releases

Code changes from version 3.0.7 to 3.0.8

admin/admin.php CHANGED
@@ -38,16 +38,16 @@ add_action ( 'admin_notices', 'em_admin_warnings' );
38
  * Called by admin_print_scripts-(hook|page) action, created when adding menu items in events-manager.php
39
  */
40
  function em_admin_load_scripts(){
 
 
 
 
41
  //Add maps
42
  if( get_option('dbem_gmap_is_active') ){
43
  wp_enqueue_script('em-google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
44
  }
45
  //Time Entry
46
  wp_enqueue_script('em-timeentry', WP_PLUGIN_URL.'/events-manager/includes/js/timeentry/jquery.timeentry.js', array('jquery'));
47
-
48
- //Load the UI items, currently date picker and autocomplete plus dependencies
49
- //wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/jquery-ui-1.8.5.custom.min.js', array('jquery', 'jquery-ui-core'));
50
- wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/em_ui.js', array('jquery', 'jquery-ui-core'));
51
 
52
  //Date Picker Locale
53
  $locale_code = substr ( get_locale (), 0, 2 );
@@ -72,6 +72,7 @@ function em_admin_load_scripts(){
72
  * Called by admin_print_styles-(hook|page) action, created when adding menu items in events-manager.php
73
  */
74
  function em_admin_load_styles() {
 
75
  wp_enqueue_style('em-ui-css', WP_PLUGIN_URL.'/events-manager/includes/css/jquery-ui-1.7.3.custom.css');
76
  wp_enqueue_style('events-manager-admin', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager_admin.css');
77
  }
38
  * Called by admin_print_scripts-(hook|page) action, created when adding menu items in events-manager.php
39
  */
40
  function em_admin_load_scripts(){
41
+ //Load the UI items, currently date picker and autocomplete plus dependencies
42
+ //wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/jquery-ui-1.8.5.custom.min.js', array('jquery', 'jquery-ui-core'));
43
+ wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/em_ui.js', array('jquery', 'jquery-ui-core'));
44
+
45
  //Add maps
46
  if( get_option('dbem_gmap_is_active') ){
47
  wp_enqueue_script('em-google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
48
  }
49
  //Time Entry
50
  wp_enqueue_script('em-timeentry', WP_PLUGIN_URL.'/events-manager/includes/js/timeentry/jquery.timeentry.js', array('jquery'));
 
 
 
 
51
 
52
  //Date Picker Locale
53
  $locale_code = substr ( get_locale (), 0, 2 );
72
  * Called by admin_print_styles-(hook|page) action, created when adding menu items in events-manager.php
73
  */
74
  function em_admin_load_styles() {
75
+ add_thickbox();
76
  wp_enqueue_style('em-ui-css', WP_PLUGIN_URL.'/events-manager/includes/css/jquery-ui-1.7.3.custom.css');
77
  wp_enqueue_style('events-manager-admin', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager_admin.css');
78
  }
admin/events.php CHANGED
@@ -110,8 +110,9 @@ function dbem_events_subpanel() {
110
  }
111
 
112
  function dbem_events_table($events, $title) {
113
- $offset = ($_GET ['offset'] == '') ? 0 : $_GET ['offset'];
114
- $limit = ($_GET ['limit'] > 0) ? $_GET['limit'] : 20;//Default limit
 
115
  $scope_names = array (
116
  'past' => __ ( 'Past events', 'dbem' ),
117
  'all' => __ ( 'All events', 'dbem' ),
@@ -120,9 +121,6 @@ function dbem_events_table($events, $title) {
120
  $scope = ( array_key_exists( $_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
121
  $events_count = count ( $events );
122
 
123
- if (isset ( $_GET ['offset'] ))
124
- $offset = $_GET ['offset'];
125
-
126
  $use_events_end = get_option ( 'dbem_use_event_end' );
127
  ?>
128
  <div class="wrap">
@@ -163,15 +161,15 @@ function dbem_events_table($events, $title) {
163
  ?>
164
  </select>
165
  <input id="post-query-submit" class="button-secondary" type="submit" value="<?php _e ( 'Filter' )?>" />
166
- <?php
167
- $events_nav = '';
168
- $backward = ($offset - $limit < 0) ? 0 : $offset - $limit;
169
- $forward = $offset + $limit;
170
- if ($offset > 0)
171
- $events_nav .= " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;limit=$limit&amp;scope=$scope&amp;offset=$backward'>&lt;&lt; ".__('Previous Page','dbem')."</a> ";
172
- if ($events_count > $limit+$offset)
173
- $events_nav .= "<a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;limit=$limit&amp;scope=$scope&amp;offset=$forward'>".__('Next Page','dbem')." &gt;&gt;</a>";
174
- echo $events_nav;
175
  ?>
176
  </div>
177
  <div class="clear"></div>
110
  }
111
 
112
  function dbem_events_table($events, $title) {
113
+ $limit = ( !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
114
+ $page = ( !empty($_GET['p']) ) ? $_GET['p']:1;
115
+ $offset = ( $page > 1 ) ? ($page-1)*$limit : 0;
116
  $scope_names = array (
117
  'past' => __ ( 'Past events', 'dbem' ),
118
  'all' => __ ( 'All events', 'dbem' ),
121
  $scope = ( array_key_exists( $_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
122
  $events_count = count ( $events );
123
 
 
 
 
124
  $use_events_end = get_option ( 'dbem_use_event_end' );
125
  ?>
126
  <div class="wrap">
161
  ?>
162
  </select>
163
  <input id="post-query-submit" class="button-secondary" type="submit" value="<?php _e ( 'Filter' )?>" />
164
+ <?php
165
+ //Pagination (if needed/requested)
166
+ if( $events_count >= $limit ){
167
+ //Show the pagination links (unless there's less than 10 events
168
+ $page_link_template = preg_replace('/p=\d+/i','',$_SERVER['REQUEST_URI']);
169
+ $page_link_template = em_add_get_params($page_link_template, array('p'=>'%PAGE%'));
170
+ $events_nav = em_paginate( $page_link_template, $events_count, $limit, $page);
171
+ echo $events_nav;
172
+ }
173
  ?>
174
  </div>
175
  <div class="clear"></div>
admin/locations.php CHANGED
@@ -73,7 +73,7 @@ function dbem_locations_page() {
73
  function dbem_admin_locations($message='', $fill_fields = false) {
74
  global $EM_Location;
75
  $locations = EM_Locations::get();
76
- $new_location = (get_class($EM_Location) == 'EM_Location' && $fill_fields ) ? $EM_Location->to_array() : array(); //let's avoid php warning for empty object
77
  $destination = get_bloginfo('wpurl')."/wp-admin/admin.php";
78
  ?>
79
  <div class='wrap'>
73
  function dbem_admin_locations($message='', $fill_fields = false) {
74
  global $EM_Location;
75
  $locations = EM_Locations::get();
76
+ $new_location = (is_object($EM_Location) && get_class($EM_Location) == 'EM_Location' && $fill_fields ) ? $EM_Location->to_array() : array(); //let's avoid php warning for empty object
77
  $destination = get_bloginfo('wpurl')."/wp-admin/admin.php";
78
  ?>
79
  <div class='wrap'>
admin/options.php CHANGED
@@ -109,7 +109,7 @@ function dbem_options_subpanel() {
109
  $em_disable_filter = false;
110
  //Rest
111
  dbem_options_radio_binary ( __( 'Show events page in lists?', 'dbem' ), 'dbem_list_events_page', __( 'Check this option if you want the events page to appear together with other pages in pages lists.', 'dbem' ) );
112
- dbem_options_radio_binary ( __( 'Display calendar in events page?', 'dbem' ), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','dbem' ) );
113
  dbem_options_radio_binary ( __( 'Disable title rewriting?', 'dbem' ), 'dbem_disable_title_rewrites', __( "Some wordpress themes don't follow best practices when generating navigation menus, and so the automatic title rewriting feature may cause problems, if your menus aren't working correctly on the event pages, try setting this to 'Yes', and provide an appropriate HTML title format below.",'dbem' ) );
114
  dbem_options_input_text ( __( 'Event Manager titles', 'dbem' ), 'dbem_title_html', __( "This only setting only matters if you selected 'Yes' to above. You will notice the events page titles aren't being rewritten, and you have a new title underneath the default page name. This is where you control the HTML of this title. Make sure you keep the #_PAGETITLE placeholder here, as that's what is rewritten by events manager. To control what's rewritten in this title, see settings further down for page titles.", 'dbem' ) );
115
  dbem_options_input_text ( __( 'Event List Limits', 'dbem' ), 'dbem_events_default_limit', __( "This will control how many events are shown on one list by default.", 'dbem' ) );
@@ -136,7 +136,7 @@ function dbem_options_subpanel() {
136
  <?php
137
  $ascending = __('Ascending','dbem');
138
  $descending = __('Descending','dbem');
139
- $order_options = apply_filters('em_settings_events_default_orderby_ddm', array(
140
  'ASC' => __('All Ascending','dbem'),
141
  'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'dbem'),
142
  'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'dbem'),
@@ -191,6 +191,7 @@ function dbem_options_subpanel() {
191
  dbem_options_input_text ( __( 'Small calendar title', 'dbem' ), 'dbem_small_calendar_event_title_format', __( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ) );
192
  dbem_options_input_text ( __( 'Small calendar title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
193
  dbem_options_input_text ( __( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ) );
 
194
  dbem_options_radio_binary ( __( 'Show list on day with single event?', 'dbem' ), 'dbem_display_calendar_day_single', __( "By default, if a calendar day only has one event, it display a single event when clicking on the link of that calendar date. If you select Yes here, you will get always see a list of events.",'dbem' ) );
195
  echo $save_button;
196
  ?>
109
  $em_disable_filter = false;
110
  //Rest
111
  dbem_options_radio_binary ( __( 'Show events page in lists?', 'dbem' ), 'dbem_list_events_page', __( 'Check this option if you want the events page to appear together with other pages in pages lists.', 'dbem' ) );
112
+ dbem_options_radio_binary ( __( 'Display calendar in events page?', 'dbem' ), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','dbem' ).' '.__('If you would like to show events that span over more than one day, see the Calendar section on this page.','dbem') );
113
  dbem_options_radio_binary ( __( 'Disable title rewriting?', 'dbem' ), 'dbem_disable_title_rewrites', __( "Some wordpress themes don't follow best practices when generating navigation menus, and so the automatic title rewriting feature may cause problems, if your menus aren't working correctly on the event pages, try setting this to 'Yes', and provide an appropriate HTML title format below.",'dbem' ) );
114
  dbem_options_input_text ( __( 'Event Manager titles', 'dbem' ), 'dbem_title_html', __( "This only setting only matters if you selected 'Yes' to above. You will notice the events page titles aren't being rewritten, and you have a new title underneath the default page name. This is where you control the HTML of this title. Make sure you keep the #_PAGETITLE placeholder here, as that's what is rewritten by events manager. To control what's rewritten in this title, see settings further down for page titles.", 'dbem' ) );
115
  dbem_options_input_text ( __( 'Event List Limits', 'dbem' ), 'dbem_events_default_limit', __( "This will control how many events are shown on one list by default.", 'dbem' ) );
136
  <?php
137
  $ascending = __('Ascending','dbem');
138
  $descending = __('Descending','dbem');
139
+ $order_options = apply_filters('em_settings_events_default_order_ddm', array(
140
  'ASC' => __('All Ascending','dbem'),
141
  'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'dbem'),
142
  'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'dbem'),
191
  dbem_options_input_text ( __( 'Small calendar title', 'dbem' ), 'dbem_small_calendar_event_title_format', __( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ) );
192
  dbem_options_input_text ( __( 'Small calendar title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
193
  dbem_options_input_text ( __( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ) );
194
+ dbem_options_radio_binary ( __( 'Show long events on calendar pages?', 'dbem' ), 'dbem_full_calendar_long_events', __( "If you are showing a calendar on the events page (see Events format section on this page), you have the option of showing events that span over days on each day it occurs.",'dbem' ) );
195
  dbem_options_radio_binary ( __( 'Show list on day with single event?', 'dbem' ), 'dbem_display_calendar_day_single', __( "By default, if a calendar day only has one event, it display a single event when clicking on the link of that calendar date. If you select Yes here, you will get always see a list of events.",'dbem' ) );
196
  echo $save_button;
197
  ?>
classes/calendar.php CHANGED
@@ -23,7 +23,7 @@ class EM_Calendar extends EM_Object {
23
  $year = date('Y');
24
  }
25
 
26
- $date = mktime(0,0,0,$month, date('d'), $year);
27
  $day = date('d', $date);
28
  // $month = date('m', $date);
29
  // $year = date('Y', $date);
23
  $year = date('Y');
24
  }
25
 
26
+ $date = mktime(0,0,0,$month, date('d', current_time('timestamp')), $year);
27
  $day = date('d', $date);
28
  // $month = date('m', $date);
29
  // $year = date('Y', $date);
classes/events.php CHANGED
@@ -117,6 +117,7 @@ class EM_Events extends EM_Object {
117
 
118
  /**
119
  * Output a set of matched of events
 
120
  * @param array $args
121
  * @return string
122
  */
@@ -127,17 +128,27 @@ class EM_Events extends EM_Object {
127
  if( is_object(current($args)) && get_class((current($args))) == 'EM_Event' ){
128
  $events = $args;
129
  }else{
 
 
 
 
 
130
  $events = self::get( $args );
131
  }
132
  //What format shall we output this to, or use default
133
  $format = ( $args['format'] == '') ? get_option( 'dbem_event_list_item_format' ) : $args['format'] ;
134
 
135
  $output = "";
136
- if ( count($events) > 0 ) {
137
- foreach ( $events as $event ) {
138
- $EM_Event = $event;
139
- /* @var EM_Event $event */
140
- $output .= $event->output($format);
 
 
 
 
 
141
  }
142
  //Add headers and footers to output
143
  if( $format == get_option ( 'dbem_event_list_item_format' ) ){
@@ -147,11 +158,19 @@ class EM_Events extends EM_Object {
147
  $single_event_format_footer = ( $single_event_format_footer != '' ) ? $single_event_format_footer : "</ul>";
148
  $output = $single_event_format_header . $output . $single_event_format_footer;
149
  }
 
 
 
 
 
 
 
 
150
  } else {
151
  $output = get_option ( 'dbem_no_events_message' );
152
  }
153
  //TODO check if reference is ok when restoring object, due to changes in php5 v 4
154
- $EM_Event_old = $EM_Event;
155
  return $output;
156
  }
157
 
@@ -162,8 +181,7 @@ class EM_Events extends EM_Object {
162
  * @uses EM_Object#get_default_search()
163
  */
164
  function get_default_search( $array = array() ){
165
- $defaults = array(
166
- 'limit'=>get_option('dbem_events_default_limit'),
167
  'orderby' => get_option('dbem_events_default_orderby'),
168
  'order' => get_option('dbem_events_default_order')
169
  );
117
 
118
  /**
119
  * Output a set of matched of events
120
+ * Note that you can pass a 'pagination' boolean attribute to enable pagination, default is enabled (true)
121
  * @param array $args
122
  * @return string
123
  */
128
  if( is_object(current($args)) && get_class((current($args))) == 'EM_Event' ){
129
  $events = $args;
130
  }else{
131
+ //Firstly, let's check for a limit/offset here, because if there is we need to remove it and manually do this
132
+ $limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
133
+ $offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:false;
134
+ $args['limit'] = false;
135
+ $args['offset'] = false;
136
  $events = self::get( $args );
137
  }
138
  //What format shall we output this to, or use default
139
  $format = ( $args['format'] == '') ? get_option( 'dbem_event_list_item_format' ) : $args['format'] ;
140
 
141
  $output = "";
142
+ $events_count = count($events);
143
+ if ( $events_count > 0 ) {
144
+ $event_count = 0;
145
+ $events_shown = 0;
146
+ foreach ( $events as $EM_Event ) {
147
+ if( $events_shown < $limit && ($event_count >= $offset || $offset === 0) ){
148
+ $output .= $EM_Event->output($format);
149
+ $events_shown++;
150
+ }
151
+ $event_count++;
152
  }
153
  //Add headers and footers to output
154
  if( $format == get_option ( 'dbem_event_list_item_format' ) ){
158
  $single_event_format_footer = ( $single_event_format_footer != '' ) ? $single_event_format_footer : "</ul>";
159
  $output = $single_event_format_header . $output . $single_event_format_footer;
160
  }
161
+ //Pagination (if needed/requested)
162
+ if( (!empty($args['pagination']) && $args['pagination'] !== false || empty($args['pagination'])) && $events_count >= $limit ){
163
+ //Calculate the page number by offset/limit
164
+ $page = ($offset > 0) ? floor($offset/$limit)+1 : 1;
165
+ //Show the pagination links (unless there's less than 10 events
166
+ $event_page_link = get_permalink(get_option('dbem_events_page'));
167
+ $output .= em_paginate(em_add_get_params($event_page_link, array_merge($_GET, array('page'=>'%PAGE%'))), $events_count, $limit, $page);
168
+ }
169
  } else {
170
  $output = get_option ( 'dbem_no_events_message' );
171
  }
172
  //TODO check if reference is ok when restoring object, due to changes in php5 v 4
173
+ $EM_Event = $EM_Event_old;
174
  return $output;
175
  }
176
 
181
  * @uses EM_Object#get_default_search()
182
  */
183
  function get_default_search( $array = array() ){
184
+ $defaults = array(
 
185
  'orderby' => get_option('dbem_events_default_orderby'),
186
  'order' => get_option('dbem_events_default_order')
187
  );
classes/map.php CHANGED
@@ -15,16 +15,11 @@ class EM_Map extends EM_Object {
15
  ob_start();
16
  $atts['ajax'] = true;
17
  $atts['query'] = 'GlobalMapData';
 
18
  //build js array of arguments to send to event query
19
  ?>
20
- <div id='em-locations-map' style='width:<?php echo $atts['width']; ?>px; height:<?php echo $atts['height']; ?>px'><em><?php _e('Loading Map....', 'dbem'); ?></em></div>
21
- <script src='<?php echo bloginfo('wpurl') ?>/wp-content/plugins/events-manager/includes/js/em_maps.js' type='text/javascript'></script>
22
- <script type='text/javascript'>
23
- <!--//
24
- var em_query = <?php echo EM_Object::json_encode($atts); ?>;
25
- em_load_map('em_map_global');
26
- //-->
27
- </script>
28
  <?php
29
  return ob_get_clean();
30
  }
@@ -45,17 +40,14 @@ class EM_Map extends EM_Object {
45
  $width = (isset($args['width'])) ? $args['width']:'400';
46
  $height = (isset($args['height'])) ? $args['height']:'300';
47
  ob_start();
 
48
  ?>
49
- <div id='em-location-map' style='background: #CDCDCD; width: <?php echo $width ?>px; height: <?php echo $height ?>px'><?php _e('Loading Map....', 'dbem'); ?></div>
50
- <div id='em-location-map-info' style="display:none; visibility:hidden;"><div class="em-map-balloon" style="font-size:12px;"><div id="content"><?php echo $location->output(get_option('dbem_location_baloon_format')); ?></div></div></div>
51
- <script src='<?php bloginfo('wpurl'); ?>/wp-content/plugins/events-manager/includes/js/em_maps.js' type='text/javascript'></script>
52
- <script type='text/javascript'>
53
- <!--//
54
- var em_latitude = parseFloat('<?php echo $location->latitude; ?>');
55
- var em_longitude = parseFloat('<?php echo $location->longitude; ?>');
56
- em_load_map('em_map_single');
57
- //-->
58
- </script>
59
  <?php
60
  return ob_get_clean();
61
  }
15
  ob_start();
16
  $atts['ajax'] = true;
17
  $atts['query'] = 'GlobalMapData';
18
+ $rand = substr(md5(rand().rand()),0,5);
19
  //build js array of arguments to send to event query
20
  ?>
21
+ <div class='em-locations-map' id='em-locations-map-<?php echo $rand; ?>' style='width:<?php echo $atts['width']; ?>px; height:<?php echo $atts['height']; ?>px'><em><?php _e('Loading Map....', 'dbem'); ?></em></div>
22
+ <div class='em-locations-map-coords' id='em-locations-map-coords-<?php echo $rand; ?>' style="display:none; visibility:hidden;"><?php echo EM_Object::json_encode($atts); ?></div>
 
 
 
 
 
 
23
  <?php
24
  return ob_get_clean();
25
  }
40
  $width = (isset($args['width'])) ? $args['width']:'400';
41
  $height = (isset($args['height'])) ? $args['height']:'300';
42
  ob_start();
43
+ $rand = substr(md5(rand().rand()),0,5);
44
  ?>
45
+ <div class='em-location-map' id='em-location-map-<?php echo $rand ?>' style='background: #CDCDCD; width: <?php echo $width ?>px; height: <?php echo $height ?>px'><?php _e('Loading Map....', 'dbem'); ?></div>
46
+ <div class='em-location-map-info' id='em-location-map-info-<?php echo $rand ?>' style="display:none; visibility:hidden;"><div class="em-map-balloon" style="font-size:12px;"><div class="em-map-balloon-content" ><?php echo $location->output(get_option('dbem_location_baloon_format')); ?></div></div></div>
47
+ <div class='em-location-map-coords' id='em-location-map-coords-<?php echo $rand ?>' style="display:none; visibility:hidden;">
48
+ <span class="lat"><?php echo $location->latitude; ?></span>
49
+ <span class="lng"><?php echo $location->longitude; ?></span>
50
+ </div>
 
 
 
 
51
  <?php
52
  return ob_get_clean();
53
  }
events-manager.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Events Manager
4
- Version: 3.0.7
5
  Plugin URI: http://wp-events-plugin.com
6
  Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
7
  Author: Davide Benini, Marcus Sykes
@@ -86,7 +86,7 @@ if( is_admin() ){
86
 
87
 
88
  // Setting constants
89
- define('EM_VERSION', 3.05); //self expanatory
90
  define('EM_CATEGORIES_TABLE', 'em_categories'); //TABLE NAME
91
  define('EM_EVENTS_TABLE','em_events'); //TABLE NAME
92
  define('EM_RECURRENCE_TABLE','dbem_recurrence'); //TABLE NAME
@@ -201,6 +201,7 @@ add_action('admin_menu','em_create_events_submenu');
201
  */
202
  function em_enqueue_public() {
203
  wp_enqueue_script ( 'jquery' ); //make sure we have jquery loaded
 
204
  wp_enqueue_style('events-manager', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager.css'); //main css
205
  }
206
  add_action ( 'template_redirect', 'em_enqueue_public' );
1
  <?php
2
  /*
3
  Plugin Name: Events Manager
4
+ Version: 3.0.8
5
  Plugin URI: http://wp-events-plugin.com
6
  Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
7
  Author: Davide Benini, Marcus Sykes
86
 
87
 
88
  // Setting constants
89
+ define('EM_VERSION', 3.06); //self expanatory
90
  define('EM_CATEGORIES_TABLE', 'em_categories'); //TABLE NAME
91
  define('EM_EVENTS_TABLE','em_events'); //TABLE NAME
92
  define('EM_RECURRENCE_TABLE','dbem_recurrence'); //TABLE NAME
201
  */
202
  function em_enqueue_public() {
203
  wp_enqueue_script ( 'jquery' ); //make sure we have jquery loaded
204
+ wp_enqueue_script('events-manager', WP_PLUGIN_URL.'/events-manager/includes/js/em_maps.js', array('jquery'));
205
  wp_enqueue_style('events-manager', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager.css'); //main css
206
  }
207
  add_action ( 'template_redirect', 'em_enqueue_public' );
events.php CHANGED
@@ -35,9 +35,18 @@ function em_content($content) {
35
  // Multiple events page
36
  $scope = ($_REQUEST['scope']) ? EM_Object::sanitize($_REQUEST['scope']) : "future";
37
  if (get_option ( 'dbem_display_calendar_in_events_page' )){
38
- $content = EM_Calendar::output( array('full'=>1) );
39
  }else{
40
- $content = EM_Events::output( array( 'scope' => $scope ) );
 
 
 
 
 
 
 
 
 
41
  }
42
  }
43
  //If disable rewrite flag is on, then we need to add a placeholder here
@@ -46,7 +55,7 @@ function em_content($content) {
46
  }
47
  //TODO FILTER - filter em page content before display
48
  }
49
- return $content;
50
  }
51
  add_filter ( 'the_content', 'em_content' );
52
 
35
  // Multiple events page
36
  $scope = ($_REQUEST['scope']) ? EM_Object::sanitize($_REQUEST['scope']) : "future";
37
  if (get_option ( 'dbem_display_calendar_in_events_page' )){
38
+ $content = EM_Calendar::output( array('full'=>1,'long_events'=>get_option('dbem_full_calendar_long_events')) );
39
  }else{
40
+ //If we have a $_GET['page'] var, use it to calculate the offset/limit ratios (safer than offset/limit get vars)
41
+ $page = ( !empty($_GET['page']) && is_numeric($_GET['page']) )? $_GET['page'] : 1;
42
+ $args = array(
43
+ 'limit'=> get_option('dbem_events_default_limit'),
44
+ 'orderby' => get_option('dbem_events_default_orderby'),
45
+ 'order' => get_option('dbem_events_default_order'),
46
+ 'scope' => $scope
47
+ );
48
+ $args['offset'] = $args['limit'] * ($page-1);
49
+ $content = EM_Events::output( $args );
50
  }
51
  }
52
  //If disable rewrite flag is on, then we need to add a placeholder here
55
  }
56
  //TODO FILTER - filter em page content before display
57
  }
58
+ return '<div id="em-wrapper">'.$content.'</div>';
59
  }
60
  add_filter ( 'the_content', 'em_content' );
61
 
functions.php CHANGED
@@ -14,9 +14,58 @@ function em_hello_to_new_user() {
14
  }
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
- function url_exists($url) {
19
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  if ((strpos ( $url, "http" )) === false)
21
  $url = "http://" . $url;
22
  // FIXME ripristina la linea seguente e VEDI DI SISTEMARE!!!!
14
  }
15
  }
16
 
17
+ /**
18
+ * Takes a few params and determins a pagination link structure
19
+ * @param string $link
20
+ * @param int $total
21
+ * @param int $limit
22
+ * @param int $page
23
+ * @param int $pagesToShow
24
+ * @return string
25
+ */
26
+ function em_paginate($link, $total, $limit, $page=1, $pagesToShow=10){
27
+ $maxPages = ceil($total/$limit); //Total number of pages
28
+ $startPage = ($page <= $pagesToShow) ? 1 : $pagesToShow * (floor($page/$pagesToShow)) ; //Which page to start the pagination links from (in case we're on say page 12 and $pagesToShow is 10 pages)
29
+ $placeholder = urlencode('%PAGE%');
30
+ $link = str_replace('%PAGE%', urlencode('%PAGE%'), $link); //To avoid url encoded/non encoded placeholders
31
+ //Add the back and first buttons
32
+ $string = ($page>1) ? '<a href="'.str_replace($placeholder,1,$link).'">&lt;&lt;</a> ' : '&lt;&lt; ';
33
+ $string .= ($page>1) ? ' <a href="'.str_replace($placeholder,$page-1,$link).'">&lt;</a> ' : '&lt; ';
34
+ //Loop each page and create a link or just a bold number if its the current page
35
+ for ($i = $startPage ; $i < $startPage+$pagesToShow && $i <= $maxPages ; $i++){
36
+ if($i == $page){
37
+ $string .= " <strong>$i</strong>";
38
+ }else{
39
+ $string .= ' <a href="'.str_replace($placeholder,$i,$link).'">'.$i.'</a> ';
40
+ }
41
+ }
42
+ //Add the forward and last buttons
43
+ $string .= ($page<$total) ? ' <a href="'.str_replace($placeholder,$page+1,$link).'">&gt;</a> ' :' &gt; ' ;
44
+ $string .= ($page<$total) ? ' <a href="'.str_replace($placeholder,$maxPages,$link).'">&gt;&gt;</a> ' : '&gt;&gt; ';
45
+ //Return the string
46
+ return $string;
47
+ }
48
 
49
+ /**
50
+ * Takes a url and appends GET params (supplied as an assoc array), it automatically detects if you already have a querystring there
51
+ * @param string $url
52
+ * @param array $params
53
+ */
54
+ function em_add_get_params($url, $params=array()){
55
+ $has_querystring = (stristr($url, "?"));
56
+ $count = 0;
57
+ foreach($params as $key=>$value){
58
+ if( $count == 0 && !$has_querystring ){
59
+ $url .= "?{$key}=".urlencode($value);
60
+ }else{
61
+ $url .= "&amp;{$key}=".urlencode($value);
62
+ }
63
+ $count++;
64
+ }
65
+ return $url;
66
+ }
67
+
68
+ function url_exists($url) {
69
  if ((strpos ( $url, "http" )) === false)
70
  $url = "http://" . $url;
71
  // FIXME ripristina la linea seguente e VEDI DI SISTEMARE!!!!
includes/css/events_manager.css CHANGED
@@ -7,7 +7,6 @@ table#dbem-bookings-table tfoot td.booking-result {
7
  table#dbem-bookings-table tfoot th {
8
  text-align: right;
9
  padding-right: 1em;
10
-
11
  }
12
 
13
  table.dbem-rsvp-form {
@@ -100,12 +99,7 @@ div#icon-events{
100
  table#dbem-location-data th {
101
  text-align: right;
102
  width: 50px;
103
- }
104
- #dbem-location-map img {
105
- max-width: none;
106
- }
107
- #em-map-balloon #content { width:auto }
108
-
109
 
110
  table.dbem-calendar-table td {
111
  padding: 2px 4px;
@@ -146,5 +140,18 @@ table.fullcalendar td {
146
  list-style: none;
147
  }
148
 
149
- /*Maps*/
150
- .em-map-balloon #content { margin:0px !important; padding:0px !important; font-size:12px !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  table#dbem-bookings-table tfoot th {
8
  text-align: right;
9
  padding-right: 1em;
 
10
  }
11
 
12
  table.dbem-rsvp-form {
99
  table#dbem-location-data th {
100
  text-align: right;
101
  width: 50px;
102
+ }
 
 
 
 
 
103
 
104
  table.dbem-calendar-table td {
105
  padding: 2px 4px;
140
  list-style: none;
141
  }
142
 
143
+ /*
144
+ Maps - if the info balloons don't look right on your site, chances are it's a CSS issue.
145
+ Google is VERY sensitive to CSS rules for the infowindows, making it hard to accommodate every theme in WP.
146
+ Please edit your theme's CSS to override this
147
+ */
148
+ .em-map-balloon .em-map-balloon-content {
149
+ margin:0px 0px 0px 0px !important;
150
+ padding:0px 0px 20px 0px !important;
151
+ font-size:12px !important;
152
+ width:auto !important;
153
+ max-width:none !important;
154
+ height:auto !important;
155
+ max-height:none !important;
156
+ }
157
+ .em-location-map img, .em-locations-map img { max-width:none !important; }
includes/js/em_maps.js CHANGED
@@ -1,74 +1,83 @@
1
- var map;
2
 
3
- function em_load_map( callback ) {
4
- var script = document.createElement("script");
5
- script.setAttribute("src", "http://maps.google.com/maps/api/js?sensor=false&callback="+callback);
6
- script.setAttribute("type", "text/javascript");
7
- document.documentElement.firstChild.appendChild(script);
8
- }
 
 
9
 
10
- //Load a map on a single page
11
- function em_map_single() {
12
- em_LatLng = new google.maps.LatLng(em_latitude, em_longitude);
13
- var map = new google.maps.Map( document.getElementById('em-location-map'), {
14
- zoom: 14,
15
- center: em_LatLng,
16
- mapTypeId: google.maps.MapTypeId.ROADMAP,
17
- mapTypeControl: false
18
- });
19
- var infowindow = new google.maps.InfoWindow({ content: document.getElementById('em-location-map-info').firstChild });
20
- var marker = new google.maps.Marker({
21
- position: em_LatLng,
22
- map: map
 
 
 
 
 
 
23
  });
24
- infowindow.open(map,marker);
25
- }
26
-
27
- function em_map_global() {
28
- jQuery.getJSON(document.URL, em_query, function(data){
29
- if(data.length > 0){
30
- var myLatlng = new google.maps.LatLng(data[0].location_latitude,data[0].location_longitude);
31
- var myOptions = {
32
- mapTypeId: google.maps.MapTypeId.ROADMAP
33
- };
34
- map = new google.maps.Map(document.getElementById("em-locations-map"), myOptions);
35
-
36
- var minLatLngArr = [0,0];
37
- var maxLatLngArr = [0,0];
38
-
39
- for (var i = 0; i < data.length; i++) {
40
- var latitude = parseFloat( data[i].location_latitude );
41
- var longitude = parseFloat( data[i].location_longitude );
42
- var location = new google.maps.LatLng( latitude, longitude );
43
- var marker = new google.maps.Marker({
44
- position: location,
45
- map: map
46
- });
47
- marker.setTitle(data[i].location_name);
48
- var myContent = '<div class="em-map-balloon"><div id="content">'+ data[i].location_balloon +'</div></div>';
49
- em_map_infobox(marker, myContent);
50
-
51
- //Get min and max long/lats
52
- minLatLngArr[0] = (latitude < minLatLngArr[0] || i == 0) ? latitude : minLatLngArr[0];
53
- minLatLngArr[1] = (longitude < minLatLngArr[1] || i == 0) ? longitude : minLatLngArr[1];
54
- maxLatLngArr[0] = (latitude > maxLatLngArr[0] || i == 0) ? latitude : maxLatLngArr[0];
55
- maxLatLngArr[1] = (longitude > maxLatLngArr[1] || i == 0) ? longitude : maxLatLngArr[1];
56
- }
57
- // Zoom in to the bounds
58
- var minLatLng = new google.maps.LatLng(minLatLngArr[0],minLatLngArr[1]);
59
- var maxLatLng = new google.maps.LatLng(maxLatLngArr[0],maxLatLngArr[1]);
60
- var bounds = new google.maps.LatLngBounds(minLatLng,maxLatLng);
61
- map.fitBounds(bounds);
62
- }else{
63
- jQuery('#em-locations-map').children().first().html('No locations found');
64
- }
 
65
  });
66
  }
67
 
68
  // The five markers show a secret message when clicked
69
  // but that message is not within the marker's instance data
70
 
71
- function em_map_infobox(marker, message) {
72
  var infowindow = new google.maps.InfoWindow({ content: message });
73
  google.maps.event.addListener(marker, 'click', function() {
74
  infowindow.open(map,marker);
1
+ var maps = {};
2
 
3
+ jQuery(document).ready( function($){
4
+ if( $('.em-location-map').length > 0 || $('.em-locations-map').length > 0 ){
5
+ var script = document.createElement("script");
6
+ script.setAttribute("src", "http://maps.google.com/maps/api/js?sensor=false&callback=em_maps");
7
+ script.setAttribute("type", "text/javascript");
8
+ document.documentElement.firstChild.appendChild(script);
9
+ }
10
+ });
11
 
12
+ //Load single maps (each map is treated as a seperate map.
13
+ function em_maps() {
14
+ //Find all the maps on this page
15
+ jQuery('.em-location-map').each( function(index){
16
+ el = jQuery(this);
17
+ var map_id = el.attr('id').replace('em-location-map-','');
18
+ em_LatLng = new google.maps.LatLng( jQuery('#em-location-map-coords-'+map_id+' .lat').text(), jQuery('#em-location-map-coords-'+map_id+' .lng').text());
19
+ maps[map_id] = new google.maps.Map( document.getElementById('em-location-map-'+map_id), {
20
+ zoom: 14,
21
+ center: em_LatLng,
22
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
23
+ mapTypeControl: false
24
+ });
25
+ var marker = new google.maps.Marker({
26
+ position: em_LatLng,
27
+ map: maps[map_id]
28
+ });
29
+ var infowindow = new google.maps.InfoWindow({ content: document.getElementById('em-location-map-info-'+map_id).firstChild });
30
+ infowindow.open(maps[map_id],marker);
31
  });
32
+ jQuery('.em-locations-map').each( function(index){
33
+ var el = jQuery(this);
34
+ var map_id = el.attr('id').replace('em-locations-map-','');
35
+ var em_data = jQuery.parseJSON( jQuery('#em-locations-map-coords-'+map_id).text() );
36
+ jQuery.getJSON(document.URL, em_data , function(data){
37
+ if(data.length > 0){
38
+ var myLatlng = new google.maps.LatLng(data[0].location_latitude,data[0].location_longitude);
39
+ var myOptions = {
40
+ mapTypeId: google.maps.MapTypeId.ROADMAP
41
+ };
42
+ maps[map_id] = new google.maps.Map(document.getElementById("em-locations-map-"+map_id), myOptions);
43
+
44
+ var minLatLngArr = [0,0];
45
+ var maxLatLngArr = [0,0];
46
+
47
+ for (var i = 0; i < data.length; i++) {
48
+ var latitude = parseFloat( data[i].location_latitude );
49
+ var longitude = parseFloat( data[i].location_longitude );
50
+ var location = new google.maps.LatLng( latitude, longitude );
51
+ var marker = new google.maps.Marker({
52
+ position: location,
53
+ map: maps[map_id]
54
+ });
55
+ marker.setTitle(data[i].location_name);
56
+ var myContent = '<div class="em-map-balloon"><div id="em-map-balloon-'+map_id+'" class="em-map-balloon-content">'+ data[i].location_balloon +'</div></div>';
57
+ em_map_infobox(marker, myContent, maps[map_id]);
58
+
59
+ //Get min and max long/lats
60
+ minLatLngArr[0] = (latitude < minLatLngArr[0] || i == 0) ? latitude : minLatLngArr[0];
61
+ minLatLngArr[1] = (longitude < minLatLngArr[1] || i == 0) ? longitude : minLatLngArr[1];
62
+ maxLatLngArr[0] = (latitude > maxLatLngArr[0] || i == 0) ? latitude : maxLatLngArr[0];
63
+ maxLatLngArr[1] = (longitude > maxLatLngArr[1] || i == 0) ? longitude : maxLatLngArr[1];
64
+ }
65
+ // Zoom in to the bounds
66
+ var minLatLng = new google.maps.LatLng(minLatLngArr[0],minLatLngArr[1]);
67
+ var maxLatLng = new google.maps.LatLng(maxLatLngArr[0],maxLatLngArr[1]);
68
+ var bounds = new google.maps.LatLngBounds(minLatLng,maxLatLng);
69
+ maps[map_id].fitBounds(bounds);
70
+ }else{
71
+ el.children().first().html('No locations found');
72
+ }
73
+ });
74
  });
75
  }
76
 
77
  // The five markers show a secret message when clicked
78
  // but that message is not within the marker's instance data
79
 
80
+ function em_map_infobox(marker, message, map) {
81
  var infowindow = new google.maps.InfoWindow({ content: message });
82
  google.maps.event.addListener(marker, 'click', function() {
83
  infowindow.open(map,marker);
install.php CHANGED
@@ -212,6 +212,7 @@ function em_add_options() {
212
  'dbem_image_max_size' => 204800,
213
  'dbem_list_date_title' => __('Events', 'dbem').' - #j #M #y',
214
  'dbem_full_calendar_event_format' => '<li>#_LINKEDNAME</li>',
 
215
  'dbem_small_calendar_event_title_format' => "#_NAME",
216
  'dbem_small_calendar_event_title_separator' => ", ",
217
  'dbem_hello_to_user' => 1,
212
  'dbem_image_max_size' => 204800,
213
  'dbem_list_date_title' => __('Events', 'dbem').' - #j #M #y',
214
  'dbem_full_calendar_event_format' => '<li>#_LINKEDNAME</li>',
215
+ 'dbem_full_calendar_long_events' => '0',
216
  'dbem_small_calendar_event_title_format' => "#_NAME",
217
  'dbem_small_calendar_event_title_separator' => ", ",
218
  'dbem_hello_to_user' => 1,
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nutsmuggler, netweblogic
3
  Donate link: http://wp-events-plugin.com
4
  Tags: events, manager, calendar, gigs, concert, maps, geotagging, rsvp
5
  Requires at least: 2.9
6
- Tested up to: 3.0.1
7
- Stable tag: 3.0.7
8
 
9
  Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
10
 
@@ -109,6 +109,15 @@ At this stage, Events Manager is only available in English and Italian. Yet, the
109
  3. The Events Manager Options page.
110
 
111
  == Change Log ==
 
 
 
 
 
 
 
 
 
112
  = 3.0.7 =
113
  * Renaming a few functions/shortcodes for consistency
114
  * Fixing #_LOCATIONPAGEURL issue
3
  Donate link: http://wp-events-plugin.com
4
  Tags: events, manager, calendar, gigs, concert, maps, geotagging, rsvp
5
  Requires at least: 2.9
6
+ Tested up to: 3.0.1
7
+ Stable tag: 3.0.8
8
 
9
  Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
10
 
109
  3. The Events Manager Options page.
110
 
111
  == Change Log ==
112
+ = 3.0.8 =
113
+ * Event lists now have pagination links for both admin and public areas!
114
+ * Fixed timezone issue with calendars, now taking time from WP settings, not server
115
+ * Added option to show long events if showing a calendar on events page.
116
+ * Multiple maps on one page will now show up.
117
+ * Modified styling of map balloons to not use #content (if you modded your theme, look at the CSS to override).
118
+ * Media uploads in GUI now working as expected
119
+ * Orderby ordering in events widget
120
+
121
  = 3.0.7 =
122
  * Renaming a few functions/shortcodes for consistency
123
  * Fixing #_LOCATIONPAGEURL issue
widgets/events.php CHANGED
@@ -45,7 +45,8 @@ class EM_Widget extends WP_Widget {
45
  'order' => 'ASC',
46
  'limit' => 5,
47
  'format' => '#_LINKEDNAME<ul><li>#j #M #y</li><li>#_TOWN</li></ul>',
48
- 'nolistwrap' => false
 
49
  );
50
  foreach($defaults as $key => $value){
51
  if($new_instance[$key] == ''){
@@ -75,10 +76,37 @@ class EM_Widget extends WP_Widget {
75
  </select>
76
  </p>
77
  <p>
78
- <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order of the events','dbem'); ?>:</label><br/>
79
- <select id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>" >
80
- <option value="ASC" <?php echo ($instance['order'] == 'ASC') ? 'selected="selected"':''; ?>><?php _e('Ascendant','dbem'); ?></option>
81
- <option value="DESC" <?php echo ($instance['order'] == 'DESC') ? 'selected="selected"':''; ?>><?php _e('Descendant','dbem'); ?></option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  </select>
83
  </p>
84
  <p>
45
  'order' => 'ASC',
46
  'limit' => 5,
47
  'format' => '#_LINKEDNAME<ul><li>#j #M #y</li><li>#_TOWN</li></ul>',
48
+ 'nolistwrap' => false,
49
+ 'orderby' => 'start_date,start_time,name'
50
  );
51
  foreach($defaults as $key => $value){
52
  if($new_instance[$key] == ''){
76
  </select>
77
  </p>
78
  <p>
79
+ <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order By','dbem'); ?>: </label>
80
+ <select id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>">
81
+ <?php
82
+ $orderby_options = apply_filters('em_widget_orderby_ddm', array(
83
+ 'start_date,start_time,name' => __('start date, start time, event name','dbem'),
84
+ 'name,start_date,start_time' => __('name, start date, start time','dbem'),
85
+ 'name,end_date,end_time' => __('name, end date, end time','dbem'),
86
+ 'end_date,end_time,name' => __('end date, end time, event name','dbem'),
87
+ ));
88
+ ?>
89
+ <?php foreach($orderby_options as $key => $value) : ?>
90
+ <option value='<?php echo $key ?>' <?php echo ($key == $instance['orderby']) ? "selected='selected'" : ''; ?>>
91
+ <?php echo $value; ?>
92
+ </option>
93
+ <?php endforeach; ?>
94
+ </select>
95
+ </p>
96
+ <p>
97
+ <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order','dbem'); ?>: </label>
98
+ <select id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>">
99
+ <?php
100
+ $order_options = apply_filters('em_widget_order_ddm', array(
101
+ 'ASC' => __('Ascending','dbem'),
102
+ 'DESC' => __('Descending','dbem')
103
+ ));
104
+ ?>
105
+ <?php foreach( $order_options as $key => $value) : ?>
106
+ <option value='<?php echo $key ?>' <?php echo ($key == $instance['order']) ? "selected='selected'" : ''; ?>>
107
+ <?php echo $value; ?>
108
+ </option>
109
+ <?php endforeach; ?>
110
  </select>
111
  </p>
112
  <p>