Events Manager - Version 5.8.0.1

Version Description

  • fixed category color picker and image uploader problems
  • created base classes for EM taxonomies to make adding custom EM taxonomies even easier in the future,
  • added tag image and color settings/data
  • added sortable option for date columns of events and recurring events in the admin area
  • fixed saving an event recreating ticket_meta and wiping out ML settings
  • fixed multilingual translations of event in WPML not hiding/showing right meta boxes
  • fixed saving multilingual translation of event overwriting original language ticket names
  • changed admin headers to use new and accessible WP inline HTML structure
  • fixed serialization problems for deprecated event/location attributes and attributes with multiple post meta entries for one post
  • removed deprecated attributes editor from admin area as this is confusing and error prone when combined with other plugins manipulating custom fields
  • fixed #_EVENTEXCERPT without arguments stripping HTML since 5.7
  • added ability to list multiple categories/tags in conditional placeholders e.g. {has_tag_123,1234,tagname}...
  • added #_EVENTPRICEMINALL and #_EVENTPRICEMAXALL to show prices of unavailable tickets as well
  • fixed JS issues with MS Global mode and JS file limiting when displaying subsite single event pages on main blog
  • fixed single initial abbreviation issues in Chinese calendars
  • fixed duplicate events not being published to social networks via jetpack publicize (kudos @gnaag)
  • fixed potential incompatibilities with other plugins using wp_query_reset() on category pages, preventing our page formats from showing
  • fixed taxonomy archive pages returning zero results if taxonomy formatting is disabled and events are excluded from searches (WP Bug workaround)
  • fixed inconsistent line ending causing warnings with PHP compatibility checker
  • unified Tag and Category class functions into sets of parent class functionn
  • fixed PHP fatal error with BP when disabling notifications
  • fixed calendar day links being incorrect if another plugin adds querystring params to permalinks
  • added groupby, groupby_orderby and groupby_order arguments allowing grouping in search results for events and locations
  • improved validation and sanitization of orderby arguments to avoid ambiguous field SQL errors
  • added optimization to optionally join event/location tables when needed for grouped searches or if EM_DISABLE_OPTIONAL_JOINS is defined and set to true
  • moved condition of when argument 'bookings'
Download this release

Release Info

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

Code changes from version 5.7.3 to 5.8.0.1

Files changed (67) hide show
  1. admin/bookings/em-events.php +2 -2
  2. admin/em-admin.php +3 -3
  3. admin/em-bookings.php +9 -6
  4. admin/em-docs.php +35 -10
  5. admin/em-ms-options.php +1 -1
  6. admin/em-options.php +19 -14
  7. admin/settings/tabs/emails.php +8 -8
  8. admin/settings/tabs/formats.php +11 -8
  9. admin/settings/tabs/general.php +1 -1
  10. admin/settings/tabs/pages.php +119 -29
  11. buddypress/bp-em-notifications.php +1 -3
  12. classes/em-booking.php +21 -17
  13. classes/em-bookings-table.php +2 -2
  14. classes/em-bookings.php +144 -60
  15. classes/em-calendar.php +27 -18
  16. classes/em-categories-admin.php +61 -0
  17. classes/em-categories-frontend.php +125 -0
  18. classes/em-categories-taxonomy.php +0 -126
  19. classes/em-categories.php +41 -277
  20. classes/em-category-taxonomy.php +0 -170
  21. classes/em-category.php +24 -291
  22. classes/em-event-post-admin.php +6 -1
  23. classes/em-event-post.php +18 -4
  24. classes/em-event-posts-admin.php +18 -7
  25. classes/em-event.php +179 -92
  26. classes/em-events.php +280 -103
  27. classes/em-location-post-admin.php +1 -1
  28. classes/em-location-post.php +15 -2
  29. classes/em-location.php +96 -49
  30. classes/em-locations.php +199 -65
  31. classes/em-object.php +208 -55
  32. classes/em-permalinks.php +1 -1
  33. classes/em-tag-taxonomy.php +0 -103
  34. classes/em-tag.php +24 -185
  35. classes/em-tags-admin.php +61 -0
  36. classes/em-tags-frontend.php +56 -0
  37. classes/em-tags.php +45 -268
  38. classes/em-taxonomy-admin.php +177 -0
  39. classes/em-taxonomy-frontend.php +170 -0
  40. classes/em-taxonomy-term.php +352 -0
  41. classes/em-taxonomy-terms.php +323 -0
  42. classes/em-ticket.php +55 -24
  43. classes/em-tickets.php +27 -9
  44. em-actions.php +8 -10
  45. em-events.php +1 -1
  46. em-functions.php +27 -5
  47. em-install.php +15 -8
  48. em-posts.php +21 -5
  49. em-pro-compatibility.php +1 -1
  50. em-shortcode.php +3 -1
  51. events-manager.php +27 -20
  52. includes/css/events_manager_admin.css +1 -0
  53. includes/js/admin-settings.js +16 -7
  54. includes/js/categories-admin.js +0 -69
  55. includes/js/taxonomies-admin.js +50 -0
  56. multilingual/em-ml-admin.php +3 -1
  57. multilingual/em-ml-bookings.php +12 -9
  58. readme.txt +74 -2
  59. templates/buddypress/profile.php +4 -3
  60. templates/forms/event/attributes.php +0 -32
  61. templates/forms/event/bookings.php +1 -1
  62. templates/forms/event/group.php +2 -2
  63. templates/forms/event/when-with-recurring.php +1 -1
  64. templates/forms/location/attributes.php +0 -32
  65. templates/templates/search/search.php +1 -1
  66. widgets/em-events.php +1 -1
  67. widgets/em-locations.php +1 -1
admin/bookings/em-events.php CHANGED
@@ -36,8 +36,8 @@ function em_bookings_events_table() {
36
$scope = "future";
37
}
38
$owner = !current_user_can('manage_others_bookings') ? get_current_user_id() : false;
39
- $events = EM_Events::get( array('scope'=>$scope, 'limit'=>$limit, 'offset' => $offset, 'order'=>$order, 'bookings'=>true, 'owner' => $owner ) );
40
- $events_count = EM_Events::count( array('scope'=>$scope, 'limit'=>0, 'order'=>$order, 'bookings'=>true, 'owner' => $owner ) );
41
42
$use_events_end = get_option ( 'dbem_use_event_end' );
43
?>
36
$scope = "future";
37
}
38
$owner = !current_user_can('manage_others_bookings') ? get_current_user_id() : false;
39
+ $events = EM_Events::get( array('scope'=>$scope, 'limit'=>$limit, 'offset' => $offset, 'order'=>$order, 'bookings'=>true, 'owner' => $owner, 'pagination' => 1 ) );
40
+ $events_count = EM_Events::$num_rows_found;
41
42
$use_events_end = get_option ( 'dbem_use_event_end' );
43
?>
admin/em-admin.php CHANGED
@@ -7,7 +7,7 @@ function em_admin_menu(){
7
$bookings_num = '';
8
$bookings_pending_count = apply_filters('em_bookings_pending_count',0);
9
if( get_option('dbem_bookings_approval') == 1){
10
- $bookings_pending_count += count(EM_Bookings::get(array('status'=>'0', 'blog'=>get_current_blog_id()))->bookings);
11
}
12
if($bookings_pending_count > 0){
13
$bookings_num = '<span class="update-plugins count-'.$bookings_pending_count.'"><span class="plugin-count">'.$bookings_pending_count.'</span></span>';
@@ -173,7 +173,7 @@ function em_admin_warnings() {
173
<?php
174
}
175
176
- if( is_multisite() && !empty($_REQUEST['page']) && $_REQUEST['page']=='events-manager-options' && is_super_admin() && get_option('dbem_ms_update_nag') ){
177
if( !empty($_GET['disable_dbem_ms_update_nag']) ){
178
delete_site_option('dbem_ms_update_nag');
179
}else{
@@ -185,7 +185,7 @@ function em_admin_warnings() {
185
}
186
}
187
188
- if( is_super_admin() && get_option('dbem_migrate_images_nag') ){
189
if( !empty($_GET['disable_dbem_migrate_images_nag']) ){
190
delete_site_option('dbem_migrate_images_nag');
191
}else{
7
$bookings_num = '';
8
$bookings_pending_count = apply_filters('em_bookings_pending_count',0);
9
if( get_option('dbem_bookings_approval') == 1){
10
+ $bookings_pending_count += EM_Bookings::count(array('status'=>'0', 'blog'=>get_current_blog_id()));
11
}
12
if($bookings_pending_count > 0){
13
$bookings_num = '<span class="update-plugins count-'.$bookings_pending_count.'"><span class="plugin-count">'.$bookings_pending_count.'</span></span>';
173
<?php
174
}
175
176
+ if( is_multisite() && !empty($_REQUEST['page']) && $_REQUEST['page']=='events-manager-options' && em_wp_is_super_admin() && get_option('dbem_ms_update_nag') ){
177
if( !empty($_GET['disable_dbem_ms_update_nag']) ){
178
delete_site_option('dbem_ms_update_nag');
179
}else{
185
}
186
}
187
188
+ if( em_wp_is_super_admin() && get_option('dbem_migrate_images_nag') ){
189
if( !empty($_GET['disable_dbem_migrate_images_nag']) ){
190
delete_site_option('dbem_migrate_images_nag');
191
}else{
admin/em-bookings.php CHANGED
@@ -84,15 +84,16 @@ function em_bookings_event(){
84
$header_button_classes = is_admin() ? 'page-title-action':'button add-new-h2';
85
?>
86
<div class='wrap'>
87
- <?php if( is_admin() ): ?><h1><?php else: ?><h2><?php endif; ?>
88
<?php echo sprintf(__('Manage %s Bookings', 'events-manager'), "'{$EM_Event->event_name}'"); ?>
89
<a href="<?php echo $EM_Event->get_permalink(); ?>" class="<?php echo $header_button_classes; ?>"><?php echo sprintf(__('View %s','events-manager'), __('Event', 'events-manager')) ?></a>
90
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="<?php echo $header_button_classes; ?>"><?php echo sprintf(__('Edit %s','events-manager'), __('Event', 'events-manager')) ?></a>
91
<?php if( locate_template('plugins/events-manager/templates/csv-event-bookings.php', false) ): //support for legacy template ?>
92
<a href='<?php echo EM_ADMIN_URL ."&amp;page=events-manager-bookings&amp;action=bookings_export_csv&amp;_wpnonce=".wp_create_nonce('bookings_export_csv')."&amp;event_id=".$EM_Event->event_id ?>' class="<?php echo $header_button_classes; ?>"><?php esc_html_e('Export CSV','events-manager')?></a>
93
<?php endif; ?>
94
<?php do_action('em_admin_event_booking_options_buttons'); ?>
95
- <?php if( !is_admin() ): ?></h2><?php else: ?></h1><?php endif; ?>
96
<?php if( !is_admin() ) echo $EM_Notices; ?>
97
<div>
98
<p><strong><?php esc_html_e('Event Name','events-manager'); ?></strong> : <?php echo esc_html($EM_Event->event_name); ?></p>
@@ -141,12 +142,13 @@ function em_bookings_ticket(){
141
$header_button_classes = is_admin() ? 'page-title-action':'button add-new-h2';
142
?>
143
<div class='wrap'>
144
- <?php if( is_admin() ): ?><h1><?php else: ?><h2><?php endif; ?>
145
<?php echo sprintf(__('Ticket for %s', 'events-manager'), "'{$EM_Event->name}'"); ?>
146
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('View/Edit Event','events-manager') ?></a>
147
<a href="<?php echo $EM_Event->get_bookings_url(); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('View Event Bookings','events-manager') ?></a>
148
149
- <?php if( !is_admin() ): ?></h2><?php else: ?></h1><?php endif; ?>
150
<?php if( !is_admin() ) echo $EM_Notices; ?>
151
<div>
152
<table>
@@ -508,15 +510,16 @@ function em_bookings_person(){
508
$header_button_classes = is_admin() ? 'page-title-action':'button add-new-h2';
509
?>
510
<div class='wrap'>
511
- <?php if( is_admin() ): ?><h1><?php else: ?><h2><?php endif; ?>
512
<?php esc_html_e('Manage Person\'s Booking', 'events-manager'); ?>
513
<?php if( current_user_can('edit_users') ) : ?>
514
<a href="<?php echo admin_url('user-edit.php?user_id='.$EM_Person->ID); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('Edit User','events-manager') ?></a>
515
<?php endif; ?>
516
<?php if( current_user_can('delete_users') ) : ?>
517
<a href="<?php echo wp_nonce_url( admin_url("users.php?action=delete&amp;user=$EM_Person->ID"), 'bulk-users' ); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('Delete User','events-manager') ?></a>
518
<?php endif; ?>
519
- <?php if( !is_admin() ): ?></h2><?php else: ?></h1><?php endif; ?>
520
<?php if( !is_admin() ) echo $EM_Notices; ?>
521
<?php do_action('em_bookings_person_header'); ?>
522
<div id="poststuff" class="metabox-holder has-right-sidebar">
84
$header_button_classes = is_admin() ? 'page-title-action':'button add-new-h2';
85
?>
86
<div class='wrap'>
87
+ <?php if( is_admin() ): ?><h1 class="wp-heading-inline"><?php else: ?><h2><?php endif; ?>
88
<?php echo sprintf(__('Manage %s Bookings', 'events-manager'), "'{$EM_Event->event_name}'"); ?>
89
+ <?php if( is_admin() ): ?></h1><?php endif; ?>
90
<a href="<?php echo $EM_Event->get_permalink(); ?>" class="<?php echo $header_button_classes; ?>"><?php echo sprintf(__('View %s','events-manager'), __('Event', 'events-manager')) ?></a>
91
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="<?php echo $header_button_classes; ?>"><?php echo sprintf(__('Edit %s','events-manager'), __('Event', 'events-manager')) ?></a>
92
<?php if( locate_template('plugins/events-manager/templates/csv-event-bookings.php', false) ): //support for legacy template ?>
93
<a href='<?php echo EM_ADMIN_URL ."&amp;page=events-manager-bookings&amp;action=bookings_export_csv&amp;_wpnonce=".wp_create_nonce('bookings_export_csv')."&amp;event_id=".$EM_Event->event_id ?>' class="<?php echo $header_button_classes; ?>"><?php esc_html_e('Export CSV','events-manager')?></a>
94
<?php endif; ?>
95
<?php do_action('em_admin_event_booking_options_buttons'); ?>
96
+ <?php if( !is_admin() ): ?></h2><?php else: ?><hr class="wp-header-end" /><?php endif; ?>
97
<?php if( !is_admin() ) echo $EM_Notices; ?>
98
<div>
99
<p><strong><?php esc_html_e('Event Name','events-manager'); ?></strong> : <?php echo esc_html($EM_Event->event_name); ?></p>
142
$header_button_classes = is_admin() ? 'page-title-action':'button add-new-h2';
143
?>
144
<div class='wrap'>
145
+ <?php if( is_admin() ): ?><h1 class="wp-heading-inline"><?php else: ?><h2><?php endif; ?>
146
<?php echo sprintf(__('Ticket for %s', 'events-manager'), "'{$EM_Event->name}'"); ?>
147
+ <?php if( is_admin() ): ?></h1><?php endif; ?>
148
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('View/Edit Event','events-manager') ?></a>
149
<a href="<?php echo $EM_Event->get_bookings_url(); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('View Event Bookings','events-manager') ?></a>
150
151
+ <?php if( !is_admin() ): ?></h2><?php else: ?><hr class="wp-header-end" /><?php endif; ?>
152
<?php if( !is_admin() ) echo $EM_Notices; ?>
153
<div>
154
<table>
510
$header_button_classes = is_admin() ? 'page-title-action':'button add-new-h2';
511
?>
512
<div class='wrap'>
513
+ <?php if( is_admin() ): ?><h1 class="wp-heading-inline"><?php else: ?><h2><?php endif; ?>
514
<?php esc_html_e('Manage Person\'s Booking', 'events-manager'); ?>
515
+ <?php if( is_admin() ): ?></h1><?php endif; ?>
516
<?php if( current_user_can('edit_users') ) : ?>
517
<a href="<?php echo admin_url('user-edit.php?user_id='.$EM_Person->ID); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('Edit User','events-manager') ?></a>
518
<?php endif; ?>
519
<?php if( current_user_can('delete_users') ) : ?>
520
<a href="<?php echo wp_nonce_url( admin_url("users.php?action=delete&amp;user=$EM_Person->ID"), 'bulk-users' ); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('Delete User','events-manager') ?></a>
521
<?php endif; ?>
522
+ <?php if( !is_admin() ): ?></h2><?php else: ?><hr class="wp-header-end" /><?php endif; ?>
523
<?php if( !is_admin() ) echo $EM_Notices; ?>
524
<?php do_action('em_bookings_person_header'); ?>
525
<div id="poststuff" class="metabox-holder has-right-sidebar">
admin/em-docs.php CHANGED
@@ -33,7 +33,10 @@ function em_docs_init($force_init = false){
33
'tag' => array( 'desc'=> str_replace('%s', 'tags', 'Supply a single id, slug or comma-separated ids or slugs (e.g. "1,%s-slug,3") to limit the search to events in any of these %s. You can also use negative numbers and slugs to exclude specific %s (e.g. -1,-exclude-%s,-3). If you mix inclusions and exclusions, all events with included %s AND without excluded %s will be shown. You can also use &amp; to separate ids and slugs, in which case events must contain (or not contain) both %s to be shown.'), 'default'=>0),
34
'year' => array( 'desc'=> 'If set to a year (e.g. 2010) only events that start or end during this year/month will be returned. Does not work as intended if used with scope.', 'default'=>''),
35
'has_location' => array( 'desc'=> 'When set to true, only events WITH an assigned location will be shown, has priority over no_location.', 'default'=>''),
36
- 'no_location' => array( 'desc'=> 'When set to true, only events WITHOUT an assigned location will be shown.', 'default'=>'')
37
),
38
'locations' => array(
39
'blog' => array( 'desc' => sprintf('Limit search to %s created in a specific blog id (MultiSite only)','locations')),
@@ -53,7 +56,10 @@ function em_docs_init($force_init = false){
53
'scope' => array( 'default' => 'all'),
54
'state' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','State'), 'default' => 'none'),
55
'status' => array( 'desc' => sprintf('Limit search to %s with a spefic status (1 is active, 0 is pending approval)','locations'), 'default'=>1),
56
- 'town' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Town'), 'default' => 'none')
57
),
58
'categories' => array(
59
'' => array( 'desc' => 'See the <a href="http://codex.wordpress.org/Function_Reference/get_terms">WordPress get_terms() Codex</a> for a list of possible search attributes/arguments.'),
@@ -149,8 +155,10 @@ function em_docs_init($force_init = false){
149
'#_BOOKINGSLINK' => array( 'desc' => 'Shows a link to the admin, front-end or buddypress (if activated) bookings management page for this event. Only shown if user is logged in and able to manage bookings.' ),
150
'#_EVENTPRICERANGE' => array( 'desc' => 'Shows a "maximum - minimum" price range for available tickets at the time of display, or a single price if there is no range. Once bookings are closed this will show a 0 value, if you have enabled \'Show unavailable tickets\' in your booking settings these will be included. Price is formatted according to currency formatting in your settings page.' ),
151
'#_EVENTPRICERANGEALL' => array( 'desc' => 'Like #_EVENTPRICERANGE but shows all tickets price range whether or not bookings or individual tickets are available.' ),
152
- '#_EVENTPRICEMIN' => array( 'desc' => 'Shows the lowest ticket price for this event.' ),
153
- '#_EVENTPRICEMAX' => array( 'desc' => 'Shows the highest ticket price for this event.' ),
154
)
155
),
156
'Contact Details' => array(
@@ -172,6 +180,8 @@ function em_docs_init($force_init = false){
172
'placeholders' => array(
173
'#_EVENTICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format).' ),
174
'#_EVENTICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format).' ),
175
'#_EVENTGCALURL' => array( 'desc' => 'Displays URL which would take the user to Google Calendar and pre-fill their add new event form.' ),
176
'#_EVENTGCALLINK' => array( 'desc' => 'Displays a button which would take the user to Google Calendar and pre-fill their add new event form.' )
177
)
@@ -184,7 +194,9 @@ function em_docs_init($force_init = false){
184
'#_CATEGORYNAME' => array( 'desc' => 'Shows the category name.' ),
185
'#_CATEGORYID' => array( 'desc' => 'Shows the category ID.' ),
186
'#_CATEGORYSLUG' => array( 'desc' => 'Shows the category slug.' ),
187
- '#_CATEGORYCOLOR' => array( 'desc' => 'Shows the category color (useful for inline styling), in hex format, if no color is defined #FFFFFF (white) will be used.' ),
188
'#_CATEGORYIMAGE' => array( 'desc' => 'Shows the category image, if available.' ),
189
'#_CATEGORYIMAGE{x,y}' => array( 'desc' => 'Shows the category image thumbnail if available, x and y are width and height respectively, both being numbers e.g. <code>#_CATEGORYIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ),
190
'#_CATEGORYIMAGEURL' => array( 'desc' => 'Shows the category image url, if available.' ),
@@ -202,8 +214,10 @@ function em_docs_init($force_init = false){
202
),
203
'iCal/RSS Feeds' => array(
204
'placeholders' => array(
205
- '#_CATEGORYICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format) which shows all events happening in this category.', 'since'=>'5.5.2' ),
206
- '#_CATEGORYICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events happening in this category.', 'since'=>'5.5.2' ),
207
'#_CATEGORYRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening in this category.', 'since'=>'5.5.2' ),
208
'#_CATEGORYRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening in this category.', 'since'=>'5.5.2' )
209
)
@@ -216,7 +230,13 @@ function em_docs_init($force_init = false){
216
'#_TAGNAME' => array( 'desc' => 'Shows the tag name.' ),
217
'#_TAGID' => array( 'desc' => 'Shows the tag ID.' ),
218
'#_TAGSLUG' => array( 'desc' => 'Shows the tag slug.' ),
219
- '#_TAGNOTES' => array( 'desc' => 'Shows the tag description.' )
220
)
221
),
222
'Related Events' => array(
@@ -230,8 +250,10 @@ function em_docs_init($force_init = false){
230
),
231
'iCal/RSS Feeds' => array(
232
'placeholders' => array(
233
- '#_TAGICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format) which shows all events happening in this tag.', 'since'=>'5.5.2' ),
234
- '#_TAGICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events happening in this tag.' , 'since'=>'5.5.2'),
235
'#_TAGRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening in this tag.', 'since'=>'5.5.2' ),
236
'#_TAGRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening in this tag.', 'since'=>'5.5.2' )
237
)
@@ -256,6 +278,7 @@ function em_docs_init($force_init = false){
256
'#_LOCATIONNOTES' => array( 'desc' => 'Shows the location description.' ),
257
'#_LOCATIONEXCERPT' => array( 'desc' => 'If an excerpt has been added to the location, it will be used. If you added a <a href="http://en.support.wordpress.com/splitting-content/more-tag/">more tag</a> to your location description, only the content before this tag will show.' ),
258
'#_LOCATIONEXCERPT{words, ...}' => array( 'desc' => 'If an excerpt has not been added to the location, only a specific length is shown, e.g. <code>#_EVENTEXCERPT{10,...}</code> where 10 is the number of words to show and ... is what is used at the cut-off point.' ),
259
'#_LOCATIONIMAGE' => array( 'desc' => 'Shows the location image.' ),
260
'#_LOCATIONIMAGE{x,y}' => array( 'desc' => 'Shows the location image thumbnail, x and y are width and height respectively, both being numbers e.g. <code>#_LOCATIONIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ),
261
'#_LOCATIONIMAGEURL' => array( 'desc' => 'Shows the location image url, if available.' ),
@@ -292,6 +315,8 @@ function em_docs_init($force_init = false){
292
'placeholders' => array(
293
'#_LOCATIONICALURL' => array( 'desc' => 'Displays the URL of the location ical feed (ics file format) which shows all events happening at that location.', 'since'=>'5.5.2' ),
294
'#_LOCATIONICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events happening at that location.', 'since'=>'5.5.2' ),
295
'#_LOCATIONRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening at this location.', 'since'=>'5.5.2' ),
296
'#_LOCATIONRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening at this location.', 'since'=>'5.5.2' )
297
)
33
'tag' => array( 'desc'=> str_replace('%s', 'tags', 'Supply a single id, slug or comma-separated ids or slugs (e.g. "1,%s-slug,3") to limit the search to events in any of these %s. You can also use negative numbers and slugs to exclude specific %s (e.g. -1,-exclude-%s,-3). If you mix inclusions and exclusions, all events with included %s AND without excluded %s will be shown. You can also use &amp; to separate ids and slugs, in which case events must contain (or not contain) both %s to be shown.'), 'default'=>0),
34
'year' => array( 'desc'=> 'If set to a year (e.g. 2010) only events that start or end during this year/month will be returned. Does not work as intended if used with scope.', 'default'=>''),
35
'has_location' => array( 'desc'=> 'When set to true, only events WITH an assigned location will be shown, has priority over no_location.', 'default'=>''),
36
+ 'no_location' => array( 'desc'=> 'When set to true, only events WITHOUT an assigned location will be shown.', 'default'=>''),
37
+ 'groupby' => array( 'desc'=> 'Show one event for each unique value of the provide field name, along with events contaning no defined value for that field. See our <a href="http://wp-events-plugin.com/documentation/event-search-attributes/event-location-grouping-ordering/">grouping documentation</a> for more information.', 'default'=>0, 'args'=>'Database field name from the wp_em_events or wp_em_locations tables, e.g. <code>event_name</code> or <code>location_name</code>', 'since'=>'5.8'),
38
+ 'groupby_orderby' => array( 'desc'=> 'When groupby is defined, the fields defined here will determine the sorting of events in each group. See our <a href="http://wp-events-plugin.com/documentation/event-search-attributes/event-location-grouping-ordering/">grouping documentation</a> for more information.', 'default'=>'event_start_date,event_start_time', 'args'=>'Database fields (comma-seperated) in the wp_em_events and wp_em_locations tables, e.g. <code>event_start_date,event_start_time</code> or <code>location_name</code>', 'since'=>'5.8'),
39
+ 'groupby_order' => array( 'desc'=> 'Indicates the alphabeitcal/numerical/date order of the sorting in groupby_orderby. Choose between ASC (ascending) and DESC (descending), case insensitive.', 'default'=>'ASC', 'since'=>'5.8'),
40
),
41
'locations' => array(
42
'blog' => array( 'desc' => sprintf('Limit search to %s created in a specific blog id (MultiSite only)','locations')),
56
'scope' => array( 'default' => 'all'),
57
'state' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','State'), 'default' => 'none'),
58
'status' => array( 'desc' => sprintf('Limit search to %s with a spefic status (1 is active, 0 is pending approval)','locations'), 'default'=>1),
59
+ 'town' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Town'), 'default' => 'none'),
60
+ 'groupby' => array( 'desc'=> 'Show one location for each unique value of the provide field name, along with locations contaning no defined value for that field. See our <a href="http://wp-events-plugin.com/documentation/event-search-attributes/event-location-grouping-ordering/">grouping documentation</a> for more information.', 'default'=>0, 'args'=>'Database field name from the wp_em_events or wp_em_locations tables, e.g. <code>event_name</code> or <code>location_name</code>', 'since'=>'5.8'),
61
+ 'groupby_orderby' => array( 'desc'=> 'When groupby is defined, the fields defined here will determine the sorting of events in each group. See our <a href="http://wp-events-plugin.com/documentation/event-search-attributes/event-location-grouping-ordering/">grouping documentation</a> for more information.', 'default'=>'event_start_date,event_start_time', 'args'=>'Database fields (comma-seperated) in the wp_em_events and wp_em_locations tables, e.g. <code>location_country,location_town</code> or <code>location_name</code>', 'since'=>'5.8'),
62
+ 'groupby_order' => array( 'desc'=> 'Indicates the alphabeitcal/numerical/date order of the sorting in groupby_orderby. Choose between ASC (ascending) and DESC (descending), case insensitive.', 'default'=>'ASC', 'since'=>'5.8'),
63
),
64
'categories' => array(
65
'' => array( 'desc' => 'See the <a href="http://codex.wordpress.org/Function_Reference/get_terms">WordPress get_terms() Codex</a> for a list of possible search attributes/arguments.'),
155
'#_BOOKINGSLINK' => array( 'desc' => 'Shows a link to the admin, front-end or buddypress (if activated) bookings management page for this event. Only shown if user is logged in and able to manage bookings.' ),
156
'#_EVENTPRICERANGE' => array( 'desc' => 'Shows a "maximum - minimum" price range for available tickets at the time of display, or a single price if there is no range. Once bookings are closed this will show a 0 value, if you have enabled \'Show unavailable tickets\' in your booking settings these will be included. Price is formatted according to currency formatting in your settings page.' ),
157
'#_EVENTPRICERANGEALL' => array( 'desc' => 'Like #_EVENTPRICERANGE but shows all tickets price range whether or not bookings or individual tickets are available.' ),
158
+ '#_EVENTPRICEMIN' => array( 'desc' => 'Shows the lowest available ticket price for this event. Will display a value of 0 if no ticket is available.' ),
159
+ '#_EVENTPRICEMAX' => array( 'desc' => 'Shows the highest available ticket price for this event. Will display a value of 0 if no ticket is avaialble.' ),
160
+ '#_EVENTPRICEMINALL' => array( 'desc' => 'Shows the lowest ticket price for this event, whether available or not.' ),
161
+ '#_EVENTPRICEMAXALL' => array( 'desc' => 'Shows the highest ticket price for this event, whether available or not.' ),
162
)
163
),
164
'Contact Details' => array(
180
'placeholders' => array(
181
'#_EVENTICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format).' ),
182
'#_EVENTICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format).' ),
183
+ '#_EVENTWEBCALURL' => array( 'desc' => 'Same as #_EVENTICALURL, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
184
+ '#_EVENTWEBCALLINK' => array( 'desc' => 'Same as #_EVENTICALLINK, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
185
'#_EVENTGCALURL' => array( 'desc' => 'Displays URL which would take the user to Google Calendar and pre-fill their add new event form.' ),
186
'#_EVENTGCALLINK' => array( 'desc' => 'Displays a button which would take the user to Google Calendar and pre-fill their add new event form.' )
187
)
194
'#_CATEGORYNAME' => array( 'desc' => 'Shows the category name.' ),
195
'#_CATEGORYID' => array( 'desc' => 'Shows the category ID.' ),
196
'#_CATEGORYSLUG' => array( 'desc' => 'Shows the category slug.' ),
197
+ '#_CATEGORYLINK' => array( 'desc' => 'Category name with a link to the category page.' ),
198
+ '#_CATEGORYURL' => array( 'desc' => 'URL of the category page.' ),
199
+ '#_CATEGORYCOLOR' => array( 'desc' => 'Shows the category color (useful for inline styling), in hex format, if no color is defined the default category color from your settings page will be used.' ),
200
'#_CATEGORYIMAGE' => array( 'desc' => 'Shows the category image, if available.' ),
201
'#_CATEGORYIMAGE{x,y}' => array( 'desc' => 'Shows the category image thumbnail if available, x and y are width and height respectively, both being numbers e.g. <code>#_CATEGORYIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ),
202
'#_CATEGORYIMAGEURL' => array( 'desc' => 'Shows the category image url, if available.' ),
214
),
215
'iCal/RSS Feeds' => array(
216
'placeholders' => array(
217
+ '#_CATEGORYICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format) which shows all events with this category.', 'since'=>'5.5.2' ),
218
+ '#_CATEGORYICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events with this category.', 'since'=>'5.5.2' ),
219
+ '#_CATEGORYWEBCALURL' => array( 'desc' => 'Same as #_CATEGORYICALURL, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
220
+ '#_CATEGORYWEBCALLINK' => array( 'desc' => 'Same as #_CATEGORYICALLINK, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
221
'#_CATEGORYRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening in this category.', 'since'=>'5.5.2' ),
222
'#_CATEGORYRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening in this category.', 'since'=>'5.5.2' )
223
)
230
'#_TAGNAME' => array( 'desc' => 'Shows the tag name.' ),
231
'#_TAGID' => array( 'desc' => 'Shows the tag ID.' ),
232
'#_TAGSLUG' => array( 'desc' => 'Shows the tag slug.' ),
233
+ '#_TAGLINK' => array( 'desc' => 'Tag name with a link to the tag page.' ),
234
+ '#_TAGURL' => array( 'desc' => 'URL of the tag page.' ),
235
+ '#_TAGNOTES' => array( 'desc' => 'Shows the tag description.' ),
236
+ '#_TAGCOLOR' => array( 'desc' => 'Shows the tag color (useful for inline styling), in hex format, if no color is defined the default tag color from your settings page will be used.' ),
237
+ '#_TAGIMAGE' => array( 'desc' => 'Shows the tag image, if available.' ),
238
+ '#_TAGIMAGE{x,y}' => array( 'desc' => 'Shows the tag image thumbnail if available, x and y are width and height respectively, both being numbers e.g. <code>#_TAGIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ),
239
+ '#_TAGIMAGEURL' => array( 'desc' => 'Shows the tag image url, if available.' ),
240
)
241
),
242
'Related Events' => array(
250
),
251
'iCal/RSS Feeds' => array(
252
'placeholders' => array(
253
+ '#_TAGICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format) which shows all events with this tag.', 'since'=>'5.5.2' ),
254
+ '#_TAGICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events with this tag.' , 'since'=>'5.5.2'),
255
+ '#_TAGWEBCALURL' => array( 'desc' => 'Same as #_TAGICALURL, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
256
+ '#_TAGWEBCALLINK' => array( 'desc' => 'Same as #_TAGICALLINK, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
257
'#_TAGRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening in this tag.', 'since'=>'5.5.2' ),
258
'#_TAGRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening in this tag.', 'since'=>'5.5.2' )
259
)
278
'#_LOCATIONNOTES' => array( 'desc' => 'Shows the location description.' ),
279
'#_LOCATIONEXCERPT' => array( 'desc' => 'If an excerpt has been added to the location, it will be used. If you added a <a href="http://en.support.wordpress.com/splitting-content/more-tag/">more tag</a> to your location description, only the content before this tag will show.' ),
280
'#_LOCATIONEXCERPT{words, ...}' => array( 'desc' => 'If an excerpt has not been added to the location, only a specific length is shown, e.g. <code>#_EVENTEXCERPT{10,...}</code> where 10 is the number of words to show and ... is what is used at the cut-off point.' ),
281
+ '#_LOCATIONEXCERPTCUT' => array( 'desc' => 'Same as <code>#_LOCATIONEXCERPT</code> (and also accepts the <code>{words,...}</code> arguments) but will also cut excerpts as well as post content. Default word limit is 55 and cut-off is <code>[...]</code>' ),
282
'#_LOCATIONIMAGE' => array( 'desc' => 'Shows the location image.' ),
283
'#_LOCATIONIMAGE{x,y}' => array( 'desc' => 'Shows the location image thumbnail, x and y are width and height respectively, both being numbers e.g. <code>#_LOCATIONIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ),
284
'#_LOCATIONIMAGEURL' => array( 'desc' => 'Shows the location image url, if available.' ),
315
'placeholders' => array(
316
'#_LOCATIONICALURL' => array( 'desc' => 'Displays the URL of the location ical feed (ics file format) which shows all events happening at that location.', 'since'=>'5.5.2' ),
317
'#_LOCATIONICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events happening at that location.', 'since'=>'5.5.2' ),
318
+ '#_LOCATIONWEBCALURL' => array( 'desc' => 'Same as #_LOCATIONICALURL, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
319
+ '#_LOCATIONWEBCALLINK' => array( 'desc' => 'Same as #_LOCATIONICALLINK, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
320
'#_LOCATIONRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening at this location.', 'since'=>'5.5.2' ),
321
'#_LOCATIONRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening at this location.', 'since'=>'5.5.2' )
322
)
admin/em-ms-options.php CHANGED
@@ -31,7 +31,7 @@ function em_ms_upgrade( $blog_id ){
31
<p><?php esc_html_e('To update your network blogs with the latest Events Manager automatically, click the update button below.','events-manager'); ?></p>
32
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('em_ms_ugrade_'.get_current_user_id()); ?>" />
33
<input type="hidden" name="action" value="upgrade" />
34
- <input type="submit" value="<?php esc_attr_e('Update','events-manager'); ?>" />
35
</form>
36
<?php
37
}
31
<p><?php esc_html_e('To update your network blogs with the latest Events Manager automatically, click the update button below.','events-manager'); ?></p>
32
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('em_ms_ugrade_'.get_current_user_id()); ?>" />
33
<input type="hidden" name="action" value="upgrade" />
34
+ <input type="submit" value="<?php esc_attr_e('Update','events-manager'); ?>" />
35
</form>
36
<?php
37
}
admin/em-options.php CHANGED
@@ -17,7 +17,7 @@ function em_options_save(){
17
if( in_array($postKey, array('dbem_bookings_notify_admin','dbem_event_submitted_email_admin','dbem_js_limit_events_form','dbem_js_limit_search','dbem_js_limit_general','dbem_css_limit_include','dbem_css_limit_exclude','dbem_search_form_geo_distance_options')) ){ $postValue = str_replace(' ', '', $postValue); } //clean up comma separated emails, no spaces needed
18
if( in_array($postKey,$numeric_options) && !is_numeric($postValue) ){
19
//Do nothing, keep old setting.
20
- }elseif( $postKey == 'dbem_category_default_color' && !preg_match("/^#([abcdef0-9]{3}){1,2}?#x2F;i",$postValue)){
21
$EM_Notices->add_error( sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'events-manager'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>').' '. esc_html__('This setting was not changed.', 'events-manager'), true);
22
}else{
23
//TODO slashes being added?
@@ -31,7 +31,7 @@ function em_options_save(){
31
}
32
}
33
//set capabilities
34
- if( !empty($_POST['em_capabilities']) && is_array($_POST['em_capabilities']) && (!is_multisite() || is_multisite() && is_super_admin()) ){
35
global $em_capabilities_array, $wp_roles;
36
if( is_multisite() && is_network_admin() && $_POST['dbem_ms_global_caps'] == 1 ){
37
//apply_caps_to_blog
@@ -67,7 +67,13 @@ function em_options_save(){
67
update_option('dbem_flush_needed',1);
68
do_action('em_options_save');
69
$EM_Notices->add_confirm('<strong>'.__('Changes saved.', 'events-manager').'</strong>', true);
70
- wp_redirect(em_wp_get_referer());
71
exit();
72
}
73
//Migration
@@ -84,7 +90,7 @@ function em_options_save(){
84
delete_option('dbem_migrate_images');
85
}
86
//Uninstall
87
- if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' && current_user_can('activate_plugins') && !empty($_REQUEST['confirmed']) && check_admin_referer('em_uninstall_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
88
if( check_admin_referer('em_uninstall_'.get_current_user_id().'_confirmed','_wpnonce2') ){
89
//We have a go to uninstall
90
global $wpdb;
@@ -112,7 +118,6 @@ function em_options_save(){
112
$wpdb->query('DROP TABLE '.EM_TICKETS_TABLE);
113
$wpdb->query('DROP TABLE '.EM_TICKETS_BOOKINGS_TABLE);
114
$wpdb->query('DROP TABLE '.EM_RECURRENCE_TABLE);
115
- $wpdb->query('DROP TABLE '.EM_CATEGORIES_TABLE);
116
$wpdb->query('DROP TABLE '.EM_META_TABLE);
117
118
//delete options
@@ -124,7 +129,7 @@ function em_options_save(){
124
}
125
}
126
//Reset
127
- if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' && !empty($_REQUEST['confirmed']) && check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
128
if( check_admin_referer('em_reset_'.get_current_user_id().'_confirmed','_wpnonce2') ){
129
//We have a go to uninstall
130
global $wpdb;
@@ -144,7 +149,7 @@ function em_options_save(){
144
}
145
}
146
//Cleanup Event Orphans
147
- if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'cleanup_event_orphans' && check_admin_referer('em_cleanup_event_orphans_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
148
//Firstly, get all orphans
149
global $wpdb;
150
$sql = 'SELECT event_id FROM '.EM_EVENTS_TABLE.' WHERE post_id NOT IN (SELECT ID FROM ' .$wpdb->posts. ' WHERE post_type="'. EM_POST_TYPE_EVENT .'" OR post_type="event-recurring")';
@@ -169,7 +174,7 @@ function em_options_save(){
169
exit();
170
}
171
//Force Update Recheck - Workaround for now
172
- if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'recheck_updates' && check_admin_referer('em_recheck_updates_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
173
//force recheck of plugin updates, to refresh dl links
174
delete_transient('update_plugins');
175
delete_site_transient('update_plugins');
@@ -178,7 +183,7 @@ function em_options_save(){
178
exit();
179
}
180
//Flag version checking to look at trunk, not tag
181
- if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'check_devs' && check_admin_referer('em_check_devs_wpnonce') && is_super_admin() ){
182
//delete transients, and add a flag to recheck dev version next time round
183
delete_transient('update_plugins');
184
delete_site_transient('update_plugins');
@@ -188,7 +193,7 @@ function em_options_save(){
188
exit();
189
}
190
//import EM settings
191
- if( !empty($_REQUEST['action']) && ( ($_REQUEST['action'] == 'import_em_settings' && check_admin_referer('import_em_settings')) || (is_multisite() && $_REQUEST['action'] == 'import_em_ms_settings' && check_admin_referer('import_em_ms_settings')) ) && is_super_admin() ){
192
//upload uniquely named file to system for usage later
193
if( !empty($_FILES['import_settings_file']['size']) && is_uploaded_file($_FILES['import_settings_file']['tmp_name']) ){
194
$settings = file_get_contents($_FILES['import_settings_file']['tmp_name']);
@@ -217,7 +222,7 @@ function em_options_save(){
217
exit();
218
}
219
//export EM settings
220
- if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_em_settings' && check_admin_referer('export_em_settings') && is_super_admin() ){
221
global $wpdb;
222
$results = $wpdb->get_results('SELECT option_name, option_value FROM '.$wpdb->options ." WHERE option_name LIKE 'dbem_%' OR option_name LIKE 'emp_%' OR option_name LIKE 'em_%'", ARRAY_A);
223
$options = array();
@@ -226,7 +231,7 @@ function em_options_save(){
226
header('Content-Disposition: attachment; filename="events-manager-settings.txt"');
227
echo json_encode($options);
228
exit();
229
- }elseif( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_em_ms_settings' && check_admin_referer('export_em_ms_settings') && is_multisite() && is_super_admin() ){
230
//delete transients, and add a flag to recheck dev version next time round
231
global $EM_MS_Globals, $wpdb;
232
$options = array();
@@ -284,7 +289,7 @@ function em_admin_email_test_ajax(){
284
add_action('wp_ajax_em_admin_test_email','em_admin_email_test_ajax');
285
286
function em_admin_options_reset_page(){
287
- if( check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
288
?>
289
<div class="wrap">
290
<div id='icon-options-general' class='icon32'><br /></div>
@@ -300,7 +305,7 @@ function em_admin_options_reset_page(){
300
}
301
}
302
function em_admin_options_uninstall_page(){
303
- if( check_admin_referer('em_uninstall_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
304
?>
305
<div class="wrap">
306
<div id='icon-options-general' class='icon32'><br /></div>
17
if( in_array($postKey, array('dbem_bookings_notify_admin','dbem_event_submitted_email_admin','dbem_js_limit_events_form','dbem_js_limit_search','dbem_js_limit_general','dbem_css_limit_include','dbem_css_limit_exclude','dbem_search_form_geo_distance_options')) ){ $postValue = str_replace(' ', '', $postValue); } //clean up comma separated emails, no spaces needed
18
if( in_array($postKey,$numeric_options) && !is_numeric($postValue) ){
19
//Do nothing, keep old setting.
20
+ }elseif( ($postKey == 'dbem_category_default_color' || $postKey == 'dbem_tag_default_color') && !preg_match("/^#([abcdef0-9]{3}){1,2}?#x2F;i",$postValue)){
21
$EM_Notices->add_error( sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'events-manager'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>').' '. esc_html__('This setting was not changed.', 'events-manager'), true);
22
}else{
23
//TODO slashes being added?
31
}
32
}
33
//set capabilities
34
+ if( !empty($_POST['em_capabilities']) && is_array($_POST['em_capabilities']) && (!is_multisite() || is_multisite() && em_wp_is_super_admin()) ){
35
global $em_capabilities_array, $wp_roles;
36
if( is_multisite() && is_network_admin() && $_POST['dbem_ms_global_caps'] == 1 ){
37
//apply_caps_to_blog
67
update_option('dbem_flush_needed',1);
68
do_action('em_options_save');
69
$EM_Notices->add_confirm('<strong>'.__('Changes saved.', 'events-manager').'</strong>', true);
70
+ $referrer = em_wp_get_referer();
71
+ //add tab hash path to url if supplied
72
+ if( !empty($_REQUEST['tab_path']) ){
73
+ $referrer_array = explode('#', $referrer);
74
+ $referrer = esc_url_raw($referrer_array[0] . '#' . $_REQUEST['tab_path']);
75
+ }
76
+ wp_redirect($referrer);
77
exit();
78
}
79
//Migration
90
delete_option('dbem_migrate_images');
91
}
92
//Uninstall
93
+ if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' && current_user_can('activate_plugins') && !empty($_REQUEST['confirmed']) && check_admin_referer('em_uninstall_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
94
if( check_admin_referer('em_uninstall_'.get_current_user_id().'_confirmed','_wpnonce2') ){
95
//We have a go to uninstall
96
global $wpdb;
118
$wpdb->query('DROP TABLE '.EM_TICKETS_TABLE);
119
$wpdb->query('DROP TABLE '.EM_TICKETS_BOOKINGS_TABLE);
120
$wpdb->query('DROP TABLE '.EM_RECURRENCE_TABLE);
121
$wpdb->query('DROP TABLE '.EM_META_TABLE);
122
123
//delete options
129
}
130
}
131
//Reset
132
+ if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' && !empty($_REQUEST['confirmed']) && check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
133
if( check_admin_referer('em_reset_'.get_current_user_id().'_confirmed','_wpnonce2') ){
134
//We have a go to uninstall
135
global $wpdb;
149
}
150
}
151
//Cleanup Event Orphans
152
+ if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'cleanup_event_orphans' && check_admin_referer('em_cleanup_event_orphans_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
153
//Firstly, get all orphans
154
global $wpdb;
155
$sql = 'SELECT event_id FROM '.EM_EVENTS_TABLE.' WHERE post_id NOT IN (SELECT ID FROM ' .$wpdb->posts. ' WHERE post_type="'. EM_POST_TYPE_EVENT .'" OR post_type="event-recurring")';
174
exit();
175
}
176
//Force Update Recheck - Workaround for now
177
+ if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'recheck_updates' && check_admin_referer('em_recheck_updates_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
178
//force recheck of plugin updates, to refresh dl links
179
delete_transient('update_plugins');
180
delete_site_transient('update_plugins');
183
exit();
184
}
185
//Flag version checking to look at trunk, not tag
186
+ if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'check_devs' && check_admin_referer('em_check_devs_wpnonce') && em_wp_is_super_admin() ){
187
//delete transients, and add a flag to recheck dev version next time round
188
delete_transient('update_plugins');
189
delete_site_transient('update_plugins');
193
exit();
194
}
195
//import EM settings
196
+ if( !empty($_REQUEST['action']) && ( ($_REQUEST['action'] == 'import_em_settings' && check_admin_referer('import_em_settings')) || (is_multisite() && $_REQUEST['action'] == 'import_em_ms_settings' && check_admin_referer('import_em_ms_settings')) ) && em_wp_is_super_admin() ){
197
//upload uniquely named file to system for usage later
198
if( !empty($_FILES['import_settings_file']['size']) && is_uploaded_file($_FILES['import_settings_file']['tmp_name']) ){
199
$settings = file_get_contents($_FILES['import_settings_file']['tmp_name']);
222
exit();
223
}
224
//export EM settings
225
+ if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_em_settings' && check_admin_referer('export_em_settings') && em_wp_is_super_admin() ){
226
global $wpdb;
227
$results = $wpdb->get_results('SELECT option_name, option_value FROM '.$wpdb->options ." WHERE option_name LIKE 'dbem_%' OR option_name LIKE 'emp_%' OR option_name LIKE 'em_%'", ARRAY_A);
228
$options = array();
231
header('Content-Disposition: attachment; filename="events-manager-settings.txt"');
232
echo json_encode($options);
233
exit();
234
+ }elseif( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_em_ms_settings' && check_admin_referer('export_em_ms_settings') && is_multisite() && em_wp_is_super_admin() ){
235
//delete transients, and add a flag to recheck dev version next time round
236
global $EM_MS_Globals, $wpdb;
237
$options = array();
289
add_action('wp_ajax_em_admin_test_email','em_admin_email_test_ajax');
290
291
function em_admin_options_reset_page(){
292
+ if( check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
293
?>
294
<div class="wrap">
295
<div id='icon-options-general' class='icon32'><br /></div>
305
}
306
}
307
function em_admin_options_uninstall_page(){
308
+ if( check_admin_referer('em_uninstall_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
309
?>
310
<div class="wrap">
311
<div id='icon-options-general' class='icon32'><br /></div>
admin/settings/tabs/emails.php CHANGED
@@ -68,14 +68,6 @@
68
em_options_input_text ( __( 'Booking pending email subject', 'events-manager'), 'dbem_bookings_email_pending_subject', $email_subject_tip);
69
em_options_textarea ( __( 'Booking pending email', 'events-manager'), 'dbem_bookings_email_pending_body','') ;
70
?>
71
- <tr class="em-subheader"><td colspan='2'>
72
- <h5><?php _e('Rejected booking email','events-manager') ?></h5>
73
- <em><?php echo __( 'This will be sent automatically when a booking is rejected. Not relevant if bookings don\'t require approval.', 'events-manager').$bookings_placeholder_tip ?></em>
74
- </td></tr>
75
- <?php
76
- em_options_input_text ( __( 'Booking rejected email subject', 'events-manager'), 'dbem_bookings_email_rejected_subject', $email_subject_tip );
77
- em_options_textarea ( __( 'Booking rejected email', 'events-manager'), 'dbem_bookings_email_rejected_body', '' );
78
- ?>
79
<tr class="em-subheader"><td colspan='2'>
80
<h5><?php _e('Booking cancelled','events-manager') ?></h5>
81
<em><?php echo __('This will be sent when a user cancels their booking.','events-manager').$bookings_placeholder_tip ?></em>
@@ -84,6 +76,14 @@
84
em_options_input_text ( __( 'Booking cancelled email subject', 'events-manager'), 'dbem_bookings_email_cancelled_subject', $email_subject_tip );
85
em_options_textarea ( __( 'Booking cancelled email', 'events-manager'), 'dbem_bookings_email_cancelled_body', '' );
86
?>
87
</tbody>
88
<?php do_action('em_options_page_booking_email_templates_options_bottom'); ?>
89
<?php echo $save_button; ?>
68
em_options_input_text ( __( 'Booking pending email subject', 'events-manager'), 'dbem_bookings_email_pending_subject', $email_subject_tip);
69
em_options_textarea ( __( 'Booking pending email', 'events-manager'), 'dbem_bookings_email_pending_body','') ;
70
?>
71
<tr class="em-subheader"><td colspan='2'>
72
<h5><?php _e('Booking cancelled','events-manager') ?></h5>
73
<em><?php echo __('This will be sent when a user cancels their booking.','events-manager').$bookings_placeholder_tip ?></em>
76
em_options_input_text ( __( 'Booking cancelled email subject', 'events-manager'), 'dbem_bookings_email_cancelled_subject', $email_subject_tip );
77
em_options_textarea ( __( 'Booking cancelled email', 'events-manager'), 'dbem_bookings_email_cancelled_body', '' );
78
?>
79
+ <tr class="em-subheader"><td colspan='2'>
80
+ <h5><?php _e('Rejected booking email','events-manager') ?></h5>
81
+ <em><?php echo __( 'This will be sent automatically when a booking is rejected. Not relevant if bookings don\'t require approval.', 'events-manager').$bookings_placeholder_tip ?></em>
82
+ </td></tr>
83
+ <?php
84
+ em_options_input_text ( __( 'Booking rejected email subject', 'events-manager'), 'dbem_bookings_email_rejected_subject', $email_subject_tip );
85
+ em_options_textarea ( __( 'Booking rejected email', 'events-manager'), 'dbem_bookings_email_rejected_body', '' );
86
+ ?>
87
</tbody>
88
<?php do_action('em_options_page_booking_email_templates_options_bottom'); ?>
89
<?php echo $save_button; ?>
admin/settings/tabs/formats.php CHANGED
@@ -162,6 +162,14 @@
162
em_options_radio_binary ( __( 'Link directly to event on day with single event?', 'events-manager'), 'dbem_calendar_direct_links', __( "If a calendar day has only one event, you can force a direct link to the event (recommended to avoid duplicate content).",'events-manager') );
163
em_options_radio_binary ( __( 'Show list on day with single event?', 'events-manager'), '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.",'events-manager') );
164
?>
165
<tr class="em-header"><td colspan="2"><h4><?php _e('Small Calendar','events-manager'); ?></h4></td></tr>
166
<?php
167
em_options_input_text ( __( 'Month format', 'events-manager'), 'dbem_small_calendar_month_format', __('The format of the month/year header of the calendar.','events-manager').' '.$date_time_format_tip);
@@ -170,14 +178,6 @@
170
em_options_radio_binary( __( 'Abbreviated weekdays', 'events-manager'), 'dbem_small_calendar_abbreviated_weekdays', __( 'The calendar headings uses abbreviated weekdays','events-manager') );
171
em_options_input_text ( __( 'Initial lengths', 'events-manager'), 'dbem_small_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'events-manager').$events_placeholder_tip );
172
em_options_radio_binary( __( 'Show Long Events?', 'events-manager'), 'dbem_small_calendar_long_events', __( 'Events with multiple dates will appear on each of those dates in the calendar.','events-manager') );
173
- ?>
174
- <tr class="em-header"><td colspan="2"><h4><?php _e('Full Calendar','events-manager'); ?></h4></td></tr>
175
- <?php
176
- em_options_input_text ( __( 'Month format', 'events-manager'), 'dbem_full_calendar_month_format', __('The format of the month/year header of the calendar.','events-manager').' '.$date_time_format_tip);
177
- em_options_input_text ( __( 'Event format', 'events-manager'), '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.', 'events-manager').$events_placeholder_tip );
178
- em_options_radio_binary( __( 'Abbreviated weekdays?', 'events-manager'), 'dbem_full_calendar_abbreviated_weekdays', __( 'Use abbreviations, e.g. Friday = Fri. Useful for certain languages where abbreviations differ from full names.','events-manager') );
179
- em_options_input_text ( __( 'Initial lengths', 'events-manager'), 'dbem_full_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'events-manager').$events_placeholder_tip);
180
- em_options_radio_binary( __( 'Show Long Events?', 'events-manager'), 'dbem_full_calendar_long_events', __( 'Events with multiple dates will appear on each of those dates in the calendar.','events-manager') );
181
?>
182
<tr class="em-header"><td colspan="2"><h4><?php echo __('Calendar Day Event List Settings','events-manager'); ?></h4></td></tr>
183
<tr valign="top" id='dbem_display_calendar_orderby_row'>
@@ -334,6 +334,9 @@
334
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Event Tags', 'events-manager'); ?> </span></h3>
335
<div class="inside">
336
<table class="form-table">
337
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','events-manager'),__('Tags','events-manager')); ?></h4></td></tr>
338
<?php
339
em_options_textarea ( sprintf(__('%s list header format','events-manager'),__('Tags','events-manager')), 'dbem_tags_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'events-manager'), __('tags','events-manager')) );
162
em_options_radio_binary ( __( 'Link directly to event on day with single event?', 'events-manager'), 'dbem_calendar_direct_links', __( "If a calendar day has only one event, you can force a direct link to the event (recommended to avoid duplicate content).",'events-manager') );
163
em_options_radio_binary ( __( 'Show list on day with single event?', 'events-manager'), '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.",'events-manager') );
164
?>
165
+ <tr class="em-header"><td colspan="2"><h4><?php _e('Full-Size Calendar','events-manager'); ?></h4></td></tr>
166
+ <?php
167
+ em_options_input_text ( __( 'Month format', 'events-manager'), 'dbem_full_calendar_month_format', __('The format of the month/year header of the calendar.','events-manager').' '.$date_time_format_tip);
168
+ em_options_input_text ( __( 'Event format', 'events-manager'), '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.', 'events-manager').$events_placeholder_tip );
169
+ em_options_radio_binary( __( 'Abbreviated weekdays?', 'events-manager'), 'dbem_full_calendar_abbreviated_weekdays', __( 'Use abbreviations, e.g. Friday = Fri. Useful for certain languages where abbreviations differ from full names.','events-manager') );
170
+ em_options_input_text ( __( 'Initial lengths', 'events-manager'), 'dbem_full_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'events-manager').$events_placeholder_tip);
171
+ em_options_radio_binary( __( 'Show Long Events?', 'events-manager'), 'dbem_full_calendar_long_events', __( 'Events with multiple dates will appear on each of those dates in the calendar.','events-manager') );
172
+ ?>
173
<tr class="em-header"><td colspan="2"><h4><?php _e('Small Calendar','events-manager'); ?></h4></td></tr>
174
<?php
175
em_options_input_text ( __( 'Month format', 'events-manager'), 'dbem_small_calendar_month_format', __('The format of the month/year header of the calendar.','events-manager').' '.$date_time_format_tip);
178
em_options_radio_binary( __( 'Abbreviated weekdays', 'events-manager'), 'dbem_small_calendar_abbreviated_weekdays', __( 'The calendar headings uses abbreviated weekdays','events-manager') );
179
em_options_input_text ( __( 'Initial lengths', 'events-manager'), 'dbem_small_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'events-manager').$events_placeholder_tip );
180
em_options_radio_binary( __( 'Show Long Events?', 'events-manager'), 'dbem_small_calendar_long_events', __( 'Events with multiple dates will appear on each of those dates in the calendar.','events-manager') );
181
?>
182
<tr class="em-header"><td colspan="2"><h4><?php echo __('Calendar Day Event List Settings','events-manager'); ?></h4></td></tr>
183
<tr valign="top" id='dbem_display_calendar_orderby_row'>
334
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Event Tags', 'events-manager'); ?> </span></h3>
335
<div class="inside">
336
<table class="form-table">
337
+ <?php
338
+ em_options_input_text(sprintf(esc_html__('Default %s color','events-manager'), esc_html__('tag','events-manager')), 'dbem_tag_default_color', sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'events-manager'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>'));
339
+ ?>
340
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','events-manager'),__('Tags','events-manager')); ?></h4></td></tr>
341
<?php
342
em_options_textarea ( sprintf(__('%s list header format','events-manager'),__('Tags','events-manager')), 'dbem_tags_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'events-manager'), __('tags','events-manager')) );
admin/settings/tabs/general.php CHANGED
@@ -87,7 +87,7 @@
87
88
<?php if ( !is_multisite() ){ em_admin_option_box_image_sizes(); } ?>
89
90
- <?php if ( !is_multisite() || (is_super_admin() && !get_site_option('dbem_ms_global_caps')) ){ em_admin_option_box_caps(); } ?>
91
92
<div class="postbox" id="em-opt-event-submissions" >
93
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Event Submission Forms', 'events-manager'); ?></span></h3>
87
88
<?php if ( !is_multisite() ){ em_admin_option_box_image_sizes(); } ?>
89
90
+ <?php if ( !is_multisite() || (em_wp_is_super_admin() && !get_site_option('dbem_ms_global_caps')) ){ em_admin_option_box_caps(); } ?>
91
92
<div class="postbox" id="em-opt-event-submissions" >
93
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Event Submission Forms', 'events-manager'); ?></span></h3>
admin/settings/tabs/pages.php CHANGED
@@ -64,7 +64,7 @@
64
<tbody class="em-event-page-options">
65
<?php
66
em_options_radio_binary ( __( 'Show events search?', 'events-manager'), 'dbem_events_page_search_form', __( "If set to yes, a search form will appear just above your list of events.", 'events-manager') );
67
- em_options_radio_binary ( __( 'Display calendar in events page?', 'events-manager'), '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.','events-manager').' '.__('If you would like to show events that span over more than one day, see the Calendar section on this page.','events-manager') );
68
em_options_radio_binary ( __( 'Disable title rewriting?', 'events-manager'), '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.",'events-manager') );
69
em_options_input_text ( __( 'Event Manager titles', 'events-manager'), '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.", 'events-manager') );
70
?>
@@ -143,14 +143,14 @@
143
<td>
144
<select name="dbem_events_default_orderby" >
145
<?php
146
- $orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
147
'event_start_date,event_start_time,event_name' => __('Order by start date, start time, then event name','events-manager'),
148
'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time','events-manager'),
149
'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time','events-manager'),
150
'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name','events-manager'),
151
));
152
?>
153
- <?php foreach($orderby_options as $key => $value) : ?>
154
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_orderby')) ? "selected='selected'" : ''; ?>>
155
<?php echo esc_html($value); ?>
156
</option>
@@ -160,7 +160,7 @@
160
<?php
161
$ascending = __('Ascending','events-manager');
162
$descending = __('Descending','events-manager');
163
- $order_options = apply_filters('em_settings_events_default_order_ddm', array(
164
'ASC' => __('All Ascending','events-manager'),
165
'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'events-manager'),
166
'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'events-manager'),
@@ -171,7 +171,7 @@
171
'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'events-manager'),
172
));
173
?>
174
- <?php foreach( $order_options as $key => $value) : ?>
175
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_order')) ? "selected='selected'" : ''; ?>>
176
<?php echo esc_html($value); ?>
177
</option>
@@ -202,6 +202,35 @@
202
em_options_input_text( __('Post Classes','events-manager'), 'dbem_cp_locations_post_class', $post_class_tip );
203
em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_locations_formats', sprintf($format_override_tip,__('locations','events-manager')));
204
em_options_radio_binary ( __( 'Enable Comments?', 'events-manager'), 'dbem_cp_locations_comments', sprintf(__('If you would like to disable comments entirely, disable this, otherwise you can disable comments on each single %s. Note that %s with comments enabled will still be until you resave them.','events-manager'),__('location','events-manager'),__('locations','events-manager')));
205
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_location_event_list_limit', sprintf(__( "Controls how many events being held at a location are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_LOCATIONNEXTEVENTS</code>') );
206
echo $save_button;
207
?>
@@ -242,13 +271,13 @@
242
<td>
243
<select name="dbem_locations_default_archive_orderby" >
244
<?php
245
- $orderby_options = apply_filters('em_settings_locations_default_archive_orderby_ddm', array(
246
'_location_country' => sprintf(__('Order by %s','events-manager'),__('Country','events-manager')),
247
'_location_town' => sprintf(__('Order by %s','events-manager'),__('Town','events-manager')),
248
'title' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager'))
249
));
250
?>
251
- <?php foreach($orderby_options as $key => $value) : ?>
252
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
253
<?php echo esc_html($value) ?>
254
</option>
@@ -258,12 +287,12 @@
258
<?php
259
$ascending = __('Ascending','events-manager');
260
$descending = __('Descending','events-manager');
261
- $order_options = apply_filters('em_settings_locations_default_archive_order_ddm', array(
262
'ASC' => __('Ascending','events-manager'),
263
'DESC' => __('Descending','events-manager')
264
));
265
?>
266
- <?php foreach( $order_options as $key => $value) : ?>
267
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_archive_order')) ? "selected='selected'" : ''; ?>>
268
<?php echo esc_html($value) ?>
269
</option>
@@ -293,13 +322,13 @@
293
<td>
294
<select name="dbem_locations_default_orderby" >
295
<?php
296
- $orderby_options = apply_filters('em_settings_locations_default_orderby_ddm', array(
297
'location_country' => sprintf(__('Order by %s','events-manager'),__('Country','events-manager')),
298
'location_town' => sprintf(__('Order by %s','events-manager'),__('Town','events-manager')),
299
'location_name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager'))
300
));
301
?>
302
- <?php foreach($orderby_options as $key => $value) : ?>
303
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_orderby')) ? "selected='selected'" : ''; ?>>
304
<?php echo esc_html($value) ?>
305
</option>
@@ -309,12 +338,12 @@
309
<?php
310
$ascending = __('Ascending','events-manager');
311
$descending = __('Descending','events-manager');
312
- $order_options = apply_filters('em_settings_locations_default_order_ddm', array(
313
'ASC' => __('Ascending','events-manager'),
314
'DESC' => __('Descending','events-manager')
315
));
316
?>
317
- <?php foreach( $order_options as $key => $value) : ?>
318
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_order')) ? "selected='selected'" : ''; ?>>
319
<?php echo esc_html($value) ?>
320
</option>
@@ -357,13 +386,14 @@
357
<tr class="em-header">
358
<td colspan="2">
359
<h4><?php echo _e('General settings','events-manager'); ?></h4>
360
</td>
361
</tr>
362
<?php
363
- em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_categories_formats', sprintf($format_override_tip,__('categories','events-manager'))." ".__('Setting this to yes will make categories display as a page rather than an archive.', 'events-manager'));
364
?>
365
- <tr valign="top">
366
- <th scope="row"><?php _e('Default archive ordering','events-manager'); ?></th>
367
<td>
368
<select name="dbem_categories_default_archive_orderby" >
369
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
@@ -379,7 +409,7 @@
379
</option>
380
<?php endforeach; ?>
381
</select>
382
- <br /><?php echo __('When listing events for a category, this order is applied.', 'events-manager'); ?>
383
</td>
384
</tr>
385
<tr class="em-header">
@@ -393,7 +423,7 @@
393
<td>
394
<select name="dbem_categories_default_orderby" >
395
<?php
396
- $orderby_options = apply_filters('em_settings_categories_default_orderby_ddm', array(
397
'id' => sprintf(__('Order by %s','events-manager'),__('ID','events-manager')),
398
'count' => sprintf(__('Order by %s','events-manager'),__('Count','events-manager')),
399
'name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager')),
@@ -401,7 +431,7 @@
401
'term_group' => sprintf(__('Order by %s','events-manager'),'term_group'),
402
));
403
?>
404
- <?php foreach($orderby_options as $key => $value) : ?>
405
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_orderby')) ? "selected='selected'" : ''; ?>>
406
<?php echo esc_html($value) ?>
407
</option>
@@ -411,12 +441,12 @@
411
<?php
412
$ascending = __('Ascending','events-manager');
413
$descending = __('Descending','events-manager');
414
- $order_options = apply_filters('em_settings_categories_default_order_ddm', array(
415
'ASC' => __('Ascending','events-manager'),
416
'DESC' => __('Descending','events-manager')
417
));
418
?>
419
- <?php foreach( $order_options as $key => $value) : ?>
420
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_order')) ? "selected='selected'" : ''; ?>>
421
<?php echo esc_html($value) ?>
422
</option>
@@ -427,8 +457,37 @@
427
</tr>
428
<?php
429
em_options_input_text ( __( 'List Limits', 'events-manager'), 'dbem_categories_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'events-manager'),__('categories','events-manager')) );
430
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_category_event_list_limit', sprintf(__( "Controls how many events belonging to a category are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_CATEGORYNEXTEVENTS</code>') );
431
- echo $save_button;
432
?>
433
</table>
434
</div> <!-- . inside -->
@@ -461,13 +520,14 @@
461
<tr class="em-header">
462
<td colspan="2">
463
<h4><?php echo _e('General settings','events-manager'); ?></h4>
464
</td>
465
</tr>
466
<?php
467
- em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_tags_formats', sprintf($format_override_tip,__('tags','events-manager')));
468
?>
469
- <tr valign="top">
470
- <th scope="row"><?php _e('Default archive ordering','events-manager'); ?></th>
471
<td>
472
<select name="dbem_tags_default_archive_orderby" >
473
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
@@ -483,6 +543,7 @@
483
</option>
484
<?php endforeach; ?>
485
</select>
486
</td>
487
</tr>
488
<tr class="em-header">
@@ -496,7 +557,7 @@
496
<td>
497
<select name="dbem_tags_default_orderby" >
498
<?php
499
- $orderby_options = apply_filters('em_settings_tags_default_orderby_ddm', array(
500
'id' => sprintf(__('Order by %s','events-manager'),__('ID','events-manager')),
501
'count' => sprintf(__('Order by %s','events-manager'),__('Count','events-manager')),
502
'name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager')),
@@ -504,7 +565,7 @@
504
'term_group' => sprintf(__('Order by %s','events-manager'),'term_group'),
505
));
506
?>
507
- <?php foreach($orderby_options as $key => $value) : ?>
508
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_orderby')) ? "selected='selected'" : ''; ?>>
509
<?php echo esc_html($value) ?>
510
</option>
@@ -514,12 +575,12 @@
514
<?php
515
$ascending = __('Ascending','events-manager');
516
$descending = __('Descending','events-manager');
517
- $order_options = apply_filters('em_settings_tags_default_order_ddm', array(
518
'ASC' => __('Ascending','events-manager'),
519
'DESC' => __('Descending','events-manager')
520
));
521
?>
522
- <?php foreach( $order_options as $key => $value) : ?>
523
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_order')) ? "selected='selected'" : ''; ?>>
524
<?php echo esc_html($value) ?>
525
</option>
@@ -530,6 +591,35 @@
530
</tr>
531
<?php
532
em_options_input_text ( __( 'List Limits', 'events-manager'), 'dbem_tags_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'events-manager'),__('tags','events-manager')) );
533
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_tag_event_list_limit', sprintf(__( "Controls how many events belonging to a tag are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_TAGNEXTEVENTS</code>') );
534
echo $save_button; ?>
535
</table>
64
<tbody class="em-event-page-options">
65
<?php
66
em_options_radio_binary ( __( 'Show events search?', 'events-manager'), 'dbem_events_page_search_form', __( "If set to yes, a search form will appear just above your list of events.", 'events-manager') );
67
+ em_options_radio_binary ( __( 'Display calendar in events page?', 'events-manager'), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the full-sized calendar on the events page, instead of the default list.','events-manager') );
68
em_options_radio_binary ( __( 'Disable title rewriting?', 'events-manager'), '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.",'events-manager') );
69
em_options_input_text ( __( 'Event Manager titles', 'events-manager'), '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.", 'events-manager') );
70
?>
143
<td>
144
<select name="dbem_events_default_orderby" >
145
<?php
146
+ $event_list_orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
147
'event_start_date,event_start_time,event_name' => __('Order by start date, start time, then event name','events-manager'),
148
'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time','events-manager'),
149
'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time','events-manager'),
150
'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name','events-manager'),
151
));
152
?>
153
+ <?php foreach($event_list_orderby_options as $key => $value) : ?>
154
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_orderby')) ? "selected='selected'" : ''; ?>>
155
<?php echo esc_html($value); ?>
156
</option>
160
<?php
161
$ascending = __('Ascending','events-manager');
162
$descending = __('Descending','events-manager');
163
+ $event_list_order_options = apply_filters('em_settings_events_default_order_ddm', array(
164
'ASC' => __('All Ascending','events-manager'),
165
'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'events-manager'),
166
'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'events-manager'),
171
'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'events-manager'),
172
));
173
?>
174
+ <?php foreach( $event_list_order_options as $key => $value) : ?>
175
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_order')) ? "selected='selected'" : ''; ?>>
176
<?php echo esc_html($value); ?>
177
</option>
202
em_options_input_text( __('Post Classes','events-manager'), 'dbem_cp_locations_post_class', $post_class_tip );
203
em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_locations_formats', sprintf($format_override_tip,__('locations','events-manager')));
204
em_options_radio_binary ( __( 'Enable Comments?', 'events-manager'), 'dbem_cp_locations_comments', sprintf(__('If you would like to disable comments entirely, disable this, otherwise you can disable comments on each single %s. Note that %s with comments enabled will still be until you resave them.','events-manager'),__('location','events-manager'),__('locations','events-manager')));
205
+ ?>
206
+ <tr class="em-header">
207
+ <td colspan="2">
208
+ <h4><?php echo sprintf(esc_html__('Default %s list options','events-manager'), __('event','events-manager')); ?></h4>
209
+ <p><?php echo sprintf(esc_html__('The options below are applied to the %s placeholders.', 'events-manager'), '<code>#_LOCATIONNEXTEVENTS</code>, <code>#_LOCATIONPASTEVENTS</code>, <code>#_LOCATIONALLEVENTS</code>'); ?></p>
210
+ </td>
211
+ </tr>
212
+ <tr valign="top" id='dbem_location_events_default_orderby_row'>
213
+ <th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
214
+ <td>
215
+ <select name="dbem_location_event_list_orderby" >
216
+ <?php foreach($event_list_orderby_options as $key => $value) : ?>
217
+ <option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_location_event_list_orderby')) ? "selected='selected'" : ''; ?>>
218
+ <?php echo esc_html($value); ?>
219
+ </option>
220
+ <?php endforeach; ?>
221
+ </select>
222
+ <select name="dbem_location_event_list_order" >
223
+ <?php foreach( $event_list_order_options as $key => $value) : ?>
224
+ <option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_location_event_list_order')) ? "selected='selected'" : ''; ?>>
225
+ <?php echo esc_html($value); ?>
226
+ </option>
227
+ <?php endforeach; ?>
228
+ </select>
229
+ <br/>
230
+ <em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
231
+ </td>
232
+ </tr>
233
+ <?php
234
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_location_event_list_limit', sprintf(__( "Controls how many events being held at a location are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_LOCATIONNEXTEVENTS</code>') );
235
echo $save_button;
236
?>
271
<td>
272
<select name="dbem_locations_default_archive_orderby" >
273
<?php
274
+ $locations_list_orderby_options = apply_filters('em_settings_locations_default_archive_orderby_ddm', array(
275
'_location_country' => sprintf(__('Order by %s','events-manager'),__('Country','events-manager')),
276
'_location_town' => sprintf(__('Order by %s','events-manager'),__('Town','events-manager')),
277
'title' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager'))
278
));
279
?>
280
+ <?php foreach($locations_list_orderby_options as $key => $value) : ?>
281
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
282
<?php echo esc_html($value) ?>
283
</option>
287
<?php
288
$ascending = __('Ascending','events-manager');
289
$descending = __('Descending','events-manager');
290
+ $locations_list_order_options = apply_filters('em_settings_locations_default_archive_order_ddm', array(
291
'ASC' => __('Ascending','events-manager'),
292
'DESC' => __('Descending','events-manager')
293
));
294
?>
295
+ <?php foreach( $locations_list_order_options as $key => $value) : ?>
296
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_archive_order')) ? "selected='selected'" : ''; ?>>
297
<?php echo esc_html($value) ?>
298
</option>
322
<td>
323
<select name="dbem_locations_default_orderby" >
324
<?php
325
+ $locations_list_orderby_options = apply_filters('em_settings_locations_default_orderby_ddm', array(
326
'location_country' => sprintf(__('Order by %s','events-manager'),__('Country','events-manager')),
327
'location_town' => sprintf(__('Order by %s','events-manager'),__('Town','events-manager')),
328
'location_name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager'))
329
));
330
?>
331
+ <?php foreach($locations_list_orderby_options as $key => $value) : ?>
332
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_orderby')) ? "selected='selected'" : ''; ?>>
333
<?php echo esc_html($value) ?>
334
</option>
338
<?php
339
$ascending = __('Ascending','events-manager');
340
$descending = __('Descending','events-manager');
341
+ $locations_list_order_options = apply_filters('em_settings_locations_default_order_ddm', array(
342
'ASC' => __('Ascending','events-manager'),
343
'DESC' => __('Descending','events-manager')
344
));
345
?>
346
+ <?php foreach( $locations_list_order_options as $key => $value) : ?>
347
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_order')) ? "selected='selected'" : ''; ?>>
348
<?php echo esc_html($value) ?>
349
</option>
386
<tr class="em-header">
387
<td colspan="2">
388
<h4><?php echo _e('General settings','events-manager'); ?></h4>
389
+ <p><?php echo esc_html(sprintf(__('Viewing a general WordPress taxonomy page such as %s will show a list of events just like it would regular posts for a regular category or tag. Below you can edit things such as the order events are displayed, or completely override the archive look with our formats feature.','events-manager'), __('categories', 'events-manager'))); ?></p>
390
</td>
391
</tr>
392
<?php
393
+ em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_categories_formats', sprintf($format_override_tip,__('categories','events-manager'))." ".__('Setting this to yes will make categories display as a page rather than an archive.', 'events-manager'), '', '.em-default-categories-archive-ordering', true);
394
?>
395
+ <tr valign="top" class="em-default-categories-archive-ordering">
396
+ <th scope="row"><?php _e('Default event archive ordering','events-manager'); ?></th>
397
<td>
398
<select name="dbem_categories_default_archive_orderby" >
399
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
409
</option>
410
<?php endforeach; ?>
411
</select>
412
+ <br /><?php echo esc_html(sprintf(__('When listing event archives for a %s, this order is applied.', 'events-manager'), __('category', 'events-manager'))); ?>
413
</td>
414
</tr>
415
<tr class="em-header">
423
<td>
424
<select name="dbem_categories_default_orderby" >
425
<?php
426
+ $categories_list_orderby_options = apply_filters('em_settings_categories_default_orderby_ddm', array(
427
'id' => sprintf(__('Order by %s','events-manager'),__('ID','events-manager')),
428
'count' => sprintf(__('Order by %s','events-manager'),__('Count','events-manager')),
429
'name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager')),
431
'term_group' => sprintf(__('Order by %s','events-manager'),'term_group'),
432
));
433
?>
434
+ <?php foreach($categories_list_orderby_options as $key => $value) : ?>
435
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_orderby')) ? "selected='selected'" : ''; ?>>
436
<?php echo esc_html($value) ?>
437
</option>
441
<?php
442
$ascending = __('Ascending','events-manager');
443
$descending = __('Descending','events-manager');
444
+ $categories_list_order_options = apply_filters('em_settings_categories_default_order_ddm', array(
445
'ASC' => __('Ascending','events-manager'),
446
'DESC' => __('Descending','events-manager')
447
));
448
?>
449
+ <?php foreach( $categories_list_order_options as $key => $value) : ?>
450
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_order')) ? "selected='selected'" : ''; ?>>
451
<?php echo esc_html($value) ?>
452
</option>
457
</tr>
458
<?php
459
em_options_input_text ( __( 'List Limits', 'events-manager'), 'dbem_categories_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'events-manager'),__('categories','events-manager')) );
460
+ ?>
461
+ <tr class="em-header">
462
+ <td colspan="2">
463
+ <h4><?php echo sprintf(esc_html__('Default %s list options','events-manager'), __('event','events-manager')); ?></h4>
464
+ <p><?php echo sprintf(esc_html__('The options below are applied to the %s placeholders.', 'events-manager'), '<code>#_CATEGORYPASTEVENTS</code>, <code>#_CATEGORYNEXTEVENTS</code>, <code>#_CATEGORYALLEVENTS</code>'); ?></p>
465
+ </td>
466
+ </tr>
467
+ <tr valign="top" id='dbem_category_events_default_orderby_row'>
468
+ <th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
469
+ <td>
470
+ <select name="dbem_category_event_list_orderby" >
471
+ <?php foreach($event_list_orderby_options as $key => $value) : ?>
472
+ <option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_category_event_list_orderby')) ? "selected='selected'" : ''; ?>>
473
+ <?php echo esc_html($value); ?>
474
+ </option>
475
+ <?php endforeach; ?>
476
+ </select>
477
+ <select name="dbem_category_event_list_order" >
478
+ <?php foreach( $event_list_order_options as $key => $value) : ?>
479
+ <option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_category_event_list_order')) ? "selected='selected'" : ''; ?>>
480
+ <?php echo esc_html($value); ?>
481
+ </option>
482
+ <?php endforeach; ?>
483
+ </select>
484
+ <br/>
485
+ <em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
486
+ </td>
487
+ </tr>
488
+ <?php
489
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_category_event_list_limit', sprintf(__( "Controls how many events belonging to a category are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_CATEGORYNEXTEVENTS</code>') );
490
+ echo $save_button;
491
?>
492
</table>
493
</div> <!-- . inside -->
520
<tr class="em-header">
521
<td colspan="2">
522
<h4><?php echo _e('General settings','events-manager'); ?></h4>
523
+ <p><?php echo esc_html(sprintf(__('Viewing a general WordPress taxonomy page such as %s will show a list of events just like it would regular posts for a regular category or tag. Below you can edit things such as the order events are displayed, or completely override the archive look with our formats feature.','events-manager'), __('tags', 'events-manager'))); ?></p>
524
</td>
525
</tr>
526
<?php
527
+ em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_tags_formats', sprintf($format_override_tip,__('tags','events-manager')), '', '.em-default-tags-archive-ordering', true);
528
?>
529
+ <tr valign="top" class="em-default-tags-archive-ordering">
530
+ <th scope="row"><?php _e('Default event archive ordering','events-manager'); ?></th>
531
<td>
532
<select name="dbem_tags_default_archive_orderby" >
533
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
543
</option>
544
<?php endforeach; ?>
545
</select>
546
+ <br /><?php echo esc_html(sprintf(__('When listing event archives for a %s, this order is applied.', 'events-manager'), __('tag', 'events-manager'))); ?>
547
</td>
548
</tr>
549
<tr class="em-header">
557
<td>
558
<select name="dbem_tags_default_orderby" >
559
<?php
560
+ $tags_list_orderby_options = apply_filters('em_settings_tags_default_orderby_ddm', array(
561
'id' => sprintf(__('Order by %s','events-manager'),__('ID','events-manager')),
562
'count' => sprintf(__('Order by %s','events-manager'),__('Count','events-manager')),
563
'name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager')),
565
'term_group' => sprintf(__('Order by %s','events-manager'),'term_group'),
566
));
567
?>
568
+ <?php foreach($tags_list_orderby_options as $key => $value) : ?>
569
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_orderby')) ? "selected='selected'" : ''; ?>>
570
<?php echo esc_html($value) ?>
571
</option>
575
<?php
576
$ascending = __('Ascending','events-manager');
577
$descending = __('Descending','events-manager');
578
+ $tags_list_order_options = apply_filters('em_settings_tags_default_order_ddm', array(
579
'ASC' => __('Ascending','events-manager'),
580
'DESC' => __('Descending','events-manager')
581
));
582
?>
583
+ <?php foreach( $tags_list_order_options as $key => $value) : ?>
584
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_order')) ? "selected='selected'" : ''; ?>>
585
<?php echo esc_html($value) ?>
586
</option>
591
</tr>
592
<?php
593
em_options_input_text ( __( 'List Limits', 'events-manager'), 'dbem_tags_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'events-manager'),__('tags','events-manager')) );
594
+ ?>
595
+ <tr class="em-header">
596
+ <td colspan="2">
597
+ <h4><?php echo sprintf(esc_html__('Default %s list options','events-manager'), __('event','events-manager')); ?></h4>
598
+ <p><?php echo sprintf(esc_html__('The options below are applied to the %s placeholders.', 'events-manager'), '<code>#_TAGPASTEVENTS</code>, <code>#_TAGNEXTEVENTS</code>, <code>#_TAGALLEVENTS</code>'); ?></p>
599
+ </td>
600
+ </tr>
601
+ <tr valign="top" id='dbem_tag_events_default_orderby_row'>
602
+ <th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
603
+ <td>
604
+ <select name="dbem_tag_event_list_orderby" >
605
+ <?php foreach($event_list_orderby_options as $key => $value) : ?>
606
+ <option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tag_event_list_orderby')) ? "selected='selected'" : ''; ?>>
607
+ <?php echo esc_html($value); ?>
608
+ </option>
609
+ <?php endforeach; ?>
610
+ </select>
611
+ <select name="dbem_tag_event_list_order" >
612
+ <?php foreach( $event_list_order_options as $key => $value) : ?>
613
+ <option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tag_event_list_order')) ? "selected='selected'" : ''; ?>>
614
+ <?php echo esc_html($value); ?>
615
+ </option>
616
+ <?php endforeach; ?>
617
+ </select>
618
+ <br/>
619
+ <em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
620
+ </td>
621
+ </tr>
622
+ <?php
623
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_tag_event_list_limit', sprintf(__( "Controls how many events belonging to a tag are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_TAGNEXTEVENTS</code>') );
624
echo $save_button; ?>
625
</table>
buddypress/bp-em-notifications.php CHANGED
@@ -54,10 +54,8 @@ function bp_em_format_notifications( $action, $item_id, $secondary_item_id, $tot
54
*/
55
function bp_em_remove_screen_notifications() {
56
global $bp;
57
- if( function_exists('bp_notifications_delete_notifications_by_type') ){ //backwards compat for BP 1.9
58
bp_notifications_delete_notifications_by_type( $bp->loggedin_user->id, $bp->events->slug, 'attending' );
59
- }else{
60
- bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->events->slug, 'attending' );
61
}
62
}
63
add_action( 'bp_em_my_events', 'bp_em_remove_screen_notifications' );
54
*/
55
function bp_em_remove_screen_notifications() {
56
global $bp;
57
+ if( function_exists('bp_notifications_delete_notifications_by_type') ){
58
bp_notifications_delete_notifications_by_type( $bp->loggedin_user->id, $bp->events->slug, 'attending' );
59
}
60
}
61
add_action( 'bp_em_my_events', 'bp_em_remove_screen_notifications' );
classes/em-booking.php CHANGED
@@ -102,7 +102,7 @@ class EM_Booking extends EM_Object{
102
var $manage_override;
103
104
/**
105
- * Creates booking object and retreives booking data (default is a blank booking object). Accepts either array of booking data (from db) or a booking id.
106
* @param mixed $booking_data
107
* @return null
108
*/
@@ -115,7 +115,7 @@ class EM_Booking extends EM_Object{
115
if( is_array($booking_data) ){
116
$booking = $booking_data;
117
}elseif( is_numeric($booking_data) ){
118
- //Retreiving from the database
119
$sql = "SELECT * FROM ". EM_BOOKINGS_TABLE ." WHERE booking_id ='$booking_data'";
120
$booking = $wpdb->get_row($sql, ARRAY_A);
121
}
@@ -140,7 +140,7 @@ class EM_Booking extends EM_Object{
140
//do some legacy checking here for bookings made prior to 5.4, due to how taxes are calculated
141
$this->get_tax_rate();
142
if( !empty($this->legacy_tax_rate) ){
143
- //reset booking_price, it'll be recalculated later (if you're using this property directly, don't, use $this->get_price())
144
$this->booking_price = $this->booking_taxes = null;
145
}
146
do_action('em_booking', $this, $booking_data);
@@ -224,7 +224,7 @@ class EM_Booking extends EM_Object{
224
}
225
226
/**
227
- * Load an record into this object by passing an associative array of table criterie to search for.
228
* Returns boolean depending on whether a record is found or not.
229
* @param $search
230
* @return boolean
@@ -285,7 +285,7 @@ class EM_Booking extends EM_Object{
285
//get person
286
$this->get_person();
287
//re-run compatiblity keys function
288
- $this->compat_keys(); //depricating in 6.0
289
}
290
return apply_filters('em_booking_get_post',count($this->errors) == 0,$this);
291
}
@@ -329,7 +329,7 @@ class EM_Booking extends EM_Object{
329
}
330
331
/**
332
- * Get the total number of spaces booked in THIS booking. Seting $force_refresh to true will recheck spaces, even if previously done so.
333
* @param unknown_type $force_refresh
334
* @return mixed
335
*/
@@ -376,12 +376,14 @@ class EM_Booking extends EM_Object{
376
return $price;
377
}
378
379
- function get_price_pre_taxes( $format = false ){
380
$price = $base_price = $this->get_price_base();
381
//apply pre-tax discounts
382
- $price -= $this->get_price_adjustments_amount('discounts', 'pre', $base_price);
383
- $price += $this->get_price_adjustments_amount('surcharges', 'pre', $base_price);
384
- $price = apply_filters('em_booking_get_price_pre_taxes', $price, $base_price, $this);
385
if( $price < 0 ){ $price = 0; } //no negative prices
386
//return amount of taxes applied, formatted or not
387
if( $format ) return $this->format_price($price);
@@ -393,9 +395,9 @@ class EM_Booking extends EM_Object{
393
* @param boolean $format
394
* @return double|string
395
*/
396
- function get_price_post_taxes( $format = false ){
397
//get price before taxes
398
- $price = $this->get_price_pre_taxes();
399
//add taxes to price
400
if( $this->get_tax_rate() > 0 ){
401
$this->booking_taxes = $price * ($this->get_tax_rate()/100); //calculate and save tax amount
@@ -404,9 +406,11 @@ class EM_Booking extends EM_Object{
404
}
405
//apply post-tax discounts
406
$price_after_taxes = $price;
407
- $price -= $this->get_price_adjustments_amount('discounts', 'post', $price_after_taxes);
408
- $price += $this->get_price_adjustments_amount('surcharges', 'post', $price_after_taxes);
409
- $price = apply_filters('em_booking_get_price_post_taxes', $price, $price_after_taxes, $this);
410
if( $price < 0 ){ $price = 0; } //no negative prices
411
//return amount of taxes applied, formatted or not
412
if( $format ) return $this->format_price($price);
@@ -625,7 +629,7 @@ class EM_Booking extends EM_Object{
625
/* Get Objects linked to booking */
626
627
/**
628
- * Gets the event this booking belongs to and saves a refernece in the event property
629
* @return EM_Event
630
*/
631
function get_event(){
@@ -843,7 +847,7 @@ class EM_Booking extends EM_Object{
843
844
function cancel($email = true){
845
if( $this->person->ID == get_current_user_id() ){
846
- $this->manage_override = true; //normally, users can't manage a bookiing, only event owners, so we allow them to mod their booking status in this case only.
847
}
848
return $this->set_status(3, $email);
849
}
102
var $manage_override;
103
104
/**
105
+ * Creates booking object and retrieves booking data (default is a blank booking object). Accepts either array of booking data (from db) or a booking id.
106
* @param mixed $booking_data
107
* @return null
108
*/
115
if( is_array($booking_data) ){
116
$booking = $booking_data;
117
}elseif( is_numeric($booking_data) ){
118
+ //Retrieving from the database
119
$sql = "SELECT * FROM ". EM_BOOKINGS_TABLE ." WHERE booking_id ='$booking_data'";
120
$booking = $wpdb->get_row($sql, ARRAY_A);
121
}
140
//do some legacy checking here for bookings made prior to 5.4, due to how taxes are calculated
141
$this->get_tax_rate();
142
if( !empty($this->legacy_tax_rate) ){
143
+ //reset booking_price, it'll be recalculated later (if you're using this property directly, don't use $this->get_price())
144
$this->booking_price = $this->booking_taxes = null;
145
}
146
do_action('em_booking', $this, $booking_data);
224
}
225
226
/**
227
+ * Load an record into this object by passing an associative array of table criteria to search for.
228
* Returns boolean depending on whether a record is found or not.
229
* @param $search
230
* @return boolean
285
//get person
286
$this->get_person();
287
//re-run compatiblity keys function
288
+ $this->compat_keys(); //depracating in 6.0
289
}
290
return apply_filters('em_booking_get_post',count($this->errors) == 0,$this);
291
}
329
}
330
331
/**
332
+ * Get the total number of spaces booked in THIS booking. Setting $force_refresh to true will recheck spaces, even if previously done so.
333
* @param unknown_type $force_refresh
334
* @return mixed
335
*/
376
return $price;
377
}
378
379
+ function get_price_pre_taxes( $format = false, $include_adjustments = true ){
380
$price = $base_price = $this->get_price_base();
381
//apply pre-tax discounts
382
+ if( $include_adjustments ){
383
+ $price -= $this->get_price_adjustments_amount('discounts', 'pre', $base_price);
384
+ $price += $this->get_price_adjustments_amount('surcharges', 'pre', $base_price);
385
+ }
386
+ $price = apply_filters('em_booking_get_price_pre_taxes', $price, $base_price, $this, $include_adjustments);
387
if( $price < 0 ){ $price = 0; } //no negative prices
388
//return amount of taxes applied, formatted or not
389
if( $format ) return $this->format_price($price);
395
* @param boolean $format
396
* @return double|string
397
*/
398
+ function get_price_post_taxes( $format = false, $include_adjustments = true ){
399
//get price before taxes
400
+ $price = $this->get_price_pre_taxes( false, $include_adjustments );
401
//add taxes to price
402
if( $this->get_tax_rate() > 0 ){
403
$this->booking_taxes = $price * ($this->get_tax_rate()/100); //calculate and save tax amount
406
}
407
//apply post-tax discounts
408
$price_after_taxes = $price;
409
+ if( $include_adjustments ){
410
+ $price -= $this->get_price_adjustments_amount('discounts', 'post', $price_after_taxes);
411
+ $price += $this->get_price_adjustments_amount('surcharges', 'post', $price_after_taxes);
412
+ }
413
+ $price = apply_filters('em_booking_get_price_post_taxes', $price, $price_after_taxes, $this, $include_adjustments);
414
if( $price < 0 ){ $price = 0; } //no negative prices
415
//return amount of taxes applied, formatted or not
416
if( $format ) return $this->format_price($price);
629
/* Get Objects linked to booking */
630
631
/**
632
+ * Gets the event this booking belongs to and saves a reference in the event property
633
* @return EM_Event
634
*/
635
function get_event(){
847
848
function cancel($email = true){
849
if( $this->person->ID == get_current_user_id() ){
850
+ $this->manage_override = true; //normally, users can't manage a booking, only event owners, so we allow them to mod their booking status in this case only.
851
}
852
return $this->set_status(3, $email);
853
}
classes/em-bookings-table.php CHANGED
@@ -69,8 +69,8 @@ class EM_Bookings_Table{
69
$this->limit = ( !empty($_REQUEST['limit']) && is_numeric($_REQUEST['limit'])) ? $_REQUEST['limit'] : 20;//Default limit
70
$this->page = ( !empty($_REQUEST['pno']) && is_numeric($_REQUEST['pno']) ) ? $_REQUEST['pno']:1;
71
$this->offset = ( $this->page > 1 ) ? ($this->page-1)*$this->limit : 0;
72
- $this->scope = ( !empty($_REQUEST['scope']) && array_key_exists($_REQUEST ['scope'], em_get_scopes()) ) ? sanitize_text_field($_REQUEST['scope']):get_option('dbem_default_bookings_search','future');
73
- $this->status = ( !empty($_REQUEST['status']) && array_key_exists($_REQUEST['status'], $this->statuses) ) ? sanitize_text_field($_REQUEST['status']):get_option('dbem_default_bookings_search','needs-attention');
74
//build template of possible collumns
75
$this->cols_template = apply_filters('em_bookings_table_cols_template', array(
76
'user_name'=>__('Name','events-manager'),
69
$this->limit = ( !empty($_REQUEST['limit']) && is_numeric($_REQUEST['limit'])) ? $_REQUEST['limit'] : 20;//Default limit
70
$this->page = ( !empty($_REQUEST['pno']) && is_numeric($_REQUEST['pno']) ) ? $_REQUEST['pno']:1;
71
$this->offset = ( $this->page > 1 ) ? ($this->page-1)*$this->limit : 0;
72
+ $this->scope = ( !empty($_REQUEST['scope']) && array_key_exists($_REQUEST ['scope'], em_get_scopes()) ) ? sanitize_text_field($_REQUEST['scope']):'future';
73
+ $this->status = ( !empty($_REQUEST['status']) && array_key_exists($_REQUEST['status'], $this->statuses) ) ? sanitize_text_field($_REQUEST['status']):'needs-attention';
74
//build template of possible collumns
75
$this->cols_template = apply_filters('em_bookings_table_cols_template', array(
76
'user_name'=>__('Name','events-manager'),
classes/em-bookings.php CHANGED
@@ -10,7 +10,7 @@ class EM_Bookings extends EM_Object implements Iterator{
10
* Array of EM_Booking objects for a specific event
11
* @var array
12
*/
13
- var $bookings = array();
14
/**
15
* @var EM_Tickets
16
*/
@@ -39,6 +39,10 @@ class EM_Bookings extends EM_Object implements Iterator{
39
*/
40
public static $disable_restrictions = false;
41
42
/**
43
* Creates an EM_Bookings instance, currently accepts an EM_Event object (gets all bookings for that event) or array of any EM_Booking objects, which can be manipulated in bulk with helper functions.
44
* @param EM_Event $event
@@ -46,9 +50,53 @@ class EM_Bookings extends EM_Object implements Iterator{
46
*/
47
function __construct( $data = false ){
48
if( is_object($data) && get_class($data) == "EM_Event" ){ //Creates a blank bookings object if needed
49
- global $wpdb;
50
$this->event_id = $data->event_id;
51
- $bookings = array();
52
if( $this->event_id > 0 ){
53
$sql = "SELECT * FROM ". EM_BOOKINGS_TABLE ." WHERE event_id ='{$this->event_id}' ORDER BY booking_date";
54
$bookings = $wpdb->get_results($sql, ARRAY_A);
@@ -56,14 +104,8 @@ class EM_Bookings extends EM_Object implements Iterator{
56
foreach ($bookings as $booking){
57
$this->bookings[] = em_get_booking($booking);
58
}
59
- $this->spaces = $this->get_spaces();
60
- }elseif( is_array($data) ){
61
- foreach( $data as $EM_Booking ){
62
- if( get_class($EM_Booking) == 'EM_Booking'){
63
- $this->bookings[] = $EM_Booking;
64
- }
65
- }
66
}
67
}
68
69
/**
@@ -83,7 +125,7 @@ class EM_Bookings extends EM_Object implements Iterator{
83
if($result){
84
//Success
85
do_action('em_bookings_added', $EM_Booking);
86
- $this->bookings[] = $EM_Booking;
87
$email = $EM_Booking->email();
88
if( get_option('dbem_bookings_approval') == 1 && $EM_Booking->booking_status == 0){
89
$this->feedback_message = get_option('dbem_booking_feedback_pending');
@@ -168,7 +210,7 @@ class EM_Bookings extends EM_Object implements Iterator{
168
$EM_Event->rsvp_end = $EM_Ticket->end_timestamp;
169
if( $EM_Event->is_recurring() && !empty($EM_Ticket->ticket_meta['recurrences']) ){
170
$EM_Event->recurrence_rsvp_days = $EM_Ticket->ticket_meta['recurrences']['end_days'];
171
- }
172
}else{
173
//if no end date is set, use event end date (which will have defaulted to the event start date
174
$EM_Ticket->ticket_end = $EM_Event->event_rsvp_date." ".$EM_Event->event_rsvp_time;
@@ -201,16 +243,16 @@ class EM_Bookings extends EM_Object implements Iterator{
201
return apply_filters('em_bookings_get_available_tickets', $EM_Tickets, $this);
202
}
203
204
function get_user_list(){
205
- $users = array();
206
- foreach( $this->get_bookings()->bookings as $EM_Booking ){
207
- $users[$EM_Booking->person->ID] = $EM_Booking->person;
208
- }
209
- return $users;
210
}
211
212
/**
213
- * does this ticket exist?
214
* @return bool
215
*/
216
function ticket_exists($ticket_id){
@@ -251,16 +293,26 @@ class EM_Bookings extends EM_Object implements Iterator{
251
function delete(){
252
global $wpdb;
253
$booking_ids = array();
254
- //get the booking ids tied to this event
255
- foreach( $this->bookings as $EM_Booking ){
256
- $booking_ids[] = $EM_Booking->booking_id;
257
- }
258
- $result_tickets = true;
259
- $result = true;
260
- if( count($booking_ids) > 0 ){
261
- //Delete bookings and ticket bookings
262
- $result_tickets = $wpdb->query("DELETE FROM ". EM_TICKETS_BOOKINGS_TABLE ." WHERE booking_id IN (".implode(',',$booking_ids).");");
263
- $result = $wpdb->query("DELETE FROM ".EM_BOOKINGS_TABLE." WHERE booking_id IN (".implode(',',$booking_ids).")");
264
}
265
do_action('em_bookings_deleted', $result, $booking_ids);
266
return apply_filters('em_bookings_delete', $result !== false && $result_tickets !== false, $booking_ids, $this);
@@ -364,30 +416,31 @@ class EM_Bookings extends EM_Object implements Iterator{
364
* @return int
365
*/
366
function get_booked_spaces($force_refresh = false){
367
- $booked_spaces = 0;
368
- foreach ( $this->bookings as $EM_Booking ){
369
- if( $EM_Booking->booking_status == 1 || (!get_option('dbem_bookings_approval') && $EM_Booking->booking_status == 0 ) ){
370
- $booked_spaces += $EM_Booking->get_spaces($force_refresh);
371
- }
372
}
373
- return apply_filters('em_bookings_get_booked_spaces', $booked_spaces, $this);
374
}
375
376
/**
377
* Gets number of pending spaces awaiting approval. Will return 0 if booking approval is not enabled.
378
* @return int
379
*/
380
- function get_pending_spaces(){
381
if( get_option('dbem_bookings_approval') == 0 ){
382
return apply_filters('em_bookings_get_pending_spaces', 0, $this);
383
}
384
- $pending = 0;
385
- foreach ( $this->bookings as $booking ){
386
- if($booking->booking_status == 0){
387
- $pending += $booking->get_spaces();
388
- }
389
}
390
- return apply_filters('em_bookings_get_pending_spaces', $pending, $this);
391
}
392
393
/**
@@ -396,9 +449,9 @@ class EM_Bookings extends EM_Object implements Iterator{
396
*/
397
function get_bookings( $all_bookings = false ){
398
$confirmed = array();
399
- foreach ( $this->bookings as $booking ){
400
- if( $booking->booking_status == 1 || (get_option('dbem_bookings_approval') == 0 && $booking->booking_status == 0) || $all_bookings ){
401
- $confirmed[] = $booking;
402
}
403
}
404
$EM_Bookings = new EM_Bookings($confirmed);
@@ -414,9 +467,9 @@ class EM_Bookings extends EM_Object implements Iterator{
414
return new EM_Bookings();
415
}
416
$pending = array();
417
- foreach ( $this->bookings as $booking ){
418
- if($booking->booking_status == 0){
419
- $pending[] = $booking;
420
}
421
}
422
$EM_Bookings = new EM_Bookings($pending);
@@ -429,9 +482,9 @@ class EM_Bookings extends EM_Object implements Iterator{
429
*/
430
function get_rejected_bookings(){
431
$rejected = array();
432
- foreach ( $this->bookings as $booking ){
433
- if($booking->booking_status == 2){
434
- $rejected[] = $booking;
435
}
436
}
437
$EM_Bookings = new EM_Bookings($rejected);
@@ -444,9 +497,9 @@ class EM_Bookings extends EM_Object implements Iterator{
444
*/
445
function get_cancelled_bookings(){
446
$cancelled = array();
447
- foreach ( $this->bookings as $booking ){
448
- if($booking->booking_status == 3){
449
- $cancelled[] = $booking;
450
}
451
}
452
$EM_Bookings = new EM_Bookings($cancelled);
@@ -464,7 +517,7 @@ class EM_Bookings extends EM_Object implements Iterator{
464
//If person exists on record, see if they've booked this event before, if so return the booking.
465
if( is_numeric($EM_Booking->person->ID) && $EM_Booking->person->ID > 0 ){
466
$EM_Booking->person_id = $EM_Booking->person->ID;
467
- foreach ($this->bookings as $booking){
468
if( $booking->person_id == $EM_Booking->person->ID ){
469
return $booking;
470
}
@@ -482,7 +535,7 @@ class EM_Bookings extends EM_Object implements Iterator{
482
$user_id = get_current_user_id();
483
}
484
if( is_numeric($user_id) && $user_id > 0 ){
485
- foreach ($this->bookings as $EM_Booking){
486
if( $EM_Booking->person->ID == $user_id && !in_array($EM_Booking->booking_status, array(2,3)) ){
487
return apply_filters('em_bookings_has_booking', $EM_Booking, $this);
488
}
@@ -534,9 +587,14 @@ class EM_Bookings extends EM_Object implements Iterator{
534
$orderby = self::build_sql_orderby($args, $accepted_fields);
535
//Now, build orderby sql
536
$orderby_sql = ( count($orderby) > 0 ) ? 'ORDER BY '. implode(', ', $orderby) : 'ORDER BY booking_date';
537
- //Selector
538
- $selectors = ( $count ) ? 'COUNT(*)':'*';
539
-
540
//Create the SQL statement and execute
541
$sql = apply_filters('em_bookings_get_sql',"
542
SELECT $selectors FROM $bookings_table
@@ -681,7 +739,8 @@ class EM_Bookings extends EM_Object implements Iterator{
681
'status' => false,
682
'person' => true, //to add later, search by person's bookings...
683
'blog' => get_current_blog_id(),
684
- 'ticket_id' => false
685
);
686
//sort out whether defaults were supplied or just the array of search values
687
if( empty($array) ){
@@ -689,6 +748,25 @@ class EM_Bookings extends EM_Object implements Iterator{
689
}else{
690
$defaults = array_merge($defaults, $array_or_defaults);
691
}
692
//figure out default owning permissions
693
if( !current_user_can('edit_others_events') ){
694
$defaults['owner'] = get_current_user_id();
@@ -703,23 +781,29 @@ class EM_Bookings extends EM_Object implements Iterator{
703
return apply_filters('em_bookings_get_default_search', parent::get_default_search($defaults,$array), $array, $defaults);
704
}
705
706
- //Iterator Implementation
707
public function rewind(){
708
reset($this->bookings);
709
}
710
public function current(){
711
$var = current($this->bookings);
712
return $var;
713
}
714
public function key(){
715
$var = key($this->bookings);
716
return $var;
717
}
718
public function next(){
719
$var = next($this->bookings);
720
return $var;
721
}
722
public function valid(){
723
$key = key($this->bookings);
724
$var = ($key !== NULL && $key !== FALSE);
725
return $var;
10
* Array of EM_Booking objects for a specific event
11
* @var array
12
*/
13
+ protected $bookings;
14
/**
15
* @var EM_Tickets
16
*/
39
*/
40
public static $disable_restrictions = false;
41
42
+ protected $booked_spaces;
43
+ protected $pending_spaces;
44
+ protected $available_spaces;
45
+
46
/**
47
* Creates an EM_Bookings instance, currently accepts an EM_Event object (gets all bookings for that event) or array of any EM_Booking objects, which can be manipulated in bulk with helper functions.
48
* @param EM_Event $event
50
*/
51
function __construct( $data = false ){
52
if( is_object($data) && get_class($data) == "EM_Event" ){ //Creates a blank bookings object if needed
53
$this->event_id = $data->event_id;
54
+ }elseif( is_array($data) ){
55
+ foreach( $data as $EM_Booking ){
56
+ if( get_class($EM_Booking) == 'EM_Booking'){
57
+ $this->bookings[] = $EM_Booking;
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ public function __get( $var ){
64
+ if( $var == 'bookings' ){
65
+ return $this->load();
66
+ }
67
+ }
68
+
69
+ public function __set( $var, $val ){
70
+ if( $var == 'bookings' ){
71
+ if( is_array($val) ){
72
+ $this->bookings = $val;
73
+ }else{
74
+ $this->bookings = null;
75
+ }
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Counter-intuitive but __isset works against isset() but for our purpose it's mainly aimed at empty() calls, which also references this function.
81
+ * We don't expect nor do we want people using isset on things like the bookings property.
82
+ * Assume every property in EM_Bookings isset() == true and avoid it, only use empty() calls to check if there's anything in that property.
83
+ * Therefore, we'd return !empty($this->bookings) because if there's bookings, isset() should return true
84
+ * @param string $var
85
+ * @return boolean
86
+ */
87
+ public function __isset( $var ){
88
+ //if isset is invoked on $EM_Bookings->bookings then we'll assume it's only set if the bookings property is empty, not if null.
89
+ $result = false;
90
+ if( $var == 'bookings' ){
91
+ $result = !empty($this->bookings);
92
+ }
93
+ return $result;
94
+ }
95
+
96
+ public function load( $refresh = false ){
97
+ if( $refresh || $this->bookings === null ){
98
+ global $wpdb;
99
+ $bookings = $this->bookings = array();
100
if( $this->event_id > 0 ){
101
$sql = "SELECT * FROM ". EM_BOOKINGS_TABLE ." WHERE event_id ='{$this->event_id}' ORDER BY booking_date";
102
$bookings = $wpdb->get_results($sql, ARRAY_A);
104
foreach ($bookings as $booking){
105
$this->bookings[] = em_get_booking($booking);
106
}
107
}
108
+ return apply_filters('em_bookings_load', $this->bookings);
109
}
110
111
/**
125
if($result){
126
//Success
127
do_action('em_bookings_added', $EM_Booking);
128
+ if( $this->bookings !== null ) $this->bookings[] = $EM_Booking;
129
$email = $EM_Booking->email();
130
if( get_option('dbem_bookings_approval') == 1 && $EM_Booking->booking_status == 0){
131
$this->feedback_message = get_option('dbem_booking_feedback_pending');
210
$EM_Event->rsvp_end = $EM_Ticket->end_timestamp;
211
if( $EM_Event->is_recurring() && !empty($EM_Ticket->ticket_meta['recurrences']) ){
212
$EM_Event->recurrence_rsvp_days = $EM_Ticket->ticket_meta['recurrences']['end_days'];
213
+ }
214
}else{
215
//if no end date is set, use event end date (which will have defaulted to the event start date
216
$EM_Ticket->ticket_end = $EM_Event->event_rsvp_date." ".$EM_Event->event_rsvp_time;
243
return apply_filters('em_bookings_get_available_tickets', $EM_Tickets, $this);
244
}
245
246
+ /**
247
+ * Deprecated - was never used and therefore is deprecated, will always return an array() and will eventually be removed entirely.
248
+ * @return array
249
+ */
250
function get_user_list(){
251
+ return array();
252
}
253
254
/**
255
+ * Returns a boolean indicating whether this ticket exists in this bookings context.
256
* @return bool
257
*/
258
function ticket_exists($ticket_id){
293
function delete(){
294
global $wpdb;
295
$booking_ids = array();
296
+ if( !empty($this->bookings) ){
297
+ //get the booking ids tied to this event or preloaded into this object
298
+ foreach( $this->bookings as $EM_Booking ){
299
+ $booking_ids[] = $EM_Booking->booking_id;
300
+ }
301
+ $result_tickets = true;
302
+ $result = true;
303
+ if( count($booking_ids) > 0 ){
304
+ //Delete bookings and ticket bookings
305
+ $result_tickets = $wpdb->query("DELETE FROM ". EM_TICKETS_BOOKINGS_TABLE ." WHERE booking_id IN (".implode(',',$booking_ids).");");
306
+ $result = $wpdb->query("DELETE FROM ".EM_BOOKINGS_TABLE." WHERE booking_id IN (".implode(',',$booking_ids).")");
307
+ }
308
+ }elseif( !empty($this->event_id) ){
309
+ //faster way of deleting bookings for an event circumventing the need to load all bookings if it hasn't been loaded already
310
+ $event_id = absint($this->event_id);
311
+ $booking_ids = $wpdb->get_col("SELECT booking_id FROM ".EM_BOOKINGS_TABLE." WHERE event_id = '$event_id'");
312
+ $result_tickets = $wpdb->query("DELETE FROM ". EM_TICKETS_BOOKINGS_TABLE ." WHERE booking_id IN (SELECT booking_id FROM ".EM_BOOKINGS_TABLE." WHERE event_id = '$event_id')");
313
+ $result = $wpdb->query("DELETE FROM ".EM_BOOKINGS_TABLE." WHERE event_id = '$event_id'");
314
+ }else{
315
+ $result = $result_tickets == true;
316
}
317
do_action('em_bookings_deleted', $result, $booking_ids);
318
return apply_filters('em_bookings_delete', $result !== false && $result_tickets !== false, $booking_ids, $this);
416
* @return int
417
*/
418
function get_booked_spaces($force_refresh = false){
419
+ global $wpdb;
420
+ if( $this->booked_spaces === null || $force_refresh ){
421
+ $status_cond = !get_option('dbem_bookings_approval') ? 'booking_status IN (0,1)' : 'booking_status = 1';
422
+ $sql = 'SELECT SUM(booking_spaces) FROM '.EM_BOOKINGS_TABLE. " WHERE $status_cond AND event_id=".absint($this->event_id);
423
+ $booked_spaces = $wpdb->get_var($sql);
424
+ $this->booked_spaces = $booked_spaces > 0 ? $booked_spaces : 0;
425
}
426
+ return apply_filters('em_bookings_get_booked_spaces', $this->booked_spaces, $this, $force_refresh);
427
}
428
429
/**
430
* Gets number of pending spaces awaiting approval. Will return 0 if booking approval is not enabled.
431
* @return int
432
*/
433
+ function get_pending_spaces( $force_refresh = false ){
434
if( get_option('dbem_bookings_approval') == 0 ){
435
return apply_filters('em_bookings_get_pending_spaces', 0, $this);
436
}
437
+ global $wpdb;
438
+ if( $this->pending_spaces === null || $force_refresh ){
439
+ $sql = 'SELECT SUM(booking_spaces) FROM '.EM_BOOKINGS_TABLE. ' WHERE booking_status=0 AND event_id='.absint($this->event_id);
440
+ $pending_spaces = $wpdb->get_var($sql);
441
+ $this->pending_spaces = $pending_spaces > 0 ? $pending_spaces : 0;
442
}
443
+ return apply_filters('em_bookings_get_pending_spaces', $this->pending_spaces, $this, $force_refresh);
444
}
445
446
/**
449
*/
450
function get_bookings( $all_bookings = false ){
451
$confirmed = array();
452
+ foreach ( $this->load() as $EM_Booking ){
453
+ if( $EM_Booking->booking_status == 1 || (get_option('dbem_bookings_approval') == 0 && $EM_Booking->booking_status == 0) || $all_bookings ){
454
+ $confirmed[] = $EM_Booking;
455
}
456
}
457
$EM_Bookings = new EM_Bookings($confirmed);
467
return new EM_Bookings();
468
}
469
$pending = array();
470
+ foreach ( $this->load() as $EM_Booking ){
471
+ if($EM_Booking->booking_status == 0){
472
+ $pending[] = $EM_Booking;
473
}
474
}
475
$EM_Bookings = new EM_Bookings($pending);
482
*/
483
function get_rejected_bookings(){
484
$rejected = array();
485
+ foreach ( $this->load() as $EM_Booking ){
486
+ if($EM_Booking->booking_status == 2){
487
+ $rejected[] = $EM_Booking;
488
}
489
}
490
$EM_Bookings = new EM_Bookings($rejected);
497
*/
498
function get_cancelled_bookings(){
499
$cancelled = array();
500
+ foreach ( $this->load() as $EM_Booking ){
501
+ if($EM_Booking->booking_status == 3){
502
+ $cancelled[] = $EM_Booking;
503
}
504
}
505
$EM_Bookings = new EM_Bookings($cancelled);
517
//If person exists on record, see if they've booked this event before, if so return the booking.
518
if( is_numeric($EM_Booking->person->ID) && $EM_Booking->person->ID > 0 ){
519
$EM_Booking->person_id = $EM_Booking->person->ID;
520
+ foreach ($this->load() as $booking){
521
if( $booking->person_id == $EM_Booking->person->ID ){
522
return $booking;
523
}
535
$user_id = get_current_user_id();
536
}
537
if( is_numeric($user_id) && $user_id > 0 ){
538
+ foreach ($this->load() as $EM_Booking){
539
if( $EM_Booking->person->ID == $user_id && !in_array($EM_Booking->booking_status, array(2,3)) ){
540
return apply_filters('em_bookings_has_booking', $EM_Booking, $this);
541
}
587
$orderby = self::build_sql_orderby($args, $accepted_fields);
588
//Now, build orderby sql
589
$orderby_sql = ( count($orderby) > 0 ) ? 'ORDER BY '. implode(', ', $orderby) : 'ORDER BY booking_date';
590
+ //Selectors
591
+ if( $count ){
592
+ $selectors = 'COUNT(*)';
593
+ }elseif( is_array($args['array']) ){
594
+ $selectors = implode(',', $args['array']);
595
+ }else{
596
+ $selectors = '*';
597
+ }
598
//Create the SQL statement and execute
599
$sql = apply_filters('em_bookings_get_sql',"
600
SELECT $selectors FROM $bookings_table
739
'status' => false,
740
'person' => true, //to add later, search by person's bookings...
741
'blog' => get_current_blog_id(),
742
+ 'ticket_id' => false,
743
+ 'array' => false //returns an array of results if true, if an array or text it's assumed an array or single row requested
744
);
745
//sort out whether defaults were supplied or just the array of search values
746
if( empty($array) ){
748
}else{
749
$defaults = array_merge($defaults, $array_or_defaults);
750
}
751
+ //clean up array value
752
+ if( !empty($args['array']) ){
753
+ $EM_Booking = new EM_Booking();
754
+ if( is_array($args['array']) ){
755
+ $clean_arg = array();
756
+ foreach( $args['array'] as $k => $field ){
757
+ if( array_key_exists($field, $EM_Booking->fields) ){
758
+ $clean_arg[] = $field;
759
+ }
760
+ }
761
+ $args['array'] = !empty($clean_arg) ? $clean_arg : true; //if invalid args given, just return all fields
762
+ }elseif( is_string($args['array']) && array_key_exists($args['array'], $EM_Booking->fields) ){
763
+ $args['array'] = array($args['array']);
764
+ }else{
765
+ $args['array'] = true;
766
+ }
767
+ }else{
768
+ $args['array'] = false;
769
+ }
770
//figure out default owning permissions
771
if( !current_user_can('edit_others_events') ){
772
$defaults['owner'] = get_current_user_id();
781
return apply_filters('em_bookings_get_default_search', parent::get_default_search($defaults,$array), $array, $defaults);
782
}
783
784
+ //Iterator Implementation - if we iterate this object, we automatically invoke the load() function first
785
+ //and load up all bookings to go through from the database.
786
public function rewind(){
787
+ $this->load();
788
reset($this->bookings);
789
}
790
public function current(){
791
+ $this->load();
792
$var = current($this->bookings);
793
return $var;
794
}
795
public function key(){
796
+ $this->load();
797
$var = key($this->bookings);
798
return $var;
799
}
800
public function next(){
801
+ $this->load();
802
$var = next($this->bookings);
803
return $var;
804
}
805
public function valid(){
806
+ $this->load();
807
$key = key($this->bookings);
808
$var = ($key !== NULL && $key !== FALSE);
809
return $var;
classes/em-calendar.php CHANGED
@@ -7,7 +7,7 @@ class EM_Calendar extends EM_Object {
7
8
public static function get( $args ){
9
10
- global $wpdb;
11
12
$calendar_array = array();
13
$calendar_array['cells'] = array();
@@ -32,8 +32,7 @@ class EM_Calendar extends EM_Object {
32
$long_events = $args['long_events'];
33
$limit = $args['limit']; //limit arg will be used per day and not for events search
34
35
- $week_starts_on_sunday = get_option('dbem_week_starts_sunday');
36
- $start_of_week = get_option('start_of_week');
37
38
if( !(is_numeric($month) && $month <= 12 && $month > 0) ) {
39
$month = date('m', current_time('timestamp'));
@@ -158,9 +157,16 @@ class EM_Calendar extends EM_Object {
158
}
159
160
$days_initials_array = array();
161
- foreach($weekdays as $weekday) {
162
- $days_initials_array[] = esc_html(self::translate_and_trim($weekday, $day_initials_length));
163
- }
164
165
$calendar_array['links'] = array( 'previous_url'=>$previous_url, 'next_url'=>$next_url);
166
$calendar_array['row_headers'] = $days_initials_array;
@@ -279,6 +285,18 @@ class EM_Calendar extends EM_Object {
279
}
280
//generate a link argument string containing event search only
281
$day_link_args = self::get_query_args( array_intersect_key($original_args, EM_Events::get_post_search($args, true) ));
282
foreach($eventful_days as $day_key => $events) {
283
if( array_key_exists($day_key, $calendar_array['cells']) ){
284
//Get link title for this date
@@ -294,20 +312,10 @@ class EM_Calendar extends EM_Object {
294
$calendar_array['cells'][$day_key]['link_title'] = implode( $event_title_separator_format, $events_titles);
295
296
//Get the link to this calendar day
297
- global $wp_rewrite;
298
if( $eventful_days_count[$day_key] > 1 || !get_option('dbem_calendar_direct_links') ){
299
- if( get_option("dbem_events_page") > 0 ){
300
- $event_page_link = get_permalink(get_option("dbem_events_page")); //PAGE URI OF EM
301
- }else{
302
- if( $wp_rewrite->using_permalinks() ){
303
- $event_page_link = trailingslashit(home_url()).EM_POST_TYPE_EVENT_SLUG.'/'; //don't use EM_URI here, since ajax calls this before EM_URI is defined.
304
- }else{
305
- //not needed atm anyway, but we use esc_url later on, in case you're wondering ;)
306
- $event_page_link = add_query_arg(array('post_type'=>EM_POST_TYPE_EVENT), home_url()); //don't use EM_URI here, since ajax calls this before EM_URI is defined.
307
- }
308
- }
309
if( $wp_rewrite->using_permalinks() && !defined('EM_DISABLE_PERMALINKS') ){
310
- $calendar_array['cells'][$day_key]['link'] = trailingslashit($event_page_link).$day_key."/";
311
//add query vars to end of link
312
if( !empty($day_link_args) ){
313
$calendar_array['cells'][$day_key]['link'] = esc_url_raw(add_query_arg($day_link_args, $calendar_array['cells'][$day_key]['link']));
@@ -434,6 +442,7 @@ class EM_Calendar extends EM_Object {
434
public static function get_default_search( $array_or_defaults = array(), $array = array() ){
435
//These defaults aren't for db queries, but flags for what to display in calendar output
436
$defaults = array(
437
'full' => 0, //Will display a full calendar with event names
438
'long_events' => 0, //Events that last longer than a day
439
'scope' => false,
7
8
public static function get( $args ){
9
10
+ global $wpdb, $wp_rewrite;
11
12
$calendar_array = array();
13
$calendar_array['cells'] = array();
32
$long_events = $args['long_events'];
33
$limit = $args['limit']; //limit arg will be used per day and not for events search
34
35
+ $start_of_week = get_option('start_of_week');
36
37
if( !(is_numeric($month) && $month <= 12 && $month > 0) ) {
38
$month = date('m', current_time('timestamp'));
157
}
158
159
$days_initials_array = array();
160
+ //translate day names, some languages may have special circumstances
161
+ if( $day_initials_length == 1 && in_array(EM_ML::$current_language, array('zh_CN', 'zh_TW')) ){
162
+ //Chinese single initial day names are different
163
+ $days_initials_array = array('日','一','二','三','四','五','六');
164
+ }else{
165
+ //all other languages
166
+ foreach($weekdays as $weekday) {
167
+ $days_initials_array[] = esc_html(self::translate_and_trim($weekday, $day_initials_length));
168
+ }
169
+ }
170
171
$calendar_array['links'] = array( 'previous_url'=>$previous_url, 'next_url'=>$next_url);
172
$calendar_array['row_headers'] = $days_initials_array;
285
}
286
//generate a link argument string containing event search only
287
$day_link_args = self::get_query_args( array_intersect_key($original_args, EM_Events::get_post_search($args, true) ));
288
+ //get event link
289
+ if( get_option("dbem_events_page") > 0 ){
290
+ $event_page_link = get_permalink(get_option("dbem_events_page")); //PAGE URI OF EM
291
+ }else{
292
+ if( $wp_rewrite->using_permalinks() ){
293
+ $event_page_link = trailingslashit(home_url()).EM_POST_TYPE_EVENT_SLUG.'/'; //don't use EM_URI here, since ajax calls this before EM_URI is defined.
294
+ }else{
295
+ //not needed atm anyway, but we use esc_url later on, in case you're wondering ;)
296
+ $event_page_link = add_query_arg(array('post_type'=>EM_POST_TYPE_EVENT), home_url()); //don't use EM_URI here, since ajax calls this before EM_URI is defined.
297
+ }
298
+ }
299
+ $event_page_link_parts = explode('?', $event_page_link); //in case we have other plugins (e.g. WPML) adding querystring params to the end
300
foreach($eventful_days as $day_key => $events) {
301
if( array_key_exists($day_key, $calendar_array['cells']) ){
302
//Get link title for this date
312
$calendar_array['cells'][$day_key]['link_title'] = implode( $event_title_separator_format, $events_titles);
313
314
//Get the link to this calendar day
315
if( $eventful_days_count[$day_key] > 1 || !get_option('dbem_calendar_direct_links') ){
316
if( $wp_rewrite->using_permalinks() && !defined('EM_DISABLE_PERMALINKS') ){
317
+ $calendar_array['cells'][$day_key]['link'] = trailingslashit($event_page_link_parts[0]).$day_key."/";
318
+ if( !empty($event_page_link_parts[1]) ) $calendar_array['cells'][$day_key]['link'] .= '?' . $event_page_link_parts[1];
319
//add query vars to end of link
320
if( !empty($day_link_args) ){
321
$calendar_array['cells'][$day_key]['link'] = esc_url_raw(add_query_arg($day_link_args, $calendar_array['cells'][$day_key]['link']));
442
public static function get_default_search( $array_or_defaults = array(), $array = array() ){
443
//These defaults aren't for db queries, but flags for what to display in calendar output
444
$defaults = array(
445
+ 'recurring' => false, //we don't initially look for recurring events only events and recurrences of recurring events
446
'full' => 0, //Will display a full calendar with event names
447
'long_events' => 0, //Events that last longer than a day
448
'scope' => false,
classes/em-categories-admin.php ADDED
@@ -0,0 +1,61 @@
1
+ <?php
2
+ /**
3
+ * This class extends the EM_Taxonomy_Admin and adds category images and colors to the admin area.
4
+ *
5
+ * Currently, all functions here serve the purpose of getting around lack of late static binding in PHP < 5.3.
6
+ * Eventually when PHP 5.3 is enforced only certain class properties need to be defined for use in the parent class via static::
7
+ *
8
+ */
9
+ class EM_Categories_Admin extends EM_Taxonomy_Admin{
10
+
11
+ public static $taxonomy_name = 'EM_TAXONOMY_CATEGORY'; //converted into a constant value during init()
12
+ public static $this_class = 'EM_Categories_Admin'; //needed until 5.3 minimum is enforced for late static binding
13
+ public static $tax_class = 'EM_Category';
14
+ public static $option_name = 'category';
15
+ public static $name_singular = 'category';
16
+ public static $name_plural = 'categories';
17
+ public static $placeholder_image = '#_CATEGORYIMAGE';
18
+ public static $placeholder_color = '#_CATEGORYCOLOR';
19
+
20
+ public static function init(){
21
+ self::$taxonomy_name = EM_TAXONOMY_CATEGORY;
22
+ self::static_binding();
23
+ parent::init();
24
+ }
25
+
26
+ public static function form_add(){
27
+ self::static_binding();
28
+ parent::form_add();
29
+ }
30
+
31
+ public static function form_edit($tag){
32
+ self::static_binding();
33
+ parent::form_edit($tag);
34
+ }
35
+
36
+ public static function save( $term_id, $tt_id ){
37
+ self::static_binding();
38
+ parent::save( $term_id, $tt_id );
39
+ }
40
+
41
+ public static function delete( $term_id ){
42
+ self::static_binding();
43
+ parent::delete( $term_id );
44
+ }
45
+
46
+ /**
47
+ * Temporary function until WP requires PHP 5.3, so that we can make use of late static binding.
48
+ * Until then, all functions needing LST should run this function before calling the parent. If all extending classes do this we shouldn't have a problem.
49
+ */
50
+ public static function static_binding(){
51
+ EM_Taxonomy_Admin::$taxonomy_name = self::$taxonomy_name;
52
+ EM_Taxonomy_Admin::$this_class = self::$this_class;
53
+ EM_Taxonomy_Admin::$tax_class = self::$tax_class;
54
+ EM_Taxonomy_Admin::$option_name = self::$option_name;
55
+ EM_Taxonomy_Admin::$name_singular = self::$name_singular;
56
+ EM_Taxonomy_Admin::$name_plural = self::$name_plural;
57
+ EM_Taxonomy_Admin::$placeholder_image = self::$placeholder_image;
58
+ EM_Taxonomy_Admin::$placeholder_color = self::$placeholder_color;
59
+ }
60
+ }
61
+ add_action('admin_init',array('EM_Categories_Admin','init'));
classes/em-categories-frontend.php ADDED
@@ -0,0 +1,125 @@
1
+ <?php
2
+ class EM_Categories_Frontend extends EM_Taxonomy_Frontend {
3
+
4
+ public static $taxonomy_name = 'event-category'; //converted into a constant value during init()
5
+ public static $this_class = 'EM_Categories_Frontend'; //needed until 5.3 minimum is enforced for late static binding
6
+ public static $tax_class = 'EM_Category';
7
+ public static $option_name = 'category';
8
+ public static $option_name_plural = 'categories';
9
+
10
+ public static function init(){
11
+ self::$taxonomy_name = EM_TAXONOMY_CATEGORY; //awaiting LST in PHP 5.3
12
+ self::static_binding();
13
+ parent::init();
14
+ }
15
+
16
+ //These following functions can be removed when PHP 5.3 is minimum and LSB is available
17
+
18
+ public static function template($template = ''){
19
+ self::static_binding();
20
+ return parent::template($template);
21
+ }
22
+
23
+ public static function the_content($content){
24
+ self::static_binding();
25
+ return parent::the_content($content);
26
+ }
27
+
28
+ public static function parse_query( $wp_query ){
29
+ //we do some double-checking here to prevent running self::static_binding() during the self::template() function when WP_Query is called.
30
+ if( !$wp_query->is_main_query() ) return;
31
+ if( $wp_query->is_tax(self::$taxonomy_name) || !empty($wp_query->{'em_'.self::$option_name.'_id'}) ){
32
+ self::static_binding();
33
+ return parent::parse_query( $wp_query );
34
+ }
35
+ }
36
+
37
+ public static function wpseo_breadcrumb_links( $links ){
38
+ self::static_binding();
39
+ return parent::wpseo_breadcrumb_links( $links );
40
+ }
41
+
42
+ /**
43
+ * Temporary function until WP requires PHP 5.3, so that we can make use of late static binding.
44
+ * Until then, all functions needing LST should run this function before calling the parent. If all extending classes do this we shouldn't have a problem.
45
+ */
46
+ public static function static_binding(){
47
+ EM_Taxonomy_Frontend::$taxonomy_name = self::$taxonomy_name;
48
+ EM_Taxonomy_Frontend::$this_class = self::$this_class;
49
+ EM_Taxonomy_Frontend::$tax_class = self::$tax_class;
50
+ EM_Taxonomy_Frontend::$option_name = self::$option_name;
51
+ EM_Taxonomy_Frontend::$option_name_plural = self::$option_name_plural;
52
+ }
53
+ }
54
+ class EM_Category_Taxonomy extends EM_Categories_Frontend {} //backwards compatibility
55
+
56
+ EM_Categories_Frontend::init();
57
+
58
+ //Walker classes allowing for hierarchical display of categories
59
+
60
+ /**
61
+ * Create an array of Categories. Copied from Walker_CategoryDropdown, but makes it possible for the selected argument to be an array.
62
+ *
63
+ * @package WordPress
64
+ * @since 2.1.0
65
+ * @uses Walker
66
+ */
67
+ class EM_Walker_Category extends Walker {
68
+ /**
69
+ * @see Walker::$tree_type
70
+ * @since 2.1.0
71
+ * @var string
72
+ */
73
+ var $tree_type = 'event-category';
74
+
75
+ /**
76
+ * @see Walker::$db_fields
77
+ * @since 2.1.0
78
+ * @todo Decouple this
79
+ * @var array
80
+ */
81
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
82
+
83
+ function __construct(){
84
+ $tree_type = EM_TAXONOMY_CATEGORY;
85
+ }
86
+
87
+ /**
88
+ * @see Walker::start_el()
89
+ */
90
+ function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
91
+ $pad = str_repeat('&nbsp;', $depth * 3);
92
+ $cat_name = $object->name;
93
+ $name = !empty($args['name']) ? $args['name']:'event_categories[]';
94
+ $output .= !empty($args['before']) ? $args['after']:'';
95
+ $output .= $pad."<input type=\"checkbox\" name=\"$name\" class=\"level-$depth\" value=\"".$object->term_id."\"";
96
+ if ( (is_array($args['selected']) && in_array($object->term_id, $args['selected'])) || ($object->term_id == $args['selected']) )
97
+ $output .= ' checked="checked"';
98
+ $output .= ' /> ';
99
+ $output .= $cat_name;
100
+ $output .= !empty($args['after']) ? $args['after']:'<br />';
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Create an array of Categories. Copied from Walker_CategoryDropdown, but makes it possible for the selected argument to be an array.
106
+ *
107
+ * @package WordPress
108
+ * @since 2.1.0
109
+ * @uses Walker
110
+ */
111
+ class EM_Walker_CategoryMultiselect extends EM_Walker_Category {
112
+ /**
113
+ * @see Walker::start_el()
114
+ */
115
+ function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
116
+ $pad = str_repeat('&nbsp;', $depth * 3);
117
+ $cat_name = $object->name;
118
+ $output .= "\t<option class=\"level-$depth\" value=\"".$object->term_id."\"";
119
+ if ( (is_array($args['selected']) && in_array($object->term_id, $args['selected'])) || ($object->term_id == $args['selected']) )
120
+ $output .= ' selected="selected"';
121
+ $output .= '>';
122
+ $output .= $pad.$cat_name;
123
+ $output .= "</option>\n";
124
+ }
125
+ }
classes/em-categories-taxonomy.php DELETED
@@ -1,126 +0,0 @@
1
- <?php
2
- class EM_Categories_Taxonomy{
3
- public static function init(){
4
- add_action( EM_TAXONOMY_CATEGORY.'_edit_form_fields', array('EM_Categories_Taxonomy','form'), 10, 1);
5
- add_action( EM_TAXONOMY_CATEGORY.'_add_form_fields', array('EM_Categories_Taxonomy','form'), 10, 1);
6
- add_action( 'edited_'.EM_TAXONOMY_CATEGORY, array('EM_Categories_Taxonomy','save'), 10, 2);
7
- add_action( 'create_'.EM_TAXONOMY_CATEGORY, array('EM_Categories_Taxonomy','save'), 10, 2);
8
- add_action( 'delete_'.EM_TAXONOMY_CATEGORY, array('EM_Categories_Taxonomy','delete'), 10, 2);
9
-
10
- add_filter('manage_edit-'.EM_TAXONOMY_CATEGORY.'_columns' , array('EM_Categories_Taxonomy','columns_add'));
11
- add_filter('manage_'.EM_TAXONOMY_CATEGORY.'_custom_column' , array('EM_Categories_Taxonomy','columns_output'),10,3);
12
-
13
- self::admin_init();
14
- }
15
-
16
-
17
- public static function columns_add($columns) {
18
- //prepend ID after checkbox
19
- $columns['cat-id'] = __('ID','events-manager');
20
- return $columns;
21
- }
22
-
23
- public static function columns_output( $val, $column, $term_id ) {
24
- switch ( $column ) {
25
- case 'cat-id':
26
- return $term_id;
27
- break;
28
- }
29
- return $val;
30
- }
31
-
32
- public static function admin_init(){
33
- global $pagenow;
34
- if( ($pagenow == 'edit-tags.php' || $pagenow == 'term.php') && !empty($_GET['taxonomy']) && $_GET['taxonomy'] == EM_TAXONOMY_CATEGORY){
35
- wp_enqueue_media();
36
- wp_enqueue_script( 'em-categories-admin', plugins_url().'/events-manager/includes/js/categories-admin.js', array( 'jquery','media-upload','thickbox','farbtastic' ) );
37
- }
38
- }
39
-
40
- public static function form($tag){
41
- $category_color = '#FFFFFF';
42
- $category_image = $category_image_id = '';
43
- if( $tag != EM_TAXONOMY_CATEGORY ){ //not an add new tag form
44
- $EM_Category = new EM_Category($tag);
45
- $category_color = $EM_Category->get_color();
46
- $category_image = $EM_Category->get_image_url();
47
- $category_image_id = $EM_Category->get_image_id();
48
- }
49
- ?>
50
- <tr class="form-field">
51
- <th scope="row" valign="top"><label for="category-bgcolor"><?php esc_html_e('Color','events-manager'); ?></label></th>
52
- <td>
53
- <input type="text" name="category_bgcolor" id="category-bgcolor" class="colorwell" value="<?php echo esc_attr($category_color); ?>" style="width:100px;"/><br />
54
- <p class="description"><?php echo sprintf(__('Choose a color for your category. You can access this using the %s placeholder.','events-manager'),'<code>#_CATEGORYCOLOR</code>'); ?></p>
55
- <div id="picker" style="position:absolute; display:none; background:#DEDEDE"></div>
56
- </td>
57
- </tr>
58
- <tr class="form-field">
59
- <th scope="row" valign="top"><label for="category-image"><?php esc_html_e('Image','events-manager'); ?></label></th>
60
- <td id="event-tax-image">
61
- <div class="img-container">
62
- <?php if( !empty($category_image) ): ?>
63
- <img src="<?php echo $category_image; ?>" />
64
- <?php endif; ?>
65
- </div>
66
- <input type="text" name="category_image" id="category-image" class="img-url" value="<?php echo esc_attr($category_image); ?>" />
67
- <input type="hidden" name="category_image_id" id="category-image-id" class="img-id" value="<?php echo esc_attr($category_image_id); ?>" />
68
- <p class="hide-if-no-js">
69
- <input id="upload_image_button" type="button" value="<?php _e('Choose/Upload Image','events-manager'); ?>" class="upload-img-button button-secondary" />
70
- <input id="delete_image_button" type="button" value="<?php _e('Remove Image','events-manager'); ?>" class="delete-img-button button-secondary" <?php if( empty($category_image) ) echo 'style="display:none;"'; ?> />
71
- </p>
72
- <br />
73
- <p class="description"><?php echo sprintf(__('Choose an image for your category, which can be displayed using the %s placeholder.','events-manager'),'<code>#_CATEGORYIMAGE</code>'); ?></p>
74
- </td>
75