Version Description
- fixed potential XSS and a potential code injection vulnerabilities (props to the team at bit9.com)
- updated Czech, Danish, Dutch, English (UK), Spanish, Estonian, French, German, Hungarian, Italian, Japanese, Norwegian, Persian, Polish, Portuguese (Brazil), Russian and Slovenian language files
- added Greek and Slovak languages
- added MultiLingual abstract layer rewritten and various modifications throughout EM to enable multilingual interfacing with plugins like WPML
- created abstract multilingual layer classes, a complete rewrite and overhaul
- fixed em_events_get_bookings filter not allowing replacement of EM_Booking object
- changed booking form placeholder template to reference EM_Bookings->event_id rather than EM_Event->event_id
- fixed wp_insert_post_data not correctly loading/validating the event associated with the actual post id supplied
- changed ML globe icon to use the globe dashicon
- fixed attributes not being translatable as well as porting new attribute values added to original being added to other language if no translation exists
- added single-tab view for options page if number of ML languages add more than 1000 fields to submit
- fixed some minor PHP warnings for edge cases
- fixed bp deprecated warning in debug mode
- added long_events default option to small and full calendar sizes on settings page
- fixed erroneous month returned when using functions and the 12th month (kudos @althie)
- removed a console.log function from the JS delete ticket function
- removed the forced 50px width/height of the full calendar day cells which breaks the calendar in twenty fifteen
- fixed global $EM_Event not loading before add_admin_boxes in admin area
- improved/simplified code for front-end image uploads handling which now uses media_handle_upload
- fixed #_CONTACTNAME showing anonymous events user rather than the guest submitter name
- fixed MS Global recurrences not saving global category info
- fixed recurring tickets triggering errors if only start date is defined
- fixed private locations searches not including eventless private locations
- changed some deprecated is_main_blog() functions to is_main_site()
- fixed JS DOM conflict by naming submit buttons 'submit'
- fixed 'Email Sent' being shown when no emails sent during booking status change
- fixed em_wp_the_title() unnecessarily filtering all the_title instances on event, location and EM pages rather than just the main title
- fixed long_events=0 not being considered for the WP Fullcalendar plugin
- fixed issue where when saving via WP admin the global $EM_Event object doesn't refresh all data before passing onto save_event filter
- added em_rewrite_rules_array_events filter for permalink rewrites
- fixed long events argument not taking in WP FullCalendar
- fixed filters em_bookings_table_rows_col and em_bookings_table_rows_col_{col_name} not supplying $object which could be an EM_Ticket_Booking object
- modified EM_Bookings_Table::get_row() to apply em_bookings_table_rows_col for every column
- fixed minor admin page bug where JS can clash with uses of pseudo URLs when certain plugins activated
- fixed EM_Calendar links clashing with WPML and potentially other plugins that manipulate urls
- added some esc_ functions to calendar links and templates an extra safety precaution
- added EM_CSV_DELIMITER constant check to allow overriding CSV delimiters
- added em_booking_output_event filter
- improved booking email sending so contact and extra admin emails sent in one go rather than in separate send functions
- added em_booking_js hook with intention of replacing em_gateway_js hook in the distant future
- fixed booking price rounding issues in EM_Booking::get_price()
- fixed event save_post hook issues when a new location CPT is created within it, which fixes ACF plugin saving issues
- fixed WPLANG php notice on installation/update
- fixed 'Manage Persons Bookings' page not filtering properly for non-admins
- fixed some false positive/negative results using EM_Object::can_manage()
- added additional db indexes for performance improvements
- fixed EM_Events::get() returning blank events when supplied an array of event IDs
- fixed advanced search & ticket editor advanced options toggle conflicts with twitter bootstrap-based themes
- updated classes and widgets to use PHP 5 constructor methods in lieu of WP 4.3 update
- fixed BP event duplication errors for non-owner group admins
- changed and cleaned up some table layout issues in templates/buddypress/group-events.php
- fixed current view/scope link not being bold in front-end events editor
- fixed saving recurrences not deleting currently trashed recurrences
- fixed location archives not adhering to sorting defined in settings page
- fixed users without the manage_booking capability being able to create events with bookings in the admin areas
- removed auto-insert of ul tags if no format_header or format_footer supplied in taxonomy list shortcode
- fixed some format, format_header and format_footer attributes not being output for custom value combinations
- fixed misspelt action em_front_event_form_guest (em_font_event_form_guest depricated, will remove in future)
- fixed custom taxonomies not being considered as default search args to make search form integration easier
- changed templates/templates/search/categories.php so default value is 0 rather than -1
- changed incorrect em_event_get_post filter applied for EM_Event::get_post_meta() which is now em_event_get_post_meta
- added em_event_get_post_meta_pre and em_event_get_post_pre actions
- fixed SQL error when searching non-existent taxonomy values or taxonomy names containing a hyphen
- fixed change of event ownership to anonymously submitted event not showing new owner contact information
- fixed soon-to-be deprecated templates/forms/ticket-form.php not including overridden forms/event/bookings-ticket-form.php file
- added em_timepicker_options JS trigger for altering time picker options
- fixed strict PHP error in templates/forms/bookingform/ticket-single.php
- added em_enqueue_admin_styles action and moved em_enqueue_admin_scripts action after em script is added
- added Russian Ruble to currency list
- fixed errors with some booking edit links on the front end
- changed use of deprecated function bp_core_add_notification to bp_notifications_add_notification
- added EM_Event::duplicate_url and changed templates with duplicate urls to use this so ML events will duplicate original translation
- fixed some potential validation errors when hooking into em_location_get_post_meta
- added admin global $EM_Location so it now becomes global during add_meta_boxes action
- added em_category_taxonomy_template and em_tag_taxonomy_template actions
- updated jQuery UI CSS files
Download this release
Release Info
Developer | netweblogic |
Plugin | Events Manager |
Version | 5.6 |
Comparing to | |
See all releases |
Code changes from version 5.5.7.1 to 5.6
- admin/bookings/em-cancelled.php +136 -136
- admin/bookings/em-confirmed.php +143 -143
- admin/bookings/em-events.php +163 -163
- admin/bookings/em-pending.php +158 -158
- admin/bookings/em-person.php +151 -151
- admin/bookings/em-rejected.php +136 -136
- admin/em-admin.php +305 -305
- admin/em-bookings.php +567 -567
- admin/em-docs.php +397 -393
- admin/em-help.php +70 -70
- admin/em-ms-locations.php +51 -51
- admin/em-ms-options.php +203 -203
- admin/em-options.php +609 -2280
- admin/settings/tabs/bookings.php +161 -0
- admin/settings/tabs/emails.php +176 -0
- admin/settings/tabs/formats.php +469 -0
- admin/settings/tabs/general.php +268 -0
- admin/settings/tabs/pages.php +634 -0
- admin/{wpfc-admin.php → settings/wpfc-admin.php} +46 -46
- buddypress/bp-em-activity.php +217 -217
- buddypress/bp-em-core.php +65 -65
- buddypress/bp-em-groups.php +150 -149
- buddypress/bp-em-notifications.php +13 -3
- buddypress/screens/attending.php +28 -28
- buddypress/screens/group-events.php +29 -29
- buddypress/screens/my-bookings.php +40 -40
- buddypress/screens/my-events.php +54 -54
- buddypress/screens/my-group-events.php +26 -26
- buddypress/screens/my-locations.php +50 -50
- buddypress/screens/profile.php +31 -31
- classes/em-booking.php +1096 -1100
- classes/em-bookings-table.php +644 -640
- classes/em-bookings.php +722 -717
- classes/em-calendar.php +453 -441
- classes/em-categories-taxonomy.php +125 -125
- classes/em-categories.php +308 -305
- classes/em-category-taxonomy.php +169 -168
- classes/em-category.php +298 -298
- classes/em-event-post-admin.php +0 -426
admin/bookings/em-cancelled.php
CHANGED
@@ -1,137 +1,137 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Generates a "widget" table of confirmed bookings for a specific event.
|
4 |
-
*
|
5 |
-
* @param int $event_id
|
6 |
-
*/
|
7 |
-
function em_bookings_cancelled_table(){
|
8 |
-
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
9 |
-
|
10 |
-
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_cancelled_table' );
|
11 |
-
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
12 |
-
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
13 |
-
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
14 |
-
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
15 |
-
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
16 |
-
|
17 |
-
if( is_object($EM_Ticket) ){
|
18 |
-
$EM_Bookings = $EM_Ticket->get_bookings()->get_cancelled_bookings();
|
19 |
-
}else{
|
20 |
-
if( is_object($EM_Event) ){
|
21 |
-
$EM_Bookings = $EM_Event->get_bookings()->get_cancelled_bookings();
|
22 |
-
}else{
|
23 |
-
return false;
|
24 |
-
}
|
25 |
-
}
|
26 |
-
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
27 |
-
?>
|
28 |
-
<div class='wrap em_bookings_pending_table em_obj'>
|
29 |
-
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
30 |
-
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
31 |
-
<!--
|
32 |
-
<ul class="subsubsub">
|
33 |
-
<li>
|
34 |
-
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
35 |
-
</li>
|
36 |
-
</ul>
|
37 |
-
<p class="search-box">
|
38 |
-
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
39 |
-
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
40 |
-
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
41 |
-
</p>
|
42 |
-
-->
|
43 |
-
<?php if ( $bookings_count >= $limit ) : ?>
|
44 |
-
<div class='tablenav'>
|
45 |
-
<!--
|
46 |
-
<div class="alignleft actions">
|
47 |
-
<select name="action">
|
48 |
-
<option value="-1" selected="selected">
|
49 |
-
<?php _e('Bulk Actions', 'dbem'); ?>
|
50 |
-
</option>
|
51 |
-
<option value="approve">
|
52 |
-
<?php _e('Approve', 'dbem'); ?>
|
53 |
-
</option>
|
54 |
-
<option value="decline">
|
55 |
-
<?php _e('Decline', 'dbem'); ?>
|
56 |
-
</option>
|
57 |
-
</select>
|
58 |
-
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
59 |
-
</div>
|
60 |
-
-->
|
61 |
-
<!--
|
62 |
-
<div class="view-switch">
|
63 |
-
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
64 |
-
</div>
|
65 |
-
-->
|
66 |
-
<?php
|
67 |
-
if ( $bookings_count >= $limit ) {
|
68 |
-
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
69 |
-
echo $bookings_nav;
|
70 |
-
}
|
71 |
-
?>
|
72 |
-
<div class="clear"></div>
|
73 |
-
</div>
|
74 |
-
<?php endif; ?>
|
75 |
-
<div class="clear"></div>
|
76 |
-
<?php if( $bookings_count > 0 ): ?>
|
77 |
-
<div class='table-wrap'>
|
78 |
-
<table id='dbem-bookings-table' class='widefat post '>
|
79 |
-
<thead>
|
80 |
-
<tr>
|
81 |
-
<th class='manage-column column-cb check-column' scope='col'>
|
82 |
-
<input class='select-all' type="checkbox" value='1' />
|
83 |
-
</th>
|
84 |
-
<th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
|
85 |
-
<th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
|
86 |
-
<th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
|
87 |
-
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
88 |
-
<th class='manage-column' scope='col'> </th>
|
89 |
-
</tr>
|
90 |
-
</thead>
|
91 |
-
<tbody>
|
92 |
-
<?php
|
93 |
-
$rowno = 0;
|
94 |
-
$event_count = 0;
|
95 |
-
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
96 |
-
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
97 |
-
$rowno++;
|
98 |
-
?>
|
99 |
-
<tr>
|
100 |
-
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
101 |
-
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
102 |
-
<td><?php echo $EM_Booking->person->user_email ?></td>
|
103 |
-
<td><?php echo $EM_Booking->person->phone ?></td>
|
104 |
-
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
-
<td>
|
106 |
-
<?php
|
107 |
-
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
108 |
-
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
-
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
110 |
-
?>
|
111 |
-
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
|
112 |
-
<a class="em-bookings-edit" href="<?php echo $edit_url; ?>"><?php _e('Edit/View','dbem'); ?></a> |
|
113 |
-
<a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a>
|
114 |
-
</td>
|
115 |
-
</tr>
|
116 |
-
<?php
|
117 |
-
}
|
118 |
-
$event_count++;
|
119 |
-
}
|
120 |
-
?>
|
121 |
-
</tbody>
|
122 |
-
</table>
|
123 |
-
</div>
|
124 |
-
<?php else: ?>
|
125 |
-
<?php _e('No cancelled bookings.', 'dbem'); ?>
|
126 |
-
<?php endif; ?>
|
127 |
-
</form>
|
128 |
-
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
129 |
-
<div class='tablenav'>
|
130 |
-
<?php echo $bookings_nav; ?>
|
131 |
-
<div class="clear"></div>
|
132 |
-
</div>
|
133 |
-
<?php endif; ?>
|
134 |
-
</div>
|
135 |
-
<?php
|
136 |
-
}
|
137 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Generates a "widget" table of confirmed bookings for a specific event.
|
4 |
+
*
|
5 |
+
* @param int $event_id
|
6 |
+
*/
|
7 |
+
function em_bookings_cancelled_table(){
|
8 |
+
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
9 |
+
|
10 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_cancelled_table' );
|
11 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
12 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
13 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
14 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
15 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
16 |
+
|
17 |
+
if( is_object($EM_Ticket) ){
|
18 |
+
$EM_Bookings = $EM_Ticket->get_bookings()->get_cancelled_bookings();
|
19 |
+
}else{
|
20 |
+
if( is_object($EM_Event) ){
|
21 |
+
$EM_Bookings = $EM_Event->get_bookings()->get_cancelled_bookings();
|
22 |
+
}else{
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
27 |
+
?>
|
28 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
29 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
30 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
31 |
+
<!--
|
32 |
+
<ul class="subsubsub">
|
33 |
+
<li>
|
34 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
35 |
+
</li>
|
36 |
+
</ul>
|
37 |
+
<p class="search-box">
|
38 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
39 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
40 |
+
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
41 |
+
</p>
|
42 |
+
-->
|
43 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
44 |
+
<div class='tablenav'>
|
45 |
+
<!--
|
46 |
+
<div class="alignleft actions">
|
47 |
+
<select name="action">
|
48 |
+
<option value="-1" selected="selected">
|
49 |
+
<?php _e('Bulk Actions', 'dbem'); ?>
|
50 |
+
</option>
|
51 |
+
<option value="approve">
|
52 |
+
<?php _e('Approve', 'dbem'); ?>
|
53 |
+
</option>
|
54 |
+
<option value="decline">
|
55 |
+
<?php _e('Decline', 'dbem'); ?>
|
56 |
+
</option>
|
57 |
+
</select>
|
58 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
59 |
+
</div>
|
60 |
+
-->
|
61 |
+
<!--
|
62 |
+
<div class="view-switch">
|
63 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
64 |
+
</div>
|
65 |
+
-->
|
66 |
+
<?php
|
67 |
+
if ( $bookings_count >= $limit ) {
|
68 |
+
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
69 |
+
echo $bookings_nav;
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
<div class="clear"></div>
|
73 |
+
</div>
|
74 |
+
<?php endif; ?>
|
75 |
+
<div class="clear"></div>
|
76 |
+
<?php if( $bookings_count > 0 ): ?>
|
77 |
+
<div class='table-wrap'>
|
78 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
79 |
+
<thead>
|
80 |
+
<tr>
|
81 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
82 |
+
<input class='select-all' type="checkbox" value='1' />
|
83 |
+
</th>
|
84 |
+
<th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
|
85 |
+
<th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
|
86 |
+
<th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
|
87 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
88 |
+
<th class='manage-column' scope='col'> </th>
|
89 |
+
</tr>
|
90 |
+
</thead>
|
91 |
+
<tbody>
|
92 |
+
<?php
|
93 |
+
$rowno = 0;
|
94 |
+
$event_count = 0;
|
95 |
+
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
96 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
97 |
+
$rowno++;
|
98 |
+
?>
|
99 |
+
<tr>
|
100 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
101 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
102 |
+
<td><?php echo $EM_Booking->person->user_email ?></td>
|
103 |
+
<td><?php echo $EM_Booking->person->phone ?></td>
|
104 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
+
<td>
|
106 |
+
<?php
|
107 |
+
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
108 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
+
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
110 |
+
?>
|
111 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
|
112 |
+
<a class="em-bookings-edit" href="<?php echo $edit_url; ?>"><?php _e('Edit/View','dbem'); ?></a> |
|
113 |
+
<a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a>
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<?php
|
117 |
+
}
|
118 |
+
$event_count++;
|
119 |
+
}
|
120 |
+
?>
|
121 |
+
</tbody>
|
122 |
+
</table>
|
123 |
+
</div>
|
124 |
+
<?php else: ?>
|
125 |
+
<?php _e('No cancelled bookings.', 'dbem'); ?>
|
126 |
+
<?php endif; ?>
|
127 |
+
</form>
|
128 |
+
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
129 |
+
<div class='tablenav'>
|
130 |
+
<?php echo $bookings_nav; ?>
|
131 |
+
<div class="clear"></div>
|
132 |
+
</div>
|
133 |
+
<?php endif; ?>
|
134 |
+
</div>
|
135 |
+
<?php
|
136 |
+
}
|
137 |
?>
|
admin/bookings/em-confirmed.php
CHANGED
@@ -1,144 +1,144 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Generates a "widget" table of confirmed bookings for a specific event.
|
5 |
-
*
|
6 |
-
* @param int $event_id
|
7 |
-
*/
|
8 |
-
function em_bookings_confirmed_table(){
|
9 |
-
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
10 |
-
|
11 |
-
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
12 |
-
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
13 |
-
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
14 |
-
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
15 |
-
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
16 |
-
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
17 |
-
|
18 |
-
if( is_object($EM_Ticket) ){
|
19 |
-
$EM_Bookings = $EM_Ticket->get_bookings()->get_bookings();
|
20 |
-
}else{
|
21 |
-
if( is_object($EM_Event) ){
|
22 |
-
$EM_Bookings = $EM_Event->get_bookings()->get_bookings();
|
23 |
-
}else{
|
24 |
-
return false;
|
25 |
-
}
|
26 |
-
}
|
27 |
-
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
28 |
-
?>
|
29 |
-
<div class='wrap em_bookings_pending_table em_obj'>
|
30 |
-
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
31 |
-
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
32 |
-
<!--
|
33 |
-
<ul class="subsubsub">
|
34 |
-
<li>
|
35 |
-
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
36 |
-
</li>
|
37 |
-
</ul>
|
38 |
-
<p class="search-box">
|
39 |
-
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
40 |
-
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
41 |
-
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
42 |
-
</p>
|
43 |
-
-->
|
44 |
-
<?php if ( $bookings_count >= $limit ) : ?>
|
45 |
-
<div class='tablenav'>
|
46 |
-
<!--
|
47 |
-
<div class="alignleft actions">
|
48 |
-
<select name="action">
|
49 |
-
<option value="-1" selected="selected">
|
50 |
-
<?php _e('Bulk Actions', 'dbem'); ?>
|
51 |
-
</option>
|
52 |
-
<option value="approve">
|
53 |
-
<?php _e('Approve', 'dbem'); ?>
|
54 |
-
</option>
|
55 |
-
<option value="decline">
|
56 |
-
<?php _e('Decline', 'dbem'); ?>
|
57 |
-
</option>
|
58 |
-
</select>
|
59 |
-
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
60 |
-
</div>
|
61 |
-
-->
|
62 |
-
<!--
|
63 |
-
<div class="view-switch">
|
64 |
-
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
65 |
-
</div>
|
66 |
-
-->
|
67 |
-
<?php
|
68 |
-
if ( $bookings_count >= $limit ) {
|
69 |
-
$bookings_nav = em_admin_paginate($bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
70 |
-
echo $bookings_nav;
|
71 |
-
}
|
72 |
-
?>
|
73 |
-
<div class="clear"></div>
|
74 |
-
</div>
|
75 |
-
<?php endif; ?>
|
76 |
-
<div class="clear"></div>
|
77 |
-
<?php if( $bookings_count > 0 ): ?>
|
78 |
-
<div class='table-wrap'>
|
79 |
-
<table id='dbem-bookings-table' class='widefat post '>
|
80 |
-
<thead>
|
81 |
-
<tr>
|
82 |
-
<th class='manage-column column-cb check-column' scope='col'>
|
83 |
-
<input class='select-all' type="checkbox" value='1' />
|
84 |
-
</th>
|
85 |
-
<th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
|
86 |
-
<th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
|
87 |
-
<th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
|
88 |
-
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
89 |
-
<th class='manage-column' scope='col'> </th>
|
90 |
-
</tr>
|
91 |
-
</thead>
|
92 |
-
<tbody>
|
93 |
-
<?php
|
94 |
-
$rowno = 0;
|
95 |
-
$event_count = 0;
|
96 |
-
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
97 |
-
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
98 |
-
$rowno++;
|
99 |
-
?>
|
100 |
-
<tr>
|
101 |
-
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
102 |
-
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person_id; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
103 |
-
<td><?php echo $EM_Booking->person->user_email ?></td>
|
104 |
-
<td><?php echo $EM_Booking->person->phone ?></td>
|
105 |
-
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
106 |
-
<td>
|
107 |
-
<?php
|
108 |
-
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
-
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
110 |
-
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
111 |
-
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
112 |
-
?>
|
113 |
-
<?php if( current_user_can('manage_bookings') && get_option('dbem_bookings_approval') ): ?>
|
114 |
-
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
|
115 |
-
<?php else: ?>
|
116 |
-
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
|
117 |
-
<?php endif; ?>
|
118 |
-
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
|
119 |
-
<a class="em-bookings-edit" href="<?php echo $edit_url; ?>"><?php _e('Edit/View','dbem'); ?></a>
|
120 |
-
</td>
|
121 |
-
</tr>
|
122 |
-
<?php
|
123 |
-
}
|
124 |
-
$event_count++;
|
125 |
-
}
|
126 |
-
?>
|
127 |
-
</tbody>
|
128 |
-
</table>
|
129 |
-
</div>
|
130 |
-
<?php else: ?>
|
131 |
-
<?php _e('No confirmed bookings.', 'dbem'); ?>
|
132 |
-
<?php endif; ?>
|
133 |
-
</form>
|
134 |
-
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
135 |
-
<div class='tablenav'>
|
136 |
-
<?php echo $bookings_nav; ?>
|
137 |
-
<div class="clear"></div>
|
138 |
-
</div>
|
139 |
-
<?php endif; ?>
|
140 |
-
</div>
|
141 |
-
<?php
|
142 |
-
|
143 |
-
}
|
144 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Generates a "widget" table of confirmed bookings for a specific event.
|
5 |
+
*
|
6 |
+
* @param int $event_id
|
7 |
+
*/
|
8 |
+
function em_bookings_confirmed_table(){
|
9 |
+
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
10 |
+
|
11 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
12 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
13 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
14 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
15 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
16 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
17 |
+
|
18 |
+
if( is_object($EM_Ticket) ){
|
19 |
+
$EM_Bookings = $EM_Ticket->get_bookings()->get_bookings();
|
20 |
+
}else{
|
21 |
+
if( is_object($EM_Event) ){
|
22 |
+
$EM_Bookings = $EM_Event->get_bookings()->get_bookings();
|
23 |
+
}else{
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
28 |
+
?>
|
29 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
30 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
31 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
32 |
+
<!--
|
33 |
+
<ul class="subsubsub">
|
34 |
+
<li>
|
35 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
36 |
+
</li>
|
37 |
+
</ul>
|
38 |
+
<p class="search-box">
|
39 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
40 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
41 |
+
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
42 |
+
</p>
|
43 |
+
-->
|
44 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
45 |
+
<div class='tablenav'>
|
46 |
+
<!--
|
47 |
+
<div class="alignleft actions">
|
48 |
+
<select name="action">
|
49 |
+
<option value="-1" selected="selected">
|
50 |
+
<?php _e('Bulk Actions', 'dbem'); ?>
|
51 |
+
</option>
|
52 |
+
<option value="approve">
|
53 |
+
<?php _e('Approve', 'dbem'); ?>
|
54 |
+
</option>
|
55 |
+
<option value="decline">
|
56 |
+
<?php _e('Decline', 'dbem'); ?>
|
57 |
+
</option>
|
58 |
+
</select>
|
59 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
60 |
+
</div>
|
61 |
+
-->
|
62 |
+
<!--
|
63 |
+
<div class="view-switch">
|
64 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
65 |
+
</div>
|
66 |
+
-->
|
67 |
+
<?php
|
68 |
+
if ( $bookings_count >= $limit ) {
|
69 |
+
$bookings_nav = em_admin_paginate($bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
70 |
+
echo $bookings_nav;
|
71 |
+
}
|
72 |
+
?>
|
73 |
+
<div class="clear"></div>
|
74 |
+
</div>
|
75 |
+
<?php endif; ?>
|
76 |
+
<div class="clear"></div>
|
77 |
+
<?php if( $bookings_count > 0 ): ?>
|
78 |
+
<div class='table-wrap'>
|
79 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
80 |
+
<thead>
|
81 |
+
<tr>
|
82 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
83 |
+
<input class='select-all' type="checkbox" value='1' />
|
84 |
+
</th>
|
85 |
+
<th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
|
86 |
+
<th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
|
87 |
+
<th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
|
88 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
89 |
+
<th class='manage-column' scope='col'> </th>
|
90 |
+
</tr>
|
91 |
+
</thead>
|
92 |
+
<tbody>
|
93 |
+
<?php
|
94 |
+
$rowno = 0;
|
95 |
+
$event_count = 0;
|
96 |
+
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
97 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
98 |
+
$rowno++;
|
99 |
+
?>
|
100 |
+
<tr>
|
101 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
102 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person_id; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
103 |
+
<td><?php echo $EM_Booking->person->user_email ?></td>
|
104 |
+
<td><?php echo $EM_Booking->person->phone ?></td>
|
105 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
106 |
+
<td>
|
107 |
+
<?php
|
108 |
+
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
+
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
110 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
111 |
+
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
112 |
+
?>
|
113 |
+
<?php if( current_user_can('manage_bookings') && get_option('dbem_bookings_approval') ): ?>
|
114 |
+
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
|
115 |
+
<?php else: ?>
|
116 |
+
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
|
117 |
+
<?php endif; ?>
|
118 |
+
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
|
119 |
+
<a class="em-bookings-edit" href="<?php echo $edit_url; ?>"><?php _e('Edit/View','dbem'); ?></a>
|
120 |
+
</td>
|
121 |
+
</tr>
|
122 |
+
<?php
|
123 |
+
}
|
124 |
+
$event_count++;
|
125 |
+
}
|
126 |
+
?>
|
127 |
+
</tbody>
|
128 |
+
</table>
|
129 |
+
</div>
|
130 |
+
<?php else: ?>
|
131 |
+
<?php _e('No confirmed bookings.', 'dbem'); ?>
|
132 |
+
<?php endif; ?>
|
133 |
+
</form>
|
134 |
+
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
135 |
+
<div class='tablenav'>
|
136 |
+
<?php echo $bookings_nav; ?>
|
137 |
+
<div class="clear"></div>
|
138 |
+
</div>
|
139 |
+
<?php endif; ?>
|
140 |
+
</div>
|
141 |
+
<?php
|
142 |
+
|
143 |
+
}
|
144 |
?>
|
admin/bookings/em-events.php
CHANGED
@@ -1,164 +1,164 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Determines whether to show event page or events page, and saves any updates to the event or events
|
5 |
-
* @return null
|
6 |
-
*/
|
7 |
-
function em_bookings_events_table() {
|
8 |
-
//TODO Simplify panel for events, use form flags to detect certain actions (e.g. submitted, etc)
|
9 |
-
global $wpdb;
|
10 |
-
global $EM_Event;
|
11 |
-
|
12 |
-
$scope_names = array (
|
13 |
-
'past' => __ ( 'Past events', 'dbem' ),
|
14 |
-
'all' => __ ( 'All events', 'dbem' ),
|
15 |
-
'future' => __ ( 'Future events', 'dbem' )
|
16 |
-
);
|
17 |
-
|
18 |
-
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_events_table' );
|
19 |
-
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
20 |
-
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
21 |
-
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
22 |
-
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
23 |
-
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
24 |
-
$scope = ( $action_scope && !empty($_GET ['scope']) && array_key_exists($_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
|
25 |
-
|
26 |
-
// No action, only showing the events list
|
27 |
-
switch ($scope) {
|
28 |
-
case "past" :
|
29 |
-
$title = __ ( 'Past Events', 'dbem' );
|
30 |
-
break;
|
31 |
-
case "all" :
|
32 |
-
$title = __ ( 'All Events', 'dbem' );
|
33 |
-
break;
|
34 |
-
default :
|
35 |
-
$title = __ ( 'Future Events', 'dbem' );
|
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 |
-
?>
|
44 |
-
<div class="wrap em_bookings_events_table em_obj">
|
45 |
-
<form id="posts-filter" action="" method="get">
|
46 |
-
<input type="hidden" name="em_obj" value="em_bookings_events_table" />
|
47 |
-
<?php if(!empty($_GET['page'])): ?>
|
48 |
-
<input type='hidden' name='page' value='events-manager-bookings' />
|
49 |
-
<?php endif; ?>
|
50 |
-
<div class="tablenav">
|
51 |
-
<div class="alignleft actions">
|
52 |
-
<!--
|
53 |
-
<select name="action">
|
54 |
-
<option value="-1" selected="selected"><?php esc_html_e( 'Bulk Actions' ); ?></option>
|
55 |
-
<option value="deleteEvents"><?php esc_html_e( 'Delete selected','dbem' ); ?></option>
|
56 |
-
</select>
|
57 |
-
<input type="submit" value="<?php esc_html_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
|
58 |
-
-->
|
59 |
-
<select name="scope">
|
60 |
-
<?php
|
61 |
-
foreach ( $scope_names as $key => $value ) {
|
62 |
-
$selected = "";
|
63 |
-
if ($key == $scope)
|
64 |
-
$selected = "selected='selected'";
|
65 |
-
echo "<option value='$key' $selected>$value</option> ";
|
66 |
-
}
|
67 |
-
?>
|
68 |
-
</select>
|
69 |
-
<input id="post-query-submit" class="button-secondary" type="submit" value="<?php esc_html_e( 'Filter' )?>" />
|
70 |
-
</div>
|
71 |
-
<!--
|
72 |
-
<div class="view-switch">
|
73 |
-
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
74 |
-
</div>
|
75 |
-
-->
|
76 |
-
<?php
|
77 |
-
if ( $events_count >= $limit ) {
|
78 |
-
$events_nav = em_admin_paginate( $events_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_events_table'));
|
79 |
-
echo $events_nav;
|
80 |
-
}
|
81 |
-
?>
|
82 |
-
</div>
|
83 |
-
|
84 |
-
<?php
|
85 |
-
if (empty ( $events )) {
|
86 |
-
// TODO localize
|
87 |
-
_e ( 'no events','dbem' );
|
88 |
-
} else {
|
89 |
-
?>
|
90 |
-
<div class='table-wrap'>
|
91 |
-
<table class="widefat">
|
92 |
-
<thead>
|
93 |
-
<tr>
|
94 |
-
<th><?php esc_html_e( 'Event', 'dbem' ); ?></th>
|
95 |
-
<th><?php esc_html_e( 'Date and time', 'dbem' ); ?></th>
|
96 |
-
</tr>
|
97 |
-
</thead>
|
98 |
-
<tbody>
|
99 |
-
<?php
|
100 |
-
$rowno = 0;
|
101 |
-
foreach ( $events as $event ) {
|
102 |
-
/* @var $event EM_Event */
|
103 |
-
$rowno++;
|
104 |
-
$class = ($rowno % 2) ? ' class="alternate"' : '';
|
105 |
-
// FIXME set to american
|
106 |
-
$localised_start_date = date_i18n(get_option('date_format'), $event->start);
|
107 |
-
$localised_end_date = date_i18n(get_option('date_format'), $event->end);
|
108 |
-
$style = "";
|
109 |
-
$today = date ( "Y-m-d" );
|
110 |
-
|
111 |
-
if ($event->start_date < $today && $event->end_date < $today){
|
112 |
-
$style = "style ='background-color: #FADDB7;'";
|
113 |
-
}
|
114 |
-
?>
|
115 |
-
<tr <?php echo "$class $style"; ?>>
|
116 |
-
<td>
|
117 |
-
<strong>
|
118 |
-
<?php echo $event->output('#_BOOKINGSLINK'); ?>
|
119 |
-
</strong>
|
120 |
-
–
|
121 |
-
<?php esc_html_e("Booked Spaces",'dbem') ?>: <?php echo $event->get_bookings()->get_booked_spaces()."/".$event->get_spaces() ?>
|
122 |
-
<?php if( get_option('dbem_bookings_approval') == 1 ) : ?>
|
123 |
-
| <?php esc_html_e("Pending",'dbem') ?>: <?php echo $event->get_bookings()->get_pending_spaces(); ?>
|
124 |
-
<?php endif; ?>
|
125 |
-
</td>
|
126 |
-
|
127 |
-
<td>
|
128 |
-
<?php echo $localised_start_date; ?>
|
129 |
-
<?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
|
130 |
-
–
|
131 |
-
<?php
|
132 |
-
//TODO Should 00:00 - 00:00 be treated as an all day event?
|
133 |
-
echo substr ( $event->start_time, 0, 5 ) . " - " . substr ( $event->end_time, 0, 5 );
|
134 |
-
?>
|
135 |
-
</td>
|
136 |
-
</tr>
|
137 |
-
<?php
|
138 |
-
}
|
139 |
-
?>
|
140 |
-
</tbody>
|
141 |
-
</table>
|
142 |
-
</div>
|
143 |
-
<?php
|
144 |
-
} // end of table
|
145 |
-
?>
|
146 |
-
<div class='tablenav'>
|
147 |
-
<div class="alignleft actions">
|
148 |
-
<br class='clear' />
|
149 |
-
</div>
|
150 |
-
<?php if (!empty($events_nav) && $events_count >= $limit ) : ?>
|
151 |
-
<div class="tablenav-pages">
|
152 |
-
<?php
|
153 |
-
echo $events_nav;
|
154 |
-
?>
|
155 |
-
</div>
|
156 |
-
<?php endif; ?>
|
157 |
-
<br class='clear' />
|
158 |
-
</div>
|
159 |
-
</form>
|
160 |
-
</div>
|
161 |
-
<?php
|
162 |
-
}
|
163 |
-
|
164 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Determines whether to show event page or events page, and saves any updates to the event or events
|
5 |
+
* @return null
|
6 |
+
*/
|
7 |
+
function em_bookings_events_table() {
|
8 |
+
//TODO Simplify panel for events, use form flags to detect certain actions (e.g. submitted, etc)
|
9 |
+
global $wpdb;
|
10 |
+
global $EM_Event;
|
11 |
+
|
12 |
+
$scope_names = array (
|
13 |
+
'past' => __ ( 'Past events', 'dbem' ),
|
14 |
+
'all' => __ ( 'All events', 'dbem' ),
|
15 |
+
'future' => __ ( 'Future events', 'dbem' )
|
16 |
+
);
|
17 |
+
|
18 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_events_table' );
|
19 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
20 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
21 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
22 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
23 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
24 |
+
$scope = ( $action_scope && !empty($_GET ['scope']) && array_key_exists($_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
|
25 |
+
|
26 |
+
// No action, only showing the events list
|
27 |
+
switch ($scope) {
|
28 |
+
case "past" :
|
29 |
+
$title = __ ( 'Past Events', 'dbem' );
|
30 |
+
break;
|
31 |
+
case "all" :
|
32 |
+
$title = __ ( 'All Events', 'dbem' );
|
33 |
+
break;
|
34 |
+
default :
|
35 |
+
$title = __ ( 'Future Events', 'dbem' );
|
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 |
+
?>
|
44 |
+
<div class="wrap em_bookings_events_table em_obj">
|
45 |
+
<form id="posts-filter" action="" method="get">
|
46 |
+
<input type="hidden" name="em_obj" value="em_bookings_events_table" />
|
47 |
+
<?php if(!empty($_GET['page'])): ?>
|
48 |
+
<input type='hidden' name='page' value='events-manager-bookings' />
|
49 |
+
<?php endif; ?>
|
50 |
+
<div class="tablenav">
|
51 |
+
<div class="alignleft actions">
|
52 |
+
<!--
|
53 |
+
<select name="action">
|
54 |
+
<option value="-1" selected="selected"><?php esc_html_e( 'Bulk Actions' ); ?></option>
|
55 |
+
<option value="deleteEvents"><?php esc_html_e( 'Delete selected','dbem' ); ?></option>
|
56 |
+
</select>
|
57 |
+
<input type="submit" value="<?php esc_html_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
|
58 |
+
-->
|
59 |
+
<select name="scope">
|
60 |
+
<?php
|
61 |
+
foreach ( $scope_names as $key => $value ) {
|
62 |
+
$selected = "";
|
63 |
+
if ($key == $scope)
|
64 |
+
$selected = "selected='selected'";
|
65 |
+
echo "<option value='$key' $selected>$value</option> ";
|
66 |
+
}
|
67 |
+
?>
|
68 |
+
</select>
|
69 |
+
<input id="post-query-submit" class="button-secondary" type="submit" value="<?php esc_html_e( 'Filter' )?>" />
|
70 |
+
</div>
|
71 |
+
<!--
|
72 |
+
<div class="view-switch">
|
73 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
74 |
+
</div>
|
75 |
+
-->
|
76 |
+
<?php
|
77 |
+
if ( $events_count >= $limit ) {
|
78 |
+
$events_nav = em_admin_paginate( $events_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_events_table'));
|
79 |
+
echo $events_nav;
|
80 |
+
}
|
81 |
+
?>
|
82 |
+
</div>
|
83 |
+
|
84 |
+
<?php
|
85 |
+
if (empty ( $events )) {
|
86 |
+
// TODO localize
|
87 |
+
_e ( 'no events','dbem' );
|
88 |
+
} else {
|
89 |
+
?>
|
90 |
+
<div class='table-wrap'>
|
91 |
+
<table class="widefat">
|
92 |
+
<thead>
|
93 |
+
<tr>
|
94 |
+
<th><?php esc_html_e( 'Event', 'dbem' ); ?></th>
|
95 |
+
<th><?php esc_html_e( 'Date and time', 'dbem' ); ?></th>
|
96 |
+
</tr>
|
97 |
+
</thead>
|
98 |
+
<tbody>
|
99 |
+
<?php
|
100 |
+
$rowno = 0;
|
101 |
+
foreach ( $events as $event ) {
|
102 |
+
/* @var $event EM_Event */
|
103 |
+
$rowno++;
|
104 |
+
$class = ($rowno % 2) ? ' class="alternate"' : '';
|
105 |
+
// FIXME set to american
|
106 |
+
$localised_start_date = date_i18n(get_option('date_format'), $event->start);
|
107 |
+
$localised_end_date = date_i18n(get_option('date_format'), $event->end);
|
108 |
+
$style = "";
|
109 |
+
$today = date ( "Y-m-d" );
|
110 |
+
|
111 |
+
if ($event->start_date < $today && $event->end_date < $today){
|
112 |
+
$style = "style ='background-color: #FADDB7;'";
|
113 |
+
}
|
114 |
+
?>
|
115 |
+
<tr <?php echo "$class $style"; ?>>
|
116 |
+
<td>
|
117 |
+
<strong>
|
118 |
+
<?php echo $event->output('#_BOOKINGSLINK'); ?>
|
119 |
+
</strong>
|
120 |
+
–
|
121 |
+
<?php esc_html_e("Booked Spaces",'dbem') ?>: <?php echo $event->get_bookings()->get_booked_spaces()."/".$event->get_spaces() ?>
|
122 |
+
<?php if( get_option('dbem_bookings_approval') == 1 ) : ?>
|
123 |
+
| <?php esc_html_e("Pending",'dbem') ?>: <?php echo $event->get_bookings()->get_pending_spaces(); ?>
|
124 |
+
<?php endif; ?>
|
125 |
+
</td>
|
126 |
+
|
127 |
+
<td>
|
128 |
+
<?php echo $localised_start_date; ?>
|
129 |
+
<?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
|
130 |
+
–
|
131 |
+
<?php
|
132 |
+
//TODO Should 00:00 - 00:00 be treated as an all day event?
|
133 |
+
echo substr ( $event->start_time, 0, 5 ) . " - " . substr ( $event->end_time, 0, 5 );
|
134 |
+
?>
|
135 |
+
</td>
|
136 |
+
</tr>
|
137 |
+
<?php
|
138 |
+
}
|
139 |
+
?>
|
140 |
+
</tbody>
|
141 |
+
</table>
|
142 |
+
</div>
|
143 |
+
<?php
|
144 |
+
} // end of table
|
145 |
+
?>
|
146 |
+
<div class='tablenav'>
|
147 |
+
<div class="alignleft actions">
|
148 |
+
<br class='clear' />
|
149 |
+
</div>
|
150 |
+
<?php if (!empty($events_nav) && $events_count >= $limit ) : ?>
|
151 |
+
<div class="tablenav-pages">
|
152 |
+
<?php
|
153 |
+
echo $events_nav;
|
154 |
+
?>
|
155 |
+
</div>
|
156 |
+
<?php endif; ?>
|
157 |
+
<br class='clear' />
|
158 |
+
</div>
|
159 |
+
</form>
|
160 |
+
</div>
|
161 |
+
<?php
|
162 |
+
}
|
163 |
+
|
164 |
?>
|
admin/bookings/em-pending.php
CHANGED
@@ -1,159 +1,159 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Generates a "widget" table of pending bookings with some quick admin operation options.
|
5 |
-
* If event id supplied then only pending bookings for that event will show.
|
6 |
-
*
|
7 |
-
* @param int $event_id
|
8 |
-
*/
|
9 |
-
function em_bookings_pending_table($event_id = false){
|
10 |
-
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
11 |
-
|
12 |
-
if( get_option('dbem_bookings_approval') == 0 ){
|
13 |
-
return false;
|
14 |
-
}
|
15 |
-
|
16 |
-
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_pending_table' );
|
17 |
-
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
18 |
-
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
19 |
-
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
20 |
-
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
21 |
-
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
22 |
-
|
23 |
-
if( is_object($EM_Ticket) ){
|
24 |
-
$EM_Bookings = $EM_Ticket->get_bookings()->get_pending_bookings();
|
25 |
-
}else{
|
26 |
-
if( is_object($EM_Event) ){
|
27 |
-
$EM_Bookings = $EM_Event->get_bookings()->get_pending_bookings();
|
28 |
-
}else{
|
29 |
-
//To optimize performance, we can do one query here for all pending bookings to show.
|
30 |
-
$EM_Bookings = EM_Bookings::get(array('status'=>0));
|
31 |
-
$events = array();
|
32 |
-
//Now let's create events and bookings for this:
|
33 |
-
foreach($EM_Bookings->bookings as $EM_Booking){
|
34 |
-
//create event
|
35 |
-
if( !array_key_exists($EM_Booking->event_id,$events) ){
|
36 |
-
$events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
40 |
-
}
|
41 |
-
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
42 |
-
?>
|
43 |
-
<div class='wrap em_bookings_pending_table em_obj'>
|
44 |
-
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
45 |
-
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
46 |
-
<!--
|
47 |
-
<ul class="subsubsub">
|
48 |
-
<li>
|
49 |
-
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
50 |
-
</li>
|
51 |
-
</ul>
|
52 |
-
<p class="search-box">
|
53 |
-
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
54 |
-
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
55 |
-
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
56 |
-
</p>
|
57 |
-
-->
|
58 |
-
<?php if ( $bookings_count >= $limit ) : ?>
|
59 |
-
<div class='tablenav'>
|
60 |
-
<!--
|
61 |
-
<div class="alignleft actions">
|
62 |
-
<select name="action">
|
63 |
-
<option value="-1" selected="selected">
|
64 |
-
<?php _e('Bulk Actions', 'dbem'); ?>
|
65 |
-
</option>
|
66 |
-
<option value="approve">
|
67 |
-
<?php _e('Approve', 'dbem'); ?>
|
68 |
-
</option>
|
69 |
-
<option value="decline">
|
70 |
-
<?php _e('Decline', 'dbem'); ?>
|
71 |
-
</option>
|
72 |
-
</select>
|
73 |
-
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
74 |
-
</div>
|
75 |
-
-->
|
76 |
-
<!--
|
77 |
-
<div class="view-switch">
|
78 |
-
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
79 |
-
</div>
|
80 |
-
-->
|
81 |
-
<?php
|
82 |
-
if ( $bookings_count >= $limit ) {
|
83 |
-
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_pending_table'));
|
84 |
-
echo $bookings_nav;
|
85 |
-
}
|
86 |
-
?>
|
87 |
-
<div class="clear"></div>
|
88 |
-
</div>
|
89 |
-
<?php endif; ?>
|
90 |
-
<div class="clear"></div>
|
91 |
-
<?php if( $bookings_count > 0 ): ?>
|
92 |
-
<div class='table-wrap'>
|
93 |
-
<table id='dbem-bookings-table' class='widefat post '>
|
94 |
-
<thead>
|
95 |
-
<tr>
|
96 |
-
<th class='manage-column column-cb check-column' scope='col'>
|
97 |
-
<input class='select-all' type="checkbox" value='1' />
|
98 |
-
</th>
|
99 |
-
<th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
|
100 |
-
<?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
|
101 |
-
<th class='manage-column' scope="col"><?php _e('Event', 'dbem'); ?></th>
|
102 |
-
<?php endif; ?>
|
103 |
-
<th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
|
104 |
-
<th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
|
105 |
-
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
106 |
-
<th class='manage-column' scope='col'> </th>
|
107 |
-
</tr>
|
108 |
-
</thead>
|
109 |
-
<tbody>
|
110 |
-
<?php
|
111 |
-
$rowno = 0;
|
112 |
-
$event_count = 0;
|
113 |
-
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
114 |
-
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
115 |
-
$rowno++;
|
116 |
-
?>
|
117 |
-
<tr>
|
118 |
-
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
119 |
-
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
120 |
-
<?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
|
121 |
-
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&event_id=<?php echo $EM_Booking->event_id; ?>"><?php echo $events[$EM_Booking->event_id]->name ?></a></td>
|
122 |
-
<?php endif; ?>
|
123 |
-
<td><?php echo $EM_Booking->person->user_email ?></td>
|
124 |
-
<td><?php echo $EM_Booking->person->phone ?></td>
|
125 |
-
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
126 |
-
<td>
|
127 |
-
<?php
|
128 |
-
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
129 |
-
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
130 |
-
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
131 |
-
?>
|
132 |
-
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
|
133 |
-
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
|
134 |
-
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
|
135 |
-
<a class="em-bookings-edit" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&booking_id=<?php echo $EM_Booking->booking_id; ?>"><?php _e('Edit/View','dbem'); ?></a>
|
136 |
-
</td>
|
137 |
-
</tr>
|
138 |
-
<?php
|
139 |
-
}
|
140 |
-
$event_count++;
|
141 |
-
}
|
142 |
-
?>
|
143 |
-
</tbody>
|
144 |
-
</table>
|
145 |
-
</div>
|
146 |
-
<?php else: ?>
|
147 |
-
<?php _e('No pending bookings.', 'dbem'); ?>
|
148 |
-
<?php endif; ?>
|
149 |
-
</form>
|
150 |
-
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
151 |
-
<div class='tablenav'>
|
152 |
-
<?php echo $bookings_nav; ?>
|
153 |
-
<div class="clear"></div>
|
154 |
-
</div>
|
155 |
-
<?php endif; ?>
|
156 |
-
</div>
|
157 |
-
<?php
|
158 |
-
}
|
159 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Generates a "widget" table of pending bookings with some quick admin operation options.
|
5 |
+
* If event id supplied then only pending bookings for that event will show.
|
6 |
+
*
|
7 |
+
* @param int $event_id
|
8 |
+
*/
|
9 |
+
function em_bookings_pending_table($event_id = false){
|
10 |
+
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
11 |
+
|
12 |
+
if( get_option('dbem_bookings_approval') == 0 ){
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_pending_table' );
|
17 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
18 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
19 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
20 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
21 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
22 |
+
|
23 |
+
if( is_object($EM_Ticket) ){
|
24 |
+
$EM_Bookings = $EM_Ticket->get_bookings()->get_pending_bookings();
|
25 |
+
}else{
|
26 |
+
if( is_object($EM_Event) ){
|
27 |
+
$EM_Bookings = $EM_Event->get_bookings()->get_pending_bookings();
|
28 |
+
}else{
|
29 |
+
//To optimize performance, we can do one query here for all pending bookings to show.
|
30 |
+
$EM_Bookings = EM_Bookings::get(array('status'=>0));
|
31 |
+
$events = array();
|
32 |
+
//Now let's create events and bookings for this:
|
33 |
+
foreach($EM_Bookings->bookings as $EM_Booking){
|
34 |
+
//create event
|
35 |
+
if( !array_key_exists($EM_Booking->event_id,$events) ){
|
36 |
+
$events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
42 |
+
?>
|
43 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
44 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
45 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
46 |
+
<!--
|
47 |
+
<ul class="subsubsub">
|
48 |
+
<li>
|
49 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
50 |
+
</li>
|
51 |
+
</ul>
|
52 |
+
<p class="search-box">
|
53 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
54 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
55 |
+
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
56 |
+
</p>
|
57 |
+
-->
|
58 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
59 |
+
<div class='tablenav'>
|
60 |
+
<!--
|
61 |
+
<div class="alignleft actions">
|
62 |
+
<select name="action">
|
63 |
+
<option value="-1" selected="selected">
|
64 |
+
<?php _e('Bulk Actions', 'dbem'); ?>
|
65 |
+
</option>
|
66 |
+
<option value="approve">
|
67 |
+
<?php _e('Approve', 'dbem'); ?>
|
68 |
+
</option>
|
69 |
+
<option value="decline">
|
70 |
+
<?php _e('Decline', 'dbem'); ?>
|
71 |
+
</option>
|
72 |
+
</select>
|
73 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
74 |
+
</div>
|
75 |
+
-->
|
76 |
+
<!--
|
77 |
+
<div class="view-switch">
|
78 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
79 |
+
</div>
|
80 |
+
-->
|
81 |
+
<?php
|
82 |
+
if ( $bookings_count >= $limit ) {
|
83 |
+
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_pending_table'));
|
84 |
+
echo $bookings_nav;
|
85 |
+
}
|
86 |
+
?>
|
87 |
+
<div class="clear"></div>
|
88 |
+
</div>
|
89 |
+
<?php endif; ?>
|
90 |
+
<div class="clear"></div>
|
91 |
+
<?php if( $bookings_count > 0 ): ?>
|
92 |
+
<div class='table-wrap'>
|
93 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
94 |
+
<thead>
|
95 |
+
<tr>
|
96 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
97 |
+
<input class='select-all' type="checkbox" value='1' />
|
98 |
+
</th>
|
99 |
+
<th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
|
100 |
+
<?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
|
101 |
+
<th class='manage-column' scope="col"><?php _e('Event', 'dbem'); ?></th>
|
102 |
+
<?php endif; ?>
|
103 |
+
<th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
|
104 |
+
<th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
|
105 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
106 |
+
<th class='manage-column' scope='col'> </th>
|
107 |
+
</tr>
|
108 |
+
</thead>
|
109 |
+
<tbody>
|
110 |
+
<?php
|
111 |
+
$rowno = 0;
|
112 |
+
$event_count = 0;
|
113 |
+
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
114 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
115 |
+
$rowno++;
|
116 |
+
?>
|
117 |
+
<tr>
|
118 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
119 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
120 |
+
<?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
|
121 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&event_id=<?php echo $EM_Booking->event_id; ?>"><?php echo $events[$EM_Booking->event_id]->name ?></a></td>
|
122 |
+
<?php endif; ?>
|
123 |
+
<td><?php echo $EM_Booking->person->user_email ?></td>
|
124 |
+
<td><?php echo $EM_Booking->person->phone ?></td>
|
125 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
126 |
+
<td>
|
127 |
+
<?php
|
128 |
+
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
129 |
+
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
130 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
131 |
+
?>
|
132 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
|
133 |
+
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
|
134 |
+
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
|
135 |
+
<a class="em-bookings-edit" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&booking_id=<?php echo $EM_Booking->booking_id; ?>"><?php _e('Edit/View','dbem'); ?></a>
|
136 |
+
</td>
|
137 |
+
</tr>
|
138 |
+
<?php
|
139 |
+
}
|
140 |
+
$event_count++;
|
141 |
+
}
|
142 |
+
?>
|
143 |
+
</tbody>
|
144 |
+
</table>
|
145 |
+
</div>
|
146 |
+
<?php else: ?>
|
147 |
+
<?php _e('No pending bookings.', 'dbem'); ?>
|
148 |
+
<?php endif; ?>
|
149 |
+
</form>
|
150 |
+
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
151 |
+
<div class='tablenav'>
|
152 |
+
<?php echo $bookings_nav; ?>
|
153 |
+
<div class="clear"></div>
|
154 |
+
</div>
|
155 |
+
<?php endif; ?>
|
156 |
+
</div>
|
157 |
+
<?php
|
158 |
+
}
|
159 |
?>
|
admin/bookings/em-person.php
CHANGED
@@ -1,152 +1,152 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Generates a "widget" table of confirmed bookings for a specific event.
|
5 |
-
*
|
6 |
-
* @param int $event_id
|
7 |
-
*/
|
8 |
-
function em_bookings_person_table(){
|
9 |
-
global $wpdb, $current_user,$EM_Person;
|
10 |
-
if(!is_object($EM_Person)){
|
11 |
-
return false;
|
12 |
-
}
|
13 |
-
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
14 |
-
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
15 |
-
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
16 |
-
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
17 |
-
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
18 |
-
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
19 |
-
|
20 |
-
$bookings = $EM_Person->get_bookings();
|
21 |
-
$bookings_count = count($bookings);
|
22 |
-
if($bookings_count > 0){
|
23 |
-
//Get events here in one query to speed things up
|
24 |
-
foreach($bookings as $EM_Booking){
|
25 |
-
$event_ids[] = $EM_Booking->event_id;
|
26 |
-
}
|
27 |
-
$events = EM_Events::get($event_ids);
|
28 |
-
}
|
29 |
-
?>
|
30 |
-
<div class='wrap em_bookings_pending_table em_obj'>
|
31 |
-
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
32 |
-
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
33 |
-
<!--
|
34 |
-
<ul class="subsubsub">
|
35 |
-
<li>
|
36 |
-
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
37 |
-
</li>
|
38 |
-
</ul>
|
39 |
-
<p class="search-box">
|
40 |
-
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
41 |
-
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
42 |
-
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
43 |
-
</p>
|
44 |
-
-->
|
45 |
-
<?php if ( $bookings_count >= $limit ) : ?>
|
46 |
-
<div class='tablenav'>
|
47 |
-
<!--
|
48 |
-
<div class="alignleft actions">
|
49 |
-
<select name="action">
|
50 |
-
<option value="-1" selected="selected">
|
51 |
-
<?php _e('Bulk Actions', 'dbem'); ?>
|
52 |
-
</option>
|
53 |
-
<option value="approve">
|
54 |
-
<?php _e('Approve', 'dbem'); ?>
|
55 |
-
</option>
|
56 |
-
<option value="decline">
|
57 |
-
<?php _e('Decline', 'dbem'); ?>
|
58 |
-
</option>
|
59 |
-
</select>
|
60 |
-
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
61 |
-
</div>
|
62 |
-
-->
|
63 |
-
<!--
|
64 |
-
<div class="view-switch">
|
65 |
-
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
66 |
-
</div>
|
67 |
-
-->
|
68 |
-
<?php
|
69 |
-
if ( $bookings_count >= $limit ) {
|
70 |
-
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
71 |
-
echo $bookings_nav;
|
72 |
-
}
|
73 |
-
?>
|
74 |
-
<div class="clear"></div>
|
75 |
-
</div>
|
76 |
-
<?php endif; ?>
|
77 |
-
<div class="clear"></div>
|
78 |
-
<?php if( $bookings_count > 0 ): ?>
|
79 |
-
<div class='table-wrap'>
|
80 |
-
<table id='dbem-bookings-table' class='widefat post '>
|
81 |
-
<thead>
|
82 |
-
<tr>
|
83 |
-
<th class='manage-column column-cb check-column' scope='col'>
|
84 |
-
<input class='select-all' type="checkbox" value='1' />
|
85 |
-
</th>
|
86 |
-
<th class='manage-column' scope='col'><?php _e('Event', 'dbem'); ?></th>
|
87 |
-
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
88 |
-
<th class='manage-column' scope='col'><?php _e('Status', 'dbem'); ?></th>
|
89 |
-
<th class='manage-column' scope='col'> </th>
|
90 |
-
</tr>
|
91 |
-
</thead>
|
92 |
-
<tbody>
|
93 |
-
<?php
|
94 |
-
$rowno = 0;
|
95 |
-
$event_count = 0;
|
96 |
-
foreach ($bookings as $EM_Booking) {
|
97 |
-
$EM_Event = $events[$EM_Booking->event_id];
|
98 |
-
if( $EM_Event->can_manage('edit_events','edit_others_events') && ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
99 |
-
$rowno++;
|
100 |
-
?>
|
101 |
-
<tr>
|
102 |
-
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
103 |
-
<td><a class="row-title" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&event_id=<?php echo $EM_Event->event_id ?>"><?php echo ($EM_Event->event_name); ?></a></td>
|
104 |
-
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
-
<td><?php echo $EM_Booking->status_array[$EM_Booking->booking_status]; ?>
|
106 |
-
</td>
|
107 |
-
<td>
|
108 |
-
<?php
|
109 |
-
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->booking_id));
|
110 |
-
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
111 |
-
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
112 |
-
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
113 |
-
?>
|
114 |
-
<?php if( get_option('dbem_bookings_approval') && ($EM_Booking->booking_status == 0 ) ): ?>
|
115 |
-
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
|
116 |
-
<?php endif; ?>
|
117 |
-
<?php if( get_option('dbem_bookings_approval') && $EM_Booking->booking_status == 1 ): ?>
|
118 |
-
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
|
119 |
-
<?php endif; ?>
|
120 |
-
<?php if( $EM_Booking->booking_status == 2 ): ?>
|
121 |
-
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
|
122 |
-
<?php endif; ?>
|
123 |
-
<?php if( $EM_Booking->booking_status == 0 || $EM_Booking->booking_status == 1 ): ?>
|
124 |
-
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
|
125 |
-
<?php endif; ?>
|
126 |
-
<a class="em-bookings-edit" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&booking_id=<?php echo $EM_Booking->booking_id; ?>"><?php _e('Edit/View','dbem'); ?></a> |
|
127 |
-
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span>
|
128 |
-
</td>
|
129 |
-
</tr>
|
130 |
-
<?php
|
131 |
-
}
|
132 |
-
$event_count++;
|
133 |
-
}
|
134 |
-
?>
|
135 |
-
</tbody>
|
136 |
-
</table>
|
137 |
-
</div>
|
138 |
-
<?php else: ?>
|
139 |
-
<?php _e('No confirmed bookings.', 'dbem'); ?>
|
140 |
-
<?php endif; ?>
|
141 |
-
</form>
|
142 |
-
<?php if( !empty($bookings_nav) && $bookings >= $limit ) : ?>
|
143 |
-
<div class='tablenav'>
|
144 |
-
<?php echo $bookings_nav; ?>
|
145 |
-
<div class="clear"></div>
|
146 |
-
</div>
|
147 |
-
<?php endif; ?>
|
148 |
-
</div>
|
149 |
-
<?php
|
150 |
-
|
151 |
-
}
|
152 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Generates a "widget" table of confirmed bookings for a specific event.
|
5 |
+
*
|
6 |
+
* @param int $event_id
|
7 |
+
*/
|
8 |
+
function em_bookings_person_table(){
|
9 |
+
global $wpdb, $current_user,$EM_Person;
|
10 |
+
if(!is_object($EM_Person)){
|
11 |
+
return false;
|
12 |
+
}
|
13 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
14 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
15 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
16 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
17 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
18 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
19 |
+
|
20 |
+
$bookings = $EM_Person->get_bookings();
|
21 |
+
$bookings_count = count($bookings);
|
22 |
+
if($bookings_count > 0){
|
23 |
+
//Get events here in one query to speed things up
|
24 |
+
foreach($bookings as $EM_Booking){
|
25 |
+
$event_ids[] = $EM_Booking->event_id;
|
26 |
+
}
|
27 |
+
$events = EM_Events::get($event_ids);
|
28 |
+
}
|
29 |
+
?>
|
30 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
31 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
32 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
33 |
+
<!--
|
34 |
+
<ul class="subsubsub">
|
35 |
+
<li>
|
36 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
37 |
+
</li>
|
38 |
+
</ul>
|
39 |
+
<p class="search-box">
|
40 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
41 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
42 |
+
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
43 |
+
</p>
|
44 |
+
-->
|
45 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
46 |
+
<div class='tablenav'>
|
47 |
+
<!--
|
48 |
+
<div class="alignleft actions">
|
49 |
+
<select name="action">
|
50 |
+
<option value="-1" selected="selected">
|
51 |
+
<?php _e('Bulk Actions', 'dbem'); ?>
|
52 |
+
</option>
|
53 |
+
<option value="approve">
|
54 |
+
<?php _e('Approve', 'dbem'); ?>
|
55 |
+
</option>
|
56 |
+
<option value="decline">
|
57 |
+
<?php _e('Decline', 'dbem'); ?>
|
58 |
+
</option>
|
59 |
+
</select>
|
60 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
61 |
+
</div>
|
62 |
+
-->
|
63 |
+
<!--
|
64 |
+
<div class="view-switch">
|
65 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
66 |
+
</div>
|
67 |
+
-->
|
68 |
+
<?php
|
69 |
+
if ( $bookings_count >= $limit ) {
|
70 |
+
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
71 |
+
echo $bookings_nav;
|
72 |
+
}
|
73 |
+
?>
|
74 |
+
<div class="clear"></div>
|
75 |
+
</div>
|
76 |
+
<?php endif; ?>
|
77 |
+
<div class="clear"></div>
|
78 |
+
<?php if( $bookings_count > 0 ): ?>
|
79 |
+
<div class='table-wrap'>
|
80 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
81 |
+
<thead>
|
82 |
+
<tr>
|
83 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
84 |
+
<input class='select-all' type="checkbox" value='1' />
|
85 |
+
</th>
|
86 |
+
<th class='manage-column' scope='col'><?php _e('Event', 'dbem'); ?></th>
|
87 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
88 |
+
<th class='manage-column' scope='col'><?php _e('Status', 'dbem'); ?></th>
|
89 |
+
<th class='manage-column' scope='col'> </th>
|
90 |
+
</tr>
|
91 |
+
</thead>
|
92 |
+
<tbody>
|
93 |
+
<?php
|
94 |
+
$rowno = 0;
|
95 |
+
$event_count = 0;
|
96 |
+
foreach ($bookings as $EM_Booking) {
|
97 |
+
$EM_Event = $events[$EM_Booking->event_id];
|
98 |
+
if( $EM_Event->can_manage('edit_events','edit_others_events') && ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
99 |
+
$rowno++;
|
100 |
+
?>
|
101 |
+
<tr>
|
102 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
103 |
+
<td><a class="row-title" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&event_id=<?php echo $EM_Event->event_id ?>"><?php echo ($EM_Event->event_name); ?></a></td>
|
104 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
+
<td><?php echo $EM_Booking->status_array[$EM_Booking->booking_status]; ?>
|
106 |
+
</td>
|
107 |
+
<td>
|
108 |
+
<?php
|
109 |
+
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->booking_id));
|
110 |
+
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
111 |
+
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
112 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
113 |
+
?>
|
114 |
+
<?php if( get_option('dbem_bookings_approval') && ($EM_Booking->booking_status == 0 ) ): ?>
|
115 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
|
116 |
+
<?php endif; ?>
|
117 |
+
<?php if( get_option('dbem_bookings_approval') && $EM_Booking->booking_status == 1 ): ?>
|
118 |
+
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
|
119 |
+
<?php endif; ?>
|
120 |
+
<?php if( $EM_Booking->booking_status == 2 ): ?>
|
121 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
|
122 |
+
<?php endif; ?>
|
123 |
+
<?php if( $EM_Booking->booking_status == 0 || $EM_Booking->booking_status == 1 ): ?>
|
124 |
+
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
|
125 |
+
<?php endif; ?>
|
126 |
+
<a class="em-bookings-edit" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&booking_id=<?php echo $EM_Booking->booking_id; ?>"><?php _e('Edit/View','dbem'); ?></a> |
|
127 |
+
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span>
|
128 |
+
</td>
|
129 |
+
</tr>
|
130 |
+
<?php
|
131 |
+
}
|
132 |
+
$event_count++;
|
133 |
+
}
|
134 |
+
?>
|
135 |
+
</tbody>
|
136 |
+
</table>
|
137 |
+
</div>
|
138 |
+
<?php else: ?>
|
139 |
+
<?php _e('No confirmed bookings.', 'dbem'); ?>
|
140 |
+
<?php endif; ?>
|
141 |
+
</form>
|
142 |
+
<?php if( !empty($bookings_nav) && $bookings >= $limit ) : ?>
|
143 |
+
<div class='tablenav'>
|
144 |
+
<?php echo $bookings_nav; ?>
|
145 |
+
<div class="clear"></div>
|
146 |
+
</div>
|
147 |
+
<?php endif; ?>
|
148 |
+
</div>
|
149 |
+
<?php
|
150 |
+
|
151 |
+
}
|
152 |
?>
|
admin/bookings/em-rejected.php
CHANGED
@@ -1,137 +1,137 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Generates a "widget" table of confirmed bookings for a specific event.
|
4 |
-
*
|
5 |
-
* @param int $event_id
|
6 |
-
*/
|
7 |
-
function em_bookings_rejected_table(){
|
8 |
-
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
9 |
-
|
10 |
-
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
11 |
-
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
12 |
-
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
13 |
-
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
14 |
-
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
15 |
-
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
16 |
-
|
17 |
-
if( is_object($EM_Ticket) ){
|
18 |
-
$EM_Bookings = $EM_Ticket->get_bookings()->get_rejected_bookings();
|
19 |
-
}else{
|
20 |
-
if( is_object($EM_Event) ){
|
21 |
-
$EM_Bookings = $EM_Event->get_bookings()->get_rejected_bookings();
|
22 |
-
}else{
|
23 |
-
return false;
|
24 |
-
}
|
25 |
-
}
|
26 |
-
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
27 |
-
?>
|
28 |
-
<div class='wrap em_bookings_pending_table em_obj'>
|
29 |
-
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
30 |
-
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
31 |
-
<!--
|
32 |
-
<ul class="subsubsub">
|
33 |
-
<li>
|
34 |
-
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
35 |
-
</li>
|
36 |
-
</ul>
|
37 |
-
<p class="search-box">
|
38 |
-
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
39 |
-
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
40 |
-
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
41 |
-
</p>
|
42 |
-
-->
|
43 |
-
<?php if ( $bookings_count >= $limit ) : ?>
|
44 |
-
<div class='tablenav'>
|
45 |
-
<!--
|
46 |
-
<div class="alignleft actions">
|
47 |
-
<select name="action">
|
48 |
-
<option value="-1" selected="selected">
|
49 |
-
<?php _e('Bulk Actions', 'dbem'); ?>
|
50 |
-
</option>
|
51 |
-
<option value="approve">
|
52 |
-
<?php _e('Approve', 'dbem'); ?>
|
53 |
-
</option>
|
54 |
-
<option value="decline">
|
55 |
-
<?php _e('Decline', 'dbem'); ?>
|
56 |
-
</option>
|
57 |
-
</select>
|
58 |
-
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
59 |
-
</div>
|
60 |
-
-->
|
61 |
-
<!--
|
62 |
-
<div class="view-switch">
|
63 |
-
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
64 |
-
</div>
|
65 |
-
-->
|
66 |
-
<?php
|
67 |
-
if ( $bookings_count >= $limit ) {
|
68 |
-
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
69 |
-
echo $bookings_nav;
|
70 |
-
}
|
71 |
-
?>
|
72 |
-
<div class="clear"></div>
|
73 |
-
</div>
|
74 |
-
<?php endif; ?>
|
75 |
-
<div class="clear"></div>
|
76 |
-
<?php if( $bookings_count > 0 ): ?>
|
77 |
-
<div class='table-wrap'>
|
78 |
-
<table id='dbem-bookings-table' class='widefat post '>
|
79 |
-
<thead>
|
80 |
-
<tr>
|
81 |
-
<th class='manage-column column-cb check-column' scope='col'>
|
82 |
-
<input class='select-all' type="checkbox" value='1' />
|
83 |
-
</th>
|
84 |
-
<th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
|
85 |
-
<th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
|
86 |
-
<th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
|
87 |
-
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
88 |
-
<th class='manage-column' scope='col'> </th>
|
89 |
-
</tr>
|
90 |
-
</thead>
|
91 |
-
<tbody>
|
92 |
-
<?php
|
93 |
-
$rowno = 0;
|
94 |
-
$event_count = 0;
|
95 |
-
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
96 |
-
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
97 |
-
$rowno++;
|
98 |
-
?>
|
99 |
-
<tr>
|
100 |
-
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
101 |
-
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
102 |
-
<td><?php echo $EM_Booking->person->user_email ?></td>
|
103 |
-
<td><?php echo $EM_Booking->person->phone ?></td>
|
104 |
-
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
-
<td>
|
106 |
-
<?php
|
107 |
-
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
108 |
-
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
-
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
110 |
-
?>
|
111 |
-
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
|
112 |
-
<a class="em-bookings-edit" href="<?php echo $edit_url ?>"><?php _e('Edit/View','dbem'); ?></a> |
|
113 |
-
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span>
|
114 |
-
</td>
|
115 |
-
</tr>
|
116 |
-
<?php
|
117 |
-
}
|
118 |
-
$event_count++;
|
119 |
-
}
|
120 |
-
?>
|
121 |
-
</tbody>
|
122 |
-
</table>
|
123 |
-
</div>
|
124 |
-
<?php else: ?>
|
125 |
-
<?php _e('No rejected bookings.', 'dbem'); ?>
|
126 |
-
<?php endif; ?>
|
127 |
-
</form>
|
128 |
-
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
129 |
-
<div class='tablenav'>
|
130 |
-
<?php echo $bookings_nav; ?>
|
131 |
-
<div class="clear"></div>
|
132 |
-
</div>
|
133 |
-
<?php endif; ?>
|
134 |
-
</div>
|
135 |
-
<?php
|
136 |
-
}
|
137 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Generates a "widget" table of confirmed bookings for a specific event.
|
4 |
+
*
|
5 |
+
* @param int $event_id
|
6 |
+
*/
|
7 |
+
function em_bookings_rejected_table(){
|
8 |
+
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
9 |
+
|
10 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
11 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
12 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
13 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
14 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
15 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
16 |
+
|
17 |
+
if( is_object($EM_Ticket) ){
|
18 |
+
$EM_Bookings = $EM_Ticket->get_bookings()->get_rejected_bookings();
|
19 |
+
}else{
|
20 |
+
if( is_object($EM_Event) ){
|
21 |
+
$EM_Bookings = $EM_Event->get_bookings()->get_rejected_bookings();
|
22 |
+
}else{
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
27 |
+
?>
|
28 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
29 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
30 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
31 |
+
<!--
|
32 |
+
<ul class="subsubsub">
|
33 |
+
<li>
|
34 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
35 |
+
</li>
|
36 |
+
</ul>
|
37 |
+
<p class="search-box">
|
38 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
|
39 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
40 |
+
<input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
|
41 |
+
</p>
|
42 |
+
-->
|
43 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
44 |
+
<div class='tablenav'>
|
45 |
+
<!--
|
46 |
+
<div class="alignleft actions">
|
47 |
+
<select name="action">
|
48 |
+
<option value="-1" selected="selected">
|
49 |
+
<?php _e('Bulk Actions', 'dbem'); ?>
|
50 |
+
</option>
|
51 |
+
<option value="approve">
|
52 |
+
<?php _e('Approve', 'dbem'); ?>
|
53 |
+
</option>
|
54 |
+
<option value="decline">
|
55 |
+
<?php _e('Decline', 'dbem'); ?>
|
56 |
+
</option>
|
57 |
+
</select>
|
58 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
59 |
+
</div>
|
60 |
+
-->
|
61 |
+
<!--
|
62 |
+
<div class="view-switch">
|
63 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
64 |
+
</div>
|
65 |
+
-->
|
66 |
+
<?php
|
67 |
+
if ( $bookings_count >= $limit ) {
|
68 |
+
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
69 |
+
echo $bookings_nav;
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
<div class="clear"></div>
|
73 |
+
</div>
|
74 |
+
<?php endif; ?>
|
75 |
+
<div class="clear"></div>
|
76 |
+
<?php if( $bookings_count > 0 ): ?>
|
77 |
+
<div class='table-wrap'>
|
78 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
79 |
+
<thead>
|
80 |
+
<tr>
|
81 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
82 |
+
<input class='select-all' type="checkbox" value='1' />
|
83 |
+
</th>
|
84 |
+
<th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
|
85 |
+
<th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
|
86 |
+
<th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
|
87 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
|
88 |
+
<th class='manage-column' scope='col'> </th>
|
89 |
+
</tr>
|
90 |
+
</thead>
|
91 |
+
<tbody>
|
92 |
+
<?php
|
93 |
+
$rowno = 0;
|
94 |
+
$event_count = 0;
|
95 |
+
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
96 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
97 |
+
$rowno++;
|
98 |
+
?>
|
99 |
+
<tr>
|
100 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
101 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
102 |
+
<td><?php echo $EM_Booking->person->user_email ?></td>
|
103 |
+
<td><?php echo $EM_Booking->person->phone ?></td>
|
104 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
+
<td>
|
106 |
+
<?php
|
107 |
+
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
108 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
+
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
110 |
+
?>
|
111 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
|
112 |
+
<a class="em-bookings-edit" href="<?php echo $edit_url ?>"><?php _e('Edit/View','dbem'); ?></a> |
|
113 |
+
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span>
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<?php
|
117 |
+
}
|
118 |
+
$event_count++;
|
119 |
+
}
|
120 |
+
?>
|
121 |
+
</tbody>
|
122 |
+
</table>
|
123 |
+
</div>
|
124 |
+
<?php else: ?>
|
125 |
+
<?php _e('No rejected bookings.', 'dbem'); ?>
|
126 |
+
<?php endif; ?>
|
127 |
+
</form>
|
128 |
+
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
129 |
+
<div class='tablenav'>
|
130 |
+
<?php echo $bookings_nav; ?>
|
131 |
+
<div class="clear"></div>
|
132 |
+
</div>
|
133 |
+
<?php endif; ?>
|
134 |
+
</div>
|
135 |
+
<?php
|
136 |
+
}
|
137 |
?>
|
admin/em-admin.php
CHANGED
@@ -1,306 +1,306 @@
|
|
1 |
-
<?php
|
2 |
-
//Admin functions
|
3 |
-
function em_admin_menu(){
|
4 |
-
global $menu, $submenu, $pagenow;
|
5 |
-
//Count pending bookings
|
6 |
-
if( get_option('dbem_rsvp_enabled') ){
|
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>';
|
14 |
-
}
|
15 |
-
}else{
|
16 |
-
$bookings_num = '';
|
17 |
-
$bookings_pending_count = 0;
|
18 |
-
}
|
19 |
-
//Count pending events
|
20 |
-
$events_num = '';
|
21 |
-
$events_pending_count = EM_Events::count(array('status'=>0, 'scope'=>'all', 'blog'=>get_current_blog_id()));
|
22 |
-
//TODO Add flexible permissions
|
23 |
-
if($events_pending_count > 0){
|
24 |
-
$events_num = '<span class="update-plugins count-'.$events_pending_count.'"><span class="plugin-count">'.$events_pending_count.'</span></span>';
|
25 |
-
}
|
26 |
-
//Count pending recurring events
|
27 |
-
$events_recurring_num = '';
|
28 |
-
$events_recurring_pending_count = EM_Events::count(array('status'=>0, 'recurring'=>1, 'scope'=>'all', 'blog'=>get_current_blog_id()));
|
29 |
-
//TODO Add flexible permissions
|
30 |
-
if($events_recurring_pending_count > 0){
|
31 |
-
$events_recurring_num = '<span class="update-plugins count-'.$events_recurring_pending_count.'"><span class="plugin-count">'.$events_recurring_pending_count.'</span></span>';
|
32 |
-
}
|
33 |
-
$both_pending_count = apply_filters('em_items_pending_count', $events_pending_count + $bookings_pending_count + $events_recurring_pending_count);
|
34 |
-
$both_num = ($both_pending_count > 0) ? '<span class="update-plugins count-'.$both_pending_count.'"><span class="plugin-count">'.$both_pending_count.'</span></span>':'';
|
35 |
-
// Add a submenu to the custom top-level menu:
|
36 |
-
$plugin_pages = array();
|
37 |
-
if( get_option('dbem_rsvp_enabled') ){
|
38 |
-
$plugin_pages['bookings'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Bookings', 'dbem'), __('Bookings', 'dbem').$bookings_num, 'manage_bookings', 'events-manager-bookings', "em_bookings_page");
|
39 |
-
}
|
40 |
-
$plugin_pages['options'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Events Manager Settings','dbem'),__('Settings','dbem'), 'list_users', "events-manager-options", 'em_admin_options_page');
|
41 |
-
$plugin_pages['help'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Getting Help for Events Manager','dbem'),__('Help','dbem'), 'list_users', "events-manager-help", 'em_admin_help_page');
|
42 |
-
//If multisite global with locations set to be saved in main blogs we can force locations to be created on the main blog only
|
43 |
-
if( EM_MS_GLOBAL && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){
|
44 |
-
include( dirname(__FILE__)."/em-ms-locations.php" );
|
45 |
-
$plugin_pages['locations'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Locations','dbem'),__('Locations','dbem'), 'read_others_locations', "locations", 'em_admin_ms_locations');
|
46 |
-
}
|
47 |
-
$plugin_pages = apply_filters('em_create_events_submenu',$plugin_pages);
|
48 |
-
//We have to modify the menus manually
|
49 |
-
if( !empty($both_num) ){ //Main Event Menu
|
50 |
-
//go through the menu array and modify the events menu if found
|
51 |
-
foreach ( (array)$menu as $key => $parent_menu ) {
|
52 |
-
if ( $parent_menu[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
|
53 |
-
$menu[$key][0] = $menu[$key][0]. $both_num;
|
54 |
-
break;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
}
|
58 |
-
if( !empty($events_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Event Item
|
59 |
-
//go through the menu array and modify the events menu if found
|
60 |
-
foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
|
61 |
-
if ( $submenu_item[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
|
62 |
-
$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_num;
|
63 |
-
break;
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
if( !empty($events_recurring_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Recurring Event Item
|
68 |
-
//go through the menu array and modify the events menu if found
|
69 |
-
foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
|
70 |
-
if ( $submenu_item[2] == 'edit.php?post_type=event-recurring' ){
|
71 |
-
$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_recurring_num;
|
72 |
-
break;
|
73 |
-
}
|
74 |
-
}
|
75 |
-
}
|
76 |
-
/* Hack! Add location/recurrence isn't possible atm so this is a workaround */
|
77 |
-
global $_wp_submenu_nopriv;
|
78 |
-
if( $pagenow == 'post-new.php' && !empty($_REQUEST['post_type']) ){
|
79 |
-
if( $_REQUEST['post_type'] == EM_POST_TYPE_LOCATION && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_locations') ){
|
80 |
-
unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
|
81 |
-
}
|
82 |
-
if( $_REQUEST['post_type'] == 'event-recurring' && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_recurring_events') ){
|
83 |
-
unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
add_action('admin_menu','em_admin_menu');
|
88 |
-
|
89 |
-
function em_admin_dashicon(){
|
90 |
-
?>
|
91 |
-
<style type="text/css">
|
92 |
-
@font-face {
|
93 |
-
font-family: 'em_dashicons';
|
94 |
-
src: url('../fonts/em-dashicons.eot'); // this is for IE
|
95 |
-
}
|
96 |
-
@font-face {
|
97 |
-
font-family: 'em_dashicons';
|
98 |
-
src: url(data:application/font-woff;charset=utf-8;base64,d09GRk9UVE8AAAVIAAoAAAAABQAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAAA9AAAAb8AAAG/+vk+uU9TLzIAAAK0AAAAYAAAAGAIIvy2Y21hcAAAAxQAAABMAAAATBpVzFdnYXNwAAADYAAAAAgAAAAIAAAAEGhlYWQAAANoAAAANgAAADYBZ6hBaGhlYQAAA6AAAAAkAAAAJAPIAeZobXR4AAADxAAAABQAAAAUAwAAM21heHAAAAPYAAAABgAAAAYABVAAbmFtZQAAA+AAAAFFAAABRVcZpu5wb3N0AAAFKAAAACAAAAAgAAMAAAEABAQAAQEBCGljb21vb24AAQIAAQA6+BwC+BsD+BgEHgoAGVP/i4seCgAZU/+LiwwHi2v4lPh0BR0AAAB2Dx0AAAB7ER0AAAAJHQAAAbYSAAYBAQgPERMWG2ljb21vb25pY29tb29udTB1MXUyMHVFNjAwAAACAYkAAwAFAgABAAQABwAKAA0BLfyUDvyUDvyUDvuUDvcu+FoVfIuAgIt9CItYBYt8loCai5mLlpaLmgiLvgWLmYCWfYsI93qLFX2Lf4CLfQiLWAWLfJeAmYuZi5eWi5oIi74Fi5l/ln2LCPth+0cVi1hYi4u+vosFpYsVvouLWFiLi74F2IsVvouLWFiLi74F14sVv4uLWFeLi74Fiz4VvouLWFiLi74FPosVv4uLWFeLi74FPosVv4uLWFeLi74FP4sVvouLWFiLi74F1z8Vv4uLV1eLi78F2IsVv4uLV1eLi78F9y33ihWGc3d5cotui3Wii6gIi5cFdI91jXiLd4t1iXWHCIt+BYtvdHRui3KLd52Go2yCdoSLi4uLi2eLfIv7lfduWYuLi4v3bb2L95WLmYuwi4uLi3aSbJQIDviUFPiUFYsMCgAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmAAHg/+D/4AHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIOYA//3//wAAAAAAIOYA//3//wAB/+MaBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAEAAIXyBpNfDzz1AAsCAAAAAADQMTPCAAAAANAxM8IAAP/6AeYBxgAAAAgAAgAAAAAAAAABAAAB4P/gAAACAAAAAAAB5gABAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAEAAAACAAAzAABQAAAFAAAAAAAOAK4AAQAAAAAAAQAOAAAAAQAAAAAAAgAOAEcAAQAAAAAAAwAOACQAAQAAAAAABAAOAFUAAQAAAAAABQAWAA4AAQAAAAAABgAHADIAAQAAAAAACgA0AGMAAwABBAkAAQAOAAAAAwABBAkAAgAOAEcAAwABBAkAAwAOACQAAwABBAkABAAOAFUAAwABBAkABQAWAA4AAwABBAkABgAOADkAAwABBAkACgA0AGMAaQBjAG8AbQBvAG8AbgBWAGUAcgBzAGkAbwBuACAAMQAuADAAaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AbgBSAGUAZwB1AGwAYQByAGkAYwBvAG0AbwBvAG4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format('woff'),
|
99 |
-
url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMggi/LYAAAC8AAAAYGNtYXAaVcxXAAABHAAAAExnYXNwAAAAEAAAAWgAAAAIZ2x5ZsaoTWEAAAFwAAACFGhlYWQBZ6hBAAADhAAAADZoaGVhA8gB5gAAA7wAAAAkaG10eAMAADMAAAPgAAAAFGxvY2EAKAEeAAAD9AAAAAxtYXhwABMAowAABAAAAAAgbmFtZVcZpu4AAAQgAAABRXBvc3QAAwAAAAAFaAAAACAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmAAHg/+D/4AHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIOYA//3//wAAAAAAIOYA//3//wAB/+MaBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAADQAz//oB5gHGABoANQA6AD8ARABJAE4AUwBYAF0AYgBnAKAAABMiBgcOAQcXBhYXHgEzMjY3PgE3JzYmJy4BIzMiBgcOARcHHgEXHgEzMjY3PgEnNy4BJy4BIwcXIzczOwEXIzc7AQcjJzsBFyM3BzMHIycjMxcjNyMzByMnIzMXIzcXMwcjJzsBFyM3Nw4BBw4BIyImJy4BJzcuASciJiMiBiMOAQ8BFgYHDgEjIiYnLgEnDgEzIhYHHgEzIjYnNiYzIiYnmgUKAgUDAQEBBQMECAcECgMEAwEBAQUCBQgG5wYJBAMFAQEBAwUCCwQGCQQDBQEBAQMFAgsEzgE0ATIbMgE0AUw0ATIBTTMBNQEBNAEyAUwzATUBTjUBMwFLMgE0AUs1ATMBTjMBNQGYAQoGBxAKChQFCAcBAQoPCQcRBgkOCQgRBwEBCgUIEgwIEgUICAMWHgEBAQEB2QEB2gEBAQEBHBgBxgQDBAkFMwYJBAMEBAMECQYzBQkEAwQEAwQJBTMGCQQDBAQDBAkGMwUJBAMEszMzMzMzMzMzTTMzMzMzMzMzTDQ0NDT2CQ8GBQcIBwcTCwwCAgEBAQECAg0KEwcHCAcFBg8JBwkoC8FycsELKAkHAAEAAAABAACs5UCKXw889QALAgAAAAAA0DEzwgAAAADQMTPCAAD/+gHmAcYAAAAIAAIAAAAAAAAAAQAAAeD/4AAAAgAAAAAAAeYAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAABAAAAAgAAMwAAAAAACgAUAB4BCgABAAAABQChAA0AAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIADgBHAAEAAAAAAAMADgAkAAEAAAAAAAQADgBVAAEAAAAAAAUAFgAOAAEAAAAAAAYABwAyAAEAAAAAAAoANABjAAMAAQQJAAEADgAAAAMAAQQJAAIADgBHAAMAAQQJAAMADgAkAAMAAQQJAAQADgBVAAMAAQQJAAUAFgAOAAMAAQQJAAYADgA5AAMAAQQJAAoANABjAGkAYwBvAG0AbwBvAG4AVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG4AUgBlAGcAdQBsAGEAcgBpAGMAbwBtAG8AbwBuAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format('truetype');
|
100 |
-
font-weight: normal;
|
101 |
-
font-style: normal;
|
102 |
-
}
|
103 |
-
.menu-icon-event .dashicons-calendar:before, #toplevel_page_events-manager-options .dashicons-calendar:before {
|
104 |
-
font-family: 'em_dashicons' !important;
|
105 |
-
content: '\e600';
|
106 |
-
}
|
107 |
-
</style>
|
108 |
-
<?php
|
109 |
-
}
|
110 |
-
add_action('admin_head','em_admin_dashicon');
|
111 |
-
|
112 |
-
function em_ms_admin_menu(){
|
113 |
-
add_menu_page( __('Events Manager','dbem'), __('Events Manager','dbem'), 'activate_plugins', 'events-manager-options', 'em_ms_admin_options_page', 'dashicons-calendar' );
|
114 |
-
add_submenu_page('events-manager-options', __('Update Blogs','dbem'),__('Update Blogs','dbem'), 'activate_plugins', "events-manager-update", 'em_ms_upgrade');
|
115 |
-
}
|
116 |
-
add_action('network_admin_menu','em_ms_admin_menu');
|
117 |
-
|
118 |
-
function em_admin_init(){
|
119 |
-
//in MS global mode and locations are stored in the main blog, then a user must have at least a subscriber role
|
120 |
-
if( EM_MS_GLOBAL && is_user_logged_in() && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){
|
121 |
-
EM_Object::ms_global_switch();
|
122 |
-
$user = new WP_User(get_current_user_id());
|
123 |
-
if( count($user->roles) == 0 ){
|
124 |
-
$user->set_role('subscriber');
|
125 |
-
}
|
126 |
-
EM_Object::ms_global_switch_back();
|
127 |
-
}
|
128 |
-
}
|
129 |
-
add_action('admin_init','em_admin_init');
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Generate warnings and notices in the admin area
|
133 |
-
*/
|
134 |
-
function em_admin_warnings() {
|
135 |
-
global $EM_Notices;
|
136 |
-
//If we're editing the events page show hello to new user
|
137 |
-
$events_page_id = get_option ( 'dbem_events_page' );
|
138 |
-
$dismiss_link_joiner = ( count($_GET) > 0 ) ? '&':'?';
|
139 |
-
|
140 |
-
if( current_user_can('activate_plugins') ){
|
141 |
-
//New User Intro
|
142 |
-
if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){
|
143 |
-
// Disable Hello to new user if requested
|
144 |
-
update_option('dbem_hello_to_user',0);
|
145 |
-
}elseif ( get_option ( 'dbem_hello_to_user' ) ) {
|
146 |
-
//FIXME update welcome msg with good links
|
147 |
-
$advice = sprintf( __("<p>Events Manager is ready to go! It is highly recommended you read the <a href='%s'>Getting Started</a> guide on our site, as well as checking out the <a href='%s'>Settings Page</a>. <a href='%s' title='Don't show this advice again'>Dismiss</a></p>", 'dbem'), 'http://wp-events-plugin.com/documentation/getting-started/?utm_source=em&utm_medium=plugin&utm_content=installationlink&utm_campaign=plugin_links', EM_ADMIN_URL .'&page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'disable_hello_to_user=true');
|
148 |
-
?>
|
149 |
-
<div id="message" class="updated">
|
150 |
-
<?php echo $advice; ?>
|
151 |
-
</div>
|
152 |
-
<?php
|
153 |
-
}
|
154 |
-
|
155 |
-
//If events page couldn't be created or is missing
|
156 |
-
if( !empty($_GET['em_dismiss_events_page']) ){
|
157 |
-
update_option('dbem_dismiss_events_page',1);
|
158 |
-
}else{
|
159 |
-
if ( !get_page($events_page_id) && !get_option('dbem_dismiss_events_page') ){
|
160 |
-
?>
|
161 |
-
<div id="em_page_error" class="updated">
|
162 |
-
<p><?php echo sprintf ( __( 'Uh Oh! For some reason WordPress could not create an events page for you (or you just deleted it). Not to worry though, all you have to do is create an empty page, name it whatever you want, and select it as your events page in your <a href="%s">settings page</a>. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so <a href="%s">ignore this message</a>', 'dbem'), EM_ADMIN_URL .'&page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1' ); ?></p>
|
163 |
-
</div>
|
164 |
-
<?php
|
165 |
-
}
|
166 |
-
}
|
167 |
-
|
168 |
-
if( defined('EMP_VERSION') && EMP_VERSION < EM_PRO_MIN_VERSION && !defined('EMP_DISABLE_WARNINGS')){
|
169 |
-
?>
|
170 |
-
<div id="em_page_error" class="updated">
|
171 |
-
<p><?php _e('There is a newer version of Events Manager Pro which is recommended for this current version of Events Manager as new features have been added. Please go to the plugin website and download the latest update.','dbem'); ?></p>
|
172 |
-
</div>
|
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{
|
180 |
-
?>
|
181 |
-
<div id="em_page_error" class="updated">
|
182 |
-
<p><?php echo sprintf(__('MultiSite options have moved <a href="%s">here</a>. <a href="%s">Dismiss message</a>','dbem'),admin_url().'network/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].'&disable_dbem_ms_update_nag=1'); ?></p>
|
183 |
-
</div>
|
184 |
-
<?php
|
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{
|
192 |
-
?>
|
193 |
-
<div id="em_page_error" class="updated">
|
194 |
-
<p><?php echo sprintf(__('Whilst they will still appear using placeholders, you need to <a href="%s">migrate your location and event images</a> in order for them to appear in your edit forms and media library. <a href="%s">Dismiss message</a>','dbem'),admin_url().'edit.php?post_type=event&page=events-manager-options&em_migrate_images=1&_wpnonce='.wp_create_nonce('em_migrate_images'), em_add_get_params($_SERVER['REQUEST_URI'], array('disable_dbem_migrate_images_nag' => 1))); ?></p>
|
195 |
-
</div>
|
196 |
-
<?php
|
197 |
-
}
|
198 |
-
}
|
199 |
-
if( !empty($_REQUEST['page']) && 'events-manager-options' == $_REQUEST['page'] && get_option('dbem_pro_dev_updates') == 1 ){
|
200 |
-
?>
|
201 |
-
<div id="message" class="updated">
|
202 |
-
<p><?php echo sprintf(__('Dev Mode active: Just a friendly reminder that you are updating to development versions. Only admins see this message, and it will go away when you disable this <a href="#pro-api">here</a> in your settings.','dbem'),'<code>define(\'EMP_DEV_UPDATES\',true);</code>'); ?></p>
|
203 |
-
</div>
|
204 |
-
<?php
|
205 |
-
}
|
206 |
-
if( class_exists('SitePress') && !class_exists('EM_WPML') && !get_site_option('disable_em_wpml_warning') ){
|
207 |
-
if( !empty($_REQUEST['disable_em_wpml_warning']) ){
|
208 |
-
update_site_option('disable_em_wpml_warning',1);
|
209 |
-
}else{
|
210 |
-
?>
|
211 |
-
<div id="message" class="updated">
|
212 |
-
<p><?php echo sprintf(__('It looks like you have WPML enabled on your site. We advise you also install our extra <a href="%s">Events Manager WPML Connector</a> plugin which helps the two work better together. <a href="%s">Dismiss message</a>','dbem'),'http://wordpress.org/extend/plugins/events-manager-wpml/', esc_url(add_query_arg(array('disable_em_wpml_warning'=>1)))); ?></p>
|
213 |
-
</div>
|
214 |
-
<?php
|
215 |
-
}
|
216 |
-
}
|
217 |
-
if( array_key_exists('dbem_disable_timthumb', wp_load_alloptions()) ){
|
218 |
-
if( !empty($_REQUEST['dbem_disable_timthumb']) ){
|
219 |
-
delete_option('dbem_disable_timthumb',1);
|
220 |
-
}else{
|
221 |
-
?>
|
222 |
-
<div id="message" class="updated">
|
223 |
-
<p>We have stopped using TimThumb for thumbnails in Events Manager, <a href="http://wp-events-plugin.com/blog/2014/12/05/bye-timthumb/">please see this post</a> for more information on how this may affect you and what options are available to you. <a href="<?php echo esc_url(add_query_arg(array('dbem_disable_timthumb'=>1))); ?>">Dismiss</a></p>
|
224 |
-
</div>
|
225 |
-
<?php
|
226 |
-
}
|
227 |
-
}
|
228 |
-
}
|
229 |
-
//Warn about EM page edit
|
230 |
-
if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
|
231 |
-
$message = sprintf ( __ ( "This page corresponds to the <strong>Events Manager</strong> %s page. Its content will be overriden by Events Manager, although if you include the word CONTENTS (exactly in capitals) and surround it with other text, only CONTENTS will be overwritten. If you want to change the way your events look, go to the <a href='%s'>settings</a> page. ", 'dbem' ), __('Events','dbem'), EM_ADMIN_URL .'&page=events-manager-options' );
|
232 |
-
$notice = "<div class='error'><p>$message</p></div>";
|
233 |
-
echo $notice;
|
234 |
-
}
|
235 |
-
echo $EM_Notices;
|
236 |
-
}
|
237 |
-
add_action ( 'admin_notices', 'em_admin_warnings', 100 );
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Settings link in the plugins page menu
|
241 |
-
* @param array $links
|
242 |
-
* @param string $file
|
243 |
-
* @return array
|
244 |
-
*/
|
245 |
-
function em_plugin_action_links($actions, $file, $plugin_data) {
|
246 |
-
$new_actions = array();
|
247 |
-
$new_actions[] = sprintf( '<a href="'.EM_ADMIN_URL.'&page=events-manager-options">%s</a>', __('Settings', 'dbem') );
|
248 |
-
$new_actions = array_merge($new_actions, $actions);
|
249 |
-
if( is_multisite() ){
|
250 |
-
$uninstall_url = admin_url().'network/admin.php?page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
251 |
-
}else{
|
252 |
-
$uninstall_url = EM_ADMIN_URL.'&page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
253 |
-
}
|
254 |
-
$new_actions[] = '<span class="delete"><a href="'.$uninstall_url.'" class="delete">'.__('Uninstall','dbem').'</a></span>';
|
255 |
-
return $new_actions;
|
256 |
-
}
|
257 |
-
add_filter( 'plugin_action_links_events-manager/events-manager.php', 'em_plugin_action_links', 10, 3 );
|
258 |
-
|
259 |
-
//Updates and Dev versions
|
260 |
-
function em_updates_check( $transient ) {
|
261 |
-
// Check if the transient contains the 'checked' information
|
262 |
-
if( empty( $transient->checked ) )
|
263 |
-
return $transient;
|
264 |
-
|
265 |
-
//only bother if we're checking for dev versions
|
266 |
-
if( get_option('em_check_dev_version') || get_option('dbem_pro_dev_updates') ){
|
267 |
-
//check WP repo for trunk version
|
268 |
-
$request = wp_remote_get('http://plugins.svn.wordpress.org/events-manager/trunk/events-manager.php');
|
269 |
-
|
270 |
-
if( !is_wp_error($request) ){
|
271 |
-
preg_match('/Version: ([0-9a-z\.]+)/', $request['body'], $matches);
|
272 |
-
|
273 |
-
if( !empty($matches[1]) ){
|
274 |
-
//we have a version number!
|
275 |
-
if( version_compare($transient->checked[EM_SLUG], $matches[1]) < 0) {
|
276 |
-
$response = new stdClass();
|
277 |
-
$response->slug = EM_SLUG;
|
278 |
-
$response->new_version = $matches[1] ;
|
279 |
-
$response->url = 'http://wordpress.org/extend/plugins/events-manager/';
|
280 |
-
$response->package = 'http://downloads.wordpress.org/plugin/events-manager.zip';
|
281 |
-
$transient->response[EM_SLUG] = $response;
|
282 |
-
}
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
-
delete_option('em_check_dev_version');
|
287 |
-
}
|
288 |
-
|
289 |
-
return $transient;
|
290 |
-
}
|
291 |
-
add_filter('pre_set_site_transient_update_plugins', 'em_updates_check'); // Hook into the plugin update check and mod for dev version
|
292 |
-
|
293 |
-
function em_user_action_links( $actions, $user ){
|
294 |
-
if ( !is_network_admin() && current_user_can( 'manage_others_bookings' ) ){
|
295 |
-
if( get_option('dbem_edit_bookings_page') && (!is_admin() || !empty($_REQUEST['is_public'])) ){
|
296 |
-
$my_bookings_page = get_permalink(get_option('dbem_edit_bookings_page'));
|
297 |
-
$bookings_link = em_add_get_params($my_bookings_page, array('person_id'=>$user->ID), false);
|
298 |
-
}else{
|
299 |
-
$bookings_link = EM_ADMIN_URL. "&page=events-manager-bookings&person_id=".$user->ID;
|
300 |
-
}
|
301 |
-
$actions['bookings'] = "<a href='$bookings_link'>" . __( 'Bookings','dbem' ) . "</a>";
|
302 |
-
}
|
303 |
-
return $actions;
|
304 |
-
}
|
305 |
-
add_filter('user_row_actions','em_user_action_links',10,2);
|
306 |
?>
|
1 |
+
<?php
|
2 |
+
//Admin functions
|
3 |
+
function em_admin_menu(){
|
4 |
+
global $menu, $submenu, $pagenow;
|
5 |
+
//Count pending bookings
|
6 |
+
if( get_option('dbem_rsvp_enabled') ){
|
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>';
|
14 |
+
}
|
15 |
+
}else{
|
16 |
+
$bookings_num = '';
|
17 |
+
$bookings_pending_count = 0;
|
18 |
+
}
|
19 |
+
//Count pending events
|
20 |
+
$events_num = '';
|
21 |
+
$events_pending_count = EM_Events::count(array('status'=>0, 'scope'=>'all', 'blog'=>get_current_blog_id()));
|
22 |
+
//TODO Add flexible permissions
|
23 |
+
if($events_pending_count > 0){
|
24 |
+
$events_num = '<span class="update-plugins count-'.$events_pending_count.'"><span class="plugin-count">'.$events_pending_count.'</span></span>';
|
25 |
+
}
|
26 |
+
//Count pending recurring events
|
27 |
+
$events_recurring_num = '';
|
28 |
+
$events_recurring_pending_count = EM_Events::count(array('status'=>0, 'recurring'=>1, 'scope'=>'all', 'blog'=>get_current_blog_id()));
|
29 |
+
//TODO Add flexible permissions
|
30 |
+
if($events_recurring_pending_count > 0){
|
31 |
+
$events_recurring_num = '<span class="update-plugins count-'.$events_recurring_pending_count.'"><span class="plugin-count">'.$events_recurring_pending_count.'</span></span>';
|
32 |
+
}
|
33 |
+
$both_pending_count = apply_filters('em_items_pending_count', $events_pending_count + $bookings_pending_count + $events_recurring_pending_count);
|
34 |
+
$both_num = ($both_pending_count > 0) ? '<span class="update-plugins count-'.$both_pending_count.'"><span class="plugin-count">'.$both_pending_count.'</span></span>':'';
|
35 |
+
// Add a submenu to the custom top-level menu:
|
36 |
+
$plugin_pages = array();
|
37 |
+
if( get_option('dbem_rsvp_enabled') ){
|
38 |
+
$plugin_pages['bookings'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Bookings', 'dbem'), __('Bookings', 'dbem').$bookings_num, 'manage_bookings', 'events-manager-bookings', "em_bookings_page");
|
39 |
+
}
|
40 |
+
$plugin_pages['options'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Events Manager Settings','dbem'),__('Settings','dbem'), 'list_users', "events-manager-options", 'em_admin_options_page');
|
41 |
+
$plugin_pages['help'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Getting Help for Events Manager','dbem'),__('Help','dbem'), 'list_users', "events-manager-help", 'em_admin_help_page');
|
42 |
+
//If multisite global with locations set to be saved in main blogs we can force locations to be created on the main blog only
|
43 |
+
if( EM_MS_GLOBAL && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){
|
44 |
+
include( dirname(__FILE__)."/em-ms-locations.php" );
|
45 |
+
$plugin_pages['locations'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Locations','dbem'),__('Locations','dbem'), 'read_others_locations', "locations", 'em_admin_ms_locations');
|
46 |
+
}
|
47 |
+
$plugin_pages = apply_filters('em_create_events_submenu',$plugin_pages);
|
48 |
+
//We have to modify the menus manually
|
49 |
+
if( !empty($both_num) ){ //Main Event Menu
|
50 |
+
//go through the menu array and modify the events menu if found
|
51 |
+
foreach ( (array)$menu as $key => $parent_menu ) {
|
52 |
+
if ( $parent_menu[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
|
53 |
+
$menu[$key][0] = $menu[$key][0]. $both_num;
|
54 |
+
break;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
if( !empty($events_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Event Item
|
59 |
+
//go through the menu array and modify the events menu if found
|
60 |
+
foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
|
61 |
+
if ( $submenu_item[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
|
62 |
+
$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_num;
|
63 |
+
break;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
if( !empty($events_recurring_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Recurring Event Item
|
68 |
+
//go through the menu array and modify the events menu if found
|
69 |
+
foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
|
70 |
+
if ( $submenu_item[2] == 'edit.php?post_type=event-recurring' ){
|
71 |
+
$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_recurring_num;
|
72 |
+
break;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
/* Hack! Add location/recurrence isn't possible atm so this is a workaround */
|
77 |
+
global $_wp_submenu_nopriv;
|
78 |
+
if( $pagenow == 'post-new.php' && !empty($_REQUEST['post_type']) ){
|
79 |
+
if( $_REQUEST['post_type'] == EM_POST_TYPE_LOCATION && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_locations') ){
|
80 |
+
unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
|
81 |
+
}
|
82 |
+
if( $_REQUEST['post_type'] == 'event-recurring' && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_recurring_events') ){
|
83 |
+
unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
add_action('admin_menu','em_admin_menu');
|
88 |
+
|
89 |
+
function em_admin_dashicon(){
|
90 |
+
?>
|
91 |
+
<style type="text/css">
|
92 |
+
@font-face {
|
93 |
+
font-family: 'em_dashicons';
|
94 |
+
src: url('../fonts/em-dashicons.eot'); // this is for IE
|
95 |
+
}
|
96 |
+
@font-face {
|
97 |
+
font-family: 'em_dashicons';
|
98 |
+
src: url(data:application/font-woff;charset=utf-8;base64,d09GRk9UVE8AAAVIAAoAAAAABQAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAAA9AAAAb8AAAG/+vk+uU9TLzIAAAK0AAAAYAAAAGAIIvy2Y21hcAAAAxQAAABMAAAATBpVzFdnYXNwAAADYAAAAAgAAAAIAAAAEGhlYWQAAANoAAAANgAAADYBZ6hBaGhlYQAAA6AAAAAkAAAAJAPIAeZobXR4AAADxAAAABQAAAAUAwAAM21heHAAAAPYAAAABgAAAAYABVAAbmFtZQAAA+AAAAFFAAABRVcZpu5wb3N0AAAFKAAAACAAAAAgAAMAAAEABAQAAQEBCGljb21vb24AAQIAAQA6+BwC+BsD+BgEHgoAGVP/i4seCgAZU/+LiwwHi2v4lPh0BR0AAAB2Dx0AAAB7ER0AAAAJHQAAAbYSAAYBAQgPERMWG2ljb21vb25pY29tb29udTB1MXUyMHVFNjAwAAACAYkAAwAFAgABAAQABwAKAA0BLfyUDvyUDvyUDvuUDvcu+FoVfIuAgIt9CItYBYt8loCai5mLlpaLmgiLvgWLmYCWfYsI93qLFX2Lf4CLfQiLWAWLfJeAmYuZi5eWi5oIi74Fi5l/ln2LCPth+0cVi1hYi4u+vosFpYsVvouLWFiLi74F2IsVvouLWFiLi74F14sVv4uLWFeLi74Fiz4VvouLWFiLi74FPosVv4uLWFeLi74FPosVv4uLWFeLi74FP4sVvouLWFiLi74F1z8Vv4uLV1eLi78F2IsVv4uLV1eLi78F9y33ihWGc3d5cotui3Wii6gIi5cFdI91jXiLd4t1iXWHCIt+BYtvdHRui3KLd52Go2yCdoSLi4uLi2eLfIv7lfduWYuLi4v3bb2L95WLmYuwi4uLi3aSbJQIDviUFPiUFYsMCgAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmAAHg/+D/4AHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIOYA//3//wAAAAAAIOYA//3//wAB/+MaBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAEAAIXyBpNfDzz1AAsCAAAAAADQMTPCAAAAANAxM8IAAP/6AeYBxgAAAAgAAgAAAAAAAAABAAAB4P/gAAACAAAAAAAB5gABAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAEAAAACAAAzAABQAAAFAAAAAAAOAK4AAQAAAAAAAQAOAAAAAQAAAAAAAgAOAEcAAQAAAAAAAwAOACQAAQAAAAAABAAOAFUAAQAAAAAABQAWAA4AAQAAAAAABgAHADIAAQAAAAAACgA0AGMAAwABBAkAAQAOAAAAAwABBAkAAgAOAEcAAwABBAkAAwAOACQAAwABBAkABAAOAFUAAwABBAkABQAWAA4AAwABBAkABgAOADkAAwABBAkACgA0AGMAaQBjAG8AbQBvAG8AbgBWAGUAcgBzAGkAbwBuACAAMQAuADAAaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AbgBSAGUAZwB1AGwAYQByAGkAYwBvAG0AbwBvAG4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format('woff'),
|
99 |
+
url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMggi/LYAAAC8AAAAYGNtYXAaVcxXAAABHAAAAExnYXNwAAAAEAAAAWgAAAAIZ2x5ZsaoTWEAAAFwAAACFGhlYWQBZ6hBAAADhAAAADZoaGVhA8gB5gAAA7wAAAAkaG10eAMAADMAAAPgAAAAFGxvY2EAKAEeAAAD9AAAAAxtYXhwABMAowAABAAAAAAgbmFtZVcZpu4AAAQgAAABRXBvc3QAAwAAAAAFaAAAACAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmAAHg/+D/4AHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIOYA//3//wAAAAAAIOYA//3//wAB/+MaBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAADQAz//oB5gHGABoANQA6AD8ARABJAE4AUwBYAF0AYgBnAKAAABMiBgcOAQcXBhYXHgEzMjY3PgE3JzYmJy4BIzMiBgcOARcHHgEXHgEzMjY3PgEnNy4BJy4BIwcXIzczOwEXIzc7AQcjJzsBFyM3BzMHIycjMxcjNyMzByMnIzMXIzcXMwcjJzsBFyM3Nw4BBw4BIyImJy4BJzcuASciJiMiBiMOAQ8BFgYHDgEjIiYnLgEnDgEzIhYHHgEzIjYnNiYzIiYnmgUKAgUDAQEBBQMECAcECgMEAwEBAQUCBQgG5wYJBAMFAQEBAwUCCwQGCQQDBQEBAQMFAgsEzgE0ATIbMgE0AUw0ATIBTTMBNQEBNAEyAUwzATUBTjUBMwFLMgE0AUs1ATMBTjMBNQGYAQoGBxAKChQFCAcBAQoPCQcRBgkOCQgRBwEBCgUIEgwIEgUICAMWHgEBAQEB2QEB2gEBAQEBHBgBxgQDBAkFMwYJBAMEBAMECQYzBQkEAwQEAwQJBTMGCQQDBAQDBAkGMwUJBAMEszMzMzMzMzMzTTMzMzMzMzMzTDQ0NDT2CQ8GBQcIBwcTCwwCAgEBAQECAg0KEwcHCAcFBg8JBwkoC8FycsELKAkHAAEAAAABAACs5UCKXw889QALAgAAAAAA0DEzwgAAAADQMTPCAAD/+gHmAcYAAAAIAAIAAAAAAAAAAQAAAeD/4AAAAgAAAAAAAeYAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAABAAAAAgAAMwAAAAAACgAUAB4BCgABAAAABQChAA0AAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIADgBHAAEAAAAAAAMADgAkAAEAAAAAAAQADgBVAAEAAAAAAAUAFgAOAAEAAAAAAAYABwAyAAEAAAAAAAoANABjAAMAAQQJAAEADgAAAAMAAQQJAAIADgBHAAMAAQQJAAMADgAkAAMAAQQJAAQADgBVAAMAAQQJAAUAFgAOAAMAAQQJAAYADgA5AAMAAQQJAAoANABjAGkAYwBvAG0AbwBvAG4AVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG4AUgBlAGcAdQBsAGEAcgBpAGMAbwBtAG8AbwBuAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format('truetype');
|
100 |
+
font-weight: normal;
|
101 |
+
font-style: normal;
|
102 |
+
}
|
103 |
+
.menu-icon-event .dashicons-calendar:before, #toplevel_page_events-manager-options .dashicons-calendar:before {
|
104 |
+
font-family: 'em_dashicons' !important;
|
105 |
+
content: '\e600';
|
106 |
+
}
|
107 |
+
</style>
|
108 |
+
<?php
|
109 |
+
}
|
110 |
+
add_action('admin_head','em_admin_dashicon');
|
111 |
+
|
112 |
+
function em_ms_admin_menu(){
|
113 |
+
add_menu_page( __('Events Manager','dbem'), __('Events Manager','dbem'), 'activate_plugins', 'events-manager-options', 'em_ms_admin_options_page', 'dashicons-calendar' );
|
114 |
+
add_submenu_page('events-manager-options', __('Update Blogs','dbem'),__('Update Blogs','dbem'), 'activate_plugins', "events-manager-update", 'em_ms_upgrade');
|
115 |
+
}
|
116 |
+
add_action('network_admin_menu','em_ms_admin_menu');
|
117 |
+
|
118 |
+
function em_admin_init(){
|
119 |
+
//in MS global mode and locations are stored in the main blog, then a user must have at least a subscriber role
|
120 |
+
if( EM_MS_GLOBAL && is_user_logged_in() && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){
|
121 |
+
EM_Object::ms_global_switch();
|
122 |
+
$user = new WP_User(get_current_user_id());
|
123 |
+
if( count($user->roles) == 0 ){
|
124 |
+
$user->set_role('subscriber');
|
125 |
+
}
|
126 |
+
EM_Object::ms_global_switch_back();
|
127 |
+
}
|
128 |
+
}
|
129 |
+
add_action('admin_init','em_admin_init');
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Generate warnings and notices in the admin area
|
133 |
+
*/
|
134 |
+
function em_admin_warnings() {
|
135 |
+
global $EM_Notices;
|
136 |
+
//If we're editing the events page show hello to new user
|
137 |
+
$events_page_id = get_option ( 'dbem_events_page' );
|
138 |
+
$dismiss_link_joiner = ( count($_GET) > 0 ) ? '&':'?';
|
139 |
+
|
140 |
+
if( current_user_can('activate_plugins') ){
|
141 |
+
//New User Intro
|
142 |
+
if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){
|
143 |
+
// Disable Hello to new user if requested
|
144 |
+
update_option('dbem_hello_to_user',0);
|
145 |
+
}elseif ( get_option ( 'dbem_hello_to_user' ) ) {
|
146 |
+
//FIXME update welcome msg with good links
|
147 |
+
$advice = sprintf( __("<p>Events Manager is ready to go! It is highly recommended you read the <a href='%s'>Getting Started</a> guide on our site, as well as checking out the <a href='%s'>Settings Page</a>. <a href='%s' title='Don't show this advice again'>Dismiss</a></p>", 'dbem'), 'http://wp-events-plugin.com/documentation/getting-started/?utm_source=em&utm_medium=plugin&utm_content=installationlink&utm_campaign=plugin_links', EM_ADMIN_URL .'&page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'disable_hello_to_user=true');
|
148 |
+
?>
|
149 |
+
<div id="message" class="updated">
|
150 |
+
<?php echo $advice; ?>
|
151 |
+
</div>
|
152 |
+
<?php
|
153 |
+
}
|
154 |
+
|
155 |
+
//If events page couldn't be created or is missing
|
156 |
+
if( !empty($_GET['em_dismiss_events_page']) ){
|
157 |
+
update_option('dbem_dismiss_events_page',1);
|
158 |
+
}else{
|
159 |
+
if ( !get_page($events_page_id) && !get_option('dbem_dismiss_events_page') ){
|
160 |
+
?>
|
161 |
+
<div id="em_page_error" class="updated">
|
162 |
+
<p><?php echo sprintf ( __( 'Uh Oh! For some reason WordPress could not create an events page for you (or you just deleted it). Not to worry though, all you have to do is create an empty page, name it whatever you want, and select it as your events page in your <a href="%s">settings page</a>. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so <a href="%s">ignore this message</a>', 'dbem'), EM_ADMIN_URL .'&page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1' ); ?></p>
|
163 |
+
</div>
|
164 |
+
<?php
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
if( defined('EMP_VERSION') && EMP_VERSION < EM_PRO_MIN_VERSION && !defined('EMP_DISABLE_WARNINGS')){
|
169 |
+
?>
|
170 |
+
<div id="em_page_error" class="updated">
|
171 |
+
<p><?php _e('There is a newer version of Events Manager Pro which is recommended for this current version of Events Manager as new features have been added. Please go to the plugin website and download the latest update.','dbem'); ?></p>
|
172 |
+
</div>
|
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{
|
180 |
+
?>
|
181 |
+
<div id="em_page_error" class="updated">
|
182 |
+
<p><?php echo sprintf(__('MultiSite options have moved <a href="%s">here</a>. <a href="%s">Dismiss message</a>','dbem'),admin_url().'network/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].'&disable_dbem_ms_update_nag=1'); ?></p>
|
183 |
+
</div>
|
184 |
+
<?php
|
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{
|
192 |
+
?>
|
193 |
+
<div id="em_page_error" class="updated">
|
194 |
+
<p><?php echo sprintf(__('Whilst they will still appear using placeholders, you need to <a href="%s">migrate your location and event images</a> in order for them to appear in your edit forms and media library. <a href="%s">Dismiss message</a>','dbem'),admin_url().'edit.php?post_type=event&page=events-manager-options&em_migrate_images=1&_wpnonce='.wp_create_nonce('em_migrate_images'), em_add_get_params($_SERVER['REQUEST_URI'], array('disable_dbem_migrate_images_nag' => 1))); ?></p>
|
195 |
+
</div>
|
196 |
+
<?php
|
197 |
+
}
|
198 |
+
}
|
199 |
+
if( !empty($_REQUEST['page']) && 'events-manager-options' == $_REQUEST['page'] && get_option('dbem_pro_dev_updates') == 1 ){
|
200 |
+
?>
|
201 |
+
<div id="message" class="updated">
|
202 |
+
<p><?php echo sprintf(__('Dev Mode active: Just a friendly reminder that you are updating to development versions. Only admins see this message, and it will go away when you disable this <a href="#pro-api">here</a> in your settings.','dbem'),'<code>define(\'EMP_DEV_UPDATES\',true);</code>'); ?></p>
|
203 |
+
</div>
|
204 |
+
<?php
|
205 |
+
}
|
206 |
+
if( class_exists('SitePress') && !class_exists('EM_WPML') && !get_site_option('disable_em_wpml_warning') ){
|
207 |
+
if( !empty($_REQUEST['disable_em_wpml_warning']) ){
|
208 |
+
update_site_option('disable_em_wpml_warning',1);
|
209 |
+
}else{
|
210 |
+
?>
|
211 |
+
<div id="message" class="updated">
|
212 |
+
<p><?php echo sprintf(__('It looks like you have WPML enabled on your site. We advise you also install our extra <a href="%s">Events Manager WPML Connector</a> plugin which helps the two work better together. <a href="%s">Dismiss message</a>','dbem'),'http://wordpress.org/extend/plugins/events-manager-wpml/', esc_url(add_query_arg(array('disable_em_wpml_warning'=>1)))); ?></p>
|
213 |
+
</div>
|
214 |
+
<?php
|
215 |
+
}
|
216 |
+
}
|
217 |
+
if( array_key_exists('dbem_disable_timthumb', wp_load_alloptions()) ){
|
218 |
+
if( !empty($_REQUEST['dbem_disable_timthumb']) ){
|
219 |
+
delete_option('dbem_disable_timthumb',1);
|
220 |
+
}else{
|
221 |
+
?>
|
222 |
+
<div id="message" class="updated">
|
223 |
+
<p>We have stopped using TimThumb for thumbnails in Events Manager, <a href="http://wp-events-plugin.com/blog/2014/12/05/bye-timthumb/">please see this post</a> for more information on how this may affect you and what options are available to you. <a href="<?php echo esc_url(add_query_arg(array('dbem_disable_timthumb'=>1))); ?>">Dismiss</a></p>
|
224 |
+
</div>
|
225 |
+
<?php
|
226 |
+
}
|
227 |
+
}
|
228 |
+
}
|
229 |
+
//Warn about EM page edit
|
230 |
+
if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
|
231 |
+
$message = sprintf ( __ ( "This page corresponds to the <strong>Events Manager</strong> %s page. Its content will be overriden by Events Manager, although if you include the word CONTENTS (exactly in capitals) and surround it with other text, only CONTENTS will be overwritten. If you want to change the way your events look, go to the <a href='%s'>settings</a> page. ", 'dbem' ), __('Events','dbem'), EM_ADMIN_URL .'&page=events-manager-options' );
|
232 |
+
$notice = "<div class='error'><p>$message</p></div>";
|
233 |
+
echo $notice;
|
234 |
+
}
|
235 |
+
echo $EM_Notices;
|
236 |
+
}
|
237 |
+
add_action ( 'admin_notices', 'em_admin_warnings', 100 );
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Settings link in the plugins page menu
|
241 |
+
* @param array $links
|
242 |
+
* @param string $file
|
243 |
+
* @return array
|
244 |
+
*/
|
245 |
+
function em_plugin_action_links($actions, $file, $plugin_data) {
|
246 |
+
$new_actions = array();
|
247 |
+
$new_actions[] = sprintf( '<a href="'.EM_ADMIN_URL.'&page=events-manager-options">%s</a>', __('Settings', 'dbem') );
|
248 |
+
$new_actions = array_merge($new_actions, $actions);
|
249 |
+
if( is_multisite() ){
|
250 |
+
$uninstall_url = admin_url().'network/admin.php?page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
251 |
+
}else{
|
252 |
+
$uninstall_url = EM_ADMIN_URL.'&page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
253 |
+
}
|
254 |
+
$new_actions[] = '<span class="delete"><a href="'.$uninstall_url.'" class="delete">'.__('Uninstall','dbem').'</a></span>';
|
255 |
+
return $new_actions;
|
256 |
+
}
|
257 |
+
add_filter( 'plugin_action_links_events-manager/events-manager.php', 'em_plugin_action_links', 10, 3 );
|
258 |
+
|
259 |
+
//Updates and Dev versions
|
260 |
+
function em_updates_check( $transient ) {
|
261 |
+
// Check if the transient contains the 'checked' information
|
262 |
+
if( empty( $transient->checked ) )
|
263 |
+
return $transient;
|
264 |
+
|
265 |
+
//only bother if we're checking for dev versions
|
266 |
+
if( get_option('em_check_dev_version') || get_option('dbem_pro_dev_updates') ){
|
267 |
+
//check WP repo for trunk version
|
268 |
+
$request = wp_remote_get('http://plugins.svn.wordpress.org/events-manager/trunk/events-manager.php');
|
269 |
+
|
270 |
+
if( !is_wp_error($request) ){
|
271 |
+
preg_match('/Version: ([0-9a-z\.]+)/', $request['body'], $matches);
|
272 |
+
|
273 |
+
if( !empty($matches[1]) ){
|
274 |
+
//we have a version number!
|
275 |
+
if( version_compare($transient->checked[EM_SLUG], $matches[1]) < 0) {
|
276 |
+
$response = new stdClass();
|
277 |
+
$response->slug = EM_SLUG;
|
278 |
+
$response->new_version = $matches[1] ;
|
279 |
+
$response->url = 'http://wordpress.org/extend/plugins/events-manager/';
|
280 |
+
$response->package = 'http://downloads.wordpress.org/plugin/events-manager.zip';
|
281 |
+
$transient->response[EM_SLUG] = $response;
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
delete_option('em_check_dev_version');
|
287 |
+
}
|
288 |
+
|
289 |
+
return $transient;
|
290 |
+
}
|
291 |
+
add_filter('pre_set_site_transient_update_plugins', 'em_updates_check'); // Hook into the plugin update check and mod for dev version
|
292 |
+
|
293 |
+
function em_user_action_links( $actions, $user ){
|
294 |
+
if ( !is_network_admin() && current_user_can( 'manage_others_bookings' ) ){
|
295 |
+
if( get_option('dbem_edit_bookings_page') && (!is_admin() || !empty($_REQUEST['is_public'])) ){
|
296 |
+
$my_bookings_page = get_permalink(get_option('dbem_edit_bookings_page'));
|
297 |
+
$bookings_link = em_add_get_params($my_bookings_page, array('person_id'=>$user->ID), false);
|
298 |
+
}else{
|
299 |
+
$bookings_link = EM_ADMIN_URL. "&page=events-manager-bookings&person_id=".$user->ID;
|
300 |
+
}
|
301 |
+
$actions['bookings'] = "<a href='$bookings_link'>" . __( 'Bookings','dbem' ) . "</a>";
|
302 |
+
}
|
303 |
+
return $actions;
|
304 |
+
}
|
305 |
+
add_filter('user_row_actions','em_user_action_links',10,2);
|
306 |
?>
|
admin/em-bookings.php
CHANGED
@@ -1,568 +1,568 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Check if there's any admin-related actions to take for bookings. All actions are caught here.
|
4 |
-
* @return null
|
5 |
-
*/
|
6 |
-
function em_admin_actions_bookings() {
|
7 |
-
global $dbem_form_add_message;
|
8 |
-
global $dbem_form_delete_message;
|
9 |
-
global $wpdb, $EM_Booking, $EM_Event, $EM_Notices;
|
10 |
-
|
11 |
-
if( is_object($EM_Booking) && !empty($_REQUEST['action']) && $EM_Booking->can_manage('manage_bookings','manage_others_bookings') ) {
|
12 |
-
if( $_REQUEST['action'] == 'bookings_add_note' && wp_verify_nonce($_REQUEST['_wpnonce'],'bookings_add_note') ){
|
13 |
-
$EM_Booking->add_note($_REQUEST['booking_note']);
|
14 |
-
function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
|
15 |
-
add_action ( 'admin_notices', 'em_booking_save_notification' );
|
16 |
-
}
|
17 |
-
}
|
18 |
-
if( is_object($EM_Event) && !empty($_REQUEST['action']) ){
|
19 |
-
if( $_REQUEST['action'] == 'bookings_export_csv' && wp_verify_nonce($_REQUEST['_wpnonce'],'bookings_export_csv') ){
|
20 |
-
$EM_Event->get_bookings()->export_csv();
|
21 |
-
exit();
|
22 |
-
}
|
23 |
-
}
|
24 |
-
}
|
25 |
-
add_action('admin_init','em_admin_actions_bookings',100);
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Decide what content to show in the bookings section.
|
29 |
-
*/
|
30 |
-
function em_bookings_page(){
|
31 |
-
//First any actions take priority
|
32 |
-
do_action('em_bookings_admin_page');
|
33 |
-
if( !empty($_REQUEST['_wpnonce']) ){ $_REQUEST['_wpnonce'] = $_GET['_wpnonce'] = $_POST['_wpnonce'] = esc_attr($_REQUEST['_wpnonce']); } //XSS fix just in case here too
|
34 |
-
if( !empty($_REQUEST['action']) && substr($_REQUEST['action'],0,7) != 'booking' ){ //actions not starting with booking_
|
35 |
-
do_action('em_bookings_'.$_REQUEST['action']);
|
36 |
-
}elseif( !empty($_REQUEST['booking_id']) ){
|
37 |
-
em_bookings_single();
|
38 |
-
}elseif( !empty($_REQUEST['person_id']) ){
|
39 |
-
em_bookings_person();
|
40 |
-
}elseif( !empty($_REQUEST['event_id']) ){
|
41 |
-
em_bookings_event();
|
42 |
-
}elseif( !empty($_REQUEST['ticket_id']) ){
|
43 |
-
em_bookings_ticket();
|
44 |
-
}else{
|
45 |
-
em_bookings_dashboard();
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Generates the bookings dashboard, showing information on all events
|
51 |
-
*/
|
52 |
-
function em_bookings_dashboard(){
|
53 |
-
global $EM_Notices;
|
54 |
-
?>
|
55 |
-
<div class='wrap em-bookings-dashboard'>
|
56 |
-
<?php if( is_admin() ): ?>
|
57 |
-
<div id='icon-users' class='icon32'>
|
58 |
-
<br/>
|
59 |
-
</div>
|
60 |
-
<h2>
|
61 |
-
<?php esc_html_e('Event Bookings Dashboard', 'dbem'); ?>
|
62 |
-
</h2>
|
63 |
-
<?php else: echo $EM_Notices; ?>
|
64 |
-
<?php endif; ?>
|
65 |
-
<div class="em-bookings-recent">
|
66 |
-
<h2><?php esc_html_e('Recent Bookings','dbem'); ?></h2>
|
67 |
-
<?php
|
68 |
-
$EM_Bookings_Table = new EM_Bookings_Table();
|
69 |
-
$EM_Bookings_Table->status = get_option('dbem_bookings_approval') ? 'needs-attention':'confirmed';
|
70 |
-
$EM_Bookings_Table->output();
|
71 |
-
?>
|
72 |
-
</div>
|
73 |
-
<br class="clear" />
|
74 |
-
<div class="em-bookings-events">
|
75 |
-
<h2><?php esc_html_e('Events With Bookings Enabled','dbem'); ?></h2>
|
76 |
-
<?php em_bookings_events_table(); ?>
|
77 |
-
<?php do_action('em_bookings_dashboard'); ?>
|
78 |
-
</div>
|
79 |
-
</div>
|
80 |
-
<?php
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Shows all booking data for a single event
|
85 |
-
*/
|
86 |
-
function em_bookings_event(){
|
87 |
-
global $EM_Event,$EM_Person,$EM_Notices;
|
88 |
-
//check that user can access this page
|
89 |
-
if( is_object($EM_Event) && !$EM_Event->can_manage('manage_bookings','manage_others_bookings') ){
|
90 |
-
?>
|
91 |
-
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this event.','dbem'); ?></p></div>
|
92 |
-
<?php
|
93 |
-
return false;
|
94 |
-
}
|
95 |
-
$localised_start_date = date_i18n('D d M Y', $EM_Event->start);
|
96 |
-
$localised_end_date = date_i18n('D d M Y', $EM_Event->end);
|
97 |
-
?>
|
98 |
-
<div class='wrap'>
|
99 |
-
<div id='icon-users' class='icon32'>
|
100 |
-
<br/>
|
101 |
-
</div>
|
102 |
-
<h2>
|
103 |
-
<?php echo sprintf(__('Manage %s Bookings', 'dbem'), "'{$EM_Event->event_name}'"); ?>
|
104 |
-
<a href="<?php echo $EM_Event->get_permalink(); ?>" class="button add-new-h2"><?php echo sprintf(__('View %s','dbem'), __('Event', 'dbem')) ?></a>
|
105 |
-
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="button add-new-h2"><?php echo sprintf(__('Edit %s','dbem'), __('Event', 'dbem')) ?></a>
|
106 |
-
<?php if( locate_template('plugins/events-manager/templates/csv-event-bookings.php', false) ): //support for legacy template ?>
|
107 |
-
<a href='<?php echo EM_ADMIN_URL ."&page=events-manager-bookings&action=bookings_export_csv&_wpnonce=".wp_create_nonce('bookings_export_csv')."&event_id=".$EM_Event->event_id ?>' class="button add-new-h2"><?php esc_html_e('Export CSV','dbem')?></a>
|
108 |
-
<?php endif; ?>
|
109 |
-
<?php do_action('em_admin_event_booking_options_buttons'); ?>
|
110 |
-
</h2>
|
111 |
-
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
112 |
-
<div>
|
113 |
-
<p><strong><?php esc_html_e('Event Name','dbem'); ?></strong> : <?php echo esc_html($EM_Event->event_name); ?></p>
|
114 |
-
<p>
|
115 |
-
<strong><?php esc_html_e('Availability','dbem'); ?></strong> :
|
116 |
-
<?php echo $EM_Event->get_bookings()->get_booked_spaces() . '/'. $EM_Event->get_spaces() ." ". __('Spaces confirmed','dbem'); ?>
|
117 |
-
<?php if( get_option('dbem_bookings_approval_reserved') ): ?>
|
118 |
-
, <?php echo $EM_Event->get_bookings()->get_available_spaces() . '/'. $EM_Event->get_spaces() ." ". __('Available spaces','dbem'); ?>
|
119 |
-
<?php endif; ?>
|
120 |
-
</p>
|
121 |
-
<p>
|
122 |
-
<strong><?php esc_html_e('Date','dbem'); ?></strong> :
|
123 |
-
<?php echo $localised_start_date; ?>
|
124 |
-
<?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
|
125 |
-
<?php echo substr ( $EM_Event->event_start_time, 0, 5 ) . " - " . substr ( $EM_Event->event_end_time, 0, 5 ); ?>
|
126 |
-
</p>
|
127 |
-
<p>
|
128 |
-
<strong><?php esc_html_e('Location','dbem'); ?></strong> :
|
129 |
-
<a class="row-title" href="<?php echo admin_url(); ?>post.php?action=edit&post=<?php echo $EM_Event->get_location()->post_id ?>"><?php echo ($EM_Event->get_location()->location_name); ?></a>
|
130 |
-
</p>
|
131 |
-
</div>
|
132 |
-
<h2><?php esc_html_e('Bookings','dbem'); ?></h2>
|
133 |
-
<?php
|
134 |
-
$EM_Bookings_Table = new EM_Bookings_Table();
|
135 |
-
$EM_Bookings_Table->status = 'all';
|
136 |
-
$EM_Bookings_Table->output();
|
137 |
-
?>
|
138 |
-
<?php do_action('em_bookings_event_footer', $EM_Event); ?>
|
139 |
-
</div>
|
140 |
-
<?php
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Shows a ticket view
|
145 |
-
*/
|
146 |
-
function em_bookings_ticket(){
|
147 |
-
global $EM_Ticket,$EM_Notices;
|
148 |
-
$EM_Event = $EM_Ticket->get_event();
|
149 |
-
//check that user can access this page
|
150 |
-
if( is_object($EM_Ticket) && !$EM_Ticket->can_manage() ){
|
151 |
-
?>
|
152 |
-
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this ticket.','dbem'); ?></p></div>
|
153 |
-
<?php
|
154 |
-
return false;
|
155 |
-
}
|
156 |
-
?>
|
157 |
-
<div class='wrap'>
|
158 |
-
<div id='icon-users' class='icon32'>
|
159 |
-
<br/>
|
160 |
-
</div>
|
161 |
-
<h2>
|
162 |
-
<?php echo sprintf(__('Ticket for %s', 'dbem'), "'{$EM_Event->name}'"); ?>
|
163 |
-
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="button add-new-h2"><?php esc_html_e('View/Edit Event','dbem') ?></a>
|
164 |
-
<a href="<?php echo $EM_Event->get_bookings_url(); ?>" class="button add-new-h2"><?php esc_html_e('View Event Bookings','dbem') ?></a>
|
165 |
-
</h2>
|
166 |
-
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
167 |
-
<div>
|
168 |
-
<table>
|
169 |
-
<tr><td><?php echo __('Name','dbem'); ?></td><td></td><td><?php echo $EM_Ticket->ticket_name; ?></td></tr>
|
170 |
-
<tr><td><?php echo __('Description','dbem'); ?> </td><td></td><td><?php echo ($EM_Ticket->ticket_description) ? $EM_Ticket->ticket_description : '-'; ?></td></tr>
|
171 |
-
<tr><td><?php echo __('Price','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_price) ? $EM_Ticket->ticket_price : '-'; ?></td></tr>
|
172 |
-
<tr><td><?php echo __('Spaces','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_spaces) ? $EM_Ticket->ticket_spaces : '-'; ?></td></tr>
|
173 |
-
<tr><td><?php echo __('Min','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_min) ? $EM_Ticket->ticket_min : '-'; ?></td></tr>
|
174 |
-
<tr><td><?php echo __('Max','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_max) ? $EM_Ticket->ticket_max : '-'; ?></td></tr>
|
175 |
-
<tr><td><?php echo __('Start','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_start) ? $EM_Ticket->ticket_start : '-'; ?></td></tr>
|
176 |
-
<tr><td><?php echo __('End','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_end) ? $EM_Ticket->ticket_end : '-'; ?></td></tr>
|
177 |
-
<?php do_action('em_booking_admin_ticket_row', $EM_Ticket); ?>
|
178 |
-
</table>
|
179 |
-
</div>
|
180 |
-
<div class="icon32" id="icon-bookings"><br></div>
|
181 |
-
<h2><?php esc_html_e('Bookings','dbem'); ?></h2>
|
182 |
-
<?php
|
183 |
-
$EM_Bookings_Table = new EM_Bookings_Table();
|
184 |
-
$EM_Bookings_Table->status = get_option('dbem_bookings_approval') ? 'needs-attention':'confirmed';
|
185 |
-
$EM_Bookings_Table->output();
|
186 |
-
?>
|
187 |
-
<?php do_action('em_bookings_ticket_footer', $EM_Ticket); ?>
|
188 |
-
</div>
|
189 |
-
<?php
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Shows a single booking for a single person.
|
194 |
-
*/
|
195 |
-
function em_bookings_single(){
|
196 |
-
global $EM_Booking, $EM_Notices; /* @var $EM_Booking EM_Booking */
|
197 |
-
//check that user can access this page
|
198 |
-
if( is_object($EM_Booking) && !$EM_Booking->can_manage() ){
|
199 |
-
?>
|
200 |
-
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this event.','dbem'); ?></p></div>
|
201 |
-
<?php
|
202 |
-
return false;
|
203 |
-
}
|
204 |
-
?>
|
205 |
-
<div class='wrap' id="em-bookings-admin-booking">
|
206 |
-
<div class="icon32" id="icon-bookings"><br></div>
|
207 |
-
<h2>
|
208 |
-
<?php esc_html_e('Edit Booking', 'dbem'); ?>
|
209 |
-
</h2>
|
210 |
-
<div id="poststuff" class="metabox-holder">
|
211 |
-
<div id="post-body">
|
212 |
-
<div id="post-body-content">
|
213 |
-
<div class="stuffbox">
|
214 |
-
<h3>
|
215 |
-
<?php esc_html_e( 'Event Details', 'dbem' ); ?>
|
216 |
-
</h3>
|
217 |
-
<div class="inside">
|
218 |
-
<?php
|
219 |
-
$EM_Event = $EM_Booking->get_event();
|
220 |
-
$localised_start_date = date_i18n(get_option('dbem_date_format'), $EM_Event->start);
|
221 |
-
$localised_end_date = date_i18n(get_option('dbem_date_format'), $EM_Event->end);
|
222 |
-
?>
|
223 |
-
<table>
|
224 |
-
<tr><td><strong><?php esc_html_e('Name','dbem'); ?></strong></td><td><a class="row-title" href="<?php echo $EM_Event->get_bookings_url(); ?>"><?php echo ($EM_Event->event_name); ?></a></td></tr>
|
225 |
-
<tr>
|
226 |
-
<td><strong><?php esc_html_e('Date/Time','dbem'); ?> </strong></td>
|
227 |
-
<td>
|
228 |
-
<?php echo $localised_start_date; ?>
|
229 |
-
<?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
|
230 |
-
<?php echo substr ( $EM_Event->event_start_time, 0, 5 ) . " - " . substr ( $EM_Event->event_end_time, 0, 5 ); ?>
|
231 |
-
</td>
|
232 |
-
</tr>
|
233 |
-
</table>
|
234 |
-
<?php do_action('em_bookings_admin_booking_event', $EM_Event); ?>
|
235 |
-
</div>
|
236 |
-
</div>
|
237 |
-
<div class="stuffbox">
|
238 |
-
<h3>
|
239 |
-
<?php esc_html_e( 'Personal Details', 'dbem' ); ?>
|
240 |
-
</h3>
|
241 |
-
<div class="inside">
|
242 |
-
<?php $no_user = get_option('dbem_bookings_registration_disable') && $EM_Booking->get_person()->ID == get_option('dbem_bookings_registration_user'); ?>
|
243 |
-
<div class="em-booking-person-details">
|
244 |
-
<?php echo $EM_Booking->get_person()->display_summary(); ?>
|
245 |
-
<?php if( $no_user ): ?>
|
246 |
-
<input type="button" id="em-booking-person-modify" value="<?php esc_attr_e('Edit Details','dbem'); ?>" />
|
247 |
-
<?php endif; ?>
|
248 |
-
</div>
|
249 |
-
<?php if( $no_user ): ?>
|
250 |
-
<form action="" method="post" class="em-booking-person-form">
|
251 |
-
<div class="em-booking-person-editor" style="display:none;">
|
252 |
-
<?php echo $EM_Booking->get_person_editor(); ?>
|
253 |
-
<input type='hidden' name='action' value='booking_modify_person'/>
|
254 |
-
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
255 |
-
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
256 |
-
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_modify_person_'.$EM_Booking->booking_id); ?>'/>
|
257 |
-
<input type="submit" class="em-booking-person-modify-submit" id="em-booking-person-modify-submit" value="<?php esc_attr_e('Submit Changes', 'dbem'); ?>" />
|
258 |
-
<input type="button" id="em-booking-person-modify-cancel" value="<?php esc_attr_e('Cancel','dbem'); ?>" />
|
259 |
-
</div>
|
260 |
-
</form>
|
261 |
-
<script type="text/javascript">
|
262 |
-
jQuery(document).ready( function($){
|
263 |
-
$('#em-booking-person-modify').click(function(){
|
264 |
-
$('.em-booking-person-details').hide();
|
265 |
-
$('.em-booking-person-editor').show();
|
266 |
-
});
|
267 |
-
$('#em-booking-person-modify-cancel').click(function(){
|
268 |
-
$('.em-booking-person-details').show();
|
269 |
-
$('.em-booking-person-editor').hide();
|
270 |
-
});
|
271 |
-
});
|
272 |
-
</script>
|
273 |
-
<?php endif; ?>
|
274 |
-
<?php do_action('em_bookings_admin_booking_person', $EM_Booking); ?>
|
275 |
-
</div>
|
276 |
-
</div>
|
277 |
-
<div class="stuffbox">
|
278 |
-
<h3>
|
279 |
-
<?php esc_html_e( 'Booking Details', 'dbem' ); ?>
|
280 |
-
</h3>
|
281 |
-
<div class="inside">
|
282 |
-
<?php
|
283 |
-
$EM_Event = $EM_Booking->get_event();
|
284 |
-
$localised_start_date = date_i18n(get_option('date_format'), $EM_Event->start);
|
285 |
-
$localised_end_date = date_i18n(get_option('date_format'), $EM_Event->end);
|
286 |
-
$shown_tickets = array();
|
287 |
-
?>
|
288 |
-
<div>
|
289 |
-
<form action="" method="post" class="em-booking-single-status-info">
|
290 |
-
<strong><?php esc_html_e('Status','dbem'); ?> : </strong>
|
291 |
-
<?php echo $EM_Booking->get_status(); ?>
|
292 |
-
<input type="button" class="em-booking-submit-status-modify" id="em-booking-submit-status-modify" value="<?php esc_attr_e('Change', 'dbem'); ?>" />
|
293 |
-
<input type="submit" class="em-booking-resend-email" id="em-booking-resend-email" value="<?php esc_attr_e('Resend Email', 'dbem'); ?>" />
|
294 |
-
<input type='hidden' name='action' value='booking_resend_email'/>
|
295 |
-
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
296 |
-
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
297 |
-
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_resend_email_'.$EM_Booking->booking_id); ?>'/>
|
298 |
-
</form>
|
299 |
-
<form action="" method="post" class="em-booking-single-status-edit">
|
300 |
-
<strong><?php esc_html_e('Status','dbem'); ?> : </strong>
|
301 |
-
<select name="booking_status">
|
302 |
-
<?php foreach($EM_Booking->status_array as $status => $status_name): ?>
|
303 |
-
<option value="<?php echo esc_attr($status); ?>" <?php if($status == $EM_Booking->booking_status){ echo 'selected="selected"'; } ?>><?php echo esc_html($status_name); ?></option>
|
304 |
-
<?php endforeach; ?>
|
305 |
-
</select>
|
306 |
-
<input type="checkbox" checked="checked" name="send_email" value="1" />
|
307 |
-
<?php esc_html_e('Send Email','dbem'); ?>
|
308 |
-
<input type="submit" class="em-booking-submit-status" id="em-booking-submit-status" value="<?php esc_attr_e('Submit Changes', 'dbem'); ?>" />
|
309 |
-
<input type="button" class="em-booking-submit-status-cancel" id="em-booking-submit-status-cancel" value="<?php esc_attr_e('Cancel', 'dbem'); ?>" />
|
310 |
-
<input type='hidden' name='action' value='booking_set_status'/>
|
311 |
-
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
312 |
-
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
313 |
-
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_set_status_'.$EM_Booking->booking_id); ?>'/>
|
314 |
-
<br /><em><?php echo wp_kses_data(__('<strong>Notes:</strong> Ticket availability not taken into account when approving new bookings (i.e. you can overbook).','dbem')); ?></em>
|
315 |
-
</form>
|
316 |
-
</div>
|
317 |
-
<form action="" method="post" class="em-booking-form">
|
318 |
-
<table class="em-tickets-bookings-table" cellpadding="0" cellspacing="0">
|
319 |
-
<thead>
|
320 |
-
<tr>
|
321 |
-
<th><?php esc_html_e('Ticket Type','dbem'); ?></th>
|
322 |
-
<th><?php esc_html_e('Spaces','dbem'); ?></th>
|
323 |
-
<th><?php esc_html_e('Price','dbem'); ?></th>
|
324 |
-
</tr>
|
325 |
-
</thead>
|
326 |
-
<tbody>
|
327 |
-
<?php foreach($EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking): /* @var $EM_Ticket_Booking EM_Ticket_Booking */ ?>
|
328 |
-
<tr>
|
329 |
-
<td class="ticket-type"><a class="row-title" href="<?php echo em_add_get_params($EM_Event->get_bookings_url(), array('ticket_id'=>$EM_Ticket_Booking->ticket_id)); ?>"><?php echo $EM_Ticket_Booking->get_ticket()->ticket_name ?></a></td>
|
330 |
-
<td>
|
331 |
-
<span class="em-booking-single-info"><?php echo $EM_Ticket_Booking->get_spaces(); ?></span>
|
332 |
-
<div class="em-booking-single-edit"><input name="em_tickets[<?php echo $EM_Ticket_Booking->ticket_id; ?>][spaces]" class="em-ticket-select" id="em-ticket-spaces-<?php echo $EM_Ticket_Booking->ticket_id; ?>" value="<?php echo $EM_Ticket_Booking->get_spaces(); ?>" /></div>
|
333 |
-
</td>
|
334 |
-
<td><?php echo $EM_Ticket_Booking->get_price(true,true); ?></td>
|
335 |
-
</tr>
|
336 |
-
<?php
|
337 |
-
$shown_tickets[] = $EM_Ticket_Booking->ticket_id;
|
338 |
-
do_action('em_bookings_admin_ticket_row', $EM_Ticket_Booking->get_ticket(), $EM_Booking);
|
339 |
-
?>
|
340 |
-
<?php endforeach; ?>
|
341 |
-
<?php if( count($shown_tickets) < count($EM_Event->get_bookings()->get_tickets()->tickets)): ?><tr>
|
342 |
-
<?php foreach($EM_Event->get_bookings()->get_tickets()->tickets as $EM_Ticket): /* @var $EM_Ticket EM_Ticket */ ?>
|
343 |
-
<?php if( !in_array($EM_Ticket->ticket_id, $shown_tickets) ): ?>
|
344 |
-
<tr>
|
345 |
-
<td class="ticket-type"><a class="row-title" href="<?php echo em_add_get_params($EM_Event->get_bookings_url(), array('ticket_id'=>$EM_Ticket->ticket_id)); ?>"><?php echo $EM_Ticket->ticket_name ?></a></td>
|
346 |
-
<td>
|
347 |
-
<span class="em-booking-single-info">0</span>
|
348 |
-
<div class="em-booking-single-edit"><input name="em_tickets[<?php echo $EM_Ticket->ticket_id; ?>][spaces]" class="em-ticket-select" id="em-ticket-spaces-<?php echo $EM_Ticket_Booking->ticket_id; ?>" value="0" /></div>
|
349 |
-
</td>
|
350 |
-
<td><?php echo em_get_currency_symbol() ?>0.00</td>
|
351 |
-
</tr>
|
352 |
-
<?php do_action('em_bookings_admin_ticket_row', $EM_Ticket, $EM_Booking); ?>
|
353 |
-
<?php endif; ?>
|
354 |
-
<?php endforeach; ?>
|
355 |
-
<?php endif; ?>
|
356 |
-
</tbody>
|
357 |
-
<tfoot>
|
358 |
-
<?php
|
359 |
-
do_action('em_bookings_admin_ticket_totals_header');
|
360 |
-
$price_summary = $EM_Booking->get_price_summary_array();
|
361 |
-
//we should now have an array of information including base price, taxes and post/pre tax discounts
|
362 |
-
?>
|
363 |
-
<tr>
|
364 |
-
<th><?php esc_html_e('Price','dbem'); ?></th>
|
365 |
-
<th><?php echo sprintf(__('%d Spaces','dbem'), $EM_Booking->get_spaces()); ?></th>
|
366 |
-
<th><?php echo $EM_Booking->get_price_base(true); ?></th>
|
367 |
-
</tr>
|
368 |
-
<?php if( count($price_summary['discounts_pre_tax']) > 0 ): ?>
|
369 |
-
<?php foreach( $price_summary['discounts_pre_tax'] as $discount_summary ): ?>
|
370 |
-
<tr>
|
371 |
-
<th><?php echo $discount_summary['name']; ?></th>
|
372 |
-
<th><?php echo $discount_summary['discount']; ?></th>
|
373 |
-
<th>- <?php echo $discount_summary['amount']; ?></th>
|
374 |
-
</tr>
|
375 |
-
<?php endforeach; ?>
|
376 |
-
<?php endif; ?>
|
377 |
-
<?php if( !empty($price_summary['taxes']['amount']) ): ?>
|
378 |
-
<tr>
|
379 |
-
<th><?php esc_html_e('Tax','dbem'); ?></th>
|
380 |
-
<th>
|
381 |
-
<span class="em-booking-single-info"><?php echo $price_summary['taxes']['rate'] ?></span>
|
382 |
-
<div class="em-booking-single-edit"><input name="booking_tax_rate" value="<?php echo esc_attr($EM_Booking->get_tax_rate()); ?>">%</div>
|
383 |
-
</th>
|
384 |
-
<th><?php echo $price_summary['taxes']['amount']; ?></th>
|
385 |
-
</tr>
|
386 |
-
<?php endif; ?>
|
387 |
-
<?php if( count($price_summary['discounts_post_tax']) > 0 ): ?>
|
388 |
-
<?php foreach( $price_summary['discounts_post_tax'] as $discount_summary ): ?>
|
389 |
-
<tr>
|
390 |
-
<th><?php echo $discount_summary['name']; ?></th>
|
391 |
-
<th><?php echo $discount_summary['discount']; ?></th>
|
392 |
-
<th>- <?php echo $discount_summary['amount']; ?></th>
|
393 |
-
</tr>
|
394 |
-
<?php endforeach; ?>
|
395 |
-
<?php endif; ?>
|
396 |
-
<tr>
|
397 |
-
<th><?php esc_html_e('Total Price','dbem'); ?></th>
|
398 |
-
<th> </th>
|
399 |
-
<th><?php echo $price_summary['total']; ?></th>
|
400 |
-
</tr>
|
401 |
-
<?php do_action('em_bookings_admin_ticket_totals_footer'); ?>
|
402 |
-
</tfoot>
|
403 |
-
</table>
|
404 |
-
<table class="em-form-fields" cellspacing="0" cellpadding="0">
|
405 |
-
<?php if( !has_action('em_bookings_single_custom') ): //default behaviour ?>
|
406 |
-
<tr>
|
407 |
-
<th><?php esc_html_e('Comment','dbem'); ?></th>
|
408 |
-
<td>
|
409 |
-
<span class="em-booking-single-info"><?php echo esc_html($EM_Booking->booking_comment); ?></span>
|
410 |
-
<div class="em-booking-single-edit"><textarea name="booking_comment"><?php echo esc_html($EM_Booking->booking_comment); ?></textarea></div>
|
411 |
-
</td>
|
412 |
-
</tr>
|
413 |
-
<?php else: do_action('em_bookings_single_custom',$EM_Booking); //do your own thing, e.g. pro ?>
|
414 |
-
<?php endif; ?>
|
415 |
-
</table>
|
416 |
-
<p class="em-booking-single-info">
|
417 |
-
<input type="button" class="em-booking-submit-modify" id="em-booking-submit-modify" value="<?php esc_attr_e('Modify Booking', 'dbem'); ?>" />
|
418 |
-
</p>
|
419 |
-
<p class="em-booking-single-edit">
|
420 |
-
<em><?php _e('<strong>Notes:</strong> Ticket availability not taken into account (i.e. you can overbook). Emails are not resent automatically.','dbem'); ?></em>
|
421 |
-
<br /><br />
|
422 |
-
<input type="submit" class="em-booking-submit" id="em-booking-submit" value="<?php esc_attr_e('Submit Changes', 'dbem'); ?>" />
|
423 |
-
<input type="button" class="em-booking-submit-cancel" id="em-booking-submit-cancel" value="<?php esc_attr_e('Cancel', 'dbem'); ?>" />
|
424 |
-
<input type='hidden' name='action' value='booking_save'/>
|
425 |
-
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
426 |
-
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
427 |
-
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_save_'.$EM_Booking->booking_id); ?>'/>
|
428 |
-
</p>
|
429 |
-
</form>
|
430 |
-
<script type="text/javascript">
|
431 |
-
jQuery(document).ready( function($){
|
432 |
-
$('#em-booking-submit-modify').click(function(){
|
433 |
-
$('.em-booking-single-info').hide();
|
434 |
-
$('.em-booking-single-edit').show();
|
435 |
-
});
|
436 |
-
$('#em-booking-submit-cancel').click(function(){
|
437 |
-
$('.em-booking-single-info').show();
|
438 |
-
$('.em-booking-single-edit').hide();
|
439 |
-
});
|
440 |
-
$('.em-booking-single-info').show();
|
441 |
-
$('.em-booking-single-edit').hide();
|
442 |
-
|
443 |
-
$('#em-booking-submit-status-modify').click(function(){
|
444 |
-
$('.em-booking-single-status-info').hide();
|
445 |
-
$('.em-booking-single-status-edit').show();
|
446 |
-
});
|
447 |
-
$('#em-booking-submit-status-cancel').click(function(){
|
448 |
-
$('.em-booking-single-status-info').show();
|
449 |
-
$('.em-booking-single-status-edit').hide();
|
450 |
-
});
|
451 |
-
$('.em-booking-single-status-info').show();
|
452 |
-
$('.em-booking-single-status-edit').hide();
|
453 |
-
});
|
454 |
-
</script>
|
455 |
-
</div>
|
456 |
-
</div>
|
457 |
-
<div id="em-booking-notes" class="stuffbox">
|
458 |
-
<h3>
|
459 |
-
<?php esc_html_e( 'Booking Notes', 'dbem' ); ?>
|
460 |
-
</h3>
|
461 |
-
<div class="inside">
|
462 |
-
<p><?php esc_html_e('You can add private notes below for internal reference that only event managers will see.','dbem'); ?></p>
|
463 |
-
<?php foreach( $EM_Booking->get_notes() as $note ):
|
464 |
-
$user = new EM_Person($note['author']);
|
465 |
-
?>
|
466 |
-
<div>
|
467 |
-
<?php echo sprintf(esc_html_x('%1$s - %2$s wrote','[Date] - [Name] wrote','dbem'), date(get_option('date_format'), $note['timestamp']), $user->get_name()); ?>:
|
468 |
-
<p style="background:#efefef; padding:5px;"><?php echo nl2br($note['note']); ?></p>
|
469 |
-
</div>
|
470 |
-
<?php endforeach; ?>
|
471 |
-
<form method="post" action="" style="padding:5px;">
|
472 |
-
<textarea class="widefat" rows="5" name="booking_note"></textarea>
|
473 |
-
<input type="hidden" name="action" value="bookings_add_note" />
|
474 |
-
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('bookings_add_note'); ?>" />
|
475 |
-
<input type="submit" value="Add Note" />
|
476 |
-
</form>
|
477 |
-
</div>
|
478 |
-
</div>
|
479 |
-
<?php do_action('em_bookings_single_metabox_footer', $EM_Booking); ?>
|
480 |
-
</div>
|
481 |
-
</div>
|
482 |
-
</div>
|
483 |
-
<br style="clear:both;" />
|
484 |
-
<?php do_action('em_bookings_single_footer', $EM_Booking); ?>
|
485 |
-
</div>
|
486 |
-
<?php
|
487 |
-
|
488 |
-
}
|
489 |
-
|
490 |
-
/**
|
491 |
-
* Shows all bookings made by one person.
|
492 |
-
*/
|
493 |
-
function em_bookings_person(){
|
494 |
-
global $EM_Person, $EM_Notices;
|
495 |
-
$EM_Person->get_bookings();
|
496 |
-
$has_booking = false;
|
497 |
-
foreach($EM_Person->get_bookings() as $EM_Booking){
|
498 |
-
if($EM_Booking->can_manage('manage_bookings','manage_others_bookings')){
|
499 |
-
$has_booking = true;
|
500 |
-
}
|
501 |
-
}
|
502 |
-
if( !$has_booking && !current_user_can('manage_others_bookings') ){
|
503 |
-
?>
|
504 |
-
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this event.','dbem'); ?></p></div>
|
505 |
-
<?php
|
506 |
-
return false;
|
507 |
-
}
|
508 |
-
?>
|
509 |
-
<div class='wrap'>
|
510 |
-
<div id='icon-users' class='icon32'>
|
511 |
-
<br/>
|
512 |
-
</div>
|
513 |
-
<h2>
|
514 |
-
<?php esc_html_e('Manage Person\'s Booking', 'dbem'); ?>
|
515 |
-
<?php if( current_user_can('edit_users') ) : ?>
|
516 |
-
<a href="<?php echo admin_url('user-edit.php?user_id='.$EM_Person->ID); ?>" class="button add-new-h2"><?php esc_html_e('Edit User','dbem') ?></a>
|
517 |
-
<?php endif; ?>
|
518 |
-
<?php if( current_user_can('delete_users') ) : ?>
|
519 |
-
<a href="<?php echo wp_nonce_url( admin_url("users.php?action=delete&user=$EM_Person->ID"), 'bulk-users' ); ?>" class="button add-new-h2"><?php esc_html_e('Delete User','dbem') ?></a>
|
520 |
-
<?php endif; ?>
|
521 |
-
</h2>
|
522 |
-
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
523 |
-
<?php do_action('em_bookings_person_header'); ?>
|
524 |
-
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
525 |
-
<div id="post-body">
|
526 |
-
<div id="post-body-content">
|
527 |
-
<div id="event_name" class="stuffbox">
|
528 |
-
<h3>
|
529 |
-
<?php esc_html_e( 'Personal Details', 'dbem' ); ?>
|
530 |
-
</h3>
|
531 |
-
<div class="inside">
|
532 |
-
<?php echo $EM_Person->display_summary(); ?>
|
533 |
-
</div>
|
534 |
-
</div>
|
535 |
-
</div>
|
536 |
-
</div>
|
537 |
-
</div>
|
538 |
-
<br style="clear:both;" />
|
539 |
-
<?php do_action('em_bookings_person_body_1'); ?>
|
540 |
-
<div class="icon32" id="icon-bookings"><br></div>
|
541 |
-
<h2><?php esc_html_e('Past And Present Bookings','dbem'); ?></h2>
|
542 |
-
<?php
|
543 |
-
$EM_Bookings_Table = new EM_Bookings_Table();
|
544 |
-
$EM_Bookings_Table->status = 'all';
|
545 |
-
$EM_Bookings_Table->scope = 'all';
|
546 |
-
$EM_Bookings_Table->output();
|
547 |
-
?>
|
548 |
-
<?php do_action('em_bookings_person_footer', $EM_Person); ?>
|
549 |
-
</div>
|
550 |
-
<?php
|
551 |
-
}
|
552 |
-
|
553 |
-
function em_printable_booking_report() {
|
554 |
-
global $EM_Event;
|
555 |
-
//check that user can access this page
|
556 |
-
if( isset($_GET['page']) && $_GET['page']=='events-manager-bookings' && isset($_GET['action']) && $_GET['action'] == 'bookings_report' && is_object($EM_Event)){
|
557 |
-
if( is_object($EM_Event) && !$EM_Event->can_manage('edit_events','edit_others_events') ){
|
558 |
-
?>
|
559 |
-
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this event.','dbem'); ?></p></div>
|
560 |
-
<?php
|
561 |
-
return false;
|
562 |
-
}
|
563 |
-
em_locate_template('templates/bookings-event-printable.php', true);
|
564 |
-
die();
|
565 |
-
}
|
566 |
-
}
|
567 |
-
add_action('admin_init', 'em_printable_booking_report');
|
568 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Check if there's any admin-related actions to take for bookings. All actions are caught here.
|
4 |
+
* @return null
|
5 |
+
*/
|
6 |
+
function em_admin_actions_bookings() {
|
7 |
+
global $dbem_form_add_message;
|
8 |
+
global $dbem_form_delete_message;
|
9 |
+
global $wpdb, $EM_Booking, $EM_Event, $EM_Notices;
|
10 |
+
|
11 |
+
if( is_object($EM_Booking) && !empty($_REQUEST['action']) && $EM_Booking->can_manage('manage_bookings','manage_others_bookings') ) {
|
12 |
+
if( $_REQUEST['action'] == 'bookings_add_note' && wp_verify_nonce($_REQUEST['_wpnonce'],'bookings_add_note') ){
|
13 |
+
$EM_Booking->add_note($_REQUEST['booking_note']);
|
14 |
+
function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
|
15 |
+
add_action ( 'admin_notices', 'em_booking_save_notification' );
|
16 |
+
}
|
17 |
+
}
|
18 |
+
if( is_object($EM_Event) && !empty($_REQUEST['action']) ){
|
19 |
+
if( $_REQUEST['action'] == 'bookings_export_csv' && wp_verify_nonce($_REQUEST['_wpnonce'],'bookings_export_csv') ){
|
20 |
+
$EM_Event->get_bookings()->export_csv();
|
21 |
+
exit();
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
add_action('admin_init','em_admin_actions_bookings',100);
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Decide what content to show in the bookings section.
|
29 |
+
*/
|
30 |
+
function em_bookings_page(){
|
31 |
+
//First any actions take priority
|
32 |
+
do_action('em_bookings_admin_page');
|
33 |
+
if( !empty($_REQUEST['_wpnonce']) ){ $_REQUEST['_wpnonce'] = $_GET['_wpnonce'] = $_POST['_wpnonce'] = esc_attr($_REQUEST['_wpnonce']); } //XSS fix just in case here too
|
34 |
+
if( !empty($_REQUEST['action']) && substr($_REQUEST['action'],0,7) != 'booking' ){ //actions not starting with booking_
|
35 |
+
do_action('em_bookings_'.$_REQUEST['action']);
|
36 |
+
}elseif( !empty($_REQUEST['booking_id']) ){
|
37 |
+
em_bookings_single();
|
38 |
+
}elseif( !empty($_REQUEST['person_id']) ){
|
39 |
+
em_bookings_person();
|
40 |
+
}elseif( !empty($_REQUEST['event_id']) ){
|
41 |
+
em_bookings_event();
|
42 |
+
}elseif( !empty($_REQUEST['ticket_id']) ){
|
43 |
+
em_bookings_ticket();
|
44 |
+
}else{
|
45 |
+
em_bookings_dashboard();
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Generates the bookings dashboard, showing information on all events
|
51 |
+
*/
|
52 |
+
function em_bookings_dashboard(){
|
53 |
+
global $EM_Notices;
|
54 |
+
?>
|
55 |
+
<div class='wrap em-bookings-dashboard'>
|
56 |
+
<?php if( is_admin() ): ?>
|
57 |
+
<div id='icon-users' class='icon32'>
|
58 |
+
<br/>
|
59 |
+
</div>
|
60 |
+
<h2>
|
61 |
+
<?php esc_html_e('Event Bookings Dashboard', 'dbem'); ?>
|
62 |
+
</h2>
|
63 |
+
<?php else: echo $EM_Notices; ?>
|
64 |
+
<?php endif; ?>
|
65 |
+
<div class="em-bookings-recent">
|
66 |
+
<h2><?php esc_html_e('Recent Bookings','dbem'); ?></h2>
|
67 |
+
<?php
|
68 |
+
$EM_Bookings_Table = new EM_Bookings_Table();
|
69 |
+
$EM_Bookings_Table->status = get_option('dbem_bookings_approval') ? 'needs-attention':'confirmed';
|
70 |
+
$EM_Bookings_Table->output();
|
71 |
+
?>
|
72 |
+
</div>
|
73 |
+
<br class="clear" />
|
74 |
+
<div class="em-bookings-events">
|
75 |
+
<h2><?php esc_html_e('Events With Bookings Enabled','dbem'); ?></h2>
|
76 |
+
<?php em_bookings_events_table(); ?>
|
77 |
+
<?php do_action('em_bookings_dashboard'); ?>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
<?php
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Shows all booking data for a single event
|
85 |
+
*/
|
86 |
+
function em_bookings_event(){
|
87 |
+
global $EM_Event,$EM_Person,$EM_Notices;
|
88 |
+
//check that user can access this page
|
89 |
+
if( is_object($EM_Event) && !$EM_Event->can_manage('manage_bookings','manage_others_bookings') ){
|
90 |
+
?>
|
91 |
+
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this event.','dbem'); ?></p></div>
|
92 |
+
<?php
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
$localised_start_date = date_i18n('D d M Y', $EM_Event->start);
|
96 |
+
$localised_end_date = date_i18n('D d M Y', $EM_Event->end);
|
97 |
+
?>
|
98 |
+
<div class='wrap'>
|
99 |
+
<div id='icon-users' class='icon32'>
|
100 |
+
<br/>
|
101 |
+
</div>
|
102 |
+
<h2>
|
103 |
+
<?php echo sprintf(__('Manage %s Bookings', 'dbem'), "'{$EM_Event->event_name}'"); ?>
|
104 |
+
<a href="<?php echo $EM_Event->get_permalink(); ?>" class="button add-new-h2"><?php echo sprintf(__('View %s','dbem'), __('Event', 'dbem')) ?></a>
|
105 |
+
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="button add-new-h2"><?php echo sprintf(__('Edit %s','dbem'), __('Event', 'dbem')) ?></a>
|
106 |
+
<?php if( locate_template('plugins/events-manager/templates/csv-event-bookings.php', false) ): //support for legacy template ?>
|
107 |
+
<a href='<?php echo EM_ADMIN_URL ."&page=events-manager-bookings&action=bookings_export_csv&_wpnonce=".wp_create_nonce('bookings_export_csv')."&event_id=".$EM_Event->event_id ?>' class="button add-new-h2"><?php esc_html_e('Export CSV','dbem')?></a>
|
108 |
+
<?php endif; ?>
|
109 |
+
<?php do_action('em_admin_event_booking_options_buttons'); ?>
|
110 |
+
</h2>
|
111 |
+
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
112 |
+
<div>
|
113 |
+
<p><strong><?php esc_html_e('Event Name','dbem'); ?></strong> : <?php echo esc_html($EM_Event->event_name); ?></p>
|
114 |
+
<p>
|
115 |
+
<strong><?php esc_html_e('Availability','dbem'); ?></strong> :
|
116 |
+
<?php echo $EM_Event->get_bookings()->get_booked_spaces() . '/'. $EM_Event->get_spaces() ." ". __('Spaces confirmed','dbem'); ?>
|
117 |
+
<?php if( get_option('dbem_bookings_approval_reserved') ): ?>
|
118 |
+
, <?php echo $EM_Event->get_bookings()->get_available_spaces() . '/'. $EM_Event->get_spaces() ." ". __('Available spaces','dbem'); ?>
|
119 |
+
<?php endif; ?>
|
120 |
+
</p>
|
121 |
+
<p>
|
122 |
+
<strong><?php esc_html_e('Date','dbem'); ?></strong> :
|
123 |
+
<?php echo $localised_start_date; ?>
|
124 |
+
<?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
|
125 |
+
<?php echo substr ( $EM_Event->event_start_time, 0, 5 ) . " - " . substr ( $EM_Event->event_end_time, 0, 5 ); ?>
|
126 |
+
</p>
|
127 |
+
<p>
|
128 |
+
<strong><?php esc_html_e('Location','dbem'); ?></strong> :
|
129 |
+
<a class="row-title" href="<?php echo admin_url(); ?>post.php?action=edit&post=<?php echo $EM_Event->get_location()->post_id ?>"><?php echo ($EM_Event->get_location()->location_name); ?></a>
|
130 |
+
</p>
|
131 |
+
</div>
|
132 |
+
<h2><?php esc_html_e('Bookings','dbem'); ?></h2>
|
133 |
+
<?php
|
134 |
+
$EM_Bookings_Table = new EM_Bookings_Table();
|
135 |
+
$EM_Bookings_Table->status = 'all';
|
136 |
+
$EM_Bookings_Table->output();
|
137 |
+
?>
|
138 |
+
<?php do_action('em_bookings_event_footer', $EM_Event); ?>
|
139 |
+
</div>
|
140 |
+
<?php
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Shows a ticket view
|
145 |
+
*/
|
146 |
+
function em_bookings_ticket(){
|
147 |
+
global $EM_Ticket,$EM_Notices;
|
148 |
+
$EM_Event = $EM_Ticket->get_event();
|
149 |
+
//check that user can access this page
|
150 |
+
if( is_object($EM_Ticket) && !$EM_Ticket->can_manage() ){
|
151 |
+
?>
|
152 |
+
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this ticket.','dbem'); ?></p></div>
|
153 |
+
<?php
|
154 |
+
return false;
|
155 |
+
}
|
156 |
+
?>
|
157 |
+
<div class='wrap'>
|
158 |
+
<div id='icon-users' class='icon32'>
|
159 |
+
<br/>
|
160 |
+
</div>
|
161 |
+
<h2>
|
162 |
+
<?php echo sprintf(__('Ticket for %s', 'dbem'), "'{$EM_Event->name}'"); ?>
|
163 |
+
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="button add-new-h2"><?php esc_html_e('View/Edit Event','dbem') ?></a>
|
164 |
+
<a href="<?php echo $EM_Event->get_bookings_url(); ?>" class="button add-new-h2"><?php esc_html_e('View Event Bookings','dbem') ?></a>
|
165 |
+
</h2>
|
166 |
+
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
167 |
+
<div>
|
168 |
+
<table>
|
169 |
+
<tr><td><?php echo __('Name','dbem'); ?></td><td></td><td><?php echo $EM_Ticket->ticket_name; ?></td></tr>
|
170 |
+
<tr><td><?php echo __('Description','dbem'); ?> </td><td></td><td><?php echo ($EM_Ticket->ticket_description) ? $EM_Ticket->ticket_description : '-'; ?></td></tr>
|
171 |
+
<tr><td><?php echo __('Price','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_price) ? $EM_Ticket->ticket_price : '-'; ?></td></tr>
|
172 |
+
<tr><td><?php echo __('Spaces','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_spaces) ? $EM_Ticket->ticket_spaces : '-'; ?></td></tr>
|
173 |
+
<tr><td><?php echo __('Min','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_min) ? $EM_Ticket->ticket_min : '-'; ?></td></tr>
|
174 |
+
<tr><td><?php echo __('Max','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_max) ? $EM_Ticket->ticket_max : '-'; ?></td></tr>
|
175 |
+
<tr><td><?php echo __('Start','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_start) ? $EM_Ticket->ticket_start : '-'; ?></td></tr>
|
176 |
+
<tr><td><?php echo __('End','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_end) ? $EM_Ticket->ticket_end : '-'; ?></td></tr>
|
177 |
+
<?php do_action('em_booking_admin_ticket_row', $EM_Ticket); ?>
|
178 |
+
</table>
|
179 |
+
</div>
|
180 |
+
<div class="icon32" id="icon-bookings"><br></div>
|
181 |
+
<h2><?php esc_html_e('Bookings','dbem'); ?></h2>
|
182 |
+
<?php
|
183 |
+
$EM_Bookings_Table = new EM_Bookings_Table();
|
184 |
+
$EM_Bookings_Table->status = get_option('dbem_bookings_approval') ? 'needs-attention':'confirmed';
|
185 |
+
$EM_Bookings_Table->output();
|
186 |
+
?>
|
187 |
+
<?php do_action('em_bookings_ticket_footer', $EM_Ticket); ?>
|
188 |
+
</div>
|
189 |
+
<?php
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Shows a single booking for a single person.
|
194 |
+
*/
|
195 |
+
function em_bookings_single(){
|
196 |
+
global $EM_Booking, $EM_Notices; /* @var $EM_Booking EM_Booking */
|
197 |
+
//check that user can access this page
|
198 |
+
if( is_object($EM_Booking) && !$EM_Booking->can_manage() ){
|
199 |
+
?>
|
200 |
+
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this event.','dbem'); ?></p></div>
|
201 |
+
<?php
|
202 |
+
return false;
|
203 |
+
}
|
204 |
+
?>
|
205 |
+
<div class='wrap' id="em-bookings-admin-booking">
|
206 |
+
<div class="icon32" id="icon-bookings"><br></div>
|
207 |
+
<h2>
|
208 |
+
<?php esc_html_e('Edit Booking', 'dbem'); ?>
|
209 |
+
</h2>
|
210 |
+
<div id="poststuff" class="metabox-holder">
|
211 |
+
<div id="post-body">
|
212 |
+
<div id="post-body-content">
|
213 |
+
<div class="stuffbox">
|
214 |
+
<h3>
|
215 |
+
<?php esc_html_e( 'Event Details', 'dbem' ); ?>
|
216 |
+
</h3>
|
217 |
+
<div class="inside">
|
218 |
+
<?php
|
219 |
+
$EM_Event = $EM_Booking->get_event();
|
220 |
+
$localised_start_date = date_i18n(get_option('dbem_date_format'), $EM_Event->start);
|
221 |
+
$localised_end_date = date_i18n(get_option('dbem_date_format'), $EM_Event->end);
|
222 |
+
?>
|
223 |
+
<table>
|
224 |
+
<tr><td><strong><?php esc_html_e('Name','dbem'); ?></strong></td><td><a class="row-title" href="<?php echo $EM_Event->get_bookings_url(); ?>"><?php echo ($EM_Event->event_name); ?></a></td></tr>
|
225 |
+
<tr>
|
226 |
+
<td><strong><?php esc_html_e('Date/Time','dbem'); ?> </strong></td>
|
227 |
+
<td>
|
228 |
+
<?php echo $localised_start_date; ?>
|
229 |
+
<?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
|
230 |
+
<?php echo substr ( $EM_Event->event_start_time, 0, 5 ) . " - " . substr ( $EM_Event->event_end_time, 0, 5 ); ?>
|
231 |
+
</td>
|
232 |
+
</tr>
|
233 |
+
</table>
|
234 |
+
<?php do_action('em_bookings_admin_booking_event', $EM_Event); ?>
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
<div class="stuffbox">
|
238 |
+
<h3>
|
239 |
+
<?php esc_html_e( 'Personal Details', 'dbem' ); ?>
|
240 |
+
</h3>
|
241 |
+
<div class="inside">
|
242 |
+
<?php $no_user = get_option('dbem_bookings_registration_disable') && $EM_Booking->get_person()->ID == get_option('dbem_bookings_registration_user'); ?>
|
243 |
+
<div class="em-booking-person-details">
|
244 |
+
<?php echo $EM_Booking->get_person()->display_summary(); ?>
|
245 |
+
<?php if( $no_user ): ?>
|
246 |
+
<input type="button" id="em-booking-person-modify" value="<?php esc_attr_e('Edit Details','dbem'); ?>" />
|
247 |
+
<?php endif; ?>
|
248 |
+
</div>
|
249 |
+
<?php if( $no_user ): ?>
|
250 |
+
<form action="" method="post" class="em-booking-person-form">
|
251 |
+
<div class="em-booking-person-editor" style="display:none;">
|
252 |
+
<?php echo $EM_Booking->get_person_editor(); ?>
|
253 |
+
<input type='hidden' name='action' value='booking_modify_person'/>
|
254 |
+
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
255 |
+
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
256 |
+
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_modify_person_'.$EM_Booking->booking_id); ?>'/>
|
257 |
+
<input type="submit" class="em-booking-person-modify-submit" id="em-booking-person-modify-submit" value="<?php esc_attr_e('Submit Changes', 'dbem'); ?>" />
|
258 |
+
<input type="button" id="em-booking-person-modify-cancel" value="<?php esc_attr_e('Cancel','dbem'); ?>" />
|
259 |
+
</div>
|
260 |
+
</form>
|
261 |
+
<script type="text/javascript">
|
262 |
+
jQuery(document).ready( function($){
|
263 |
+
$('#em-booking-person-modify').click(function(){
|
264 |
+
$('.em-booking-person-details').hide();
|
265 |
+
$('.em-booking-person-editor').show();
|
266 |
+
});
|
267 |
+
$('#em-booking-person-modify-cancel').click(function(){
|
268 |
+
$('.em-booking-person-details').show();
|
269 |
+
$('.em-booking-person-editor').hide();
|
270 |
+
});
|
271 |
+
});
|
272 |
+
</script>
|
273 |
+
<?php endif; ?>
|
274 |
+
<?php do_action('em_bookings_admin_booking_person', $EM_Booking); ?>
|
275 |
+
</div>
|
276 |
+
</div>
|
277 |
+
<div class="stuffbox">
|
278 |
+
<h3>
|
279 |
+
<?php esc_html_e( 'Booking Details', 'dbem' ); ?>
|
280 |
+
</h3>
|
281 |
+
<div class="inside">
|
282 |
+
<?php
|
283 |
+
$EM_Event = $EM_Booking->get_event();
|
284 |
+
$localised_start_date = date_i18n(get_option('date_format'), $EM_Event->start);
|
285 |
+
$localised_end_date = date_i18n(get_option('date_format'), $EM_Event->end);
|
286 |
+
$shown_tickets = array();
|
287 |
+
?>
|
288 |
+
<div>
|
289 |
+
<form action="" method="post" class="em-booking-single-status-info">
|
290 |
+
<strong><?php esc_html_e('Status','dbem'); ?> : </strong>
|
291 |
+
<?php echo $EM_Booking->get_status(); ?>
|
292 |
+
<input type="button" class="em-booking-submit-status-modify" id="em-booking-submit-status-modify" value="<?php esc_attr_e('Change', 'dbem'); ?>" />
|
293 |
+
<input type="submit" class="em-booking-resend-email" id="em-booking-resend-email" value="<?php esc_attr_e('Resend Email', 'dbem'); ?>" />
|
294 |
+
<input type='hidden' name='action' value='booking_resend_email'/>
|
295 |
+
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
296 |
+
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
297 |
+
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_resend_email_'.$EM_Booking->booking_id); ?>'/>
|
298 |
+
</form>
|
299 |
+
<form action="" method="post" class="em-booking-single-status-edit">
|
300 |
+
<strong><?php esc_html_e('Status','dbem'); ?> : </strong>
|
301 |
+
<select name="booking_status">
|
302 |
+
<?php foreach($EM_Booking->status_array as $status => $status_name): ?>
|
303 |
+
<option value="<?php echo esc_attr($status); ?>" <?php if($status == $EM_Booking->booking_status){ echo 'selected="selected"'; } ?>><?php echo esc_html($status_name); ?></option>
|
304 |
+
<?php endforeach; ?>
|
305 |
+
</select>
|
306 |
+
<input type="checkbox" checked="checked" name="send_email" value="1" />
|
307 |
+
<?php esc_html_e('Send Email','dbem'); ?>
|
308 |
+
<input type="submit" class="em-booking-submit-status" id="em-booking-submit-status" value="<?php esc_attr_e('Submit Changes', 'dbem'); ?>" />
|
309 |
+
<input type="button" class="em-booking-submit-status-cancel" id="em-booking-submit-status-cancel" value="<?php esc_attr_e('Cancel', 'dbem'); ?>" />
|
310 |
+
<input type='hidden' name='action' value='booking_set_status'/>
|
311 |
+
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
312 |
+
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
313 |
+
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_set_status_'.$EM_Booking->booking_id); ?>'/>
|
314 |
+
<br /><em><?php echo wp_kses_data(__('<strong>Notes:</strong> Ticket availability not taken into account when approving new bookings (i.e. you can overbook).','dbem')); ?></em>
|
315 |
+
</form>
|
316 |
+
</div>
|
317 |
+
<form action="" method="post" class="em-booking-form">
|
318 |
+
<table class="em-tickets-bookings-table" cellpadding="0" cellspacing="0">
|
319 |
+
<thead>
|
320 |
+
<tr>
|
321 |
+
<th><?php esc_html_e('Ticket Type','dbem'); ?></th>
|
322 |
+
<th><?php esc_html_e('Spaces','dbem'); ?></th>
|
323 |
+
<th><?php esc_html_e('Price','dbem'); ?></th>
|
324 |
+
</tr>
|
325 |
+
</thead>
|
326 |
+
<tbody>
|
327 |
+
<?php foreach($EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking): /* @var $EM_Ticket_Booking EM_Ticket_Booking */ ?>
|
328 |
+
<tr>
|
329 |
+
<td class="ticket-type"><a class="row-title" href="<?php echo em_add_get_params($EM_Event->get_bookings_url(), array('ticket_id'=>$EM_Ticket_Booking->ticket_id)); ?>"><?php echo $EM_Ticket_Booking->get_ticket()->ticket_name ?></a></td>
|
330 |
+
<td>
|
331 |
+
<span class="em-booking-single-info"><?php echo $EM_Ticket_Booking->get_spaces(); ?></span>
|
332 |
+
<div class="em-booking-single-edit"><input name="em_tickets[<?php echo $EM_Ticket_Booking->ticket_id; ?>][spaces]" class="em-ticket-select" id="em-ticket-spaces-<?php echo $EM_Ticket_Booking->ticket_id; ?>" value="<?php echo $EM_Ticket_Booking->get_spaces(); ?>" /></div>
|
333 |
+
</td>
|
334 |
+
<td><?php echo $EM_Ticket_Booking->get_price(true,true); ?></td>
|
335 |
+
</tr>
|
336 |
+
<?php
|
337 |
+
$shown_tickets[] = $EM_Ticket_Booking->ticket_id;
|
338 |
+
do_action('em_bookings_admin_ticket_row', $EM_Ticket_Booking->get_ticket(), $EM_Booking);
|
339 |
+
?>
|
340 |
+
<?php endforeach; ?>
|
341 |
+
<?php if( count($shown_tickets) < count($EM_Event->get_bookings()->get_tickets()->tickets)): ?><tr>
|
342 |
+
<?php foreach($EM_Event->get_bookings()->get_tickets()->tickets as $EM_Ticket): /* @var $EM_Ticket EM_Ticket */ ?>
|
343 |
+
<?php if( !in_array($EM_Ticket->ticket_id, $shown_tickets) ): ?>
|
344 |
+
<tr>
|
345 |
+
<td class="ticket-type"><a class="row-title" href="<?php echo em_add_get_params($EM_Event->get_bookings_url(), array('ticket_id'=>$EM_Ticket->ticket_id)); ?>"><?php echo $EM_Ticket->ticket_name ?></a></td>
|
346 |
+
<td>
|
347 |
+
<span class="em-booking-single-info">0</span>
|
348 |
+
<div class="em-booking-single-edit"><input name="em_tickets[<?php echo $EM_Ticket->ticket_id; ?>][spaces]" class="em-ticket-select" id="em-ticket-spaces-<?php echo $EM_Ticket_Booking->ticket_id; ?>" value="0" /></div>
|
349 |
+
</td>
|
350 |
+
<td><?php echo em_get_currency_symbol() ?>0.00</td>
|
351 |
+
</tr>
|
352 |
+
<?php do_action('em_bookings_admin_ticket_row', $EM_Ticket, $EM_Booking); ?>
|
353 |
+
<?php endif; ?>
|
354 |
+
<?php endforeach; ?>
|
355 |
+
<?php endif; ?>
|
356 |
+
</tbody>
|
357 |
+
<tfoot>
|
358 |
+
<?php
|
359 |
+
do_action('em_bookings_admin_ticket_totals_header');
|
360 |
+
$price_summary = $EM_Booking->get_price_summary_array();
|
361 |
+
//we should now have an array of information including base price, taxes and post/pre tax discounts
|
362 |
+
?>
|
363 |
+
<tr>
|
364 |
+
<th><?php esc_html_e('Price','dbem'); ?></th>
|
365 |
+
<th><?php echo sprintf(__('%d Spaces','dbem'), $EM_Booking->get_spaces()); ?></th>
|
366 |
+
<th><?php echo $EM_Booking->get_price_base(true); ?></th>
|
367 |
+
</tr>
|
368 |
+
<?php if( count($price_summary['discounts_pre_tax']) > 0 ): ?>
|
369 |
+
<?php foreach( $price_summary['discounts_pre_tax'] as $discount_summary ): ?>
|
370 |
+
<tr>
|
371 |
+
<th><?php echo $discount_summary['name']; ?></th>
|
372 |
+
<th><?php echo $discount_summary['discount']; ?></th>
|
373 |
+
<th>- <?php echo $discount_summary['amount']; ?></th>
|
374 |
+
</tr>
|
375 |
+
<?php endforeach; ?>
|
376 |
+
<?php endif; ?>
|
377 |
+
<?php if( !empty($price_summary['taxes']['amount']) ): ?>
|
378 |
+
<tr>
|
379 |
+
<th><?php esc_html_e('Tax','dbem'); ?></th>
|
380 |
+
<th>
|
381 |
+
<span class="em-booking-single-info"><?php echo $price_summary['taxes']['rate'] ?></span>
|
382 |
+
<div class="em-booking-single-edit"><input name="booking_tax_rate" value="<?php echo esc_attr($EM_Booking->get_tax_rate()); ?>">%</div>
|
383 |
+
</th>
|
384 |
+
<th><?php echo $price_summary['taxes']['amount']; ?></th>
|
385 |
+
</tr>
|
386 |
+
<?php endif; ?>
|
387 |
+
<?php if( count($price_summary['discounts_post_tax']) > 0 ): ?>
|
388 |
+
<?php foreach( $price_summary['discounts_post_tax'] as $discount_summary ): ?>
|
389 |
+
<tr>
|
390 |
+
<th><?php echo $discount_summary['name']; ?></th>
|
391 |
+
<th><?php echo $discount_summary['discount']; ?></th>
|
392 |
+
<th>- <?php echo $discount_summary['amount']; ?></th>
|
393 |
+
</tr>
|
394 |
+
<?php endforeach; ?>
|
395 |
+
<?php endif; ?>
|
396 |
+
<tr>
|
397 |
+
<th><?php esc_html_e('Total Price','dbem'); ?></th>
|
398 |
+
<th> </th>
|
399 |
+
<th><?php echo $price_summary['total']; ?></th>
|
400 |
+
</tr>
|
401 |
+
<?php do_action('em_bookings_admin_ticket_totals_footer'); ?>
|
402 |
+
</tfoot>
|
403 |
+
</table>
|
404 |
+
<table class="em-form-fields" cellspacing="0" cellpadding="0">
|
405 |
+
<?php if( !has_action('em_bookings_single_custom') ): //default behaviour ?>
|
406 |
+
<tr>
|
407 |
+
<th><?php esc_html_e('Comment','dbem'); ?></th>
|
408 |
+
<td>
|
409 |
+
<span class="em-booking-single-info"><?php echo esc_html($EM_Booking->booking_comment); ?></span>
|
410 |
+
<div class="em-booking-single-edit"><textarea name="booking_comment"><?php echo esc_html($EM_Booking->booking_comment); ?></textarea></div>
|
411 |
+
</td>
|
412 |
+
</tr>
|
413 |
+
<?php else: do_action('em_bookings_single_custom',$EM_Booking); //do your own thing, e.g. pro ?>
|
414 |
+
<?php endif; ?>
|
415 |
+
</table>
|
416 |
+
<p class="em-booking-single-info">
|
417 |
+
<input type="button" class="em-booking-submit-modify" id="em-booking-submit-modify" value="<?php esc_attr_e('Modify Booking', 'dbem'); ?>" />
|
418 |
+
</p>
|
419 |
+
<p class="em-booking-single-edit">
|
420 |
+
<em><?php _e('<strong>Notes:</strong> Ticket availability not taken into account (i.e. you can overbook). Emails are not resent automatically.','dbem'); ?></em>
|
421 |
+
<br /><br />
|
422 |
+
<input type="submit" class="em-booking-submit" id="em-booking-submit" value="<?php esc_attr_e('Submit Changes', 'dbem'); ?>" />
|
423 |
+
<input type="button" class="em-booking-submit-cancel" id="em-booking-submit-cancel" value="<?php esc_attr_e('Cancel', 'dbem'); ?>" />
|
424 |
+
<input type='hidden' name='action' value='booking_save'/>
|
425 |
+
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
426 |
+
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
427 |
+
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_save_'.$EM_Booking->booking_id); ?>'/>
|
428 |
+
</p>
|
429 |
+
</form>
|
430 |
+
<script type="text/javascript">
|
431 |
+
jQuery(document).ready( function($){
|
432 |
+
$('#em-booking-submit-modify').click(function(){
|
433 |
+
$('.em-booking-single-info').hide();
|
434 |
+
$('.em-booking-single-edit').show();
|
435 |
+
});
|
436 |
+
$('#em-booking-submit-cancel').click(function(){
|
437 |
+
$('.em-booking-single-info').show();
|
438 |
+
$('.em-booking-single-edit').hide();
|
439 |
+
});
|
440 |
+
$('.em-booking-single-info').show();
|
441 |
+
$('.em-booking-single-edit').hide();
|
442 |
+
|
443 |
+
$('#em-booking-submit-status-modify').click(function(){
|
444 |
+
$('.em-booking-single-status-info').hide();
|
445 |
+
$('.em-booking-single-status-edit').show();
|
446 |
+
});
|
447 |
+
$('#em-booking-submit-status-cancel').click(function(){
|
448 |
+
$('.em-booking-single-status-info').show();
|
449 |
+
$('.em-booking-single-status-edit').hide();
|
450 |
+
});
|
451 |
+
$('.em-booking-single-status-info').show();
|
452 |
+
$('.em-booking-single-status-edit').hide();
|
453 |
+
});
|
454 |
+
</script>
|
455 |
+
</div>
|
456 |
+
</div>
|
457 |
+
<div id="em-booking-notes" class="stuffbox">
|
458 |
+
<h3>
|
459 |
+
<?php esc_html_e( 'Booking Notes', 'dbem' ); ?>
|
460 |
+
</h3>
|
461 |
+
<div class="inside">
|
462 |
+
<p><?php esc_html_e('You can add private notes below for internal reference that only event managers will see.','dbem'); ?></p>
|
463 |
+
<?php foreach( $EM_Booking->get_notes() as $note ):
|
464 |
+
$user = new EM_Person($note['author']);
|
465 |
+
?>
|
466 |
+
<div>
|
467 |
+
<?php echo sprintf(esc_html_x('%1$s - %2$s wrote','[Date] - [Name] wrote','dbem'), date(get_option('date_format'), $note['timestamp']), $user->get_name()); ?>:
|
468 |
+
<p style="background:#efefef; padding:5px;"><?php echo nl2br($note['note']); ?></p>
|
469 |
+
</div>
|
470 |
+
<?php endforeach; ?>
|
471 |
+
<form method="post" action="" style="padding:5px;">
|
472 |
+
<textarea class="widefat" rows="5" name="booking_note"></textarea>
|
473 |
+
<input type="hidden" name="action" value="bookings_add_note" />
|
474 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('bookings_add_note'); ?>" />
|
475 |
+
<input type="submit" value="Add Note" />
|
476 |
+
</form>
|
477 |
+
</div>
|
478 |
+
</div>
|
479 |
+
<?php do_action('em_bookings_single_metabox_footer', $EM_Booking); ?>
|
480 |
+
</div>
|
481 |
+
</div>
|
482 |
+
</div>
|
483 |
+
<br style="clear:both;" />
|
484 |
+
<?php do_action('em_bookings_single_footer', $EM_Booking); ?>
|
485 |
+
</div>
|
486 |
+
<?php
|
487 |
+
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Shows all bookings made by one person.
|
492 |
+
*/
|
493 |
+
function em_bookings_person(){
|
494 |
+
global $EM_Person, $EM_Notices;
|
495 |
+
$EM_Person->get_bookings();
|
496 |
+
$has_booking = false;
|
497 |
+
foreach($EM_Person->get_bookings() as $EM_Booking){
|
498 |
+
if($EM_Booking->can_manage('manage_bookings','manage_others_bookings')){
|
499 |
+
$has_booking = true;
|
500 |
+
}
|
501 |
+
}
|
502 |
+
if( !$has_booking && !current_user_can('manage_others_bookings') ){
|
503 |
+
?>
|
504 |
+
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this event.','dbem'); ?></p></div>
|
505 |
+
<?php
|
506 |
+
return false;
|
507 |
+
}
|
508 |
+
?>
|
509 |
+
<div class='wrap'>
|
510 |
+
<div id='icon-users' class='icon32'>
|
511 |
+
<br/>
|
512 |
+
</div>
|
513 |
+
<h2>
|
514 |
+
<?php esc_html_e('Manage Person\'s Booking', 'dbem'); ?>
|
515 |
+
<?php if( current_user_can('edit_users') ) : ?>
|
516 |
+
<a href="<?php echo admin_url('user-edit.php?user_id='.$EM_Person->ID); ?>" class="button add-new-h2"><?php esc_html_e('Edit User','dbem') ?></a>
|
517 |
+
<?php endif; ?>
|
518 |
+
<?php if( current_user_can('delete_users') ) : ?>
|
519 |
+
<a href="<?php echo wp_nonce_url( admin_url("users.php?action=delete&user=$EM_Person->ID"), 'bulk-users' ); ?>" class="button add-new-h2"><?php esc_html_e('Delete User','dbem') ?></a>
|
520 |
+
<?php endif; ?>
|
521 |
+
</h2>
|
522 |
+
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
523 |
+
<?php do_action('em_bookings_person_header'); ?>
|
524 |
+
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
525 |
+
<div id="post-body">
|
526 |
+
<div id="post-body-content">
|
527 |
+
<div id="event_name" class="stuffbox">
|
528 |
+
<h3>
|
529 |
+
<?php esc_html_e( 'Personal Details', 'dbem' ); ?>
|
530 |
+
</h3>
|
531 |
+
<div class="inside">
|
532 |
+
<?php echo $EM_Person->display_summary(); ?>
|
533 |
+
</div>
|
534 |
+
</div>
|
535 |
+
</div>
|
536 |
+
</div>
|
537 |
+
</div>
|
538 |
+
<br style="clear:both;" />
|
539 |
+
<?php do_action('em_bookings_person_body_1'); ?>
|
540 |
+
<div class="icon32" id="icon-bookings"><br></div>
|
541 |
+
<h2><?php esc_html_e('Past And Present Bookings','dbem'); ?></h2>
|
542 |
+
<?php
|
543 |
+
$EM_Bookings_Table = new EM_Bookings_Table();
|
544 |
+
$EM_Bookings_Table->status = 'all';
|
545 |
+
$EM_Bookings_Table->scope = 'all';
|
546 |
+
$EM_Bookings_Table->output();
|
547 |
+
?>
|
548 |
+
<?php do_action('em_bookings_person_footer', $EM_Person); ?>
|
549 |
+
</div>
|
550 |
+
<?php
|
551 |
+
}
|
552 |
+
|
553 |
+
function em_printable_booking_report() {
|
554 |
+
global $EM_Event;
|
555 |
+
//check that user can access this page
|
556 |
+
if( isset($_GET['page']) && $_GET['page']=='events-manager-bookings' && isset($_GET['action']) && $_GET['action'] == 'bookings_report' && is_object($EM_Event)){
|
557 |
+
if( is_object($EM_Event) && !$EM_Event->can_manage('edit_events','edit_others_events') ){
|
558 |
+
?>
|
559 |
+
<div class="wrap"><h2><?php esc_html_e('Unauthorized Access','dbem'); ?></h2><p><?php esc_html_e('You do not have the rights to manage this event.','dbem'); ?></p></div>
|
560 |
+
<?php
|
561 |
+
return false;
|
562 |
+
}
|
563 |
+
em_locate_template('templates/bookings-event-printable.php', true);
|
564 |
+
die();
|
565 |
+
}
|
566 |
+
}
|
567 |
+
add_action('admin_init', 'em_printable_booking_report');
|
568 |
?>
|
admin/em-docs.php
CHANGED
@@ -1,394 +1,398 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function em_docs_init($force_init = false){
|
4 |
-
global $pagenow;
|
5 |
-
if( ($pagenow == 'edit.php' && !empty($_GET['page']) && $_GET['page']=='events-manager-help' && class_exists('EM_Event')) || $force_init){
|
6 |
-
add_action('wp_head', 'emd_head');
|
7 |
-
//Generate the docs
|
8 |
-
global $EM_Documentation;
|
9 |
-
$EM_Event = new EM_Event();
|
10 |
-
$event_fields = $EM_Event->get_fields(true);
|
11 |
-
$EM_Location = new EM_Location();
|
12 |
-
$location_fields = $EM_Location->get_fields(true);
|
13 |
-
$EM_Documentation = array(
|
14 |
-
'arguments' => array(
|
15 |
-
'events' => array(
|
16 |
-
'blog' => array( 'desc' => sprintf('Limit search to %s created in a specific blog id (MultiSite only)','events')),
|
17 |
-
'bookings' => array( 'desc'=> 'Include only events with bookings enabled. Use \'user\' to show events a logged in user has booked.'.'1 = yes, 0 = no'),
|
18 |
-
'category' => array( 'desc'=> str_replace('%s','categories', 'Supply a single id, slug or comma-seperated 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 & to seperate ids and slugs, in which case events must contain (or not contain) both %s to be shown.'), 'default'=>0),
|
19 |
-
'
|
20 |
-
'
|
21 |
-
'
|
22 |
-
'
|
23 |
-
'
|
24 |
-
|
25 |
-
'
|
26 |
-
'
|
27 |
-
'
|
28 |
-
'
|
29 |
-
'
|
30 |
-
'
|
31 |
-
|
32 |
-
|
33 |
-
'
|
34 |
-
'
|
35 |
-
|
36 |
-
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
-
|
46 |
-
'
|
47 |
-
|
48 |
-
|
49 |
-
'' => array( 'desc' =>
|
50 |
-
|
51 |
-
|
52 |
-
'' => array( 'desc'
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
'
|
60 |
-
'
|
61 |
-
|
62 |
-
|
63 |
-
'
|
64 |
-
'
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
'
|
69 |
-
'
|
70 |
-
'
|
71 |
-
'
|
72 |
-
'
|
73 |
-
'
|
74 |
-
'
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
'#
|
86 |
-
'#
|
87 |
-
'#
|
88 |
-
'#
|
89 |
-
'#
|
90 |
-
'#
|
91 |
-
'#
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
'#
|
102 |
-
'#
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
'#
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
'#
|
137 |
-
'#
|
138 |
-
'#
|
139 |
-
'#
|
140 |
-
'#
|
141 |
-
'#
|
142 |
-
'#
|
143 |
-
'#
|
144 |
-
'#
|
145 |
-
'#
|
146 |
-
'#
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
'#
|
157 |
-
'#
|
158 |
-
'#
|
159 |
-
'#
|
160 |
-
'#
|
161 |
-
'#
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
'#
|
182 |
-
'#
|
183 |
-
'#
|
184 |
-
'#
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
'#
|
214 |
-
'#
|
215 |
-
'#
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
'#
|
245 |
-
'#
|
246 |
-
'#
|
247 |
-
'#
|
248 |
-
'#
|
249 |
-
'#
|
250 |
-
'#
|
251 |
-
'#
|
252 |
-
'#
|
253 |
-
'#
|
254 |
-
'#
|
255 |
-
'#
|
256 |
-
'#
|
257 |
-
'#
|
258 |
-
'#
|
259 |
-
'#
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
'#
|
305 |
-
'#
|
306 |
-
'#
|
307 |
-
'#
|
308 |
-
'#
|
309 |
-
'#
|
310 |
-
'#
|
311 |
-
'#
|
312 |
-
'#
|
313 |
-
'#
|
314 |
-
'#
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
'#
|
334 |
-
'#
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
'#
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
<
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
|
|
394 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function em_docs_init($force_init = false){
|
4 |
+
global $pagenow;
|
5 |
+
if( ($pagenow == 'edit.php' && !empty($_GET['page']) && $_GET['page']=='events-manager-help' && class_exists('EM_Event')) || $force_init){
|
6 |
+
add_action('wp_head', 'emd_head');
|
7 |
+
//Generate the docs
|
8 |
+
global $EM_Documentation;
|
9 |
+
$EM_Event = new EM_Event();
|
10 |
+
$event_fields = $EM_Event->get_fields(true);
|
11 |
+
$EM_Location = new EM_Location();
|
12 |
+
$location_fields = $EM_Location->get_fields(true);
|
13 |
+
$EM_Documentation = array(
|
14 |
+
'arguments' => array(
|
15 |
+
'events' => array(
|
16 |
+
'blog' => array( 'desc' => sprintf('Limit search to %s created in a specific blog id (MultiSite only)','events')),
|
17 |
+
'bookings' => array( 'desc'=> 'Include only events with bookings enabled. Use \'user\' to show events a logged in user has booked.'.'1 = yes, 0 = no'),
|
18 |
+
'category' => array( 'desc'=> str_replace('%s','categories', 'Supply a single id, slug or comma-seperated 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 & to seperate ids and slugs, in which case events must contain (or not contain) both %s to be shown.'), 'default'=>0),
|
19 |
+
'event' => array( 'desc'=> sprintf('Supply a single id or comma-seperated ids (e.g. "1,2,3") to limit the search to %s with the %s.','events', 'event_id(s)'), 'default'=>0),
|
20 |
+
'group' => array( 'desc' => 'Limit search to events belonging to a specific group id (BuddyPress only). Using \'my\' will show events belonging to groups the logged in user is a member of.'),
|
21 |
+
'near' => array('desc'=>'Accepts a comma-seperated coordinates (e.g. 1,1) value, which searches for events or locations located near this coordinate.'),
|
22 |
+
'near_unit' => array('desc'=>'The distance unit used when a near attribute is provided.', 'default'=>'mi', 'args'=>'mi or km'),
|
23 |
+
'near_distance' => array('desc'=>'The radius distance when searching with the near attribute. near_unit will determine whether this is in miles or kilometers.'),
|
24 |
+
'owner' => array('desc'=> 'Limits returned results to a specific owner, identified by their user id (e.g. list events or locations owned by user)', 'default'=>0),
|
25 |
+
'post_id' => array( 'desc' => sprintf('Supply a single id or comma-seperated ids (e.g. "1,2,3") to limit the search to %s with the %s.','events', 'post_id(s)')),
|
26 |
+
'private' => array( 'desc' => sprintf('Display private %s within your list?','events'), 'args' => '1 = yes, 0 = no', 'default' => 'If user can view private events, 1, otherwise 0.'),
|
27 |
+
'private_only' => array( 'desc' =>sprintf('Display only private %s ?','events'), 'args' => '1 = yes, 0 = no', 'default' => '0'),
|
28 |
+
'recurrence' => array( 'desc'=> 'If set to the event id of the recurring event, this will show only events this event recurrences.', 'default'=>0),
|
29 |
+
'recurring' => array( 'desc'=> 'If set to 1, will only show recurring event templates. Only useful if you know what you\'re doing, use recurrence if you want events that are recurrences.', 'default'=>0),
|
30 |
+
'scope' => array( 'desc'=> 'Choose the time frame of events to show. Additionally you can supply dates (in format of YYYY-MM-DD), either single for events on a specific date or two dates seperated by a comma (e.g. 2010-12-25,2010-12-31) for events ocurring between these dates.', 'default'=>'future', 'args'=>array("future", "past", "today", "tomorrow", "month", "next-month", "1-months", "2-months", "3-months", "6-months", "12-months","all")),
|
31 |
+
'search' => array( 'desc'=> 'Do a search for this string within event name, details and location address.' ),
|
32 |
+
'status' => array( 'desc' => sprintf('Limit search to %s with a spefic status (1 is active, 0 is pending approval)','events'), 'default'=>1),
|
33 |
+
'tag' => array( 'desc'=> str_replace('%s', 'tags', 'Supply a single id, slug or comma-seperated 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 & to seperate 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 |
+
),
|
36 |
+
'locations' => array(
|
37 |
+
'blog' => array( 'desc' => sprintf('Limit search to %s created in a specific blog id (MultiSite only)','locations')),
|
38 |
+
'country' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Country'), 'default' => 'none', 'args'=>'Use two-character country codes as defined in <a href="http://countrycode.org/">countrycode.org</a>, can be comma-seperated e.g. US,GB,ES'),
|
39 |
+
'eventful' => array( 'desc'=> 'If set to 1 will only show locations that have at least one event occurring during the scope.', 'default' => 0),
|
40 |
+
'eventless' => array( 'desc'=> 'If set to 1 will only show locations that have no events occurring during the scope.', 'default' => 0),
|
41 |
+
'location' => array( 'desc'=> sprintf('Supply a single id or comma-seperated ids (e.g. "1,2,3") to limit the search to %s with the %s.','locations', 'location_id(s)'), 'default'=>0),
|
42 |
+
'near' => array('desc'=>'Accepts a comma-seperated coordinates (e.g. 1,1) value, which searches for events or locations located near this coordinate.'),
|
43 |
+
'near_unit' => array('desc'=>'The distance unit used when a near attribute is provided.', 'default'=>'mi', 'args'=>'mi or km'),
|
44 |
+
'near_distance' => array('desc'=>'The radius distance when searching with the near attribute. near_unit will determine whether this is in miles or kilometers.'),
|
45 |
+
'owner' => array('desc'=> 'Limits returned results to a specific owner, identified by their user id (e.g. list events or locations owned by user)', 'default'=>0),
|
46 |
+
'post_id' => array( 'desc' => sprintf('Supply a single id or comma-seperated ids (e.g. "1,2,3") to limit the search to %s with the %s.','locations', 'post_id(s)')),
|
47 |
+
'postcode' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Postcode'), 'default' => 'none'),
|
48 |
+
'private' => array( 'desc' => sprintf('Display private %s within your list?','locations'), 'args' => '1 = yes, 0 = no', 'default' => 'If user can view private locations, 1, otherwise 0.'),
|
49 |
+
'private_only' => array( 'desc' =>sprintf('Display only private %s ?','locations'), 'args' => '1 = yes, 0 = no', 'default' => '0'),
|
50 |
+
'region' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Region'), 'default' => 'none'),
|
51 |
+
'scope' => array( 'default' => 'all'),
|
52 |
+
'state' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','State'), 'default' => 'none'),
|
53 |
+
'status' => array( 'desc' => sprintf('Limit search to %s with a spefic status (1 is active, 0 is pending approval)','locations'), 'default'=>1),
|
54 |
+
'town' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Town'), 'default' => 'none')
|
55 |
+
),
|
56 |
+
'categories' => array(
|
57 |
+
'' => 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.'),
|
58 |
+
),
|
59 |
+
'tags' => array(
|
60 |
+
'' => 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.'),
|
61 |
+
),
|
62 |
+
'calendar' => array(
|
63 |
+
'full' => array( 'desc'=> 'If set to 1 it will display a full calendar that shows event names.', 'default' => 0),
|
64 |
+
'long_events' => array( 'desc'=> 'If set to 1, will show events that last longer than a day.', 'default' => 0),
|
65 |
+
),
|
66 |
+
//The object is commonly shared by all, so entries above overwrite entries here
|
67 |
+
'general' => array(
|
68 |
+
'array' => array( 'desc'=> 'If you supply this as an argument, the returned data will be in an array, not an object (only useful wen using PHP, not shortcodes)', 'default'=>0),
|
69 |
+
'format_header' => array( 'desc'=> sprintf('If you are displaying lists (e.g. listing events), you can supply the %s html and placeholders here.','header'), 'default'=> 'If the <em>format</em> attribute is not provided, the relevant default format will be taken from the settings page.'),
|
70 |
+
'format' => array( 'desc'=> 'If you are displaying some information with the shortcode or function (e.g. listing events), you can supply the html and placeholders here. When providing a custom format value, format_header and format_footer will be blank if not also provided.', 'default'=> 'The relevant default format will be taken from the settings page.'),
|
71 |
+
'format_footer' => array( 'desc'=> sprintf('If you are displaying lists (e.g. listing events), you can supply the %s html and placeholders here.','footer'), 'default'=> 'If the <em>format</em> attribute is not provided, the relevant default format will be taken from the settings page.'),
|
72 |
+
'limit' => array( 'desc'=> 'Limits the amount of values returned to this number.', 'default'=>'0 (no limit)'),
|
73 |
+
'offset' => array( 'desc'=> 'For example, if you have ten results, if you set this to 5, only the last 5 results will be returned. Useful for pagination.', 'default'=>0),
|
74 |
+
'order' => array( 'desc'=> 'Indicates the alphabeitcal/numerical order of the lists. Choose between ASC (ascending) and DESC (descending).', 'default'=>'ASC'),
|
75 |
+
'orderby' => array( 'desc'=> 'Choose what fields to order your results by. You can supply a single field or multiple comma-seperated fields (e.g. "event_start_date,event_name").', 'default'=>0, 'args'=>'Database table fields, e.g. <code>event_name</code> or <code>location_name</code>'),
|
76 |
+
'pagination' => array('desc'=> 'When using a function or shortcode that outputs items (e.g. [events_list] for events, [locations_list] for locations), if the number of items supercede the limit of items to show, setting this to 1 will show page links under the list.', 'default'=>0),
|
77 |
+
'page' => array('desc' => 'Which page shall be shown. Requires pagination to be set to 1 and will override the offset value if also provided.'),
|
78 |
+
'page_queryvar' => array('desc'=>'The default parameter name used to figure out the page number to show is pno, provide a unique name if you want to display two lists on the same page with independent pagination.'),
|
79 |
+
)
|
80 |
+
),
|
81 |
+
'placeholders' => array(
|
82 |
+
'events' => array(
|
83 |
+
'Event Details' => array(
|
84 |
+
'placeholders' => array(
|
85 |
+
'#_EVENTID' => array( 'desc' => 'Shows the event ID number in the wp_em_events table.' ),
|
86 |
+
'#_EVENTPOSTID' => array( 'desc' => 'Shows the event corresponding Post ID in the wp_posts table.' ),
|
87 |
+
'#_EVENTNAME' => array( 'desc' => 'Displays the name of the event.' ),
|
88 |
+
'#_EVENTNOTES' => array( 'desc' => 'Shows the description of the event.' ),
|
89 |
+
'#_EVENTEXCERPT' => array( 'desc' => 'If an excerpt has been added to the event, it will be used. If you added a <a href="http://en.support.wordpress.com/splitting-content/more-tag/">more tag</a> to your event description, only the content before this tag will show.' ),
|
90 |
+
'#_EVENTEXCERPT{words,...}' => array( 'desc' => 'If an excerpt has not been added to the event you can use this format <code>#_EVENTEXCERPT{10,...}</code>, where 10 is the number of words to show and ... is what is used at the cut-off point.' ),
|
91 |
+
'#_EVENTIMAGE' => array( 'desc' => 'Shows the event image, if available.' ),
|
92 |
+
'#_EVENTIMAGE{x,y}' => array( 'desc' => 'Shows the event image thumbnail, x and y are width and height respectively, both being numbers e.g. <code>#_EVENTIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized' ),
|
93 |
+
'#_EVENTCATEGORIES' => array( 'desc' => 'Shows a list of category links this event belongs to.' ),
|
94 |
+
'#_EVENTCATEGORIESIMAGES' => array( 'desc' => 'Shows a list of category images this event belongs to. Categories without an image will be ignored.' ),
|
95 |
+
'#_EVENTTAGS' => array( 'desc' => 'Shows a list of tag links this event belongs to.' ),
|
96 |
+
)
|
97 |
+
),
|
98 |
+
'Date and Times' => array(
|
99 |
+
'desc' => 'These are shortcut placeholders for pre-formatted dates and times. See the Custom Date/Time Formatting section below for more refined formatting placeholders.',
|
100 |
+
'placeholders' => array(
|
101 |
+
'#_24HSTARTTIME' => array( 'desc' => 'Displays the start time in a 24 hours format (e.g. 16:30).' ),
|
102 |
+
'#_24HENDTIME' => array( 'desc' => 'Displays the end time in a 24 hours format (e.g. 18:30).' ),
|
103 |
+
'#_12HSTARTTIME' => array( 'desc' => 'Displays the start time in a 12 hours format (e.g. 4:30 PM).' ),
|
104 |
+
'#_12HENDTIME' => array( 'desc' => 'Displays the end time in a 12 hours format (e.g. 6:30 PM).' ),
|
105 |
+
'#_EVENTTIMES' => array( 'desc' => 'Displays either a single time, time-span, or "All Day" depending on your event times. Format is taken from your Events Manager settings page.' ),
|
106 |
+
'#_EVENTDATES' => array( 'desc' => 'Displays either a single date or a date range depending on your event dates. Format is taken from your Events Manager settings page.' ),
|
107 |
+
)
|
108 |
+
),
|
109 |
+
'Custom Date/Time Formatting' => array(
|
110 |
+
'desc' => 'Events Manager allows extremely flexible date formatting by using <a href="http://www.php.net/manual/en/function.date.php">PHP date syntax format characters</a> along with placeholders.',
|
111 |
+
'placeholders' => array(
|
112 |
+
'# or #@' => array( 'desc' => 'Prepend <code>#</code> or <code>#@</code> before a valid PHP date syntax format character to show start and end date/time information respectively (e.g. <code>#F</code> will show the starting month name like "January", #@h shows the end hour).' ),
|
113 |
+
'#{x} or #@{x}' => array( 'desc' => 'You can also create a date format without prepending # to each character by wrapping a valid php date() format in <code>#{}</code> or <code>#@{}</code> (e.g. <code>#_{d/m/Y}</code>). If there is no end date (or is same as start date), the value is not shown. This is useful if you want to show event end dates only on events that are longer than one day, e.g. <code>#j #M #Y #@_{ \u\n\t\i\l j M Y}</code>.' ),
|
114 |
+
)
|
115 |
+
),
|
116 |
+
'Links/URLs' => array(
|
117 |
+
'placeholders' => array(
|
118 |
+
'#_EVENTIMAGEURL' => array( 'desc' => 'Shows the event image url, if available.' ),
|
119 |
+
'#_EVENTURL' => array( 'desc' => 'Simply prints the event URL. You can use this placeholder to build your own customised links.' ),
|
120 |
+
'#_EVENTLINK' => array( 'desc' => 'Displays the event name with a link to the event page.' ),
|
121 |
+
'#_EDITEVENTLINK' => array( 'desc' => 'Inserts a link to the admin or buddypress (if activated) edit event page, only if a user is logged in and is allowed to edit the event.' ),
|
122 |
+
'#_EDITEVENTURL' => array( 'desc' => 'Inserts a url to the admin or buddypress (if activated) edit event page, only if a user is logged in and is allowed to edit the event.' ),
|
123 |
+
)
|
124 |
+
),
|
125 |
+
'Custom Attributes' => array(
|
126 |
+
'desc' => 'Events Manager allows you to create dynamic attributes to your events, which act as extra information fields for your events (e.g. "Dress Code"). For more information see <a href="http://wp-events-plugin.com/documentation/event-attributes/">our online documentation</a> for more info on attributes.',
|
127 |
+
'placeholders' => array(
|
128 |
+
'#_ATT{key}' => array('desc'=> 'This key will appear as an option when adding attributes to your event.'),
|
129 |
+
'#_ATT{key}{alternative text}' => array('desc'=> 'This key will appear as an option when adding attributes to your event. The text in the second braces will appear if the attribute is not defined or left blank for that event.'),
|
130 |
+
'#_ATT{key}{option 1|option 2|option 3|etc.}' => array('desc'=> 'This key will appear as an option when adding attributes to your event. The second braces are optional and will use a select box with these values as input. If no valid value is defined, the first option is used.'),
|
131 |
+
)
|
132 |
+
),
|
133 |
+
'Bookings' => array(
|
134 |
+
'desc' => 'These placeholders will only show if bookings are enabled for the given event and in the events manager settings page. Spaces placeholders will default to 0',
|
135 |
+
'placeholders' => array(
|
136 |
+
'#_BOOKINGFORM' => array( 'desc' => 'Adds a booking forms for this event.' ),
|
137 |
+
'#_BOOKINGBUTTON' => array( 'desc' => 'A single button that will appear to logged in users, if they click on it, they apply for a booking. This button will only display if there is one ticket.' ),
|
138 |
+
'#_AVAILABLESPACES' => array( 'desc' => 'Shows available spaces for the event.' ),
|
139 |
+
'#_BOOKEDSPACES' => array( 'desc' => 'Shows the amount of currently booked spaces for the event.' ),
|
140 |
+
'#_PENDINGSPACES' => array( 'desc' => 'Shows the amount of pending spaces for the event.' ),
|
141 |
+
'#_SPACES' => array( 'desc' => 'Shows the total spaces for the event.' ),
|
142 |
+
'#_ATTENDEES' => array( 'desc' => 'Shows the list of user avatars attending the event.' ),
|
143 |
+
'#_ATTENDEESLIST' => array( 'desc' => 'Shows the list of people attending the event.' ),
|
144 |
+
'#_ATTENDEESPENDINGLIST' => array( 'desc' => 'Shows the list of people with a pending booking for the event.' ),
|
145 |
+
'#_BOOKINGSURL' => array( 'desc' => 'Shows the url 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.' ),
|
146 |
+
'#_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.' ),
|
147 |
+
'#_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.' ),
|
148 |
+
'#_EVENTPRICERANGEALL' => array( 'desc' => 'Like #_EVENTPRICERANGE but shows all tickets price range whether or not bookings or individual tickets are available.' ),
|
149 |
+
'#_EVENTPRICEMIN' => array( 'desc' => 'Shows the lowest ticket price for this event.' ),
|
150 |
+
'#_EVENTPRICEMAX' => array( 'desc' => 'Shows the highest ticket price for this event.' ),
|
151 |
+
)
|
152 |
+
),
|
153 |
+
'Contact Details' => array(
|
154 |
+
'desc' => 'The values here are taken from the chosen contact for the specific event, or the default contact in the settings page.',
|
155 |
+
'placeholders' => array(
|
156 |
+
'#_CONTACTNAME' => array( 'desc' => 'Name of the contact person for this event (as shown in the dropdown when adding an event).' ),
|
157 |
+
'#_CONTACTUSERNAME' => array( 'desc' => 'Contact person\'s username.' ),
|
158 |
+
'#_CONTACTEMAIL' => array( 'desc' => 'E-mail of the contact person for this event.' ),
|
159 |
+
'#_CONTACTURL' => array( 'desc' => 'Website of the contact person for this event.' ),
|
160 |
+
'#_CONTACTPHONE' => array( 'desc' => 'Phone number of the contact person for this event. Can be set in the user profile page.' ),
|
161 |
+
'#_CONTACTAVATAR' => array( 'desc' => 'Contact person\'s avatar.' ),
|
162 |
+
'#_CONTACTPROFILELINK' => array( 'desc' => 'Contact person\'s "Profile" link. Only works with BuddyPress enabled.' ),
|
163 |
+
'#_CONTACTPROFILEURL' => array( 'desc' => 'Contact person\'s profile url. Only works with BuddyPress enabled.' ),
|
164 |
+
'#_CONTACTID' => array( 'desc' => 'Contact person\'s WordPress user ID.'),
|
165 |
+
'#_CONTACTMETA' => array( 'desc' => 'Display any user meta of a WordPress account by including the meta key, e.g. #_CONTACTMETA{dbem_phone}'),
|
166 |
+
)
|
167 |
+
),
|
168 |
+
'iCal/Calendar' => array(
|
169 |
+
'placeholders' => array(
|
170 |
+
'#_EVENTICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format).' ),
|
171 |
+
'#_EVENTICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format).' ),
|
172 |
+
'#_EVENTGCALURL' => array( 'desc' => 'Displays URL which would take the user to Google Calendar and pre-fill their add new event form.' ),
|
173 |
+
'#_EVENTGCALLINK' => array( 'desc' => 'Displays a button which would take the user to Google Calendar and pre-fill their add new event form.' )
|
174 |
+
)
|
175 |
+
),
|
176 |
+
),
|
177 |
+
'categories' => array(
|
178 |
+
'Category Details' => array(
|
179 |
+
'desc' => 'You can use these when displaying categories or for showing the first available category in an event format.',
|
180 |
+
'placeholders' => array(
|
181 |
+
'#_CATEGORYNAME' => array( 'desc' => 'Shows the category name.' ),
|
182 |
+
'#_CATEGORYID' => array( 'desc' => 'Shows the category ID.' ),
|
183 |
+
'#_CATEGORYSLUG' => array( 'desc' => 'Shows the category slug.' ),
|
184 |
+
'#_CATEGORYCOLOR' => array( 'desc' => 'Shows the category color (useful for inline styling), in hex format, if no color is defined #FFFFFF (white) will be used.' ),
|
185 |
+
'#_CATEGORYIMAGE' => array( 'desc' => 'Shows the category image, if available.' ),
|
186 |
+
'#_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.' ),
|
187 |
+
'#_CATEGORYIMAGEURL' => array( 'desc' => 'Shows the category image url, if available.' ),
|
188 |
+
'#_CATEGORYNOTES' => array( 'desc' => 'Shows the category description.' )
|
189 |
+
)
|
190 |
+
),
|
191 |
+
'Related Events' => array(
|
192 |
+
'desc' => 'You can show lists of other events belonging to this category. The formatting of the list is the same as a normal events list.',
|
193 |
+
'placeholders' => array(
|
194 |
+
'#_CATEGORYPASTEVENTS' => array( 'desc' => 'Will show a list of all past events with this category.' ),
|
195 |
+
'#_CATEGORYNEXTEVENTS' => array( 'desc' => 'Will show a list of all future events with this category.' ),
|
196 |
+
'#_CATEGORYALLEVENTS' => array( 'desc' => 'Will show a list of all events with this category.' ),
|
197 |
+
'#_CATEGORYNEXTEVENT' => array( 'desc' => 'Will show the next event with this category.' )
|
198 |
+
)
|
199 |
+
),
|
200 |
+
'iCal/RSS Feeds' => array(
|
201 |
+
'placeholders' => array(
|
202 |
+
'#_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' ),
|
203 |
+
'#_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' ),
|
204 |
+
'#_CATEGORYRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening in this category.', 'since'=>'5.5.2' ),
|
205 |
+
'#_CATEGORYRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening in this category.', 'since'=>'5.5.2' )
|
206 |
+
)
|
207 |
+
)
|
208 |
+
),
|
209 |
+
'tags' => array(
|
210 |
+
'Tag Details' => array(
|
211 |
+
'desc' => 'You can use these when displaying tags or for showing the first available tag in an event format.',
|
212 |
+
'placeholders' => array(
|
213 |
+
'#_TAGNAME' => array( 'desc' => 'Shows the tag name.' ),
|
214 |
+
'#_TAGID' => array( 'desc' => 'Shows the tag ID.' ),
|
215 |
+
'#_TAGSLUG' => array( 'desc' => 'Shows the tag slug.' ),
|
216 |
+
'#_TAGIMAGE' => array( 'desc' => 'Shows the tag image, if available.' ),
|
217 |
+
'#_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.' ),
|
218 |
+
'#_TAGIMAGEURL' => array( 'desc' => 'Shows the tag image url, if available.' ),
|
219 |
+
'#_TAGNOTES' => array( 'desc' => 'Shows the tag description.' )
|
220 |
+
)
|
221 |
+
),
|
222 |
+
'Related Events' => array(
|
223 |
+
'desc' => 'You can show lists of other events belonging to this tag. The formatting of the list is the same as a normal events list.',
|
224 |
+
'placeholders' => array(
|
225 |
+
'#_TAGPASTEVENTS' => array( 'desc' => 'Will show a list of all past events with this tag.' ),
|
226 |
+
'#_TAGNEXTEVENTS' => array( 'desc' => 'Will show a list of all future events with this tag.' ),
|
227 |
+
'#_TAGALLEVENTS' => array( 'desc' => 'Will show a list of all events with this tag.' ),
|
228 |
+
'#_TAGNEXTEVENT' => array( 'desc' => 'Will show the next event with this tag.' )
|
229 |
+
)
|
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 |
+
)
|
238 |
+
)
|
239 |
+
),
|
240 |
+
'locations' => array(
|
241 |
+
'Location Details' => array(
|
242 |
+
'desc' => '',
|
243 |
+
'placeholders' => array(
|
244 |
+
'#_LOCATIONID' => array( 'desc' => 'Shows the event ID number in the wp_em_locations table.' ),
|
245 |
+
'#_LOCATIONPOSTID' => array( 'desc' => 'Shows the location corresponding Post ID in the wp_posts table.' ),
|
246 |
+
'#_LOCATIONNAME' => array( 'desc' => 'Displays the location name.' ),
|
247 |
+
'#_LOCATIONADDRESS' => array( 'desc' => 'Displays the address.' ),
|
248 |
+
'#_LOCATIONTOWN' => array( 'desc' => 'Displays the town.' ),
|
249 |
+
'#_LOCATIONSTATE' => array( 'desc' => 'Displays the state/county.' ),
|
250 |
+
'#_LOCATIONPOSTCODE' => array( 'desc' => 'Displays the postcode.' ),
|
251 |
+
'#_LOCATIONREGION' => array( 'desc' => 'Displays the region.' ),
|
252 |
+
'#_LOCATIONCOUNTRY' => array( 'desc' => 'Displays the country.' ),
|
253 |
+
'#_LOCATIONLONGITUDE' => array( 'desc' => 'Displays the longitude, used for locating in Google Maps.' ),
|
254 |
+
'#_LOCATIONLATITUDE' => array( 'desc' => 'Displays the latitude, used for locating in Google Maps.' ),
|
255 |
+
'#_LOCATIONMAP' => array( 'desc' => 'Displays a google map showing where the location is located (Will not show if maps are disabled in the settings page)' ),
|
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.' ),
|
262 |
+
'#_LOCATIONFULLLINE' => array( 'desc' => 'Shows a comma-seperated line of location information, ommitting blanks (format of address, town, state, postcode, region' ),
|
263 |
+
'#_LOCATIONFULLBR' => array( 'desc' => 'Shows a line-break (br tag) seperated location information, ommitting blanks (format of address, town, state, postcode, region' ),
|
264 |
+
)
|
265 |
+
),
|
266 |
+
'Custom Attributes' => array(
|
267 |
+
'desc' => 'Events Manager allows you to create dynamic attributes to your locations, which act as extra information fields for your locations (e.g. "Dress Code"). For more information see <a href="http://wp-events-plugin.com/documentation/event-attributes/">our online documentation</a> for more info on attributes.',
|
268 |
+
'placeholders' => array(
|
269 |
+
'#_LATT{key}' => array('desc'=> 'This key will appear as an option when adding attributes to your location.'),
|
270 |
+
'#_LATT{key}{alternative text}' => array('desc'=> 'This key will appear as an option when adding attributes to your location. The text in the second braces will appear if the attribute is not defined or left blank for that location.'),
|
271 |
+
'#_LATT{key}{option 1|option 2|option 3|etc.}' => array('desc'=> 'This key will appear as an option when adding attributes to your location. The second braces are optional and will use a select box with these values as input. If no valid value is defined, the first option is used.'),
|
272 |
+
)
|
273 |
+
),
|
274 |
+
'Links' => array(
|
275 |
+
'placeholders' => array(
|
276 |
+
'#_LOCATIONURL' => array( 'desc' => 'Simply prints the location URL. You can use this placeholder to build your own customised links.' ),
|
277 |
+
'#_LOCATIONLINK' => array( 'desc' => 'Displays the location name with a link to the location page.' ),
|
278 |
+
'#_EDITLOCATIONLINK' => array( 'desc' => 'Inserts a link to the admin or buddypress (if activated) edit location page, only if a user is logged in and is allowed to edit the location.' ),
|
279 |
+
'#_EDITLOCATIONURL' => array( 'desc' => 'Inserts a url to the admin or buddypress (if activated) edit location page, only if a user is logged in and is allowed to edit the location.' )
|
280 |
+
)
|
281 |
+
),
|
282 |
+
'Related Events' => array(
|
283 |
+
'desc' => 'You can show lists of other events that are being held at this location. The formatting of the list is the same as a normal events list.',
|
284 |
+
'placeholders' => array(
|
285 |
+
'#_LOCATIONPASTEVENTS' => array( 'desc' => 'Will show a list of all past events at this location.' ),
|
286 |
+
'#_LOCATIONNEXTEVENTS' => array( 'desc' => 'Will show a list of all future events at this location.' ),
|
287 |
+
'#_LOCATIONALLEVENTS' => array( 'desc' => 'Will show a list of all events at this location.' ),
|
288 |
+
'#_LOCATIONNEXTEVENT' => array( 'desc' => 'Will show a link to the next event at this location, or the no events message.' ),
|
289 |
+
)
|
290 |
+
),
|
291 |
+
'iCal/RSS Feeds' => array(
|
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 |
+
)
|
298 |
+
)
|
299 |
+
),
|
300 |
+
'bookings' => array(
|
301 |
+
'Individual Booking Information' => array(
|
302 |
+
'desc' => 'When a specific booking is displayed (on screen and on email), you can use these placeholders to show specific information about the booking. Event and Location placeholders are also available in these cases.',
|
303 |
+
'placeholders' => array(
|
304 |
+
'#_BOOKINGID' => array( 'desc' => 'The unique ID of this booking, useful if you are making your own customizations to this plugin.' ),
|
305 |
+
'#_BOOKINGNAME' => array( 'desc' => 'Name of person who made the booking.' ),
|
306 |
+
'#_BOOKINGEMAIL' => array( 'desc' => 'Email of person who made the booking.' ),
|
307 |
+
'#_BOOKINGPHONE' => array( 'desc' => 'Phone number of person who made the booking.' ),
|
308 |
+
'#_BOOKINGSPACES' => array( 'desc' => 'Number of spaces the person has booked.' ),
|
309 |
+
'#_BOOKINGCOMMENT' => array( 'desc' => 'Any specific comments made by the person who made the booking.' ),
|
310 |
+
'#_BOOKINGTICKETNAME' => array( 'desc' => 'Name of the ticket booked. Useful in single ticket mode, if multiple tickets are booked a random ticket is used.' ),
|
311 |
+
'#_BOOKINGTICKETDESCRIPTION' => array( 'desc' => 'Description of the ticket booked. Useful in single ticket mode, if multiple tickets are booked a random ticket is used.' ),
|
312 |
+
'#_BOOKINGTICKETPRICE' => array( 'desc' => 'Booked ticket price with currency symbol (e.g. $ 10.00). Useful in single ticket mode, if multiple tickets are booked a random ticket is used.' ),
|
313 |
+
'#_BOOKINGTICKETS' => array( 'desc' => 'A list of booked tickets. You can modify this by using template files and modifying templates/emails/bookingtickets.php' ),
|
314 |
+
'#_BOOKINGSUMMARY' => array( 'desc' => 'Shows a breakdown of price/quantity booked by ticket, followed by a summary of price totals, taxes, and other discounts applied.' ),
|
315 |
+
'#_BOOKINGFORMCUSTOM{field_id}' => array( 'desc' => sprintf('(<a href="%s">pro only</a>) Shows booking form custom fields. The field_id value must match that of your custom booking form field.','http://wp-events-plugin.com/features/') ),
|
316 |
+
'#_BOOKINGFORMCUSTOMREG{field_id}' => array( 'desc' => sprintf('(<a href="%s">pro only</a>) Shows booking form custom fields that are used for guest user registration. The field_id value must match that of your custom booking form field.','http://wp-events-plugin.com/features/') ),
|
317 |
+
'#_BOOKINGFORMCUSTOMFIELDS' => array( 'desc' => sprintf('(<a href="%s">pro only</a>) Generates a list of booking form custom fields that are used in the booking.','http://wp-events-plugin.com/features/') ),
|
318 |
+
'#_BOOKINGATTENDEES' => array('desc' => sprintf('(<a href="%s">pro only</a>) Generates a list of attendee information displaying the filled in form data for each attendee (requires individual attendee forms enabled for the event). This list is split by ticket type, then by individual attendee.','http://wp-events-plugin.com/features/')), //coupons too!
|
319 |
+
)
|
320 |
+
),
|
321 |
+
'Pricing Information' => array(
|
322 |
+
'desc' => '',
|
323 |
+
'placeholders' => array(
|
324 |
+
'#_BOOKINGPRICE' => array( 'desc' => 'Displays booking total price (tax inclusion depends on your booking settings).' ),
|
325 |
+
'#_BOOKINGPRICETAX' => array( 'desc' => 'Displays booking total tax.' ),
|
326 |
+
'#_BOOKINGPRICEWITHOUTTAX' => array( 'desc' => 'Displays booking total without tax.' ),
|
327 |
+
'#_BOOKINGPRICEWITHTAX' => array( 'desc' => 'Displays booking total with tax.' ),
|
328 |
+
)
|
329 |
+
),
|
330 |
+
'Ticket Information' => array(
|
331 |
+
'desc' => '',
|
332 |
+
'placeholders' => array(
|
333 |
+
'#_BOOKINGTICKETS' => array( 'desc' => 'Shows a breakdown of tickets and pricing, defined in the <code>emails/bookingtickets.php</code> template. (See <a href="http://wp-events-plugin.com/documentation/using-template-files/">Using Template Files</a> for more information)' ),
|
334 |
+
'#_BOOKINGTICKETDESCRIPTION' => array( 'desc' => 'Shows the description of the first ticket booked (useful in single ticket mode/events).' ),
|
335 |
+
'#_BOOKINGTICKETPRICE' => array( 'desc' => 'Shows the price of the first ticket booked, tax inclusion depending on your booking settings (useful in single ticket mode/events).' ),
|
336 |
+
'#_BOOKINGTICKETTAX' => array( 'desc' => 'Shows the tax of the first ticket booked (useful in single ticket mode/events).' ),
|
337 |
+
'#_BOOKINGTICKETPRICEWITHTAX' => array( 'desc' => 'Shows the price including tax of the first ticket booked (useful in single ticket mode/events).' ),
|
338 |
+
'#_BOOKINGTICKETPRICEWITHOUTTAX' => array( 'desc' => 'Shows the price excluding tax of the first ticket booked (useful in single ticket mode/events).' ),
|
339 |
+
)
|
340 |
+
),
|
341 |
+
'Links' => array(
|
342 |
+
'desc' => 'People are able to manage their bookings. Below are some placeholder which automatically provides correctly formatted urls',
|
343 |
+
'placeholders' => array(
|
344 |
+
'#_BOOKINGLISTURL' => array( 'desc' => 'URL to page showing that users booked events.' )
|
345 |
+
)
|
346 |
+
),
|
347 |
+
'Gateway-Specific Information' => array(
|
348 |
+
'desc' => 'Information pertaining to speicifc gateways. '. sprintf('Requires <a href="%s">Events Manager Pro</a>','http://wp-events-plugin.com/features/'),
|
349 |
+
'placeholders' => array(
|
350 |
+
'#_BOOKINGTXNID' => array( 'desc' => '<em>Online Payments Only</em> - Prints the transaction ID of this booking if available.' )
|
351 |
+
)
|
352 |
+
),
|
353 |
+
'Coupon Information' => array(
|
354 |
+
'desc' => 'When a booking has been made with a coupon, you can display coupon information using these placeholders. If no coupon is used, nothing will be shown. '.sprintf('Requires <a href="%s">Events Manager Pro</a>','http://wp-events-plugin.com/features/'),
|
355 |
+
'placeholders' => array(
|
356 |
+
'#_BOOKINGCOUPON' => array('desc' => 'Displays the coupon code followed by the amount/percentage discounted.'),
|
357 |
+
'#_BOOKINGCOUPONCODE' => array('desc' => 'Displays the coupon code used.'),
|
358 |
+
'#_BOOKINGCOUPONNAME' => array('desc' => 'Displays the name given to this coupon.'),
|
359 |
+
'#_BOOKINGCOUPONDISCOUNT' => array('desc' => 'Displays amount/percentage discounted (e.g. 25% Off).'),
|
360 |
+
'#_BOOKINGCOUPONDESCRIPTION' => array('desc' => 'Displays the coupon description.'),
|
361 |
+
)
|
362 |
+
),
|
363 |
+
),
|
364 |
+
),
|
365 |
+
//TODO add capabilites explanations
|
366 |
+
'capabilities' => array()
|
367 |
+
);
|
368 |
+
}
|
369 |
+
}
|
370 |
+
add_action('init', 'em_docs_init');
|
371 |
+
|
372 |
+
function em_docs_placeholders($atts){
|
373 |
+
ob_start();
|
374 |
+
?>
|
375 |
+
<div class="em-docs">
|
376 |
+
<?php
|
377 |
+
global $EM_Documentation;
|
378 |
+
$type = $atts['type'];
|
379 |
+
$data = $EM_Documentation['placeholders'][$type];
|
380 |
+
foreach($data as $sectionTitle => $details) : ?>
|
381 |
+
<div>
|
382 |
+
<h3><?php echo $sectionTitle; ?></h3>
|
383 |
+
<?php if( !empty($details['desc']) ): ?>
|
384 |
+
<p><?php echo $details['desc']; ?></p>
|
385 |
+
<?php endif; ?>
|
386 |
+
<dl>
|
387 |
+
<?php foreach($details['placeholders'] as $placeholder => $desc ): ?>
|
388 |
+
<dt><b><?php echo $placeholder; ?></b></dt>
|
389 |
+
<dd><?php echo $desc['desc']; ?></dd>
|
390 |
+
<?php endforeach; ?>
|
391 |
+
</dl>
|
392 |
+
</div>
|
393 |
+
<?php endforeach; ?>
|
394 |
+
</div>
|
395 |
+
<?php
|
396 |
+
return ob_get_clean();
|
397 |
+
}
|
398 |
?>
|
admin/em-help.php
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Display function for the support page. here we can give links to forums and special upgrade instructions e.g. migration features
|
4 |
-
*/
|
5 |
-
function em_admin_help_page(){
|
6 |
-
global $wpdb;
|
7 |
-
?>
|
8 |
-
<div class="wrap">
|
9 |
-
<div id="icon-events" class="icon32"><br /></div>
|
10 |
-
<h2><?php _e('Getting Help for Events Manager','dbem'); ?></h2>
|
11 |
-
<div class="em-docs">
|
12 |
-
<h2>Where To Get Help</h3>
|
13 |
-
<p>
|
14 |
-
This page is only a small portion of the event documentation which is here for quick reference. If you're just starting out, we recommend you visit the following places for further support:
|
15 |
-
</p>
|
16 |
-
<ol>
|
17 |
-
<li>New users are strongly encouraged to have a look at our <a href="http://wp-events-plugin.com/documentation/getting-started/">getting started page</a>.</li>
|
18 |
-
<li>Browse the other documentation pages and <a href="http://wp-events-plugin.com/tutorials/">tutorials</a>.</li>
|
19 |
-
<li>View the <a href="http://wp-events-plugin.com/documentation/faq/">FAQ</a> for general questions and <a href="http://wp-events-plugin.com/documentation/troubleshooting/">Troubleshooting</a> for common issues. These are regularly updated with recent issues.</li>
|
20 |
-
<li>Rather than trying to contact us directly, we request you use the <a href="http://wordpress.org/tags/events-manager?forum_id=10">support forums</a> as others may be experiencing the same issues as you. For faster support via private member forums and extra features please consider <a href="http://wp-events-plugin.com/events-manager-pro/">upgrading to pro</a>.</li>
|
21 |
-
</ol>
|
22 |
-
<p>
|
23 |
-
If you can't find what you're looking for in the documentation, you may find help on our <a href="http://wp-events-plugin.com/forums/">support forums</a>.
|
24 |
-
</p>
|
25 |
-
<h2><?php _e('Placeholders for customizing event pages','dbem'); ?></h2>
|
26 |
-
<p><?php echo sprintf( __("In the <a href='%s'>settings page</a>, you'll find various textboxes where you can edit how event information looks, such as for event and location lists. Using the placeholders below, you can choose what information should be displayed.",'dbem'), EM_ADMIN_URL .'&events-manager-options'); ?></p>
|
27 |
-
<a name="event-placeholders"></a>
|
28 |
-
<h3 style="margin-top:20px;"><?php _e('Event Related Placeholders','dbem'); ?></h3>
|
29 |
-
<?php echo em_docs_placeholders( array('type'=>'events') ); ?>
|
30 |
-
<a name="category-placeholders"></a>
|
31 |
-
<h3><?php _e('Category Related Placeholders','dbem'); ?></h3>
|
32 |
-
<?php echo em_docs_placeholders( array('type'=>'categories') ); ?>
|
33 |
-
<h3><?php _e('Tag Related Placeholders','dbem'); ?></h3>
|
34 |
-
<?php echo em_docs_placeholders( array('type'=>'tags') ); ?>
|
35 |
-
<a name="location-placeholders"></a>
|
36 |
-
<h3><?php _e('Location Related Placeholders','dbem'); ?></h3>
|
37 |
-
<?php echo em_docs_placeholders( array('type'=>'locations') ); ?>
|
38 |
-
<a name="booking-placeholders"></a>
|
39 |
-
<h3><?php _e('Booking Related Placeholders','dbem'); ?></h3>
|
40 |
-
<?php echo em_docs_placeholders( array('type'=>'bookings') ); ?>
|
41 |
-
</div>
|
42 |
-
<?php
|
43 |
-
|
44 |
-
//Is this a previously imported installation?
|
45 |
-
$old_table_name = $wpdb->prefix.'dbem_events';
|
46 |
-
if( $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") == $old_table_name ){
|
47 |
-
?>
|
48 |
-
<hr style="margin:30px 10px;" />
|
49 |
-
<div class="updated">
|
50 |
-
<h3>Troubleshooting upgrades from version 2.x to 3.x</h3>
|
51 |
-
<p>We notice that you upgraded from version 2, as we are now using new database tables, and we do not delete the old tables in case something went wrong with this upgrade.</p>
|
52 |
-
<p>If something went wrong with the update to version 3 read on:</p>
|
53 |
-
<h4>Scenario 1: the plugin is working, but for some reason the old events weren't imported</h4>
|
54 |
-
<p>You can safely reimport your old events from the previous tables without any risk of deleting them. However, if you click the link below <b>YOU WILL OVERWRITE ANY NEW EVENTS YOU CREATED IN VERSION 3</b></p>
|
55 |
-
<p><a onclick="return confirm('Are you sure you want to do this? Any new changes made since updating will be overwritten by your old ones, and this cannot be undone');" href="<?php echo wp_nonce_url( EM_ADMIN_URL .'&events-manager-help&em_reimport=1', 'em_reimport' ) ?>">Reimport Events from version 2</a></p>
|
56 |
-
<h4>Scenario 2: the plugin is not working, I want to go back to version 2!</h4>
|
57 |
-
<p>You can safely downgrade and will not lose any information.</p>
|
58 |
-
<ol>
|
59 |
-
<li>First of all, <a href='http://downloads.wordpress.org/plugin/events-manager.2.2.2.zip'>dowload a copy of version 2.2</a></li>
|
60 |
-
<li>Deactivate and delete Events Manager in the plugin page</li>
|
61 |
-
<li><a href="<?php bloginfo('wpurl'); ?>/wp-admin/plugin-install.php?tab=upload">Upload the zip file you just downloaded here</a></li>
|
62 |
-
<li>Let the developers know, of any bugs you ran into while upgrading. We'll help you out if there is a simple solution, and will fix reported bugs within days, if not quicker!</li>
|
63 |
-
</ol>
|
64 |
-
</div>
|
65 |
-
<?php
|
66 |
-
}
|
67 |
-
?>
|
68 |
-
</div>
|
69 |
-
<?php
|
70 |
-
}
|
71 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Display function for the support page. here we can give links to forums and special upgrade instructions e.g. migration features
|
4 |
+
*/
|
5 |
+
function em_admin_help_page(){
|
6 |
+
global $wpdb;
|
7 |
+
?>
|
8 |
+
<div class="wrap">
|
9 |
+
<div id="icon-events" class="icon32"><br /></div>
|
10 |
+
<h2><?php _e('Getting Help for Events Manager','dbem'); ?></h2>
|
11 |
+
<div class="em-docs">
|
12 |
+
<h2>Where To Get Help</h3>
|
13 |
+
<p>
|
14 |
+
This page is only a small portion of the event documentation which is here for quick reference. If you're just starting out, we recommend you visit the following places for further support:
|
15 |
+
</p>
|
16 |
+
<ol>
|
17 |
+
<li>New users are strongly encouraged to have a look at our <a href="http://wp-events-plugin.com/documentation/getting-started/">getting started page</a>.</li>
|
18 |
+
<li>Browse the other documentation pages and <a href="http://wp-events-plugin.com/tutorials/">tutorials</a>.</li>
|
19 |
+
<li>View the <a href="http://wp-events-plugin.com/documentation/faq/">FAQ</a> for general questions and <a href="http://wp-events-plugin.com/documentation/troubleshooting/">Troubleshooting</a> for common issues. These are regularly updated with recent issues.</li>
|
20 |
+
<li>Rather than trying to contact us directly, we request you use the <a href="http://wordpress.org/tags/events-manager?forum_id=10">support forums</a> as others may be experiencing the same issues as you. For faster support via private member forums and extra features please consider <a href="http://wp-events-plugin.com/events-manager-pro/">upgrading to pro</a>.</li>
|
21 |
+
</ol>
|
22 |
+
<p>
|
23 |
+
If you can't find what you're looking for in the documentation, you may find help on our <a href="http://wp-events-plugin.com/forums/">support forums</a>.
|
24 |
+
</p>
|
25 |
+
<h2><?php _e('Placeholders for customizing event pages','dbem'); ?></h2>
|
26 |
+
<p><?php echo sprintf( __("In the <a href='%s'>settings page</a>, you'll find various textboxes where you can edit how event information looks, such as for event and location lists. Using the placeholders below, you can choose what information should be displayed.",'dbem'), EM_ADMIN_URL .'&events-manager-options'); ?></p>
|
27 |
+
<a name="event-placeholders"></a>
|
28 |
+
<h3 style="margin-top:20px;"><?php _e('Event Related Placeholders','dbem'); ?></h3>
|
29 |
+
<?php echo em_docs_placeholders( array('type'=>'events') ); ?>
|
30 |
+
<a name="category-placeholders"></a>
|
31 |
+
<h3><?php _e('Category Related Placeholders','dbem'); ?></h3>
|
32 |
+
<?php echo em_docs_placeholders( array('type'=>'categories') ); ?>
|
33 |
+
<h3><?php _e('Tag Related Placeholders','dbem'); ?></h3>
|
34 |
+
<?php echo em_docs_placeholders( array('type'=>'tags') ); ?>
|
35 |
+
<a name="location-placeholders"></a>
|
36 |
+
<h3><?php _e('Location Related Placeholders','dbem'); ?></h3>
|
37 |
+
<?php echo em_docs_placeholders( array('type'=>'locations') ); ?>
|
38 |
+
<a name="booking-placeholders"></a>
|
39 |
+
<h3><?php _e('Booking Related Placeholders','dbem'); ?></h3>
|
40 |
+
<?php echo em_docs_placeholders( array('type'=>'bookings') ); ?>
|
41 |
+
</div>
|
42 |
+
<?php
|
43 |
+
|
44 |
+
//Is this a previously imported installation?
|
45 |
+
$old_table_name = $wpdb->prefix.'dbem_events';
|
46 |
+
if( $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") == $old_table_name ){
|
47 |
+
?>
|
48 |
+
<hr style="margin:30px 10px;" />
|
49 |
+
<div class="updated">
|
50 |
+
<h3>Troubleshooting upgrades from version 2.x to 3.x</h3>
|
51 |
+
<p>We notice that you upgraded from version 2, as we are now using new database tables, and we do not delete the old tables in case something went wrong with this upgrade.</p>
|
52 |
+
<p>If something went wrong with the update to version 3 read on:</p>
|
53 |
+
<h4>Scenario 1: the plugin is working, but for some reason the old events weren't imported</h4>
|
54 |
+
<p>You can safely reimport your old events from the previous tables without any risk of deleting them. However, if you click the link below <b>YOU WILL OVERWRITE ANY NEW EVENTS YOU CREATED IN VERSION 3</b></p>
|
55 |
+
<p><a onclick="return confirm('Are you sure you want to do this? Any new changes made since updating will be overwritten by your old ones, and this cannot be undone');" href="<?php echo wp_nonce_url( EM_ADMIN_URL .'&events-manager-help&em_reimport=1', 'em_reimport' ) ?>">Reimport Events from version 2</a></p>
|
56 |
+
<h4>Scenario 2: the plugin is not working, I want to go back to version 2!</h4>
|
57 |
+
<p>You can safely downgrade and will not lose any information.</p>
|
58 |
+
<ol>
|
59 |
+
<li>First of all, <a href='http://downloads.wordpress.org/plugin/events-manager.2.2.2.zip'>dowload a copy of version 2.2</a></li>
|
60 |
+
<li>Deactivate and delete Events Manager in the plugin page</li>
|
61 |
+
<li><a href="<?php bloginfo('wpurl'); ?>/wp-admin/plugin-install.php?tab=upload">Upload the zip file you just downloaded here</a></li>
|
62 |
+
<li>Let the developers know, of any bugs you ran into while upgrading. We'll help you out if there is a simple solution, and will fix reported bugs within days, if not quicker!</li>
|
63 |
+
</ol>
|
64 |
+
</div>
|
65 |
+
<?php
|
66 |
+
}
|
67 |
+
?>
|
68 |
+
</div>
|
69 |
+
<?php
|
70 |
+
}
|
71 |
?>
|
admin/em-ms-locations.php
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Looks at the request values, saves/updates and then displays the right menu in the admin
|
4 |
-
* @return null
|
5 |
-
*/
|
6 |
-
function em_admin_ms_locations() {
|
7 |
-
//TODO EM_Location is globalized, use it fully here
|
8 |
-
global $EM_Location;
|
9 |
-
//Take actions
|
10 |
-
if( !empty($_REQUEST['action']) && ($_REQUEST['action'] == "edit" || $_REQUEST['action'] == "location_save")) {
|
11 |
-
em_admin_location();
|
12 |
-
} else {
|
13 |
-
// no action, just a locations list
|
14 |
-
em_admin_locations();
|
15 |
-
}
|
16 |
-
}
|
17 |
-
|
18 |
-
function em_admin_locations($message='', $fill_fields = false) {
|
19 |
-
global $current_site;
|
20 |
-
?>
|
21 |
-
<div class='wrap'>
|
22 |
-
<div id='icon-edit' class='icon32'>
|
23 |
-
<br/>
|
24 |
-
</div>
|
25 |
-
<h2>
|
26 |
-
<?php _e('Locations', 'dbem'); ?>
|
27 |
-
</h2>
|
28 |
-
<?php em_locations_admin(array('url' => $_SERVER['REQUEST_URI'])); ?>
|
29 |
-
</div>
|
30 |
-
<?php
|
31 |
-
}
|
32 |
-
|
33 |
-
function em_admin_location($message = "") {
|
34 |
-
global $EM_Location;
|
35 |
-
if( empty($EM_Location) || !is_object($EM_Location) ){
|
36 |
-
$title = __('Add location', 'dbem');
|
37 |
-
$EM_Location = new EM_Location();
|
38 |
-
}else{
|
39 |
-
$title = __('Edit location', 'dbem');
|
40 |
-
}
|
41 |
-
?>
|
42 |
-
<div class='wrap'>
|
43 |
-
<div id='icon-edit' class='icon32'>
|
44 |
-
<br/>
|
45 |
-
</div>
|
46 |
-
<h2><?php echo $title ?></h2>
|
47 |
-
<?php em_location_form(); ?>
|
48 |
-
</div>
|
49 |
-
<?php
|
50 |
-
}
|
51 |
-
|
52 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Looks at the request values, saves/updates and then displays the right menu in the admin
|
4 |
+
* @return null
|
5 |
+
*/
|
6 |
+
function em_admin_ms_locations() {
|
7 |
+
//TODO EM_Location is globalized, use it fully here
|
8 |
+
global $EM_Location;
|
9 |
+
//Take actions
|
10 |
+
if( !empty($_REQUEST['action']) && ($_REQUEST['action'] == "edit" || $_REQUEST['action'] == "location_save")) {
|
11 |
+
em_admin_location();
|
12 |
+
} else {
|
13 |
+
// no action, just a locations list
|
14 |
+
em_admin_locations();
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
function em_admin_locations($message='', $fill_fields = false) {
|
19 |
+
global $current_site;
|
20 |
+
?>
|
21 |
+
<div class='wrap'>
|
22 |
+
<div id='icon-edit' class='icon32'>
|
23 |
+
<br/>
|
24 |
+
</div>
|
25 |
+
<h2>
|
26 |
+
<?php _e('Locations', 'dbem'); ?>
|
27 |
+
</h2>
|
28 |
+
<?php em_locations_admin(array('url' => $_SERVER['REQUEST_URI'])); ?>
|
29 |
+
</div>
|
30 |
+
<?php
|
31 |
+
}
|
32 |
+
|
33 |
+
function em_admin_location($message = "") {
|
34 |
+
global $EM_Location;
|
35 |
+
if( empty($EM_Location) || !is_object($EM_Location) ){
|
36 |
+
$title = __('Add location', 'dbem');
|
37 |
+
$EM_Location = new EM_Location();
|
38 |
+
}else{
|
39 |
+
$title = __('Edit location', 'dbem');
|
40 |
+
}
|
41 |
+
?>
|
42 |
+
<div class='wrap'>
|
43 |
+
<div id='icon-edit' class='icon32'>
|
44 |
+
<br/>
|
45 |
+
</div>
|
46 |
+
<h2><?php echo $title ?></h2>
|
47 |
+
<?php em_location_form(); ?>
|
48 |
+
</div>
|
49 |
+
<?php
|
50 |
+
}
|
51 |
+
|
52 |
?>
|
admin/em-ms-options.php
CHANGED
@@ -1,205 +1,205 @@
|
|
1 |
-
<?php
|
2 |
-
function em_ms_upgrade( $blog_id ){
|
3 |
-
?>
|
4 |
-
<div class="wrap">
|
5 |
-
<div id='icon-options-general' class='icon32'><br /></div>
|
6 |
-
<h2><?php esc_html_e('Update Network','dbem'); ?></h2>
|
7 |
-
<?php
|
8 |
-
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'upgrade' && check_admin_referer('em_ms_ugrade_'.get_current_user_id()) ){
|
9 |
-
global $current_site,$wpdb;
|
10 |
-
$blog_ids = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs.' WHERE site_id='.$current_site->id);
|
11 |
-
foreach($blog_ids as $blog_id){
|
12 |
-
$plugin_basename = plugin_basename(dirname(dirname(__FILE__)).'/events-manager.php');
|
13 |
-
if( in_array( $plugin_basename, (array) get_blog_option($blog_id, 'active_plugins', array() ) ) || is_plugin_active_for_network($plugin_basename) ){
|
14 |
-
if( EM_VERSION > get_blog_option($blog_id, 'dbem_version', 0) ){
|
15 |
-
switch_to_blog($blog_id);
|
16 |
-
require_once( dirname(__FILE__).'/../em-install.php');
|
17 |
-
em_install();
|
18 |
-
echo "<p>Upgraded - ".get_bloginfo('blogname')."</p>";
|
19 |
-
restore_current_blog();
|
20 |
-
}else{
|
21 |
-
echo "<p>"".get_blog_option($blog_id, 'blogname')."" is up to date.</p>";
|
22 |
-
}
|
23 |
-
}else{
|
24 |
-
echo "<p>"".get_blog_option($blog_id, 'blogname')."" does not have Events Manager activated.</p>";
|
25 |
-
}
|
26 |
-
}
|
27 |
-
echo "<p>Done Upgrading</p>";
|
28 |
-
}else{
|
29 |
-
?>
|
30 |
-
<form action="" method="post">
|
31 |
-
<p><?php esc_html_e('To update your network blogs with the latest Events Manager automatically, click the update button below.','dbem'); ?></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','dbem'); ?>" />
|
35 |
-
</form>
|
36 |
-
<?php
|
37 |
-
}
|
38 |
-
?>
|
39 |
-
</div>
|
40 |
-
<?php
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Displays network-related options in the network admin section
|
45 |
-
* @uses em_options_save() to save settings
|
46 |
-
*/
|
47 |
-
function em_ms_admin_options_page() {
|
48 |
-
global $wpdb,$EM_Notices;
|
49 |
-
//Check for uninstall/reset request
|
50 |
-
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' ){
|
51 |
-
em_admin_options_uninstall_page();
|
52 |
-
return;
|
53 |
-
}
|
54 |
-
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ){
|
55 |
-
em_admin_options_reset_page();
|
56 |
-
return;
|
57 |
-
}
|
58 |
-
//TODO place all options into an array
|
59 |
-
$events_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#event-placeholders">'. __('Event Related Placeholders','dbem') .'</a>';
|
60 |
-
$locations_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#location-placeholders">'. __('Location Related Placeholders','dbem') .'</a>';
|
61 |
-
$bookings_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#booking-placeholders">'. __('Booking Related Placeholders','dbem') .'</a>';
|
62 |
-
$categories_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#category-placeholders">'. __('Category Related Placeholders','dbem') .'</a>';
|
63 |
-
$events_placeholder_tip = " ". sprintf(__('This accepts %s and %s placeholders.','dbem'),$events_placeholders, $locations_placeholders);
|
64 |
-
$locations_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','dbem'), $locations_placeholders);
|
65 |
-
$categories_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','dbem'), $categories_placeholders);
|
66 |
-
$bookings_placeholder_tip = " ". sprintf(__('This accepts %s, %s and %s placeholders.','dbem'), $bookings_placeholders, $events_placeholders, $locations_placeholders);
|
67 |
-
|
68 |
-
global $save_button;
|
69 |
-
$save_button = '<tr><th> </th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" id="dbem_options_submit" name="Submit" value="'. __( 'Save Changes', 'dbem') .' ('. __('All','dbem') .')" /></p></ts></td></tr>';
|
70 |
-
//Do some multisite checking here for reuse
|
71 |
-
?>
|
72 |
-
<script type="text/javascript" charset="utf-8"><?php include(EM_DIR.'/includes/js/admin-settings.js'); ?></script>
|
73 |
-
<script type="text/javascript" charset="utf-8">
|
74 |
-
jQuery(document).ready(function($){
|
75 |
-
//events
|
76 |
-
$('input[name="dbem_ms_global_events"]').change(function(){
|
77 |
-
if( $('input:radio[name="dbem_ms_global_events"]:checked').val() == 1 ){
|
78 |
-
$("tr#dbem_ms_global_events_links_row").show();
|
79 |
-
$('input:radio[name="dbem_ms_global_events_links"]:checked').trigger('change');
|
80 |
-
}else{
|
81 |
-
$("tr#dbem_ms_global_events_links_row, tr#dbem_ms_events_slug_row").hide();
|
82 |
-
}
|
83 |
-
}).first().trigger('change');
|
84 |
-
$('input[name="dbem_ms_global_events_links"]').change(function(){
|
85 |
-
if( $('input:radio[name="dbem_ms_global_events_links"]:checked').val() == 1 ){
|
86 |
-
$("tr#dbem_ms_events_slug_row").hide();
|
87 |
-
}else{
|
88 |
-
$("tr#dbem_ms_events_slug_row").show();
|
89 |
-
}
|
90 |
-
}).first().trigger('change');
|
91 |
-
//locations
|
92 |
-
$('input[name="dbem_ms_mainblog_locations"]').change(function(){
|
93 |
-
if( $('input:radio[name="dbem_ms_mainblog_locations"]:checked').val() == 1 ){
|
94 |
-
$("tbody.em-global-locations").hide();
|
95 |
-
}else{
|
96 |
-
$("tbody.em-global-locations").show();
|
97 |
-
}
|
98 |
-
}).first().trigger('change');
|
99 |
-
$('input[name="dbem_ms_global_locations"]').change(function(){
|
100 |
-
if( $('input:radio[name="dbem_ms_global_locations"]:checked').val() == 1 ){
|
101 |
-
$("tr#dbem_ms_global_locations_links_row").show();
|
102 |
-
$('input:radio[name="dbem_ms_global_locations_links"]:checked').trigger('change');
|
103 |
-
}else{
|
104 |
-
$("tr#dbem_ms_global_locations_links_row, tr#dbem_ms_locations_slug_row").hide();
|
105 |
-
}
|
106 |
-
}).first().trigger('change');
|
107 |
-
$('input[name="dbem_ms_global_locations_links"]').change(function(){
|
108 |
-
if( $('input:radio[name="dbem_ms_global_locations_links"]:checked').val() == 1 ){
|
109 |
-
$("tr#dbem_ms_locations_slug_row").hide();
|
110 |
-
}else{
|
111 |
-
$("tr#dbem_ms_locations_slug_row").show();
|
112 |
-
}
|
113 |
-
});
|
114 |
-
//MS Mode selection hiders
|
115 |
-
$('input[name="dbem_ms_global_table"]').change(function(){ //global
|
116 |
-
if( $('input:radio[name="dbem_ms_global_table"]:checked').val() == 1 ){
|
117 |
-
$("tbody.em-global-options").show();
|
118 |
-
$('input:radio[name="dbem_ms_mainblog_locations"]:checked').trigger('change');
|
119 |
-
}else{
|
120 |
-
$("tbody.em-global-options").hide();
|
121 |
-
}
|
122 |
-
}).first().trigger('change');
|
123 |
-
});
|
124 |
-
</script>
|
125 |
-
<style type="text/css">.postbox h3 { cursor:pointer; }</style>
|
126 |
-
<div class="wrap">
|
127 |
-
<div id='icon-options-general' class='icon32'><br /></div>
|
128 |
-
<h2 class="nav-tab-wrapper">
|
129 |
-
<a href="#" id="em-menu-general" class="nav-tab nav-tab-active"><?php esc_html_e('General','dbem'); ?></a>
|
130 |
-
</h2>
|
131 |
-
<h3 id="em-options-title"><?php _e ( 'Event Manager Options', 'dbem' ); ?></h3>
|
132 |
-
<?php echo $EM_Notices; ?>
|
133 |
-
<form id="em-options-form" method="post" action="">
|
134 |
-
<div class="metabox-holder">
|
135 |
-
<!-- // TODO Move style in css -->
|
136 |
-
<div class='postbox-container' style='width: 99.5%'>
|
137 |
-
<div id="">
|
138 |
-
|
139 |
-
<div class="em-menu-general em-menu-group">
|
140 |
-
<div class="postbox " id="em-opt-ms-options" >
|
141 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Multi Site Options', 'dbem' ); ?></span></h3>
|
142 |
-
<div class="inside">
|
143 |
-
<table class="form-table">
|
144 |
-
<?php
|
145 |
-
em_options_radio_binary ( __( 'Enable global tables mode?', 'dbem'), 'dbem_ms_global_table', __( 'Setting this to yes will make all events save in the main site event tables (EM must also be activated). This allows you to share events across different blogs, such as showing events in your network whilst allowing users to display and manage their events within their own blog. Bear in mind that activating this will mean old events created on the sub-blogs will not be accessible anymore, and if you switch back they will be but new events created during global events mode will only remain on the main site.','dbem' ) );
|
146 |
-
?>
|
147 |
-
<tbody class="em-global-options">
|
148 |
-
<?php
|
149 |
-
global $current_site;
|
150 |
-
$global_slug_tip = __('%s belonging to other sub-sites will have an extra slug preppended to it so that your main site can differentiate between its own %s and those belonging to other sites in your network.','dbem');
|
151 |
-
$global_link_tip = __( 'When displaying global %s on the main site you have the option of users viewing the %s details on the main site or being directed to the sub-site.','dbem' );
|
152 |
-
$global_post_tip = __( 'Displays %s from all sites on the network by default. You can still restrict %s by blog using shortcodes and template tags coupled with the <code>blog</code> attribute. Requires global tables to be turned on.','dbem');
|
153 |
-
$global_link_tip2 = __('You <strong>must</strong> have assigned a %s page in your <a href="%s">main blog settings</a> for this to work.','dbem');
|
154 |
-
$options_page_link = get_admin_url($current_site->blog_id, 'edit.php?post_type=event&page=events-manager-options#pages');
|
155 |
-
?><tr class="em-header"><td><h4><?php echo sprintf(__('%s Options','dbem'),__('Event','dbem')); ?></h4></td></tr><?php
|
156 |
-
em_options_radio_binary ( sprintf(__( 'Display global events on main blog?', 'dbem'), __('events','dbem')), 'dbem_ms_global_events', sprintf($global_post_tip, __('events','dbem'), __('events','dbem')) );
|
157 |
-
em_options_radio_binary ( sprintf(__( 'Link sub-site %s directly to sub-site?', 'dbem'), __('events','dbem')), 'dbem_ms_global_events_links', sprintf($global_link_tip, __('events','dbem'), __('event','dbem')).sprintf($global_link_tip2, __('event','dbem'), $options_page_link) );
|
158 |
-
em_options_input_text ( sprintf(__( 'Global %s slug', 'dbem' ),__('event','dbem')), 'dbem_ms_events_slug', sprintf($global_slug_tip, __('Events','dbem'), __('events','dbem')).__('Example:','dbem').'<code>http://yoursite.com/events/<strong>event</strong>/subsite-event-slug/', EM_EVENT_SLUG );
|
159 |
-
?><tr class="em-header"><td><h4><?php echo sprintf(__('%s Options','dbem'),__('Location','dbem')); ?></h4></td></tr><?php
|
160 |
-
em_options_radio_binary ( sprintf(__( 'Locations on main blog?', 'dbem'), __('locations','dbem')), 'dbem_ms_mainblog_locations', __('If you would prefer all your locations to belong to your main blog, users in sub-sites will still be able to create locations, but the actual locations are created and reside in the main blog.','dbem') );
|
161 |
-
?>
|
162 |
-
</tbody>
|
163 |
-
<tbody class="em-global-options em-global-locations">
|
164 |
-
<?php
|
165 |
-
em_options_radio_binary ( sprintf(__( 'Display global %s on main blog?', 'dbem'), __('locations','dbem')), 'dbem_ms_global_locations', sprintf($global_post_tip, __('locations','dbem'), __('locations','dbem')) );
|
166 |
-
em_options_radio_binary ( sprintf(__( 'Link sub-site %s directly to sub-site?', 'dbem'), __('locations','dbem')), 'dbem_ms_global_locations_links', sprintf($global_link_tip, __('locations','dbem'), __('location','dbem')).sprintf($global_link_tip2, __('location','dbem'), $options_page_link) );
|
167 |
-
em_options_input_text ( sprintf(__( 'Global %s slug', 'dbem' ),__('location','dbem')), 'dbem_ms_locations_slug', sprintf($global_slug_tip, __('Locations','dbem'), __('locations','dbem')).__('Example:','dbem').'<code>http://yoursite.com/locations/<strong>location</strong>/subsite-location-slug/', EM_LOCATION_SLUG );
|
168 |
-
?>
|
169 |
-
</tbody>
|
170 |
-
<?php echo $save_button; ?>
|
171 |
-
</table>
|
172 |
-
|
173 |
-
</div> <!-- . inside -->
|
174 |
-
</div> <!-- .postbox -->
|
175 |
-
|
176 |
-
<?php
|
177 |
-
//including shared MS/non-MS boxes
|
178 |
-
em_admin_option_box_caps();
|
179 |
-
em_admin_option_box_image_sizes();
|
180 |
-
em_admin_option_box_email();
|
181 |
-
em_admin_option_box_uninstall();
|
182 |
-
?>
|
183 |
-
|
184 |
-
<?php do_action('em_ms_options_page_footer'); ?>
|
185 |
-
</div> <!-- .em-menu-general -->
|
186 |
-
|
187 |
-
<div class="em-menu-pages em-menu-group" style="display:none;">
|
188 |
-
|
189 |
-
</div> <!-- .em-menu-pages -->
|
190 |
-
|
191 |
-
<p class="submit">
|
192 |
-
<input type="submit" id="dbem_options_submit" name="Submit" value="<?php esc_attr_e( 'Save Changes' )?>" />
|
193 |
-
<input type="hidden" name="em-submitted" value="1" />
|
194 |
-
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('events-manager-options'); ?>" />
|
195 |
-
</p>
|
196 |
-
|
197 |
-
</div> <!-- .metabox-sortables -->
|
198 |
-
</div> <!-- .postbox-container -->
|
199 |
-
|
200 |
-
</div> <!-- .metabox-holder -->
|
201 |
-
</form>
|
202 |
-
</div>
|
203 |
-
<?php
|
204 |
-
}
|
205 |
?>
|
1 |
+
<?php
|
2 |
+
function em_ms_upgrade( $blog_id ){
|
3 |
+
?>
|
4 |
+
<div class="wrap">
|
5 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
6 |
+
<h2><?php esc_html_e('Update Network','dbem'); ?></h2>
|
7 |
+
<?php
|
8 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'upgrade' && check_admin_referer('em_ms_ugrade_'.get_current_user_id()) ){
|
9 |
+
global $current_site,$wpdb;
|
10 |
+
$blog_ids = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs.' WHERE site_id='.$current_site->id);
|
11 |
+
foreach($blog_ids as $blog_id){
|
12 |
+
$plugin_basename = plugin_basename(dirname(dirname(__FILE__)).'/events-manager.php');
|
13 |
+
if( in_array( $plugin_basename, (array) get_blog_option($blog_id, 'active_plugins', array() ) ) || is_plugin_active_for_network($plugin_basename) ){
|
14 |
+
if( EM_VERSION > get_blog_option($blog_id, 'dbem_version', 0) ){
|
15 |
+
switch_to_blog($blog_id);
|
16 |
+
require_once( dirname(__FILE__).'/../em-install.php');
|
17 |
+
em_install();
|
18 |
+
echo "<p>Upgraded - ".get_bloginfo('blogname')."</p>";
|
19 |
+
restore_current_blog();
|
20 |
+
}else{
|
21 |
+
echo "<p>"".get_blog_option($blog_id, 'blogname')."" is up to date.</p>";
|
22 |
+
}
|
23 |
+
}else{
|
24 |
+
echo "<p>"".get_blog_option($blog_id, 'blogname')."" does not have Events Manager activated.</p>";
|
25 |
+
}
|
26 |
+
}
|
27 |
+
echo "<p>Done Upgrading</p>";
|
28 |
+
}else{
|
29 |
+
?>
|
30 |
+
<form action="" method="post">
|
31 |
+
<p><?php esc_html_e('To update your network blogs with the latest Events Manager automatically, click the update button below.','dbem'); ?></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','dbem'); ?>" />
|
35 |
+
</form>
|
36 |
+
<?php
|
37 |
+
}
|
38 |
+
?>
|
39 |
+
</div>
|
40 |
+
<?php
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Displays network-related options in the network admin section
|
45 |
+
* @uses em_options_save() to save settings
|
46 |
+
*/
|
47 |
+
function em_ms_admin_options_page() {
|
48 |
+
global $wpdb,$EM_Notices;
|
49 |
+
//Check for uninstall/reset request
|
50 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' ){
|
51 |
+
em_admin_options_uninstall_page();
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ){
|
55 |
+
em_admin_options_reset_page();
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
//TODO place all options into an array
|
59 |
+
$events_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#event-placeholders">'. __('Event Related Placeholders','dbem') .'</a>';
|
60 |
+
$locations_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#location-placeholders">'. __('Location Related Placeholders','dbem') .'</a>';
|
61 |
+
$bookings_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#booking-placeholders">'. __('Booking Related Placeholders','dbem') .'</a>';
|
62 |
+
$categories_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#category-placeholders">'. __('Category Related Placeholders','dbem') .'</a>';
|
63 |
+
$events_placeholder_tip = " ". sprintf(__('This accepts %s and %s placeholders.','dbem'),$events_placeholders, $locations_placeholders);
|
64 |
+
$locations_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','dbem'), $locations_placeholders);
|
65 |
+
$categories_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','dbem'), $categories_placeholders);
|
66 |
+
$bookings_placeholder_tip = " ". sprintf(__('This accepts %s, %s and %s placeholders.','dbem'), $bookings_placeholders, $events_placeholders, $locations_placeholders);
|
67 |
+
|
68 |
+
global $save_button;
|
69 |
+
$save_button = '<tr><th> </th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" id="dbem_options_submit" name="Submit" value="'. __( 'Save Changes', 'dbem') .' ('. __('All','dbem') .')" /></p></ts></td></tr>';
|
70 |
+
//Do some multisite checking here for reuse
|
71 |
+
?>
|
72 |
+
<script type="text/javascript" charset="utf-8"><?php include(EM_DIR.'/includes/js/admin-settings.js'); ?></script>
|
73 |
+
<script type="text/javascript" charset="utf-8">
|
74 |
+
jQuery(document).ready(function($){
|
75 |
+
//events
|
76 |
+
$('input[name="dbem_ms_global_events"]').change(function(){
|
77 |
+
if( $('input:radio[name="dbem_ms_global_events"]:checked').val() == 1 ){
|
78 |
+
$("tr#dbem_ms_global_events_links_row").show();
|
79 |
+
$('input:radio[name="dbem_ms_global_events_links"]:checked').trigger('change');
|
80 |
+
}else{
|
81 |
+
$("tr#dbem_ms_global_events_links_row, tr#dbem_ms_events_slug_row").hide();
|
82 |
+
}
|
83 |
+
}).first().trigger('change');
|
84 |
+
$('input[name="dbem_ms_global_events_links"]').change(function(){
|
85 |
+
if( $('input:radio[name="dbem_ms_global_events_links"]:checked').val() == 1 ){
|
86 |
+
$("tr#dbem_ms_events_slug_row").hide();
|
87 |
+
}else{
|
88 |
+
$("tr#dbem_ms_events_slug_row").show();
|
89 |
+
}
|
90 |
+
}).first().trigger('change');
|
91 |
+
//locations
|
92 |
+
$('input[name="dbem_ms_mainblog_locations"]').change(function(){
|
93 |
+
if( $('input:radio[name="dbem_ms_mainblog_locations"]:checked').val() == 1 ){
|
94 |
+
$("tbody.em-global-locations").hide();
|
95 |
+
}else{
|
96 |
+
$("tbody.em-global-locations").show();
|
97 |
+
}
|
98 |
+
}).first().trigger('change');
|
99 |
+
$('input[name="dbem_ms_global_locations"]').change(function(){
|
100 |
+
if( $('input:radio[name="dbem_ms_global_locations"]:checked').val() == 1 ){
|
101 |
+
$("tr#dbem_ms_global_locations_links_row").show();
|
102 |
+
$('input:radio[name="dbem_ms_global_locations_links"]:checked').trigger('change');
|
103 |
+
}else{
|
104 |
+
$("tr#dbem_ms_global_locations_links_row, tr#dbem_ms_locations_slug_row").hide();
|
105 |
+
}
|
106 |
+
}).first().trigger('change');
|
107 |
+
$('input[name="dbem_ms_global_locations_links"]').change(function(){
|
108 |
+
if( $('input:radio[name="dbem_ms_global_locations_links"]:checked').val() == 1 ){
|
109 |
+
$("tr#dbem_ms_locations_slug_row").hide();
|
110 |
+
}else{
|
111 |
+
$("tr#dbem_ms_locations_slug_row").show();
|
112 |
+
}
|
113 |
+
});
|
114 |
+
//MS Mode selection hiders
|
115 |
+
$('input[name="dbem_ms_global_table"]').change(function(){ //global
|
116 |
+
if( $('input:radio[name="dbem_ms_global_table"]:checked').val() == 1 ){
|
117 |
+
$("tbody.em-global-options").show();
|
118 |
+
$('input:radio[name="dbem_ms_mainblog_locations"]:checked').trigger('change');
|
119 |
+
}else{
|
120 |
+
$("tbody.em-global-options").hide();
|
121 |
+
}
|
122 |
+
}).first().trigger('change');
|
123 |
+
});
|
124 |
+
</script>
|
125 |
+
<style type="text/css">.postbox h3 { cursor:pointer; }</style>
|
126 |
+
<div class="wrap">
|
127 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
128 |
+
<h2 class="nav-tab-wrapper">
|
129 |
+
<a href="#" id="em-menu-general" class="nav-tab nav-tab-active"><?php esc_html_e('General','dbem'); ?></a>
|
130 |
+
</h2>
|
131 |
+
<h3 id="em-options-title"><?php _e ( 'Event Manager Options', 'dbem' ); ?></h3>
|
132 |
+
<?php echo $EM_Notices; ?>
|
133 |
+
<form id="em-options-form" method="post" action="">
|
134 |
+
<div class="metabox-holder">
|
135 |
+
<!-- // TODO Move style in css -->
|
136 |
+
<div class='postbox-container' style='width: 99.5%'>
|
137 |
+
<div id="">
|
138 |
+
|
139 |
+
<div class="em-menu-general em-menu-group">
|
140 |
+
<div class="postbox " id="em-opt-ms-options" >
|
141 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Multi Site Options', 'dbem' ); ?></span></h3>
|
142 |
+
<div class="inside">
|
143 |
+
<table class="form-table">
|
144 |
+
<?php
|
145 |
+
em_options_radio_binary ( __( 'Enable global tables mode?', 'dbem'), 'dbem_ms_global_table', __( 'Setting this to yes will make all events save in the main site event tables (EM must also be activated). This allows you to share events across different blogs, such as showing events in your network whilst allowing users to display and manage their events within their own blog. Bear in mind that activating this will mean old events created on the sub-blogs will not be accessible anymore, and if you switch back they will be but new events created during global events mode will only remain on the main site.','dbem' ) );
|
146 |
+
?>
|
147 |
+
<tbody class="em-global-options">
|
148 |
+
<?php
|
149 |
+
global $current_site;
|
150 |
+
$global_slug_tip = __('%s belonging to other sub-sites will have an extra slug preppended to it so that your main site can differentiate between its own %s and those belonging to other sites in your network.','dbem');
|
151 |
+
$global_link_tip = __( 'When displaying global %s on the main site you have the option of users viewing the %s details on the main site or being directed to the sub-site.','dbem' );
|
152 |
+
$global_post_tip = __( 'Displays %s from all sites on the network by default. You can still restrict %s by blog using shortcodes and template tags coupled with the <code>blog</code> attribute. Requires global tables to be turned on.','dbem');
|
153 |
+
$global_link_tip2 = __('You <strong>must</strong> have assigned a %s page in your <a href="%s">main blog settings</a> for this to work.','dbem');
|
154 |
+
$options_page_link = get_admin_url($current_site->blog_id, 'edit.php?post_type=event&page=events-manager-options#pages');
|
155 |
+
?><tr class="em-header"><td><h4><?php echo sprintf(__('%s Options','dbem'),__('Event','dbem')); ?></h4></td></tr><?php
|
156 |
+
em_options_radio_binary ( sprintf(__( 'Display global events on main blog?', 'dbem'), __('events','dbem')), 'dbem_ms_global_events', sprintf($global_post_tip, __('events','dbem'), __('events','dbem')) );
|
157 |
+
em_options_radio_binary ( sprintf(__( 'Link sub-site %s directly to sub-site?', 'dbem'), __('events','dbem')), 'dbem_ms_global_events_links', sprintf($global_link_tip, __('events','dbem'), __('event','dbem')).sprintf($global_link_tip2, __('event','dbem'), $options_page_link) );
|
158 |
+
em_options_input_text ( sprintf(__( 'Global %s slug', 'dbem' ),__('event','dbem')), 'dbem_ms_events_slug', sprintf($global_slug_tip, __('Events','dbem'), __('events','dbem')).__('Example:','dbem').'<code>http://yoursite.com/events/<strong>event</strong>/subsite-event-slug/', EM_EVENT_SLUG );
|
159 |
+
?><tr class="em-header"><td><h4><?php echo sprintf(__('%s Options','dbem'),__('Location','dbem')); ?></h4></td></tr><?php
|
160 |
+
em_options_radio_binary ( sprintf(__( 'Locations on main blog?', 'dbem'), __('locations','dbem')), 'dbem_ms_mainblog_locations', __('If you would prefer all your locations to belong to your main blog, users in sub-sites will still be able to create locations, but the actual locations are created and reside in the main blog.','dbem') );
|
161 |
+
?>
|
162 |
+
</tbody>
|
163 |
+
<tbody class="em-global-options em-global-locations">
|
164 |
+
<?php
|
165 |
+
em_options_radio_binary ( sprintf(__( 'Display global %s on main blog?', 'dbem'), __('locations','dbem')), 'dbem_ms_global_locations', sprintf($global_post_tip, __('locations','dbem'), __('locations','dbem')) );
|
166 |
+
em_options_radio_binary ( sprintf(__( 'Link sub-site %s directly to sub-site?', 'dbem'), __('locations','dbem')), 'dbem_ms_global_locations_links', sprintf($global_link_tip, __('locations','dbem'), __('location','dbem')).sprintf($global_link_tip2, __('location','dbem'), $options_page_link) );
|
167 |
+
em_options_input_text ( sprintf(__( 'Global %s slug', 'dbem' ),__('location','dbem')), 'dbem_ms_locations_slug', sprintf($global_slug_tip, __('Locations','dbem'), __('locations','dbem')).__('Example:','dbem').'<code>http://yoursite.com/locations/<strong>location</strong>/subsite-location-slug/', EM_LOCATION_SLUG );
|
168 |
+
?>
|
169 |
+
</tbody>
|
170 |
+
<?php echo $save_button; ?>
|
171 |
+
</table>
|
172 |
+
|
173 |
+
</div> <!-- . inside -->
|
174 |
+
</div> <!-- .postbox -->
|
175 |
+
|
176 |
+
<?php
|
177 |
+
//including shared MS/non-MS boxes
|
178 |
+
em_admin_option_box_caps();
|
179 |
+
em_admin_option_box_image_sizes();
|
180 |
+
em_admin_option_box_email();
|
181 |
+
em_admin_option_box_uninstall();
|
182 |
+
?>
|
183 |
+
|
184 |
+
<?php do_action('em_ms_options_page_footer'); ?>
|
185 |
+
</div> <!-- .em-menu-general -->
|
186 |
+
|
187 |
+
<div class="em-menu-pages em-menu-group" style="display:none;">
|
188 |
+
|
189 |
+
</div> <!-- .em-menu-pages -->
|
190 |
+
|
191 |
+
<p class="submit">
|
192 |
+
<input type="submit" id="dbem_options_submit" name="Submit" value="<?php esc_attr_e( 'Save Changes' )?>" />
|
193 |
+
<input type="hidden" name="em-submitted" value="1" />
|
194 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('events-manager-options'); ?>" />
|
195 |
+
</p>
|
196 |
+
|
197 |
+
</div> <!-- .metabox-sortables -->
|
198 |
+
</div> <!-- .postbox-container -->
|
199 |
+
|
200 |
+
</div> <!-- .metabox-holder -->
|
201 |
+
</form>
|
202 |
+
</div>
|
203 |
+
<?php
|
204 |
+
}
|
205 |
?>
|
admin/em-options.php
CHANGED
@@ -1,2281 +1,610 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
//Function composing the options subpanel
|
4 |
-
function em_options_save(){
|
5 |
-
global $EM_Notices;
|
6 |
-
/*
|
7 |
-
* Here's the idea, we have an array of all options that need super admin approval if in multi-site mode
|
8 |
-
* since options are only updated here, its one place fit all
|
9 |
-
*/
|
10 |
-
if( current_user_can('list_users') && !empty($_POST['em-submitted']) && check_admin_referer('events-manager-options','_wpnonce') ){
|
11 |
-
//Build the array of options here
|
12 |
-
$post = $_POST;
|
13 |
-
foreach ($_POST as $postKey => $postValue){
|
14 |
-
if( substr($postKey, 0, 5) == 'dbem_' ){
|
15 |
-
//TODO some more validation/reporting
|
16 |
-
$numeric_options = array('dbem_locations_default_limit','dbem_events_default_limit');
|
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 seperated 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}?$/i",$postValue)){
|
21 |
-
$EM_Notices->add_error( sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'dbem'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>').' '. esc_html__('This setting was not changed.', 'dbem'), true);
|
22 |
-
}else{
|
23 |
-
//TODO slashes being added?
|
24 |
-
if( is_array($postValue) ){
|
25 |
-
foreach($postValue as $postValue_key=>$postValue_val) $postValue[$postValue_key] = stripslashes($postValue_val);
|
26 |
-
}else{
|
27 |
-
$postValue = stripslashes($postValue);
|
28 |
-
}
|
29 |
-
update_option($postKey, $postValue);
|
30 |
-
}
|
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
|
38 |
-
global $current_site,$wpdb;
|
39 |
-
$blog_ids = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs.' WHERE site_id='.$current_site->id);
|
40 |
-
foreach($blog_ids as $blog_id){
|
41 |
-
switch_to_blog($blog_id);
|
42 |
-
//normal blog role application
|
43 |
-
foreach( $wp_roles->role_objects as $role_name => $role ){
|
44 |
-
foreach( array_keys($em_capabilities_array) as $capability){
|
45 |
-
if( !empty($_POST['em_capabilities'][$role_name][$capability]) ){
|
46 |
-
$role->add_cap($capability);
|
47 |
-
}else{
|
48 |
-
$role->remove_cap($capability);
|
49 |
-
}
|
50 |
-
}
|
51 |
-
}
|
52 |
-
restore_current_blog();
|
53 |
-
}
|
54 |
-
}elseif( !is_network_admin() ){
|
55 |
-
//normal blog role application
|
56 |
-
foreach( $wp_roles->role_objects as $role_name => $role ){
|
57 |
-
foreach( array_keys($em_capabilities_array) as $capability){
|
58 |
-
if( !empty($_POST['em_capabilities'][$role_name][$capability]) ){
|
59 |
-
$role->add_cap($capability);
|
60 |
-
}else{
|
61 |
-
$role->remove_cap($capability);
|
62 |
-
}
|
63 |
-
}
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
update_option('dbem_flush_needed',1);
|
68 |
-
do_action('em_options_save');
|
69 |
-
$EM_Notices->add_confirm('<strong>'.__('Changes saved.', 'dbem').'</strong>', true);
|
70 |
-
wp_redirect(wp_get_referer());
|
71 |
-
exit();
|
72 |
-
}
|
73 |
-
//Migration
|
74 |
-
if( !empty($_GET['em_migrate_images']) && check_admin_referer('em_migrate_images','_wpnonce') && get_option('dbem_migrate_images') ){
|
75 |
-
include(plugin_dir_path(__FILE__).'../em-install.php');
|
76 |
-
$result = em_migrate_uploads();
|
77 |
-
if($result){
|
78 |
-
$failed = ( $result['fail'] > 0 ) ? $result['fail'] . ' images failed to migrate.' : '';
|
79 |
-
$EM_Notices->add_confirm('<strong>'.$result['success'].' images migrated successfully. '.$failed.'</strong>');
|
80 |
-
}
|
81 |
-
wp_redirect(admin_url().'edit.php?post_type=event&page=events-manager-options&em_migrate_images');
|
82 |
-
}elseif( !empty($_GET['em_not_migrate_images']) && check_admin_referer('em_not_migrate_images','_wpnonce') ){
|
83 |
-
delete_option('dbem_migrate_images_nag');
|
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;
|
91 |
-
//delete EM posts
|
92 |
-
remove_action('before_delete_post',array('EM_Location_Post_Admin','before_delete_post'),10,1);
|
93 |
-
remove_action('before_delete_post',array('EM_Event_Post_Admin','before_delete_post'),10,1);
|
94 |
-
remove_action('before_delete_post',array('EM_Event_Recurring_Post_Admin','before_delete_post'),10,1);
|
95 |
-
$post_ids = $wpdb->get_col('SELECT ID FROM '.$wpdb->posts." WHERE post_type IN ('".EM_POST_TYPE_EVENT."','".EM_POST_TYPE_LOCATION."','event-recurring')");
|
96 |
-
foreach($post_ids as $post_id){
|
97 |
-
wp_delete_post($post_id);
|
98 |
-
}
|
99 |
-
//delete categories
|
100 |
-
$cat_terms = get_terms(EM_TAXONOMY_CATEGORY, array('hide_empty'=>false));
|
101 |
-
foreach($cat_terms as $cat_term){
|
102 |
-
wp_delete_term($cat_term->term_id, EM_TAXONOMY_CATEGORY);
|
103 |
-
}
|
104 |
-
$tag_terms = get_terms(EM_TAXONOMY_TAG, array('hide_empty'=>false));
|
105 |
-
foreach($tag_terms as $tag_term){
|
106 |
-
wp_delete_term($tag_term->term_id, EM_TAXONOMY_TAG);
|
107 |
-
}
|
108 |
-
//delete EM tables
|
109 |
-
$wpdb->query('DROP TABLE '.EM_EVENTS_TABLE);
|
110 |
-
$wpdb->query('DROP TABLE '.EM_BOOKINGS_TABLE);
|
111 |
-
$wpdb->query('DROP TABLE '.EM_LOCATIONS_TABLE);
|
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
|
119 |
-
$wpdb->query('DELETE FROM '.$wpdb->options.' WHERE option_name LIKE \'em_%\' OR option_name LIKE \'dbem_%\'');
|
120 |
-
//deactivate and go!
|
121 |
-
deactivate_plugins(array('events-manager/events-manager.php','events-manager-pro/events-manager-pro.php'), true);
|
122 |
-
wp_redirect(admin_url('plugins.php?deactivate=true'));
|
123 |
-
exit();
|
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;
|
131 |
-
//delete options
|
132 |
-
$wpdb->query('DELETE FROM '.$wpdb->options.' WHERE option_name LIKE \'em_%\' OR option_name LIKE \'dbem_%\'');
|
133 |
-
//reset capabilities
|
134 |
-
global $em_capabilities_array, $wp_roles;
|
135 |
-
foreach( $wp_roles->role_objects as $role_name => $role ){
|
136 |
-
foreach( array_keys($em_capabilities_array) as $capability){
|
137 |
-
$role->remove_cap($capability);
|
138 |
-
}
|
139 |
-
}
|
140 |
-
//go back to plugin options page
|
141 |
-
$EM_Notices->add_confirm(__('Settings have been reset back to default. Your events, locations and categories have not been modified.','dbem'), true);
|
142 |
-
wp_redirect(EM_ADMIN_URL.'&page=events-manager-options');
|
143 |
-
exit();
|
144 |
-
}
|
145 |
-
}
|
146 |
-
//Force Update Recheck - Workaround for now
|
147 |
-
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'recheck_updates' && check_admin_referer('em_recheck_updates_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
|
148 |
-
//force recheck of plugin updates, to refresh dl links
|
149 |
-
delete_transient('update_plugins');
|
150 |
-
delete_site_transient('update_plugins');
|
151 |
-
$EM_Notices->add_confirm(__('If there are any new updates, you should now see them in your Plugins or Updates admin pages.','dbem'), true);
|
152 |
-
wp_redirect(wp_get_referer());
|
153 |
-
exit();
|
154 |
-
}
|
155 |
-
//Flag version checking to look at trunk, not tag
|
156 |
-
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'check_devs' && check_admin_referer('em_check_devs_wpnonce') && is_super_admin() ){
|
157 |
-
//delete transients, and add a flag to recheck dev version next time round
|
158 |
-
delete_transient('update_plugins');
|
159 |
-
delete_site_transient('update_plugins');
|
160 |
-
update_option('em_check_dev_version', true);
|
161 |
-
$EM_Notices->add_confirm(__('Checking for dev versions.','dbem').' '. __('If there are any new updates, you should now see them in your Plugins or Updates admin pages.','dbem'), true);
|
162 |
-
wp_redirect(wp_get_referer());
|
163 |
-
exit();
|
164 |
-
}
|
165 |
-
|
166 |
-
}
|
167 |
-
add_action('admin_init', 'em_options_save');
|
168 |
-
|
169 |
-
function em_admin_email_test_ajax(){
|
170 |
-
if( wp_verify_nonce($_REQUEST['_check_email_nonce'],'check_email') && current_user_can('activate_plugins') ){
|
171 |
-
$subject = __("Events Manager Test Email",'dbem');
|
172 |
-
$content = __('Congratulations! Your email settings work.','dbem');
|
173 |
-
$current_user = get_user_by('id', get_current_user_id());
|
174 |
-
//add filters for options used in EM_Mailer so the current supplied ones are used
|
175 |
-
ob_start();
|
176 |
-
|
177 |
-
add_filter('
|
178 |
-
|
179 |
-
add_filter('
|
180 |
-
|
181 |
-
add_filter('
|
182 |
-
|
183 |
-
add_filter('
|
184 |
-
|
185 |
-
add_filter('
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
if( $
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
$
|
258 |
-
$
|
259 |
-
$
|
260 |
-
$
|
261 |
-
|
262 |
-
$locations_placeholder_tip
|
263 |
-
$
|
264 |
-
$
|
265 |
-
|
266 |
-
|
267 |
-
$
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
<div class="inside">
|
611 |
-
<table class="form-table">
|
612 |
-
<tr>
|
613 |
-
<th><?php echo sprintf(__( 'Events page', 'dbem' )); ?></th>
|
614 |
-
<td>
|
615 |
-
<?php wp_dropdown_pages(array('name'=>'dbem_events_page', 'selected'=>get_option('dbem_events_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'dbem'),__('Events','dbem')) )); ?>
|
616 |
-
<br />
|
617 |
-
<em><?php echo __( 'This option allows you to select which page to use as an events page. If you do not select an events page, to display event lists you can enable event archives or use the appropriate shortcodes and/or template tags.','dbem' ); ?></em>
|
618 |
-
</td>
|
619 |
-
</tr>
|
620 |
-
<tbody class="em-event-page-options">
|
621 |
-
<?php
|
622 |
-
em_options_radio_binary ( __( 'Show events search?', 'dbem' ), 'dbem_events_page_search_form', __( "If set to yes, a search form will appear just above your list of events.", 'dbem' ) );
|
623 |
-
em_options_radio_binary ( __( 'Display calendar in events page?', 'dbem' ), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','dbem' ).' '.__('If you would like to show events that span over more than one day, see the Calendar section on this page.','dbem') );
|
624 |
-
em_options_radio_binary ( __( 'Disable title rewriting?', 'dbem' ), 'dbem_disable_title_rewrites', __( "Some WordPress themes don't follow best practices when generating navigation menus, and so the automatic title rewriting feature may cause problems, if your menus aren't working correctly on the event pages, try setting this to 'Yes', and provide an appropriate HTML title format below.",'dbem' ) );
|
625 |
-
em_options_input_text ( __( 'Event Manager titles', 'dbem' ), 'dbem_title_html', __( "This only setting only matters if you selected 'Yes' to above. You will notice the events page titles aren't being rewritten, and you have a new title underneath the default page name. This is where you control the HTML of this title. Make sure you keep the #_PAGETITLE placeholder here, as that's what is rewritten by events manager. To control what's rewritten in this title, see settings further down for page titles.", 'dbem' ) );
|
626 |
-
?>
|
627 |
-
</tbody>
|
628 |
-
<tr class="em-header">
|
629 |
-
<td colspan="2">
|
630 |
-
<h4><?php echo sprintf(__('WordPress %s Archives','dbem'), __('Event','dbem')); ?></h4>
|
631 |
-
<p><?php echo sprintf(__('%s custom post types can have archives, just like normal WordPress posts. If enabled, should you visit your base slug url %s and you will see an post-formatted archive of previous %s', 'dbem'), __('Event','dbem'), '<code>'.home_url().'/'.get_option('dbem_cp_events_slug',EM_POST_TYPE_EVENT_SLUG).'/</code>', __('events','dbem')); ?></p>
|
632 |
-
<p><?php echo sprintf(__('Note that assigning a %s page above will override this archive if the URLs collide (which is the default setting, and is recommended for maximum plugin compatibility). You can have both at the same time, but you must ensure that your page and %s slugs are different.','dbem'), __('events','dbem'), __('event','dbem')); ?></p>
|
633 |
-
</td>
|
634 |
-
</tr>
|
635 |
-
<tbody class="em-event-archive-options">
|
636 |
-
<?php
|
637 |
-
em_options_radio_binary ( __( 'Enable Archives?', 'dbem' ), 'dbem_cp_events_has_archive', __( "Allow WordPress post-style archives.", 'dbem' ) );
|
638 |
-
?>
|
639 |
-
</tbody>
|
640 |
-
<tbody class="em-event-archive-options em-event-archive-sub-options">
|
641 |
-
<tr valign="top">
|
642 |
-
<th scope="row"><?php _e('Default event archive ordering','dbem'); ?></th>
|
643 |
-
<td>
|
644 |
-
<select name="dbem_events_default_archive_orderby" >
|
645 |
-
<?php
|
646 |
-
$event_archive_orderby_options = apply_filters('em_settings_events_default_archive_orderby_ddm', array(
|
647 |
-
'_start_ts' => __('Order by start date, start time','dbem'),
|
648 |
-
'title' => __('Order by name','dbem')
|
649 |
-
));
|
650 |
-
?>
|
651 |
-
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
652 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
653 |
-
<?php echo esc_html($value); ?>
|
654 |
-
</option>
|
655 |
-
<?php endforeach; ?>
|
656 |
-
</select>
|
657 |
-
<select name="dbem_events_default_archive_order" >
|
658 |
-
<?php
|
659 |
-
$ascending = __('Ascending','dbem');
|
660 |
-
$descending = __('Descending','dbem');
|
661 |
-
$event_archive_order_options = apply_filters('em_settings_events_default_archive_order_ddm', array(
|
662 |
-
'ASC' => __('Ascending','dbem'),
|
663 |
-
'DESC' => __('Descending','dbem')
|
664 |
-
));
|
665 |
-
?>
|
666 |
-
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
667 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
668 |
-
<?php echo esc_html($value); ?>
|
669 |
-
</option>
|
670 |
-
<?php endforeach; ?>
|
671 |
-
</select>
|
672 |
-
<br/>
|
673 |
-
<em><?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?></em>
|
674 |
-
</td>
|
675 |
-
</tr>
|
676 |
-
<?php
|
677 |
-
em_options_select( __('Event archives scope','dbem'), 'dbem_events_archive_scope', em_get_scopes() );
|
678 |
-
?>
|
679 |
-
</tbody>
|
680 |
-
<tr class="em-header">
|
681 |
-
<td colspan="2">
|
682 |
-
<h4><?php echo _e('General settings','dbem'); ?></h4>
|
683 |
-
</td>
|
684 |
-
</tr>
|
685 |
-
<?php
|
686 |
-
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_events_archive_formats', sprintf($format_override_tip,__('events','dbem')));
|
687 |
-
em_options_radio_binary ( __( 'Override Excerpts with Formats?', 'dbem' ), 'dbem_cp_events_excerpt_formats', sprintf($format_override_tip,__('events','dbem')));
|
688 |
-
em_options_radio_binary ( __( 'Are current events past events?', 'dbem' ), 'dbem_events_current_are_past', __( "By default, events that are have an end date later than today will be included in searches, set this to yes to consider events that started 'yesterday' as past.", 'dbem' ) );
|
689 |
-
em_options_radio_binary ( __( 'Include in WordPress Searches?', 'dbem' ), 'dbem_cp_events_search_results', sprintf(__( "Allow %s to appear in the built-in search results.", 'dbem' ),__('events','dbem')) );
|
690 |
-
?>
|
691 |
-
<tr class="em-header">
|
692 |
-
<td colspan="2">
|
693 |
-
<h4><?php echo sprintf(__('Default %s list options','dbem'), __('event','dbem')); ?></h4>
|
694 |
-
<p><?php _e('These can be overriden when using shortcode or template tags.','dbem'); ?></p>
|
695 |
-
</td>
|
696 |
-
</tr>
|
697 |
-
<tr valign="top" id='dbem_events_default_orderby_row'>
|
698 |
-
<th scope="row"><?php _e('Default event list ordering','dbem'); ?></th>
|
699 |
-
<td>
|
700 |
-
<select name="dbem_events_default_orderby" >
|
701 |
-
<?php
|
702 |
-
$orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
|
703 |
-
'event_start_date,event_start_time,event_name' => __('Order by start date, start time, then event name','dbem'),
|
704 |
-
'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time','dbem'),
|
705 |
-
'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time','dbem'),
|
706 |
-
'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name','dbem'),
|
707 |
-
));
|
708 |
-
?>
|
709 |
-
<?php foreach($orderby_options as $key => $value) : ?>
|
710 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_orderby')) ? "selected='selected'" : ''; ?>>
|
711 |
-
<?php echo esc_html($value); ?>
|
712 |
-
</option>
|
713 |
-
<?php endforeach; ?>
|
714 |
-
</select>
|
715 |
-
<select name="dbem_events_default_order" >
|
716 |
-
<?php
|
717 |
-
$ascending = __('Ascending','dbem');
|
718 |
-
$descending = __('Descending','dbem');
|
719 |
-
$order_options = apply_filters('em_settings_events_default_order_ddm', array(
|
720 |
-
'ASC' => __('All Ascending','dbem'),
|
721 |
-
'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'dbem'),
|
722 |
-
'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'dbem'),
|
723 |
-
'DESC' => __('All Descending','dbem'),
|
724 |
-
'ASC,DESC,ASC' => __("$ascending, $descending, $ascending",'dbem'),
|
725 |
-
'ASC,DESC,DESC' => __("$ascending, $descending, $descending",'dbem'),
|
726 |
-
'ASC,ASC,DESC' => __("$ascending, $ascending, $descending",'dbem'),
|
727 |
-
'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'dbem'),
|
728 |
-
));
|
729 |
-
?>
|
730 |
-
<?php foreach( $order_options as $key => $value) : ?>
|
731 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_order')) ? "selected='selected'" : ''; ?>>
|
732 |
-
<?php echo esc_html($value); ?>
|
733 |
-
</option>
|
734 |
-
<?php endforeach; ?>
|
735 |
-
</select>
|
736 |
-
<br/>
|
737 |
-
<em><?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?></em>
|
738 |
-
</td>
|
739 |
-
</tr>
|
740 |
-
<?php
|
741 |
-
em_options_select( __('Event list scope','dbem'), 'dbem_events_page_scope', em_get_scopes(), __('Only show events starting within a certain time limit on the events page. Default is future events with no end time limit.','dbem') );
|
742 |
-
em_options_input_text ( __( 'Event List Limits', 'dbem' ), 'dbem_events_default_limit', __( "This will control how many events are shown on one list by default.", 'dbem' ) );
|
743 |
-
echo $save_button;
|
744 |
-
?>
|
745 |
-
</table>
|
746 |
-
</div> <!-- . inside -->
|
747 |
-
</div> <!-- .postbox -->
|
748 |
-
|
749 |
-
<?php if( get_option('dbem_locations_enabled') ): ?>
|
750 |
-
<div class="postbox " id="em-opt-location-pages" >
|
751 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s Pages','dbem'),__('Location','dbem')); ?></span></h3>
|
752 |
-
<div class="inside">
|
753 |
-
<table class="form-table">
|
754 |
-
<?php
|
755 |
-
//em_options_radio_binary ( sprintf(__( 'Display %s as', 'dbem' ),__('locations','dbem')), 'dbem_cp_locations_template_page', sprintf($template_page_tip, EM_POST_TYPE_LOCATION), array(__('Posts'),__('Pages')) );
|
756 |
-
em_options_select( sprintf(__( 'Display %s as', 'dbem' ),__('locations','dbem')), 'dbem_cp_locations_template', $page_templates, sprintf($template_page_tip, __('locations','dbem'), EM_POST_TYPE_LOCATION) );
|
757 |
-
em_options_input_text( __('Body Classes','dbem'), 'dbem_cp_locations_body_class', sprintf($body_class_tip, __('location','dbem')) );
|
758 |
-
em_options_input_text( __('Post Classes','dbem'), 'dbem_cp_locations_post_class', $post_class_tip );
|
759 |
-
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_locations_formats', sprintf($format_override_tip,__('locations','dbem')));
|
760 |
-
em_options_radio_binary ( __( 'Enable Comments?', 'dbem' ), '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.','dbem'),__('location','dbem'),__('locations','dbem')));
|
761 |
-
em_options_input_text ( __( 'Event List Limits', 'dbem' ), '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.", 'dbem' ), '<code>#_LOCATIONNEXTEVENTS</code>') );
|
762 |
-
echo $save_button;
|
763 |
-
?>
|
764 |
-
</table>
|
765 |
-
</div> <!-- . inside -->
|
766 |
-
</div> <!-- .postbox -->
|
767 |
-
|
768 |
-
<div class="postbox " id="em-opt-location-archives" >
|
769 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s List/Archives','dbem'),__('Location','dbem')); ?></span></h3>
|
770 |
-
<div class="inside">
|
771 |
-
<table class="form-table">
|
772 |
-
<tr>
|
773 |
-
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Locations','dbem')); ?></th>
|
774 |
-
<td>
|
775 |
-
<?php wp_dropdown_pages(array('name'=>'dbem_locations_page', 'selected'=>get_option('dbem_locations_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'dbem'),__('Locations','dbem')) )); ?>
|
776 |
-
<br />
|
777 |
-
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page. If you do not select a %s page, to display lists you can enable archives or use the appropriate shortcodes and/or template tags.','dbem' ),__('locations','dbem'),__('locations','dbem')); ?></em>
|
778 |
-
</td>
|
779 |
-
</tr>
|
780 |
-
<?php
|
781 |
-
em_options_radio_binary ( __( 'Show locations search?', 'dbem' ), 'dbem_locations_page_search_form', __( "If set to yes, a search form will appear just above your list of locations.", 'dbem' ) );
|
782 |
-
?>
|
783 |
-
<tr class="em-header">
|
784 |
-
<td colspan="2">
|
785 |
-
<h4><?php echo sprintf(__('WordPress %s Archives','dbem'), __('Location','dbem')); ?></h4>
|
786 |
-
<p><?php echo sprintf(__('%s custom post types can have archives, just like normal WordPress posts. If enabled, should you visit your base slug url %s and you will see an post-formatted archive of previous %s', 'dbem'), __('Location','dbem'), '<code>'.home_url().'/'.get_option('dbem_cp_events_slug',EM_POST_TYPE_LOCATION_SLUG).'/</code>', __('locations','dbem')); ?></p>
|
787 |
-
<p><?php echo sprintf(__('Note that assigning a %s page above will override this archive if the URLs collide (which is the default settings, and is recommended for maximum plugin compatibility). You can have both at the same time, but you must ensure that your page and %s slugs are different.','dbem'), __('locations','dbem'), __('location','dbem')); ?></p>
|
788 |
-
</td>
|
789 |
-
</tr>
|
790 |
-
<tbody class="em-location-archive-options">
|
791 |
-
<?php
|
792 |
-
em_options_radio_binary ( __( 'Enable Archives?', 'dbem' ), 'dbem_cp_locations_has_archive', __( "Allow WordPress post-style archives.", 'dbem' ) );
|
793 |
-
?>
|
794 |
-
</tbody>
|
795 |
-
<tbody class="em-location-archive-options em-location-archive-sub-options">
|
796 |
-
<tr valign="top">
|
797 |
-
<th scope="row"><?php _e('Default archive ordering','dbem'); ?></th>
|
798 |
-
<td>
|
799 |
-
<select name="dbem_locations_default_archive_orderby" >
|
800 |
-
<?php
|
801 |
-
$orderby_options = apply_filters('em_settings_locations_default_archive_orderby_ddm', array(
|
802 |
-
'_country' => sprintf(__('Order by %s','dbem'),__('Country','dbem')),
|
803 |
-
'_town' => sprintf(__('Order by %s','dbem'),__('Town','dbem')),
|
804 |
-
'title' => sprintf(__('Order by %s','dbem'),__('Name','dbem'))
|
805 |
-
));
|
806 |
-
?>
|
807 |
-
<?php foreach($orderby_options as $key => $value) : ?>
|
808 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
809 |
-
<?php echo esc_html($value) ?>
|
810 |
-
</option>
|
811 |
-
<?php endforeach; ?>
|
812 |
-
</select>
|
813 |
-
<select name="dbem_locations_default_archive_order" >
|
814 |
-
<?php
|
815 |
-
$ascending = __('Ascending','dbem');
|
816 |
-
$descending = __('Descending','dbem');
|
817 |
-
$order_options = apply_filters('em_settings_locations_default_archive_order_ddm', array(
|
818 |
-
'ASC' => __('Ascending','dbem'),
|
819 |
-
'DESC' => __('Descending','dbem')
|
820 |
-
));
|
821 |
-
?>
|
822 |
-
<?php foreach( $order_options as $key => $value) : ?>
|
823 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
824 |
-
<?php echo esc_html($value) ?>
|
825 |
-
</option>
|
826 |
-
<?php endforeach; ?>
|
827 |
-
</select>
|
828 |
-
</td>
|
829 |
-
</tr>
|
830 |
-
</tbody>
|
831 |
-
<tr class="em-header">
|
832 |
-
<td colspan="2">
|
833 |
-
<h4><?php echo _e('General settings','dbem'); ?></h4>
|
834 |
-
</td>
|
835 |
-
</tr>
|
836 |
-
<?php
|
837 |
-
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_locations_archive_formats', sprintf($format_override_tip,__('locations','dbem')));
|
838 |
-
em_options_radio_binary ( __( 'Override Excerpts with Formats?', 'dbem' ), 'dbem_cp_locations_excerpt_formats', sprintf($format_override_tip,__('locations','dbem')));
|
839 |
-
em_options_radio_binary ( __( 'Include in WordPress Searches?', 'dbem' ), 'dbem_cp_locations_search_results', sprintf(__( "Allow %s to appear in the built-in search results.", 'dbem' ),__('locations','dbem')) );
|
840 |
-
?>
|
841 |
-
<tr class="em-header">
|
842 |
-
<td colspan="2">
|
843 |
-
<h4><?php echo sprintf(__('Default %s list options','dbem'), __('location','dbem')); ?></h4>
|
844 |
-
<p><?php _e('These can be overriden when using shortcode or template tags.','dbem'); ?></p>
|
845 |
-
</td>
|
846 |
-
</tr>
|
847 |
-
<tr valign="top" id='dbem_locations_default_orderby_row'>
|
848 |
-
<th scope="row"><?php _e('Default list ordering','dbem'); ?></th>
|
849 |
-
<td>
|
850 |
-
<select name="dbem_locations_default_orderby" >
|
851 |
-
<?php
|
852 |
-
$orderby_options = apply_filters('em_settings_locations_default_orderby_ddm', array(
|
853 |
-
'location_country' => sprintf(__('Order by %s','dbem'),__('Country','dbem')),
|
854 |
-
'location_town' => sprintf(__('Order by %s','dbem'),__('Town','dbem')),
|
855 |
-
'location_name' => sprintf(__('Order by %s','dbem'),__('Name','dbem'))
|
856 |
-
));
|
857 |
-
?>
|
858 |
-
<?php foreach($orderby_options as $key => $value) : ?>
|
859 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_orderby')) ? "selected='selected'" : ''; ?>>
|
860 |
-
<?php echo esc_html($value) ?>
|
861 |
-
</option>
|
862 |
-
<?php endforeach; ?>
|
863 |
-
</select>
|
864 |
-
<select name="dbem_locations_default_order" >
|
865 |
-
<?php
|
866 |
-
$ascending = __('Ascending','dbem');
|
867 |
-
$descending = __('Descending','dbem');
|
868 |
-
$order_options = apply_filters('em_settings_locations_default_order_ddm', array(
|
869 |
-
'ASC' => __('Ascending','dbem'),
|
870 |
-
'DESC' => __('Descending','dbem')
|
871 |
-
));
|
872 |
-
?>
|
873 |
-
<?php foreach( $order_options as $key => $value) : ?>
|
874 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_order')) ? "selected='selected'" : ''; ?>>
|
875 |
-
<?php echo esc_html($value) ?>
|
876 |
-
</option>
|
877 |
-
<?php endforeach; ?>
|
878 |
-
</select>
|
879 |
-
</td>
|
880 |
-
</tr>
|
881 |
-
<?php
|
882 |
-
em_options_input_text ( __( 'List Limits', 'dbem' ), 'dbem_locations_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'dbem' ),__('locations','dbem')) );
|
883 |
-
echo $save_button;
|
884 |
-
?>
|
885 |
-
</table>
|
886 |
-
</div> <!-- . inside -->
|
887 |
-
</div> <!-- .postbox -->
|
888 |
-
<?php endif; ?>
|
889 |
-
|
890 |
-
<?php if( get_option('dbem_categories_enabled') && !(EM_MS_GLOBAL && !is_main_site()) ): ?>
|
891 |
-
<div class="postbox " id="em-opt-categories-pages" >
|
892 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo __('Event Categories','dbem'); ?></span></h3>
|
893 |
-
<div class="inside">
|
894 |
-
<div class="em-boxheader">
|
895 |
-
<p>
|
896 |
-
<?php echo sprintf(__('%s are a <a href="%s" target="_blank">WordPress custom taxonomy</a>.','dbem'), __('Event Categories','dbem'), 'http://codex.wordpress.org/Taxonomies');?>
|
897 |
-
<?php echo sprintf(__('%s can be displayed just like normal WordPress custom taxonomies in an archive-style format, however Events Manager by default allows you to completely change the standard look of these archives and use our own <a href="%s">custom formatting</a> methods.','dbem'), __('Event Categories','dbem'), EM_ADMIN_URL .'&page=events-manager-help#event-placeholders'); ?>
|
898 |
-
</p>
|
899 |
-
<p>
|
900 |
-
<?php echo sprintf(__('Due to how we change how this custom taxonomy is displayed when overriding with formats it is strongly advised that you assign a %s page below, which increases comatability with various plugins and themes.','dbem'), __('categories','dbem')); ?>
|
901 |
-
<?php sprintf(__('<a href="%s">See some more information</a> on how %s work when overriding with formats.','dbem'), '#', __('categories','dbem')); //not ready yet, but make translatable ?>
|
902 |
-
</p>
|
903 |
-
</div>
|
904 |
-
<table class="form-table">
|
905 |
-
<tr>
|
906 |
-
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Categories','dbem')); ?></th>
|
907 |
-
<td>
|
908 |
-
<?php wp_dropdown_pages(array('name'=>'dbem_categories_page','selected'=>get_option('dbem_categories_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'dbem'),__('Categories','dbem')) )); ?>
|
909 |
-
<br />
|
910 |
-
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page.','dbem' ),__('categories','dbem')); ?></em>
|
911 |
-
</td>
|
912 |
-
</tr>
|
913 |
-
<tr class="em-header">
|
914 |
-
<td colspan="2">
|
915 |
-
<h4><?php echo _e('General settings','dbem'); ?></h4>
|
916 |
-
</td>
|
917 |
-
</tr>
|
918 |
-
<?php
|
919 |
-
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_categories_formats', sprintf($format_override_tip,__('categories','dbem'))." ".__('Setting this to yes will make categories display as a page rather than an archive.', 'dbem'));
|
920 |
-
?>
|
921 |
-
<tr valign="top">
|
922 |
-
<th scope="row"><?php _e('Default archive ordering','dbem'); ?></th>
|
923 |
-
<td>
|
924 |
-
<select name="dbem_categories_default_archive_orderby" >
|
925 |
-
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
926 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
927 |
-
<?php echo esc_html($value) ?>
|
928 |
-
</option>
|
929 |
-
<?php endforeach; ?>
|
930 |
-
</select>
|
931 |
-
<select name="dbem_categories_default_archive_order" >
|
932 |
-
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
933 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
934 |
-
<?php echo esc_html($value) ?>
|
935 |
-
</option>
|
936 |
-
<?php endforeach; ?>
|
937 |
-
</select>
|
938 |
-
<br /><?php echo __('When listing events for a category, this order is applied.', 'dbem'); ?>
|
939 |
-
</td>
|
940 |
-
</tr>
|
941 |
-
<tr class="em-header">
|
942 |
-
<td colspan="2">
|
943 |
-
<h4><?php echo sprintf(__('Default %s list options','dbem'), __('category','dbem')); ?></h4>
|
944 |
-
<p><?php _e('These can be overriden when using shortcode or template tags.','dbem'); ?></p>
|
945 |
-
</td>
|
946 |
-
</tr>
|
947 |
-
<tr valign="top" id='dbem_categories_default_orderby_row'>
|
948 |
-
<th scope="row"><?php _e('Default list ordering','dbem'); ?></th>
|
949 |
-
<td>
|
950 |
-
<select name="dbem_categories_default_orderby" >
|
951 |
-
<?php
|
952 |
-
$orderby_options = apply_filters('em_settings_categories_default_orderby_ddm', array(
|
953 |
-
'id' => sprintf(__('Order by %s','dbem'),__('ID','dbem')),
|
954 |
-
'count' => sprintf(__('Order by %s','dbem'),__('Count','dbem')),
|
955 |
-
'name' => sprintf(__('Order by %s','dbem'),__('Name','dbem')),
|
956 |
-
'slug' => sprintf(__('Order by %s','dbem'),__('Slug','dbem')),
|
957 |
-
'term_group' => sprintf(__('Order by %s','dbem'),'term_group'),
|
958 |
-
));
|
959 |
-
?>
|
960 |
-
<?php foreach($orderby_options as $key => $value) : ?>
|
961 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_orderby')) ? "selected='selected'" : ''; ?>>
|
962 |
-
<?php echo esc_html($value) ?>
|
963 |
-
</option>
|
964 |
-
<?php endforeach; ?>
|
965 |
-
</select>
|
966 |
-
<select name="dbem_categories_default_order" >
|
967 |
-
<?php
|
968 |
-
$ascending = __('Ascending','dbem');
|
969 |
-
$descending = __('Descending','dbem');
|
970 |
-
$order_options = apply_filters('em_settings_categories_default_order_ddm', array(
|
971 |
-
'ASC' => __('Ascending','dbem'),
|
972 |
-
'DESC' => __('Descending','dbem')
|
973 |
-
));
|
974 |
-
?>
|
975 |
-
<?php foreach( $order_options as $key => $value) : ?>
|
976 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_order')) ? "selected='selected'" : ''; ?>>
|
977 |
-
<?php echo esc_html($value) ?>
|
978 |
-
</option>
|
979 |
-
<?php endforeach; ?>
|
980 |
-
</select>
|
981 |
-
<br /><?php echo __('When listing categories, this order is applied.', 'dbem'); ?>
|
982 |
-
</td>
|
983 |
-
</tr>
|
984 |
-
<?php
|
985 |
-
em_options_input_text ( __( 'List Limits', 'dbem' ), 'dbem_categories_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'dbem' ),__('categories','dbem')) );
|
986 |
-
em_options_input_text ( __( 'Event List Limits', 'dbem' ), '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.", 'dbem' ), '<code>#_CATEGORYNEXTEVENTS</code>') );
|
987 |
-
echo $save_button;
|
988 |
-
?>
|
989 |
-
</table>
|
990 |
-
</div> <!-- . inside -->
|
991 |
-
</div> <!-- .postbox -->
|
992 |
-
<?php endif; ?>
|
993 |
-
|
994 |
-
<?php if( get_option('dbem_tags_enabled') ): //disabled for now, will add tag stuff later ?>
|
995 |
-
<div class="postbox " id="em-opt-tags-pages" >
|
996 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo __('Event Tags','dbem'); ?></span></h3>
|
997 |
-
<div class="inside">
|
998 |
-
<div class="em-boxheader">
|
999 |
-
<p>
|
1000 |
-
<?php echo sprintf(__('%s are a <a href="%s" target="_blank">WordPress custom taxonomy</a>.','dbem'), __('Event Tags','dbem'), 'http://codex.wordpress.org/Taxonomies');?>
|
1001 |
-
<?php echo sprintf(__('%s can be displayed just like normal WordPress custom taxonomies in an archive-style format, however Events Manager by default allows you to completely change the standard look of these archives and use our own <a href="%s">custom formatting</a> methods.','dbem'), __('Event Tags','dbem'), EM_ADMIN_URL .'&page=events-manager-help#event-placeholders'); ?>
|
1002 |
-
</p>
|
1003 |
-
<p>
|
1004 |
-
<?php echo sprintf(__('Due to how we change how this custom taxonomy is displayed when overriding with formats it is strongly advised that you assign a %s page below, which increases comatability with various plugins and themes.','dbem'), __('tags','dbem')); ?>
|
1005 |
-
<?php sprintf(__('<a href="%s">See some more information</a> on how %s work when overriding with formats.','dbem'), '#', __('tags','dbem')); //not ready yet, but make translatable ?>
|
1006 |
-
</p>
|
1007 |
-
</div>
|
1008 |
-
<table class="form-table">
|
1009 |
-
<tr>
|
1010 |
-
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Tags','dbem')); ?></th>
|
1011 |
-
<td>
|
1012 |
-
<?php wp_dropdown_pages(array('name'=>'dbem_tags_page','selected'=>get_option('dbem_tags_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'dbem'),__('Tags','dbem')) )); ?>
|
1013 |
-
<br />
|
1014 |
-
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page.','dbem' ),__('tags','dbem'),__('tags','dbem')); ?></em>
|
1015 |
-
</td>
|
1016 |
-
</tr>
|
1017 |
-
<tr class="em-header">
|
1018 |
-
<td colspan="2">
|
1019 |
-
<h4><?php echo _e('General settings','dbem'); ?></h4>
|
1020 |
-
</td>
|
1021 |
-
</tr>
|
1022 |
-
<?php
|
1023 |
-
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_tags_formats', sprintf($format_override_tip,__('tags','dbem')));
|
1024 |
-
?>
|
1025 |
-
<tr valign="top">
|
1026 |
-
<th scope="row"><?php _e('Default archive ordering','dbem'); ?></th>
|
1027 |
-
<td>
|
1028 |
-
<select name="dbem_tags_default_archive_orderby" >
|
1029 |
-
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
1030 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
1031 |
-
<?php echo esc_html($value) ?>
|
1032 |
-
</option>
|
1033 |
-
<?php endforeach; ?>
|
1034 |
-
</select>
|
1035 |
-
<select name="dbem_tags_default_archive_order" >
|
1036 |
-
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
1037 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
1038 |
-
<?php echo esc_html($value) ?>
|
1039 |
-
</option>
|
1040 |
-
<?php endforeach; ?>
|
1041 |
-
</select>
|
1042 |
-
</td>
|
1043 |
-
</tr>
|
1044 |
-
<tr class="em-header">
|
1045 |
-
<td colspan="2">
|
1046 |
-
<h4><?php echo sprintf(__('Default %s list options','dbem'), __('tag','dbem')); ?></h4>
|
1047 |
-
<p><?php _e('These can be overriden when using shortcode or template tags.','dbem'); ?></p>
|
1048 |
-
</td>
|
1049 |
-
</tr>
|
1050 |
-
<tr valign="top" id='dbem_tags_default_orderby_row'>
|
1051 |
-
<th scope="row"><?php _e('Default list ordering','dbem'); ?></th>
|
1052 |
-
<td>
|
1053 |
-
<select name="dbem_tags_default_orderby" >
|
1054 |
-
<?php
|
1055 |
-
$orderby_options = apply_filters('em_settings_tags_default_orderby_ddm', array(
|
1056 |
-
'id' => sprintf(__('Order by %s','dbem'),__('ID','dbem')),
|
1057 |
-
'count' => sprintf(__('Order by %s','dbem'),__('Count','dbem')),
|
1058 |
-
'name' => sprintf(__('Order by %s','dbem'),__('Name','dbem')),
|
1059 |
-
'slug' => sprintf(__('Order by %s','dbem'),__('Slug','dbem')),
|
1060 |
-
'term_group' => sprintf(__('Order by %s','dbem'),'term_group'),
|
1061 |
-
));
|
1062 |
-
?>
|
1063 |
-
<?php foreach($orderby_options as $key => $value) : ?>
|
1064 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_orderby')) ? "selected='selected'" : ''; ?>>
|
1065 |
-
<?php echo esc_html($value) ?>
|
1066 |
-
</option>
|
1067 |
-
<?php endforeach; ?>
|
1068 |
-
</select>
|
1069 |
-
<select name="dbem_tags_default_order" >
|
1070 |
-
<?php
|
1071 |
-
$ascending = __('Ascending','dbem');
|
1072 |
-
$descending = __('Descending','dbem');
|
1073 |
-
$order_options = apply_filters('em_settings_tags_default_order_ddm', array(
|
1074 |
-
'ASC' => __('Ascending','dbem'),
|
1075 |
-
'DESC' => __('Descending','dbem')
|
1076 |
-
));
|
1077 |
-
?>
|
1078 |
-
<?php foreach( $order_options as $key => $value) : ?>
|
1079 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_order')) ? "selected='selected'" : ''; ?>>
|
1080 |
-
<?php echo esc_html($value) ?>
|
1081 |
-
</option>
|
1082 |
-
<?php endforeach; ?>
|
1083 |
-
</select>
|
1084 |
-
<br /><?php echo __('When listing tags, this order is applied.', 'dbem'); ?>
|
1085 |
-
</td>
|
1086 |
-
</tr>
|
1087 |
-
<?php
|
1088 |
-
em_options_input_text ( __( 'List Limits', 'dbem' ), 'dbem_tags_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'dbem' ),__('tags','dbem')) );
|
1089 |
-
em_options_input_text ( __( 'Event List Limits', 'dbem' ), '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.", 'dbem' ), '<code>#_TAGNEXTEVENTS</code>') );
|
1090 |
-
echo $save_button; ?>
|
1091 |
-
</table>
|
1092 |
-
</div> <!-- . inside -->
|
1093 |
-
</div> <!-- .postbox -->
|
1094 |
-
<?php endif; ?>
|
1095 |
-
|
1096 |
-
<div class="postbox " id="em-opt-other-pages" >
|
1097 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s Pages','dbem'),__('Other','dbem')); ?></span></h3>
|
1098 |
-
<div class="inside">
|
1099 |
-
<p class="em-boxheader"><?php _e('These pages allow you to provide an event management interface outside the admin area on whatever page you want on your website. Bear in mind that this is overriden by BuddyPress if activated.', 'dbem'); ?></p>
|
1100 |
-
<table class="form-table">
|
1101 |
-
<?php
|
1102 |
-
$other_pages_tip = 'Using the %s shortcode, you can allow users to manage %s outside the admin area.';
|
1103 |
-
?>
|
1104 |
-
<tr class="em-header">
|
1105 |
-
<td colspan="2">
|
1106 |
-
<h4><?php _e('My Bookings','dbem'); ?></h4>
|
1107 |
-
<p><?php _e('This page is where people that have made bookings for an event can go and view their previous bookings.','dbem'); ?>
|
1108 |
-
</td>
|
1109 |
-
</tr>
|
1110 |
-
<tr>
|
1111 |
-
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('My bookings','dbem')); ?>
|
1112 |
-
</th>
|
1113 |
-
<td>
|
1114 |
-
<?php wp_dropdown_pages(array('name'=>'dbem_my_bookings_page', 'selected'=>get_option('dbem_my_bookings_page'), 'show_option_none'=>'['.__('None', 'dbem').']' )); ?>
|
1115 |
-
<br />
|
1116 |
-
<em><?php echo sprintf(__('Users can view their bookings for other events on this page.','dbem' ),'<code>[my_bookings]</code>',__('bookings','dbem')); ?></em>
|
1117 |
-
</td>
|
1118 |
-
</tr>
|
1119 |
-
<tr valign="top" id='dbem_bookings_default_orderby_row'>
|
1120 |
-
<th scope="row"><?php _e('Default list ordering','dbem'); ?></th>
|
1121 |
-
<td>
|
1122 |
-
<select name="dbem_bookings_default_orderby" >
|
1123 |
-
<?php
|
1124 |
-
$orderby_options = apply_filters('em_settings_bookings_default_orderby_ddm', array(
|
1125 |
-
'event_name' => sprintf(__('Order by %s','dbem'),__('Event Name','dbem')),
|
1126 |
-
'event_start_date' => sprintf(__('Order by %s','dbem'),__('Start Date','dbem')),
|
1127 |
-
'booking_date' => sprintf(__('Order by %s','dbem'),__('Booking Date','dbem'))
|
1128 |
-
));
|
1129 |
-
?>
|
1130 |
-
<?php foreach($orderby_options as $key => $value) : ?>
|
1131 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_bookings_default_orderby')) ? "selected='selected'" : ''; ?>>
|
1132 |
-
<?php echo esc_html($value) ?>
|
1133 |
-
</option>
|
1134 |
-
<?php endforeach; ?>
|
1135 |
-
</select>
|
1136 |
-
<select name="dbem_bookings_default_order" >
|
1137 |
-
<?php
|
1138 |
-
$ascending = __('Ascending','dbem');
|
1139 |
-
$descending = __('Descending','dbem');
|
1140 |
-
$order_options = apply_filters('em_settings_bookings_default_order_ddm', array(
|
1141 |
-
'ASC' => __('Ascending','dbem'),
|
1142 |
-
'DESC' => __('Descending','dbem')
|
1143 |
-
));
|
1144 |
-
?>
|
1145 |
-
<?php foreach( $order_options as $key => $value) : ?>
|
1146 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_bookings_default_order')) ? "selected='selected'" : ''; ?>>
|
1147 |
-
<?php echo esc_html($value) ?>
|
1148 |
-
</option>
|
1149 |
-
<?php endforeach; ?>
|
1150 |
-
</select>
|
1151 |
-
</td>
|
1152 |
-
</tr>
|
1153 |
-
<tr class="em-header">
|
1154 |
-
<td colspan="2">
|
1155 |
-
<h4><?php _e('Front-end management pages','dbem'); ?></h4>
|
1156 |
-
<p><?php _e('Users with the relevant permissions can manage their own events and bookings to these events on the following pages.','dbem'); ?></p>
|
1157 |
-
</td>
|
1158 |
-
</tr>
|
1159 |
-
<tr>
|
1160 |
-
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Edit events','dbem')); ?></th>
|
1161 |
-
<td>
|
1162 |
-
<?php wp_dropdown_pages(array('name'=>'dbem_edit_events_page', 'selected'=>get_option('dbem_edit_events_page'), 'show_option_none'=>'['.__('None', 'dbem').']' )); ?>
|
1163 |
-
<br />
|
1164 |
-
<em><?php echo sprintf(__('Users can view, add and edit their %s on this page.','dbem'),__('events','dbem')); ?></em>
|
1165 |
-
</td>
|
1166 |
-
</tr>
|
1167 |
-
<tr>
|
1168 |
-
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Edit locations','dbem')); ?></th>
|
1169 |
-
<td>
|
1170 |
-
<?php wp_dropdown_pages(array('name'=>'dbem_edit_locations_page', 'selected'=>get_option('dbem_edit_locations_page'), 'show_option_none'=>'['.__('None', 'dbem').']' )); ?>
|
1171 |
-
<br />
|
1172 |
-
<em><?php echo sprintf(__('Users can view, add and edit their %s on this page.','dbem'),__('locations','dbem')); ?></em>
|
1173 |
-
</td>
|
1174 |
-
</tr>
|
1175 |
-
<tr>
|
1176 |
-
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Manage bookings','dbem')); ?></th>
|
1177 |
-
<td>
|
1178 |
-
<?php wp_dropdown_pages(array('name'=>'dbem_edit_bookings_page', 'selected'=>get_option('dbem_edit_bookings_page'), 'show_option_none'=>'['.__('None', 'dbem').']' )); ?>
|
1179 |
-
<br />
|
1180 |
-
<em><?php _e('Users can manage bookings for their events on this page.','dbem'); ?></em>
|
1181 |
-
</td>
|
1182 |
-
</tr>
|
1183 |
-
<?php echo $save_button; ?>
|
1184 |
-
</table>
|
1185 |
-
</div> <!-- . inside -->
|
1186 |
-
</div> <!-- .postbox -->
|
1187 |
-
|
1188 |
-
<?php do_action('em_options_page_footer_pages'); ?>
|
1189 |
-
|
1190 |
-
</div> <!-- .em-menu-pages -->
|
1191 |
-
|
1192 |
-
<!-- FORMAT OPTIONS -->
|
1193 |
-
<div class="em-menu-formats em-menu-group" style="display:none;">
|
1194 |
-
<div class="postbox " id="em-opt-events-formats" >
|
1195 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Events', 'dbem' ); ?> </span></h3>
|
1196 |
-
<div class="inside">
|
1197 |
-
<table class="form-table">
|
1198 |
-
<tr class="em-header"><td colspan="2">
|
1199 |
-
<h4><?php echo sprintf(__('%s Page','dbem'),__('Events','dbem')); ?></h4>
|
1200 |
-
<p><?php _e('These formats will be used on your events page. This will also be used if you do not provide specified formats in other event lists, like in shortcodes.','dbem'); ?></p>
|
1201 |
-
</td></tr>
|
1202 |
-
<?php
|
1203 |
-
$grouby_modes = array(0=>__('None','dbem'), 'yearly'=>__('Yearly','dbem'), 'monthly'=>__('Monthly','dbem'), 'weekly'=>__('Weekly','dbem'), 'daily'=>__('Daily','dbem'));
|
1204 |
-
em_options_select(__('Events page grouping','dbem'), 'dbem_event_list_groupby', $grouby_modes, __('If you choose a group by mode, your events page will display events in groups of your chosen time range.','dbem'));
|
1205 |
-
em_options_input_text(__('Events page grouping header','dbem'), 'dbem_event_list_groupby_header_format', __('Choose how to format your group headings.','dbem').' '. sprintf(__('#s will be replaced by the date format below', 'dbem'), 'http://codex.wordpress.org/Formatting_Date_and_Time'));
|
1206 |
-
em_options_input_text(__('Events page grouping date format','dbem'), 'dbem_event_list_groupby_format', __('Choose how to format your group heading dates. Leave blank for default.','dbem').' '. sprintf(__('Date and Time formats follow the <a href="%s">WordPress time formatting conventions</a>', 'dbem'), 'http://codex.wordpress.org/Formatting_Date_and_Time'));
|
1207 |
-
em_options_textarea ( __( 'Default event list format header', 'dbem' ), 'dbem_event_list_item_format_header', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
|
1208 |
-
em_options_textarea ( __( 'Default event list format', 'dbem' ), 'dbem_event_list_item_format', __( 'The format of any events in a list.', 'dbem' ).$events_placeholder_tip );
|
1209 |
-
em_options_textarea ( __( 'Default event list format footer', 'dbem' ), 'dbem_event_list_item_format_footer', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
|
1210 |
-
em_options_input_text ( __( 'No events message', 'dbem' ), 'dbem_no_events_message', __( 'The message displayed when no events are available.', 'dbem' ) );
|
1211 |
-
em_options_input_text ( __( 'List events by date title', 'dbem' ), 'dbem_list_date_title', __( 'If viewing a page for events on a specific date, this is the title that would show up. To insert date values, use <a href="http://www.php.net/manual/en/function.date.php">PHP time format characters</a> with a <code>#</code> symbol before them, i.e. <code>#m</code>, <code>#M</code>, <code>#j</code>, etc.<br/>', 'dbem' ) );
|
1212 |
-
?>
|
1213 |
-
<tr class="em-header">
|
1214 |
-
<td colspan="2">
|
1215 |
-
<h4><?php echo sprintf(__('Single %s Page','dbem'),__('Event','dbem')); ?></h4>
|
1216 |
-
<em><?php echo sprintf(__('These formats can be used on %s pages or on other areas of your site displaying an %s.','dbem'),__('event','dbem'),__('event','dbem'));?></em>
|
1217 |
-
</tr>
|
1218 |
-
<?php
|
1219 |
-
if( EM_MS_GLOBAL && !get_option('dbem_ms_global_events_links') ){
|
1220 |
-
em_options_input_text ( sprintf(__( 'Single %s title format', 'dbem' ),__('event','dbem')), 'dbem_event_page_title_format', sprintf(__( 'The format of a single %s page title.', 'dbem' ),__('event','dbem')).' '.__( 'This is only used when showing events from other blogs.', 'dbem' ).$events_placeholder_tip );
|
1221 |
-
}
|
1222 |
-
em_options_textarea ( sprintf(__('Single %s page format', 'dbem' ),__('event','dbem')), 'dbem_single_event_format', sprintf(__( 'The format used to display %s content on single pages or elsewhere on your site.', 'dbem' ),__('event','dbem')).$events_placeholder_tip );
|
1223 |
-
?>
|
1224 |
-
<tr class="em-header">
|
1225 |
-
<td colspan="2">
|
1226 |
-
<h4><?php echo sprintf(__('%s Excerpts','dbem'),__('Event','dbem')); ?></h4>
|
1227 |
-
<em><?php echo sprintf(__('These formats can be used when WordPress automatically displays %s excerpts on your site and %s is enabled in your %s settings tab.','dbem'),__('event','dbem'),'<strong>'.__( 'Override Excerpts with Formats?', 'dbem' ).'</strong>','<a href="#formats" class="nav-tab-link" rel="#em-menu-pages">'.__('Pages','dbem').' > '.sprintf(__('%s List/Archives','dbem'),__('Event','dbem')).'</a>');?></em>
|
1228 |
-
</td>
|
1229 |
-
</tr>
|
1230 |
-
<?php
|
1231 |
-
em_options_textarea ( sprintf(__('%s excerpt', 'dbem' ),__('Event','dbem')), 'dbem_event_excerpt_format', __( 'Used if an excerpt has been defined.', 'dbem' ).$events_placeholder_tip );
|
1232 |
-
em_options_textarea ( sprintf(__('%s excerpt fallback', 'dbem' ),__('Event','dbem')), 'dbem_event_excerpt_alt_format', __( 'Used if an excerpt has not been defined.', 'dbem' ).$events_placeholder_tip );
|
1233 |
-
|
1234 |
-
echo $save_button;
|
1235 |
-
?>
|
1236 |
-
</table>
|
1237 |
-
</div> <!-- . inside -->
|
1238 |
-
</div> <!-- .postbox -->
|
1239 |
-
|
1240 |
-
<div class="postbox " id="em-opt-search-form" >
|
1241 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Search Form', 'dbem' ); ?> </span></h3>
|
1242 |
-
<div class="inside">
|
1243 |
-
<table class="form-table em-search-form-main">
|
1244 |
-
<tr class="em-header"><td colspan="2"><h4><?php _e('Main Search Fields','dbem'); ?></h4></td></tr>
|
1245 |
-
<tbody class="em-subsection">
|
1246 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Search', 'dbem' ); ?></h5></td></tr>
|
1247 |
-
<?php
|
1248 |
-
em_options_radio_binary ( __( 'Show text search?', 'dbem' ), 'dbem_search_form_text', '', '', '#dbem_search_form_text_label_row' );
|
1249 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_text_label', __('Appears within the input box.','dbem') );
|
1250 |
-
?>
|
1251 |
-
</tbody>
|
1252 |
-
<tbody class="em-settings-geocoding em-subsection">
|
1253 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Geolocation Search', 'dbem' ); ?></h5></td></tr>
|
1254 |
-
<?php
|
1255 |
-
em_options_radio_binary ( __( 'Show geolocation search?', 'dbem' ), 'dbem_search_form_geo', '', '', '#dbem_search_form_geo_label_row, #dbem_search_form_geo_distance_default_row, #dbem_search_form_geo_unit_default_row' );
|
1256 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_geo_label', __('Appears within the input box.','dbem') );
|
1257 |
-
em_options_input_text ( __( 'Default distance', 'dbem' ), 'dbem_search_form_geo_distance_default', __('Enter a number.','dbem'), '');
|
1258 |
-
em_options_select ( __( 'Default distance unit', 'dbem' ), 'dbem_search_form_geo_unit_default', array('km'=>'km','mi'=>'mi'), '');
|
1259 |
-
?>
|
1260 |
-
</tbody>
|
1261 |
-
</table>
|
1262 |
-
<table class="form-table">
|
1263 |
-
<tr class="em-header"><td colspan="2"><h4><?php _e('Advanced Search Fields','dbem'); ?></h4></td></tr>
|
1264 |
-
<?php
|
1265 |
-
em_options_radio_binary ( __( 'Enable advanced fields?', 'dbem' ), 'dbem_search_form_advanced', __('Enables additional advanced search fields such as dates, country, etc.','dbem'), '', '.em-search-form-advanced' );
|
1266 |
-
?>
|
1267 |
-
<tbody class="em-search-form-advanced">
|
1268 |
-
<?php
|
1269 |
-
em_options_input_text ( __( 'Search button text', 'dbem' ), 'dbem_search_form_submit', __("If there's no fields to show in the main search section, this button will be used instead at the bottom of the advanced fields.",'dbem'));
|
1270 |
-
em_options_radio_binary ( __( 'Hidden by default?', 'dbem' ), 'dbem_search_form_advanced_hidden', __('If set to yes, advanced search fields will be hidden by default and can be revealed by clicking the "Advanced Search" link.','dbem'), '', '#dbem_search_form_advanced_show_row, #dbem_search_form_advanced_hide_row' );
|
1271 |
-
em_options_input_text ( __( 'Show label', 'dbem' ), 'dbem_search_form_advanced_show', __('Appears as the label for this search option.','dbem') );
|
1272 |
-
em_options_input_text ( __( 'Hide label', 'dbem' ), 'dbem_search_form_advanced_hide', __('Appears as the label for this search option.','dbem') );
|
1273 |
-
?>
|
1274 |
-
</tbody>
|
1275 |
-
<tbody class="em-search-form-advanced em-subsection">
|
1276 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Dates', 'dbem' ); ?></h5></td></tr>
|
1277 |
-
<?php
|
1278 |
-
em_options_radio_binary ( __( 'Show date range?', 'dbem' ), 'dbem_search_form_dates', '', '', '#dbem_search_form_dates_label_row, #dbem_search_form_dates_separator_row' );
|
1279 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_dates_label', __('Appears as the label for this search option.','dbem') );
|
1280 |
-
em_options_input_text ( __( 'Date Separator', 'dbem' ), 'dbem_search_form_dates_separator', sprintf(__( 'For when start/end %s are present, this will seperate the two (include spaces here if necessary).', 'dbem' ), __('dates','dbem')) );
|
1281 |
-
?>
|
1282 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Category', 'dbem' ); ?></h5></td></tr>
|
1283 |
-
<?php
|
1284 |
-
em_options_radio_binary ( __( 'Show categories?', 'dbem' ), 'dbem_search_form_categories', '', '', '#dbem_search_form_category_label_row, #dbem_search_form_categories_label_row' );
|
1285 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_category_label', __('Appears as the label for this search option.','dbem') );
|
1286 |
-
em_options_input_text ( __( 'Categories dropdown label', 'dbem' ), 'dbem_search_form_categories_label', __('Appears as the first default search option.','dbem') );
|
1287 |
-
?>
|
1288 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Geolocation Search', 'dbem' ); ?></h5></td></tr>
|
1289 |
-
<?php
|
1290 |
-
em_options_radio_binary ( __( 'Show distance options?', 'dbem' ), 'dbem_search_form_geo_units', '', '', '#dbem_search_form_geo_units_label_row, #dbem_search_form_geo_distance_options_row' );
|
1291 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_geo_units_label', __('Appears as the label for this search option.','dbem') );
|
1292 |
-
em_options_input_text ( __( 'Distance Values', 'dbem' ), 'dbem_search_form_geo_distance_options', __('The numerical units shown to those searching by distance. Use comma-seperated numers, such as "25,50,100".','dbem') );
|
1293 |
-
?>
|
1294 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Country', 'dbem' ); ?></h5></td></tr>
|
1295 |
-
<?php
|
1296 |
-
em_options_radio_binary ( __( 'Show countries?', 'dbem' ), 'dbem_search_form_countries', '', '', '#dbem_search_form_country_label_row, #dbem_search_form_countries_label_row' );
|
1297 |
-
em_options_select ( __( 'Default Country', 'dbem' ), 'dbem_search_form_default_country', em_get_countries(__('no default country', 'dbem')), __('Search form will be pre-selected with this country, if searching by country is disabled above, only search results from this country will be returned.','dbem') );
|
1298 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_country_label', __('Appears as the label for this search option.','dbem') );
|
1299 |
-
em_options_input_text ( __( 'All countries text', 'dbem' ), 'dbem_search_form_countries_label', __('Appears as the first default search option.','dbem') );
|
1300 |
-
?>
|
1301 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Region', 'dbem' ); ?></h5></td></tr>
|
1302 |
-
<?php
|
1303 |
-
em_options_radio_binary ( __( 'Show regions?', 'dbem' ), 'dbem_search_form_regions', '', '', '#dbem_search_form_region_label_row, #dbem_search_form_regions_label_row' );
|
1304 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_region_label', __('Appears as the label for this search option.','dbem') );
|
1305 |
-
em_options_input_text ( __( 'All regions text', 'dbem' ), 'dbem_search_form_regions_label', __('Appears as the first default search option.','dbem') );
|
1306 |
-
?>
|
1307 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'State/County', 'dbem' ); ?></h5></td></tr>
|
1308 |
-
<?php
|
1309 |
-
em_options_radio_binary ( __( 'Show states?', 'dbem' ), 'dbem_search_form_states', '', '', '#dbem_search_form_state_label_row, #dbem_search_form_states_label_row' );
|
1310 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_state_label', __('Appears as the label for this search option.','dbem') );
|
1311 |
-
em_options_input_text ( __( 'All states text', 'dbem' ), 'dbem_search_form_states_label', __('Appears as the first default search option.','dbem') );
|
1312 |
-
?>
|
1313 |
-
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'City/Town', 'dbem' ); ?></h5></td></tr>
|
1314 |
-
<?php
|
1315 |
-
em_options_radio_binary ( __( 'Show towns/cities?', 'dbem' ), 'dbem_search_form_towns', '', '', '#dbem_search_form_town_label_row, #dbem_search_form_towns_label_row' );
|
1316 |
-
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_town_label', __('Appears as the label for this search option.','dbem') );
|
1317 |
-
em_options_input_text ( __( 'All towns/cities text', 'dbem' ), 'dbem_search_form_towns_label', __('Appears as the first default search option.','dbem') );
|
1318 |
-
?>
|
1319 |
-
</tbody>
|
1320 |
-
<?php echo $save_button; ?>
|
1321 |
-
</table>
|
1322 |
-
</div> <!-- . inside -->
|
1323 |
-
</div> <!-- .postbox -->
|
1324 |
-
|
1325 |
-
<div class="postbox " id="em-opt-date-time" >
|
1326 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Date/Time', 'dbem' ); ?> </span></h3>
|
1327 |
-
<div class="inside">
|
1328 |
-
<p class="em-boxheader"><?php
|
1329 |
-
$date_time_format_tip = sprintf(__('Date and Time formats follow the <a href="%s">WordPress time formatting conventions</a>', 'dbem'), 'http://codex.wordpress.org/Formatting_Date_and_Time');
|
1330 |
-
echo $date_time_format_tip;
|
1331 |
-
?></p>
|
1332 |
-
<table class="form-table">
|
1333 |
-
<?php
|
1334 |
-
em_options_input_text ( __( 'Date Format', 'dbem' ), 'dbem_date_format', sprintf(__('For use with the %s placeholder','dbem'),'<code>#_EVENTDATES</code>') );
|
1335 |
-
em_options_input_text ( __( 'Date Picker Format', 'dbem' ), 'dbem_date_format_js', sprintf(__( 'Same as <em>Date Format</em>, but this is used for the datepickers used by Events Manager. This uses a slightly different format to the others on here, for a list of characters to use, visit the <a href="%s">jQuery formatDate reference</a>', 'dbem' ),'http://docs.jquery.com/UI/Datepicker/formatDate') );
|
1336 |
-
em_options_input_text ( __( 'Date Separator', 'dbem' ), 'dbem_dates_separator', sprintf(__( 'For when start/end %s are present, this will seperate the two (include spaces here if necessary).', 'dbem' ), __('dates','dbem')) );
|
1337 |
-
em_options_input_text ( __( 'Time Format', 'dbem' ), 'dbem_time_format', sprintf(__('For use with the %s placeholder','dbem'),'<code>#_EVENTTIMES</code>') );
|
1338 |
-
em_options_input_text ( __( 'Time Separator', 'dbem' ), 'dbem_times_separator', sprintf(__( 'For when start/end %s are present, this will seperate the two (include spaces here if necessary).', 'dbem' ), __('times','dbem')) );
|
1339 |
-
em_options_input_text ( __( 'All Day Message', 'dbem' ), 'dbem_event_all_day_message', sprintf(__( 'If an event lasts all day, this text will show if using the %s placeholder', 'dbem' ), '<code>#_EVENTTIMES</code>') );
|
1340 |
-
em_options_radio_binary ( __( 'Use 24h Format?', 'dbem' ), 'dbem_time_24h', __( 'When creating events, would you like your times to be shown in 24 hour format?', 'dbem' ) );
|
1341 |
-
echo $save_button;
|
1342 |
-
?>
|
1343 |
-
</table>
|
1344 |
-
</div> <!-- . inside -->
|
1345 |
-
</div> <!-- .postbox -->
|
1346 |
-
|
1347 |
-
<div class="postbox " id="em-opt-calendar-formats" >
|
1348 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Calendar', 'dbem' ); ?></span></h3>
|
1349 |
-
<div class="inside">
|
1350 |
-
<table class="form-table">
|
1351 |
-
<?php
|
1352 |
-
em_options_radio_binary ( __( 'Link directly to event on day with single event?', 'dbem' ), '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).",'dbem' ) );
|
1353 |
-
em_options_radio_binary ( __( 'Show list on day with single event?', 'dbem' ), 'dbem_display_calendar_day_single', __( "By default, if a calendar day only has one event, it display a single event when clicking on the link of that calendar date. If you select Yes here, you will get always see a list of events.",'dbem' ) );
|
1354 |
-
?>
|
1355 |
-
<tr class="em-header"><td colspan="2"><h4><?php _e('Small Calendar','dbem'); ?></h4></td></tr>
|
1356 |
-
<?php
|
1357 |
-
em_options_input_text ( __( 'Month format', 'dbem' ), 'dbem_small_calendar_month_format', __('The format of the month/year header of the calendar.','dbem').' '.$date_time_format_tip);
|
1358 |
-
em_options_input_text ( __( 'Event titles', 'dbem' ), 'dbem_small_calendar_event_title_format', __( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ).$events_placeholder_tip );
|
1359 |
-
em_options_input_text ( __( 'Title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
|
1360 |
-
em_options_radio_binary( __( 'Abbreviated weekdays', 'dbem' ), 'dbem_small_calendar_abbreviated_weekdays', __( 'The calendar headings uses abbreviated weekdays','dbem') );
|
1361 |
-
em_options_input_text ( __( 'Initial lengths', 'dbem' ), 'dbem_small_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'dbem' ).$events_placeholder_tip );
|
1362 |
-
?>
|
1363 |
-
<tr class="em-header"><td colspan="2"><h4><?php _e('Full Calendar','dbem'); ?></h4></td></tr>
|
1364 |
-
<?php
|
1365 |
-
em_options_input_text ( __( 'Month format', 'dbem' ), 'dbem_full_calendar_month_format', __('The format of the month/year header of the calendar.','dbem').' '.$date_time_format_tip);
|
1366 |
-
em_options_input_text ( __( 'Event format', 'dbem' ), 'dbem_full_calendar_event_format', __( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ).$events_placeholder_tip );
|
1367 |
-
em_options_radio_binary( __( 'Abbreviated weekdays?', 'dbem' ), 'dbem_full_calendar_abbreviated_weekdays', __( 'Use abbreviations, e.g. Friday = Fri. Useful for certain languages where abbreviations differ from full names.','dbem') );
|
1368 |
-
em_options_input_text ( __( 'Initial lengths', 'dbem' ), 'dbem_full_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'dbem' ).$events_placeholder_tip);
|
1369 |
-
?>
|
1370 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo __('Calendar Day Event List Settings','dbem'); ?></h4></td></tr>
|
1371 |
-
<tr valign="top" id='dbem_display_calendar_orderby_row'>
|
1372 |
-
<th scope="row"><?php _e('Default event list ordering','dbem'); ?></th>
|
1373 |
-
<td>
|
1374 |
-
<select name="dbem_display_calendar_orderby" >
|
1375 |
-
<?php
|
1376 |
-
$orderby_options = apply_filters('dbem_display_calendar_orderby_ddm', array(
|
1377 |
-
'event_name,event_start_time' => __('Order by event name, then event start time','dbem'),
|
1378 |
-
'event_start_time,event_name' => __('Order by event start time, then event name','dbem')
|
1379 |
-
));
|
1380 |
-
?>
|
1381 |
-
<?php foreach($orderby_options as $key => $value) : ?>
|
1382 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_display_calendar_orderby')) ? "selected='selected'" : ''; ?>>
|
1383 |
-
<?php echo esc_html($value) ?>
|
1384 |
-
</option>
|
1385 |
-
<?php endforeach; ?>
|
1386 |
-
</select>
|
1387 |
-
<select name="dbem_display_calendar_order" >
|
1388 |
-
<?php
|
1389 |
-
$ascending = __('Ascending','dbem');
|
1390 |
-
$descending = __('Descending','dbem');
|
1391 |
-
$order_options = apply_filters('dbem_display_calendar_order_ddm', array(
|
1392 |
-
'ASC' => __('All Ascending','dbem'),
|
1393 |
-
'DESC,ASC' => "$descending, $ascending",
|
1394 |
-
'DESC,DESC' => "$descending, $descending",
|
1395 |
-
'DESC' => __('All Descending','dbem')
|
1396 |
-
));
|
1397 |
-
?>
|
1398 |
-
<?php foreach( $order_options as $key => $value) : ?>
|
1399 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_display_calendar_order')) ? "selected='selected'" : ''; ?>>
|
1400 |
-
<?php echo esc_html($value) ?>
|
1401 |
-
</option>
|
1402 |
-
<?php endforeach; ?>
|
1403 |
-
</select>
|
1404 |
-
<br/>
|
1405 |
-
<em><?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?></em>
|
1406 |
-
</td>
|
1407 |
-
</tr>
|
1408 |
-
<?php
|
1409 |
-
em_options_input_text ( __( 'Calendar events/day limit', 'dbem' ), 'dbem_display_calendar_events_limit', __( 'Limits the number of events on each calendar day. Leave blank for no limit.', 'dbem' ) );
|
1410 |
-
em_options_input_text ( __( 'More Events message', 'dbem' ), 'dbem_display_calendar_events_limit_msg', __( 'Text with link to calendar day page with all events for that day if there are more events than the limit above, leave blank for no link as the day number is also a link.', 'dbem' ) );
|
1411 |
-
?>
|
1412 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('iCal Feed Settings','dbem'),__('Event','dbem')); ?></h4></td></tr>
|
1413 |
-
<?php
|
1414 |
-
em_options_input_text ( __( 'iCal Title', 'dbem' ), 'dbem_ical_description_format', __( 'The title that will appear in the calendar.', 'dbem' ).$events_placeholder_tip );
|
1415 |
-
em_options_input_text ( __( 'iCal Description', 'dbem' ), 'dbem_ical_real_description_format', __( 'The description of the event that will appear in the calendar.', 'dbem' ).$events_placeholder_tip );
|
1416 |
-
em_options_input_text ( __( 'iCal Location', 'dbem' ), 'dbem_ical_location_format', __( 'The location information that will appear in the calendar.', 'dbem' ).$events_placeholder_tip );
|
1417 |
-
em_options_select( __('iCal Scope','dbem'), 'dbem_ical_scope', em_get_scopes(), __('Choose to show events within a specific time range.','dbem'));
|
1418 |
-
em_options_input_text ( __( 'iCal Limit', 'dbem' ), 'dbem_ical_limit', __( 'Limits the number of future events shown (0 = unlimited).', 'dbem' ) );
|
1419 |
-
echo $save_button;
|
1420 |
-
?>
|
1421 |
-
</table>
|
1422 |
-
</div> <!-- . inside -->
|
1423 |
-
</div> <!-- .postbox -->
|
1424 |
-
|
1425 |
-
<?php if( get_option('dbem_locations_enabled') ): ?>
|
1426 |
-
<div class="postbox " id="em-opt-locations-formats" >
|
1427 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Locations', 'dbem' ); ?> </span></h3>
|
1428 |
-
<div class="inside">
|
1429 |
-
<table class="form-table">
|
1430 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','dbem'),__('Locations','dbem')); ?></h4></td></tr>
|
1431 |
-
<?php
|
1432 |
-
em_options_textarea ( sprintf(__('%s list header format','dbem'),__('Locations','dbem')), 'dbem_location_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'dbem' ), __('locations','dbem')) );
|
1433 |
-
em_options_textarea ( sprintf(__('%s list item format','dbem'),__('Locations','dbem')), 'dbem_location_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'dbem' ), __('locations','dbem')).$locations_placeholder_tip );
|
1434 |
-
em_options_textarea ( sprintf(__('%s list footer format','dbem'),__('Locations','dbem')), 'dbem_location_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'dbem' ), __('locations','dbem')) );
|
1435 |
-
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('Locations','dbem')), 'dbem_no_locations_message', sprintf( __( 'The message displayed when no %s are available.', 'dbem' ), __('locations','dbem')) );
|
1436 |
-
?>
|
1437 |
-
<tr class="em-header">
|
1438 |
-
<td colspan="2">
|
1439 |
-
<h4><?php echo sprintf(__('Single %s Page','dbem'),__('Location','dbem')); ?></h4>
|
1440 |
-
<em><?php echo sprintf(__('These formats can be used on %s pages or on other areas of your site displaying an %s.','dbem'),__('location','dbem'),__('location','dbem'));?></em>
|
1441 |
-
</tr>
|
1442 |
-
<?php
|
1443 |
-
if( EM_MS_GLOBAL && get_option('dbem_ms_global_location_links') ){
|
1444 |
-
em_options_input_text (sprintf( __( 'Single %s title format', 'dbem' ),__('location','dbem')), 'dbem_location_page_title_format', sprintf(__( 'The format of a single %s page title.', 'dbem' ),__('location','dbem')).$locations_placeholder_tip );
|
1445 |
-
}
|
1446 |
-
em_options_textarea ( sprintf(__('Single %s page format', 'dbem' ),__('location','dbem')), 'dbem_single_location_format', sprintf(__( 'The format of a single %s page.', 'dbem' ),__('location','dbem')).$locations_placeholder_tip );
|
1447 |
-
?>
|
1448 |
-
<tr class="em-header">
|
1449 |
-
<td colspan="2">
|
1450 |
-
<h4><?php echo sprintf(__('%s Excerpts','dbem'),__('Location','dbem')); ?></h4>
|
1451 |
-
<em><?php echo sprintf(__('These formats can be used when WordPress automatically displays %s excerpts on your site and %s is enabled in your %s settings tab.','dbem'),__('location','dbem'),'<strong>'.__( 'Override Excerpts with Formats?', 'dbem' ).'</strong>','<a href="#formats" class="nav-tab-link" rel="#em-menu-pages">'.__('Pages','dbem').' > '.sprintf(__('%s List/Archives','dbem'),__('Location','dbem')).'</a>');?></em>
|
1452 |
-
</td>
|
1453 |
-
</tr>
|
1454 |
-
<?php
|
1455 |
-
em_options_textarea ( sprintf(__('%s excerpt', 'dbem' ),__('Location','dbem')), 'dbem_location_excerpt_format', __( 'Used if an excerpt has been defined.', 'dbem' ).$locations_placeholder_tip );
|
1456 |
-
em_options_textarea ( sprintf(__('%s excerpt fallback', 'dbem' ),__('Location','dbem')), 'dbem_location_excerpt_alt_format', __( 'Used if an excerpt has not been defined.', 'dbem' ).$locations_placeholder_tip );
|
1457 |
-
?>
|
1458 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','dbem'),__('Event','dbem')); ?></h4></td></tr>
|
1459 |
-
<?php
|
1460 |
-
em_options_input_text ( __( 'Default event list format header', 'dbem' ), 'dbem_location_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
|
1461 |
-
em_options_textarea ( sprintf(__( 'Default %s list format', 'dbem' ),__('events','dbem')), 'dbem_location_event_list_item_format', sprintf(__( 'The format of the events the list inserted in the location page through the %s element.', 'dbem' ).$events_placeholder_tip, '<code>#_LOCATIONNEXTEVENTS</code>, <code>#_LOCATIONPASTEVENTS</code>, <code>#_LOCATIONALLEVENTS</code>') );
|
1462 |
-
em_options_input_text ( __( 'Default event list format footer', 'dbem' ), 'dbem_location_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
|
1463 |
-
em_options_textarea ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_location_no_events_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_LOCATIONNEXTEVENTS</code>, <code>#_LOCATIONPASTEVENTS</code>, <code>#_LOCATIONALLEVENTS</code>') );
|
1464 |
-
?>
|
1465 |
-
<tr class="em-header"><td colspan="2">
|
1466 |
-
<h4><?php echo sprintf(__('Single %s Format','dbem'),__('Event','dbem')); ?></h4>
|
1467 |
-
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','dbem'), '<code>#_LOCATIONNEXTEVENT</code>'); ?></p>
|
1468 |
-
</td></tr>
|
1469 |
-
<?php
|
1470 |
-
em_options_input_text ( __( 'Next event format', 'dbem' ), 'dbem_location_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'dbem' ),__('location','dbem')).$events_placeholder_tip );
|
1471 |
-
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_location_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_LOCATIONNEXTEVENT</code>') );
|
1472 |
-
echo $save_button;
|
1473 |
-
?>
|
1474 |
-
</table>
|
1475 |
-
</div> <!-- . inside -->
|
1476 |
-
</div> <!-- .postbox -->
|
1477 |
-
<?php endif; ?>
|
1478 |
-
|
1479 |
-
<?php if( get_option('dbem_categories_enabled') && !(EM_MS_GLOBAL && !is_main_site()) ): ?>
|
1480 |
-
<div class="postbox " id="em-opt-categories-formats" >
|
1481 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Event Categories', 'dbem' ); ?> </span></h3>
|
1482 |
-
<div class="inside">
|
1483 |
-
<table class="form-table">
|
1484 |
-
<?php
|
1485 |
-
em_options_input_text(sprintf(esc_html__('Default %s color','dbem'), esc_html__('category','dbem')), 'dbem_category_default_color', sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'dbem'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>'));
|
1486 |
-
?>
|
1487 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','dbem'),__('Categories','dbem')); ?></h4></td></tr>
|
1488 |
-
<?php
|
1489 |
-
em_options_textarea ( sprintf(__('%s list header format','dbem'),__('Categories','dbem')), 'dbem_categories_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'dbem' ), __('categories','dbem')) );
|
1490 |
-
em_options_textarea ( sprintf(__('%s list item format','dbem'),__('Categories','dbem')), 'dbem_categories_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'dbem' ), __('categories','dbem')).$categories_placeholder_tip );
|
1491 |
-
em_options_textarea ( sprintf(__('%s list footer format','dbem'),__('Categories','dbem')), 'dbem_categories_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'dbem' ), __('categories','dbem')) );
|
1492 |
-
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('Categories','dbem')), 'dbem_no_categories_message', sprintf( __( 'The message displayed when no %s are available.', 'dbem' ), __('categories','dbem')) );
|
1493 |
-
?>
|
1494 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('Single %s Page','dbem'),__('Category','dbem')); ?></h4></td></tr>
|
1495 |
-
<?php
|
1496 |
-
em_options_input_text ( sprintf(__( 'Single %s title format', 'dbem' ),__('category','dbem')), 'dbem_category_page_title_format', __( 'The format of a single category page title.', 'dbem' ).$categories_placeholder_tip );
|
1497 |
-
em_options_textarea ( sprintf(__('Single %s page format', 'dbem' ),__('category','dbem')), 'dbem_category_page_format', sprintf(__( 'The format of a single %s page.', 'dbem' ),__('category','dbem')).$categories_placeholder_tip );
|
1498 |
-
?>
|
1499 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','dbem'),__('Event','dbem')); ?></h4></td></tr>
|
1500 |
-
<?php
|
1501 |
-
em_options_input_text ( __( 'Default event list format header', 'dbem' ), 'dbem_category_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
|
1502 |
-
em_options_textarea ( sprintf(__( 'Default %s list format', 'dbem' ),__('events','dbem')), 'dbem_category_event_list_item_format', sprintf(__( 'The format of the events the list inserted in the category page through the %s element.', 'dbem' ).$events_placeholder_tip, '<code>#_CATEGORYPASTEVENTS</code>, <code>#_CATEGORYNEXTEVENTS</code>, <code>#_CATEGORYALLEVENTS</code>') );
|
1503 |
-
em_options_input_text ( __( 'Default event list format footer', 'dbem' ), 'dbem_category_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
|
1504 |
-
em_options_textarea ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_category_no_events_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_CATEGORYPASTEVENTS</code>, <code>#_CATEGORYNEXTEVENTS</code>, <code>#_CATEGORYALLEVENTS</code>') );
|
1505 |
-
?>
|
1506 |
-
<tr class="em-header"><td colspan="2">
|
1507 |
-
<h4><?php echo sprintf(__('Single %s Format','dbem'),__('Event','dbem')); ?></h4>
|
1508 |
-
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','dbem'), '<code>#_CATEGORYNEXTEVENT</code>'); ?></p>
|
1509 |
-
</td></tr>
|
1510 |
-
<?php
|
1511 |
-
em_options_input_text ( __( 'Next event format', 'dbem' ), 'dbem_category_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'dbem' ),__('category','dbem')).$events_placeholder_tip );
|
1512 |
-
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_category_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_CATEGORYNEXTEVENT</code>') );
|
1513 |
-
echo $save_button;
|
1514 |
-
?>
|
1515 |
-
</table>
|
1516 |
-
</div> <!-- . inside -->
|
1517 |
-
</div> <!-- .postbox -->
|
1518 |
-
<?php endif; ?>
|
1519 |
-
|
1520 |
-
<?php if( get_option('dbem_tags_enabled') ): ?>
|
1521 |
-
<div class="postbox " id="em-opt-tags-formats" >
|
1522 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Event Tags', 'dbem' ); ?> </span></h3>
|
1523 |
-
<div class="inside">
|
1524 |
-
<table class="form-table">
|
1525 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','dbem'),__('Tags','dbem')); ?></h4></td></tr>
|
1526 |
-
<?php
|
1527 |
-
em_options_textarea ( sprintf(__('%s list header format','dbem'),__('Tags','dbem')), 'dbem_tags_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'dbem' ), __('tags','dbem')) );
|
1528 |
-
em_options_textarea ( sprintf(__('%s list item format','dbem'),__('Tags','dbem')), 'dbem_tags_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'dbem' ), __('tags','dbem')).$categories_placeholder_tip );
|
1529 |
-
em_options_textarea ( sprintf(__('%s list footer format','dbem'),__('Tags','dbem')), 'dbem_tags_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'dbem' ), __('tags','dbem')) );
|
1530 |
-
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('Tags','dbem')), 'dbem_no_tags_message', sprintf( __( 'The message displayed when no %s are available.', 'dbem' ), __('tags','dbem')) );
|
1531 |
-
?>
|
1532 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('Single %s Page','dbem'),__('Tag','dbem')); ?></h4></td></tr>
|
1533 |
-
<?php
|
1534 |
-
em_options_input_text ( sprintf(__( 'Single %s title format', 'dbem' ),__('tag','dbem')), 'dbem_tag_page_title_format', __( 'The format of a single tag page title.', 'dbem' ).$categories_placeholder_tip );
|
1535 |
-
em_options_textarea ( sprintf(__('Single %s page format', 'dbem' ),__('tag','dbem')), 'dbem_tag_page_format', sprintf(__( 'The format of a single %s page.', 'dbem' ),__('tag','dbem')).$categories_placeholder_tip );
|
1536 |
-
?>
|
1537 |
-
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','dbem'),__('Event','dbem')); ?></h4></td></tr>
|
1538 |
-
<?php
|
1539 |
-
em_options_input_text ( __( 'Default event list format header', 'dbem' ), 'dbem_tag_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
|
1540 |
-
em_options_textarea ( sprintf(__( 'Default %s list format', 'dbem' ),__('events','dbem')), 'dbem_tag_event_list_item_format', __( 'The format of the events the list inserted in the tag page through the <code>#_TAGNEXTEVENTS</code>, <code>#_TAGNEXTEVENTS</code> and <code>#_TAGALLEVENTS</code> element.', 'dbem' ).$categories_placeholder_tip );
|
1541 |
-
em_options_input_text ( __( 'Default event list format footer', 'dbem' ), 'dbem_tag_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
|
1542 |
-
em_options_textarea ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_tag_no_events_message', __( 'The message to be displayed in the list generated by <code>#_TAGNEXTEVENTS</code>, <code>#_TAGNEXTEVENTS</code> and <code>#_TAGALLEVENTS</code> when no events are available.', 'dbem' ) );
|
1543 |
-
?>
|
1544 |
-
<tr class="em-header"><td colspan="2">
|
1545 |
-
<h4><?php echo sprintf(__('Single %s Format','dbem'),__('Event','dbem')); ?></h4>
|
1546 |
-
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','dbem'), '<code>#_TAGNEXTEVENT</code>'); ?></p>
|
1547 |
-
</td></tr>
|
1548 |
-
<?php
|
1549 |
-
em_options_input_text ( __( 'Next event format', 'dbem' ), 'dbem_tag_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'dbem' ),__('tag','dbem')).$events_placeholder_tip );
|
1550 |
-
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_tag_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_CATEGORYNEXTEVENT</code>') );
|
1551 |
-
echo $save_button;
|
1552 |
-
?>
|
1553 |
-
</table>
|
1554 |
-
</div> <!-- . inside -->
|
1555 |
-
</div> <!-- .postbox -->
|
1556 |
-
<?php endif; ?>
|
1557 |
-
|
1558 |
-
<div class="postbox " id="em-opt-rss-formats" >
|
1559 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'RSS', 'dbem' ); ?> </span></h3>
|
1560 |
-
<div class="inside">
|
1561 |
-
<table class="form-table">
|
1562 |
-
<?php
|
1563 |
-
em_options_input_text ( __( 'RSS main title', 'dbem' ), 'dbem_rss_main_title', __( 'The main title of your RSS events feed.', 'dbem' ).$events_placeholder_tip );
|
1564 |
-
em_options_input_text ( __( 'RSS main description', 'dbem' ), 'dbem_rss_main_description', __( 'The main description of your RSS events feed.', 'dbem' ) );
|
1565 |
-
em_options_input_text ( __( 'RSS title format', 'dbem' ), 'dbem_rss_title_format', __( 'The format of the title of each item in the events RSS feed.', 'dbem' ).$events_placeholder_tip );
|
1566 |
-
em_options_input_text ( __( 'RSS description format', 'dbem' ), 'dbem_rss_description_format', __( 'The format of the description of each item in the events RSS feed.', 'dbem' ).$events_placeholder_tip );
|
1567 |
-
em_options_input_text ( __( 'RSS limit', 'dbem' ), 'dbem_rss_limit', __( 'Limits the number of future events shown (0 = unlimited).', 'dbem' ) );
|
1568 |
-
em_options_select( __('RSS Scope','dbem'), 'dbem_rss_scope', em_get_scopes(), __('Choose to show events within a specific time range.','dbem'));
|
1569 |
-
?>
|
1570 |
-
<tr valign="top" id='dbem_rss_orderby_row'>
|
1571 |
-
<th scope="row"><?php _e('Default event list ordering','dbem'); ?></th>
|
1572 |
-
<td>
|
1573 |
-
<select name="dbem_rss_orderby" >
|
1574 |
-
<?php
|
1575 |
-
$orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
|
1576 |
-
'event_start_date,event_start_time,event_name' => __('Order by start date, start time, then event name','dbem'),
|
1577 |
-
'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time','dbem'),
|
1578 |
-
'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time','dbem'),
|
1579 |
-
'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name','dbem'),
|
1580 |
-
));
|
1581 |
-
?>
|
1582 |
-
<?php foreach($orderby_options as $key => $value) : ?>
|
1583 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_rss_orderby')) ? "selected='selected'" : ''; ?>>
|
1584 |
-
<?php echo esc_html($value); ?>
|
1585 |
-
</option>
|
1586 |
-
<?php endforeach; ?>
|
1587 |
-
</select>
|
1588 |
-
<select name="dbem_rss_order" >
|
1589 |
-
<?php
|
1590 |
-
$ascending = __('Ascending','dbem');
|
1591 |
-
$descending = __('Descending','dbem');
|
1592 |
-
$order_options = apply_filters('em_settings_events_default_order_ddm', array(
|
1593 |
-
'ASC' => __('All Ascending','dbem'),
|
1594 |
-
'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'dbem'),
|
1595 |
-
'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'dbem'),
|
1596 |
-
'DESC' => __('All Descending','dbem'),
|
1597 |
-
'ASC,DESC,ASC' => __("$ascending, $descending, $ascending",'dbem'),
|
1598 |
-
'ASC,DESC,DESC' => __("$ascending, $descending, $descending",'dbem'),
|
1599 |
-
'ASC,ASC,DESC' => __("$ascending, $ascending, $descending",'dbem'),
|
1600 |
-
'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'dbem'),
|
1601 |
-
));
|
1602 |
-
?>
|
1603 |
-
<?php foreach( $order_options as $key => $value) : ?>
|
1604 |
-
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_rss_order')) ? "selected='selected'" : ''; ?>>
|
1605 |
-
<?php echo esc_html($value); ?>
|
1606 |
-
</option>
|
1607 |
-
<?php endforeach; ?>
|
1608 |
-
</select>
|
1609 |
-
<br/>
|
1610 |
-
<em><?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?></em>
|
1611 |
-
</td>
|
1612 |
-
</tr>
|
1613 |
-
<?php
|
1614 |
-
echo $save_button;
|
1615 |
-
?>
|
1616 |
-
</table>
|
1617 |
-
</div> <!-- . inside -->
|
1618 |
-
</div> <!-- .postbox -->
|
1619 |
-
|
1620 |
-
<div class="postbox " id="em-opt-maps-formats" >
|
1621 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Maps', 'dbem' ); ?> </span></h3>
|
1622 |
-
<div class="inside">
|
1623 |
-
<p class="em-boxheader"><?php echo sprintf(__('You can use Google Maps to show where your events are located. For more information on using maps, <a href="%s">see our documentation</a>.','dbem'),'http://wp-events-plugin.com/documentation/google-maps/'); ?>
|
1624 |
-
<table class='form-table'>
|
1625 |
-
<?php $gmap_is_active = get_option ( 'dbem_gmap_is_active' ); ?>
|
1626 |
-
<tr valign="top">
|
1627 |
-
<th scope="row"><?php _e ( 'Enable Google Maps integration?', 'dbem' ); ?></th>
|
1628 |
-
<td>
|
1629 |
-
<?php _e ( 'Yes' ); ?> <input id="dbem_gmap_is_active_yes" name="dbem_gmap_is_active" type="radio" value="1" <?php echo ($gmap_is_active) ? "checked='checked'":''; ?> />
|
1630 |
-
<?php _e ( 'No' ); ?> <input name="dbem_gmap_is_active" type="radio" value="0" <?php echo ($gmap_is_active) ? '':"checked='checked'"; ?> /><br />
|
1631 |
-
<em><?php _e ( 'Check this option to enable Goggle Map integration.', 'dbem' )?></em>
|
1632 |
-
</td>
|
1633 |
-
<?php em_options_input_text(__('Default map width','dbem'), 'dbem_map_default_width', sprintf(__('Can be in form of pixels or a percentage such as %s or %s.', 'dbem'), '<code>100%</code>', '<code>100px</code>')); ?>
|
1634 |
-
<?php em_options_input_text(__('Default map height','dbem'), 'dbem_map_default_height', sprintf(__('Can be in form of pixels or a percentage such as %s or %s.', 'dbem'), '<code>100%</code>', '<code>100px</code>')); ?>
|
1635 |
-
</tr>
|
1636 |
-
<tr class="em-header"><td colspan="2">
|
1637 |
-
<h4><?php _e('Global Map Format','dbem'); ?></h4>
|
1638 |
-
<p><?php echo sprintf(__('If you use the %s <a href="%s">shortcode</a>, you can display a map of all your locations and events, the settings below will be used.','dbem'), '<code>[locations_map]</code>','http://wp-events-plugin.com/documentation/shortcodes/'); ?></p>
|
1639 |
-
</td></tr>
|
1640 |
-
<?php
|
1641 |
-
em_options_textarea ( __( 'Location balloon format', 'dbem' ), 'dbem_map_text_format', __( 'The format of of the text appearing in the balloon describing the location.', 'dbem' ).' '.__( 'Event.', 'dbem' ).$locations_placeholder_tip );
|
1642 |
-
?>
|
1643 |
-
<tr class="em-header"><td colspan="2">
|
1644 |
-
<h4><?php _e('Single Location/Event Map Format','dbem'); ?></h4>
|
1645 |
-
<p><?php echo sprintf(_e('If you use the <code>#_LOCATIONMAP</code> <a href="%s">placeholder</a> when displaying individual event and location information, the settings below will be used.','dbem'), '<code>[locations_map]</code>','http://wp-events-plugin.com/documentation/placeholders/'); ?></p>
|
1646 |
-
</td></tr>
|
1647 |
-
<?php
|
1648 |
-
em_options_textarea ( __( 'Location balloon format', 'dbem' ), 'dbem_location_baloon_format', __( 'The format of of the text appearing in the balloon describing the location.', 'dbem' ).$events_placeholder_tip );
|
1649 |
-
echo $save_button;
|
1650 |
-
?>
|
1651 |
-
</table>
|
1652 |
-
</div> <!-- . inside -->
|
1653 |
-
</div> <!-- .postbox -->
|
1654 |
-
|
1655 |
-
<?php do_action('em_options_page_footer_formats'); ?>
|
1656 |
-
|
1657 |
-
</div> <!-- .em-menu-formats -->
|
1658 |
-
|
1659 |
-
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
1660 |
-
<!-- BOOKING OPTIONS -->
|
1661 |
-
<div class="em-menu-bookings em-menu-group" style="display:none;">
|
1662 |
-
|
1663 |
-
<div class="postbox " id="em-opt-bookings-general" >
|
1664 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'dbem' ),__('General','dbem')); ?> </span></h3>
|
1665 |
-
<div class="inside">
|
1666 |
-
<table class='form-table'>
|
1667 |
-
<?php
|
1668 |
-
em_options_radio_binary ( __( 'Allow guest bookings?', 'dbem' ), 'dbem_bookings_anonymous', __( 'If enabled, guest visitors can supply an email address and a user account will automatically be created for them along with their booking. They will be also be able to log back in with that newly created account.', 'dbem' ) );
|
1669 |
-
em_options_radio_binary ( __( 'Approval Required?', 'dbem' ), 'dbem_bookings_approval', __( 'Bookings will not be confirmed until the event administrator approves it.', 'dbem' ).' '.__( 'This setting is not applicable when using payment gateways, see individual gateways for approval settings.', 'dbem' ));
|
1670 |
-
em_options_radio_binary ( __( 'Reserved unconfirmed spaces?', 'dbem' ), 'dbem_bookings_approval_reserved', __( 'By default, event spaces become unavailable once there are enough CONFIRMED bookings. To reserve spaces even if unnapproved, choose yes.', 'dbem' ) );
|
1671 |
-
em_options_radio_binary ( __( 'Can users cancel their booking?', 'dbem' ), 'dbem_bookings_user_cancellation', __( 'If enabled, users can cancel their bookings themselves from their bookings page.', 'dbem' ) );
|
1672 |
-
em_options_radio_binary ( __( 'Allow overbooking when approving?', 'dbem' ), 'dbem_bookings_approval_overbooking', __( 'If you get a lot of pending bookings and you decide to allow more bookings than spaces allow, setting this to yes will allow you to override the event space limit when manually approving.', 'dbem' ) );
|
1673 |
-
em_options_radio_binary ( __( 'Allow double bookings?', 'dbem' ), 'dbem_bookings_double', __( 'If enabled, users can book an event more than once.', 'dbem' ) );
|
1674 |
-
echo $save_button;
|
1675 |
-
?>
|
1676 |
-
</table>
|
1677 |
-
</div> <!-- . inside -->
|
1678 |
-
</div> <!-- .postbox -->
|
1679 |
-
|
1680 |
-
<div class="postbox " id="em-opt-pricing-options" >
|
1681 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'dbem' ),__('Pricing','dbem')); ?> </span></h3>
|
1682 |
-
<div class="inside">
|
1683 |
-
<table class='form-table'>
|
1684 |
-
<?php
|
1685 |
-
/* Tax & Currency */
|
1686 |
-
em_options_select ( __( 'Currency', 'dbem' ), 'dbem_bookings_currency', em_get_currencies()->names, __( 'Choose your currency for displaying event pricing.', 'dbem' ) );
|
1687 |
-
em_options_input_text ( __( 'Thousands Separator', 'dbem' ), 'dbem_bookings_currency_thousands_sep', '<code>'.get_option('dbem_bookings_currency_thousands_sep')." = ".em_get_currency_symbol().'100<strong>'.get_option('dbem_bookings_currency_thousands_sep').'</strong>000<strong>'.get_option('dbem_bookings_currency_decimal_point').'</strong>00</code>' );
|
1688 |
-
em_options_input_text ( __( 'Decimal Point', 'dbem' ), 'dbem_bookings_currency_decimal_point', '<code>'.get_option('dbem_bookings_currency_decimal_point')." = ".em_get_currency_symbol().'100<strong>'.get_option('dbem_bookings_currency_decimal_point').'</strong>00</code>' );
|
1689 |
-
em_options_input_text ( __( 'Currency Format', 'dbem' ), 'dbem_bookings_currency_format', __('Choose how prices are displayed. <code>@</code> will be replaced by the currency symbol, and <code>#</code> will be replaced by the number.','dbem').' <code>'.get_option('dbem_bookings_currency_format')." = ".em_get_currency_formatted('10000000').'</code>');
|
1690 |
-
em_options_input_text ( __( 'Tax Rate', 'dbem' ), 'dbem_bookings_tax', __( 'Add a tax rate to your ticket prices (entering 10 will add 10% to the ticket price).', 'dbem' ) );
|
1691 |
-
em_options_radio_binary ( __( 'Add tax to ticket price?', 'dbem' ), 'dbem_bookings_tax_auto_add', __( 'When displaying ticket prices and booking totals, include the tax automatically?', 'dbem' ) );
|
1692 |
-
echo $save_button;
|
1693 |
-
?>
|
1694 |
-
</table>
|
1695 |
-
</div> <!-- . inside -->
|
1696 |
-
</div> <!-- .postbox -->
|
1697 |
-
|
1698 |
-
<div class="postbox " id="em-opt-booking-feedbacks" >
|
1699 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e( 'Customize Feedback Messages', 'dbem' ); ?> </span></h3>
|
1700 |
-
<div class="inside">
|
1701 |
-
<p><?php _e('Below you will find texts that will be displayed to users in various areas during the bookings process, particularly on booking forms.','dbem'); ?></p>
|
1702 |
-
<table class='form-table'>
|
1703 |
-
<tr class="em-header"><td colspan='2'><h4><?php _e('My Bookings messages','dbem') ?></h4></td></tr>
|
1704 |
-
<?php
|
1705 |
-
em_options_input_text ( __( 'Booking Cancelled', 'dbem' ), 'dbem_booking_feedback_cancelled', __( 'When a user cancels their booking, this message will be displayed confirming the cancellation.', 'dbem' ) );
|
1706 |
-
em_options_input_text ( __( 'Booking Cancellation Warning', 'dbem' ), 'dbem_booking_warning_cancel', __( 'When a user chooses to cancel a booking, this warning is displayed for them to confirm.', 'dbem' ) );
|
1707 |
-
?>
|
1708 |
-
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking form texts/messages','dbem') ?></h4></td></tr>
|
1709 |
-
<?php
|
1710 |
-
em_options_input_text ( __( 'Bookings disabled', 'dbem' ), 'dbem_bookings_form_msg_disabled', __( 'An event with no bookings.', 'dbem' ) );
|
1711 |
-
em_options_input_text ( __( 'Bookings closed', 'dbem' ), 'dbem_bookings_form_msg_closed', __( 'Bookings have closed (e.g. event has started).', 'dbem' ) );
|
1712 |
-
em_options_input_text ( __( 'Fully booked', 'dbem' ), 'dbem_bookings_form_msg_full', __( 'Event is fully booked.', 'dbem' ) );
|
1713 |
-
em_options_input_text ( __( 'Already attending', 'dbem' ), 'dbem_bookings_form_msg_attending', __( 'If already attending and double bookings are disabled, this message will be displayed, followed by a link to the users booking page.', 'dbem' ) );
|
1714 |
-
em_options_input_text ( __( 'Manage bookings link text', 'dbem' ), 'dbem_bookings_form_msg_bookings_link', __( 'Link text used for link to user bookings.', 'dbem' ) );
|
1715 |
-
?>
|
1716 |
-
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking form feedback messages','dbem') ?></h4></td></tr>
|
1717 |
-
<tr><td colspan='2'><?php _e('When a booking is made by a user, a feedback message is shown depending on the result, which can be customized below.','dbem'); ?></td></tr>
|
1718 |
-
<?php
|
1719 |
-
em_options_input_text ( __( 'Successful booking', 'dbem' ), 'dbem_booking_feedback', __( 'When a booking is registered and confirmed.', 'dbem' ) );
|
1720 |
-
em_options_input_text ( __( 'Successful pending booking', 'dbem' ), 'dbem_booking_feedback_pending', __( 'When a booking is registered but pending.', 'dbem' ) );
|
1721 |
-
em_options_input_text ( __( 'Not enough spaces', 'dbem' ), 'dbem_booking_feedback_full', __( 'When a booking cannot be made due to lack of spaces.', 'dbem' ) );
|
1722 |
-
em_options_input_text ( __( 'Errors', 'dbem' ), 'dbem_booking_feedback_error', __( 'When a booking cannot be made due to an error when filling the form. Below this, there will be a dynamic list of errors.', 'dbem' ) );
|
1723 |
-
em_options_input_text ( __( 'Email Exists', 'dbem' ), 'dbem_booking_feedback_email_exists', __( 'When a guest tries to book using an email registered with a user account.', 'dbem' ) );
|
1724 |
-
em_options_input_text ( __( 'User must log in', 'dbem' ), 'dbem_booking_feedback_log_in', __( 'When a user must log in before making a booking.', 'dbem' ) );
|
1725 |
-
em_options_input_text ( __( 'Error mailing user', 'dbem' ), 'dbem_booking_feedback_nomail', __( 'If a booking is made and an email cannot be sent, this is added to the success message.', 'dbem' ) );
|
1726 |
-
em_options_input_text ( __( 'Already booked', 'dbem' ), 'dbem_booking_feedback_already_booked', __( 'If the user made a previous booking and cannot double-book.', 'dbem' ) );
|
1727 |
-
em_options_input_text ( __( 'No spaces booked', 'dbem' ), 'dbem_booking_feedback_min_space', __( 'If the user tries to make a booking without requesting any spaces.', 'dbem' ) );$notice_full = __('Sold Out', 'dbem');
|
1728 |
-
em_options_input_text ( __( 'Maximum spaces per booking', 'dbem' ), 'dbem_booking_feedback_spaces_limit', __( 'If the user tries to make a booking with spaces that exceeds the maximum number of spaces per booking.', 'dbem' ).' '. __('%d will be replaced by a number.','dbem') );
|
1729 |
-
?>
|
1730 |
-
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking button feedback messages','dbem') ?></h4></td></tr>
|
1731 |
-
<tr><td colspan='2'><?php echo sprintf(__('When the %s placeholder, the below texts will be used.','dbem'),'<code>#_BOOKINGBUTTON</code>'); ?></td></tr>
|
1732 |
-
<?php
|
1733 |
-
em_options_input_text ( __( 'User can book', 'dbem' ), 'dbem_booking_button_msg_book', '');
|
1734 |
-
em_options_input_text ( __( 'Booking in progress', 'dbem' ), 'dbem_booking_button_msg_booking', '');
|
1735 |
-
em_options_input_text ( __( 'Booking complete', 'dbem' ), 'dbem_booking_button_msg_booked', '');
|
1736 |
-
em_options_input_text ( __( 'Booking already made', 'dbem' ), 'dbem_booking_button_msg_already_booked', '');
|
1737 |
-
em_options_input_text ( __( 'Booking error', 'dbem' ), 'dbem_booking_button_msg_error', '');
|
1738 |
-
em_options_input_text ( __( 'Event fully booked', 'dbem' ), 'dbem_booking_button_msg_full', '');
|
1739 |
-
em_options_input_text ( __( 'Cancel', 'dbem' ), 'dbem_booking_button_msg_cancel', '');
|
1740 |
-
em_options_input_text ( __( 'Cancelation in progress', 'dbem' ), 'dbem_booking_button_msg_canceling', '');
|
1741 |
-
em_options_input_text ( __( 'Cancelation complete', 'dbem' ), 'dbem_booking_button_msg_cancelled', '');
|
1742 |
-
em_options_input_text ( __( 'Cancelation error', 'dbem' ), 'dbem_booking_button_msg_cancel_error', '');
|
1743 |
-
|
1744 |
-
echo $save_button;
|
1745 |
-
?>
|
1746 |
-
</table>
|
1747 |
-
</div> <!-- . inside -->
|
1748 |
-
</div> <!-- .postbox -->
|
1749 |
-
|
1750 |
-
<div class="postbox " id="em-opt-booking-form-options" >
|
1751 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'dbem' ),__('Booking Form','dbem')); ?> </span></h3>
|
1752 |
-
<div class="inside">
|
1753 |
-
<table class='form-table'>
|
1754 |
-
<?php
|
1755 |
-
em_options_radio_binary ( __( 'Display login form?', 'dbem' ), 'dbem_bookings_login_form', __( 'Choose whether or not to display a login form in the booking form area to remind your members to log in before booking.', 'dbem' ) );
|
1756 |
-
em_options_input_text ( __( 'Submit button text', 'dbem' ), 'dbem_bookings_submit_button', sprintf(__( 'The text used by the submit button. To use an image instead, enter the full url starting with %s or %s.', 'dbem' ), '<code>http://</code>','<code>https://</code>') );
|
1757 |
-
do_action('em_options_booking_form_options');
|
1758 |
-
echo $save_button;
|
1759 |
-
?>
|
1760 |
-
</table>
|
1761 |
-
</div> <!-- . inside -->
|
1762 |
-
</div> <!-- .postbox -->
|
1763 |
-
|
1764 |
-
<div class="postbox " id="em-opt-ticket-options" >
|
1765 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'dbem' ),__('Ticket','dbem')); ?> </span></h3>
|
1766 |
-
<div class="inside">
|
1767 |
-
<table class='form-table'>
|
1768 |
-
<?php
|
1769 |
-
em_options_radio_binary ( __( 'Single ticket mode?', 'dbem' ), 'dbem_bookings_tickets_single', __( 'In single ticket mode, users can only create one ticket per event (and will not see options to add more tickets).', 'dbem' ) );
|
1770 |
-
em_options_radio_binary ( __( 'Show ticket table in single ticket mode?', 'dbem' ), 'dbem_bookings_tickets_single_form', __( 'If you prefer a ticket table like with multiple tickets, even for single ticket events, enable this.', 'dbem' ) );
|
1771 |
-
em_options_radio_binary ( __( 'Show unavailable tickets?', 'dbem' ), 'dbem_bookings_tickets_show_unavailable', __( 'You can choose whether or not to show unavailable tickets to visitors.', 'dbem' ) );
|
1772 |
-
em_options_radio_binary ( __( 'Show member-only tickets?', 'dbem' ), 'dbem_bookings_tickets_show_member_tickets', sprintf(__('%s must be set to yes for this to work.', 'dbem' ), '<strong>'.__( 'Show unavailable tickets?', 'dbem' ).'</strong>').' '.__( 'If there are member-only tickets, you can choose whether or not to show these tickets to guests.','dbem') );
|
1773 |
-
|
1774 |
-
em_options_radio_binary ( __( 'Show multiple tickets if logged out?', 'dbem' ), 'dbem_bookings_tickets_show_loggedout', __( 'If guests cannot make bookings, they will be asked to register in order to book. However, enabling this will still show available tickets.', 'dbem' ) );
|
1775 |
-
$ticket_orders = array(
|
1776 |
-
'ticket_price DESC, ticket_name ASC'=>__('Ticket Price (Descending)','dbem'),
|
1777 |
-
'ticket_price ASC, ticket_name ASC'=>__('Ticket Price (Ascending)','dbem'),
|
1778 |
-
'ticket_name ASC, ticket_price DESC'=>__('Ticket Name (Ascending)','dbem'),
|
1779 |
-
'ticket_name DESC, ticket_price DESC'=>__('Ticket Name (Descending)','dbem')
|
1780 |
-
);
|
1781 |
-
em_options_select ( __( 'Order Tickets By', 'dbem' ), 'dbem_bookings_tickets_orderby', $ticket_orders, __( 'Choose which order your tickets appear.', 'dbem' ) );
|
1782 |
-
echo $save_button;
|
1783 |
-
?>
|
1784 |
-
</table>
|
1785 |
-
</div> <!-- . inside -->
|
1786 |
-
</div> <!-- .postbox -->
|
1787 |
-
|
1788 |
-
<div class="postbox " id="em-opt-no-user-bookings" >
|
1789 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e('No-User Booking Mode','dbem'); ?> </span></h3>
|
1790 |
-
<div class="inside">
|
1791 |
-
<table class='form-table'>
|
1792 |
-
<tr><td colspan='2'>
|
1793 |
-
<p><?php _e('By default, when a booking is made by a user, this booking is tied to a user account, if the user is not registered nor logged in and guest bookings are enabled, an account will be created for them.','dbem'); ?></p>
|
1794 |
-
<p><?php _e('The option below allows you to disable user accounts and assign all bookings to a parent user, yet you will still see the supplied booking personal information for each booking. When this mode is enabled, extra booking information about the person is stored alongside the booking record rather than as a WordPress user.','dbem'); ?></p>
|
1795 |
-
<p><?php _e('Users with accounts (which would be created by other means when this mode is enabled) will still be able to log in and make bookings linked to their account as normal.','dbem'); ?></p>
|
1796 |
-
<p><?php _e('<strong>Warning : </strong> Various features afforded to users with an account will not be available, e.g. viewing bookings. Once you enable this and select a user, modifying these values will prevent older non-user bookings from displaying the correct information.','dbem'); ?></p>
|
1797 |
-
</td></tr>
|
1798 |
-
<?php
|
1799 |
-
em_options_radio_binary ( __( 'Enable No-User Booking Mode?', 'dbem' ), 'dbem_bookings_registration_disable', __( 'This disables user registrations for bookings.', 'dbem' ) );
|
1800 |
-
em_options_radio_binary ( __( 'Allow bookings with registered emails?', 'dbem' ), 'dbem_bookings_registration_disable_user_emails', __( 'By default, if a guest tries to book an event using the email of a user account on your site they will be asked to log in, selecting yes will bypass this security measure.', 'dbem' ).'<br />'.__('<strong>Warning : </strong> By enabling this, registered users will not be able to see bookings they make as guests in their "My Bookings" page.','dbem') );
|
1801 |
-
$current_user = array();
|
1802 |
-
if( get_option('dbem_bookings_registration_user') ){
|
1803 |
-
$user = get_user_by('id',get_option('dbem_bookings_registration_user'));
|
1804 |
-
$current_user[$user->ID] = $user->display_name;
|
1805 |
-
}
|
1806 |
-
if( defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS') && EM_OPTIMIZE_SETTINGS_PAGE_USERS ){
|
1807 |
-
em_options_input_text ( __( 'Assign bookings to', 'dbem' ), 'dbem_bookings_registration_user', __('Please add a User ID.','dbem').' '.__( 'Choose a parent user to assign bookings to. People making their booking will be unaware of this and will never have access to those user details. This should be a subscriber user you do not use to log in with yourself.', 'dbem' ) );
|
1808 |
-
}else{
|
1809 |
-
em_options_select ( __( 'Assign bookings to', 'dbem' ), 'dbem_bookings_registration_user', em_get_wp_users(array('role' => 'subscriber'), $current_user), __( 'Choose a parent user to assign bookings to. People making their booking will be unaware of this and will never have access to those user details. This should be a subscriber user you do not use to log in with yourself.', 'dbem' ) );
|
1810 |
-
}
|
1811 |
-
echo $save_button;
|
1812 |
-
?>
|
1813 |
-
</table>
|
1814 |
-
</div> <!-- . inside -->
|
1815 |
-
</div> <!-- .postbox -->
|
1816 |
-
|
1817 |
-
<?php do_action('em_options_page_footer_bookings'); ?>
|
1818 |
-
|
1819 |
-
</div> <!-- .em-menu-bookings -->
|
1820 |
-
<?php endif; ?>
|
1821 |
-
|
1822 |
-
<!-- EMAIL OPTIONS -->
|
1823 |
-
<div class="em-menu-emails em-menu-group" style="display:none;">
|
1824 |
-
|
1825 |
-
<?php if ( !is_multisite() ) { em_admin_option_box_email(); } ?>
|
1826 |
-
|
1827 |
-
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
1828 |
-
<div class="postbox " id="em-opt-booking-emails">
|
1829 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Booking Email Templates', 'dbem' ); ?> </span></h3>
|
1830 |
-
<div class="inside">
|
1831 |
-
<?php do_action('em_options_page_booking_email_templates_options_top'); ?>
|
1832 |
-
<table class='form-table'>
|
1833 |
-
<?php
|
1834 |
-
$email_subject_tip = __('You can disable this email by leaving the subject blank.','dbem');
|
1835 |
-
em_options_input_text ( __( 'Email events admin?', 'dbem' ), 'dbem_bookings_notify_admin', __( "If you would like every event booking confirmation email sent to an administrator write their email here (leave blank to not send an email).", 'dbem' ).' '.__('For multiple emails, seperate by commas (e.g. email1@test.com,email2@test.com,etc.)','dbem') );
|
1836 |
-
em_options_radio_binary ( __( 'Email event owner?', 'dbem' ), 'dbem_bookings_contact_email', __( 'Check this option if you want the event contact to receive an email when someone books places. An email will be sent when a booking is first made (regardless if confirmed or pending)', 'dbem' ) );
|
1837 |
-
?>
|
1838 |
-
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Admin/Owner Emails', 'dbem'); ?></h4></td></tr>
|
1839 |
-
<tbody class="em-subsection">
|
1840 |
-
<tr class="em-subheader"><td colspan='2'>
|
1841 |
-
<h5><?php _e('Confirmed booking email','dbem') ?></h5>
|
1842 |
-
<em><?php echo __('This is sent when a person\'s booking is confirmed. This will be sent automatically if approvals are required and the booking is approved. If approvals are disabled, this is sent out when a user first submits their booking.','dbem').$bookings_placeholder_tip ?></em>
|
1843 |
-
</td></tr>
|
1844 |
-
<?php
|
1845 |
-
em_options_input_text ( __( 'Booking confirmed email subject', 'dbem' ), 'dbem_bookings_contact_email_confirmed_subject', $email_subject_tip );
|
1846 |
-
em_options_textarea ( __( 'Booking confirmed email', 'dbem' ), 'dbem_bookings_contact_email_confirmed_body', '' );
|
1847 |
-
?>
|
1848 |
-
<tr class="em-subheader"><td colspan='2'>
|
1849 |
-
<h5><?php _e('Pending booking email','dbem') ?></h5>
|
1850 |
-
<em><?php echo __('This is sent when a person\'s booking is pending. If approvals are enabled, this is sent out when a user first submits their booking.','dbem').$bookings_placeholder_tip ?></em>
|
1851 |
-
</td></tr>
|
1852 |
-
<?php
|
1853 |
-
em_options_input_text ( __( 'Booking pending email subject', 'dbem' ), 'dbem_bookings_contact_email_pending_subject', $email_subject_tip );
|
1854 |
-
em_options_textarea ( __( 'Booking pending email', 'dbem' ), 'dbem_bookings_contact_email_pending_body', '' );
|
1855 |
-
?>
|
1856 |
-
<tr class="em-subheader"><td colspan='2'>
|
1857 |
-
<h5><?php _e('Booking cancelled','dbem') ?></h5>
|
1858 |
-
<em><?php echo __('An email will be sent to the event contact if someone cancels their booking.','dbem').$bookings_placeholder_tip ?></em>
|
1859 |
-
</td></tr>
|
1860 |
-
<?php
|
1861 |
-
em_options_input_text ( __( 'Booking cancelled email subject', 'dbem' ), 'dbem_bookings_contact_email_cancelled_subject', $email_subject_tip );
|
1862 |
-
em_options_textarea ( __( 'Booking cancelled email', 'dbem' ), 'dbem_bookings_contact_email_cancelled_body', '' );
|
1863 |
-
?>
|
1864 |
-
<tr class="em-subheader"><td colspan='2'>
|
1865 |
-
<h5><?php _e('Rejected booking email','dbem') ?></h5>
|
1866 |
-
<em><?php echo __( 'This will be sent to event admins when a booking is rejected.', 'dbem' ).$bookings_placeholder_tip ?></em>
|
1867 |
-
</td></tr>
|
1868 |
-
<?php
|
1869 |
-
em_options_input_text ( __( 'Booking rejected email subject', 'dbem' ), 'dbem_bookings_contact_email_rejected_subject', $email_subject_tip );
|
1870 |
-
em_options_textarea ( __( 'Booking rejected email', 'dbem' ), 'dbem_bookings_contact_email_rejected_body', '' );
|
1871 |
-
?>
|
1872 |
-
</tbody>
|
1873 |
-
<tr class="em-header"><td colspan='2'><h4><?php _e('Booked User Emails', 'dbem'); ?></h4></td></tr>
|
1874 |
-
<tbody class="em-subsection">
|
1875 |
-
<tr class="em-subheader"><td colspan='2'>
|
1876 |
-
<h5><?php _e('Confirmed booking email','dbem') ?></h5>
|
1877 |
-
<em><?php echo __('This is sent when a person\'s booking is confirmed. This will be sent automatically if approvals are required and the booking is approved. If approvals are disabled, this is sent out when a user first submits their booking.','dbem').$bookings_placeholder_tip ?></em>
|
1878 |
-
</td></tr>
|
1879 |
-
<?php
|
1880 |
-
em_options_input_text ( __( 'Booking confirmed email subject', 'dbem' ), 'dbem_bookings_email_confirmed_subject', $email_subject_tip );
|
1881 |
-
em_options_textarea ( __( 'Booking confirmed email', 'dbem' ), 'dbem_bookings_email_confirmed_body', '' );
|
1882 |
-
?>
|
1883 |
-
<tr class="em-subheader"><td colspan='2'>
|
1884 |
-
<h5><?php _e('Pending booking email','dbem') ?></h5>
|
1885 |
-
<em><?php echo __( 'This will be sent to the person when they first submit their booking. Not relevant if bookings don\'t require approval.', 'dbem' ).$bookings_placeholder_tip ?></em>
|
1886 |
-
</td></tr>
|
1887 |
-
<?php
|
1888 |
-
em_options_input_text ( __( 'Booking pending email subject', 'dbem' ), 'dbem_bookings_email_pending_subject', $email_subject_tip);
|
1889 |
-
em_options_textarea ( __( 'Booking pending email', 'dbem' ), 'dbem_bookings_email_pending_body','') ;
|
1890 |
-
?>
|
1891 |
-
<tr class="em-subheader"><td colspan='2'>
|
1892 |
-
<h5><?php _e('Rejected booking email','dbem') ?></h5>
|
1893 |
-
<em><?php echo __( 'This will be sent automatically when a booking is rejected. Not relevant if bookings don\'t require approval.', 'dbem' ).$bookings_placeholder_tip ?></em>
|
1894 |
-
</td></tr>
|
1895 |
-
<?php
|
1896 |
-
em_options_input_text ( __( 'Booking rejected email subject', 'dbem' ), 'dbem_bookings_email_rejected_subject', $email_subject_tip );
|
1897 |
-
em_options_textarea ( __( 'Booking rejected email', 'dbem' ), 'dbem_bookings_email_rejected_body', '' );
|
1898 |
-
?>
|
1899 |
-
<tr class="em-subheader"><td colspan='2'>
|
1900 |
-
<h5><?php _e('Booking cancelled','dbem') ?></h5>
|
1901 |
-
<em><?php echo __('This will be sent when a user cancels their booking.','dbem').$bookings_placeholder_tip ?></em>
|
1902 |
-
</td></tr>
|
1903 |
-
<?php
|
1904 |
-
em_options_input_text ( __( 'Booking cancelled email subject', 'dbem' ), 'dbem_bookings_email_cancelled_subject', $email_subject_tip );
|
1905 |
-
em_options_textarea ( __( 'Booking cancelled email', 'dbem' ), 'dbem_bookings_email_cancelled_body', '' );
|
1906 |
-
?>
|
1907 |
-
</tbody>
|
1908 |
-
<?php do_action('em_options_page_booking_email_templates_options_bottom'); ?>
|
1909 |
-
<?php echo $save_button; ?>
|
1910 |
-
</table>
|
1911 |
-
</div> <!-- . inside -->
|
1912 |
-
</div> <!-- .postbox -->
|
1913 |
-
<?php endif; ?>
|
1914 |
-
|
1915 |
-
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
1916 |
-
<div class="postbox " id="em-opt-registration-emails">
|
1917 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Registration Email Templates', 'dbem' ); ?> </span></h3>
|
1918 |
-
<div class="inside">
|
1919 |
-
<p class="em-boxheader">
|
1920 |
-
<?php echo sprintf(__('This is only applicable when %s is not active.','dbem'), '<em>'.__('No-User Booking Mode','dbem').'</em>'); ?>
|
1921 |
-
<?php _e('When a guest user makes a booking for the first time in Events Manager, a new user account is created for them and they are sent their credentials in a seperate email, which can be modified below.','dbem'); ?>
|
1922 |
-
</p>
|
1923 |
-
<table class='form-table'>
|
1924 |
-
<?php
|
1925 |
-
em_options_radio_binary ( __( 'Disable new registration email?', 'dbem' ), 'dbem_email_disable_registration', __( 'Check this option if you want to prevent the WordPress registration email from going out when a user anonymously books an event.', 'dbem' ) );
|
1926 |
-
|
1927 |
-
em_options_input_text ( __( 'Registration email subject', 'dbem' ), 'dbem_bookings_email_registration_subject' );
|
1928 |
-
em_options_textarea ( __( 'Registration email', 'dbem' ), 'dbem_bookings_email_registration_body', sprintf(__('%s is replaced by username and %s is replaced by the user password.','dbem'),'<code>%username%</code>','<code>%password%</code>') );
|
1929 |
-
echo $save_button;
|
1930 |
-
?>
|
1931 |
-
</table>
|
1932 |
-
</div> <!-- . inside -->
|
1933 |
-
</div> <!-- .postbox -->
|
1934 |
-
<?php endif; ?>
|
1935 |
-
|
1936 |
-
<div class="postbox " id="em-opt-event-submission-emails" >
|
1937 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Event Submission Templates', 'dbem' ); ?> </span></h3>
|
1938 |
-
<div class="inside">
|
1939 |
-
<table class='form-table'>
|
1940 |
-
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Admin Emails', 'dbem'); ?></h4></td></tr>
|
1941 |
-
<?php
|
1942 |
-
em_options_input_text ( __( 'Administrator Email', 'dbem' ), 'dbem_event_submitted_email_admin', __('Event submission notifications will be sent to emails added here.','dbem').' '.__('If left blank, no emails will be sent. Seperate emails with commas for more than one email.','dbem') );
|
1943 |
-
?>
|
1944 |
-
<tbody class="em-subsection">
|
1945 |
-
<tr class="em-subheader"><td colspan='2'>
|
1946 |
-
<h5><?php _e('Event Submitted','dbem') ?></h5>
|
1947 |
-
<em><?php echo __('An email will be sent to your administrator emails when an event is submitted and pending approval.','dbem').$bookings_placeholder_tip ?></em>
|
1948 |
-
</td></tr>
|
1949 |
-
<?php
|
1950 |
-
em_options_input_text ( __( 'Event submitted subject', 'dbem' ), 'dbem_event_submitted_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
1951 |
-
em_options_textarea ( __( 'Event submitted email', 'dbem' ), 'dbem_event_submitted_email_body', '' );
|
1952 |
-
?>
|
1953 |
-
<tr class="em-subheader"><td colspan='2'>
|
1954 |
-
<h5><?php _e('Event Re-Submitted','dbem') ?></h5>
|
1955 |
-
<em><?php echo __('When a user modifies a previously published event, it will be put back into pending review status and will not be publisehd until you re-approve it.','dbem').$bookings_placeholder_tip ?></em>
|
1956 |
-
</td></tr>
|
1957 |
-
<?php
|
1958 |
-
em_options_input_text ( __( 'Event resubmitted subject', 'dbem' ), 'dbem_event_resubmitted_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
1959 |
-
em_options_textarea ( __( 'Event resubmitted email', 'dbem' ), 'dbem_event_resubmitted_email_body', '' );
|
1960 |
-
?>
|
1961 |
-
<tr class="em-subheader"><td colspan='2'>
|
1962 |
-
<h5><?php _e('Event Published','dbem') ?></h5>
|
1963 |
-
<em><?php echo __('An email will be sent to an administrator of your choice when an event is published by users who are not administrators.','dbem').$bookings_placeholder_tip ?>
|
1964 |
-
</td></tr>
|
1965 |
-
<?php
|
1966 |
-
em_options_input_text ( __( 'Event published subject', 'dbem' ), 'dbem_event_published_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
1967 |
-
em_options_textarea ( __( 'Event published email', 'dbem' ), 'dbem_event_published_email_body', '' );
|
1968 |
-
?>
|
1969 |
-
</tbody>
|
1970 |
-
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Submitter Emails', 'dbem'); ?></h4></td></tr>
|
1971 |
-
<tbody class="em-subsection">
|
1972 |
-
<tr class="em-subheader"><td colspan='2'>
|
1973 |
-
<h5><?php _e('Event Approved','dbem') ?></h5>
|
1974 |
-
<em><?php echo __('An email will be sent to the event owner when their event is approved. Users requiring event approval do not have the <code>publish_events</code> capability.','dbem').$bookings_placeholder_tip ?>
|
1975 |
-
</td></tr>
|
1976 |
-
<?php
|
1977 |
-
em_options_input_text ( __( 'Event approved subject', 'dbem' ), 'dbem_event_approved_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
1978 |
-
em_options_textarea ( __( 'Event approved email', 'dbem' ), 'dbem_event_approved_email_body', '' );
|
1979 |
-
?>
|
1980 |
-
<tr class="em-subheader"><td colspan='2'>
|
1981 |
-
<h5><?php _e('Event Reapproved','dbem') ?></h5>
|
1982 |
-
<?php echo __('When a user modifies a previously published event, it will be put back into pending review status and will not be publisehd until you re-approve it.','dbem').$bookings_placeholder_tip ?>
|
1983 |
-
</td></tr>
|
1984 |
-
<?php
|
1985 |
-
em_options_input_text ( __( 'Event reapproved subject', 'dbem' ), 'dbem_event_reapproved_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
1986 |
-
em_options_textarea ( __( 'Event reapproved email', 'dbem' ), 'dbem_event_reapproved_email_body', '' );
|
1987 |
-
?>
|
1988 |
-
</tbody>
|
1989 |
-
<?php echo $save_button; ?>
|
1990 |
-
</table>
|
1991 |
-
</div> <!-- . inside -->
|
1992 |
-
</div> <!-- .postbox -->
|
1993 |
-
|
1994 |
-
<?php do_action('em_options_page_footer_emails'); ?>
|
1995 |
-
|
1996 |
-
</div><!-- .em-group-emails -->
|
1997 |
-
<?php /*
|
1998 |
-
<div class="postbox " >
|
1999 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Debug Modes', 'dbem' ); ?> </span></h3>
|
2000 |
-
<div class="inside">
|
2001 |
-
<table class='form-table'>
|
2002 |
-
<?php
|
2003 |
-
em_options_radio_binary ( __( 'EM Debug Mode?', 'dbem' ), 'dbem_debug', __( 'Setting this to yes will display different content to admins for event pages and emails so you can see all the available placeholders and their values.', 'dbem' ) );
|
2004 |
-
em_options_radio_binary ( __( 'WP Debug Mode?', 'dbem' ), 'dbem_wp_debug', __( 'This will turn WP_DEBUG mode on. Useful if you want to troubleshoot php errors without looking at your logs.', 'dbem' ) );
|
2005 |
-
?>
|
2006 |
-
</table>
|
2007 |
-
</div> <!-- . inside -->
|
2008 |
-
</div> <!-- .postbox -->
|
2009 |
-
*/ ?>
|
2010 |
-
|
2011 |
-
<p class="submit">
|
2012 |
-
<input type="submit" id="dbem_options_submit" class="button-primary" name="Submit" value="<?php esc_attr_e( 'Save Changes', 'dbem' ); ?>" />
|
2013 |
-
<input type="hidden" name="em-submitted" value="1" />
|
2014 |
-
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('events-manager-options'); ?>" />
|
2015 |
-
</p>
|
2016 |
-
|
2017 |
-
</div> <!-- .metabox-sortables -->
|
2018 |
-
</div> <!-- .postbox-container -->
|
2019 |
-
|
2020 |
-
</div> <!-- .metabox-holder -->
|
2021 |
-
</form>
|
2022 |
-
</div>
|
2023 |
-
<?php
|
2024 |
-
}
|
2025 |
-
|
2026 |
-
/**
|
2027 |
-
* Meta options box for image sizes. Shared in both MS and Normal options page, hence it's own function
|
2028 |
-
*/
|
2029 |
-
function em_admin_option_box_image_sizes(){
|
2030 |
-
global $save_button;
|
2031 |
-
?>
|
2032 |
-
<div class="postbox " id="em-opt-image-sizes" >
|
2033 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Image Sizes', 'dbem' ); ?> </span></h3>
|
2034 |
-
<div class="inside">
|
2035 |
-
<p class="em-boxheader"><?php _e('These settings will only apply to the image uploading if using our front-end forms. In your WP admin area, images are handled by WordPress.','dbem'); ?></p>
|
2036 |
-
<table class='form-table'>
|
2037 |
-
<?php
|
2038 |
-
em_options_input_text ( __( 'Maximum width (px)', 'dbem' ), 'dbem_image_max_width', __( 'The maximum allowed width for images uploads', 'dbem' ) );
|
2039 |
-
em_options_input_text ( __( 'Minimum width (px)', 'dbem' ), 'dbem_image_min_width', __( 'The minimum allowed width for images uploads', 'dbem' ) );
|
2040 |
-
em_options_input_text ( __( 'Maximum height (px)', 'dbem' ), 'dbem_image_max_height', __( "The maximum allowed height for images uploaded, in pixels", 'dbem' ) );
|
2041 |
-
em_options_input_text ( __( 'Minimum height (px)', 'dbem' ), 'dbem_image_min_height', __( "The minimum allowed height for images uploaded, in pixels", 'dbem' ) );
|
2042 |
-
em_options_input_text ( __( 'Maximum size (bytes)', 'dbem' ), 'dbem_image_max_size', __( "The maximum allowed size for images uploaded, in bytes", 'dbem' ) );
|
2043 |
-
echo $save_button;
|
2044 |
-
?>
|
2045 |
-
</table>
|
2046 |
-
</div> <!-- . inside -->
|
2047 |
-
</div> <!-- .postbox -->
|
2048 |
-
<?php
|
2049 |
-
}
|
2050 |
-
|
2051 |
-
/**
|
2052 |
-
* Meta options box for email settings. Shared in both MS and Normal options page, hence it's own function
|
2053 |
-
*/
|
2054 |
-
function em_admin_option_box_email(){
|
2055 |
-
global $save_button;
|
2056 |
-
$current_user = get_user_by('id', get_current_user_id());
|
2057 |
-
?>
|
2058 |
-
<div class="postbox " id="em-opt-email-settings">
|
2059 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Email Settings', 'dbem' ); ?></span></h3>
|
2060 |
-
<div class="inside em-email-form">
|
2061 |
-
<p class="em-email-settings-check em-boxheader">
|
2062 |
-
<em><?php _e('Before you save your changes, you can quickly send yourself a test email by clicking this button.','dbem'); ?>
|
2063 |
-
<?php echo sprintf(__('A test email will be sent to your account email - %s','dbem'), $current_user->user_email . ' <a href="'.admin_url( 'profile.php' ).'">'.__('edit','dbem').'</a>'); ?></em><br />
|
2064 |
-
<input type="button" id="em-admin-check-email" class="secondary-button" value="<?php esc_attr_e('Test Email Settings','dbem'); ?>" />
|
2065 |
-
<input type="hidden" name="_check_email_nonce" value="<?php echo wp_create_nonce('check_email'); ?>" />
|
2066 |
-
<span id="em-email-settings-check-status"></span>
|
2067 |
-
</p>
|
2068 |
-
<table class="form-table">
|
2069 |
-
<?php
|
2070 |
-
em_options_input_text ( __( 'Notification sender name', 'dbem' ), 'dbem_mail_sender_name', __( "Insert the display name of the notification sender.", 'dbem' ) );
|
2071 |
-
em_options_input_text ( __( 'Notification sender address', 'dbem' ), 'dbem_mail_sender_address', __( "Insert the address of the notification sender.", 'dbem' ) );
|
2072 |
-
em_options_select ( __( 'Mail sending method', 'dbem' ), 'dbem_rsvp_mail_send_method', array ('smtp' => 'SMTP', 'mail' => __( 'PHP mail function', 'dbem' ), 'sendmail' => 'Sendmail', 'qmail' => 'Qmail', 'wp_mail' => 'WP Mail' ), __( 'Select the method to send email notification.', 'dbem' ) );
|
2073 |
-
em_options_radio_binary ( __( 'Send HTML Emails?', 'dbem' ), 'dbem_smtp_html', __( 'If set to yes, your emails will be sent in HTML format, otherwise plaintext.', 'dbem' ).' '.__( 'Depending on server settings, some sending methods may ignore this settings.', 'dbem' ) );
|
2074 |
-
em_options_radio_binary ( __( 'Add br tags to HTML emails?', 'dbem' ), 'dbem_smtp_html_br', __( 'If HTML emails are enabled, br tags will automatically be added for new lines.', 'dbem' ) );
|
2075 |
-
?>
|
2076 |
-
<tbody class="em-email-settings-smtp">
|
2077 |
-
<?php
|
2078 |
-
em_options_input_text ( 'Mail sending port', 'dbem_rsvp_mail_port', __( "The port through which you e-mail notifications will be sent. Make sure the firewall doesn't block this port", 'dbem' ) );
|
2079 |
-
em_options_radio_binary ( __( 'Use SMTP authentication?', 'dbem' ), 'dbem_rsvp_mail_SMTPAuth', __( 'SMTP authentication is often needed. If you use GMail, make sure to set this parameter to Yes', 'dbem' ) );
|
2080 |
-
em_options_input_text ( 'SMTP host', 'dbem_smtp_host', __( "The SMTP host. Usually it corresponds to 'localhost'. If you use GMail, set this value to 'ssl://smtp.gmail.com:465'.", 'dbem' ) );
|
2081 |
-
em_options_input_text ( __( 'SMTP username', 'dbem' ), 'dbem_smtp_username', __( "Insert the username to be used to access your SMTP server.", 'dbem' ) );
|
2082 |
-
em_options_input_password ( __( 'SMTP password', 'dbem' ), "dbem_smtp_password", __( "Insert the password to be used to access your SMTP server", 'dbem' ) );
|
2083 |
-
?>
|
2084 |
-
</tbody>
|
2085 |
-
<?php
|
2086 |
-
echo $save_button;
|
2087 |
-
?>
|
2088 |
-
</table>
|
2089 |
-
<script type="text/javascript" charset="utf-8">
|
2090 |
-
jQuery(document).ready(function($){
|
2091 |
-
$('#dbem_rsvp_mail_send_method_row select').change(function(){
|
2092 |
-
el = $(this);
|
2093 |
-
if( el.find(':selected').val() == 'smtp' ){
|
2094 |
-
$('.em-email-settings-smtp').show();
|
2095 |
-
}else{
|
2096 |
-
$('.em-email-settings-smtp').hide();
|
2097 |
-
}
|
2098 |
-
}).trigger('change');
|
2099 |
-
$('input#em-admin-check-email').click(function(e,el){
|
2100 |
-
var email_data = $('.em-email-form input, .em-email-form select').serialize();
|
2101 |
-
$.ajax({
|
2102 |
-
url: EM.ajaxurl,
|
2103 |
-
dataType: 'json',
|
2104 |
-
data: email_data+"&action=em_admin_test_email",
|
2105 |
-
success: function(data){
|
2106 |
-
if(data.result && data.message){
|
2107 |
-
$('#em-email-settings-check-status').css({'color':'green','display':'block'}).html(data.message);
|
2108 |
-
}else{
|
2109 |
-
var msg = (data.message) ? data.message:'Email not sent';
|
2110 |
-
$('#em-email-settings-check-status').css({'color':'red','display':'block'}).html(msg);
|
2111 |
-
}
|
2112 |
-
},
|
2113 |
-
error: function(){ $('#em-email-settings-check-status').css({'color':'red','display':'block'}).html('Server Error'); },
|
2114 |
-
beforeSend: function(){ $('input#em-admin-check-email').val('<?php _e('Checking...','dbem') ?>'); },
|
2115 |
-
complete: function(){ $('input#em-admin-check-email').val('<?php _e('Test Email Settings','dbem'); ?>'); }
|
2116 |
-
});
|
2117 |
-
});
|
2118 |
-
});
|
2119 |
-
</script>
|
2120 |
-
</div> <!-- . inside -->
|
2121 |
-
</div> <!-- .postbox -->
|
2122 |
-
<?php
|
2123 |
-
}
|
2124 |
-
|
2125 |
-
/**
|
2126 |
-
* Meta options box for user capabilities. Shared in both MS and Normal options page, hence it's own function
|
2127 |
-
*/
|
2128 |
-
function em_admin_option_box_caps(){
|
2129 |
-
global $save_button, $wpdb;
|
2130 |
-
?>
|
2131 |
-
<div class="postbox" id="em-opt-user-caps" >
|
2132 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'User Capabilities', 'dbem' ); ?></span></h3>
|
2133 |
-
<div class="inside">
|
2134 |
-
<table class="form-table">
|
2135 |
-
<tr><td colspan="2" class="em-boxheader">
|
2136 |
-
<p><strong><?php _e('Warning: Changing these values may result in exposing previously hidden information to all users.', 'dbem')?></strong></p>
|
2137 |
-
<p><em><?php _e('You can now give fine grained control with regards to what your users can do with events. Each user role can have perform different sets of actions.','dbem'); ?></em></p>
|
2138 |
-
</td></tr>
|
2139 |
-
<?php
|
2140 |
-
global $wp_roles;
|
2141 |
-
$cap_docs = array(
|
2142 |
-
sprintf(__('%s Capabilities','dbem'),__('Event','dbem')) => array(
|
2143 |
-
/* Event Capabilities */
|
2144 |
-
'publish_events' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('events','dbem')),
|
2145 |
-
'delete_others_events' => sprintf(__('User can delete other users %s','dbem'),__('events','dbem')),
|
2146 |
-
'edit_others_events' => sprintf(__('User can edit other users %s','dbem'),__('events','dbem')),
|
2147 |
-
'delete_events' => sprintf(__('User can delete their own %s','dbem'),__('events','dbem')),
|
2148 |
-
'edit_events' => sprintf(__('User can create and edit %s','dbem'),__('events','dbem')),
|
2149 |
-
'read_private_events' => sprintf(__('User can view private %s','dbem'),__('events','dbem')),
|
2150 |
-
/*'read_events' => sprintf(__('User can view %s','dbem'),__('events','dbem')),*/
|
2151 |
-
),
|
2152 |
-
sprintf(__('%s Capabilities','dbem'),__('Recurring Event','dbem')) => array(
|
2153 |
-
/* Recurring Event Capabilties */
|
2154 |
-
'publish_recurring_events' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('recurring events','dbem')),
|
2155 |
-
'delete_others_recurring_events' => sprintf(__('User can delete other users %s','dbem'),__('recurring events','dbem')),
|
2156 |
-
'edit_others_recurring_events' => sprintf(__('User can edit other users %s','dbem'),__('recurring events','dbem')),
|
2157 |
-
'delete_recurring_events' => sprintf(__('User can delete their own %s','dbem'),__('recurring events','dbem')),
|
2158 |
-
'edit_recurring_events' => sprintf(__('User can create and edit %s','dbem'),__('recurring events','dbem'))
|
2159 |
-
),
|
2160 |
-
sprintf(__('%s Capabilities','dbem'),__('Location','dbem')) => array(
|
2161 |
-
/* Location Capabilities */
|
2162 |
-
'publish_locations' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('locations','dbem')),
|
2163 |
-
'delete_others_locations' => sprintf(__('User can delete other users %s','dbem'),__('locations','dbem')),
|
2164 |
-
'edit_others_locations' => sprintf(__('User can edit other users %s','dbem'),__('locations','dbem')),
|
2165 |
-
'delete_locations' => sprintf(__('User can delete their own %s','dbem'),__('locations','dbem')),
|
2166 |
-
'edit_locations' => sprintf(__('User can create and edit %s','dbem'),__('locations','dbem')),
|
2167 |
-
'read_private_locations' => sprintf(__('User can view private %s','dbem'),__('locations','dbem')),
|
2168 |
-
'read_others_locations' => __('User can use other user locations for their events.','dbem'),
|
2169 |
-
/*'read_locations' => sprintf(__('User can view %s','dbem'),__('locations','dbem')),*/
|
2170 |
-
),
|
2171 |
-
sprintf(__('%s Capabilities','dbem'),__('Other','dbem')) => array(
|
2172 |
-
/* Category Capabilities */
|
2173 |
-
'delete_event_categories' => sprintf(__('User can delete %s categories and tags.','dbem'),__('event','dbem')),
|
2174 |
-
'edit_event_categories' => sprintf(__('User can edit %s categories and tags.','dbem'),__('event','dbem')),
|
2175 |
-
/* Booking Capabilities */
|
2176 |
-
'manage_others_bookings' => __('User can manage other users individual bookings and event booking settings.','dbem'),
|
2177 |
-
'manage_bookings' => __('User can use and manage bookings with their events.','dbem'),
|
2178 |
-
'upload_event_images' => __('User can upload images along with their events and locations.','dbem')
|
2179 |
-
)
|
2180 |
-
);
|
2181 |
-
?>
|
2182 |
-
<?php
|
2183 |
-
if( is_multisite() && is_network_admin() ){
|
2184 |
-
echo em_options_radio_binary(__('Apply global capabilities?','dbem'), 'dbem_ms_global_caps', __('If set to yes the capabilities will be applied all your network blogs and you will not be able to set custom capabilities each blog. You can select no later and visit specific blog settings pages to add/remove capabilities.','dbem') );
|
2185 |
-
}
|
2186 |
-
?>
|
2187 |
-
<tr><td colspan="2">
|
2188 |
-
<table class="em-caps-table" style="width:auto;" cellspacing="0" cellpadding="0">
|
2189 |
-
<thead>
|
2190 |
-
<tr>
|
2191 |
-
<td> </td>
|
2192 |
-
<?php
|
2193 |
-
$odd = 0;
|
2194 |
-
foreach(array_keys($cap_docs) as $capability_group){
|
2195 |
-
?><th class="<?php echo ( !is_int($odd/2) ) ? 'odd':''; ?>"><?php echo $capability_group ?></th><?php
|
2196 |
-
$odd++;
|
2197 |
-
}
|
2198 |
-
?>
|
2199 |
-
</tr>
|
2200 |
-
</thead>
|
2201 |
-
<tbody>
|
2202 |
-
<?php foreach($wp_roles->role_objects as $role): ?>
|
2203 |
-
<tr>
|
2204 |
-
<td class="cap"><strong><?php echo $role->name; ?></strong></td>
|
2205 |
-
<?php
|
2206 |
-
$odd = 0;
|
2207 |
-
foreach($cap_docs as $capability_group){
|
2208 |
-
?>
|
2209 |
-
<td class="<?php echo ( !is_int($odd/2) ) ? 'odd':''; ?>">
|
2210 |
-
<?php foreach($capability_group as $cap => $cap_help){ ?>
|
2211 |
-
<input type="checkbox" name="em_capabilities[<?php echo $role->name; ?>][<?php echo $cap ?>]" value="1" id="<?php echo $role->name.'_'.$cap; ?>" <?php echo $role->has_cap($cap) ? 'checked="checked"':''; ?> />
|
2212 |
-
<label for="<?php echo $role->name.'_'.$cap; ?>"><?php echo $cap; ?></label> <a href="#" title="<?php echo $cap_help; ?>">?</a>
|
2213 |
-
<br />
|
2214 |
-
<?php } ?>
|
2215 |
-
</td>
|
2216 |
-
<?php
|
2217 |
-
$odd++;
|
2218 |
-
}
|
2219 |
-
?>
|
2220 |
-
</tr>
|
2221 |
-
<?php endforeach; ?>
|
2222 |
-
</tbody>
|
2223 |
-
</table>
|
2224 |
-
</td></tr>
|
2225 |
-
<?php echo $save_button; ?>
|
2226 |
-
</table>
|
2227 |
-
</div> <!-- . inside -->
|
2228 |
-
</div> <!-- .postbox -->
|
2229 |
-
<?php
|
2230 |
-
}
|
2231 |
-
|
2232 |
-
function em_admin_option_box_uninstall(){
|
2233 |
-
global $save_button;
|
2234 |
-
if( is_multisite() ){
|
2235 |
-
$uninstall_url = admin_url().'network/admin.php?page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
2236 |
-
$reset_url = admin_url().'network/admin.php?page=events-manager-options&action=reset&_wpnonce='.wp_create_nonce('em_reset_'.get_current_user_id().'_wpnonce');
|
2237 |
-
$recheck_updates_url = admin_url().'network/admin.php?page=events-manager-options&action=recheck_updates&_wpnonce='.wp_create_nonce('em_recheck_updates_'.get_current_user_id().'_wpnonce');
|
2238 |
-
$check_devs = admin_url().'network/admin.php?page=events-manager-options&action=check_devs&_wpnonce='.wp_create_nonce('em_check_devs_wpnonce');
|
2239 |
-
}else{
|
2240 |
-
$uninstall_url = EM_ADMIN_URL.'&page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
2241 |
-
$reset_url = EM_ADMIN_URL.'&page=events-manager-options&action=reset&_wpnonce='.wp_create_nonce('em_reset_'.get_current_user_id().'_wpnonce');
|
2242 |
-
$recheck_updates_url = EM_ADMIN_URL.'&page=events-manager-options&action=recheck_updates&_wpnonce='.wp_create_nonce('em_recheck_updates_'.get_current_user_id().'_wpnonce');
|
2243 |
-
$check_devs = EM_ADMIN_URL.'&page=events-manager-options&action=check_devs&_wpnonce='.wp_create_nonce('em_check_devs_wpnonce');
|
2244 |
-
}
|
2245 |
-
?>
|
2246 |
-
<div class="postbox" id="em-opt-admin-tools" >
|
2247 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Admin Tools', 'dbem' ); ?> (<?php _e ( 'Advanced', 'dbem' ); ?>)</span></h3>
|
2248 |
-
<div class="inside">
|
2249 |
-
<table class="form-table">
|
2250 |
-
<tr class="em-header"><td colspan="2">
|
2251 |
-
<h4><?php _e ( 'Development Versions & Updates', 'dbem' ); ?></h4>
|
2252 |
-
<p><?php _e('We\'re always making improvements, adding features and fixing bugs between releases. We incrementally make these changes in between updates and make it available as a development version. You can download these manually, but we\'ve made it easy for you. <strong>Warning:</strong> Development versions are not always fully tested before release, use wisely!','dbem'); ?></p>
|
2253 |
-
</td></tr>
|
2254 |
-
<?php em_options_radio_binary ( __( 'Enable Dev Updates?', 'dbem' ), 'dbem_pro_dev_updates', __('If enabled, the latest dev version will always be checked instead of the latest stable version of the plugin.', 'dbem') ); ?>
|
2255 |
-
<tr>
|
2256 |
-
<th style="text-align:right;"><a href="<?php echo $recheck_updates_url; ?>" class="button-secondary"><?php _e('Re-Check Updates','dbem'); ?></a></th>
|
2257 |
-
<td><?php _e('If you would like to check and see if there is a new stable update.','dbem'); ?></td>
|
2258 |
-
</tr>
|
2259 |
-
<tr>
|
2260 |
-
<th style="text-align:right;"><a href="<?php echo $check_devs; ?>" class="button-secondary"><?php _e('Check Dev Versions','dbem'); ?></a></th>
|
2261 |
-
<td><?php _e('If you would like to download a dev version, but just as a one-off, you can force a dev version check by clicking the button below. If there is one available, it should appear in your plugin updates page as a regular update.','dbem'); ?></td>
|
2262 |
-
</tr>
|
2263 |
-
</table>
|
2264 |
-
|
2265 |
-
<table class="form-table">
|
2266 |
-
<tr class="em-header"><td colspan="2">
|
2267 |
-
<h4><?php _e ( 'Uninstall/Reset', 'dbem' ); ?></h4>
|
2268 |
-
<p><?php _e('Use the buttons below to uninstall Events Manager completely from your system or reset Events Manager to original settings and keep your event data.','dbem'); ?></p>
|
2269 |
-
</td></tr>
|
2270 |
-
<tr><td colspan="2">
|
2271 |
-
<a href="<?php echo $uninstall_url; ?>" class="button-secondary"><?php _e('Uninstall','dbem'); ?></a>
|
2272 |
-
<a href="<?php echo $reset_url; ?>" class="button-secondary"><?php _e('Reset','dbem'); ?></a>
|
2273 |
-
</td></tr>
|
2274 |
-
</table>
|
2275 |
-
<?php do_action('em_options_page_panel_admin_tools'); ?>
|
2276 |
-
<?php echo $save_button; ?>
|
2277 |
-
</div>
|
2278 |
-
</div>
|
2279 |
-
<?php
|
2280 |
-
}
|
2281 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//Function composing the options subpanel
|
4 |
+
function em_options_save(){
|
5 |
+
global $EM_Notices;
|
6 |
+
/*
|
7 |
+
* Here's the idea, we have an array of all options that need super admin approval if in multi-site mode
|
8 |
+
* since options are only updated here, its one place fit all
|
9 |
+
*/
|
10 |
+
if( current_user_can('list_users') && !empty($_POST['em-submitted']) && check_admin_referer('events-manager-options','_wpnonce') ){
|
11 |
+
//Build the array of options here
|
12 |
+
$post = $_POST;
|
13 |
+
foreach ($_POST as $postKey => $postValue){
|
14 |
+
if( substr($postKey, 0, 5) == 'dbem_' ){
|
15 |
+
//TODO some more validation/reporting
|
16 |
+
$numeric_options = array('dbem_locations_default_limit','dbem_events_default_limit');
|
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 seperated 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}?$/i",$postValue)){
|
21 |
+
$EM_Notices->add_error( sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'dbem'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>').' '. esc_html__('This setting was not changed.', 'dbem'), true);
|
22 |
+
}else{
|
23 |
+
//TODO slashes being added?
|
24 |
+
if( is_array($postValue) ){
|
25 |
+
foreach($postValue as $postValue_key=>$postValue_val) $postValue[$postValue_key] = stripslashes($postValue_val);
|
26 |
+
}else{
|
27 |
+
$postValue = stripslashes($postValue);
|
28 |
+
}
|
29 |
+
update_option($postKey, $postValue);
|
30 |
+
}
|
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
|
38 |
+
global $current_site,$wpdb;
|
39 |
+
$blog_ids = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs.' WHERE site_id='.$current_site->id);
|
40 |
+
foreach($blog_ids as $blog_id){
|
41 |
+
switch_to_blog($blog_id);
|
42 |
+
//normal blog role application
|
43 |
+
foreach( $wp_roles->role_objects as $role_name => $role ){
|
44 |
+
foreach( array_keys($em_capabilities_array) as $capability){
|
45 |
+
if( !empty($_POST['em_capabilities'][$role_name][$capability]) ){
|
46 |
+
$role->add_cap($capability);
|
47 |
+
}else{
|
48 |
+
$role->remove_cap($capability);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
restore_current_blog();
|
53 |
+
}
|
54 |
+
}elseif( !is_network_admin() ){
|
55 |
+
//normal blog role application
|
56 |
+
foreach( $wp_roles->role_objects as $role_name => $role ){
|
57 |
+
foreach( array_keys($em_capabilities_array) as $capability){
|
58 |
+
if( !empty($_POST['em_capabilities'][$role_name][$capability]) ){
|
59 |
+
$role->add_cap($capability);
|
60 |
+
}else{
|
61 |
+
$role->remove_cap($capability);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
update_option('dbem_flush_needed',1);
|
68 |
+
do_action('em_options_save');
|
69 |
+
$EM_Notices->add_confirm('<strong>'.__('Changes saved.', 'dbem').'</strong>', true);
|
70 |
+
wp_redirect(wp_get_referer());
|
71 |
+
exit();
|
72 |
+
}
|
73 |
+
//Migration
|
74 |
+
if( !empty($_GET['em_migrate_images']) && check_admin_referer('em_migrate_images','_wpnonce') && get_option('dbem_migrate_images') ){
|
75 |
+
include(plugin_dir_path(__FILE__).'../em-install.php');
|
76 |
+
$result = em_migrate_uploads();
|
77 |
+
if($result){
|
78 |
+
$failed = ( $result['fail'] > 0 ) ? $result['fail'] . ' images failed to migrate.' : '';
|
79 |
+
$EM_Notices->add_confirm('<strong>'.$result['success'].' images migrated successfully. '.$failed.'</strong>');
|
80 |
+
}
|
81 |
+
wp_redirect(admin_url().'edit.php?post_type=event&page=events-manager-options&em_migrate_images');
|
82 |
+
}elseif( !empty($_GET['em_not_migrate_images']) && check_admin_referer('em_not_migrate_images','_wpnonce') ){
|
83 |
+
delete_option('dbem_migrate_images_nag');
|
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;
|
91 |
+
//delete EM posts
|
92 |
+
remove_action('before_delete_post',array('EM_Location_Post_Admin','before_delete_post'),10,1);
|
93 |
+
remove_action('before_delete_post',array('EM_Event_Post_Admin','before_delete_post'),10,1);
|
94 |
+
remove_action('before_delete_post',array('EM_Event_Recurring_Post_Admin','before_delete_post'),10,1);
|
95 |
+
$post_ids = $wpdb->get_col('SELECT ID FROM '.$wpdb->posts." WHERE post_type IN ('".EM_POST_TYPE_EVENT."','".EM_POST_TYPE_LOCATION."','event-recurring')");
|
96 |
+
foreach($post_ids as $post_id){
|
97 |
+
wp_delete_post($post_id);
|
98 |
+
}
|
99 |
+
//delete categories
|
100 |
+
$cat_terms = get_terms(EM_TAXONOMY_CATEGORY, array('hide_empty'=>false));
|
101 |
+
foreach($cat_terms as $cat_term){
|
102 |
+
wp_delete_term($cat_term->term_id, EM_TAXONOMY_CATEGORY);
|
103 |
+
}
|
104 |
+
$tag_terms = get_terms(EM_TAXONOMY_TAG, array('hide_empty'=>false));
|
105 |
+
foreach($tag_terms as $tag_term){
|
106 |
+
wp_delete_term($tag_term->term_id, EM_TAXONOMY_TAG);
|
107 |
+
}
|
108 |
+
//delete EM tables
|
109 |
+
$wpdb->query('DROP TABLE '.EM_EVENTS_TABLE);
|
110 |
+
$wpdb->query('DROP TABLE '.EM_BOOKINGS_TABLE);
|
111 |
+
$wpdb->query('DROP TABLE '.EM_LOCATIONS_TABLE);
|
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
|
119 |
+
$wpdb->query('DELETE FROM '.$wpdb->options.' WHERE option_name LIKE \'em_%\' OR option_name LIKE \'dbem_%\'');
|
120 |
+
//deactivate and go!
|
121 |
+
deactivate_plugins(array('events-manager/events-manager.php','events-manager-pro/events-manager-pro.php'), true);
|
122 |
+
wp_redirect(admin_url('plugins.php?deactivate=true'));
|
123 |
+
exit();
|
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;
|
131 |
+
//delete options
|
132 |
+
$wpdb->query('DELETE FROM '.$wpdb->options.' WHERE option_name LIKE \'em_%\' OR option_name LIKE \'dbem_%\'');
|
133 |
+
//reset capabilities
|
134 |
+
global $em_capabilities_array, $wp_roles;
|
135 |
+
foreach( $wp_roles->role_objects as $role_name => $role ){
|
136 |
+
foreach( array_keys($em_capabilities_array) as $capability){
|
137 |
+
$role->remove_cap($capability);
|
138 |
+
}
|
139 |
+
}
|
140 |
+
//go back to plugin options page
|
141 |
+
$EM_Notices->add_confirm(__('Settings have been reset back to default. Your events, locations and categories have not been modified.','dbem'), true);
|
142 |
+
wp_redirect(EM_ADMIN_URL.'&page=events-manager-options');
|
143 |
+
exit();
|
144 |
+
}
|
145 |
+
}
|
146 |
+
//Force Update Recheck - Workaround for now
|
147 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'recheck_updates' && check_admin_referer('em_recheck_updates_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
|
148 |
+
//force recheck of plugin updates, to refresh dl links
|
149 |
+
delete_transient('update_plugins');
|
150 |
+
delete_site_transient('update_plugins');
|
151 |
+
$EM_Notices->add_confirm(__('If there are any new updates, you should now see them in your Plugins or Updates admin pages.','dbem'), true);
|
152 |
+
wp_redirect(wp_get_referer());
|
153 |
+
exit();
|
154 |
+
}
|
155 |
+
//Flag version checking to look at trunk, not tag
|
156 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'check_devs' && check_admin_referer('em_check_devs_wpnonce') && is_super_admin() ){
|
157 |
+
//delete transients, and add a flag to recheck dev version next time round
|
158 |
+
delete_transient('update_plugins');
|
159 |
+
delete_site_transient('update_plugins');
|
160 |
+
update_option('em_check_dev_version', true);
|
161 |
+
$EM_Notices->add_confirm(__('Checking for dev versions.','dbem').' '. __('If there are any new updates, you should now see them in your Plugins or Updates admin pages.','dbem'), true);
|
162 |
+
wp_redirect(wp_get_referer());
|
163 |
+
exit();
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
167 |
+
add_action('admin_init', 'em_options_save');
|
168 |
+
|
169 |
+
function em_admin_email_test_ajax(){
|
170 |
+
if( wp_verify_nonce($_REQUEST['_check_email_nonce'],'check_email') && current_user_can('activate_plugins') ){
|
171 |
+
$subject = __("Events Manager Test Email",'dbem');
|
172 |
+
$content = __('Congratulations! Your email settings work.','dbem');
|
173 |
+
$current_user = get_user_by('id', get_current_user_id());
|
174 |
+
//add filters for options used in EM_Mailer so the current supplied ones are used
|
175 |
+
ob_start();
|
176 |
+
function pre_option_dbem_mail_sender_name(){ return sanitize_email($_REQUEST['dbem_mail_sender_name']); }
|
177 |
+
add_filter('pre_option_dbem_mail_sender_name', 'pre_option_dbem_mail_sender_name');
|
178 |
+
function pre_option_dbem_mail_sender_address(){ return sanitize_text_field($_REQUEST['dbem_mail_sender_address']); }
|
179 |
+
add_filter('pre_option_dbem_mail_sender_address', 'pre_option_dbem_mail_sender_address');
|
180 |
+
function pre_option_dbem_rsvp_mail_send_method(){ return sanitize_text_field($_REQUEST['dbem_rsvp_mail_send_method']); }
|
181 |
+
add_filter('pre_option_dbem_rsvp_mail_send_method', 'pre_option_dbem_rsvp_mail_send_method');
|
182 |
+
function pre_option_dbem_rsvp_mail_port(){ return sanitize_text_field($_REQUEST['dbem_rsvp_mail_port']); }
|
183 |
+
add_filter('pre_option_dbem_rsvp_mail_port', 'pre_option_dbem_rsvp_mail_port');
|
184 |
+
function pre_option_dbem_rsvp_mail_SMTPAuth(){ return sanitize_text_field($_REQUEST['dbem_rsvp_mail_SMTPAuth']); }
|
185 |
+
add_filter('pre_option_dbem_rsvp_mail_SMTPAuth', 'pre_option_dbem_rsvp_mail_SMTPAuth');
|
186 |
+
function pre_option_dbem_smtp_host(){ return sanitize_text_field($_REQUEST['dbem_smtp_host']); }
|
187 |
+
add_filter('pre_option_dbem_smtp_host', 'pre_option_dbem_smtp_host');
|
188 |
+
function pre_option_dbem_smtp_username(){ return sanitize_text_field($_REQUEST['dbem_smtp_username']); }
|
189 |
+
add_filter('pre_option_dbem_smtp_username', 'pre_option_dbem_smtp_username');
|
190 |
+
function pre_option_dbem_smtp_password(){ return sanitize_text_field($_REQUEST['dbem_smtp_password']); }
|
191 |
+
add_filter('pre_option_dbem_smtp_password', 'pre_option_dbem_smtp_password');
|
192 |
+
ob_clean(); //remove any php errors/warnings output
|
193 |
+
$EM_Event = new EM_Event();
|
194 |
+
if( $EM_Event->email_send($subject,$content,$current_user->user_email) ){
|
195 |
+
$result = array(
|
196 |
+
'result' => true,
|
197 |
+
'message' => sprintf(__('Email sent succesfully to %s','dbem'),$current_user->user_email)
|
198 |
+
);
|
199 |
+
}else{
|
200 |
+
$result = array(
|
201 |
+
'result' => false,
|
202 |
+
'message' => __('Email not sent.','dbem')." <ul><li>".implode('</li><li>',$EM_Event->get_errors()).'</li></ul>'
|
203 |
+
);
|
204 |
+
}
|
205 |
+
echo EM_Object::json_encode($result);
|
206 |
+
}
|
207 |
+
exit();
|
208 |
+
}
|
209 |
+
add_action('wp_ajax_em_admin_test_email','em_admin_email_test_ajax');
|
210 |
+
|
211 |
+
function em_admin_options_reset_page(){
|
212 |
+
if( check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
|
213 |
+
?>
|
214 |
+
<div class="wrap">
|
215 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
216 |
+
<h2><?php _e('Reset Events Manager','dbem'); ?></h2>
|
217 |
+
<p style="color:red; font-weight:bold;"><?php _e('Are you sure you want to reset Events Manager?','dbem')?></p>
|
218 |
+
<p style="font-weight:bold;"><?php _e('All your settings, including email templates and template formats for Events Manager will be deleted.','dbem')?></p>
|
219 |
+
<p>
|
220 |
+
<a href="<?php echo esc_url(add_query_arg(array('_wpnonce2' => wp_create_nonce('em_reset_'.get_current_user_id().'_confirmed'), 'confirmed'=>1))); ?>" class="button-primary"><?php _e('Reset Events Manager','dbem'); ?></a>
|
221 |
+
<a href="<?php echo wp_get_referer(); ?>" class="button-secondary"><?php _e('Cancel','dbem'); ?></a>
|
222 |
+
</p>
|
223 |
+
</div>
|
224 |
+
<?php
|
225 |
+
}
|
226 |
+
}
|
227 |
+
function em_admin_options_uninstall_page(){
|
228 |
+
if( check_admin_referer('em_uninstall_'.get_current_user_id().'_wpnonce') && is_super_admin() ){
|
229 |
+
?>
|
230 |
+
<div class="wrap">
|
231 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
232 |
+
<h2><?php _e('Uninstall Events Manager','dbem'); ?></h2>
|
233 |
+
<p style="color:red; font-weight:bold;"><?php _e('Are you sure you want to uninstall Events Manager?','dbem')?></p>
|
234 |
+
<p style="font-weight:bold;"><?php _e('All your settings and events will be permanently deleted. This cannot be undone.','dbem')?></p>
|
235 |
+
<p><?php echo sprintf(__('If you just want to deactivate the plugin, <a href="%s">go to your plugins page</a>.','dbem'), wp_nonce_url(admin_url('plugins.php'))); ?></p>
|
236 |
+
<p>
|
237 |
+
<a href="<?php echo esc_url(add_query_arg(array('_wpnonce2' => wp_create_nonce('em_uninstall_'.get_current_user_id().'_confirmed'), 'confirmed'=>1))); ?>" class="button-primary"><?php _e('Uninstall and Deactivate','dbem'); ?></a>
|
238 |
+
<a href="<?php echo wp_get_referer(); ?>" class="button-secondary"><?php _e('Cancel','dbem'); ?></a>
|
239 |
+
</p>
|
240 |
+
</div>
|
241 |
+
<?php
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
function em_admin_options_page() {
|
246 |
+
global $wpdb, $EM_Notices;
|
247 |
+
//Check for uninstall/reset request
|
248 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' ){
|
249 |
+
em_admin_options_uninstall_page();
|
250 |
+
return;
|
251 |
+
}
|
252 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ){
|
253 |
+
em_admin_options_reset_page();
|
254 |
+
return;
|
255 |
+
}
|
256 |
+
//substitute dropdowns with input boxes for some situations to improve speed, e.g. if there 1000s of locations or users
|
257 |
+
$total_users = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users};");
|
258 |
+
if( $total_users > 100 && !defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS') ){ define('EM_OPTIMIZE_SETTINGS_PAGE_USERS',true); }
|
259 |
+
$total_locations = EM_Locations::count();
|
260 |
+
if( $total_locations > 100 && !defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS') ){ define('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS',true); }
|
261 |
+
//TODO place all options into an array
|
262 |
+
global $events_placeholder_tip, $locations_placeholder_tip, $categories_placeholder_tip, $bookings_placeholder_tip;
|
263 |
+
$events_placeholders = '<a href="'.EM_ADMIN_URL .'&page=events-manager-help#event-placeholders">'. __('Event Related Placeholders','dbem') .'</a>';
|
264 |
+
$locations_placeholders = '<a href="'.EM_ADMIN_URL .'&page=events-manager-help#location-placeholders">'. __('Location Related Placeholders','dbem') .'</a>';
|
265 |
+
$bookings_placeholders = '<a href="'.EM_ADMIN_URL .'&page=events-manager-help#booking-placeholders">'. __('Booking Related Placeholders','dbem') .'</a>';
|
266 |
+
$categories_placeholders = '<a href="'.EM_ADMIN_URL .'&page=events-manager-help#category-placeholders">'. __('Category Related Placeholders','dbem') .'</a>';
|
267 |
+
$events_placeholder_tip = " ". sprintf(__('This accepts %s and %s placeholders.','dbem'),$events_placeholders, $locations_placeholders);
|
268 |
+
$locations_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','dbem'), $locations_placeholders);
|
269 |
+
$categories_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','dbem'), $categories_placeholders);
|
270 |
+
$bookings_placeholder_tip = " ". sprintf(__('This accepts %s, %s and %s placeholders.','dbem'), $bookings_placeholders, $events_placeholders, $locations_placeholders);
|
271 |
+
|
272 |
+
global $save_button;
|
273 |
+
$save_button = '<tr><th> </th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" class="button-primary" id="dbem_options_submit" name="Submit" value="'. __( 'Save Changes', 'dbem') .' ('. __('All','dbem') .')" /></p></ts></td></tr>';
|
274 |
+
|
275 |
+
if( defined('EM_SETTINGS_TABS') && EM_SETTINGS_TABS ){
|
276 |
+
$tabs_enabled = true;
|
277 |
+
$general_tab_link = esc_url(add_query_arg( array('em_tab'=>'general')));
|
278 |
+
$pages_tab_link = esc_url(add_query_arg( array('em_tab'=>'pages')));
|
279 |
+
$formats_tab_link = esc_url(add_query_arg( array('em_tab'=>'formats')));
|
280 |
+
$bookings_tab_link = esc_url(add_query_arg( array('em_tab'=>'bookings')));
|
281 |
+
$emails_tab_link = esc_url(add_query_arg( array('em_tab'=>'emails')));
|
282 |
+
}else{
|
283 |
+
$general_tab_link = $pages_tab_link = $formats_tab_link = $bookings_tab_link = $emails_tab_link = '';
|
284 |
+
}
|
285 |
+
?>
|
286 |
+
<script type="text/javascript" charset="utf-8"><?php include(EM_DIR.'/includes/js/admin-settings.js'); ?></script>
|
287 |
+
<style type="text/css">.postbox h3 { cursor:pointer; }</style>
|
288 |
+
<div class="wrap <?php if(empty($tabs_enabled)) echo 'tabs-active' ?>">
|
289 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
290 |
+
<h2 class="nav-tab-wrapper">
|
291 |
+
<a href="<?php echo $general_tab_link; ?>#general" id="em-menu-general" class="nav-tab nav-tab-active"><?php _e('General','dbem'); ?></a>
|
292 |
+
<a href="<?php echo $pages_tab_link; ?>#pages" id="em-menu-pages" class="nav-tab"><?php _e('Pages','dbem'); ?></a>
|
293 |
+
<a href="<?php echo $formats_tab_link; ?>#formats" id="em-menu-formats" class="nav-tab"><?php _e('Formatting','dbem'); ?></a>
|
294 |
+
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
295 |
+
<a href="<?php echo $bookings_tab_link; ?>#bookings" id="em-menu-bookings" class="nav-tab"><?php _e('Bookings','dbem'); ?></a>
|
296 |
+
<?php endif; ?>
|
297 |
+
<a href="<?php echo $emails_tab_link; ?>#emails" id="em-menu-emails" class="nav-tab"><?php _e('Emails','dbem'); ?></a>
|
298 |
+
</h2>
|
299 |
+
<h3 id="em-options-title"><?php _e ( 'Event Manager Options', 'dbem' ); ?></h3>
|
300 |
+
<form id="em-options-form" method="post" action="">
|
301 |
+
<div class="metabox-holder">
|
302 |
+
<!-- // TODO Move style in css -->
|
303 |
+
<div class='postbox-container' style='width: 99.5%'>
|
304 |
+
<div id="">
|
305 |
+
|
306 |
+
<?php
|
307 |
+
if( !empty($tabs_enabled) ){
|
308 |
+
if( $_REQUEST['em_tab'] == 'general' || empty($_REQUEST['em_tab']) ) include('settings/tabs/general.php');
|
309 |
+
if( $_REQUEST['em_tab'] == 'pages' ) include('settings/tabs/pages.php');
|
310 |
+
if( $_REQUEST['em_tab'] == 'formats' ) include('settings/tabs/formats.php');
|
311 |
+
if( get_option('dbem_rsvp_enabled') && $_REQUEST['em_tab'] == 'bookings' ){
|
312 |
+
include('settings/tabs/bookings.php');
|
313 |
+
}
|
314 |
+
if( $_REQUEST['em_tab'] == 'emails' ) include('settings/tabs/emails.php');
|
315 |
+
}else{
|
316 |
+
include('settings/tabs/general.php');
|
317 |
+
include('settings/tabs/pages.php');
|
318 |
+
include('settings/tabs/formats.php');
|
319 |
+
if( get_option('dbem_rsvp_enabled') ){
|
320 |
+
include('settings/tabs/bookings.php');
|
321 |
+
}
|
322 |
+
include('settings/tabs/emails.php');
|
323 |
+
}
|
324 |
+
?>
|
325 |
+
|
326 |
+
<?php /*
|
327 |
+
<div class="postbox " >
|
328 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Debug Modes', 'dbem' ); ?> </span></h3>
|
329 |
+
<div class="inside">
|
330 |
+
<table class='form-table'>
|
331 |
+
<?php
|
332 |
+
em_options_radio_binary ( __( 'EM Debug Mode?', 'dbem' ), 'dbem_debug', __( 'Setting this to yes will display different content to admins for event pages and emails so you can see all the available placeholders and their values.', 'dbem' ) );
|
333 |
+
em_options_radio_binary ( __( 'WP Debug Mode?', 'dbem' ), 'dbem_wp_debug', __( 'This will turn WP_DEBUG mode on. Useful if you want to troubleshoot php errors without looking at your logs.', 'dbem' ) );
|
334 |
+
?>
|
335 |
+
</table>
|
336 |
+
</div> <!-- . inside -->
|
337 |
+
</div> <!-- .postbox -->
|
338 |
+
*/ ?>
|
339 |
+
|
340 |
+
<p class="submit">
|
341 |
+
<input type="submit" id="dbem_options_submit" class="button-primary" name="Submit" value="<?php esc_attr_e( 'Save Changes', 'dbem' ); ?>" />
|
342 |
+
<input type="hidden" name="em-submitted" value="1" />
|
343 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('events-manager-options'); ?>" />
|
344 |
+
</p>
|
345 |
+
|
346 |
+
</div> <!-- .metabox-sortables -->
|
347 |
+
</div> <!-- .postbox-container -->
|
348 |
+
|
349 |
+
</div> <!-- .metabox-holder -->
|
350 |
+
</form>
|
351 |
+
</div>
|
352 |
+
<?php
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Meta options box for image sizes. Shared in both MS and Normal options page, hence it's own function
|
357 |
+
*/
|
358 |
+
function em_admin_option_box_image_sizes(){
|
359 |
+
global $save_button;
|
360 |
+
?>
|
361 |
+
<div class="postbox " id="em-opt-image-sizes" >
|
362 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Image Sizes', 'dbem' ); ?> </span></h3>
|
363 |
+
<div class="inside">
|
364 |
+
<p class="em-boxheader"><?php _e('These settings will only apply to the image uploading if using our front-end forms. In your WP admin area, images are handled by WordPress.','dbem'); ?></p>
|
365 |
+
<table class='form-table'>
|
366 |
+
<?php
|
367 |
+
em_options_input_text ( __( 'Maximum width (px)', 'dbem' ), 'dbem_image_max_width', __( 'The maximum allowed width for images uploads', 'dbem' ) );
|
368 |
+
em_options_input_text ( __( 'Minimum width (px)', 'dbem' ), 'dbem_image_min_width', __( 'The minimum allowed width for images uploads', 'dbem' ) );
|
369 |
+
em_options_input_text ( __( 'Maximum height (px)', 'dbem' ), 'dbem_image_max_height', __( "The maximum allowed height for images uploaded, in pixels", 'dbem' ) );
|
370 |
+
em_options_input_text ( __( 'Minimum height (px)', 'dbem' ), 'dbem_image_min_height', __( "The minimum allowed height for images uploaded, in pixels", 'dbem' ) );
|
371 |
+
em_options_input_text ( __( 'Maximum size (bytes)', 'dbem' ), 'dbem_image_max_size', __( "The maximum allowed size for images uploaded, in bytes", 'dbem' ) );
|
372 |
+
echo $save_button;
|
373 |
+
?>
|
374 |
+
</table>
|
375 |
+
</div> <!-- . inside -->
|
376 |
+
</div> <!-- .postbox -->
|
377 |
+
<?php
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Meta options box for email settings. Shared in both MS and Normal options page, hence it's own function
|
382 |
+
*/
|
383 |
+
function em_admin_option_box_email(){
|
384 |
+
global $save_button;
|
385 |
+
$current_user = get_user_by('id', get_current_user_id());
|
386 |
+
?>
|
387 |
+
<div class="postbox " id="em-opt-email-settings">
|
388 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Email Settings', 'dbem' ); ?></span></h3>
|
389 |
+
<div class="inside em-email-form">
|
390 |
+
<p class="em-email-settings-check em-boxheader">
|
391 |
+
<em><?php _e('Before you save your changes, you can quickly send yourself a test email by clicking this button.','dbem'); ?>
|
392 |
+
<?php echo sprintf(__('A test email will be sent to your account email - %s','dbem'), $current_user->user_email . ' <a href="'.admin_url( 'profile.php' ).'">'.__('edit','dbem').'</a>'); ?></em><br />
|
393 |
+
<input type="button" id="em-admin-check-email" class="secondary-button" value="<?php esc_attr_e('Test Email Settings','dbem'); ?>" />
|
394 |
+
<input type="hidden" name="_check_email_nonce" value="<?php echo wp_create_nonce('check_email'); ?>" />
|
395 |
+
<span id="em-email-settings-check-status"></span>
|
396 |
+
</p>
|
397 |
+
<table class="form-table">
|
398 |
+
<?php
|
399 |
+
em_options_input_text ( __( 'Notification sender name', 'dbem' ), 'dbem_mail_sender_name', __( "Insert the display name of the notification sender.", 'dbem' ) );
|
400 |
+
em_options_input_text ( __( 'Notification sender address', 'dbem' ), 'dbem_mail_sender_address', __( "Insert the address of the notification sender.", 'dbem' ) );
|
401 |
+
em_options_select ( __( 'Mail sending method', 'dbem' ), 'dbem_rsvp_mail_send_method', array ('smtp' => 'SMTP', 'mail' => __( 'PHP mail function', 'dbem' ), 'sendmail' => 'Sendmail', 'qmail' => 'Qmail', 'wp_mail' => 'WP Mail' ), __( 'Select the method to send email notification.', 'dbem' ) );
|
402 |
+
em_options_radio_binary ( __( 'Send HTML Emails?', 'dbem' ), 'dbem_smtp_html', __( 'If set to yes, your emails will be sent in HTML format, otherwise plaintext.', 'dbem' ).' '.__( 'Depending on server settings, some sending methods may ignore this settings.', 'dbem' ) );
|
403 |
+
em_options_radio_binary ( __( 'Add br tags to HTML emails?', 'dbem' ), 'dbem_smtp_html_br', __( 'If HTML emails are enabled, br tags will automatically be added for new lines.', 'dbem' ) );
|
404 |
+
?>
|
405 |
+
<tbody class="em-email-settings-smtp">
|
406 |
+
<?php
|
407 |
+
em_options_input_text ( 'Mail sending port', 'dbem_rsvp_mail_port', __( "The port through which you e-mail notifications will be sent. Make sure the firewall doesn't block this port", 'dbem' ) );
|
408 |
+
em_options_radio_binary ( __( 'Use SMTP authentication?', 'dbem' ), 'dbem_rsvp_mail_SMTPAuth', __( 'SMTP authentication is often needed. If you use GMail, make sure to set this parameter to Yes', 'dbem' ) );
|
409 |
+
em_options_input_text ( 'SMTP host', 'dbem_smtp_host', __( "The SMTP host. Usually it corresponds to 'localhost'. If you use GMail, set this value to 'ssl://smtp.gmail.com:465'.", 'dbem' ) );
|
410 |
+
em_options_input_text ( __( 'SMTP username', 'dbem' ), 'dbem_smtp_username', __( "Insert the username to be used to access your SMTP server.", 'dbem' ) );
|
411 |
+
em_options_input_password ( __( 'SMTP password', 'dbem' ), "dbem_smtp_password", __( "Insert the password to be used to access your SMTP server", 'dbem' ) );
|
412 |
+
?>
|
413 |
+
</tbody>
|
414 |
+
<?php
|
415 |
+
echo $save_button;
|
416 |
+
?>
|
417 |
+
</table>
|
418 |
+
<script type="text/javascript" charset="utf-8">
|
419 |
+
jQuery(document).ready(function($){
|
420 |
+
$('#dbem_rsvp_mail_send_method_row select').change(function(){
|
421 |
+
el = $(this);
|
422 |
+
if( el.find(':selected').val() == 'smtp' ){
|
423 |
+
$('.em-email-settings-smtp').show();
|
424 |
+
}else{
|
425 |
+
$('.em-email-settings-smtp').hide();
|
426 |
+
}
|
427 |
+
}).trigger('change');
|
428 |
+
$('input#em-admin-check-email').click(function(e,el){
|
429 |
+
var email_data = $('.em-email-form input, .em-email-form select').serialize();
|
430 |
+
$.ajax({
|
431 |
+
url: EM.ajaxurl,
|
432 |
+
dataType: 'json',
|
433 |
+
data: email_data+"&action=em_admin_test_email",
|
434 |
+
success: function(data){
|
435 |
+
if(data.result && data.message){
|
436 |
+
$('#em-email-settings-check-status').css({'color':'green','display':'block'}).html(data.message);
|
437 |
+
}else{
|
438 |
+
var msg = (data.message) ? data.message:'Email not sent';
|
439 |
+
$('#em-email-settings-check-status').css({'color':'red','display':'block'}).html(msg);
|
440 |
+
}
|
441 |
+
},
|
442 |
+
error: function(){ $('#em-email-settings-check-status').css({'color':'red','display':'block'}).html('Server Error'); },
|
443 |
+
beforeSend: function(){ $('input#em-admin-check-email').val('<?php _e('Checking...','dbem') ?>'); },
|
444 |
+
complete: function(){ $('input#em-admin-check-email').val('<?php _e('Test Email Settings','dbem'); ?>'); }
|
445 |
+
});
|
446 |
+
});
|
447 |
+
});
|
448 |
+
</script>
|
449 |
+
</div> <!-- . inside -->
|
450 |
+
</div> <!-- .postbox -->
|
451 |
+
<?php
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Meta options box for user capabilities. Shared in both MS and Normal options page, hence it's own function
|
456 |
+
*/
|
457 |
+
function em_admin_option_box_caps(){
|
458 |
+
global $save_button, $wpdb;
|
459 |
+
?>
|
460 |
+
<div class="postbox" id="em-opt-user-caps" >
|
461 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'User Capabilities', 'dbem' ); ?></span></h3>
|
462 |
+
<div class="inside">
|
463 |
+
<table class="form-table">
|
464 |
+
<tr><td colspan="2" class="em-boxheader">
|
465 |
+
<p><strong><?php _e('Warning: Changing these values may result in exposing previously hidden information to all users.', 'dbem')?></strong></p>
|
466 |
+
<p><em><?php _e('You can now give fine grained control with regards to what your users can do with events. Each user role can have perform different sets of actions.','dbem'); ?></em></p>
|
467 |
+
</td></tr>
|
468 |
+
<?php
|
469 |
+
global $wp_roles;
|
470 |
+
$cap_docs = array(
|
471 |
+
sprintf(__('%s Capabilities','dbem'),__('Event','dbem')) => array(
|
472 |
+
/* Event Capabilities */
|
473 |
+
'publish_events' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('events','dbem')),
|
474 |
+
'delete_others_events' => sprintf(__('User can delete other users %s','dbem'),__('events','dbem')),
|
475 |
+
'edit_others_events' => sprintf(__('User can edit other users %s','dbem'),__('events','dbem')),
|
476 |
+
'delete_events' => sprintf(__('User can delete their own %s','dbem'),__('events','dbem')),
|
477 |
+
'edit_events' => sprintf(__('User can create and edit %s','dbem'),__('events','dbem')),
|
478 |
+
'read_private_events' => sprintf(__('User can view private %s','dbem'),__('events','dbem')),
|
479 |
+
/*'read_events' => sprintf(__('User can view %s','dbem'),__('events','dbem')),*/
|
480 |
+
),
|
481 |
+
sprintf(__('%s Capabilities','dbem'),__('Recurring Event','dbem')) => array(
|
482 |
+
/* Recurring Event Capabilties */
|
483 |
+
'publish_recurring_events' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('recurring events','dbem')),
|
484 |
+
'delete_others_recurring_events' => sprintf(__('User can delete other users %s','dbem'),__('recurring events','dbem')),
|
485 |
+
'edit_others_recurring_events' => sprintf(__('User can edit other users %s','dbem'),__('recurring events','dbem')),
|
486 |
+
'delete_recurring_events' => sprintf(__('User can delete their own %s','dbem'),__('recurring events','dbem')),
|
487 |
+
'edit_recurring_events' => sprintf(__('User can create and edit %s','dbem'),__('recurring events','dbem'))
|
488 |
+
),
|
489 |
+
sprintf(__('%s Capabilities','dbem'),__('Location','dbem')) => array(
|
490 |
+
/* Location Capabilities */
|
491 |
+
'publish_locations' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('locations','dbem')),
|
492 |
+
'delete_others_locations' => sprintf(__('User can delete other users %s','dbem'),__('locations','dbem')),
|
493 |
+
'edit_others_locations' => sprintf(__('User can edit other users %s','dbem'),__('locations','dbem')),
|
494 |
+
'delete_locations' => sprintf(__('User can delete their own %s','dbem'),__('locations','dbem')),
|
495 |
+
'edit_locations' => sprintf(__('User can create and edit %s','dbem'),__('locations','dbem')),
|
496 |
+
'read_private_locations' => sprintf(__('User can view private %s','dbem'),__('locations','dbem')),
|
497 |
+
'read_others_locations' => __('User can use other user locations for their events.','dbem'),
|
498 |
+
/*'read_locations' => sprintf(__('User can view %s','dbem'),__('locations','dbem')),*/
|
499 |
+
),
|
500 |
+
sprintf(__('%s Capabilities','dbem'),__('Other','dbem')) => array(
|
501 |
+
/* Category Capabilities */
|
502 |
+
'delete_event_categories' => sprintf(__('User can delete %s categories and tags.','dbem'),__('event','dbem')),
|
503 |
+
'edit_event_categories' => sprintf(__('User can edit %s categories and tags.','dbem'),__('event','dbem')),
|
504 |
+
/* Booking Capabilities */
|
505 |
+
'manage_others_bookings' => __('User can manage other users individual bookings and event booking settings.','dbem'),
|
506 |
+
'manage_bookings' => __('User can use and manage bookings with their events.','dbem'),
|
507 |
+
'upload_event_images' => __('User can upload images along with their events and locations.','dbem')
|
508 |
+
)
|
509 |
+
);
|
510 |
+
?>
|
511 |
+
<?php
|
512 |
+
if( is_multisite() && is_network_admin() ){
|
513 |
+
echo em_options_radio_binary(__('Apply global capabilities?','dbem'), 'dbem_ms_global_caps', __('If set to yes the capabilities will be applied all your network blogs and you will not be able to set custom capabilities each blog. You can select no later and visit specific blog settings pages to add/remove capabilities.','dbem') );
|
514 |
+
}
|
515 |
+
?>
|
516 |
+
<tr><td colspan="2">
|
517 |
+
<table class="em-caps-table" style="width:auto;" cellspacing="0" cellpadding="0">
|
518 |
+
<thead>
|
519 |
+
<tr>
|
520 |
+
<td> </td>
|
521 |
+
<?php
|
522 |
+
$odd = 0;
|
523 |
+
foreach(array_keys($cap_docs) as $capability_group){
|
524 |
+
?><th class="<?php echo ( !is_int($odd/2) ) ? 'odd':''; ?>"><?php echo $capability_group ?></th><?php
|
525 |
+
$odd++;
|
526 |
+
}
|
527 |
+
?>
|
528 |
+
</tr>
|
529 |
+
</thead>
|
530 |
+
<tbody>
|
531 |
+
<?php foreach($wp_roles->role_objects as $role): ?>
|
532 |
+
<tr>
|
533 |
+
<td class="cap"><strong><?php echo $role->name; ?></strong></td>
|
534 |
+
<?php
|
535 |
+
$odd = 0;
|
536 |
+
foreach($cap_docs as $capability_group){
|
537 |
+
?>
|
538 |
+
<td class="<?php echo ( !is_int($odd/2) ) ? 'odd':''; ?>">
|
539 |
+
<?php foreach($capability_group as $cap => $cap_help){ ?>
|
540 |
+
<input type="checkbox" name="em_capabilities[<?php echo $role->name; ?>][<?php echo $cap ?>]" value="1" id="<?php echo $role->name.'_'.$cap; ?>" <?php echo $role->has_cap($cap) ? 'checked="checked"':''; ?> />
|
541 |
+
<label for="<?php echo $role->name.'_'.$cap; ?>"><?php echo $cap; ?></label> <a href="#" title="<?php echo $cap_help; ?>">?</a>
|
542 |
+
<br />
|
543 |
+
<?php } ?>
|
544 |
+
</td>
|
545 |
+
<?php
|
546 |
+
$odd++;
|
547 |
+
}
|
548 |
+
?>
|
549 |
+
</tr>
|
550 |
+
<?php endforeach; ?>
|
551 |
+
</tbody>
|
552 |
+
</table>
|
553 |
+
</td></tr>
|
554 |
+
<?php echo $save_button; ?>
|
555 |
+
</table>
|
556 |
+
</div> <!-- . inside -->
|
557 |
+
</div> <!-- .postbox -->
|
558 |
+
<?php
|
559 |
+
}
|
560 |
+
|
561 |
+
function em_admin_option_box_uninstall(){
|
562 |
+
global $save_button;
|
563 |
+
if( is_multisite() ){
|
564 |
+
$uninstall_url = admin_url().'network/admin.php?page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
565 |
+
$reset_url = admin_url().'network/admin.php?page=events-manager-options&action=reset&_wpnonce='.wp_create_nonce('em_reset_'.get_current_user_id().'_wpnonce');
|
566 |
+
$recheck_updates_url = admin_url().'network/admin.php?page=events-manager-options&action=recheck_updates&_wpnonce='.wp_create_nonce('em_recheck_updates_'.get_current_user_id().'_wpnonce');
|
567 |
+
$check_devs = admin_url().'network/admin.php?page=events-manager-options&action=check_devs&_wpnonce='.wp_create_nonce('em_check_devs_wpnonce');
|
568 |
+
}else{
|
569 |
+
$uninstall_url = EM_ADMIN_URL.'&page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
570 |
+
$reset_url = EM_ADMIN_URL.'&page=events-manager-options&action=reset&_wpnonce='.wp_create_nonce('em_reset_'.get_current_user_id().'_wpnonce');
|
571 |
+
$recheck_updates_url = EM_ADMIN_URL.'&page=events-manager-options&action=recheck_updates&_wpnonce='.wp_create_nonce('em_recheck_updates_'.get_current_user_id().'_wpnonce');
|
572 |
+
$check_devs = EM_ADMIN_URL.'&page=events-manager-options&action=check_devs&_wpnonce='.wp_create_nonce('em_check_devs_wpnonce');
|
573 |
+
}
|
574 |
+
?>
|
575 |
+
<div class="postbox" id="em-opt-admin-tools" >
|
576 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Admin Tools', 'dbem' ); ?> (<?php _e ( 'Advanced', 'dbem' ); ?>)</span></h3>
|
577 |
+
<div class="inside">
|
578 |
+
<table class="form-table">
|
579 |
+
<tr class="em-header"><td colspan="2">
|
580 |
+
<h4><?php _e ( 'Development Versions & Updates', 'dbem' ); ?></h4>
|
581 |
+
<p><?php _e('We\'re always making improvements, adding features and fixing bugs between releases. We incrementally make these changes in between updates and make it available as a development version. You can download these manually, but we\'ve made it easy for you. <strong>Warning:</strong> Development versions are not always fully tested before release, use wisely!','dbem'); ?></p>
|
582 |
+
</td></tr>
|
583 |
+
<?php em_options_radio_binary ( __( 'Enable Dev Updates?', 'dbem' ), 'dbem_pro_dev_updates', __('If enabled, the latest dev version will always be checked instead of the latest stable version of the plugin.', 'dbem') ); ?>
|
584 |
+
<tr>
|
585 |
+
<th style="text-align:right;"><a href="<?php echo $recheck_updates_url; ?>" class="button-secondary"><?php _e('Re-Check Updates','dbem'); ?></a></th>
|
586 |
+
<td><?php _e('If you would like to check and see if there is a new stable update.','dbem'); ?></td>
|
587 |
+
</tr>
|
588 |
+
<tr>
|
589 |
+
<th style="text-align:right;"><a href="<?php echo $check_devs; ?>" class="button-secondary"><?php _e('Check Dev Versions','dbem'); ?></a></th>
|
590 |
+
<td><?php _e('If you would like to download a dev version, but just as a one-off, you can force a dev version check by clicking the button below. If there is one available, it should appear in your plugin updates page as a regular update.','dbem'); ?></td>
|
591 |
+
</tr>
|
592 |
+
</table>
|
593 |
+
|
594 |
+
<table class="form-table">
|
595 |
+
<tr class="em-header"><td colspan="2">
|
596 |
+
<h4><?php _e ( 'Uninstall/Reset', 'dbem' ); ?></h4>
|
597 |
+
<p><?php _e('Use the buttons below to uninstall Events Manager completely from your system or reset Events Manager to original settings and keep your event data.','dbem'); ?></p>
|
598 |
+
</td></tr>
|
599 |
+
<tr><td colspan="2">
|
600 |
+
<a href="<?php echo $uninstall_url; ?>" class="button-secondary"><?php _e('Uninstall','dbem'); ?></a>
|
601 |
+
<a href="<?php echo $reset_url; ?>" class="button-secondary"><?php _e('Reset','dbem'); ?></a>
|
602 |
+
</td></tr>
|
603 |
+
</table>
|
604 |
+
<?php do_action('em_options_page_panel_admin_tools'); ?>
|
605 |
+
<?php echo $save_button; ?>
|
606 |
+
</div>
|
607 |
+
</div>
|
608 |
+
<?php
|
609 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
610 |
?>
|
admin/settings/tabs/bookings.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('list_users') ) return; ?>
|
2 |
+
<!-- BOOKING OPTIONS -->
|
3 |
+
<div class="em-menu-bookings em-menu-group" <?php if( !defined('EM_SETTINGS_TABS') || !EM_SETTINGS_TABS) : ?>style="display:none;"<?php endif; ?>>
|
4 |
+
|
5 |
+
<div class="postbox " id="em-opt-bookings-general" >
|
6 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'dbem' ),__('General','dbem')); ?> </span></h3>
|
7 |
+
<div class="inside">
|
8 |
+
<table class='form-table'>
|
9 |
+
<?php
|
10 |
+
em_options_radio_binary ( __( 'Allow guest bookings?', 'dbem' ), 'dbem_bookings_anonymous', __( 'If enabled, guest visitors can supply an email address and a user account will automatically be created for them along with their booking. They will be also be able to log back in with that newly created account.', 'dbem' ) );
|
11 |
+
em_options_radio_binary ( __( 'Approval Required?', 'dbem' ), 'dbem_bookings_approval', __( 'Bookings will not be confirmed until the event administrator approves it.', 'dbem' ).' '.__( 'This setting is not applicable when using payment gateways, see individual gateways for approval settings.', 'dbem' ));
|
12 |
+
em_options_radio_binary ( __( 'Reserved unconfirmed spaces?', 'dbem' ), 'dbem_bookings_approval_reserved', __( 'By default, event spaces become unavailable once there are enough CONFIRMED bookings. To reserve spaces even if unnapproved, choose yes.', 'dbem' ) );
|
13 |
+
em_options_radio_binary ( __( 'Can users cancel their booking?', 'dbem' ), 'dbem_bookings_user_cancellation', __( 'If enabled, users can cancel their bookings themselves from their bookings page.', 'dbem' ) );
|
14 |
+
em_options_radio_binary ( __( 'Allow overbooking when approving?', 'dbem' ), 'dbem_bookings_approval_overbooking', __( 'If you get a lot of pending bookings and you decide to allow more bookings than spaces allow, setting this to yes will allow you to override the event space limit when manually approving.', 'dbem' ) );
|
15 |
+
em_options_radio_binary ( __( 'Allow double bookings?', 'dbem' ), 'dbem_bookings_double', __( 'If enabled, users can book an event more than once.', 'dbem' ) );
|
16 |
+
echo $save_button;
|
17 |
+
?>
|
18 |
+
</table>
|
19 |
+
</div> <!-- . inside -->
|
20 |
+
</div> <!-- .postbox -->
|
21 |
+
|
22 |
+
<div class="postbox " id="em-opt-pricing-options" >
|
23 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'dbem' ),__('Pricing','dbem')); ?> </span></h3>
|
24 |
+
<div class="inside">
|
25 |
+
<table class='form-table'>
|
26 |
+
<?php
|
27 |
+
/* Tax & Currency */
|
28 |
+
em_options_select ( __( 'Currency', 'dbem' ), 'dbem_bookings_currency', em_get_currencies()->names, __( 'Choose your currency for displaying event pricing.', 'dbem' ) );
|
29 |
+
em_options_input_text ( __( 'Thousands Separator', 'dbem' ), 'dbem_bookings_currency_thousands_sep', '<code>'.get_option('dbem_bookings_currency_thousands_sep')." = ".em_get_currency_symbol().'100<strong>'.get_option('dbem_bookings_currency_thousands_sep').'</strong>000<strong>'.get_option('dbem_bookings_currency_decimal_point').'</strong>00</code>' );
|
30 |
+
em_options_input_text ( __( 'Decimal Point', 'dbem' ), 'dbem_bookings_currency_decimal_point', '<code>'.get_option('dbem_bookings_currency_decimal_point')." = ".em_get_currency_symbol().'100<strong>'.get_option('dbem_bookings_currency_decimal_point').'</strong>00</code>' );
|
31 |
+
em_options_input_text ( __( 'Currency Format', 'dbem' ), 'dbem_bookings_currency_format', __('Choose how prices are displayed. <code>@</code> will be replaced by the currency symbol, and <code>#</code> will be replaced by the number.','dbem').' <code>'.get_option('dbem_bookings_currency_format')." = ".em_get_currency_formatted('10000000').'</code>');
|
32 |
+
em_options_input_text ( __( 'Tax Rate', 'dbem' ), 'dbem_bookings_tax', __( 'Add a tax rate to your ticket prices (entering 10 will add 10% to the ticket price).', 'dbem' ) );
|
33 |
+
em_options_radio_binary ( __( 'Add tax to ticket price?', 'dbem' ), 'dbem_bookings_tax_auto_add', __( 'When displaying ticket prices and booking totals, include the tax automatically?', 'dbem' ) );
|
34 |
+
echo $save_button;
|
35 |
+
?>
|
36 |
+
</table>
|
37 |
+
</div> <!-- . inside -->
|
38 |
+
</div> <!-- .postbox -->
|
39 |
+
|
40 |
+
<div class="postbox " id="em-opt-booking-feedbacks" >
|
41 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e( 'Customize Feedback Messages', 'dbem' ); ?> </span></h3>
|
42 |
+
<div class="inside">
|
43 |
+
<p><?php _e('Below you will find texts that will be displayed to users in various areas during the bookings process, particularly on booking forms.','dbem'); ?></p>
|
44 |
+
<table class='form-table'>
|
45 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('My Bookings messages','dbem') ?></h4></td></tr>
|
46 |
+
<?php
|
47 |
+
em_options_input_text ( __( 'Booking Cancelled', 'dbem' ), 'dbem_booking_feedback_cancelled', __( 'When a user cancels their booking, this message will be displayed confirming the cancellation.', 'dbem' ) );
|
48 |
+
em_options_input_text ( __( 'Booking Cancellation Warning', 'dbem' ), 'dbem_booking_warning_cancel', __( 'When a user chooses to cancel a booking, this warning is displayed for them to confirm.', 'dbem' ) );
|
49 |
+
?>
|
50 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking form texts/messages','dbem') ?></h4></td></tr>
|
51 |
+
<?php
|
52 |
+
em_options_input_text ( __( 'Bookings disabled', 'dbem' ), 'dbem_bookings_form_msg_disabled', __( 'An event with no bookings.', 'dbem' ) );
|
53 |
+
em_options_input_text ( __( 'Bookings closed', 'dbem' ), 'dbem_bookings_form_msg_closed', __( 'Bookings have closed (e.g. event has started).', 'dbem' ) );
|
54 |
+
em_options_input_text ( __( 'Fully booked', 'dbem' ), 'dbem_bookings_form_msg_full', __( 'Event is fully booked.', 'dbem' ) );
|
55 |
+
em_options_input_text ( __( 'Already attending', 'dbem' ), 'dbem_bookings_form_msg_attending', __( 'If already attending and double bookings are disabled, this message will be displayed, followed by a link to the users booking page.', 'dbem' ) );
|
56 |
+
em_options_input_text ( __( 'Manage bookings link text', 'dbem' ), 'dbem_bookings_form_msg_bookings_link', __( 'Link text used for link to user bookings.', 'dbem' ) );
|
57 |
+
?>
|
58 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking form feedback messages','dbem') ?></h4></td></tr>
|
59 |
+
<tr><td colspan='2'><?php _e('When a booking is made by a user, a feedback message is shown depending on the result, which can be customized below.','dbem'); ?></td></tr>
|
60 |
+
<?php
|
61 |
+
em_options_input_text ( __( 'Successful booking', 'dbem' ), 'dbem_booking_feedback', __( 'When a booking is registered and confirmed.', 'dbem' ) );
|
62 |
+
em_options_input_text ( __( 'Successful pending booking', 'dbem' ), 'dbem_booking_feedback_pending', __( 'When a booking is registered but pending.', 'dbem' ) );
|
63 |
+
em_options_input_text ( __( 'Not enough spaces', 'dbem' ), 'dbem_booking_feedback_full', __( 'When a booking cannot be made due to lack of spaces.', 'dbem' ) );
|
64 |
+
em_options_input_text ( __( 'Errors', 'dbem' ), 'dbem_booking_feedback_error', __( 'When a booking cannot be made due to an error when filling the form. Below this, there will be a dynamic list of errors.', 'dbem' ) );
|
65 |
+
em_options_input_text ( __( 'Email Exists', 'dbem' ), 'dbem_booking_feedback_email_exists', __( 'When a guest tries to book using an email registered with a user account.', 'dbem' ) );
|
66 |
+
em_options_input_text ( __( 'User must log in', 'dbem' ), 'dbem_booking_feedback_log_in', __( 'When a user must log in before making a booking.', 'dbem' ) );
|
67 |
+
em_options_input_text ( __( 'Error mailing user', 'dbem' ), 'dbem_booking_feedback_nomail', __( 'If a booking is made and an email cannot be sent, this is added to the success message.', 'dbem' ) );
|
68 |
+
em_options_input_text ( __( 'Already booked', 'dbem' ), 'dbem_booking_feedback_already_booked', __( 'If the user made a previous booking and cannot double-book.', 'dbem' ) );
|
69 |
+
em_options_input_text ( __( 'No spaces booked', 'dbem' ), 'dbem_booking_feedback_min_space', __( 'If the user tries to make a booking without requesting any spaces.', 'dbem' ) );$notice_full = __('Sold Out', 'dbem');
|
70 |
+
em_options_input_text ( __( 'Maximum spaces per booking', 'dbem' ), 'dbem_booking_feedback_spaces_limit', __( 'If the user tries to make a booking with spaces that exceeds the maximum number of spaces per booking.', 'dbem' ).' '. __('%d will be replaced by a number.','dbem') );
|
71 |
+
?>
|
72 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking button feedback messages','dbem') ?></h4></td></tr>
|
73 |
+
<tr><td colspan='2'><?php echo sprintf(__('When the %s placeholder, the below texts will be used.','dbem'),'<code>#_BOOKINGBUTTON</code>'); ?></td></tr>
|
74 |
+
<?php
|
75 |
+
em_options_input_text ( __( 'User can book', 'dbem' ), 'dbem_booking_button_msg_book', '');
|
76 |
+
em_options_input_text ( __( 'Booking in progress', 'dbem' ), 'dbem_booking_button_msg_booking', '');
|
77 |
+
em_options_input_text ( __( 'Booking complete', 'dbem' ), 'dbem_booking_button_msg_booked', '');
|
78 |
+
em_options_input_text ( __( 'Booking already made', 'dbem' ), 'dbem_booking_button_msg_already_booked', '');
|
79 |
+
em_options_input_text ( __( 'Booking error', 'dbem' ), 'dbem_booking_button_msg_error', '');
|
80 |
+
em_options_input_text ( __( 'Event fully booked', 'dbem' ), 'dbem_booking_button_msg_full', '');
|
81 |
+
em_options_input_text ( __( 'Cancel', 'dbem' ), 'dbem_booking_button_msg_cancel', '');
|
82 |
+
em_options_input_text ( __( 'Cancelation in progress', 'dbem' ), 'dbem_booking_button_msg_canceling', '');
|
83 |
+
em_options_input_text ( __( 'Cancelation complete', 'dbem' ), 'dbem_booking_button_msg_cancelled', '');
|
84 |
+
em_options_input_text ( __( 'Cancelation error', 'dbem' ), 'dbem_booking_button_msg_cancel_error', '');
|
85 |
+
|
86 |
+
echo $save_button;
|
87 |
+
?>
|
88 |
+
</table>
|
89 |
+
</div> <!-- . inside -->
|
90 |
+
</div> <!-- .postbox -->
|
91 |
+
|
92 |
+
<div class="postbox " id="em-opt-booking-form-options" >
|
93 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'dbem' ),__('Booking Form','dbem')); ?> </span></h3>
|
94 |
+
<div class="inside">
|
95 |
+
<table class='form-table'>
|
96 |
+
<?php
|
97 |
+
em_options_radio_binary ( __( 'Display login form?', 'dbem' ), 'dbem_bookings_login_form', __( 'Choose whether or not to display a login form in the booking form area to remind your members to log in before booking.', 'dbem' ) );
|
98 |
+
em_options_input_text ( __( 'Submit button text', 'dbem' ), 'dbem_bookings_submit_button', sprintf(__( 'The text used by the submit button. To use an image instead, enter the full url starting with %s or %s.', 'dbem' ), '<code>http://</code>','<code>https://</code>') );
|
99 |
+
do_action('em_options_booking_form_options');
|
100 |
+
echo $save_button;
|
101 |
+
?>
|
102 |
+
</table>
|
103 |
+
</div> <!-- . inside -->
|
104 |
+
</div> <!-- .postbox -->
|
105 |
+
|
106 |
+
<div class="postbox " id="em-opt-ticket-options" >
|
107 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'dbem' ),__('Ticket','dbem')); ?> </span></h3>
|
108 |
+
<div class="inside">
|
109 |
+
<table class='form-table'>
|
110 |
+
<?php
|
111 |
+
em_options_radio_binary ( __( 'Single ticket mode?', 'dbem' ), 'dbem_bookings_tickets_single', __( 'In single ticket mode, users can only create one ticket per event (and will not see options to add more tickets).', 'dbem' ) );
|
112 |
+
em_options_radio_binary ( __( 'Show ticket table in single ticket mode?', 'dbem' ), 'dbem_bookings_tickets_single_form', __( 'If you prefer a ticket table like with multiple tickets, even for single ticket events, enable this.', 'dbem' ) );
|
113 |
+
em_options_radio_binary ( __( 'Show unavailable tickets?', 'dbem' ), 'dbem_bookings_tickets_show_unavailable', __( 'You can choose whether or not to show unavailable tickets to visitors.', 'dbem' ) );
|
114 |
+
em_options_radio_binary ( __( 'Show member-only tickets?', 'dbem' ), 'dbem_bookings_tickets_show_member_tickets', sprintf(__('%s must be set to yes for this to work.', 'dbem' ), '<strong>'.__( 'Show unavailable tickets?', 'dbem' ).'</strong>').' '.__( 'If there are member-only tickets, you can choose whether or not to show these tickets to guests.','dbem') );
|
115 |
+
|
116 |
+
em_options_radio_binary ( __( 'Show multiple tickets if logged out?', 'dbem' ), 'dbem_bookings_tickets_show_loggedout', __( 'If guests cannot make bookings, they will be asked to register in order to book. However, enabling this will still show available tickets.', 'dbem' ) );
|
117 |
+
$ticket_orders = array(
|
118 |
+
'ticket_price DESC, ticket_name ASC'=>__('Ticket Price (Descending)','dbem'),
|
119 |
+
'ticket_price ASC, ticket_name ASC'=>__('Ticket Price (Ascending)','dbem'),
|
120 |
+
'ticket_name ASC, ticket_price DESC'=>__('Ticket Name (Ascending)','dbem'),
|
121 |
+
'ticket_name DESC, ticket_price DESC'=>__('Ticket Name (Descending)','dbem')
|
122 |
+
);
|
123 |
+
em_options_select ( __( 'Order Tickets By', 'dbem' ), 'dbem_bookings_tickets_orderby', $ticket_orders, __( 'Choose which order your tickets appear.', 'dbem' ) );
|
124 |
+
echo $save_button;
|
125 |
+
?>
|
126 |
+
</table>
|
127 |
+
</div> <!-- . inside -->
|
128 |
+
</div> <!-- .postbox -->
|
129 |
+
|
130 |
+
<div class="postbox " id="em-opt-no-user-bookings" >
|
131 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e('No-User Booking Mode','dbem'); ?> </span></h3>
|
132 |
+
<div class="inside">
|
133 |
+
<table class='form-table'>
|
134 |
+
<tr><td colspan='2'>
|
135 |
+
<p><?php _e('By default, when a booking is made by a user, this booking is tied to a user account, if the user is not registered nor logged in and guest bookings are enabled, an account will be created for them.','dbem'); ?></p>
|
136 |
+
<p><?php _e('The option below allows you to disable user accounts and assign all bookings to a parent user, yet you will still see the supplied booking personal information for each booking. When this mode is enabled, extra booking information about the person is stored alongside the booking record rather than as a WordPress user.','dbem'); ?></p>
|
137 |
+
<p><?php _e('Users with accounts (which would be created by other means when this mode is enabled) will still be able to log in and make bookings linked to their account as normal.','dbem'); ?></p>
|
138 |
+
<p><?php _e('<strong>Warning : </strong> Various features afforded to users with an account will not be available, e.g. viewing bookings. Once you enable this and select a user, modifying these values will prevent older non-user bookings from displaying the correct information.','dbem'); ?></p>
|
139 |
+
</td></tr>
|
140 |
+
<?php
|
141 |
+
em_options_radio_binary ( __( 'Enable No-User Booking Mode?', 'dbem' ), 'dbem_bookings_registration_disable', __( 'This disables user registrations for bookings.', 'dbem' ) );
|
142 |
+
em_options_radio_binary ( __( 'Allow bookings with registered emails?', 'dbem' ), 'dbem_bookings_registration_disable_user_emails', __( 'By default, if a guest tries to book an event using the email of a user account on your site they will be asked to log in, selecting yes will bypass this security measure.', 'dbem' ).'<br />'.__('<strong>Warning : </strong> By enabling this, registered users will not be able to see bookings they make as guests in their "My Bookings" page.','dbem') );
|
143 |
+
$current_user = array();
|
144 |
+
if( get_option('dbem_bookings_registration_user') ){
|
145 |
+
$user = get_user_by('id',get_option('dbem_bookings_registration_user'));
|
146 |
+
$current_user[$user->ID] = $user->display_name;
|
147 |
+
}
|
148 |
+
if( defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS') && EM_OPTIMIZE_SETTINGS_PAGE_USERS ){
|
149 |
+
em_options_input_text ( __( 'Assign bookings to', 'dbem' ), 'dbem_bookings_registration_user', __('Please add a User ID.','dbem').' '.__( 'Choose a parent user to assign bookings to. People making their booking will be unaware of this and will never have access to those user details. This should be a subscriber user you do not use to log in with yourself.', 'dbem' ) );
|
150 |
+
}else{
|
151 |
+
em_options_select ( __( 'Assign bookings to', 'dbem' ), 'dbem_bookings_registration_user', em_get_wp_users(array('role' => 'subscriber'), $current_user), __( 'Choose a parent user to assign bookings to. People making their booking will be unaware of this and will never have access to those user details. This should be a subscriber user you do not use to log in with yourself.', 'dbem' ) );
|
152 |
+
}
|
153 |
+
echo $save_button;
|
154 |
+
?>
|
155 |
+
</table>
|
156 |
+
</div> <!-- . inside -->
|
157 |
+
</div> <!-- .postbox -->
|
158 |
+
|
159 |
+
<?php do_action('em_options_page_footer_bookings'); ?>
|
160 |
+
|
161 |
+
</div> <!-- .em-menu-bookings -->
|
admin/settings/tabs/emails.php
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('list_users') ) return; ?>
|
2 |
+
<!-- EMAIL OPTIONS -->
|
3 |
+
<div class="em-menu-emails em-menu-group" <?php if( !defined('EM_SETTINGS_TABS') || !EM_SETTINGS_TABS) : ?>style="display:none;"<?php endif; ?>>
|
4 |
+
|
5 |
+
<?php if ( !is_multisite() ) { em_admin_option_box_email(); } ?>
|
6 |
+
|
7 |
+
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
8 |
+
<div class="postbox " id="em-opt-booking-emails">
|
9 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Booking Email Templates', 'dbem' ); ?> </span></h3>
|
10 |
+
<div class="inside">
|
11 |
+
<?php do_action('em_options_page_booking_email_templates_options_top'); ?>
|
12 |
+
<table class='form-table'>
|
13 |
+
<?php
|
14 |
+
$email_subject_tip = __('You can disable this email by leaving the subject blank.','dbem');
|
15 |
+
em_options_input_text ( __( 'Email events admin?', 'dbem' ), 'dbem_bookings_notify_admin', __( "If you would like every event booking confirmation email sent to an administrator write their email here (leave blank to not send an email).", 'dbem' ).' '.__('For multiple emails, seperate by commas (e.g. email1@test.com,email2@test.com,etc.)','dbem') );
|
16 |
+
em_options_radio_binary ( __( 'Email event owner?', 'dbem' ), 'dbem_bookings_contact_email', __( 'Check this option if you want the event contact to receive an email when someone books places. An email will be sent when a booking is first made (regardless if confirmed or pending)', 'dbem' ) );
|
17 |
+
?>
|
18 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Admin/Owner Emails', 'dbem'); ?></h4></td></tr>
|
19 |
+
<tbody class="em-subsection">
|
20 |
+
<tr class="em-subheader"><td colspan='2'>
|
21 |
+
<h5><?php _e('Confirmed booking email','dbem') ?></h5>
|
22 |
+
<em><?php echo __('This is sent when a person\'s booking is confirmed. This will be sent automatically if approvals are required and the booking is approved. If approvals are disabled, this is sent out when a user first submits their booking.','dbem').$bookings_placeholder_tip ?></em>
|
23 |
+
</td></tr>
|
24 |
+
<?php
|
25 |
+
em_options_input_text ( __( 'Booking confirmed email subject', 'dbem' ), 'dbem_bookings_contact_email_confirmed_subject', $email_subject_tip );
|
26 |
+
em_options_textarea ( __( 'Booking confirmed email', 'dbem' ), 'dbem_bookings_contact_email_confirmed_body', '' );
|
27 |
+
?>
|
28 |
+
<tr class="em-subheader"><td colspan='2'>
|
29 |
+
<h5><?php _e('Pending booking email','dbem') ?></h5>
|
30 |
+
<em><?php echo __('This is sent when a person\'s booking is pending. If approvals are enabled, this is sent out when a user first submits their booking.','dbem').$bookings_placeholder_tip ?></em>
|
31 |
+
</td></tr>
|
32 |
+
<?php
|
33 |
+
em_options_input_text ( __( 'Booking pending email subject', 'dbem' ), 'dbem_bookings_contact_email_pending_subject', $email_subject_tip );
|
34 |
+
em_options_textarea ( __( 'Booking pending email', 'dbem' ), 'dbem_bookings_contact_email_pending_body', '' );
|
35 |
+
?>
|
36 |
+
<tr class="em-subheader"><td colspan='2'>
|
37 |
+
<h5><?php _e('Booking cancelled','dbem') ?></h5>
|
38 |
+
<em><?php echo __('An email will be sent to the event contact if someone cancels their booking.','dbem').$bookings_placeholder_tip ?></em>
|
39 |
+
</td></tr>
|
40 |
+
<?php
|
41 |
+
em_options_input_text ( __( 'Booking cancelled email subject', 'dbem' ), 'dbem_bookings_contact_email_cancelled_subject', $email_subject_tip );
|
42 |
+
em_options_textarea ( __( 'Booking cancelled email', 'dbem' ), 'dbem_bookings_contact_email_cancelled_body', '' );
|
43 |
+
?>
|
44 |
+
<tr class="em-subheader"><td colspan='2'>
|
45 |
+
<h5><?php _e('Rejected booking email','dbem') ?></h5>
|
46 |
+
<em><?php echo __( 'This will be sent to event admins when a booking is rejected.', 'dbem' ).$bookings_placeholder_tip ?></em>
|
47 |
+
</td></tr>
|
48 |
+
<?php
|
49 |
+
em_options_input_text ( __( 'Booking rejected email subject', 'dbem' ), 'dbem_bookings_contact_email_rejected_subject', $email_subject_tip );
|
50 |
+
em_options_textarea ( __( 'Booking rejected email', 'dbem' ), 'dbem_bookings_contact_email_rejected_body', '' );
|
51 |
+
?>
|
52 |
+
</tbody>
|
53 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Booked User Emails', 'dbem'); ?></h4></td></tr>
|
54 |
+
<tbody class="em-subsection">
|
55 |
+
<tr class="em-subheader"><td colspan='2'>
|
56 |
+
<h5><?php _e('Confirmed booking email','dbem') ?></h5>
|
57 |
+
<em><?php echo __('This is sent when a person\'s booking is confirmed. This will be sent automatically if approvals are required and the booking is approved. If approvals are disabled, this is sent out when a user first submits their booking.','dbem').$bookings_placeholder_tip ?></em>
|
58 |
+
</td></tr>
|
59 |
+
<?php
|
60 |
+
em_options_input_text ( __( 'Booking confirmed email subject', 'dbem' ), 'dbem_bookings_email_confirmed_subject', $email_subject_tip );
|
61 |
+
em_options_textarea ( __( 'Booking confirmed email', 'dbem' ), 'dbem_bookings_email_confirmed_body', '' );
|
62 |
+
?>
|
63 |
+
<tr class="em-subheader"><td colspan='2'>
|
64 |
+
<h5><?php _e('Pending booking email','dbem') ?></h5>
|
65 |
+
<em><?php echo __( 'This will be sent to the person when they first submit their booking. Not relevant if bookings don\'t require approval.', 'dbem' ).$bookings_placeholder_tip ?></em>
|
66 |
+
</td></tr>
|
67 |
+
<?php
|
68 |
+
em_options_input_text ( __( 'Booking pending email subject', 'dbem' ), 'dbem_bookings_email_pending_subject', $email_subject_tip);
|
69 |
+
em_options_textarea ( __( 'Booking pending email', 'dbem' ), 'dbem_bookings_email_pending_body','') ;
|
70 |
+
?>
|
71 |
+
<tr class="em-subheader"><td colspan='2'>
|
72 |
+
<h5><?php _e('Rejected booking email','dbem') ?></h5>
|
73 |
+
<em><?php echo __( 'This will be sent automatically when a booking is rejected. Not relevant if bookings don\'t require approval.', 'dbem' ).$bookings_placeholder_tip ?></em>
|
74 |
+
</td></tr>
|
75 |
+
<?php
|
76 |
+
em_options_input_text ( __( 'Booking rejected email subject', 'dbem' ), 'dbem_bookings_email_rejected_subject', $email_subject_tip );
|
77 |
+
em_options_textarea ( __( 'Booking rejected email', 'dbem' ), 'dbem_bookings_email_rejected_body', '' );
|
78 |
+
?>
|
79 |
+
<tr class="em-subheader"><td colspan='2'>
|
80 |
+
<h5><?php _e('Booking cancelled','dbem') ?></h5>
|
81 |
+
<em><?php echo __('This will be sent when a user cancels their booking.','dbem').$bookings_placeholder_tip ?></em>
|
82 |
+
</td></tr>
|
83 |
+
<?php
|
84 |
+
em_options_input_text ( __( 'Booking cancelled email subject', 'dbem' ), 'dbem_bookings_email_cancelled_subject', $email_subject_tip );
|
85 |
+
em_options_textarea ( __( 'Booking cancelled email', 'dbem' ), '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; ?>
|
90 |
+
</table>
|
91 |
+
</div> <!-- . inside -->
|
92 |
+
</div> <!-- .postbox -->
|
93 |
+
<?php endif; ?>
|
94 |
+
|
95 |
+
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
96 |
+
<div class="postbox " id="em-opt-registration-emails">
|
97 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Registration Email Templates', 'dbem' ); ?> </span></h3>
|
98 |
+
<div class="inside">
|
99 |
+
<p class="em-boxheader">
|
100 |
+
<?php echo sprintf(__('This is only applicable when %s is not active.','dbem'), '<em>'.__('No-User Booking Mode','dbem').'</em>'); ?>
|
101 |
+
<?php _e('When a guest user makes a booking for the first time in Events Manager, a new user account is created for them and they are sent their credentials in a seperate email, which can be modified below.','dbem'); ?>
|
102 |
+
</p>
|
103 |
+
<table class='form-table'>
|
104 |
+
<?php
|
105 |
+
em_options_radio_binary ( __( 'Disable new registration email?', 'dbem' ), 'dbem_email_disable_registration', __( 'Check this option if you want to prevent the WordPress registration email from going out when a user anonymously books an event.', 'dbem' ) );
|
106 |
+
|
107 |
+
em_options_input_text ( __( 'Registration email subject', 'dbem' ), 'dbem_bookings_email_registration_subject' );
|
108 |
+
em_options_textarea ( __( 'Registration email', 'dbem' ), 'dbem_bookings_email_registration_body', sprintf(__('%s is replaced by username and %s is replaced by the user password.','dbem'),'<code>%username%</code>','<code>%password%</code>') );
|
109 |
+
echo $save_button;
|
110 |
+
?>
|
111 |
+
</table>
|
112 |
+
</div> <!-- . inside -->
|
113 |
+
</div> <!-- .postbox -->
|
114 |
+
<?php endif; ?>
|
115 |
+
|
116 |
+
<div class="postbox " id="em-opt-event-submission-emails" >
|
117 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Event Submission Templates', 'dbem' ); ?> </span></h3>
|
118 |
+
<div class="inside">
|
119 |
+
<table class='form-table'>
|
120 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Admin Emails', 'dbem'); ?></h4></td></tr>
|
121 |
+
<?php
|
122 |
+
em_options_input_text ( __( 'Administrator Email', 'dbem' ), 'dbem_event_submitted_email_admin', __('Event submission notifications will be sent to emails added here.','dbem').' '.__('If left blank, no emails will be sent. Seperate emails with commas for more than one email.','dbem') );
|
123 |
+
?>
|
124 |
+
<tbody class="em-subsection">
|
125 |
+
<tr class="em-subheader"><td colspan='2'>
|
126 |
+
<h5><?php _e('Event Submitted','dbem') ?></h5>
|
127 |
+
<em><?php echo __('An email will be sent to your administrator emails when an event is submitted and pending approval.','dbem').$bookings_placeholder_tip ?></em>
|
128 |
+
</td></tr>
|
129 |
+
<?php
|
130 |
+
em_options_input_text ( __( 'Event submitted subject', 'dbem' ), 'dbem_event_submitted_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
131 |
+
em_options_textarea ( __( 'Event submitted email', 'dbem' ), 'dbem_event_submitted_email_body', '' );
|
132 |
+
?>
|
133 |
+
<tr class="em-subheader"><td colspan='2'>
|
134 |
+
<h5><?php _e('Event Re-Submitted','dbem') ?></h5>
|
135 |
+
<em><?php echo __('When a user modifies a previously published event, it will be put back into pending review status and will not be publisehd until you re-approve it.','dbem').$bookings_placeholder_tip ?></em>
|
136 |
+
</td></tr>
|
137 |
+
<?php
|
138 |
+
em_options_input_text ( __( 'Event resubmitted subject', 'dbem' ), 'dbem_event_resubmitted_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
139 |
+
em_options_textarea ( __( 'Event resubmitted email', 'dbem' ), 'dbem_event_resubmitted_email_body', '' );
|
140 |
+
?>
|
141 |
+
<tr class="em-subheader"><td colspan='2'>
|
142 |
+
<h5><?php _e('Event Published','dbem') ?></h5>
|
143 |
+
<em><?php echo __('An email will be sent to an administrator of your choice when an event is published by users who are not administrators.','dbem').$bookings_placeholder_tip ?>
|
144 |
+
</td></tr>
|
145 |
+
<?php
|
146 |
+
em_options_input_text ( __( 'Event published subject', 'dbem' ), 'dbem_event_published_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
147 |
+
em_options_textarea ( __( 'Event published email', 'dbem' ), 'dbem_event_published_email_body', '' );
|
148 |
+
?>
|
149 |
+
</tbody>
|
150 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Submitter Emails', 'dbem'); ?></h4></td></tr>
|
151 |
+
<tbody class="em-subsection">
|
152 |
+
<tr class="em-subheader"><td colspan='2'>
|
153 |
+
<h5><?php _e('Event Approved','dbem') ?></h5>
|
154 |
+
<em><?php echo __('An email will be sent to the event owner when their event is approved. Users requiring event approval do not have the <code>publish_events</code> capability.','dbem').$bookings_placeholder_tip ?>
|
155 |
+
</td></tr>
|
156 |
+
<?php
|
157 |
+
em_options_input_text ( __( 'Event approved subject', 'dbem' ), 'dbem_event_approved_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
158 |
+
em_options_textarea ( __( 'Event approved email', 'dbem' ), 'dbem_event_approved_email_body', '' );
|
159 |
+
?>
|
160 |
+
<tr class="em-subheader"><td colspan='2'>
|
161 |
+
<h5><?php _e('Event Reapproved','dbem') ?></h5>
|
162 |
+
<?php echo __('When a user modifies a previously published event, it will be put back into pending review status and will not be publisehd until you re-approve it.','dbem').$bookings_placeholder_tip ?>
|
163 |
+
</td></tr>
|
164 |
+
<?php
|
165 |
+
em_options_input_text ( __( 'Event reapproved subject', 'dbem' ), 'dbem_event_reapproved_email_subject', __('If left blank, this email will not be sent.','dbem') );
|
166 |
+
em_options_textarea ( __( 'Event reapproved email', 'dbem' ), 'dbem_event_reapproved_email_body', '' );
|
167 |
+
?>
|
168 |
+
</tbody>
|
169 |
+
<?php echo $save_button; ?>
|
170 |
+
</table>
|
171 |
+
</div> <!-- . inside -->
|
172 |
+
</div> <!-- .postbox -->
|
173 |
+
|
174 |
+
<?php do_action('em_options_page_footer_emails'); ?>
|
175 |
+
|
176 |
+
</div><!-- .em-group-emails -->
|
admin/settings/tabs/formats.php
ADDED
@@ -0,0 +1,469 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('list_users') ) return; ?>
|
2 |
+
<!-- FORMAT OPTIONS -->
|
3 |
+
<div class="em-menu-formats em-menu-group" <?php if( !defined('EM_SETTINGS_TABS') || !EM_SETTINGS_TABS) : ?>style="display:none;"<?php endif; ?>>
|
4 |
+
<div class="postbox " id="em-opt-events-formats" >
|
5 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Events', 'dbem' ); ?> </span></h3>
|
6 |
+
<div class="inside">
|
7 |
+
<table class="form-table">
|
8 |
+
<tr class="em-header"><td colspan="2">
|
9 |
+
<h4><?php echo sprintf(__('%s Page','dbem'),__('Events','dbem')); ?></h4>
|
10 |
+
<p><?php _e('These formats will be used on your events page. This will also be used if you do not provide specified formats in other event lists, like in shortcodes.','dbem'); ?></p>
|
11 |
+
</td></tr>
|
12 |
+
<?php
|
13 |
+
$grouby_modes = array(0=>__('None','dbem'), 'yearly'=>__('Yearly','dbem'), 'monthly'=>__('Monthly','dbem'), 'weekly'=>__('Weekly','dbem'), 'daily'=>__('Daily','dbem'));
|
14 |
+
em_options_select(__('Events page grouping','dbem'), 'dbem_event_list_groupby', $grouby_modes, __('If you choose a group by mode, your events page will display events in groups of your chosen time range.','dbem'));
|
15 |
+
em_options_input_text(__('Events page grouping header','dbem'), 'dbem_event_list_groupby_header_format', __('Choose how to format your group headings.','dbem').' '. sprintf(__('#s will be replaced by the date format below', 'dbem'), 'http://codex.wordpress.org/Formatting_Date_and_Time'));
|
16 |
+
em_options_input_text(__('Events page grouping date format','dbem'), 'dbem_event_list_groupby_format', __('Choose how to format your group heading dates. Leave blank for default.','dbem').' '. sprintf(__('Date and Time formats follow the <a href="%s">WordPress time formatting conventions</a>', 'dbem'), 'http://codex.wordpress.org/Formatting_Date_and_Time'));
|
17 |
+
em_options_textarea ( __( 'Default event list format header', 'dbem' ), 'dbem_event_list_item_format_header', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
|
18 |
+
em_options_textarea ( __( 'Default event list format', 'dbem' ), 'dbem_event_list_item_format', __( 'The format of any events in a list.', 'dbem' ).$events_placeholder_tip );
|
19 |
+
em_options_textarea ( __( 'Default event list format footer', 'dbem' ), 'dbem_event_list_item_format_footer', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
|
20 |
+
em_options_input_text ( __( 'No events message', 'dbem' ), 'dbem_no_events_message', __( 'The message displayed when no events are available.', 'dbem' ) );
|
21 |
+
em_options_input_text ( __( 'List events by date title', 'dbem' ), 'dbem_list_date_title', __( 'If viewing a page for events on a specific date, this is the title that would show up. To insert date values, use <a href="http://www.php.net/manual/en/function.date.php">PHP time format characters</a> with a <code>#</code> symbol before them, i.e. <code>#m</code>, <code>#M</code>, <code>#j</code>, etc.<br/>', 'dbem' ) );
|
22 |
+
?>
|
23 |
+
<tr class="em-header">
|
24 |
+
<td colspan="2">
|
25 |
+
<h4><?php echo sprintf(__('Single %s Page','dbem'),__('Event','dbem')); ?></h4>
|
26 |
+
<em><?php echo sprintf(__('These formats can be used on %s pages or on other areas of your site displaying an %s.','dbem'),__('event','dbem'),__('event','dbem'));?></em>
|
27 |
+
</tr>
|
28 |
+
<?php
|
29 |
+
if( EM_MS_GLOBAL && !get_option('dbem_ms_global_events_links') ){
|
30 |
+
em_options_input_text ( sprintf(__( 'Single %s title format', 'dbem' ),__('event','dbem')), 'dbem_event_page_title_format', sprintf(__( 'The format of a single %s page title.', 'dbem' ),__('event','dbem')).' '.__( 'This is only used when showing events from other blogs.', 'dbem' ).$events_placeholder_tip );
|
31 |
+
}
|
32 |
+
em_options_textarea ( sprintf(__('Single %s page format', 'dbem' ),__('event','dbem')), 'dbem_single_event_format', sprintf(__( 'The format used to display %s content on single pages or elsewhere on your site.', 'dbem' ),__('event','dbem')).$events_placeholder_tip );
|
33 |
+
?>
|
34 |
+
<tr class="em-header">
|
35 |
+
<td colspan="2">
|
36 |
+
<h4><?php echo sprintf(__('%s Excerpts','dbem'),__('Event','dbem')); ?></h4>
|
37 |
+
<em><?php echo sprintf(__('These formats can be used when WordPress automatically displays %s excerpts on your site and %s is enabled in your %s settings tab.','dbem'),__('event','dbem'),'<strong>'.__( 'Override Excerpts with Formats?', 'dbem' ).'</strong>','<a href="#formats" class="nav-tab-link" rel="#em-menu-pages">'.__('Pages','dbem').' > '.sprintf(__('%s List/Archives','dbem'),__('Event','dbem')).'</a>');?></em>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
<?php
|
41 |
+
em_options_textarea ( sprintf(__('%s excerpt', 'dbem' ),__('Event','dbem')), 'dbem_event_excerpt_format', __( 'Used if an excerpt has been defined.', 'dbem' ).$events_placeholder_tip );
|
42 |
+
em_options_textarea ( sprintf(__('%s excerpt fallback', 'dbem' ),__('Event','dbem')), 'dbem_event_excerpt_alt_format', __( 'Used if an excerpt has not been defined.', 'dbem' ).$events_placeholder_tip );
|
43 |
+
|
44 |
+
echo $save_button;
|
45 |
+
?>
|
46 |
+
</table>
|
47 |
+
</div> <!-- . inside -->
|
48 |
+
</div> <!-- .postbox -->
|
49 |
+
|
50 |
+
<div class="postbox " id="em-opt-search-form" >
|
51 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Search Form', 'dbem' ); ?> </span></h3>
|
52 |
+
<div class="inside">
|
53 |
+
<table class="form-table em-search-form-main">
|
54 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Main Search Fields','dbem'); ?></h4></td></tr>
|
55 |
+
<tbody class="em-subsection">
|
56 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Search', 'dbem' ); ?></h5></td></tr>
|
57 |
+
<?php
|
58 |
+
em_options_radio_binary ( __( 'Show text search?', 'dbem' ), 'dbem_search_form_text', '', '', '#dbem_search_form_text_label_row' );
|
59 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_text_label', __('Appears within the input box.','dbem') );
|
60 |
+
?>
|
61 |
+
</tbody>
|
62 |
+
<tbody class="em-settings-geocoding em-subsection">
|
63 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Geolocation Search', 'dbem' ); ?></h5></td></tr>
|
64 |
+
<?php
|
65 |
+
em_options_radio_binary ( __( 'Show geolocation search?', 'dbem' ), 'dbem_search_form_geo', '', '', '#dbem_search_form_geo_label_row, #dbem_search_form_geo_distance_default_row, #dbem_search_form_geo_unit_default_row' );
|
66 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_geo_label', __('Appears within the input box.','dbem') );
|
67 |
+
em_options_input_text ( __( 'Default distance', 'dbem' ), 'dbem_search_form_geo_distance_default', __('Enter a number.','dbem'), '');
|
68 |
+
em_options_select ( __( 'Default distance unit', 'dbem' ), 'dbem_search_form_geo_unit_default', array('km'=>'km','mi'=>'mi'), '');
|
69 |
+
?>
|
70 |
+
</tbody>
|
71 |
+
</table>
|
72 |
+
<table class="form-table">
|
73 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Advanced Search Fields','dbem'); ?></h4></td></tr>
|
74 |
+
<?php
|
75 |
+
em_options_radio_binary ( __( 'Enable advanced fields?', 'dbem' ), 'dbem_search_form_advanced', __('Enables additional advanced search fields such as dates, country, etc.','dbem'), '', '.em-search-form-advanced' );
|
76 |
+
?>
|
77 |
+
<tbody class="em-search-form-advanced">
|
78 |
+
<?php
|
79 |
+
em_options_input_text ( __( 'Search button text', 'dbem' ), 'dbem_search_form_submit', __("If there's no fields to show in the main search section, this button will be used instead at the bottom of the advanced fields.",'dbem'));
|
80 |
+
em_options_radio_binary ( __( 'Hidden by default?', 'dbem' ), 'dbem_search_form_advanced_hidden', __('If set to yes, advanced search fields will be hidden by default and can be revealed by clicking the "Advanced Search" link.','dbem'), '', '#dbem_search_form_advanced_show_row, #dbem_search_form_advanced_hide_row' );
|
81 |
+
em_options_input_text ( __( 'Show label', 'dbem' ), 'dbem_search_form_advanced_show', __('Appears as the label for this search option.','dbem') );
|
82 |
+
em_options_input_text ( __( 'Hide label', 'dbem' ), 'dbem_search_form_advanced_hide', __('Appears as the label for this search option.','dbem') );
|
83 |
+
?>
|
84 |
+
</tbody>
|
85 |
+
<tbody class="em-search-form-advanced em-subsection">
|
86 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Dates', 'dbem' ); ?></h5></td></tr>
|
87 |
+
<?php
|
88 |
+
em_options_radio_binary ( __( 'Show date range?', 'dbem' ), 'dbem_search_form_dates', '', '', '#dbem_search_form_dates_label_row, #dbem_search_form_dates_separator_row' );
|
89 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_dates_label', __('Appears as the label for this search option.','dbem') );
|
90 |
+
em_options_input_text ( __( 'Date Separator', 'dbem' ), 'dbem_search_form_dates_separator', sprintf(__( 'For when start/end %s are present, this will seperate the two (include spaces here if necessary).', 'dbem' ), __('dates','dbem')) );
|
91 |
+
?>
|
92 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Category', 'dbem' ); ?></h5></td></tr>
|
93 |
+
<?php
|
94 |
+
em_options_radio_binary ( __( 'Show categories?', 'dbem' ), 'dbem_search_form_categories', '', '', '#dbem_search_form_category_label_row, #dbem_search_form_categories_label_row' );
|
95 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_category_label', __('Appears as the label for this search option.','dbem') );
|
96 |
+
em_options_input_text ( __( 'Categories dropdown label', 'dbem' ), 'dbem_search_form_categories_label', __('Appears as the first default search option.','dbem') );
|
97 |
+
?>
|
98 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Geolocation Search', 'dbem' ); ?></h5></td></tr>
|
99 |
+
<?php
|
100 |
+
em_options_radio_binary ( __( 'Show distance options?', 'dbem' ), 'dbem_search_form_geo_units', '', '', '#dbem_search_form_geo_units_label_row, #dbem_search_form_geo_distance_options_row' );
|
101 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_geo_units_label', __('Appears as the label for this search option.','dbem') );
|
102 |
+
em_options_input_text ( __( 'Distance Values', 'dbem' ), 'dbem_search_form_geo_distance_options', __('The numerical units shown to those searching by distance. Use comma-seperated numers, such as "25,50,100".','dbem') );
|
103 |
+
?>
|
104 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Country', 'dbem' ); ?></h5></td></tr>
|
105 |
+
<?php
|
106 |
+
em_options_radio_binary ( __( 'Show countries?', 'dbem' ), 'dbem_search_form_countries', '', '', '#dbem_search_form_country_label_row, #dbem_search_form_countries_label_row' );
|
107 |
+
em_options_select ( __( 'Default Country', 'dbem' ), 'dbem_search_form_default_country', em_get_countries(__('no default country', 'dbem')), __('Search form will be pre-selected with this country, if searching by country is disabled above, only search results from this country will be returned.','dbem') );
|
108 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_country_label', __('Appears as the label for this search option.','dbem') );
|
109 |
+
em_options_input_text ( __( 'All countries text', 'dbem' ), 'dbem_search_form_countries_label', __('Appears as the first default search option.','dbem') );
|
110 |
+
?>
|
111 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Region', 'dbem' ); ?></h5></td></tr>
|
112 |
+
<?php
|
113 |
+
em_options_radio_binary ( __( 'Show regions?', 'dbem' ), 'dbem_search_form_regions', '', '', '#dbem_search_form_region_label_row, #dbem_search_form_regions_label_row' );
|
114 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_region_label', __('Appears as the label for this search option.','dbem') );
|
115 |
+
em_options_input_text ( __( 'All regions text', 'dbem' ), 'dbem_search_form_regions_label', __('Appears as the first default search option.','dbem') );
|
116 |
+
?>
|
117 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'State/County', 'dbem' ); ?></h5></td></tr>
|
118 |
+
<?php
|
119 |
+
em_options_radio_binary ( __( 'Show states?', 'dbem' ), 'dbem_search_form_states', '', '', '#dbem_search_form_state_label_row, #dbem_search_form_states_label_row' );
|
120 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_state_label', __('Appears as the label for this search option.','dbem') );
|
121 |
+
em_options_input_text ( __( 'All states text', 'dbem' ), 'dbem_search_form_states_label', __('Appears as the first default search option.','dbem') );
|
122 |
+
?>
|
123 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'City/Town', 'dbem' ); ?></h5></td></tr>
|
124 |
+
<?php
|
125 |
+
em_options_radio_binary ( __( 'Show towns/cities?', 'dbem' ), 'dbem_search_form_towns', '', '', '#dbem_search_form_town_label_row, #dbem_search_form_towns_label_row' );
|
126 |
+
em_options_input_text ( __( 'Label', 'dbem' ), 'dbem_search_form_town_label', __('Appears as the label for this search option.','dbem') );
|
127 |
+
em_options_input_text ( __( 'All towns/cities text', 'dbem' ), 'dbem_search_form_towns_label', __('Appears as the first default search option.','dbem') );
|
128 |
+
?>
|
129 |
+
</tbody>
|
130 |
+
<?php echo $save_button; ?>
|
131 |
+
</table>
|
132 |
+
</div> <!-- . inside -->
|
133 |
+
</div> <!-- .postbox -->
|
134 |
+
|
135 |
+
<div class="postbox " id="em-opt-date-time" >
|
136 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Date/Time', 'dbem' ); ?> </span></h3>
|
137 |
+
<div class="inside">
|
138 |
+
<p class="em-boxheader"><?php
|
139 |
+
$date_time_format_tip = sprintf(__('Date and Time formats follow the <a href="%s">WordPress time formatting conventions</a>', 'dbem'), 'http://codex.wordpress.org/Formatting_Date_and_Time');
|
140 |
+
echo $date_time_format_tip;
|
141 |
+
?></p>
|
142 |
+
<table class="form-table">
|
143 |
+
<?php
|
144 |
+
em_options_input_text ( __( 'Date Format', 'dbem' ), 'dbem_date_format', sprintf(__('For use with the %s placeholder','dbem'),'<code>#_EVENTDATES</code>') );
|
145 |
+
em_options_input_text ( __( 'Date Picker Format', 'dbem' ), 'dbem_date_format_js', sprintf(__( 'Same as <em>Date Format</em>, but this is used for the datepickers used by Events Manager. This uses a slightly different format to the others on here, for a list of characters to use, visit the <a href="%s">jQuery formatDate reference</a>', 'dbem' ),'http://docs.jquery.com/UI/Datepicker/formatDate') );
|
146 |
+
em_options_input_text ( __( 'Date Separator', 'dbem' ), 'dbem_dates_separator', sprintf(__( 'For when start/end %s are present, this will seperate the two (include spaces here if necessary).', 'dbem' ), __('dates','dbem')) );
|
147 |
+
em_options_input_text ( __( 'Time Format', 'dbem' ), 'dbem_time_format', sprintf(__('For use with the %s placeholder','dbem'),'<code>#_EVENTTIMES</code>') );
|
148 |
+
em_options_input_text ( __( 'Time Separator', 'dbem' ), 'dbem_times_separator', sprintf(__( 'For when start/end %s are present, this will seperate the two (include spaces here if necessary).', 'dbem' ), __('times','dbem')) );
|
149 |
+
em_options_input_text ( __( 'All Day Message', 'dbem' ), 'dbem_event_all_day_message', sprintf(__( 'If an event lasts all day, this text will show if using the %s placeholder', 'dbem' ), '<code>#_EVENTTIMES</code>') );
|
150 |
+
em_options_radio_binary ( __( 'Use 24h Format?', 'dbem' ), 'dbem_time_24h', __( 'When creating events, would you like your times to be shown in 24 hour format?', 'dbem' ) );
|
151 |
+
echo $save_button;
|
152 |
+
?>
|
153 |
+
</table>
|
154 |
+
</div> <!-- . inside -->
|
155 |
+
</div> <!-- .postbox -->
|
156 |
+
|
157 |
+
<div class="postbox " id="em-opt-calendar-formats" >
|
158 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Calendar', 'dbem' ); ?></span></h3>
|
159 |
+
<div class="inside">
|
160 |
+
<table class="form-table">
|
161 |
+
<?php
|
162 |
+
em_options_radio_binary ( __( 'Link directly to event on day with single event?', 'dbem' ), '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).",'dbem' ) );
|
163 |
+
em_options_radio_binary ( __( 'Show list on day with single event?', 'dbem' ), 'dbem_display_calendar_day_single', __( "By default, if a calendar day only has one event, it display a single event when clicking on the link of that calendar date. If you select Yes here, you will get always see a list of events.",'dbem' ) );
|
164 |
+
?>
|
165 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Small Calendar','dbem'); ?></h4></td></tr>
|
166 |
+
<?php
|
167 |
+
em_options_input_text ( __( 'Month format', 'dbem' ), 'dbem_small_calendar_month_format', __('The format of the month/year header of the calendar.','dbem').' '.$date_time_format_tip);
|
168 |
+
em_options_input_text ( __( 'Event titles', 'dbem' ), 'dbem_small_calendar_event_title_format', __( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ).$events_placeholder_tip );
|
169 |
+
em_options_input_text ( __( 'Title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
|
170 |
+
em_options_radio_binary( __( 'Abbreviated weekdays', 'dbem' ), 'dbem_small_calendar_abbreviated_weekdays', __( 'The calendar headings uses abbreviated weekdays','dbem') );
|
171 |
+
em_options_input_text ( __( 'Initial lengths', 'dbem' ), 'dbem_small_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'dbem' ).$events_placeholder_tip );
|
172 |
+
em_options_radio_binary( __( 'Show Long Events?', 'dbem' ), 'dbem_small_calendar_long_events', __( 'Events with multiple dates will appear on each of those dates in the calendar.','dbem') );
|
173 |
+
?>
|
174 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Full Calendar','dbem'); ?></h4></td></tr>
|
175 |
+
<?php
|
176 |
+
em_options_input_text ( __( 'Month format', 'dbem' ), 'dbem_full_calendar_month_format', __('The format of the month/year header of the calendar.','dbem').' '.$date_time_format_tip);
|
177 |
+
em_options_input_text ( __( 'Event format', 'dbem' ), 'dbem_full_calendar_event_format', __( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ).$events_placeholder_tip );
|
178 |
+
em_options_radio_binary( __( 'Abbreviated weekdays?', 'dbem' ), 'dbem_full_calendar_abbreviated_weekdays', __( 'Use abbreviations, e.g. Friday = Fri. Useful for certain languages where abbreviations differ from full names.','dbem') );
|
179 |
+
em_options_input_text ( __( 'Initial lengths', 'dbem' ), 'dbem_full_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'dbem' ).$events_placeholder_tip);
|
180 |
+
em_options_radio_binary( __( 'Show Long Events?', 'dbem' ), 'dbem_full_calendar_long_events', __( 'Events with multiple dates will appear on each of those dates in the calendar.','dbem') );
|
181 |
+
?>
|
182 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo __('Calendar Day Event List Settings','dbem'); ?></h4></td></tr>
|
183 |
+
<tr valign="top" id='dbem_display_calendar_orderby_row'>
|
184 |
+
<th scope="row"><?php _e('Default event list ordering','dbem'); ?></th>
|
185 |
+
<td>
|
186 |
+
<select name="dbem_display_calendar_orderby" >
|
187 |
+
<?php
|
188 |
+
$orderby_options = apply_filters('dbem_display_calendar_orderby_ddm', array(
|
189 |
+
'event_name,event_start_time' => __('Order by event name, then event start time','dbem'),
|
190 |
+
'event_start_time,event_name' => __('Order by event start time, then event name','dbem')
|
191 |
+
));
|
192 |
+
?>
|
193 |
+
<?php foreach($orderby_options as $key => $value) : ?>
|
194 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_display_calendar_orderby')) ? "selected='selected'" : ''; ?>>
|
195 |
+
<?php echo esc_html($value) ?>
|
196 |
+
</option>
|
197 |
+
<?php endforeach; ?>
|
198 |
+
</select>
|
199 |
+
<select name="dbem_display_calendar_order" >
|
200 |
+
<?php
|
201 |
+
$ascending = __('Ascending','dbem');
|
202 |
+
$descending = __('Descending','dbem');
|
203 |
+
$order_options = apply_filters('dbem_display_calendar_order_ddm', array(
|
204 |
+
'ASC' => __('All Ascending','dbem'),
|
205 |
+
'DESC,ASC' => "$descending, $ascending",
|
206 |
+
'DESC,DESC' => "$descending, $descending",
|
207 |
+
'DESC' => __('All Descending','dbem')
|
208 |
+
));
|
209 |
+
?>
|
210 |
+
<?php foreach( $order_options as $key => $value) : ?>
|
211 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_display_calendar_order')) ? "selected='selected'" : ''; ?>>
|
212 |
+
<?php echo esc_html($value) ?>
|
213 |
+
</option>
|
214 |
+
<?php endforeach; ?>
|
215 |
+
</select>
|
216 |
+
<br/>
|
217 |
+
<em><?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?></em>
|
218 |
+
</td>
|
219 |
+
</tr>
|
220 |
+
<?php
|
221 |
+
em_options_input_text ( __( 'Calendar events/day limit', 'dbem' ), 'dbem_display_calendar_events_limit', __( 'Limits the number of events on each calendar day. Leave blank for no limit.', 'dbem' ) );
|
222 |
+
em_options_input_text ( __( 'More Events message', 'dbem' ), 'dbem_display_calendar_events_limit_msg', __( 'Text with link to calendar day page with all events for that day if there are more events than the limit above, leave blank for no link as the day number is also a link.', 'dbem' ) );
|
223 |
+
?>
|
224 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('iCal Feed Settings','dbem'),__('Event','dbem')); ?></h4></td></tr>
|
225 |
+
<?php
|
226 |
+
em_options_input_text ( __( 'iCal Title', 'dbem' ), 'dbem_ical_description_format', __( 'The title that will appear in the calendar.', 'dbem' ).$events_placeholder_tip );
|
227 |
+
em_options_input_text ( __( 'iCal Description', 'dbem' ), 'dbem_ical_real_description_format', __( 'The description of the event that will appear in the calendar.', 'dbem' ).$events_placeholder_tip );
|
228 |
+
em_options_input_text ( __( 'iCal Location', 'dbem' ), 'dbem_ical_location_format', __( 'The location information that will appear in the calendar.', 'dbem' ).$events_placeholder_tip );
|
229 |
+
em_options_select( __('iCal Scope','dbem'), 'dbem_ical_scope', em_get_scopes(), __('Choose to show events within a specific time range.','dbem'));
|
230 |
+
em_options_input_text ( __( 'iCal Limit', 'dbem' ), 'dbem_ical_limit', __( 'Limits the number of future events shown (0 = unlimited).', 'dbem' ) );
|
231 |
+
echo $save_button;
|
232 |
+
?>
|
233 |
+
</table>
|
234 |
+
</div> <!-- . inside -->
|
235 |
+
</div> <!-- .postbox -->
|
236 |
+
|
237 |
+
<?php if( get_option('dbem_locations_enabled') ): ?>
|
238 |
+
<div class="postbox " id="em-opt-locations-formats" >
|
239 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Locations', 'dbem' ); ?> </span></h3>
|
240 |
+
<div class="inside">
|
241 |
+
<table class="form-table">
|
242 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','dbem'),__('Locations','dbem')); ?></h4></td></tr>
|
243 |
+
<?php
|
244 |
+
em_options_textarea ( sprintf(__('%s list header format','dbem'),__('Locations','dbem')), 'dbem_location_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'dbem' ), __('locations','dbem')) );
|
245 |
+
em_options_textarea ( sprintf(__('%s list item format','dbem'),__('Locations','dbem')), 'dbem_location_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'dbem' ), __('locations','dbem')).$locations_placeholder_tip );
|
246 |
+
em_options_textarea ( sprintf(__('%s list footer format','dbem'),__('Locations','dbem')), 'dbem_location_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'dbem' ), __('locations','dbem')) );
|
247 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('Locations','dbem')), 'dbem_no_locations_message', sprintf( __( 'The message displayed when no %s are available.', 'dbem' ), __('locations','dbem')) );
|
248 |
+
?>
|
249 |
+
<tr class="em-header">
|
250 |
+
<td colspan="2">
|
251 |
+
<h4><?php echo sprintf(__('Single %s Page','dbem'),__('Location','dbem')); ?></h4>
|
252 |
+
<em><?php echo sprintf(__('These formats can be used on %s pages or on other areas of your site displaying an %s.','dbem'),__('location','dbem'),__('location','dbem'));?></em>
|
253 |
+
</tr>
|
254 |
+
<?php
|
255 |
+
if( EM_MS_GLOBAL && get_option('dbem_ms_global_location_links') ){
|
256 |
+
em_options_input_text (sprintf( __( 'Single %s title format', 'dbem' ),__('location','dbem')), 'dbem_location_page_title_format', sprintf(__( 'The format of a single %s page title.', 'dbem' ),__('location','dbem')).$locations_placeholder_tip );
|
257 |
+
}
|
258 |
+
em_options_textarea ( sprintf(__('Single %s page format', 'dbem' ),__('location','dbem')), 'dbem_single_location_format', sprintf(__( 'The format of a single %s page.', 'dbem' ),__('location','dbem')).$locations_placeholder_tip );
|
259 |
+
?>
|
260 |
+
<tr class="em-header">
|
261 |
+
<td colspan="2">
|
262 |
+
<h4><?php echo sprintf(__('%s Excerpts','dbem'),__('Location','dbem')); ?></h4>
|
263 |
+
<em><?php echo sprintf(__('These formats can be used when WordPress automatically displays %s excerpts on your site and %s is enabled in your %s settings tab.','dbem'),__('location','dbem'),'<strong>'.__( 'Override Excerpts with Formats?', 'dbem' ).'</strong>','<a href="#formats" class="nav-tab-link" rel="#em-menu-pages">'.__('Pages','dbem').' > '.sprintf(__('%s List/Archives','dbem'),__('Location','dbem')).'</a>');?></em>
|
264 |
+
</td>
|
265 |
+
</tr>
|
266 |
+
<?php
|
267 |
+
em_options_textarea ( sprintf(__('%s excerpt', 'dbem' ),__('Location','dbem')), 'dbem_location_excerpt_format', __( 'Used if an excerpt has been defined.', 'dbem' ).$locations_placeholder_tip );
|
268 |
+
em_options_textarea ( sprintf(__('%s excerpt fallback', 'dbem' ),__('Location','dbem')), 'dbem_location_excerpt_alt_format', __( 'Used if an excerpt has not been defined.', 'dbem' ).$locations_placeholder_tip );
|
269 |
+
?>
|
270 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','dbem'),__('Event','dbem')); ?></h4></td></tr>
|
271 |
+
<?php
|
272 |
+
em_options_input_text ( __( 'Default event list format header', 'dbem' ), 'dbem_location_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
|
273 |
+
em_options_textarea ( sprintf(__( 'Default %s list format', 'dbem' ),__('events','dbem')), 'dbem_location_event_list_item_format', sprintf(__( 'The format of the events the list inserted in the location page through the %s element.', 'dbem' ).$events_placeholder_tip, '<code>#_LOCATIONNEXTEVENTS</code>, <code>#_LOCATIONPASTEVENTS</code>, <code>#_LOCATIONALLEVENTS</code>') );
|
274 |
+
em_options_input_text ( __( 'Default event list format footer', 'dbem' ), 'dbem_location_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
|
275 |
+
em_options_textarea ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_location_no_events_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_LOCATIONNEXTEVENTS</code>, <code>#_LOCATIONPASTEVENTS</code>, <code>#_LOCATIONALLEVENTS</code>') );
|
276 |
+
?>
|
277 |
+
<tr class="em-header"><td colspan="2">
|
278 |
+
<h4><?php echo sprintf(__('Single %s Format','dbem'),__('Event','dbem')); ?></h4>
|
279 |
+
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','dbem'), '<code>#_LOCATIONNEXTEVENT</code>'); ?></p>
|
280 |
+
</td></tr>
|
281 |
+
<?php
|
282 |
+
em_options_input_text ( __( 'Next event format', 'dbem' ), 'dbem_location_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'dbem' ),__('location','dbem')).$events_placeholder_tip );
|
283 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_location_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_LOCATIONNEXTEVENT</code>') );
|
284 |
+
echo $save_button;
|
285 |
+
?>
|
286 |
+
</table>
|
287 |
+
</div> <!-- . inside -->
|
288 |
+
</div> <!-- .postbox -->
|
289 |
+
<?php endif; ?>
|
290 |
+
|
291 |
+
<?php if( get_option('dbem_categories_enabled') && !(EM_MS_GLOBAL && !is_main_site()) ): ?>
|
292 |
+
<div class="postbox " id="em-opt-categories-formats" >
|
293 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Event Categories', 'dbem' ); ?> </span></h3>
|
294 |
+
<div class="inside">
|
295 |
+
<table class="form-table">
|
296 |
+
<?php
|
297 |
+
em_options_input_text(sprintf(esc_html__('Default %s color','dbem'), esc_html__('category','dbem')), 'dbem_category_default_color', sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'dbem'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>'));
|
298 |
+
?>
|
299 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','dbem'),__('Categories','dbem')); ?></h4></td></tr>
|
300 |
+
<?php
|
301 |
+
em_options_textarea ( sprintf(__('%s list header format','dbem'),__('Categories','dbem')), 'dbem_categories_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'dbem' ), __('categories','dbem')) );
|
302 |
+
em_options_textarea ( sprintf(__('%s list item format','dbem'),__('Categories','dbem')), 'dbem_categories_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'dbem' ), __('categories','dbem')).$categories_placeholder_tip );
|
303 |
+
em_options_textarea ( sprintf(__('%s list footer format','dbem'),__('Categories','dbem')), 'dbem_categories_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'dbem' ), __('categories','dbem')) );
|
304 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('Categories','dbem')), 'dbem_no_categories_message', sprintf( __( 'The message displayed when no %s are available.', 'dbem' ), __('categories','dbem')) );
|
305 |
+
?>
|
306 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('Single %s Page','dbem'),__('Category','dbem')); ?></h4></td></tr>
|
307 |
+
<?php
|
308 |
+
em_options_input_text ( sprintf(__( 'Single %s title format', 'dbem' ),__('category','dbem')), 'dbem_category_page_title_format', __( 'The format of a single category page title.', 'dbem' ).$categories_placeholder_tip );
|
309 |
+
em_options_textarea ( sprintf(__('Single %s page format', 'dbem' ),__('category','dbem')), 'dbem_category_page_format', sprintf(__( 'The format of a single %s page.', 'dbem' ),__('category','dbem')).$categories_placeholder_tip );
|
310 |
+
?>
|
311 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','dbem'),__('Event','dbem')); ?></h4></td></tr>
|
312 |
+
<?php
|
313 |
+
em_options_input_text ( __( 'Default event list format header', 'dbem' ), 'dbem_category_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
|
314 |
+
em_options_textarea ( sprintf(__( 'Default %s list format', 'dbem' ),__('events','dbem')), 'dbem_category_event_list_item_format', sprintf(__( 'The format of the events the list inserted in the category page through the %s element.', 'dbem' ).$events_placeholder_tip, '<code>#_CATEGORYPASTEVENTS</code>, <code>#_CATEGORYNEXTEVENTS</code>, <code>#_CATEGORYALLEVENTS</code>') );
|
315 |
+
em_options_input_text ( __( 'Default event list format footer', 'dbem' ), 'dbem_category_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
|
316 |
+
em_options_textarea ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_category_no_events_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_CATEGORYPASTEVENTS</code>, <code>#_CATEGORYNEXTEVENTS</code>, <code>#_CATEGORYALLEVENTS</code>') );
|
317 |
+
?>
|
318 |
+
<tr class="em-header"><td colspan="2">
|
319 |
+
<h4><?php echo sprintf(__('Single %s Format','dbem'),__('Event','dbem')); ?></h4>
|
320 |
+
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','dbem'), '<code>#_CATEGORYNEXTEVENT</code>'); ?></p>
|
321 |
+
</td></tr>
|
322 |
+
<?php
|
323 |
+
em_options_input_text ( __( 'Next event format', 'dbem' ), 'dbem_category_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'dbem' ),__('category','dbem')).$events_placeholder_tip );
|
324 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_category_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_CATEGORYNEXTEVENT</code>') );
|
325 |
+
echo $save_button;
|
326 |
+
?>
|
327 |
+
</table>
|
328 |
+
</div> <!-- . inside -->
|
329 |
+
</div> <!-- .postbox -->
|
330 |
+
<?php endif; ?>
|
331 |
+
|
332 |
+
<?php if( get_option('dbem_tags_enabled') ): ?>
|
333 |
+
<div class="postbox " id="em-opt-tags-formats" >
|
334 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Event Tags', 'dbem' ); ?> </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','dbem'),__('Tags','dbem')); ?></h4></td></tr>
|
338 |
+
<?php
|
339 |
+
em_options_textarea ( sprintf(__('%s list header format','dbem'),__('Tags','dbem')), 'dbem_tags_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'dbem' ), __('tags','dbem')) );
|
340 |
+
em_options_textarea ( sprintf(__('%s list item format','dbem'),__('Tags','dbem')), 'dbem_tags_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'dbem' ), __('tags','dbem')).$categories_placeholder_tip );
|
341 |
+
em_options_textarea ( sprintf(__('%s list footer format','dbem'),__('Tags','dbem')), 'dbem_tags_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'dbem' ), __('tags','dbem')) );
|
342 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('Tags','dbem')), 'dbem_no_tags_message', sprintf( __( 'The message displayed when no %s are available.', 'dbem' ), __('tags','dbem')) );
|
343 |
+
?>
|
344 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('Single %s Page','dbem'),__('Tag','dbem')); ?></h4></td></tr>
|
345 |
+
<?php
|
346 |
+
em_options_input_text ( sprintf(__( 'Single %s title format', 'dbem' ),__('tag','dbem')), 'dbem_tag_page_title_format', __( 'The format of a single tag page title.', 'dbem' ).$categories_placeholder_tip );
|
347 |
+
em_options_textarea ( sprintf(__('Single %s page format', 'dbem' ),__('tag','dbem')), 'dbem_tag_page_format', sprintf(__( 'The format of a single %s page.', 'dbem' ),__('tag','dbem')).$categories_placeholder_tip );
|
348 |
+
?>
|
349 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','dbem'),__('Event','dbem')); ?></h4></td></tr>
|
350 |
+
<?php
|
351 |
+
em_options_input_text ( __( 'Default event list format header', 'dbem' ), 'dbem_tag_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
|
352 |
+
em_options_textarea ( sprintf(__( 'Default %s list format', 'dbem' ),__('events','dbem')), 'dbem_tag_event_list_item_format', __( 'The format of the events the list inserted in the tag page through the <code>#_TAGNEXTEVENTS</code>, <code>#_TAGNEXTEVENTS</code> and <code>#_TAGALLEVENTS</code> element.', 'dbem' ).$categories_placeholder_tip );
|
353 |
+
em_options_input_text ( __( 'Default event list format footer', 'dbem' ), 'dbem_tag_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
|
354 |
+
em_options_textarea ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_tag_no_events_message', __( 'The message to be displayed in the list generated by <code>#_TAGNEXTEVENTS</code>, <code>#_TAGNEXTEVENTS</code> and <code>#_TAGALLEVENTS</code> when no events are available.', 'dbem' ) );
|
355 |
+
?>
|
356 |
+
<tr class="em-header"><td colspan="2">
|
357 |
+
<h4><?php echo sprintf(__('Single %s Format','dbem'),__('Event','dbem')); ?></h4>
|
358 |
+
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','dbem'), '<code>#_TAGNEXTEVENT</code>'); ?></p>
|
359 |
+
</td></tr>
|
360 |
+
<?php
|
361 |
+
em_options_input_text ( __( 'Next event format', 'dbem' ), 'dbem_tag_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'dbem' ),__('tag','dbem')).$events_placeholder_tip );
|
362 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'dbem' ),__('events','dbem')), 'dbem_tag_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'dbem' ), '<code>#_CATEGORYNEXTEVENT</code>') );
|
363 |
+
echo $save_button;
|
364 |
+
?>
|
365 |
+
</table>
|
366 |
+
</div> <!-- . inside -->
|
367 |
+
</div> <!-- .postbox -->
|
368 |
+
<?php endif; ?>
|
369 |
+
|
370 |
+
<div class="postbox " id="em-opt-rss-formats" >
|
371 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'RSS', 'dbem' ); ?> </span></h3>
|
372 |
+
<div class="inside">
|
373 |
+
<table class="form-table">
|
374 |
+
<?php
|
375 |
+
em_options_input_text ( __( 'RSS main title', 'dbem' ), 'dbem_rss_main_title', __( 'The main title of your RSS events feed.', 'dbem' ).$events_placeholder_tip );
|
376 |
+
em_options_input_text ( __( 'RSS main description', 'dbem' ), 'dbem_rss_main_description', __( 'The main description of your RSS events feed.', 'dbem' ) );
|
377 |
+
em_options_input_text ( __( 'RSS title format', 'dbem' ), 'dbem_rss_title_format', __( 'The format of the title of each item in the events RSS feed.', 'dbem' ).$events_placeholder_tip );
|
378 |
+
em_options_input_text ( __( 'RSS description format', 'dbem' ), 'dbem_rss_description_format', __( 'The format of the description of each item in the events RSS feed.', 'dbem' ).$events_placeholder_tip );
|
379 |
+
em_options_input_text ( __( 'RSS limit', 'dbem' ), 'dbem_rss_limit', __( 'Limits the number of future events shown (0 = unlimited).', 'dbem' ) );
|
380 |
+
em_options_select( __('RSS Scope','dbem'), 'dbem_rss_scope', em_get_scopes(), __('Choose to show events within a specific time range.','dbem'));
|
381 |
+
?>
|
382 |
+
<tr valign="top" id='dbem_rss_orderby_row'>
|
383 |
+
<th scope="row"><?php _e('Default event list ordering','dbem'); ?></th>
|
384 |
+
<td>
|
385 |
+
<select name="dbem_rss_orderby" >
|
386 |
+
<?php
|
387 |
+
$orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
|
388 |
+
'event_start_date,event_start_time,event_name' => __('Order by start date, start time, then event name','dbem'),
|
389 |
+
'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time','dbem'),
|
390 |
+
'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time','dbem'),
|
391 |
+
'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name','dbem'),
|
392 |
+
));
|
393 |
+
?>
|
394 |
+
<?php foreach($orderby_options as $key => $value) : ?>
|
395 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_rss_orderby')) ? "selected='selected'" : ''; ?>>
|
396 |
+
<?php echo esc_html($value); ?>
|
397 |
+
</option>
|
398 |
+
<?php endforeach; ?>
|
399 |
+
</select>
|
400 |
+
<select name="dbem_rss_order" >
|
401 |
+
<?php
|
402 |
+
$ascending = __('Ascending','dbem');
|
403 |
+
$descending = __('Descending','dbem');
|
404 |
+
$order_options = apply_filters('em_settings_events_default_order_ddm', array(
|
405 |
+
'ASC' => __('All Ascending','dbem'),
|
406 |
+
'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'dbem'),
|
407 |
+
'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'dbem'),
|
408 |
+
'DESC' => __('All Descending','dbem'),
|
409 |
+
'ASC,DESC,ASC' => __("$ascending, $descending, $ascending",'dbem'),
|
410 |
+
'ASC,DESC,DESC' => __("$ascending, $descending, $descending",'dbem'),
|
411 |
+
'ASC,ASC,DESC' => __("$ascending, $ascending, $descending",'dbem'),
|
412 |
+
'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'dbem'),
|
413 |
+
));
|
414 |
+
?>
|
415 |
+
<?php foreach( $order_options as $key => $value) : ?>
|
416 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_rss_order')) ? "selected='selected'" : ''; ?>>
|
417 |
+
<?php echo esc_html($value); ?>
|
418 |
+
</option>
|
419 |
+
<?php endforeach; ?>
|
420 |
+
</select>
|
421 |
+
<br/>
|
422 |
+
<em><?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?></em>
|
423 |
+
</td>
|
424 |
+
</tr>
|
425 |
+
<?php
|
426 |
+
echo $save_button;
|
427 |
+
?>
|
428 |
+
</table>
|
429 |
+
</div> <!-- . inside -->
|
430 |
+
</div> <!-- .postbox -->
|
431 |
+
|
432 |
+
<div class="postbox " id="em-opt-maps-formats" >
|
433 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Maps', 'dbem' ); ?> </span></h3>
|
434 |
+
<div class="inside">
|
435 |
+
<p class="em-boxheader"><?php echo sprintf(__('You can use Google Maps to show where your events are located. For more information on using maps, <a href="%s">see our documentation</a>.','dbem'),'http://wp-events-plugin.com/documentation/google-maps/'); ?>
|
436 |
+
<table class='form-table'>
|
437 |
+
<?php $gmap_is_active = get_option ( 'dbem_gmap_is_active' ); ?>
|
438 |
+
<tr valign="top">
|
439 |
+
<th scope="row"><?php _e ( 'Enable Google Maps integration?', 'dbem' ); ?></th>
|
440 |
+
<td>
|
441 |
+
<?php _e ( 'Yes' ); ?> <input id="dbem_gmap_is_active_yes" name="dbem_gmap_is_active" type="radio" value="1" <?php echo ($gmap_is_active) ? "checked='checked'":''; ?> />
|
442 |
+
<?php _e ( 'No' ); ?> <input name="dbem_gmap_is_active" type="radio" value="0" <?php echo ($gmap_is_active) ? '':"checked='checked'"; ?> /><br />
|
443 |
+
<em><?php _e ( 'Check this option to enable Goggle Map integration.', 'dbem' )?></em>
|
444 |
+
</td>
|
445 |
+
<?php em_options_input_text(__('Default map width','dbem'), 'dbem_map_default_width', sprintf(__('Can be in form of pixels or a percentage such as %s or %s.', 'dbem'), '<code>100%</code>', '<code>100px</code>')); ?>
|
446 |
+
<?php em_options_input_text(__('Default map height','dbem'), 'dbem_map_default_height', sprintf(__('Can be in form of pixels or a percentage such as %s or %s.', 'dbem'), '<code>100%</code>', '<code>100px</code>')); ?>
|
447 |
+
</tr>
|
448 |
+
<tr class="em-header"><td colspan="2">
|
449 |
+
<h4><?php _e('Global Map Format','dbem'); ?></h4>
|
450 |
+
<p><?php echo sprintf(__('If you use the %s <a href="%s">shortcode</a>, you can display a map of all your locations and events, the settings below will be used.','dbem'), '<code>[locations_map]</code>','http://wp-events-plugin.com/documentation/shortcodes/'); ?></p>
|
451 |
+
</td></tr>
|
452 |
+
<?php
|
453 |
+
em_options_textarea ( __( 'Location balloon format', 'dbem' ), 'dbem_map_text_format', __( 'The format of of the text appearing in the balloon describing the location.', 'dbem' ).' '.__( 'Event.', 'dbem' ).$locations_placeholder_tip );
|
454 |
+
?>
|
455 |
+
<tr class="em-header"><td colspan="2">
|
456 |
+
<h4><?php _e('Single Location/Event Map Format','dbem'); ?></h4>
|
457 |
+
<p><?php echo sprintf(_e('If you use the <code>#_LOCATIONMAP</code> <a href="%s">placeholder</a> when displaying individual event and location information, the settings below will be used.','dbem'), '<code>[locations_map]</code>','http://wp-events-plugin.com/documentation/placeholders/'); ?></p>
|
458 |
+
</td></tr>
|
459 |
+
<?php
|
460 |
+
em_options_textarea ( __( 'Location balloon format', 'dbem' ), 'dbem_location_baloon_format', __( 'The format of of the text appearing in the balloon describing the location.', 'dbem' ).$events_placeholder_tip );
|
461 |
+
echo $save_button;
|
462 |
+
?>
|
463 |
+
</table>
|
464 |
+
</div> <!-- . inside -->
|
465 |
+
</div> <!-- .postbox -->
|
466 |
+
|
467 |
+
<?php do_action('em_options_page_footer_formats'); ?>
|
468 |
+
|
469 |
+
</div> <!-- .em-menu-formats -->
|
admin/settings/tabs/general.php
ADDED
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('list_users') ) return; ?>
|
2 |
+
<!-- GENERAL OPTIONS -->
|
3 |
+
<div class="em-menu-general em-menu-group">
|
4 |
+
<div class="postbox " id="em-opt-general" >
|
5 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'General Options', 'dbem' ); ?> </span></h3>
|
6 |
+
<div class="inside">
|
7 |
+
<table class="form-table">
|
8 |
+
<?php em_options_radio_binary ( __( 'Disable thumbnails?', 'dbem' ), 'dbem_thumbnails_enabled', __( 'Select yes to disable Events Manager from enabling thumbnails (some themes may already have this enabled, which we cannot be turned off here).','dbem' ) ); ?>
|
9 |
+
<tr class="em-header">
|
10 |
+
<td colspan="2">
|
11 |
+
<h4><?php echo sprintf(__('%s Settings','dbem'),__('Event','dbem')); ?></h4>
|
12 |
+
</td>
|
13 |
+
</tr>
|
14 |
+
<?php
|
15 |
+
em_options_radio_binary ( __( 'Enable recurrence?', 'dbem' ), 'dbem_recurrence_enabled', __( 'Select yes to enable the recurrence features feature','dbem' ) );
|
16 |
+
em_options_radio_binary ( __( 'Enable bookings?', 'dbem' ), 'dbem_rsvp_enabled', __( 'Select yes to allow bookings and tickets for events.','dbem' ) );
|
17 |
+
em_options_radio_binary ( __( 'Enable tags?', 'dbem' ), 'dbem_tags_enabled', __( 'Select yes to enable the tag features','dbem' ) );
|
18 |
+
if( !(EM_MS_GLOBAL && !is_main_site()) ){
|
19 |
+
em_options_radio_binary ( __( 'Enable categories?', 'dbem' ), 'dbem_categories_enabled', __( 'Select yes to enable the category features','dbem' ) );
|
20 |
+
if( get_option('dbem_categories_enabled') ){
|
21 |
+
/*default category*/
|
22 |
+
$category_options = array();
|
23 |
+
$category_options[0] = __('no default category','dbem');
|
24 |
+
$EM_Categories = EM_Categories::get();
|
25 |
+
foreach($EM_Categories as $EM_Category){
|
26 |
+
$category_options[$EM_Category->id] = $EM_Category->name;
|
27 |
+
}
|
28 |
+
echo "<tr><th>".__( 'Default Category', 'dbem' )."</th><td>";
|
29 |
+
wp_dropdown_categories(array( 'hide_empty' => 0, 'name' => 'dbem_default_category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => get_option('dbem_default_category'), 'show_option_none' => __('None','dbem'), 'class'=>''));
|
30 |
+
echo "</br><em>" .__( 'This option allows you to select the default category when adding an event.','dbem' ).' '.__('If an event does not have a category assigned when editing, this one will be assigned automatically.','dbem')."</em>";
|
31 |
+
echo "</td></tr>";
|
32 |
+
}
|
33 |
+
}
|
34 |
+
em_options_radio_binary ( sprintf(__( 'Enable %s attributes?', 'dbem' ),__('event','dbem')), 'dbem_attributes_enabled', __( 'Select yes to enable the attributes feature','dbem' ) );
|
35 |
+
em_options_radio_binary ( sprintf(__( 'Enable %s custom fields?', 'dbem' ),__('event','dbem')), 'dbem_cp_events_custom_fields', __( 'Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.','dbem' ) );
|
36 |
+
if( get_option('dbem_attributes_enabled') ){
|
37 |
+
em_options_textarea ( sprintf(__( '%s Attributes', 'dbem' ),__('Event','dbem')), 'dbem_placeholders_custom', sprintf(__( "You can also add event attributes here, one per line in this format <code>#_ATT{key}</code>. They will not appear on event pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. <a href='%s'>More information on placeholders.</a>", 'dbem' ), EM_ADMIN_URL .'&page=events-manager-help') );
|
38 |
+
}
|
39 |
+
if( get_option('dbem_locations_enabled') ){
|
40 |
+
/*default location*/
|
41 |
+
if( defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS') && EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS ){
|
42 |
+
em_options_input_text( __( 'Default Location', 'dbem' ), 'dbem_default_location', __('Please enter your Location ID, or leave blank for no location.','dbem').' '.__( 'This option allows you to select the default location when adding an event.','dbem' )." ".__('(not applicable with event ownership on presently, coming soon!)','dbem') );
|
43 |
+
}else{
|
44 |
+
$location_options = array();
|
45 |
+
$location_options[0] = __('no default location','dbem');
|
46 |
+
$EM_Locations = EM_Locations::get();
|
47 |
+
foreach($EM_Locations as $EM_Location){
|
48 |
+
$location_options[$EM_Location->location_id] = $EM_Location->location_name;
|
49 |
+
}
|
50 |
+
em_options_select ( __( 'Default Location', 'dbem' ), 'dbem_default_location', $location_options, __('Please enter your Location ID.','dbem').' '.__( 'This option allows you to select the default location when adding an event.','dbem' )." ".__('(not applicable with event ownership on presently, coming soon!)','dbem') );
|
51 |
+
}
|
52 |
+
|
53 |
+
/*default location country*/
|
54 |
+
em_options_select ( __( 'Default Location Country', 'dbem' ), 'dbem_location_default_country', em_get_countries(__('no default country', 'dbem')), __('If you select a default country, that will be pre-selected when creating a new location.','dbem') );
|
55 |
+
}
|
56 |
+
?>
|
57 |
+
<tr class="em-header">
|
58 |
+
<td colspan="2">
|
59 |
+
<h4><?php echo sprintf(__('%s Settings','dbem'),__('Location','dbem')); ?></h4>
|
60 |
+
</td>
|
61 |
+
</tr>
|
62 |
+
<?php
|
63 |
+
em_options_radio_binary ( __( 'Enable locations?', 'dbem' ), 'dbem_locations_enabled', __( 'If you disable locations, bear in mind that you should remove your location page, shortcodes and related placeholders from your <a href="#formats" class="nav-tab-link" rel="#em-menu-formats">formats</a>.','dbem' ) );
|
64 |
+
if( get_option('dbem_locations_enabled') ){
|
65 |
+
em_options_radio_binary ( __( 'Require locations for events?', 'dbem' ), 'dbem_require_location', __( 'Setting this to no will allow you to submit events without locations. You can use the <code>{no_location}...{/no_location}</code> or <code>{has_location}..{/has_location}</code> conditional placeholder to selectively display location information.','dbem' ) );
|
66 |
+
em_options_radio_binary ( __( 'Use dropdown for locations?', 'dbem' ), 'dbem_use_select_for_locations', __( 'Select yes to select location from a drop-down menu; location selection will be faster, but you will lose the ability to insert locations with events','dbem' ) );
|
67 |
+
em_options_radio_binary ( sprintf(__( 'Enable %s attributes?', 'dbem' ),__('location','dbem')), 'dbem_location_attributes_enabled', __( 'Select yes to enable the attributes feature','dbem' ) );
|
68 |
+
em_options_radio_binary ( sprintf(__( 'Enable %s custom fields?', 'dbem' ),__('location','dbem')), 'dbem_cp_locations_custom_fields', __( 'Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.','dbem' ) );
|
69 |
+
if( get_option('dbem_location_attributes_enabled') ){
|
70 |
+
em_options_textarea ( sprintf(__( '%s Attributes', 'dbem' ),__('Location','dbem')), 'dbem_location_placeholders_custom', sprintf(__( "You can also add location attributes here, one per line in this format <code>#_LATT{key}</code>. They will not appear on location pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. <a href='%s'>More information on placeholders.</a>", 'dbem' ), EM_ADMIN_URL .'&page=events-manager-help') );
|
71 |
+
}
|
72 |
+
}
|
73 |
+
?>
|
74 |
+
<tr class="em-header">
|
75 |
+
<td colspan="2">
|
76 |
+
<h4><?php echo sprintf(__('%s Settings','dbem'),__('Other','dbem')); ?></h4>
|
77 |
+
</td>
|
78 |
+
</tr>
|
79 |
+
<?php
|
80 |
+
em_options_radio_binary ( __('Show some love?','dbem'), 'dbem_credits', __( 'Hundreds of free hours have gone into making this free plugin, show your support and add a small link to the plugin website at the bottom of your event pages.','dbem' ) );
|
81 |
+
echo $save_button;
|
82 |
+
?>
|
83 |
+
</table>
|
84 |
+
|
85 |
+
</div> <!-- . inside -->
|
86 |
+
</div> <!-- .postbox -->
|
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', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Event Submission Forms', 'dbem' ); ?></span></h3>
|
94 |
+
<div class="inside">
|
95 |
+
<table class="form-table">
|
96 |
+
<tr><td colspan="2" class="em-boxheader">
|
97 |
+
<?php echo sprintf(__('You can allow users to publicly submit events on your blog by using the %s shortcode, and enabling anonymous submissions below.','dbem'), '<code>[event_form]</code>'); ?>
|
98 |
+
</td></tr>
|
99 |
+
<?php
|
100 |
+
em_options_radio_binary ( __( 'Use Visual Editor?', 'dbem' ), 'dbem_events_form_editor', __( 'Users can now use the WordPress editor for easy HTML entry in the submission form.', 'dbem' ) );
|
101 |
+
em_options_radio_binary ( __( 'Show form again?', 'dbem' ), 'dbem_events_form_reshow', __( 'When a user submits their event, you can display a new event form again.', 'dbem' ) );
|
102 |
+
em_options_textarea ( __( 'Success Message', 'dbem' ), 'dbem_events_form_result_success', __( 'Customize the message your user sees when they submitted their event.', 'dbem' ).$events_placeholder_tip );
|
103 |
+
em_options_textarea ( __( 'Successfully Updated Message', 'dbem' ), 'dbem_events_form_result_success_updated', __( 'Customize the message your user sees when they resubmit/update their event.', 'dbem' ).$events_placeholder_tip );
|
104 |
+
?>
|
105 |
+
<tr class="em-header"><td colspan="2">
|
106 |
+
<h4><?php echo sprintf(__('Anonymous event submissions','dbem'), '<code>[event_form]</code>'); ?></h4>
|
107 |
+
</td></tr>
|
108 |
+
<?php
|
109 |
+
em_options_radio_binary ( __( 'Allow anonymous event submissions?', 'dbem' ), 'dbem_events_anonymous_submissions', __( 'Would you like to allow users to submit bookings anonymously? If so, you can use the new [event_form] shortcode or <code>em_event_form()</code> template tag with this enabled.', 'dbem' ) );
|
110 |
+
if( defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS') && EM_OPTIMIZE_SETTINGS_PAGE_USERS ){
|
111 |
+
em_options_input_text( __('Guest Default User', 'dbem'), 'dbem_events_anonymous_user', __('Please add a User ID.','dbem').' '.__( 'Events require a user to own them. In order to allow events to be submitted anonymously you need to assign that event a specific user. We recommend you create a "Anonymous" subscriber with a very good password and use that. Guests will have the same event permissions as this user when submitting.', 'dbem' ) );
|
112 |
+
}else{
|
113 |
+
em_options_select ( __('Guest Default User', 'dbem'), 'dbem_events_anonymous_user', em_get_wp_users (), __( 'Events require a user to own them. In order to allow events to be submitted anonymously you need to assign that event a specific user. We recommend you create a "Anonymous" subscriber with a very good password and use that. Guests will have the same event permissions as this user when submitting.', 'dbem' ) );
|
114 |
+
}
|
115 |
+
em_options_textarea ( __( 'Success Message', 'dbem' ), 'dbem_events_anonymous_result_success', __( 'Anonymous submitters cannot see or modify their event once submitted. You can customize the success message they see here.', 'dbem' ).$events_placeholder_tip );
|
116 |
+
?>
|
117 |
+
<?php echo $save_button; ?>
|
118 |
+
</table>
|
119 |
+
</div> <!-- . inside -->
|
120 |
+
</div> <!-- .postbox -->
|
121 |
+
|
122 |
+
<?php do_action('em_options_page_footer'); ?>
|
123 |
+
|
124 |
+
<?php /*
|
125 |
+
<div class="postbox" id="em-opt-geo" >
|
126 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Geo APIs', 'dbem' ); ?> <em>(Beta)</em></span></h3>
|
127 |
+
<div class="inside">
|
128 |
+
<p><?php esc_html_e('Geocoding is the process of converting addresses into geographic coordinates, which can be used to find events and locations near a specific coordinate.','dbem'); ?></p>
|
129 |
+
<table class="form-table">
|
130 |
+
<?php
|
131 |
+
em_options_radio_binary ( __( 'Enable Geocoding Features?', 'dbem' ), 'dbem_geo', '', '', '.em-settings-geocoding');
|
132 |
+
?>
|
133 |
+
</table>
|
134 |
+
<div class="em-settings-geocoding">
|
135 |
+
<h4>GeoNames API (geonames.org)</h4>
|
136 |
+
<p>We make use of the <a href="http://www.geonames.org">GeoNames</a> web service to suggest locations/addresses to users when searching, and converting these into coordinates.</p>
|
137 |
+
<p>To be able to use these services, you must <a href="http://www.geonames.org/login">register an account</a>, activate the free webservice and enter your username below. You are allowed up to 30,000 requests per day, if you require more you can purchase credits from your account.</p>
|
138 |
+
<table class="form-table">
|
139 |
+
<?php em_options_input_text ( __( 'GeoNames Username', 'dbem' ), 'dbem_geonames_username', __('If left blank, this service will not be used.','dbem')); ?>
|
140 |
+
</table>
|
141 |
+
</div>
|
142 |
+
<table class="form-table"><?php echo $save_button; ?></table>
|
143 |
+
</div> <!-- . inside -->
|
144 |
+
</div> <!-- .postbox -->
|
145 |
+
*/ ?>
|
146 |
+
|
147 |
+
<div class="postbox" id="em-opt-performance-optimization" >
|
148 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Performance Optimization', 'dbem' ); ?> (<?php _e('Advanced','dbem'); ?>)</span></h3>
|
149 |
+
<div class="inside">
|
150 |
+
<?php
|
151 |
+
$performance_opt_page_instructions = __('In the boxes below, you are expected to write the page IDs. For multiple pages, use comma-seperated values e.g. 1,2,3. Entering 0 means EVERY page, -1 means the home page.','dbem');
|
152 |
+
?>
|
153 |
+
<div class="em-boxheader">
|
154 |
+
<p><?php _e('This section allows you to configure parts of this plugin that will improve performance on your site and increase page speeds by reducing extra files from being unnecessarily included on pages as well as reducing server loads where possible. This only applies to pages outside the admin area.','dbem'); ?></p>
|
155 |
+
<p><strong><?php _e('Warning!','dbem'); ?></strong> <?php echo sprintf(__('This is for advanced users, you should know what you\'re doing here or things will not work properly. For more information on how these options work see our <a href="%s" target="_blank">optimization recommendations</a>','dbem'), 'http://wp-events-plugin.com/documentation/optimization-recommendations/'); ?></p>
|
156 |
+
</div>
|
157 |
+
<table class="form-table">
|
158 |
+
<tr class="em-header"><td colspan="2">
|
159 |
+
<h4><?php _e('JavaScript Files','dbem'); ?></h4>
|
160 |
+
<p><?php echo sprintf(__('If you are not using it already, we recommend you try the <a href="%s" target="_blank">Use Google Libraries</a> plugin, because without further optimization options below it already significantly reduces the number of files needed to display your Event pages and will most likely speed up your overall website loading time.' ,'dbem'),'http://wordpress.org/extend/plugins/use-google-libraries/'); ?>
|
161 |
+
</td></tr>
|
162 |
+
<?php
|
163 |
+
em_options_radio_binary ( __( 'Limit JS file loading?', 'dbem' ), 'dbem_js_limit', __( 'Prevent unnecessary loading of JavaScript files on pages where they are not needed.', 'dbem' ) );
|
164 |
+
?>
|
165 |
+
<tbody id="dbem-js-limit-options">
|
166 |
+
<tr class="em-subheader"><td colspan="2">
|
167 |
+
<?php
|
168 |
+
_e('Aside from pages we automatically generate and include certain jQuery files, if you are using Widgets, Shortcode or PHP to display specific items you may need to tell us where you are using them for them to work properly. Below are options for you to include specific jQuery dependencies only on certain pages.','dbem');
|
169 |
+
echo $performance_opt_page_instructions;
|
170 |
+
?>
|
171 |
+
</td></tr>
|
172 |
+
<?php
|
173 |
+
em_options_input_text( __( 'General JS', 'dbem' ), 'dbem_js_limit_general', __( 'Loads our own JS file if no other dependencies are already loaded, which is still needed for many items generated by EM using JavaScript such as Calendars, Maps and Booking Forms/Buttons', 'dbem' ), 0 );
|
174 |
+
em_options_input_text( __( 'Search Forms', 'dbem' ), 'dbem_js_limit_search', __( 'Include pages where you use shortcodes or widgets to display event search forms.', 'dbem' ) );
|
175 |
+
em_options_input_text( __( 'Event Edit and Submission Forms', 'dbem' ), 'dbem_js_limit_events_form', __( 'Include pages where you use shortcode or PHP to display event submission forms.', 'dbem' ) );
|
176 |
+
em_options_input_text( __( 'Booking Management Pages', 'dbem' ), 'dbem_js_limit_edit_bookings', __( 'Include pages where you use shortcode or PHP to display event submission forms.', 'dbem' ) );
|
177 |
+
?>
|
178 |
+
</tbody>
|
179 |
+
<tr class="em-header"><td colspan="2">
|
180 |
+
<h4><?php _e('CSS File','dbem'); ?></h4>
|
181 |
+
</td></tr>
|
182 |
+
<?php
|
183 |
+
em_options_radio_binary ( __( 'Limit loading of our CSS files?', 'dbem' ), 'dbem_css_limit', __( 'Enabling this will prevent us from loading our CSS file on every page, and will only load on specific pages generated by Events Manager.', 'dbem' ) );
|
184 |
+
?>
|
185 |
+
<tbody id="dbem-css-limit-options">
|
186 |
+
<tr class="em-subheader"><td colspan="2">
|
187 |
+
<?php echo $performance_opt_page_instructions; ?>
|
188 |
+
</td></tr>
|
189 |
+
<?php
|
190 |
+
em_options_input_text( __( 'Include on', 'dbem' ), 'dbem_css_limit_include', __( 'Our CSS file will only be INCLUDED on all of these pages.', 'dbem' ), 0 );
|
191 |
+
em_options_input_text( __( 'Exclude on', 'dbem' ), 'dbem_css_limit_exclude', __( 'Our CSS file will be EXCLUDED on all of these pages. Takes precedence over inclusion rules.', 'dbem' ), 0 );
|
192 |
+
?>
|
193 |
+
</tbody>
|
194 |
+
<?php
|
195 |
+
?>
|
196 |
+
<tr class="em-header"><td colspan="2">
|
197 |
+
<h4><?php _e('Thumbnails','dbem'); ?></h4>
|
198 |
+
</td></tr>
|
199 |
+
<?php
|
200 |
+
em_options_radio_binary ( __( 'Disable WordPress Thumbnails?', 'dbem' ), 'dbem_disable_thumbnails', __( 'If set to yes, full sized images will be used and HTML width and height attributes will be used to determine the size.', 'dbem' ).' '.sprintf(__('Setting this to yes will also make your images crop efficiently with the %s feature in the %s plugin.','dbem'), '<a href="http://jetpack.me/support/photon/">Photon</a>','<a href="https://wordpress.org/plugins/jetpack/">JetPack</a>') );
|
201 |
+
?>
|
202 |
+
<?php echo $save_button; ?>
|
203 |
+
</table>
|
204 |
+
<script type="text/javascript">
|
205 |
+
jQuery(document).ready(function($){
|
206 |
+
$('input:radio[name="dbem_js_limit"]').change(function(){
|
207 |
+
if( $('input:radio[name="dbem_js_limit"]:checked').val() == 1 ){
|
208 |
+
$('tbody#dbem-js-limit-options').show();
|
209 |
+
}else{
|
210 |
+
$('tbody#dbem-js-limit-options').hide();
|
211 |
+
}
|
212 |
+
}).trigger('change');
|
213 |
+
|
214 |
+
$('input:radio[name="dbem_css_limit"]').change(function(){
|
215 |
+
if( $('input:radio[name="dbem_css_limit"]:checked').val() == 1 ){
|
216 |
+
$('tbody#dbem-css-limit-options').show();
|
217 |
+
}else{
|
218 |
+
$('tbody#dbem-css-limit-options').hide();
|
219 |
+
}
|
220 |
+
}).trigger('change');
|
221 |
+
});
|
222 |
+
</script>
|
223 |
+
</div> <!-- . inside -->
|
224 |
+
</div> <!-- .postbox -->
|
225 |
+
|
226 |
+
<div class="postbox" id="em-opt-style-options" >
|
227 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php _e ( 'Styling Options', 'dbem' ); ?> (<?php _e('Advanced','dbem'); ?>) <em>(Beta)</em></span></h3>
|
228 |
+
<div class="inside">
|
229 |
+
<p class="em-boxheader">
|
230 |
+
<?php _e('Events Manager imposes a minimal amount of styling on websites so that your themes can take over.','dbem'); ?>
|
231 |
+
<?php _e('Below are some additional options for individual pages and sections, which you can turn on to enforce custom styling provided by the plugin or off if you want to do your own custom styling.','dbem'); ?>
|
232 |
+
</p>
|
233 |
+
<table class="form-table">
|
234 |
+
<?php
|
235 |
+
em_options_radio_binary ( __( 'Search forms', 'dbem' ), 'dbem_css_search');
|
236 |
+
?>
|
237 |
+
<tr class="em-subheader"><td colspan="2">The options below currently have no effect, but are there so you know what may be added in future updates. You can leave them on if you want furture styling to take effect, or turn them off to keep your current styles as is.</td><tr>
|
238 |
+
<?php
|
239 |
+
em_options_radio_binary ( __( 'Event/Location admin pages', 'dbem' ), 'dbem_css_editors' );
|
240 |
+
em_options_radio_binary ( __( 'Booking admin pages', 'dbem' ), 'dbem_css_rsvpadmin' );
|
241 |
+
em_options_radio_binary ( __( 'Events list page', 'dbem' ), 'dbem_css_evlist' );
|
242 |
+
em_options_radio_binary ( __( 'Locations list page', 'dbem' ), 'dbem_css_loclist' );
|
243 |
+
em_options_radio_binary ( __( 'Event booking forms', 'dbem' ), 'dbem_css_rsvp' );
|
244 |
+
em_options_radio_binary ( __( 'Categories list page', 'dbem' ), 'dbem_css_catlist' );
|
245 |
+
em_options_radio_binary ( __( 'Tags list page', 'dbem' ), 'dbem_css_taglist' );
|
246 |
+
echo $save_button;
|
247 |
+
?>
|
248 |
+
</table>
|
249 |
+
</div> <!-- . inside -->
|
250 |
+
</div> <!-- .postbox -->
|
251 |
+
|
252 |
+
<?php if ( !is_multisite() ) { em_admin_option_box_uninstall(); } ?>
|
253 |
+
|
254 |
+
<?php if( get_option('dbem_migrate_images') ): ?>
|
255 |
+
<div class="postbox " >
|
256 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span>Migrate Images From Version 4</span></h3>
|
257 |
+
<div class="inside">
|
258 |
+
<?php /* Not translating as it's temporary */ //EM4 ?>
|
259 |
+
<p>You have the option of migrating images from version 4 so they become the equivalent of 'featured images' like with regular WordPress posts and pages and are also available in your media library.</p>
|
260 |
+
<p>Your event and location images will still display correctly on the front-end even if you don't migrate, but will not show up within your edit location/event pages in the admin area.</p>
|
261 |
+
<p>
|
262 |
+
<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&em_migrate_images=1&_wpnonce=<?php echo wp_create_nonce('em_migrate_images'); ?>" />Migrate Images</a><br />
|
263 |
+
<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&em_not_migrate_images=1&_wpnonce=<?php echo wp_create_nonce('em_not_migrate_images'); ?>" />Do Not Migrate Images</a>
|
264 |
+
</p>
|
265 |
+
</div> <!-- . inside -->
|
266 |
+
</div> <!-- .postbox -->
|
267 |
+
<?php endif; ?>
|
268 |
+
</div> <!-- .em-menu-general -->
|
admin/settings/tabs/pages.php
ADDED
@@ -0,0 +1,634 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('list_users') ) return; ?>
|
2 |
+
<!-- PAGE OPTIONS -->
|
3 |
+
<div class="em-menu-pages em-menu-group" <?php if( !defined('EM_SETTINGS_TABS') || !EM_SETTINGS_TABS) : ?>style="display:none;"<?php endif; ?>>
|
4 |
+
<?php
|
5 |
+
$template_page_tip = __( "Many themes display extra meta information on post pages such as 'posted by' or 'post date' information, which may not be desired. Usually, page templates contain less clutter.", 'dbem' );
|
6 |
+
$template_page_tip .= ' '. __("If you choose 'Pages' then %s will be shown using your theme default page template, alternatively choose from page templates that come with your specific theme.",'dbem');
|
7 |
+
$template_page_tip .= ' '. str_replace('#','http://codex.wordpress.org/Post_Types#Template_Files',__("Be aware that some themes will not work with this option, if so (or you want to make your own changes), you can create a file named <code>single-%s.php</code> <a href='#'>as shown on the wordpress codex</a>, and leave this set to Posts.", 'dbem'));
|
8 |
+
$body_class_tip = __('If you would like to add extra classes to your body html tag when a single %s page is displayed, enter it here. May be useful or necessary if your theme requires special class names for specific templates.','dbem');
|
9 |
+
$post_class_tip = __('Same concept as the body classes option, but some themes also use the <code>post_class()</code> function within page content to differentiate styling between post types.','dbem');
|
10 |
+
$format_override_tip = __("By using formats, you can control how your %s are displayed from within the Events Manager <a href='#formats' class='nav-tab-link' rel='#em-menu-formats'>Formatting</a> tab above without having to edit your theme files.",'dbem');
|
11 |
+
$page_templates = array(''=>__('Posts'), 'page' => __('Pages'), __('Theme Templates','dbem') => array_flip(get_page_templates()));
|
12 |
+
?>
|
13 |
+
<div class="postbox" id="em-opt-permalinks" >
|
14 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('Permalink Slugs','dbem')); ?></span></h3>
|
15 |
+
<div class="inside">
|
16 |
+
<p class="em-boxheader"><?php _e('You can change the permalink structure of your events, locations, categories and tags here. Be aware that you may want to set up redirects if you change your permalink structures to maintain SEO rankings.','dbem'); ?></p>
|
17 |
+
<table class="form-table">
|
18 |
+
<?php
|
19 |
+
em_options_input_text ( __( 'Events', 'dbem' ), 'dbem_cp_events_slug', sprintf(__('e.g. %s - you can use / Separators too', 'dbem' ), '<strong>'.home_url().'/<code>'.get_option('dbem_cp_events_slug',EM_POST_TYPE_EVENT_SLUG).'</code>/2012-olympics/</strong>'), EM_POST_TYPE_EVENT_SLUG );
|
20 |
+
if( get_option('dbem_locations_enabled') && !(EM_MS_GLOBAL && get_site_option('dbem_ms_mainblog_locations') && !is_main_site()) ){
|
21 |
+
em_options_input_text ( __( 'Locations', 'dbem' ), 'dbem_cp_locations_slug', sprintf(__('e.g. %s - you can use / Separators too', 'dbem' ), '<strong>'.home_url().'/<code>'.get_option('dbem_cp_locations_slug',EM_POST_TYPE_LOCATION_SLUG).'</code>/wembley-stadium/</strong>'), EM_POST_TYPE_LOCATION_SLUG );
|
22 |
+
}
|
23 |
+
if( get_option('dbem_categories_enabled') && !(EM_MS_GLOBAL && !is_main_site()) ){
|
24 |
+
em_options_input_text ( __( 'Event Categories', 'dbem' ), 'dbem_taxonomy_category_slug', sprintf(__('e.g. %s - you can use / Separators too', 'dbem' ), '<strong>'.home_url().'/<code>'.get_option('dbem_taxonomy_category_slug',EM_TAXONOMY_CATEGORY_SLUG).'</code>/sports/</strong>'), EM_TAXONOMY_CATEGORY_SLUG );
|
25 |
+
}
|
26 |
+
if( get_option('dbem_tags_enabled') ){
|
27 |
+
em_options_input_text ( __( 'Event Tags', 'dbem' ), 'dbem_taxonomy_tag_slug', sprintf(__('e.g. %s - you can use / Separators too', 'dbem' ), '<strong>'.home_url().'/<code>'.get_option('dbem_taxonomy_tag_slug',EM_TAXONOMY_TAG_SLUG).'</code>/running/</strong>'), EM_TAXONOMY_TAG_SLUG );
|
28 |
+
}
|
29 |
+
echo $save_button;
|
30 |
+
?>
|
31 |
+
</table>
|
32 |
+
</div> <!-- . inside -->
|
33 |
+
</div> <!-- .postbox -->
|
34 |
+
|
35 |
+
<div class="postbox " id="em-opt-event-pages" >
|
36 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s Pages','dbem'),__('Event','dbem')); ?></span></h3>
|
37 |
+
<div class="inside">
|
38 |
+
<table class="form-table">
|
39 |
+
<?php
|
40 |
+
//em_options_radio_binary ( sprintf(__( 'Display %s as', 'dbem' ),__('events','dbem')), 'dbem_cp_events_template_page', sprintf($template_page_tip, EM_POST_TYPE_EVENT), array(__('Posts'),__('Pages')) );
|
41 |
+
em_options_select( sprintf(__( 'Display %s as', 'dbem' ),__('events','dbem')), 'dbem_cp_events_template', $page_templates, sprintf($template_page_tip, __('events','dbem'), EM_POST_TYPE_EVENT) );
|
42 |
+
em_options_input_text( __('Body Classes','dbem'), 'dbem_cp_events_body_class', sprintf($body_class_tip, __('event','dbem')) );
|
43 |
+
em_options_input_text( __('Post Classes','dbem'), 'dbem_cp_events_post_class', $post_class_tip );
|
44 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_events_formats', sprintf($format_override_tip,__('events','dbem')));
|
45 |
+
em_options_radio_binary ( __( 'Enable Comments?', 'dbem' ), 'dbem_cp_events_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.','dbem'),__('event','dbem'),__('events','dbem')));
|
46 |
+
echo $save_button;
|
47 |
+
?>
|
48 |
+
</table>
|
49 |
+
</div> <!-- . inside -->
|
50 |
+
</div> <!-- .postbox -->
|
51 |
+
|
52 |
+
<div class="postbox " id="em-opt-event-archives" >
|
53 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s List/Archives','dbem'),__('Event','dbem')); ?></span></h3>
|
54 |
+
<div class="inside">
|
55 |
+
<table class="form-table">
|
56 |
+
<tr>
|
57 |
+
<th><?php echo sprintf(__( 'Events page', 'dbem' )); ?></th>
|
58 |
+
<td>
|
59 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_events_page', 'selected'=>get_option('dbem_events_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'dbem'),__('Events','dbem')) )); ?>
|
60 |
+
<br />
|
61 |
+
<em><?php echo __( 'This option allows you to select which page to use as an events page. If you do not select an events page, to display event lists you can enable event archives or use the appropriate shortcodes and/or template tags.','dbem' ); ?></em>
|
62 |
+
</td>
|
63 |
+
</tr>
|
64 |
+
<tbody class="em-event-page-options">
|
65 |
+
<?php
|
66 |
+
em_options_radio_binary ( __( 'Show events search?', 'dbem' ), 'dbem_events_page_search_form', __( "If set to yes, a search form will appear just above your list of events.", 'dbem' ) );
|
67 |
+
em_options_radio_binary ( __( 'Display calendar in events page?', 'dbem' ), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','dbem' ).' '.__('If you would like to show events that span over more than one day, see the Calendar section on this page.','dbem') );
|
68 |
+
em_options_radio_binary ( __( 'Disable title rewriting?', 'dbem' ), 'dbem_disable_title_rewrites', __( "Some WordPress themes don't follow best practices when generating navigation menus, and so the automatic title rewriting feature may cause problems, if your menus aren't working correctly on the event pages, try setting this to 'Yes', and provide an appropriate HTML title format below.",'dbem' ) );
|
69 |
+
em_options_input_text ( __( 'Event Manager titles', 'dbem' ), 'dbem_title_html', __( "This only setting only matters if you selected 'Yes' to above. You will notice the events page titles aren't being rewritten, and you have a new title underneath the default page name. This is where you control the HTML of this title. Make sure you keep the #_PAGETITLE placeholder here, as that's what is rewritten by events manager. To control what's rewritten in this title, see settings further down for page titles.", 'dbem' ) );
|
70 |
+
?>
|
71 |
+
</tbody>
|
72 |
+
<tr class="em-header">
|
73 |
+
<td colspan="2">
|
74 |
+
<h4><?php echo sprintf(__('WordPress %s Archives','dbem'), __('Event','dbem')); ?></h4>
|
75 |
+
<p><?php echo sprintf(__('%s custom post types can have archives, just like normal WordPress posts. If enabled, should you visit your base slug url %s and you will see an post-formatted archive of previous %s', 'dbem'), __('Event','dbem'), '<code>'.home_url().'/'.get_option('dbem_cp_events_slug',EM_POST_TYPE_EVENT_SLUG).'/</code>', __('events','dbem')); ?></p>
|
76 |
+
<p><?php echo sprintf(__('Note that assigning a %s page above will override this archive if the URLs collide (which is the default setting, and is recommended for maximum plugin compatibility). You can have both at the same time, but you must ensure that your page and %s slugs are different.','dbem'), __('events','dbem'), __('event','dbem')); ?></p>
|
77 |
+
</td>
|
78 |
+
</tr>
|
79 |
+
<tbody class="em-event-archive-options">
|
80 |
+
<?php
|
81 |
+
em_options_radio_binary ( __( 'Enable Archives?', 'dbem' ), 'dbem_cp_events_has_archive', __( "Allow WordPress post-style archives.", 'dbem' ) );
|
82 |
+
?>
|
83 |
+
</tbody>
|
84 |
+
<tbody class="em-event-archive-options em-event-archive-sub-options">
|
85 |
+
<tr valign="top">
|
86 |
+
<th scope="row"><?php _e('Default event archive ordering','dbem'); ?></th>
|
87 |
+
<td>
|
88 |
+
<select name="dbem_events_default_archive_orderby" >
|
89 |
+
<?php
|
90 |
+
$event_archive_orderby_options = apply_filters('em_settings_events_default_archive_orderby_ddm', array(
|
91 |
+
'_start_ts' => __('Order by start date, start time','dbem'),
|
92 |
+
'title' => __('Order by name','dbem')
|
93 |
+
));
|
94 |
+
?>
|
95 |
+
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
96 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
97 |
+
<?php echo esc_html($value); ?>
|
98 |
+
</option>
|
99 |
+
<?php endforeach; ?>
|
100 |
+
</select>
|
101 |
+
<select name="dbem_events_default_archive_order" >
|
102 |
+
<?php
|
103 |
+
$ascending = __('Ascending','dbem');
|
104 |
+
$descending = __('Descending','dbem');
|
105 |
+
$event_archive_order_options = apply_filters('em_settings_events_default_archive_order_ddm', array(
|
106 |
+
'ASC' => __('Ascending','dbem'),
|
107 |
+
'DESC' => __('Descending','dbem')
|
108 |
+
));
|
109 |
+
?>
|
110 |
+
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
111 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
112 |
+
<?php echo esc_html($value); ?>
|
113 |
+
</option>
|
114 |
+
<?php endforeach; ?>
|
115 |
+
</select>
|
116 |
+
<br/>
|
117 |
+
<em><?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?></em>
|
118 |
+
</td>
|
119 |
+
</tr>
|
120 |
+
<?php
|
121 |
+
em_options_select( __('Event archives scope','dbem'), 'dbem_events_archive_scope', em_get_scopes() );
|
122 |
+
?>
|
123 |
+
</tbody>
|
124 |
+
<tr class="em-header">
|
125 |
+
<td colspan="2">
|
126 |
+
<h4><?php echo _e('General settings','dbem'); ?></h4>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
<?php
|
130 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_events_archive_formats', sprintf($format_override_tip,__('events','dbem')));
|
131 |
+
em_options_radio_binary ( __( 'Override Excerpts with Formats?', 'dbem' ), 'dbem_cp_events_excerpt_formats', sprintf($format_override_tip,__('events','dbem')));
|
132 |
+
em_options_radio_binary ( __( 'Are current events past events?', 'dbem' ), 'dbem_events_current_are_past', __( "By default, events that have an end date later than today will be included in searches, set this to yes to consider events that started 'yesterday' as past.", 'dbem' ) );
|
133 |
+
em_options_radio_binary ( __( 'Include in WordPress Searches?', 'dbem' ), 'dbem_cp_events_search_results', sprintf(__( "Allow %s to appear in the built-in search results.", 'dbem' ),__('events','dbem')) );
|
134 |
+
?>
|
135 |
+
<tr class="em-header">
|
136 |
+
<td colspan="2">
|
137 |
+
<h4><?php echo sprintf(__('Default %s list options','dbem'), __('event','dbem')); ?></h4>
|
138 |
+
<p><?php _e('These can be overriden when using shortcode or template tags.','dbem'); ?></p>
|
139 |
+
</td>
|
140 |
+
</tr>
|
141 |
+
<tr valign="top" id='dbem_events_default_orderby_row'>
|
142 |
+
<th scope="row"><?php _e('Default event list ordering','dbem'); ?></th>
|
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','dbem'),
|
148 |
+
'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time','dbem'),
|
149 |
+
'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time','dbem'),
|
150 |
+
'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name','dbem'),
|
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>
|
157 |
+
<?php endforeach; ?>
|
158 |
+
</select>
|
159 |
+
<select name="dbem_events_default_order" >
|
160 |
+
<?php
|
161 |
+
$ascending = __('Ascending','dbem');
|
162 |
+
$descending = __('Descending','dbem');
|
163 |
+
$order_options = apply_filters('em_settings_events_default_order_ddm', array(
|
164 |
+
'ASC' => __('All Ascending','dbem'),
|
165 |
+
'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'dbem'),
|
166 |
+
'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'dbem'),
|
167 |
+
'DESC' => __('All Descending','dbem'),
|
168 |
+
'ASC,DESC,ASC' => __("$ascending, $descending, $ascending",'dbem'),
|
169 |
+
'ASC,DESC,DESC' => __("$ascending, $descending, $descending",'dbem'),
|
170 |
+
'ASC,ASC,DESC' => __("$ascending, $ascending, $descending",'dbem'),
|
171 |
+
'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'dbem'),
|
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>
|
178 |
+
<?php endforeach; ?>
|
179 |
+
</select>
|
180 |
+
<br/>
|
181 |
+
<em><?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?></em>
|
182 |
+
</td>
|
183 |
+
</tr>
|
184 |
+
<?php
|
185 |
+
em_options_select( __('Event list scope','dbem'), 'dbem_events_page_scope', em_get_scopes(), __('Only show events starting within a certain time limit on the events page. Default is future events with no end time limit.','dbem') );
|
186 |
+
em_options_input_text ( __( 'Event List Limits', 'dbem' ), 'dbem_events_default_limit', __( "This will control how many events are shown on one list by default.", 'dbem' ) );
|
187 |
+
echo $save_button;
|
188 |
+
?>
|
189 |
+
</table>
|
190 |
+
</div> <!-- . inside -->
|
191 |
+
</div> <!-- .postbox -->
|
192 |
+
|
193 |
+
<?php if( get_option('dbem_locations_enabled') ): ?>
|
194 |
+
<div class="postbox " id="em-opt-location-pages" >
|
195 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s Pages','dbem'),__('Location','dbem')); ?></span></h3>
|
196 |
+
<div class="inside">
|
197 |
+
<table class="form-table">
|
198 |
+
<?php
|
199 |
+
//em_options_radio_binary ( sprintf(__( 'Display %s as', 'dbem' ),__('locations','dbem')), 'dbem_cp_locations_template_page', sprintf($template_page_tip, EM_POST_TYPE_LOCATION), array(__('Posts'),__('Pages')) );
|
200 |
+
em_options_select( sprintf(__( 'Display %s as', 'dbem' ),__('locations','dbem')), 'dbem_cp_locations_template', $page_templates, sprintf($template_page_tip, __('locations','dbem'), EM_POST_TYPE_LOCATION) );
|
201 |
+
em_options_input_text( __('Body Classes','dbem'), 'dbem_cp_locations_body_class', sprintf($body_class_tip, __('location','dbem')) );
|
202 |
+
em_options_input_text( __('Post Classes','dbem'), 'dbem_cp_locations_post_class', $post_class_tip );
|
203 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_locations_formats', sprintf($format_override_tip,__('locations','dbem')));
|
204 |
+
em_options_radio_binary ( __( 'Enable Comments?', 'dbem' ), '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.','dbem'),__('location','dbem'),__('locations','dbem')));
|
205 |
+
em_options_input_text ( __( 'Event List Limits', 'dbem' ), '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.", 'dbem' ), '<code>#_LOCATIONNEXTEVENTS</code>') );
|
206 |
+
echo $save_button;
|
207 |
+
?>
|
208 |
+
</table>
|
209 |
+
</div> <!-- . inside -->
|
210 |
+
</div> <!-- .postbox -->
|
211 |
+
|
212 |
+
<div class="postbox " id="em-opt-location-archives" >
|
213 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s List/Archives','dbem'),__('Location','dbem')); ?></span></h3>
|
214 |
+
<div class="inside">
|
215 |
+
<table class="form-table">
|
216 |
+
<tr>
|
217 |
+
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Locations','dbem')); ?></th>
|
218 |
+
<td>
|
219 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_locations_page', 'selected'=>get_option('dbem_locations_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'dbem'),__('Locations','dbem')) )); ?>
|
220 |
+
<br />
|
221 |
+
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page. If you do not select a %s page, to display lists you can enable archives or use the appropriate shortcodes and/or template tags.','dbem' ),__('locations','dbem'),__('locations','dbem')); ?></em>
|
222 |
+
</td>
|
223 |
+
</tr>
|
224 |
+
<?php
|
225 |
+
em_options_radio_binary ( __( 'Show locations search?', 'dbem' ), 'dbem_locations_page_search_form', __( "If set to yes, a search form will appear just above your list of locations.", 'dbem' ) );
|
226 |
+
?>
|
227 |
+
<tr class="em-header">
|
228 |
+
<td colspan="2">
|
229 |
+
<h4><?php echo sprintf(__('WordPress %s Archives','dbem'), __('Location','dbem')); ?></h4>
|
230 |
+
<p><?php echo sprintf(__('%s custom post types can have archives, just like normal WordPress posts. If enabled, should you visit your base slug url %s and you will see an post-formatted archive of previous %s', 'dbem'), __('Location','dbem'), '<code>'.home_url().'/'.get_option('dbem_cp_locations_slug',EM_POST_TYPE_LOCATION_SLUG).'/</code>', __('locations','dbem')); ?></p>
|
231 |
+
<p><?php echo sprintf(__('Note that assigning a %s page above will override this archive if the URLs collide (which is the default settings, and is recommended for maximum plugin compatibility). You can have both at the same time, but you must ensure that your page and %s slugs are different.','dbem'), __('locations','dbem'), __('location','dbem')); ?></p>
|
232 |
+
</td>
|
233 |
+
</tr>
|
234 |
+
<tbody class="em-location-archive-options">
|
235 |
+
<?php
|
236 |
+
em_options_radio_binary ( __( 'Enable Archives?', 'dbem' ), 'dbem_cp_locations_has_archive', __( "Allow WordPress post-style archives.", 'dbem' ) );
|
237 |
+
?>
|
238 |
+
</tbody>
|
239 |
+
<tbody class="em-location-archive-options em-location-archive-sub-options">
|
240 |
+
<tr valign="top">
|
241 |
+
<th scope="row"><?php _e('Default archive ordering','dbem'); ?></th>
|
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','dbem'),__('Country','dbem')),
|
247 |
+
'_location_town' => sprintf(__('Order by %s','dbem'),__('Town','dbem')),
|
248 |
+
'title' => sprintf(__('Order by %s','dbem'),__('Name','dbem'))
|
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>
|
255 |
+
<?php endforeach; ?>
|
256 |
+
</select>
|
257 |
+
<select name="dbem_locations_default_archive_order" >
|
258 |
+
<?php
|
259 |
+
$ascending = __('Ascending','dbem');
|
260 |
+
$descending = __('Descending','dbem');
|
261 |
+
$order_options = apply_filters('em_settings_locations_default_archive_order_ddm', array(
|
262 |
+
'ASC' => __('Ascending','dbem'),
|
263 |
+
'DESC' => __('Descending','dbem')
|
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>
|
270 |
+
<?php endforeach; ?>
|
271 |
+
</select>
|
272 |
+
</td>
|
273 |
+
</tr>
|
274 |
+
</tbody>
|
275 |
+
<tr class="em-header">
|
276 |
+
<td colspan="2">
|
277 |
+
<h4><?php echo _e('General settings','dbem'); ?></h4>
|
278 |
+
</td>
|
279 |
+
</tr>
|
280 |
+
<?php
|
281 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_locations_archive_formats', sprintf($format_override_tip,__('locations','dbem')));
|
282 |
+
em_options_radio_binary ( __( 'Override Excerpts with Formats?', 'dbem' ), 'dbem_cp_locations_excerpt_formats', sprintf($format_override_tip,__('locations','dbem')));
|
283 |
+
em_options_radio_binary ( __( 'Include in WordPress Searches?', 'dbem' ), 'dbem_cp_locations_search_results', sprintf(__( "Allow %s to appear in the built-in search results.", 'dbem' ),__('locations','dbem')) );
|
284 |
+
?>
|
285 |
+
<tr class="em-header">
|
286 |
+
<td colspan="2">
|
287 |
+
<h4><?php echo sprintf(__('Default %s list options','dbem'), __('location','dbem')); ?></h4>
|
288 |
+
<p><?php _e('These can be overriden when using shortcode or template tags.','dbem'); ?></p>
|
289 |
+
</td>
|
290 |
+
</tr>
|
291 |
+
<tr valign="top" id='dbem_locations_default_orderby_row'>
|
292 |
+
<th scope="row"><?php _e('Default list ordering','dbem'); ?></th>
|
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','dbem'),__('Country','dbem')),
|
298 |
+
'location_town' => sprintf(__('Order by %s','dbem'),__('Town','dbem')),
|
299 |
+
'location_name' => sprintf(__('Order by %s','dbem'),__('Name','dbem'))
|
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>
|
306 |
+
<?php endforeach; ?>
|
307 |
+
</select>
|
308 |
+
<select name="dbem_locations_default_order" >
|
309 |
+
<?php
|
310 |
+
$ascending = __('Ascending','dbem');
|
311 |
+
$descending = __('Descending','dbem');
|
312 |
+
$order_options = apply_filters('em_settings_locations_default_order_ddm', array(
|
313 |
+
'ASC' => __('Ascending','dbem'),
|
314 |
+
'DESC' => __('Descending','dbem')
|
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>
|
321 |
+
<?php endforeach; ?>
|
322 |
+
</select>
|
323 |
+
</td>
|
324 |
+
</tr>
|
325 |
+
<?php
|
326 |
+
em_options_input_text ( __( 'List Limits', 'dbem' ), 'dbem_locations_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'dbem' ),__('locations','dbem')) );
|
327 |
+
echo $save_button;
|
328 |
+
?>
|
329 |
+
</table>
|
330 |
+
</div> <!-- . inside -->
|
331 |
+
</div> <!-- .postbox -->
|
332 |
+
<?php endif; ?>
|
333 |
+
|
334 |
+
<?php if( get_option('dbem_categories_enabled') && !(EM_MS_GLOBAL && !is_main_site()) ): ?>
|
335 |
+
<div class="postbox " id="em-opt-categories-pages" >
|
336 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo __('Event Categories','dbem'); ?></span></h3>
|
337 |
+
<div class="inside">
|
338 |
+
<div class="em-boxheader">
|
339 |
+
<p>
|
340 |
+
<?php echo sprintf(__('%s are a <a href="%s" target="_blank">WordPress custom taxonomy</a>.','dbem'), __('Event Categories','dbem'), 'http://codex.wordpress.org/Taxonomies');?>
|
341 |
+
<?php echo sprintf(__('%s can be displayed just like normal WordPress custom taxonomies in an archive-style format, however Events Manager by default allows you to completely change the standard look of these archives and use our own <a href="%s">custom formatting</a> methods.','dbem'), __('Event Categories','dbem'), EM_ADMIN_URL .'&page=events-manager-help#event-placeholders'); ?>
|
342 |
+
</p>
|
343 |
+
<p>
|
344 |
+
<?php echo sprintf(__('Due to how we change how this custom taxonomy is displayed when overriding with formats it is strongly advised that you assign a %s page below, which increases comatability with various plugins and themes.','dbem'), __('categories','dbem')); ?>
|
345 |
+
<?php sprintf(__('<a href="%s">See some more information</a> on how %s work when overriding with formats.','dbem'), '#', __('categories','dbem')); //not ready yet, but make translatable ?>
|
346 |
+
</p>
|
347 |
+
</div>
|
348 |
+
<table class="form-table">
|
349 |
+
<tr>
|
350 |
+
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Categories','dbem')); ?></th>
|
351 |
+
<td>
|
352 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_categories_page','selected'=>get_option('dbem_categories_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'dbem'),__('Categories','dbem')) )); ?>
|
353 |
+
<br />
|
354 |
+
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page.','dbem' ),__('categories','dbem')); ?></em>
|
355 |
+
</td>
|
356 |
+
</tr>
|
357 |
+
<tr class="em-header">
|
358 |
+
<td colspan="2">
|
359 |
+
<h4><?php echo _e('General settings','dbem'); ?></h4>
|
360 |
+
</td>
|
361 |
+
</tr>
|
362 |
+
<?php
|
363 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_categories_formats', sprintf($format_override_tip,__('categories','dbem'))." ".__('Setting this to yes will make categories display as a page rather than an archive.', 'dbem'));
|
364 |
+
?>
|
365 |
+
<tr valign="top">
|
366 |
+
<th scope="row"><?php _e('Default archive ordering','dbem'); ?></th>
|
367 |
+
<td>
|
368 |
+
<select name="dbem_categories_default_archive_orderby" >
|
369 |
+
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
370 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
371 |
+
<?php echo esc_html($value) ?>
|
372 |
+
</option>
|
373 |
+
<?php endforeach; ?>
|
374 |
+
</select>
|
375 |
+
<select name="dbem_categories_default_archive_order" >
|
376 |
+
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
377 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
378 |
+
<?php echo esc_html($value) ?>
|
379 |
+
</option>
|
380 |
+
<?php endforeach; ?>
|
381 |
+
</select>
|
382 |
+
<br /><?php echo __('When listing events for a category, this order is applied.', 'dbem'); ?>
|
383 |
+
</td>
|
384 |
+
</tr>
|
385 |
+
<tr class="em-header">
|
386 |
+
<td colspan="2">
|
387 |
+
<h4><?php echo sprintf(__('Default %s list options','dbem'), __('category','dbem')); ?></h4>
|
388 |
+
<p><?php _e('These can be overriden when using shortcode or template tags.','dbem'); ?></p>
|
389 |
+
</td>
|
390 |
+
</tr>
|
391 |
+
<tr valign="top" id='dbem_categories_default_orderby_row'>
|
392 |
+
<th scope="row"><?php _e('Default list ordering','dbem'); ?></th>
|
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','dbem'),__('ID','dbem')),
|
398 |
+
'count' => sprintf(__('Order by %s','dbem'),__('Count','dbem')),
|
399 |
+
'name' => sprintf(__('Order by %s','dbem'),__('Name','dbem')),
|
400 |
+
'slug' => sprintf(__('Order by %s','dbem'),__('Slug','dbem')),
|
401 |
+
'term_group' => sprintf(__('Order by %s','dbem'),'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>
|
408 |
+
<?php endforeach; ?>
|
409 |
+
</select>
|
410 |
+
<select name="dbem_categories_default_order" >
|
411 |
+
<?php
|
412 |
+
$ascending = __('Ascending','dbem');
|
413 |
+
$descending = __('Descending','dbem');
|
414 |
+
$order_options = apply_filters('em_settings_categories_default_order_ddm', array(
|
415 |
+
'ASC' => __('Ascending','dbem'),
|
416 |
+
'DESC' => __('Descending','dbem')
|
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>
|
423 |
+
<?php endforeach; ?>
|
424 |
+
</select>
|
425 |
+
<br /><?php echo __('When listing categories, this order is applied.', 'dbem'); ?>
|
426 |
+
</td>
|
427 |
+
</tr>
|
428 |
+
<?php
|
429 |
+
em_options_input_text ( __( 'List Limits', 'dbem' ), 'dbem_categories_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'dbem' ),__('categories','dbem')) );
|
430 |
+
em_options_input_text ( __( 'Event List Limits', 'dbem' ), '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.", 'dbem' ), '<code>#_CATEGORYNEXTEVENTS</code>') );
|
431 |
+
echo $save_button;
|
432 |
+
?>
|
433 |
+
</table>
|
434 |
+
</div> <!-- . inside -->
|
435 |
+
</div> <!-- .postbox -->
|
436 |
+
<?php endif; ?>
|
437 |
+
|
438 |
+
<?php if( get_option('dbem_tags_enabled') ): //disabled for now, will add tag stuff later ?>
|
439 |
+
<div class="postbox " id="em-opt-tags-pages" >
|
440 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo __('Event Tags','dbem'); ?></span></h3>
|
441 |
+
<div class="inside">
|
442 |
+
<div class="em-boxheader">
|
443 |
+
<p>
|
444 |
+
<?php echo sprintf(__('%s are a <a href="%s" target="_blank">WordPress custom taxonomy</a>.','dbem'), __('Event Tags','dbem'), 'http://codex.wordpress.org/Taxonomies');?>
|
445 |
+
<?php echo sprintf(__('%s can be displayed just like normal WordPress custom taxonomies in an archive-style format, however Events Manager by default allows you to completely change the standard look of these archives and use our own <a href="%s">custom formatting</a> methods.','dbem'), __('Event Tags','dbem'), EM_ADMIN_URL .'&page=events-manager-help#event-placeholders'); ?>
|
446 |
+
</p>
|
447 |
+
<p>
|
448 |
+
<?php echo sprintf(__('Due to how we change how this custom taxonomy is displayed when overriding with formats it is strongly advised that you assign a %s page below, which increases comatability with various plugins and themes.','dbem'), __('tags','dbem')); ?>
|
449 |
+
<?php sprintf(__('<a href="%s">See some more information</a> on how %s work when overriding with formats.','dbem'), '#', __('tags','dbem')); //not ready yet, but make translatable ?>
|
450 |
+
</p>
|
451 |
+
</div>
|
452 |
+
<table class="form-table">
|
453 |
+
<tr>
|
454 |
+
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Tags','dbem')); ?></th>
|
455 |
+
<td>
|
456 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_tags_page','selected'=>get_option('dbem_tags_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'dbem'),__('Tags','dbem')) )); ?>
|
457 |
+
<br />
|
458 |
+
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page.','dbem' ),__('tags','dbem'),__('tags','dbem')); ?></em>
|
459 |
+
</td>
|
460 |
+
</tr>
|
461 |
+
<tr class="em-header">
|
462 |
+
<td colspan="2">
|
463 |
+
<h4><?php echo _e('General settings','dbem'); ?></h4>
|
464 |
+
</td>
|
465 |
+
</tr>
|
466 |
+
<?php
|
467 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'dbem' ), 'dbem_cp_tags_formats', sprintf($format_override_tip,__('tags','dbem')));
|
468 |
+
?>
|
469 |
+
<tr valign="top">
|
470 |
+
<th scope="row"><?php _e('Default archive ordering','dbem'); ?></th>
|
471 |
+
<td>
|
472 |
+
<select name="dbem_tags_default_archive_orderby" >
|
473 |
+
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
474 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
475 |
+
<?php echo esc_html($value) ?>
|
476 |
+
</option>
|
477 |
+
<?php endforeach; ?>
|
478 |
+
</select>
|
479 |
+
<select name="dbem_tags_default_archive_order" >
|
480 |
+
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
481 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
482 |
+
<?php echo esc_html($value) ?>
|
483 |
+
</option>
|
484 |
+
<?php endforeach; ?>
|
485 |
+
</select>
|
486 |
+
</td>
|
487 |
+
</tr>
|
488 |
+
<tr class="em-header">
|
489 |
+
<td colspan="2">
|
490 |
+
<h4><?php echo sprintf(__('Default %s list options','dbem'), __('tag','dbem')); ?></h4>
|
491 |
+
<p><?php _e('These can be overriden when using shortcode or template tags.','dbem'); ?></p>
|
492 |
+
</td>
|
493 |
+
</tr>
|
494 |
+
<tr valign="top" id='dbem_tags_default_orderby_row'>
|
495 |
+
<th scope="row"><?php _e('Default list ordering','dbem'); ?></th>
|
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','dbem'),__('ID','dbem')),
|
501 |
+
'count' => sprintf(__('Order by %s','dbem'),__('Count','dbem')),
|
502 |
+
'name' => sprintf(__('Order by %s','dbem'),__('Name','dbem')),
|
503 |
+
'slug' => sprintf(__('Order by %s','dbem'),__('Slug','dbem')),
|
504 |
+
'term_group' => sprintf(__('Order by %s','dbem'),'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>
|
511 |
+
<?php endforeach; ?>
|
512 |
+
</select>
|
513 |
+
<select name="dbem_tags_default_order" >
|
514 |
+
<?php
|
515 |
+
$ascending = __('Ascending','dbem');
|
516 |
+
$descending = __('Descending','dbem');
|
517 |
+
$order_options = apply_filters('em_settings_tags_default_order_ddm', array(
|
518 |
+
'ASC' => __('Ascending','dbem'),
|
519 |
+
'DESC' => __('Descending','dbem')
|
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>
|
526 |
+
<?php endforeach; ?>
|
527 |
+
</select>
|
528 |
+
<br /><?php echo __('When listing tags, this order is applied.', 'dbem'); ?>
|
529 |
+
</td>
|
530 |
+
</tr>
|
531 |
+
<?php
|
532 |
+
em_options_input_text ( __( 'List Limits', 'dbem' ), 'dbem_tags_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'dbem' ),__('tags','dbem')) );
|
533 |
+
em_options_input_text ( __( 'Event List Limits', 'dbem' ), '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.", 'dbem' ), '<code>#_TAGNEXTEVENTS</code>') );
|
534 |
+
echo $save_button; ?>
|
535 |
+
</table>
|
536 |
+
</div> <!-- . inside -->
|
537 |
+
</div> <!-- .postbox -->
|
538 |
+
<?php endif; ?>
|
539 |
+
|
540 |
+
<div class="postbox " id="em-opt-other-pages" >
|
541 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s Pages','dbem'),__('Other','dbem')); ?></span></h3>
|
542 |
+
<div class="inside">
|
543 |
+
<p class="em-boxheader"><?php _e('These pages allow you to provide an event management interface outside the admin area on whatever page you want on your website. Bear in mind that this is overriden by BuddyPress if activated.', 'dbem'); ?></p>
|
544 |
+
<table class="form-table">
|
545 |
+
<?php
|
546 |
+
$other_pages_tip = 'Using the %s shortcode, you can allow users to manage %s outside the admin area.';
|
547 |
+
?>
|
548 |
+
<tr class="em-header">
|
549 |
+
<td colspan="2">
|
550 |
+
<h4><?php _e('My Bookings','dbem'); ?></h4>
|
551 |
+
<p><?php _e('This page is where people that have made bookings for an event can go and view their previous bookings.','dbem'); ?>
|
552 |
+
</td>
|
553 |
+
</tr>
|
554 |
+
<tr>
|
555 |
+
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('My bookings','dbem')); ?>
|
556 |
+
</th>
|
557 |
+
<td>
|
558 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_my_bookings_page', 'selected'=>get_option('dbem_my_bookings_page'), 'show_option_none'=>'['.__('None', 'dbem').']' )); ?>
|
559 |
+
<br />
|
560 |
+
<em><?php echo sprintf(__('Users can view their bookings for other events on this page.','dbem' ),'<code>[my_bookings]</code>',__('bookings','dbem')); ?></em>
|
561 |
+
</td>
|
562 |
+
</tr>
|
563 |
+
<tr valign="top" id='dbem_bookings_default_orderby_row'>
|
564 |
+
<th scope="row"><?php _e('Default list ordering','dbem'); ?></th>
|
565 |
+
<td>
|
566 |
+
<select name="dbem_bookings_default_orderby" >
|
567 |
+
<?php
|
568 |
+
$orderby_options = apply_filters('em_settings_bookings_default_orderby_ddm', array(
|
569 |
+
'event_name' => sprintf(__('Order by %s','dbem'),__('Event Name','dbem')),
|
570 |
+
'event_start_date' => sprintf(__('Order by %s','dbem'),__('Start Date','dbem')),
|
571 |
+
'booking_date' => sprintf(__('Order by %s','dbem'),__('Booking Date','dbem'))
|
572 |
+
));
|
573 |
+
?>
|
574 |
+
<?php foreach($orderby_options as $key => $value) : ?>
|
575 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_bookings_default_orderby')) ? "selected='selected'" : ''; ?>>
|
576 |
+
<?php echo esc_html($value) ?>
|
577 |
+
</option>
|
578 |
+
<?php endforeach; ?>
|
579 |
+
</select>
|
580 |
+
<select name="dbem_bookings_default_order" >
|
581 |
+
<?php
|
582 |
+
$ascending = __('Ascending','dbem');
|
583 |
+
$descending = __('Descending','dbem');
|
584 |
+
$order_options = apply_filters('em_settings_bookings_default_order_ddm', array(
|
585 |
+
'ASC' => __('Ascending','dbem'),
|
586 |
+
'DESC' => __('Descending','dbem')
|
587 |
+
));
|
588 |
+
?>
|
589 |
+
<?php foreach( $order_options as $key => $value) : ?>
|
590 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_bookings_default_order')) ? "selected='selected'" : ''; ?>>
|
591 |
+
<?php echo esc_html($value) ?>
|
592 |
+
</option>
|
593 |
+
<?php endforeach; ?>
|
594 |
+
</select>
|
595 |
+
</td>
|
596 |
+
</tr>
|
597 |
+
<tr class="em-header">
|
598 |
+
<td colspan="2">
|
599 |
+
<h4><?php _e('Front-end management pages','dbem'); ?></h4>
|
600 |
+
<p><?php _e('Users with the relevant permissions can manage their own events and bookings to these events on the following pages.','dbem'); ?></p>
|
601 |
+
</td>
|
602 |
+
</tr>
|
603 |
+
<tr>
|
604 |
+
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Edit events','dbem')); ?></th>
|
605 |
+
<td>
|
606 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_edit_events_page', 'selected'=>get_option('dbem_edit_events_page'), 'show_option_none'=>'['.__('None', 'dbem').']' )); ?>
|
607 |
+
<br />
|
608 |
+
<em><?php echo sprintf(__('Users can view, add and edit their %s on this page.','dbem'),__('events','dbem')); ?></em>
|
609 |
+
</td>
|
610 |
+
</tr>
|
611 |
+
<tr>
|
612 |
+
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Edit locations','dbem')); ?></th>
|
613 |
+
<td>
|
614 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_edit_locations_page', 'selected'=>get_option('dbem_edit_locations_page'), 'show_option_none'=>'['.__('None', 'dbem').']' )); ?>
|
615 |
+
<br />
|
616 |
+
<em><?php echo sprintf(__('Users can view, add and edit their %s on this page.','dbem'),__('locations','dbem')); ?></em>
|
617 |
+
</td>
|
618 |
+
</tr>
|
619 |
+
<tr>
|
620 |
+
<th><?php echo sprintf(__( '%s page', 'dbem' ),__('Manage bookings','dbem')); ?></th>
|
621 |
+
<td>
|
622 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_edit_bookings_page', 'selected'=>get_option('dbem_edit_bookings_page'), 'show_option_none'=>'['.__('None', 'dbem').']' )); ?>
|
623 |
+
<br />
|
624 |
+
<em><?php _e('Users can manage bookings for their events on this page.','dbem'); ?></em>
|
625 |
+
</td>
|
626 |
+
</tr>
|
627 |
+
<?php echo $save_button; ?>
|
628 |
+
</table>
|
629 |
+
</div> <!-- . inside -->
|
630 |
+
</div> <!-- .postbox -->
|
631 |
+
|
632 |
+
<?php do_action('em_options_page_footer_pages'); ?>
|
633 |
+
|
634 |
+
</div> <!-- .em-menu-pages -->
|
admin/{wpfc-admin.php → settings/wpfc-admin.php}
RENAMED
@@ -1,47 +1,47 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Adds a note to the event post type in the admin area, so it's obvious EM is interfering.
|
4 |
-
*/
|
5 |
-
function wpfc_admin_options_post_type_event(){
|
6 |
-
echo " - <i>powered by Events Manager</i>";
|
7 |
-
}
|
8 |
-
add_action('wpfc_admin_options_post_type_event','wpfc_admin_options_post_type_event');
|
9 |
-
|
10 |
-
function wpfc_em_admin_notice(){
|
11 |
-
if( !empty($_REQUEST['page']) && $_REQUEST['page'] == 'wp-fullcalendar'){
|
12 |
-
?>
|
13 |
-
<div class="updated"><p><?php echo sprintf(__('If you choose the Event post type whilst Events Manager is activated, you can also visit the <a href="%s">Events Manager settings page</a> for a few more options when displaying event information on your calendar.','dbem'), admin_url('edit.php?post_type='.EM_POST_TYPE_EVENT.'&page=events-manager-options')); ?></p></div>
|
14 |
-
<?php
|
15 |
-
}
|
16 |
-
}
|
17 |
-
add_action('admin_notices', 'wpfc_em_admin_notice');
|
18 |
-
|
19 |
-
function wpfc_em_admin_options(){
|
20 |
-
?>
|
21 |
-
<div class="postbox " >
|
22 |
-
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Full Calendar Options', 'dbem' ); ?> </span></h3>
|
23 |
-
<div class="inside">
|
24 |
-
<p class="em-boxheader"><?php echo sprintf(__('Looking for the rest of the FullCalendar Options? They\'ve moved <a href="%s">here</a>, the options below are for overriding specific bits relevant to Events Manager.','dbem'), admin_url('options-general.php?page=wp-fullcalendar')); ?></p>
|
25 |
-
<table class='form-table'>
|
26 |
-
<?php
|
27 |
-
global $events_placeholder_tip, $save_button;
|
28 |
-
em_options_radio_binary ( __( 'Override calendar on events page?', 'dbem' ), 'dbem_emfc_override_calendar', __( 'If set to yes, the FullCalendar will be used instead of the standard calendar on the events page.', 'dbem' ) );
|
29 |
-
em_options_radio_binary ( __( 'Override calendar shortcode?', 'dbem' ), 'dbem_emfc_override_shortcode', __( 'Overrides the default calendar shortcode. You can also use [events_fullcalendar] instead.','dbem' ) );
|
30 |
-
em_options_input_text ( __( 'Event title format', 'dbem' ), 'dbem_emfc_full_calendar_event_format', __('HTML is not accepted.','dbem').' '.$events_placeholder_tip, '#_EVENTNAME' );
|
31 |
-
em_options_textarea( __( 'Event tooltips format', 'dbem' ), 'dbem_emfc_qtips_format', __('If you enable tips, this information will be shown, which can include HTML.','dbem').' '.$events_placeholder_tip, '#_EVENTNAME' );$positions_options = array();
|
32 |
-
?>
|
33 |
-
</table>
|
34 |
-
<?php echo $save_button; ?>
|
35 |
-
</div> <!-- . inside -->
|
36 |
-
</div> <!-- .postbox -->
|
37 |
-
<?php
|
38 |
-
}
|
39 |
-
add_action('em_options_page_footer', 'wpfc_em_admin_options');
|
40 |
-
|
41 |
-
function wpfc_em_install(){
|
42 |
-
//check for updates - try adding one option, if it works then it's a first time install so add more
|
43 |
-
if( current_user_can('list_users') && add_option('dbem_emfc_full_calendar_event_format','#_EVENTTIMES - #_EVENTNAME') ){
|
44 |
-
add_option('dbem_emfc_qtips_format', '{has_image}<div style="float:left; margin:0px 5px 5px 0px;">#_EVENTIMAGE{75,75}</div>{/has_image}#_EVENTEXCERPT');
|
45 |
-
}
|
46 |
-
}
|
47 |
add_action('init', 'wpfc_em_install');
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adds a note to the event post type in the admin area, so it's obvious EM is interfering.
|
4 |
+
*/
|
5 |
+
function wpfc_admin_options_post_type_event(){
|
6 |
+
echo " - <i>powered by Events Manager</i>";
|
7 |
+
}
|
8 |
+
add_action('wpfc_admin_options_post_type_event','wpfc_admin_options_post_type_event');
|
9 |
+
|
10 |
+
function wpfc_em_admin_notice(){
|
11 |
+
if( !empty($_REQUEST['page']) && $_REQUEST['page'] == 'wp-fullcalendar'){
|
12 |
+
?>
|
13 |
+
<div class="updated"><p><?php echo sprintf(__('If you choose the Event post type whilst Events Manager is activated, you can also visit the <a href="%s">Events Manager settings page</a> for a few more options when displaying event information on your calendar.','dbem'), admin_url('edit.php?post_type='.EM_POST_TYPE_EVENT.'&page=events-manager-options')); ?></p></div>
|
14 |
+
<?php
|
15 |
+
}
|
16 |
+
}
|
17 |
+
add_action('admin_notices', 'wpfc_em_admin_notice');
|
18 |
+
|
19 |
+
function wpfc_em_admin_options(){
|
20 |
+
?>
|
21 |
+
<div class="postbox " >
|
22 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'dbem'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Full Calendar Options', 'dbem' ); ?> </span></h3>
|
23 |
+
<div class="inside">
|
24 |
+
<p class="em-boxheader"><?php echo sprintf(__('Looking for the rest of the FullCalendar Options? They\'ve moved <a href="%s">here</a>, the options below are for overriding specific bits relevant to Events Manager.','dbem'), admin_url('options-general.php?page=wp-fullcalendar')); ?></p>
|
25 |
+
<table class='form-table'>
|
26 |
+
<?php
|
27 |
+
global $events_placeholder_tip, $save_button;
|
28 |
+
em_options_radio_binary ( __( 'Override calendar on events page?', 'dbem' ), 'dbem_emfc_override_calendar', __( 'If set to yes, the FullCalendar will be used instead of the standard calendar on the events page.', 'dbem' ) );
|
29 |
+
em_options_radio_binary ( __( 'Override calendar shortcode?', 'dbem' ), 'dbem_emfc_override_shortcode', __( 'Overrides the default calendar shortcode. You can also use [events_fullcalendar] instead.','dbem' ) );
|
30 |
+
em_options_input_text ( __( 'Event title format', 'dbem' ), 'dbem_emfc_full_calendar_event_format', __('HTML is not accepted.','dbem').' '.$events_placeholder_tip, '#_EVENTNAME' );
|
31 |
+
em_options_textarea( __( 'Event tooltips format', 'dbem' ), 'dbem_emfc_qtips_format', __('If you enable tips, this information will be shown, which can include HTML.','dbem').' '.$events_placeholder_tip, '#_EVENTNAME' );$positions_options = array();
|
32 |
+
?>
|
33 |
+
</table>
|
34 |
+
<?php echo $save_button; ?>
|
35 |
+
</div> <!-- . inside -->
|
36 |
+
</div> <!-- .postbox -->
|
37 |
+
<?php
|
38 |
+
}
|
39 |
+
add_action('em_options_page_footer', 'wpfc_em_admin_options');
|
40 |
+
|
41 |
+
function wpfc_em_install(){
|
42 |
+
//check for updates - try adding one option, if it works then it's a first time install so add more
|
43 |
+
if( current_user_can('list_users') && add_option('dbem_emfc_full_calendar_event_format','#_EVENTTIMES - #_EVENTNAME') ){
|
44 |
+
add_option('dbem_emfc_qtips_format', '{has_image}<div style="float:left; margin:0px 5px 5px 0px;">#_EVENTIMAGE{75,75}</div>{/has_image}#_EVENTEXCERPT');
|
45 |
+
}
|
46 |
+
}
|
47 |
add_action('init', 'wpfc_em_install');
|
buddypress/bp-em-activity.php
CHANGED
@@ -1,218 +1,218 @@
|
|
1 |
-
<?php
|
2 |
-
// This file handles hooks/filter requiring activity stream publications
|
3 |
-
|
4 |
-
/**
|
5 |
-
* bp_em_record_activity()
|
6 |
-
*
|
7 |
-
* If the activity stream component is installed, this function will record activity items for your
|
8 |
-
* component.
|
9 |
-
*/
|
10 |
-
function bp_em_record_activity( $args = '' ) {
|
11 |
-
if ( !function_exists( 'bp_activity_add' ) )
|
12 |
-
return false;
|
13 |
-
|
14 |
-
$defaults = array(
|
15 |
-
'id' => false,
|
16 |
-
'user_id' => '',
|
17 |
-
'action' => '',
|
18 |
-
'content' => '',
|
19 |
-
'primary_link' => '',
|
20 |
-
'component' => 'events-manager',
|
21 |
-
'type' => false,
|
22 |
-
'item_id' => false,
|
23 |
-
'secondary_item_id' => false,
|
24 |
-
'recorded_time' => gmdate( "Y-m-d H:i:s" ),
|
25 |
-
'hide_sitewide' => false
|
26 |
-
);
|
27 |
-
|
28 |
-
$r = wp_parse_args( $args, $defaults );
|
29 |
-
extract( $r );
|
30 |
-
return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
|
31 |
-
}
|
32 |
-
|
33 |
-
function em_bp_register_activity_actions() {
|
34 |
-
|
35 |
-
if ( !bp_is_active( 'events' ) ) {
|
36 |
-
return false;
|
37 |
-
}
|
38 |
-
|
39 |
-
$bp = buddypress();
|
40 |
-
|
41 |
-
// @todo - Figure out why adding a second bp_activity_set_action creates two 'Bookings' actions in backend and different booking status front-end e.g. when friendships created/accepted do not
|
42 |
-
bp_activity_set_action(
|
43 |
-
$bp->events->id,
|
44 |
-
'new_booking',
|
45 |
-
__( 'Bookings', 'dbem' ),
|
46 |
-
'em_bp_events_format_activity_action_bookings',
|
47 |
-
__( 'Bookings', 'dbem' ),
|
48 |
-
array( 'activity', 'member' )
|
49 |
-
);
|
50 |
-
/*
|
51 |
-
bp_activity_set_action(
|
52 |
-
$bp->events->id,
|
53 |
-
'booking_cancelled',
|
54 |
-
__( 'Booking Cancelled', 'dbem' ),
|
55 |
-
'em_bp_events_format_activity_action_bookings',
|
56 |
-
__( 'Bookings', 'dbem' ),
|
57 |
-
array( 'activity', 'member' )
|
58 |
-
);
|
59 |
-
*/
|
60 |
-
|
61 |
-
bp_activity_set_action(
|
62 |
-
$bp->events->id,
|
63 |
-
'new_event',
|
64 |
-
__('New Event','dbem'),
|
65 |
-
'em_bp_events_format_activity_action_events',
|
66 |
-
__( 'Events', 'dbem' ),
|
67 |
-
array( 'activity', 'member' )
|
68 |
-
);
|
69 |
-
}
|
70 |
-
add_action( 'bp_register_activity_actions', 'em_bp_register_activity_actions' );
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Not yet used fully - formats booking-related actions
|
74 |
-
* @param string $action
|
75 |
-
* @param object $activity
|
76 |
-
* @return string
|
77 |
-
*/
|
78 |
-
function em_bp_events_format_activity_action_bookings( $action, $activity ) {
|
79 |
-
return '';
|
80 |
-
$member_link = bp_core_get_userlink( $activity->user_id );
|
81 |
-
$EM_Booking = em_get_booking( $activity->item );
|
82 |
-
|
83 |
-
$action = '';
|
84 |
-
switch ($activity->type){
|
85 |
-
case 'new_booking':
|
86 |
-
if( $activity->component == 'groups' ){
|
87 |
-
$action = sprintf(__('%s is attending %s of the group %s.','dbem'), $member_link, $event_link, $group_link );
|
88 |
-
}else{
|
89 |
-
$action = sprintf(__('%s is attending %s.','dbem'), $member_link, $event_link );
|
90 |
-
}
|
91 |
-
break;
|
92 |
-
case 'cancelled_booking':
|
93 |
-
if( $activity->component == 'groups' ){
|
94 |
-
$action = sprintf(__('%s will not be attending %s of group %s anymore.','dbem'), $user_link, $event_link, $group_link );
|
95 |
-
}else{
|
96 |
-
$action = sprintf(__('%s will not be attending %s anymore.','dbem'), $user_link, $event_link );
|
97 |
-
}
|
98 |
-
break;
|
99 |
-
}
|
100 |
-
|
101 |
-
return apply_filters( 'bp_events_format_activity_action_bookings', $action, $activity );
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Not yet used fully - formats event-related actions
|
106 |
-
* @param string $action
|
107 |
-
* @param object $activity
|
108 |
-
* @return string
|
109 |
-
*/
|
110 |
-
function em_bp_events_format_activity_action_events( $action, $activity ) {
|
111 |
-
return '';
|
112 |
-
$member_link = bp_core_get_userlink( $activity->user_id );
|
113 |
-
$EM_Event = em_get_event( $activity->item_id );
|
114 |
-
|
115 |
-
$action = sprintf(__('%s added the event %s','dbem'), $member_link, $EM_Event->output('#_EVENTLINK') );
|
116 |
-
|
117 |
-
return apply_filters( 'bp_events_format_activity_action_events', $action, $activity );
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Records new events to the activity stream.
|
122 |
-
* @param unknown_type $result
|
123 |
-
* @param unknown_type $EM_Event
|
124 |
-
* @return unknown
|
125 |
-
*/
|
126 |
-
function bp_em_record_activity_event_save( $result, $EM_Event ){
|
127 |
-
if( $result && $EM_Event->event_status == 1 && $EM_Event->get_previous_status() != 1 ){
|
128 |
-
$user = get_userdata($EM_Event->event_owner);
|
129 |
-
$member_link = bp_core_get_user_domain($user->ID);
|
130 |
-
if( empty($EM_Event->group_id) ){
|
131 |
-
bp_em_record_activity( array(
|
132 |
-
'user_id' => $user->ID,
|
133 |
-
'action' => sprintf(__('%s added the event %s','dbem'), "<a href='".$member_link."'>".$user->display_name."</a>", $EM_Event->output('#_EVENTLINK') ),
|
134 |
-
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
135 |
-
'type' => 'new_event',
|
136 |
-
'item_id' => $EM_Event->event_id,
|
137 |
-
'hide_sitewide' => $EM_Event->event_private
|
138 |
-
));
|
139 |
-
}else{
|
140 |
-
//tis a group event
|
141 |
-
$group = new BP_Groups_Group($EM_Event->group_id);
|
142 |
-
bp_em_record_activity( array(
|
143 |
-
'user_id' => $user->ID,
|
144 |
-
'action' => sprintf(__('%s added the event %s to %s.','dbem'), "<a href='".$member_link."'>".$user->display_name."</a>", $EM_Event->output('#_EVENTLINK'), '<a href="'.bp_get_group_permalink($group).'">'.bp_get_group_name($group).'</a>' ),
|
145 |
-
'component' => 'groups',
|
146 |
-
'type' => 'new_event',
|
147 |
-
'item_id' => $EM_Event->group_id,
|
148 |
-
'hide_sitewide' => $EM_Event->event_private
|
149 |
-
));
|
150 |
-
}
|
151 |
-
}
|
152 |
-
return $result;
|
153 |
-
}
|
154 |
-
add_filter('em_event_save','bp_em_record_activity_event_save', 10, 2);
|
155 |
-
|
156 |
-
/**
|
157 |
-
* @param boolean $result
|
158 |
-
* @param EM_Booking $EM_Booking
|
159 |
-
* @return boolean
|
160 |
-
*/
|
161 |
-
function bp_em_record_activity_booking_save( $result, $EM_Booking ){
|
162 |
-
if( !empty($EM_Booking->event_id) && $result ){
|
163 |
-
$rejected_statuses = array(0,2,3); //these statuses apply to rejected/cancelled bookings
|
164 |
-
$user = $EM_Booking->get_person();
|
165 |
-
$member_link = bp_core_get_user_domain($user->ID);
|
166 |
-
$user_link = "<a href='".$member_link."/'>".$user->display_name."</a>";
|
167 |
-
$event_link = $EM_Booking->get_event()->output('#_EVENTLINK');
|
168 |
-
$status = $EM_Booking->booking_status;
|
169 |
-
$EM_Event = $EM_Booking->get_event();
|
170 |
-
$action_type = 'new_booking';
|
171 |
-
if( empty($EM_Event->group_id) ){
|
172 |
-
if( $status == 1 || (!get_option('dbem_bookings_approval') && $status < 2) ){
|
173 |
-
$action = sprintf(__('%s is attending %s.','dbem'), $user_link, $event_link );
|
174 |
-
}elseif( ($EM_Booking->previous_status == 1 || (!get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2)) && in_array($status, $rejected_statuses) ){
|
175 |
-
$action = sprintf(__('%s will not be attending %s anymore.','dbem'), $user_link, $event_link );
|
176 |
-
//$action_type = 'cancelled_booking';
|
177 |
-
}
|
178 |
-
}else{
|
179 |
-
$group = new BP_Groups_Group($EM_Event->group_id);
|
180 |
-
$group_link = '<a href="'.bp_get_group_permalink($group).'">'.bp_get_group_name($group).'</a>';
|
181 |
-
if( $status == 1 || (!get_option('dbem_bookings_approval') && $status < 2) ){
|
182 |
-
$action = sprintf(__('%s is attending %s of the group %s.','dbem'), $user_link, $event_link, $group_link );
|
183 |
-
}elseif( ($EM_Booking->previous_status == 1 || (!get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2)) && in_array($status, $rejected_statuses) ){
|
184 |
-
$action = sprintf(__('%s will not be attending %s of group %s anymore.','dbem'), $user_link, $event_link, $group_link );
|
185 |
-
//$action_type = 'cancelled_booking';
|
186 |
-
}
|
187 |
-
}
|
188 |
-
if( !empty($action) ){
|
189 |
-
if( empty($EM_Event->group_id) ){
|
190 |
-
bp_em_record_activity( array(
|
191 |
-
'user_id' => $EM_Booking->person->ID,
|
192 |
-
'action' => $action,
|
193 |
-
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
194 |
-
'type' => $action_type,
|
195 |
-
'item_id' => $EM_Event->event_id,
|
196 |
-
'secondary_item_id' => $EM_Booking->booking_id,
|
197 |
-
'hide_sitewide' => $EM_Event->event_private
|
198 |
-
));
|
199 |
-
}else{
|
200 |
-
//tis a group event
|
201 |
-
bp_em_record_activity( array(
|
202 |
-
'component' => 'groups',
|
203 |
-
'user_id' => $EM_Booking->person->ID,
|
204 |
-
'action' => $action,
|
205 |
-
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
206 |
-
'type' => $action_type,
|
207 |
-
'item_id' => $EM_Event->group_id,
|
208 |
-
'secondary_item_id' => $EM_Booking->booking_id,
|
209 |
-
'hide_sitewide' => $EM_Event->event_private
|
210 |
-
));
|
211 |
-
}
|
212 |
-
}
|
213 |
-
}
|
214 |
-
return $result;
|
215 |
-
}
|
216 |
-
add_filter('em_booking_set_status','bp_em_record_activity_booking_save', 100, 2);
|
217 |
-
add_filter('em_booking_save','bp_em_record_activity_booking_save', 100, 2);
|
218 |
add_filter('em_booking_delete','bp_em_record_activity_booking_save', 100, 2);
|
1 |
+
<?php
|
2 |
+
// This file handles hooks/filter requiring activity stream publications
|
3 |
+
|
4 |
+
/**
|
5 |
+
* bp_em_record_activity()
|
6 |
+
*
|
7 |
+
* If the activity stream component is installed, this function will record activity items for your
|
8 |
+
* component.
|
9 |
+
*/
|
10 |
+
function bp_em_record_activity( $args = '' ) {
|
11 |
+
if ( !function_exists( 'bp_activity_add' ) )
|
12 |
+
return false;
|
13 |
+
|
14 |
+
$defaults = array(
|
15 |
+
'id' => false,
|
16 |
+
'user_id' => '',
|
17 |
+
'action' => '',
|
18 |
+
'content' => '',
|
19 |
+
'primary_link' => '',
|
20 |
+
'component' => 'events-manager',
|
21 |
+
'type' => false,
|
22 |
+
'item_id' => false,
|
23 |
+
'secondary_item_id' => false,
|
24 |
+
'recorded_time' => gmdate( "Y-m-d H:i:s" ),
|
25 |
+
'hide_sitewide' => false
|
26 |
+
);
|
27 |
+
|
28 |
+
$r = wp_parse_args( $args, $defaults );
|
29 |
+
extract( $r );
|
30 |
+
return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
function em_bp_register_activity_actions() {
|
34 |
+
|
35 |
+
if ( !bp_is_active( 'events' ) ) {
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
|
39 |
+
$bp = buddypress();
|
40 |
+
|
41 |
+
// @todo - Figure out why adding a second bp_activity_set_action creates two 'Bookings' actions in backend and different booking status front-end e.g. when friendships created/accepted do not
|
42 |
+
bp_activity_set_action(
|
43 |
+
$bp->events->id,
|
44 |
+
'new_booking',
|
45 |
+
__( 'Bookings', 'dbem' ),
|
46 |
+
'em_bp_events_format_activity_action_bookings',
|
47 |
+
__( 'Bookings', 'dbem' ),
|
48 |
+
array( 'activity', 'member' )
|
49 |
+
);
|
50 |
+
/*
|
51 |
+
bp_activity_set_action(
|
52 |
+
$bp->events->id,
|
53 |
+
'booking_cancelled',
|
54 |
+
__( 'Booking Cancelled', 'dbem' ),
|
55 |
+
'em_bp_events_format_activity_action_bookings',
|
56 |
+
__( 'Bookings', 'dbem' ),
|
57 |
+
array( 'activity', 'member' )
|
58 |
+
);
|
59 |
+
*/
|
60 |
+
|
61 |
+
bp_activity_set_action(
|
62 |
+
$bp->events->id,
|
63 |
+
'new_event',
|
64 |
+
__('New Event','dbem'),
|
65 |
+
'em_bp_events_format_activity_action_events',
|
66 |
+
__( 'Events', 'dbem' ),
|
67 |
+
array( 'activity', 'member' )
|
68 |
+
);
|
69 |
+
}
|
70 |
+
add_action( 'bp_register_activity_actions', 'em_bp_register_activity_actions' );
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Not yet used fully - formats booking-related actions
|
74 |
+
* @param string $action
|
75 |
+
* @param object $activity
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
function em_bp_events_format_activity_action_bookings( $action, $activity ) {
|
79 |
+
return '';
|
80 |
+
$member_link = bp_core_get_userlink( $activity->user_id );
|
81 |
+
$EM_Booking = em_get_booking( $activity->item );
|
82 |
+
|
83 |
+
$action = '';
|
84 |
+
switch ($activity->type){
|
85 |
+
case 'new_booking':
|
86 |
+
if( $activity->component == 'groups' ){
|
87 |
+
$action = sprintf(__('%s is attending %s of the group %s.','dbem'), $member_link, $event_link, $group_link );
|
88 |
+
}else{
|
89 |
+
$action = sprintf(__('%s is attending %s.','dbem'), $member_link, $event_link );
|
90 |
+
}
|
91 |
+
break;
|
92 |
+
case 'cancelled_booking':
|
93 |
+
if( $activity->component == 'groups' ){
|
94 |
+
$action = sprintf(__('%s will not be attending %s of group %s anymore.','dbem'), $user_link, $event_link, $group_link );
|
95 |
+
}else{
|
96 |
+
$action = sprintf(__('%s will not be attending %s anymore.','dbem'), $user_link, $event_link );
|
97 |
+
}
|
98 |
+
break;
|
99 |
+
}
|
100 |
+
|
101 |
+
return apply_filters( 'bp_events_format_activity_action_bookings', $action, $activity );
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Not yet used fully - formats event-related actions
|
106 |
+
* @param string $action
|
107 |
+
* @param object $activity
|
108 |
+
* @return string
|
109 |
+
*/
|
110 |
+
function em_bp_events_format_activity_action_events( $action, $activity ) {
|
111 |
+
return '';
|
112 |
+
$member_link = bp_core_get_userlink( $activity->user_id );
|
113 |
+
$EM_Event = em_get_event( $activity->item_id );
|
114 |
+
|
115 |
+
$action = sprintf(__('%s added the event %s','dbem'), $member_link, $EM_Event->output('#_EVENTLINK') );
|
116 |
+
|
117 |
+
return apply_filters( 'bp_events_format_activity_action_events', $action, $activity );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Records new events to the activity stream.
|
122 |
+
* @param unknown_type $result
|
123 |
+
* @param unknown_type $EM_Event
|
124 |
+
* @return unknown
|
125 |
+
*/
|
126 |
+
function bp_em_record_activity_event_save( $result, $EM_Event ){
|
127 |
+
if( $result && $EM_Event->event_status == 1 && $EM_Event->get_previous_status() != 1 ){
|
128 |
+
$user = get_userdata($EM_Event->event_owner);
|
129 |
+
$member_link = bp_core_get_user_domain($user->ID);
|
130 |
+
if( empty($EM_Event->group_id) ){
|
131 |
+
bp_em_record_activity( array(
|
132 |
+
'user_id' => $user->ID,
|
133 |
+
'action' => sprintf(__('%s added the event %s','dbem'), "<a href='".$member_link."'>".$user->display_name."</a>", $EM_Event->output('#_EVENTLINK') ),
|
134 |
+
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
135 |
+
'type' => 'new_event',
|
136 |
+
'item_id' => $EM_Event->event_id,
|
137 |
+
'hide_sitewide' => $EM_Event->event_private
|
138 |
+
));
|
139 |
+
}else{
|
140 |
+
//tis a group event
|
141 |
+
$group = new BP_Groups_Group($EM_Event->group_id);
|
142 |
+
bp_em_record_activity( array(
|
143 |
+
'user_id' => $user->ID,
|
144 |
+
'action' => sprintf(__('%s added the event %s to %s.','dbem'), "<a href='".$member_link."'>".$user->display_name."</a>", $EM_Event->output('#_EVENTLINK'), '<a href="'.bp_get_group_permalink($group).'">'.bp_get_group_name($group).'</a>' ),
|
145 |
+
'component' => 'groups',
|
146 |
+
'type' => 'new_event',
|
147 |
+
'item_id' => $EM_Event->group_id,
|
148 |
+
'hide_sitewide' => $EM_Event->event_private
|
149 |
+
));
|
150 |
+
}
|
151 |
+
}
|
152 |
+
return $result;
|
153 |
+
}
|
154 |
+
add_filter('em_event_save','bp_em_record_activity_event_save', 10, 2);
|
155 |
+
|
156 |
+
/**
|
157 |
+
* @param boolean $result
|
158 |
+
* @param EM_Booking $EM_Booking
|
159 |
+
* @return boolean
|
160 |
+
*/
|
161 |
+
function bp_em_record_activity_booking_save( $result, $EM_Booking ){
|
162 |
+
if( !empty($EM_Booking->event_id) && $result ){
|
163 |
+
$rejected_statuses = array(0,2,3); //these statuses apply to rejected/cancelled bookings
|
164 |
+
$user = $EM_Booking->get_person();
|
165 |
+
$member_link = bp_core_get_user_domain($user->ID);
|
166 |
+
$user_link = "<a href='".$member_link."/'>".$user->display_name."</a>";
|
167 |
+
$event_link = $EM_Booking->get_event()->output('#_EVENTLINK');
|
168 |
+
$status = $EM_Booking->booking_status;
|
169 |
+
$EM_Event = $EM_Booking->get_event();
|
170 |
+
$action_type = 'new_booking';
|
171 |
+
if( empty($EM_Event->group_id) ){
|
172 |
+
if( $status == 1 || (!get_option('dbem_bookings_approval') && $status < 2) ){
|
173 |
+
$action = sprintf(__('%s is attending %s.','dbem'), $user_link, $event_link );
|
174 |
+
}elseif( ($EM_Booking->previous_status == 1 || (!get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2)) && in_array($status, $rejected_statuses) ){
|
175 |
+
$action = sprintf(__('%s will not be attending %s anymore.','dbem'), $user_link, $event_link );
|
176 |
+
//$action_type = 'cancelled_booking';
|
177 |
+
}
|
178 |
+
}else{
|
179 |
+
$group = new BP_Groups_Group($EM_Event->group_id);
|
180 |
+
$group_link = '<a href="'.bp_get_group_permalink($group).'">'.bp_get_group_name($group).'</a>';
|
181 |
+
if( $status == 1 || (!get_option('dbem_bookings_approval') && $status < 2) ){
|
182 |
+
$action = sprintf(__('%s is attending %s of the group %s.','dbem'), $user_link, $event_link, $group_link );
|
183 |
+
}elseif( ($EM_Booking->previous_status == 1 || (!get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2)) && in_array($status, $rejected_statuses) ){
|
184 |
+
$action = sprintf(__('%s will not be attending %s of group %s anymore.','dbem'), $user_link, $event_link, $group_link );
|
185 |
+
//$action_type = 'cancelled_booking';
|
186 |
+
}
|
187 |
+
}
|
188 |
+
if( !empty($action) ){
|
189 |
+
if( empty($EM_Event->group_id) ){
|
190 |
+
bp_em_record_activity( array(
|
191 |
+
'user_id' => $EM_Booking->person->ID,
|
192 |
+
'action' => $action,
|
193 |
+
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
194 |
+
'type' => $action_type,
|
195 |
+
'item_id' => $EM_Event->event_id,
|
196 |
+
'secondary_item_id' => $EM_Booking->booking_id,
|
197 |
+
'hide_sitewide' => $EM_Event->event_private
|
198 |
+
));
|
199 |
+
}else{
|
200 |
+
//tis a group event
|
201 |
+
bp_em_record_activity( array(
|
202 |
+
'component' => 'groups',
|
203 |
+
'user_id' => $EM_Booking->person->ID,
|
204 |
+
'action' => $action,
|
205 |
+
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
206 |
+
'type' => $action_type,
|
207 |
+
'item_id' => $EM_Event->group_id,
|
208 |
+
'secondary_item_id' => $EM_Booking->booking_id,
|
209 |
+
'hide_sitewide' => $EM_Event->event_private
|
210 |
+
));
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
return $result;
|
215 |
+
}
|
216 |
+
add_filter('em_booking_set_status','bp_em_record_activity_booking_save', 100, 2);
|
217 |
+
add_filter('em_booking_save','bp_em_record_activity_booking_save', 100, 2);
|
218 |
add_filter('em_booking_delete','bp_em_record_activity_booking_save', 100, 2);
|
buddypress/bp-em-core.php
CHANGED
@@ -160,93 +160,93 @@ class BP_EM_Component extends BP_Component {
|
|
160 |
add_action( 'bp_init', array(&$this, 'setup_group_nav') );
|
161 |
}
|
162 |
|
163 |
-
public function setup_admin_bar( $wp_admin_nav = array() ) {
|
164 |
-
global $bp, $blog_id;
|
165 |
-
|
166 |
-
// Prevent debug notices
|
167 |
-
$wp_admin_nav = array();
|
168 |
-
|
169 |
-
// Menus for logged in user
|
170 |
if ( is_user_logged_in() ) {
|
171 |
-
//check multisite or normal mode for correct permission checking
|
172 |
-
if(is_multisite() && $blog_id != BP_ROOT_BLOG){
|
173 |
-
//FIXME MS mode doesn't seem to recognize cross subsite caps, using the proper functions, for now we use switch_blog.
|
174 |
-
$current_blog = $blog_id;
|
175 |
-
switch_to_blog(BP_ROOT_BLOG);
|
176 |
-
$can_manage_events = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_events');
|
177 |
-
$can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations');
|
178 |
-
$can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings');
|
179 |
-
switch_to_blog($current_blog);
|
180 |
-
}else{
|
181 |
-
$can_manage_events = current_user_can('edit_events');
|
182 |
-
$can_manage_locations = current_user_can('edit_locations');
|
183 |
-
$can_manage_bookings = current_user_can('manage_bookings');
|
184 |
}
|
185 |
-
|
186 |
$em_link = trailingslashit( bp_loggedin_user_domain() . em_bp_get_slug() );
|
187 |
-
|
188 |
-
/* Add 'Events' to the main user profile navigation */
|
189 |
$wp_admin_nav[] = array(
|
190 |
'parent' => $bp->my_account_menu_id,
|
191 |
'id' => 'my-em-' . $this->id,
|
192 |
'title' => __( 'Events', 'dbem' ),
|
193 |
-
'href' => $em_link
|
194 |
-
);
|
195 |
-
|
196 |
-
/* Create SubNav Items */
|
197 |
-
$wp_admin_nav[] = array(
|
198 |
-
'parent' => 'my-em-' . $this->id,
|
199 |
-
'id' => 'my-em-' . $this->id .'-profile',
|
200 |
-
'title' => __( 'My Profile', 'dbem' ),
|
201 |
-
'href' => $em_link.'profile/'
|
202 |
-
);
|
203 |
-
|
204 |
$wp_admin_nav[] = array(
|
205 |
'parent' => 'my-em-' . $this->id,
|
206 |
'id' => 'my-em-' . $this->id .'-attending',
|
207 |
'title' => __( 'Events I\'m Attending', 'dbem' ),
|
208 |
-
'href' => $em_link.'attending/'
|
209 |
-
);
|
210 |
-
|
211 |
-
if( $can_manage_events ){
|
212 |
-
$wp_admin_nav[] = array(
|
213 |
-
'parent' => 'my-em-' . $this->id,
|
214 |
-
'id' => 'my-em-' . $this->id .'-my-events',
|
215 |
-
'title' => __( 'My Events', 'dbem' ),
|
216 |
-
'href' => $em_link.'my-events/'
|
217 |
-
);
|
218 |
-
}
|
219 |
-
|
220 |
-
if( $can_manage_locations && get_option('dbem_locations_enabled') ){
|
221 |
$wp_admin_nav[] = array(
|
222 |
'parent' => 'my-em-' . $this->id,
|
223 |
'id' => 'my-em-' . $this->id .'-my-locations',
|
224 |
'title' => __( 'My Locations', 'dbem' ),
|
225 |
-
'href' => $em_link.'my-locations/'
|
226 |
-
);
|
227 |
-
}
|
228 |
-
|
229 |
-
if( $can_manage_bookings && get_option('dbem_rsvp_enabled') ){
|
230 |
$wp_admin_nav[] = array(
|
231 |
'parent' => 'my-em-' . $this->id,
|
232 |
'id' => 'my-em-' . $this->id .'-my-bookings',
|
233 |
'title' => __( 'My Event Bookings', 'dbem' ),
|
234 |
-
'href' => $em_link.'my-bookings/'
|
235 |
-
);
|
236 |
-
}
|
237 |
-
|
238 |
-
if( bp_is_active('groups') ){
|
239 |
-
/* Create Profile Group Sub-Nav */
|
240 |
$wp_admin_nav[] = array(
|
241 |
'parent' => 'my-account-groups',
|
242 |
'id' => 'my-account-groups-' . $this->id ,
|
243 |
'title' => __( 'Events', 'dbem' ),
|
244 |
-
'href' => trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . 'group-events/'
|
245 |
-
);
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
parent::setup_admin_bar( $wp_admin_nav );
|
250 |
}
|
251 |
|
252 |
function setup_group_nav(){
|
@@ -310,7 +310,7 @@ if( !is_admin() || ( defined('DOING_AJAX') && !empty($_REQUEST['is_public'])) ){
|
|
310 |
}
|
311 |
|
312 |
//CSS and JS Loading
|
313 |
-
function bp_em_enqueue_scripts( ){
|
314 |
if( bp_is_current_component('events') || (bp_is_current_component('groups') && bp_is_current_action('group-events')) ){
|
315 |
add_filter('option_dbem_js_limit', create_function('$args','return false;'));
|
316 |
add_filter('option_dbem_css_limit', create_function('$args','return false;'));
|
160 |
add_action( 'bp_init', array(&$this, 'setup_group_nav') );
|
161 |
}
|
162 |
|
163 |
+
public function setup_admin_bar( $wp_admin_nav = array() ) {
|
164 |
+
global $bp, $blog_id;
|
165 |
+
|
166 |
+
// Prevent debug notices
|
167 |
+
$wp_admin_nav = array();
|
168 |
+
|
169 |
+
// Menus for logged in user
|
170 |
if ( is_user_logged_in() ) {
|
171 |
+
//check multisite or normal mode for correct permission checking
|
172 |
+
if(is_multisite() && $blog_id != BP_ROOT_BLOG){
|
173 |
+
//FIXME MS mode doesn't seem to recognize cross subsite caps, using the proper functions, for now we use switch_blog.
|
174 |
+
$current_blog = $blog_id;
|
175 |
+
switch_to_blog(BP_ROOT_BLOG);
|
176 |
+
$can_manage_events = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_events');
|
177 |
+
$can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations');
|
178 |
+
$can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings');
|
179 |
+
switch_to_blog($current_blog);
|
180 |
+
}else{
|
181 |
+
$can_manage_events = current_user_can('edit_events');
|
182 |
+
$can_manage_locations = current_user_can('edit_locations');
|
183 |
+
$can_manage_bookings = current_user_can('manage_bookings');
|
184 |
}
|
185 |
+
|
186 |
$em_link = trailingslashit( bp_loggedin_user_domain() . em_bp_get_slug() );
|
187 |
+
|
188 |
+
/* Add 'Events' to the main user profile navigation */
|
189 |
$wp_admin_nav[] = array(
|
190 |
'parent' => $bp->my_account_menu_id,
|
191 |
'id' => 'my-em-' . $this->id,
|
192 |
'title' => __( 'Events', 'dbem' ),
|
193 |
+
'href' => $em_link
|
194 |
+
);
|
195 |
+
|
196 |
+
/* Create SubNav Items */
|
197 |
+
$wp_admin_nav[] = array(
|
198 |
+
'parent' => 'my-em-' . $this->id,
|
199 |
+
'id' => 'my-em-' . $this->id .'-profile',
|
200 |
+
'title' => __( 'My Profile', 'dbem' ),
|
201 |
+
'href' => $em_link.'profile/'
|
202 |
+
);
|
203 |
+
|
204 |
$wp_admin_nav[] = array(
|
205 |
'parent' => 'my-em-' . $this->id,
|
206 |
'id' => 'my-em-' . $this->id .'-attending',
|
207 |
'title' => __( 'Events I\'m Attending', 'dbem' ),
|
208 |
+
'href' => $em_link.'attending/'
|
209 |
+
);
|
210 |
+
|
211 |
+
if( $can_manage_events ){
|
212 |
+
$wp_admin_nav[] = array(
|
213 |
+
'parent' => 'my-em-' . $this->id,
|
214 |
+
'id' => 'my-em-' . $this->id .'-my-events',
|
215 |
+
'title' => __( 'My Events', 'dbem' ),
|
216 |
+
'href' => $em_link.'my-events/'
|
217 |
+
);
|
218 |
+
}
|
219 |
+
|
220 |
+
if( $can_manage_locations && get_option('dbem_locations_enabled') ){
|
221 |
$wp_admin_nav[] = array(
|
222 |
'parent' => 'my-em-' . $this->id,
|
223 |
'id' => 'my-em-' . $this->id .'-my-locations',
|
224 |
'title' => __( 'My Locations', 'dbem' ),
|
225 |
+
'href' => $em_link.'my-locations/'
|
226 |
+
);
|
227 |
+
}
|
228 |
+
|
229 |
+
if( $can_manage_bookings && get_option('dbem_rsvp_enabled') ){
|
230 |
$wp_admin_nav[] = array(
|
231 |
'parent' => 'my-em-' . $this->id,
|
232 |
'id' => 'my-em-' . $this->id .'-my-bookings',
|
233 |
'title' => __( 'My Event Bookings', 'dbem' ),
|
234 |
+
'href' => $em_link.'my-bookings/'
|
235 |
+
);
|
236 |
+
}
|
237 |
+
|
238 |
+
if( bp_is_active('groups') ){
|
239 |
+
/* Create Profile Group Sub-Nav */
|
240 |
$wp_admin_nav[] = array(
|
241 |
'parent' => 'my-account-groups',
|
242 |
'id' => 'my-account-groups-' . $this->id ,
|
243 |
'title' => __( 'Events', 'dbem' ),
|
244 |
+
'href' => trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . 'group-events/'
|
245 |
+
);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
parent::setup_admin_bar( $wp_admin_nav );
|
250 |
}
|
251 |
|
252 |
function setup_group_nav(){
|
310 |
}
|
311 |
|
312 |
//CSS and JS Loading
|
313 |
+
function bp_em_enqueue_scripts( ){
|
314 |
if( bp_is_current_component('events') || (bp_is_current_component('groups') && bp_is_current_action('group-events')) ){
|
315 |
add_filter('option_dbem_js_limit', create_function('$args','return false;'));
|
316 |
add_filter('option_dbem_css_limit', create_function('$args','return false;'));
|
buddypress/bp-em-groups.php
CHANGED
@@ -1,150 +1,151 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Turns an event private if the event belongs to a private BP Group
|
4 |
-
* @param EM_Event $EM_Event
|
5 |
-
*/
|
6 |
-
function bp_em_group_event_save($result, $EM_Event){
|
7 |
-
if( is_object($EM_Event) && !empty($EM_Event->event_id) ){
|
8 |
-
if( !empty($_REQUEST['group_id']) && is_numeric($_REQUEST['group_id']) && bp_is_active('groups') ){
|
9 |
-
//firstly, we check that the event has been published, otherwise users without publish rights can submit an event at a private group and event is marked private/published immediately
|
10 |
-
if( $EM_Event->event_status == 1 ){
|
11 |
-
//we have been requested an event creation tied to a group, so does this group exist, and does this person have admin rights to it?
|
12 |
-
if( groups_is_user_admin(get_current_user_id(), $_REQUEST['group_id']) ){
|
13 |
-
$EM_Event->group_id = $_REQUEST['group_id'];
|
14 |
-
}
|
15 |
-
if( !empty($EM_Event->group_id) ){
|
16 |
-
//if group is private, make it private
|
17 |
-
$group = groups_get_group(array('group_id'=>$EM_Event->group_id));
|
18 |
-
$is_member = groups_is_user_member(get_current_user_id(), $EM_Event->group_id) || groups_is_user_admin(get_current_user_id(), $EM_Event->group_id) || groups_is_user_mod(get_current_user_id(), $EM_Event->group_id);
|
19 |
-
if( $group->status != 'public' && $is_member ){
|
20 |
-
//Make sure event status is private and set post status to private
|
21 |
-
global $wpdb;
|
22 |
-
$EM_Event->event_private = 1;
|
23 |
-
$wpdb->update($wpdb->posts, array('post_status'=>'private'), array('ID'=>$EM_Event->post_id));
|
24 |
-
$wpdb->update(EM_EVENTS_TABLE, array('event_private'=>1), array('event_id'=>$EM_Event->event_id));
|
25 |
-
}
|
26 |
-
}
|
27 |
-
}
|
28 |
-
}else{
|
29 |
-
$EM_Event->group_id = null;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
return $result;
|
33 |
-
}
|
34 |
-
add_action('em_event_save','bp_em_group_event_save',1,2);
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Overrides the default capability of the user for another owner's event if the user is a group admin and the event belongs to a group.
|
38 |
-
* User must have the relevant permissions globally in order to inherit that capability for this event as well.
|
39 |
-
* @param boolean $result
|
40 |
-
* @param EM_Event $EM_Event
|
41 |
-
*/
|
42 |
-
function bp_em_group_event_can_manage( $result, $EM_Event, $owner_capability, $admin_capability, $user_to_check){
|
43 |
-
if( !$result && $EM_Event->event_owner != get_current_user_id() && !empty($EM_Event->group_id) && bp_is_active('groups') ){ //only override if already false, incase it's true
|
44 |
-
//if the user is an admin of this group, and actually has the relevant permissions globally, they can manage this event
|
45 |
-
$EM_Object = new EM_Object(); //create new object to prevent infinite loop should we call $EM_Event->can_manage();
|
46 |
-
if( groups_is_user_admin(get_current_user_id(),$EM_Event->group_id) && $EM_Object->can_manage($owner_capability, $admin_capability, $user_to_check) ){
|
47 |
-
//This user is an admin of the owner's group, so they can edit this event.
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
*
|
112 |
-
* @
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
$
|
126 |
-
$
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
$
|
131 |
-
$
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
add_meta_box('em-event-group', __('Group Ownership','dbem'), 'bp_em_meta_box_group',
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
150 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Turns an event private if the event belongs to a private BP Group
|
4 |
+
* @param EM_Event $EM_Event
|
5 |
+
*/
|
6 |
+
function bp_em_group_event_save($result, $EM_Event){
|
7 |
+
if( is_object($EM_Event) && !empty($EM_Event->event_id) ){
|
8 |
+
if( !empty($_REQUEST['group_id']) && is_numeric($_REQUEST['group_id']) && bp_is_active('groups') ){
|
9 |
+
//firstly, we check that the event has been published, otherwise users without publish rights can submit an event at a private group and event is marked private/published immediately
|
10 |
+
if( $EM_Event->event_status == 1 ){
|
11 |
+
//we have been requested an event creation tied to a group, so does this group exist, and does this person have admin rights to it?
|
12 |
+
if( groups_is_user_admin(get_current_user_id(), $_REQUEST['group_id']) ){
|
13 |
+
$EM_Event->group_id = $_REQUEST['group_id'];
|
14 |
+
}
|
15 |
+
if( !empty($EM_Event->group_id) ){
|
16 |
+
//if group is private, make it private
|
17 |
+
$group = groups_get_group(array('group_id'=>$EM_Event->group_id));
|
18 |
+
$is_member = groups_is_user_member(get_current_user_id(), $EM_Event->group_id) || groups_is_user_admin(get_current_user_id(), $EM_Event->group_id) || groups_is_user_mod(get_current_user_id(), $EM_Event->group_id);
|
19 |
+
if( $group->status != 'public' && $is_member ){
|
20 |
+
//Make sure event status is private and set post status to private
|
21 |
+
global $wpdb;
|
22 |
+
$EM_Event->event_private = 1;
|
23 |
+
$wpdb->update($wpdb->posts, array('post_status'=>'private'), array('ID'=>$EM_Event->post_id));
|
24 |
+
$wpdb->update(EM_EVENTS_TABLE, array('event_private'=>1), array('event_id'=>$EM_Event->event_id));
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}else{
|
29 |
+
$EM_Event->group_id = null;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
return $result;
|
33 |
+
}
|
34 |
+
add_action('em_event_save','bp_em_group_event_save',1,2);
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Overrides the default capability of the user for another owner's event if the user is a group admin and the event belongs to a group.
|
38 |
+
* User must have the relevant permissions globally in order to inherit that capability for this event as well.
|
39 |
+
* @param boolean $result
|
40 |
+
* @param EM_Event $EM_Event
|
41 |
+
*/
|
42 |
+
function bp_em_group_event_can_manage( $result, $EM_Event, $owner_capability, $admin_capability, $user_to_check){
|
43 |
+
if( !$result && $EM_Event->event_owner != get_current_user_id() && !empty($EM_Event->group_id) && bp_is_active('groups') ){ //only override if already false, incase it's true
|
44 |
+
//if the user is an admin of this group, and actually has the relevant permissions globally, they can manage this event
|
45 |
+
$EM_Object = new EM_Object(); //create new object to prevent infinite loop should we call $EM_Event->can_manage();
|
46 |
+
if( groups_is_user_admin(get_current_user_id(),$EM_Event->group_id) && $EM_Object->can_manage($owner_capability, $admin_capability, $user_to_check) ){
|
47 |
+
//This user is an admin of the owner's group, so they can edit this event.
|
48 |
+
array_pop($EM_Event->errors); //remove last error
|
49 |
+
return true;
|
50 |
+
}else{
|
51 |
+
$EM_Event->add_error($EM_Object->get_errors()); //add any applicable errors
|
52 |
+
}
|
53 |
+
}
|
54 |
+
return $result;
|
55 |
+
}
|
56 |
+
add_filter('em_event_can_manage','bp_em_group_event_can_manage',1,5);
|
57 |
+
|
58 |
+
|
59 |
+
function bp_em_group_events_accepted_searches($searches){
|
60 |
+
if( bp_is_active('groups') ){
|
61 |
+
$searches[] = 'group';
|
62 |
+
}
|
63 |
+
return $searches;
|
64 |
+
}
|
65 |
+
add_filter('em_accepted_searches','bp_em_group_events_accepted_searches',1,1);
|
66 |
+
|
67 |
+
function bp_em_group_events_get_default_search($searches, $array){
|
68 |
+
if( !empty($array['group']) && (is_numeric($array['group']) || $array['group'] == 'my' || $array['group'] == 'this') && bp_is_active('groups') ){
|
69 |
+
if($array['group'] == 'this'){ //shows current group, if applicable
|
70 |
+
if( is_numeric(bp_get_current_group_id()) ){
|
71 |
+
$searches['group'] = bp_get_current_group_id();
|
72 |
+
}
|
73 |
+
}else{
|
74 |
+
$searches['group'] = $array['group'];
|
75 |
+
}
|
76 |
+
}
|
77 |
+
return $searches;
|
78 |
+
}
|
79 |
+
add_filter('em_events_get_default_search','bp_em_group_events_get_default_search',1,2);
|
80 |
+
|
81 |
+
/*
|
82 |
+
* Privacy Functions
|
83 |
+
*/
|
84 |
+
function bp_em_group_events_build_sql_conditions( $conditions, $args ){
|
85 |
+
if( !empty($args['group']) && is_numeric($args['group']) ){
|
86 |
+
$conditions['group'] = "( `group_id`={$args['group']} )";
|
87 |
+
}elseif( !empty($args['group']) && $args['group'] == 'my' ){
|
88 |
+
$groups = groups_get_user_groups(get_current_user_id());
|
89 |
+
if( count($groups) > 0 ){
|
90 |
+
$conditions['group'] = "( `group_id` IN (".implode(',',$groups['groups']).") )";
|
91 |
+
}
|
92 |
+
}
|
93 |
+
//deal with private groups and events
|
94 |
+
if( is_user_logged_in() ){
|
95 |
+
global $wpdb;
|
96 |
+
//find out what private groups they belong to, and don't show private group events not in their memberships
|
97 |
+
$group_ids = BP_Groups_Member::get_group_ids(get_current_user_id());
|
98 |
+
if( $group_ids['total'] > 0){
|
99 |
+
$conditions['group_privacy'] = "(`event_private`=0 OR (`event_private`=1 AND (`group_id` IS NULL OR `group_id` = 0)) OR (`event_private`=1 AND `group_id` IN (".implode(',',$group_ids['groups']).")))";
|
100 |
+
}else{
|
101 |
+
//find out what private groups they belong to, and don't show private group events not in their memberships
|
102 |
+
$conditions['group_privacy'] = "(`event_private`=0 OR (`event_private`=1 AND (`group_id` IS NULL OR `group_id` = 0)))";
|
103 |
+
}
|
104 |
+
}
|
105 |
+
return $conditions;
|
106 |
+
}
|
107 |
+
add_filter('em_events_build_sql_conditions','bp_em_group_events_build_sql_conditions',1,2);
|
108 |
+
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Checks if the event is private and either belongs to a group or private group, as members of that group should be able to see the post even if not able to see private events.
|
112 |
+
* @param string $template
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
function bp_em_private_event_check($template){
|
116 |
+
global $post, $wpdb, $wp_query, $bp;
|
117 |
+
if( $post->post_type == EM_POST_TYPE_EVENT ){
|
118 |
+
$EM_Event = em_get_event($post);
|
119 |
+
//echo "<pre>"; print_r($EM_Event); echo "</pre>"; die();
|
120 |
+
if( !empty($EM_Event->event_private) && !empty($EM_Event->group_id) ){
|
121 |
+
if( is_user_logged_in() ){
|
122 |
+
//make sure user is a member of this group, whether private or not, private groups just aren't shown to non-members of a group
|
123 |
+
$id_lookup = $wpdb->get_var( $wpdb->prepare( "SELECT m.group_id FROM {$bp->groups->table_name_members} m WHERE m.group_id = %s AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $EM_Event->group_id, get_current_user_id() ) );
|
124 |
+
if($id_lookup != $EM_Event->group_id){
|
125 |
+
unset($post);
|
126 |
+
$wp_query->set_404();
|
127 |
+
$template = locate_template(array('404.php'),false);
|
128 |
+
}
|
129 |
+
}else{
|
130 |
+
unset($post);
|
131 |
+
$wp_query->set_404();
|
132 |
+
$template = locate_template(array('404.php'),false);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
return $template;
|
137 |
+
}
|
138 |
+
add_filter('single_template','bp_em_private_event_check',20);
|
139 |
+
|
140 |
+
/*
|
141 |
+
* Admin Meta Boxes
|
142 |
+
*/
|
143 |
+
function bp_em_meta_boxes(){
|
144 |
+
add_meta_box('em-event-group', __('Group Ownership','dbem'), 'bp_em_meta_box_group',EM_POST_TYPE_EVENT, 'side','low');
|
145 |
+
add_meta_box('em-event-group', __('Group Ownership','dbem'), 'bp_em_meta_box_group','event-recurring', 'side','low');
|
146 |
+
}
|
147 |
+
add_action('add_meta_boxes', 'bp_em_meta_boxes');
|
148 |
+
|
149 |
+
function bp_em_meta_box_group(){
|
150 |
+
em_locate_template('forms/event/group.php',true);
|
151 |
}
|
buddypress/bp-em-notifications.php
CHANGED
@@ -54,7 +54,11 @@ function bp_em_format_notifications( $action, $item_id, $secondary_item_id, $tot
|
|
54 |
*/
|
55 |
function bp_em_remove_screen_notifications() {
|
56 |
global $bp;
|
57 |
-
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
add_action( 'bp_em_my_events', 'bp_em_remove_screen_notifications' );
|
60 |
add_action( 'xprofile_screen_display_profile', 'bp_em_remove_screen_notifications' );
|
@@ -74,8 +78,14 @@ function bp_em_add_booking_notification($result, $EM_Booking){
|
|
74 |
}elseif( $EM_Booking->get_status() == 3 ){
|
75 |
$action = 'cancelled_booking';
|
76 |
}
|
77 |
-
if( !empty($action) ){
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
return $result;
|
81 |
}
|
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' );
|
64 |
add_action( 'xprofile_screen_display_profile', 'bp_em_remove_screen_notifications' );
|
78 |
}elseif( $EM_Booking->get_status() == 3 ){
|
79 |
$action = 'cancelled_booking';
|
80 |
}
|
81 |
+
if( !empty($action) && !(get_option('dbem_bookings_registration_disable') && get_option('dbem_bookings_registration_user') == $EM_Booking->get_event()->get_contact()->ID) ){
|
82 |
+
bp_notifications_add_notification( array(
|
83 |
+
'item_id' => $EM_Booking->booking_id,
|
84 |
+
'secondary_item_id' => $EM_Booking->event_id,
|
85 |
+
'user_id' => $EM_Booking->get_event()->get_contact()->ID,
|
86 |
+
'component_name' => 'events',
|
87 |
+
'component_action' => $action
|
88 |
+
));
|
89 |
}
|
90 |
return $result;
|
91 |
}
|
buddypress/screens/attending.php
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* bp_em_screen_two()
|
4 |
-
*
|
5 |
-
* Sets up and displays the screen output for the sub nav item "em/screen-two"
|
6 |
-
*/
|
7 |
-
function bp_em_attending() {
|
8 |
-
global $bp;
|
9 |
-
/**
|
10 |
-
* If the user has not Accepted or Rejected anything, then the code above will not run,
|
11 |
-
* we can continue and load the template.
|
12 |
-
*/
|
13 |
-
do_action( 'bp_em_attending' );
|
14 |
-
|
15 |
-
add_action( 'bp_template_title', 'bp_em_attending_title' );
|
16 |
-
add_action( 'bp_template_content', 'bp_em_attending_content' );
|
17 |
-
|
18 |
-
/* Finally load the plugin template file. */
|
19 |
-
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
20 |
-
}
|
21 |
-
|
22 |
-
function bp_em_attending_title() {
|
23 |
-
_e( 'Events I\'m Attending', 'dbem' );
|
24 |
-
}
|
25 |
-
|
26 |
-
function bp_em_attending_content() {
|
27 |
-
//We can use the same template as the public user interface for non bp sites
|
28 |
-
em_my_bookings();
|
29 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* bp_em_screen_two()
|
4 |
+
*
|
5 |
+
* Sets up and displays the screen output for the sub nav item "em/screen-two"
|
6 |
+
*/
|
7 |
+
function bp_em_attending() {
|
8 |
+
global $bp;
|
9 |
+
/**
|
10 |
+
* If the user has not Accepted or Rejected anything, then the code above will not run,
|
11 |
+
* we can continue and load the template.
|
12 |
+
*/
|
13 |
+
do_action( 'bp_em_attending' );
|
14 |
+
|
15 |
+
add_action( 'bp_template_title', 'bp_em_attending_title' );
|
16 |
+
add_action( 'bp_template_content', 'bp_em_attending_content' );
|
17 |
+
|
18 |
+
/* Finally load the plugin template file. */
|
19 |
+
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
function bp_em_attending_title() {
|
23 |
+
_e( 'Events I\'m Attending', 'dbem' );
|
24 |
+
}
|
25 |
+
|
26 |
+
function bp_em_attending_content() {
|
27 |
+
//We can use the same template as the public user interface for non bp sites
|
28 |
+
em_my_bookings();
|
29 |
}
|
buddypress/screens/group-events.php
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Controller for the event views in BP (using mvc terms here)
|
4 |
-
*/
|
5 |
-
function bp_em_group_events() {
|
6 |
-
global $bp;
|
7 |
-
do_action( 'bp_em_group_events' );
|
8 |
-
|
9 |
-
//plug into EM admin code (at least for now)
|
10 |
-
include_once(EM_DIR.'/admin/em-admin.php');
|
11 |
-
|
12 |
-
add_action( 'bp_template_title', 'bp_em_group_events_title' );
|
13 |
-
add_action( 'bp_template_content', 'bp_em_group_events_content' );
|
14 |
-
|
15 |
-
/* Finally load the plugin template file. */
|
16 |
-
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/single/plugins' ) );
|
17 |
-
}
|
18 |
-
|
19 |
-
function bp_em_group_events_title() {
|
20 |
-
_e( 'Group Events', 'dbem' );
|
21 |
-
}
|
22 |
-
/**
|
23 |
-
* Determines whether to show event page or events page, and saves any updates to the event or events
|
24 |
-
* @return null
|
25 |
-
*/
|
26 |
-
function bp_em_group_events_content() {
|
27 |
-
em_locate_template('buddypress/group-events.php', true);
|
28 |
-
}
|
29 |
-
|
30 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Controller for the event views in BP (using mvc terms here)
|
4 |
+
*/
|
5 |
+
function bp_em_group_events() {
|
6 |
+
global $bp;
|
7 |
+
do_action( 'bp_em_group_events' );
|
8 |
+
|
9 |
+
//plug into EM admin code (at least for now)
|
10 |
+
include_once(EM_DIR.'/admin/em-admin.php');
|
11 |
+
|
12 |
+
add_action( 'bp_template_title', 'bp_em_group_events_title' );
|
13 |
+
add_action( 'bp_template_content', 'bp_em_group_events_content' );
|
14 |
+
|
15 |
+
/* Finally load the plugin template file. */
|
16 |
+
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/single/plugins' ) );
|
17 |
+
}
|
18 |
+
|
19 |
+
function bp_em_group_events_title() {
|
20 |
+
_e( 'Group Events', 'dbem' );
|
21 |
+
}
|
22 |
+
/**
|
23 |
+
* Determines whether to show event page or events page, and saves any updates to the event or events
|
24 |
+
* @return null
|
25 |
+
*/
|
26 |
+
function bp_em_group_events_content() {
|
27 |
+
em_locate_template('buddypress/group-events.php', true);
|
28 |
+
}
|
29 |
+
|
30 |
?>
|
buddypress/screens/my-bookings.php
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* bp_em_screen_two()
|
4 |
-
*
|
5 |
-
* Sets up and displays the screen output for the sub nav item "em/screen-two"
|
6 |
-
*/
|
7 |
-
function bp_em_my_bookings() {
|
8 |
-
global $bp, $EM_Event;
|
9 |
-
|
10 |
-
//assume any notifications here are considered viewed via this page
|
11 |
-
if( function_exists('bp_notifications_delete_notifications_by_type') ){
|
12 |
-
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','pending_booking');
|
13 |
-
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','confirmed_booking');
|
14 |
-
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','cancelled_booking');
|
15 |
-
}else{
|
16 |
-
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','pending_booking');
|
17 |
-
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','confirmed_booking');
|
18 |
-
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','cancelled_booking');
|
19 |
-
}
|
20 |
-
|
21 |
-
em_load_event();
|
22 |
-
/**
|
23 |
-
* If the user has not Accepted or Rejected anything, then the code above will not run,
|
24 |
-
* we can continue and load the template.
|
25 |
-
*/
|
26 |
-
do_action( 'bp_em_my_bookings' );
|
27 |
-
|
28 |
-
add_action( 'bp_template_title', 'bp_em_my_bookings_title' );
|
29 |
-
add_action( 'bp_template_content', 'bp_em_my_bookings_content' );
|
30 |
-
|
31 |
-
/* Finally load the plugin template file. */
|
32 |
-
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
33 |
-
}
|
34 |
-
|
35 |
-
function bp_em_my_bookings_title() {
|
36 |
-
_e( 'My Event Bookings', 'dbem' );
|
37 |
-
}
|
38 |
-
|
39 |
-
function bp_em_my_bookings_content() {
|
40 |
-
em_locate_template('buddypress/my-bookings.php',true);
|
41 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* bp_em_screen_two()
|
4 |
+
*
|
5 |
+
* Sets up and displays the screen output for the sub nav item "em/screen-two"
|
6 |
+
*/
|
7 |
+
function bp_em_my_bookings() {
|
8 |
+
global $bp, $EM_Event;
|
9 |
+
|
10 |
+
//assume any notifications here are considered viewed via this page
|
11 |
+
if( function_exists('bp_notifications_delete_notifications_by_type') ){
|
12 |
+
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','pending_booking');
|
13 |
+
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','confirmed_booking');
|
14 |
+
bp_notifications_delete_notifications_by_type(get_current_user_id(), 'events','cancelled_booking');
|
15 |
+
}else{
|
16 |
+
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','pending_booking');
|
17 |
+
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','confirmed_booking');
|
18 |
+
bp_core_delete_notifications_by_type(get_current_user_id(), 'events','cancelled_booking');
|
19 |
+
}
|
20 |
+
|
21 |
+
em_load_event();
|
22 |
+
/**
|
23 |
+
* If the user has not Accepted or Rejected anything, then the code above will not run,
|
24 |
+
* we can continue and load the template.
|
25 |
+
*/
|
26 |
+
do_action( 'bp_em_my_bookings' );
|
27 |
+
|
28 |
+
add_action( 'bp_template_title', 'bp_em_my_bookings_title' );
|
29 |
+
add_action( 'bp_template_content', 'bp_em_my_bookings_content' );
|
30 |
+
|
31 |
+
/* Finally load the plugin template file. */
|
32 |
+
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
function bp_em_my_bookings_title() {
|
36 |
+
_e( 'My Event Bookings', 'dbem' );
|
37 |
+
}
|
38 |
+
|
39 |
+
function bp_em_my_bookings_content() {
|
40 |
+
em_locate_template('buddypress/my-bookings.php',true);
|
41 |
}
|
buddypress/screens/my-events.php
CHANGED
@@ -1,55 +1,55 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Controller for the event views in BP (using mvc terms here)
|
4 |
-
*/
|
5 |
-
function bp_em_my_events() {
|
6 |
-
global $bp, $EM_Event;
|
7 |
-
if( !is_object($EM_Event) && !empty($_REQUEST['event_id']) ){
|
8 |
-
$EM_Event = new EM_Event($_REQUEST['event_id']);
|
9 |
-
}
|
10 |
-
|
11 |
-
do_action( 'bp_em_my_events' );
|
12 |
-
|
13 |
-
$template_title = 'bp_em_my_events_title';
|
14 |
-
$template_content = 'bp_em_my_events_content';
|
15 |
-
|
16 |
-
if( !empty($_GET['action']) ){
|
17 |
-
switch($_GET['action']){
|
18 |
-
case 'edit':
|
19 |
-
$template_title = 'bp_em_my_events_editor_title';
|
20 |
-
break;
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
add_action( 'bp_template_title', $template_title );
|
25 |
-
add_action( 'bp_template_content', $template_content );
|
26 |
-
|
27 |
-
/* Finally load the plugin template file. */
|
28 |
-
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
29 |
-
}
|
30 |
-
|
31 |
-
function bp_em_my_events_title() {
|
32 |
-
_e( 'My Events', 'dbem' );
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Determines whether to show event page or events page, and saves any updates to the event or events
|
37 |
-
* @return null
|
38 |
-
*/
|
39 |
-
function bp_em_my_events_content() {
|
40 |
-
em_locate_template('buddypress/my-events.php', true);
|
41 |
-
}
|
42 |
-
|
43 |
-
function bp_em_my_events_editor_title() {
|
44 |
-
global $EM_Event;
|
45 |
-
if( is_object($EM_Event) ){
|
46 |
-
if($EM_Event->is_recurring()){
|
47 |
-
echo __( "Reschedule Events", 'dbem' )." '{$EM_Event->event_name}'";
|
48 |
-
}else{
|
49 |
-
echo __( "Edit Event", 'dbem' ) . " '" . $EM_Event->event_name . "'";
|
50 |
-
}
|
51 |
-
}else{
|
52 |
-
_e( 'Add Event', 'dbem' );
|
53 |
-
}
|
54 |
-
}
|
55 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Controller for the event views in BP (using mvc terms here)
|
4 |
+
*/
|
5 |
+
function bp_em_my_events() {
|
6 |
+
global $bp, $EM_Event;
|
7 |
+
if( !is_object($EM_Event) && !empty($_REQUEST['event_id']) ){
|
8 |
+
$EM_Event = new EM_Event($_REQUEST['event_id']);
|
9 |
+
}
|
10 |
+
|
11 |
+
do_action( 'bp_em_my_events' );
|
12 |
+
|
13 |
+
$template_title = 'bp_em_my_events_title';
|
14 |
+
$template_content = 'bp_em_my_events_content';
|
15 |
+
|
16 |
+
if( !empty($_GET['action']) ){
|
17 |
+
switch($_GET['action']){
|
18 |
+
case 'edit':
|
19 |
+
$template_title = 'bp_em_my_events_editor_title';
|
20 |
+
break;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
add_action( 'bp_template_title', $template_title );
|
25 |
+
add_action( 'bp_template_content', $template_content );
|
26 |
+
|
27 |
+
/* Finally load the plugin template file. */
|
28 |
+
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
function bp_em_my_events_title() {
|
32 |
+
_e( 'My Events', 'dbem' );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Determines whether to show event page or events page, and saves any updates to the event or events
|
37 |
+
* @return null
|
38 |
+
*/
|
39 |
+
function bp_em_my_events_content() {
|
40 |
+
em_locate_template('buddypress/my-events.php', true);
|
41 |
+
}
|
42 |
+
|
43 |
+
function bp_em_my_events_editor_title() {
|
44 |
+
global $EM_Event;
|
45 |
+
if( is_object($EM_Event) ){
|
46 |
+
if($EM_Event->is_recurring()){
|
47 |
+
echo __( "Reschedule Events", 'dbem' )." '{$EM_Event->event_name}'";
|
48 |
+
}else{
|
49 |
+
echo __( "Edit Event", 'dbem' ) . " '" . $EM_Event->event_name . "'";
|
50 |
+
}
|
51 |
+
}else{
|
52 |
+
_e( 'Add Event', 'dbem' );
|
53 |
+
}
|
54 |
+
}
|
55 |
?>
|
buddypress/screens/my-group-events.php
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Controller for the event views in BP (using mvc terms here)
|
4 |
-
*/
|
5 |
-
function bp_em_my_group_events() {
|
6 |
-
global $bp;
|
7 |
-
do_action( 'bp_em_my_group_events' );
|
8 |
-
|
9 |
-
//plug into EM admin code (at least for now)
|
10 |
-
include_once(EM_DIR.'/admin/em-admin.php');
|
11 |
-
|
12 |
-
add_action( 'bp_template_title', 'bp_em_my_group_events_title' );
|
13 |
-
add_action( 'bp_template_content', 'bp_em_my_group_events_content' );
|
14 |
-
|
15 |
-
/* Finally load the plugin template file. */
|
16 |
-
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
17 |
-
}
|
18 |
-
|
19 |
-
function bp_em_my_group_events_title() {
|
20 |
-
_e( 'Group Events', 'dbem' );
|
21 |
-
}
|
22 |
-
|
23 |
-
function bp_em_my_group_events_content(){
|
24 |
-
em_locate_template('buddypress/my-group-events.php', true);
|
25 |
-
}
|
26 |
-
|
27 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Controller for the event views in BP (using mvc terms here)
|
4 |
+
*/
|
5 |
+
function bp_em_my_group_events() {
|
6 |
+
global $bp;
|
7 |
+
do_action( 'bp_em_my_group_events' );
|
8 |
+
|
9 |
+
//plug into EM admin code (at least for now)
|
10 |
+
include_once(EM_DIR.'/admin/em-admin.php');
|
11 |
+
|
12 |
+
add_action( 'bp_template_title', 'bp_em_my_group_events_title' );
|
13 |
+
add_action( 'bp_template_content', 'bp_em_my_group_events_content' );
|
14 |
+
|
15 |
+
/* Finally load the plugin template file. */
|
16 |
+
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
17 |
+
}
|
18 |
+
|
19 |
+
function bp_em_my_group_events_title() {
|
20 |
+
_e( 'Group Events', 'dbem' );
|
21 |
+
}
|
22 |
+
|
23 |
+
function bp_em_my_group_events_content(){
|
24 |
+
em_locate_template('buddypress/my-group-events.php', true);
|
25 |
+
}
|
26 |
+
|
27 |
?>
|
buddypress/screens/my-locations.php
CHANGED
@@ -1,51 +1,51 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Controller for the location views in BP (using mvc terms here)
|
4 |
-
*/
|
5 |
-
function bp_em_my_locations() {
|
6 |
-
global $bp, $EM_Location;
|
7 |
-
if( !is_object($EM_Location) && !empty($_REQUEST['location_id']) ){
|
8 |
-
$EM_Location = new EM_Location($_REQUEST['location_id']);
|
9 |
-
}
|
10 |
-
|
11 |
-
do_action( 'bp_em_my_locations' );
|
12 |
-
|
13 |
-
$template_title = 'bp_em_my_locations_title';
|
14 |
-
$template_content = 'bp_em_my_locations_content';
|
15 |
-
|
16 |
-
if( !empty($_GET['action']) ){
|
17 |
-
switch($_GET['action']){
|
18 |
-
case 'edit':
|
19 |
-
$template_title = 'bp_em_my_locations_editor_title';
|
20 |
-
break;
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
add_action( 'bp_template_title', $template_title );
|
25 |
-
add_action( 'bp_template_content', $template_content );
|
26 |
-
|
27 |
-
/* Finally load the plugin template file. */
|
28 |
-
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
29 |
-
}
|
30 |
-
|
31 |
-
function bp_em_my_locations_title() {
|
32 |
-
_e( 'My Locations', 'dbem' );
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Determines whether to show location page or locations page, and saves any updates to the location or locations
|
37 |
-
* @return null
|
38 |
-
*/
|
39 |
-
function bp_em_my_locations_content() {
|
40 |
-
em_locate_template('buddypress/my-locations.php', true);
|
41 |
-
}
|
42 |
-
|
43 |
-
function bp_em_my_locations_editor_title() {
|
44 |
-
global $EM_Location;
|
45 |
-
if( empty($EM_Location) || !is_object($EM_Location) ){
|
46 |
-
$title = __('Add Location', 'dbem');
|
47 |
-
}else{
|
48 |
-
$title = __('Edit Location', 'dbem');
|
49 |
-
}
|
50 |
-
}
|
51 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Controller for the location views in BP (using mvc terms here)
|
4 |
+
*/
|
5 |
+
function bp_em_my_locations() {
|
6 |
+
global $bp, $EM_Location;
|
7 |
+
if( !is_object($EM_Location) && !empty($_REQUEST['location_id']) ){
|
8 |
+
$EM_Location = new EM_Location($_REQUEST['location_id']);
|
9 |
+
}
|
10 |
+
|
11 |
+
do_action( 'bp_em_my_locations' );
|
12 |
+
|
13 |
+
$template_title = 'bp_em_my_locations_title';
|
14 |
+
$template_content = 'bp_em_my_locations_content';
|
15 |
+
|
16 |
+
if( !empty($_GET['action']) ){
|
17 |
+
switch($_GET['action']){
|
18 |
+
case 'edit':
|
19 |
+
$template_title = 'bp_em_my_locations_editor_title';
|
20 |
+
break;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
add_action( 'bp_template_title', $template_title );
|
25 |
+
add_action( 'bp_template_content', $template_content );
|
26 |
+
|
27 |
+
/* Finally load the plugin template file. */
|
28 |
+
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
function bp_em_my_locations_title() {
|
32 |
+
_e( 'My Locations', 'dbem' );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Determines whether to show location page or locations page, and saves any updates to the location or locations
|
37 |
+
* @return null
|
38 |
+
*/
|
39 |
+
function bp_em_my_locations_content() {
|
40 |
+
em_locate_template('buddypress/my-locations.php', true);
|
41 |
+
}
|
42 |
+
|
43 |
+
function bp_em_my_locations_editor_title() {
|
44 |
+
global $EM_Location;
|
45 |
+
if( empty($EM_Location) || !is_object($EM_Location) ){
|
46 |
+
$title = __('Add Location', 'dbem');
|
47 |
+
}else{
|
48 |
+
$title = __('Edit Location', 'dbem');
|
49 |
+
}
|
50 |
+
}
|
51 |
?>
|
buddypress/screens/profile.php
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* bp_em_screen_one()
|
4 |
-
*
|
5 |
-
* Sets up and displays the screen output for the sub nav item "em/screen-one"
|
6 |
-
*/
|
7 |
-
function bp_em_events() {
|
8 |
-
global $bp, $EM_Notices;
|
9 |
-
|
10 |
-
if( bp_is_my_profile() ){
|
11 |
-
$EM_Notices->add_info( __('You are currently viewing your public page, this is what other users will see.', 'dbem') );
|
12 |
-
}
|
13 |
-
|
14 |
-
/* Add a do action here, so your component can be extended by others. */
|
15 |
-
do_action( 'bp_em_events' );
|
16 |
-
|
17 |
-
add_action( 'bp_template_title', 'bp_em_events_title' );
|
18 |
-
add_action( 'bp_template_content', 'bp_em_events_content' );
|
19 |
-
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
20 |
-
//bp_core_load_template( apply_filters( 'bp_em_template_screen_one', 'em/screen-one' ) );
|
21 |
-
}
|
22 |
-
/***
|
23 |
-
* The second argument of each of the above add_action() calls is a function that will
|
24 |
-
* display the corresponding information. The functions are presented below:
|
25 |
-
*/
|
26 |
-
function bp_em_events_title() {
|
27 |
-
_e( 'Events', 'dbem' );
|
28 |
-
}
|
29 |
-
|
30 |
-
function bp_em_events_content() {
|
31 |
-
em_locate_template('buddypress/profile.php',true);
|
32 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* bp_em_screen_one()
|
4 |
+
*
|
5 |
+
* Sets up and displays the screen output for the sub nav item "em/screen-one"
|
6 |
+
*/
|
7 |
+
function bp_em_events() {
|
8 |
+
global $bp, $EM_Notices;
|
9 |
+
|
10 |
+
if( bp_is_my_profile() ){
|
11 |
+
$EM_Notices->add_info( __('You are currently viewing your public page, this is what other users will see.', 'dbem') );
|
12 |
+
}
|
13 |
+
|
14 |
+
/* Add a do action here, so your component can be extended by others. */
|
15 |
+
do_action( 'bp_em_events' );
|
16 |
+
|
17 |
+
add_action( 'bp_template_title', 'bp_em_events_title' );
|
18 |
+
add_action( 'bp_template_content', 'bp_em_events_content' );
|
19 |
+
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
|
20 |
+
//bp_core_load_template( apply_filters( 'bp_em_template_screen_one', 'em/screen-one' ) );
|
21 |
+
}
|
22 |
+
/***
|
23 |
+
* The second argument of each of the above add_action() calls is a function that will
|
24 |
+
* display the corresponding information. The functions are presented below:
|
25 |
+
*/
|
26 |
+
function bp_em_events_title() {
|
27 |
+
_e( 'Events', 'dbem' );
|
28 |
+
}
|
29 |
+
|
30 |
+
function bp_em_events_content() {
|
31 |
+
em_locate_template('buddypress/profile.php',true);
|
32 |
}
|
classes/em-booking.php
CHANGED
@@ -1,1101 +1,1097 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* gets a booking in a more db-friendly manner, allows hooking into booking object right after instantiation
|
4 |
-
* @param mixed $id
|
5 |
-
* @param mixed $search_by
|
6 |
-
* @return EM_Booking
|
7 |
-
*/
|
8 |
-
function em_get_booking($id = false) {
|
9 |
-
global $EM_Booking;
|
10 |
-
//check if it's not already global so we don't instantiate again
|
11 |
-
if( is_object($EM_Booking) && get_class($EM_Booking) == 'EM_Booking' ){
|
12 |
-
if( is_object($id) && $EM_Booking->booking_id == $id->booking_id ){
|
13 |
-
return apply_filters('em_get_booking', $EM_Booking);
|
14 |
-
}else{
|
15 |
-
if( is_numeric($id) && $EM_Booking->booking_id == $id ){
|
16 |
-
return apply_filters('em_get_booking', $EM_Booking);
|
17 |
-
}elseif( is_array($id) && !empty($id['booking_id']) && $EM_Booking->booking_id == $id['booking_id'] ){
|
18 |
-
return apply_filters('em_get_booking', $EM_Booking);
|
19 |
-
}
|
20 |
-
}
|
21 |
-
}
|
22 |
-
if( is_object($id) && get_class($id) == 'EM_Booking' ){
|
23 |
-
return apply_filters('em_get_booking', $id);
|
24 |
-
}else{
|
25 |
-
return apply_filters('em_get_booking', new EM_Booking($id));
|
26 |
-
}
|
27 |
-
}
|
28 |
-
/**
|
29 |
-
* Contains all information and relevant functions surrounding a single booking made with Events Manager
|
30 |
-
*/
|
31 |
-
class EM_Booking extends EM_Object{
|
32 |
-
//DB Fields
|
33 |
-
var $booking_id;
|
34 |
-
var $event_id;
|
35 |
-
var $person_id;
|
36 |
-
var $booking_price = null;
|
37 |
-
var $booking_spaces;
|
38 |
-
var $booking_comment;
|
39 |
-
var $booking_status = false;
|
40 |
-
var $booking_tax_rate = null;
|
41 |
-
var $booking_taxes = null;
|
42 |
-
var $booking_meta = array();
|
43 |
-
var $fields = array(
|
44 |
-
'booking_id' => array('name'=>'id','type'=>'%d'),
|
45 |
-
'event_id' => array('name'=>'event_id','type'=>'%d'),
|
46 |
-
'person_id' => array('name'=>'person_id','type'=>'%d'),
|
47 |
-
'booking_price' => array('name'=>'price','type'=>'%f'),
|
48 |
-
'booking_spaces' => array('name'=>'spaces','type'=>'%d'),
|
49 |
-
'booking_comment' => array('name'=>'comment','type'=>'%s'),
|
50 |
-
'booking_status' => array('name'=>'status','type'=>'%d'),
|
51 |
-
'booking_tax_rate' => array('name'=>'tax_rate','type'=>'%f','null'=>1),
|
52 |
-
'booking_taxes' => array('name'=>'taxes','type'=>'%f','null'=>1),
|
53 |
-
'booking_meta' => array('name'=>'meta','type'=>'%s')
|
54 |
-
);
|
55 |
-
//Other Vars
|
56 |
-
/**
|
57 |
-
* array of notes by admins on this booking. loaded from em_meta table in construct
|
58 |
-
* @var array
|
59 |
-
*/
|
60 |
-
var $notes;
|
61 |
-
var $timestamp;
|
62 |
-
var $person;
|
63 |
-
var $required_fields = array('booking_id', 'event_id', 'person_id', 'booking_spaces');
|
64 |
-
var $feedback_message = "";
|
65 |
-
var $errors = array();
|
66 |
-
/**
|
67 |
-
* when using EM_Booking::email_send(), this number is updated with sent emails
|
68 |
-
* @var int
|
69 |
-
*/
|
70 |
-
var $mails_sent = 0;
|
71 |
-
/**
|
72 |
-
* Contains an array of custom fields for a booking. This is loaded from em_meta, where the booking_custom name contains arrays of data.
|
73 |
-
* @var array
|
74 |
-
*/
|
75 |
-
var $custom = array();
|
76 |
-
/**
|
77 |
-
* If saved in this instance, you can see what previous approval status was.
|
78 |
-
* @var int
|
79 |
-
*/
|
80 |
-
var $previous_status = false;
|
81 |
-
/**
|
82 |
-
* The booking approval status number corresponds to a state in this array.
|
83 |
-
* @var unknown_type
|
84 |
-
*/
|
85 |
-
var $status_array = array();
|
86 |
-
/**
|
87 |
-
* @var EM_Tickets
|
88 |
-
*/
|
89 |
-
var $tickets;
|
90 |
-
/**
|
91 |
-
* @var EM_Event
|
92 |
-
*/
|
93 |
-
var $event;
|
94 |
-
/**
|
95 |
-
* @var EM_Tickets_Bookings
|
96 |
-
*/
|
97 |
-
var $tickets_bookings;
|
98 |
-
/**
|
99 |
-
* If set to true, this booking can be managed by any logged in user.
|
100 |
-
* @var EM_Tickets_Bookings
|
101 |
-
*/
|
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 |
-
*/
|
109 |
-
function
|
110 |
-
//Get the person for this booking
|
111 |
-
global $wpdb;
|
112 |
-
if( $booking_data !== false ){
|
113 |
-
//Load booking data
|
114 |
-
$booking = array();
|
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 |
-
}
|
122 |
-
//booking meta
|
123 |
-
$booking['booking_meta'] = (!empty($booking['booking_meta'])) ? maybe_unserialize($booking['booking_meta']):array();
|
124 |
-
//Save into the object
|
125 |
-
$this->to_object($booking);
|
126 |
-
$this->previous_status = $this->booking_status;
|
127 |
-
$this->get_person();
|
128 |
-
$this->timestamp = !empty($booking['booking_date']) ? strtotime($booking['booking_date'], current_time('timestamp')):false;
|
129 |
-
}
|
130 |
-
//Do it here so things appear in the po file.
|
131 |
-
$this->status_array = array(
|
132 |
-
0 => __('Pending','dbem'),
|
133 |
-
1 => __('Approved','dbem'),
|
134 |
-
2 => __('Rejected','dbem'),
|
135 |
-
3 => __('Cancelled','dbem'),
|
136 |
-
4 => __('Awaiting Online Payment','dbem'),
|
137 |
-
5 => __('Awaiting Payment','dbem')
|
138 |
-
);
|
139 |
-
$this->compat_keys(); //depricating in 6.0
|
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);
|
147 |
-
}
|
148 |
-
|
149 |
-
function get_notes(){
|
150 |
-
global $wpdb;
|
151 |
-
if( !is_array($this->notes) && !empty($this->booking_id) ){
|
152 |
-
$notes = $wpdb->get_results("SELECT * FROM ". EM_META_TABLE ." WHERE meta_key='booking-note' AND object_id ='{$this->booking_id}'", ARRAY_A);
|
153 |
-
$this->notes = array();
|
154 |
-
foreach($notes as $note){
|
155 |
-
$this->notes[] = unserialize($note['meta_value']);
|
156 |
-
}
|
157 |
-
}elseif( empty($this->booking_id) ){
|
158 |
-
$this->notes = array();
|
159 |
-
}
|
160 |
-
return $this->notes;
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Saves the booking into the database, whether a new or existing booking
|
165 |
-
* @param $mail whether or not to email the user and contact people
|
166 |
-
* @return boolean
|
167 |
-
*/
|
168 |
-
function save($mail = true){
|
169 |
-
global $wpdb;
|
170 |
-
$table = EM_BOOKINGS_TABLE;
|
171 |
-
do_action('em_booking_save_pre',$this);
|
172 |
-
if( $this->can_manage() ){
|
173 |
-
//update prices, spaces, person_id
|
174 |
-
$this->get_spaces(true);
|
175 |
-
$this->calculate_price();
|
176 |
-
$this->person_id = (empty($this->person_id)) ? $this->get_person()->ID : $this->person_id;
|
177 |
-
//Step 1. Save the booking
|
178 |
-
$data = $this->to_array();
|
179 |
-
$data['booking_meta'] = serialize($data['booking_meta']);
|
180 |
-
//update or save
|
181 |
-
if($this->booking_id != ''){
|
182 |
-
$update = true;
|
183 |
-
$where = array( 'booking_id' => $this->booking_id );
|
184 |
-
$result = $wpdb->update($table, $data, $where, $this->get_types($data));
|
185 |
-
$result = ($result !== false);
|
186 |
-
$this->feedback_message = __('Changes saved','dbem');
|
187 |
-
}else{
|
188 |
-
$update = false;
|
189 |
-
$data_types = $this->get_types($data);
|
190 |
-
$data['booking_date'] = current_time('mysql');
|
191 |
-
$data_types[] = '%s';
|
192 |
-
$result = $wpdb->insert($table, $data, $data_types);
|
193 |
-
$this->booking_id = $wpdb->insert_id;
|
194 |
-
$this->feedback_message = __('Your booking has been recorded','dbem');
|
195 |
-
}
|
196 |
-
//Step 2. Insert ticket bookings for this booking id if no errors so far
|
197 |
-
if( $result === false ){
|
198 |
-
$this->feedback_message = __('There was a problem saving the booking.', 'dbem');
|
199 |
-
$this->errors[] = __('There was a problem saving the booking.', 'dbem');
|
200 |
-
}else{
|
201 |
-
$tickets_bookings_result = $this->get_tickets_bookings()->save();
|
202 |
-
if( !$tickets_bookings_result ){
|
203 |
-
if( !$update ){
|
204 |
-
//delete the booking and tickets, instead of a transaction
|
205 |
-
$this->delete();
|
206 |
-
}
|
207 |
-
$this->errors[] = __('There was a problem saving the booking.', 'dbem');
|
208 |
-
$this->add_error( $this->get_tickets_bookings()->get_errors() );
|
209 |
-
}
|
210 |
-
}
|
211 |
-
//Step 3. email if necessary
|
212 |
-
if ( count($this->errors) == 0 && $mail ) {
|
213 |
-
$this->email();
|
214 |
-
}
|
215 |
-
$this->compat_keys();
|
216 |
-
return apply_filters('em_booking_save', ( count($this->errors) == 0 ), $this);
|
217 |
-
}else{
|
218 |
-
$this->feedback_message = __('There was a problem saving the booking.', 'dbem');
|
219 |
-
if( !$this->can_manage() ){
|
220 |
-
$this->add_error(sprintf(__('You cannot manage this %s.', 'dbem'),__('Booking','dbem')));
|
221 |
-
}
|
222 |
-
}
|
223 |
-
return apply_filters('em_booking_save', false, $this);
|
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
|
231 |
-
*/
|
232 |
-
function get($search) {
|
233 |
-
global $wpdb;
|
234 |
-
$conds = array();
|
235 |
-
foreach($search as $key => $value) {
|
236 |
-
if( array_key_exists($key, $this->fields) ){
|
237 |
-
$value = esc_sql($value);
|
238 |
-
$conds[] = "`$key`='$value'";
|
239 |
-
}
|
240 |
-
}
|
241 |
-
$sql = "SELECT * FROM ". $wpdb->EM_BOOKINGS_TABLE ." WHERE " . implode(' AND ', $conds) ;
|
242 |
-
$result = $wpdb->get_row($sql, ARRAY_A);
|
243 |
-
if($result){
|
244 |
-
$this->to_object($result);
|
245 |
-
$this->person = new EM_Person($this->person_id);
|
246 |
-
return true;
|
247 |
-
}else{
|
248 |
-
return false;
|
249 |
-
}
|
250 |
-
}
|
251 |
-
|
252 |
-
/**
|
253 |
-
* Get posted data and save it into the object (not db)
|
254 |
-
* @return boolean
|
255 |
-
*/
|
256 |
-
function get_post( $override_availability = false ){
|
257 |
-
$this->tickets_bookings = new EM_Tickets_Bookings($this->booking_id);
|
258 |
-
do_action('em_booking_get_post_pre',$this);
|
259 |
-
$result = array();
|
260 |
-
$this->event_id = $_REQUEST['event_id'];
|
261 |
-
if( isset($_REQUEST['em_tickets']) && is_array($_REQUEST['em_tickets']) && ($_REQUEST['em_tickets'] || $override_availability) ){
|
262 |
-
foreach( $_REQUEST['em_tickets'] as $ticket_id => $values){
|
263 |
-
//make sure ticket exists
|
264 |
-
if( !empty($values['spaces']) || $override_availability ){
|
265 |
-
$args = array('ticket_id'=>$ticket_id, 'ticket_booking_spaces'=>$values['spaces'], 'booking_id'=>$this->booking_id);
|
266 |
-
if($this->get_event()->get_bookings()->ticket_exists($ticket_id)){
|
267 |
-
$EM_Ticket_Booking = new EM_Ticket_Booking($args);
|
268 |
-
$EM_Ticket_Booking->booking = $this;
|
269 |
-
if( !$this->tickets_bookings->add( $EM_Ticket_Booking, $override_availability ) ){
|
270 |
-
$this->add_error($this->tickets_bookings->get_errors());
|
271 |
-
}
|
272 |
-
}else{
|
273 |
-
$this->errors[]=__('You are trying to book a non-existent ticket for this event.','dbem');
|
274 |
-
}
|
275 |
-
}
|
276 |
-
}
|
277 |
-
$this->booking_comment = (!empty($_REQUEST['booking_comment'])) ? wp_kses_data(stripslashes($_REQUEST['booking_comment'])):'';
|
278 |
-
//allow editing of tax rate
|
279 |
-
if( !empty($this->booking_id) && $this->can_manage() ){
|
280 |
-
$this->booking_tax_rate = (!empty($_REQUEST['booking_tax_rate']) && is_numeric($_REQUEST['booking_tax_rate'])) ? $_REQUEST['booking_tax_rate']:$this->booking_tax_rate;
|
281 |
-
}
|
282 |
-
//recalculate spaces/price
|
283 |
-
$this->get_spaces(true);
|
284 |
-
$this->calculate_price();
|
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 |
-
}
|
292 |
-
|
293 |
-
function validate( $override_availability = false ){
|
294 |
-
//step 1, basic info
|
295 |
-
$basic = (
|
296 |
-
(empty($this->event_id) || is_numeric($this->event_id)) &&
|
297 |
-
(empty($this->person_id) || is_numeric($this->person_id)) &&
|
298 |
-
is_numeric($this->booking_spaces) && $this->booking_spaces > 0
|
299 |
-
);
|
300 |
-
//give some errors in step 1
|
301 |
-
if( $this->booking_spaces == 0 ){
|
302 |
-
$this->add_error(get_option('dbem_booking_feedback_min_space'));
|
303 |
-
}
|
304 |
-
//step 2, tickets bookings info
|
305 |
-
if( count($this->get_tickets_bookings()) > 0 ){
|
306 |
-
$ticket_validation = array();
|
307 |
-
foreach($this->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking){ /* @var $EM_Ticket_Booking EM_Ticket_Booking */
|
308 |
-
if ( !$EM_Ticket_Booking->validate() ){
|
309 |
-
$ticket_validation[] = false;
|
310 |
-
$result = $basic && !in_array(false,$ticket_validation);
|
311 |
-
}
|
312 |
-
$this->errors = array_merge($this->errors, $EM_Ticket_Booking->get_errors());
|
313 |
-
}
|
314 |
-
$result = $basic && !in_array(false,$ticket_validation);
|
315 |
-
}else{
|
316 |
-
$result = false;
|
317 |
-
}
|
318 |
-
//is there enough space overall?
|
319 |
-
if( !$override_availability && $this->get_event()->get_bookings()->get_available_spaces() < $this->get_spaces() ){
|
320 |
-
$result = false;
|
321 |
-
$this->add_error(get_option('dbem_booking_feedback_full'));
|
322 |
-
}
|
323 |
-
//can we book this amount of spaces at once?
|
324 |
-
if( $this->get_event()->event_rsvp_spaces > 0 && $this->get_spaces() > $this->get_event()->event_rsvp_spaces ){
|
325 |
-
$result = false;
|
326 |
-
$this->add_error( sprintf(get_option('dbem_booking_feedback_spaces_limit'), $this->get_event()->event_rsvp_spaces));
|
327 |
-
}
|
328 |
-
return apply_filters('em_booking_validate',$result,$this);
|
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 |
-
*/
|
336 |
-
function get_spaces( $force_refresh=false ){
|
337 |
-
if($this->booking_spaces == 0 || $force_refresh == true ){
|
338 |
-
$this->booking_spaces = $this->get_tickets_bookings()->get_spaces($force_refresh);
|
339 |
-
}
|
340 |
-
return apply_filters('em_booking_get_spaces',$this->booking_spaces,$this);
|
341 |
-
}
|
342 |
-
|
343 |
-
/* Price Calculations */
|
344 |
-
|
345 |
-
/**
|
346 |
-
* Gets the total price for this whole booking, including any discounts, taxes, and any other additional items. In other words, what the person has to pay or has supposedly paid.
|
347 |
-
* This price shouldn't change once established, unless there's any alteration to the booking itself that'd affect the price, such as a change in ticket numbers, discount, etc.
|
348 |
-
* @param boolean $format
|
349 |
-
* @return double|string
|
350 |
-
*/
|
351 |
-
function get_price( $format = false, $format_depricated = null ){
|
352 |
-
if( $format_depricated !== null ) $format = $format_depricated; //support for old parameters, will be depricated soon
|
353 |
-
//recalculate price here only if price is not actually set
|
354 |
-
if( $this->booking_price === null ){
|
355 |
-
$this->calculate_price();
|
356 |
-
apply_filters('em_booking_get_price', $this->booking_price, $this);
|
357 |
-
}
|
358 |
-
//return booking_price, formatted or not
|
359 |
-
if($format){
|
360 |
-
return $this->format_price($this->booking_price);
|
361 |
-
}
|
362 |
-
return $this->booking_price;
|
363 |
-
}
|
364 |
-
|
365 |
-
/**
|
366 |
-
* Total of tickets without taxes, discounts or any other modification. No filter given here for that very reason!
|
367 |
-
* @param boolean $format
|
368 |
-
* @return double|string
|
369 |
-
*/
|
370 |
-
function get_price_base( $format = false ){
|
371 |
-
$price = $this->get_tickets_bookings()->get_price();
|
372 |
-
if($format){
|
373 |
-
return $this->format_price($price);
|
374 |
-
}
|
375 |
-
return $price;
|
376 |
-
}
|
377 |
-
|
378 |
-
function get_price_pre_taxes( $format = false ){
|
379 |
-
$price = $base_price = $this->get_price_base();
|
380 |
-
//apply pre-tax discounts
|
381 |
-
$price -= $this->get_price_discounts_amount('pre', $price);
|
382 |
-
if( $price < 0 ){ $price = 0; } //no negative prices
|
383 |
-
//return amount of taxes applied, formatted or not
|
384 |
-
if( $format ) return $this->format_price($price);
|
385 |
-
return $price;
|
386 |
-
}
|
387 |
-
|
388 |
-
/**
|
389 |
-
* Gets price AFTER taxes and post-tax discounts have also been added
|
390 |
-
* @param boolean $format
|
391 |
-
* @return double|string
|
392 |
-
*/
|
393 |
-
function get_price_post_taxes( $format = false ){
|
394 |
-
//get price before taxes
|
395 |
-
$price = $this->get_price_pre_taxes();
|
396 |
-
//add taxes to price
|
397 |
-
if( $this->get_tax_rate() > 0 ){
|
398 |
-
$this->booking_taxes = $price * ($this->get_tax_rate()/100); //calculate and save tax amount
|
399 |
-
$price += $this->booking_taxes; //add taxes
|
400 |
-
$this->taxes_applied = true;
|
401 |
-
}
|
402 |
-
//apply post-tax discounts
|
403 |
-
$price -= $this->get_price_discounts_amount('post', $price);
|
404 |
-
if( $price < 0 ){ $price = 0; } //no negative prices
|
405 |
-
//return amount of taxes applied, formatted or not
|
406 |
-
if( $format ) return $this->format_price($price);
|
407 |
-
return $price;
|
408 |
-
}
|
409 |
-
|
410 |
-
/**
|
411 |
-
* Get amount of taxes applied to this booking price.
|
412 |
-
* @param boolean $format
|
413 |
-
* @return double|string
|
414 |
-
*/
|
415 |
-
function get_price_taxes( $format=false ){
|
416 |
-
if( $this->booking_taxes !== null ){
|
417 |
-
$this->booking_taxes; //taxes already calculated
|
418 |
-
}else{
|
419 |
-
$this->calculate_price(); //recalculate price and taxes
|
420 |
-
}
|
421 |
-
//return amount of taxes applied, formatted or not
|
422 |
-
if( $format ){
|
423 |
-
return $this->format_price($this->booking_taxes);
|
424 |
-
}
|
425 |
-
return $this->booking_taxes;
|
426 |
-
}
|
427 |
-
|
428 |
-
function get_price_discount(){
|
429 |
-
|
430 |
-
}
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Calculates (or recalculates) the price of this booking including taxes, discounts etc., saves it to the booking_price property and writes to relevant properties booking_meta variables
|
434 |
-
* @return double
|
435 |
-
*/
|
436 |
-
function calculate_price(){
|
437 |
-
//reset price and taxes calculations
|
438 |
-
$this->booking_price = $this->booking_taxes = null;
|
439 |
-
//get post-tax price and save it to booking_price
|
440 |
-
$this->booking_price = apply_filters('em_booking_calculate_price', $this->get_price_post_taxes(), $this);
|
441 |
-
return $this->booking_price;
|
442 |
-
}
|
443 |
-
|
444 |
-
/*
|
445 |
-
* Gets tax rate of booking
|
446 |
-
* @see EM_Object::get_tax_rate()
|
447 |
-
* @return double
|
448 |
-
*/
|
449 |
-
function get_tax_rate(){
|
450 |
-
if( $this->booking_tax_rate === null ){
|
451 |
-
//booking not saved or tax never defined
|
452 |
-
if( !empty($this->booking_id) && get_option('dbem_legacy_bookings_tax', 'x') !== 'x'){ //even if 0 if defined as tax rate we still use it, delete the option entirely to stop
|
453 |
-
//no tax applied yet to an existing booking, or tax possibly applied (but handled seperately in EM_Tickets_Bookings but in legacy < v5.4
|
454 |
-
//sort out MultiSite nuances
|
455 |
-
if( EM_MS_GLOBAL && $this->get_event()->blog_id != get_current_blog_id() ){
|
456 |
-
//MultiSite AND Global tables enabled AND this event belongs to another blog - get settings for blog that published the event
|
457 |
-
$this->booking_tax_rate = get_blog_option($this->get_event()->blog_id, 'dbem_legacy_bookings_tax');
|
458 |
-
}else{
|
459 |
-
//get booking from current site, whether or not we're in MultiSite
|
460 |
-
$this->booking_tax_rate = get_option('dbem_legacy_bookings_tax');
|
461 |
-
}
|
462 |
-
$this->legacy_tax_rate = true;
|
463 |
-
}else{
|
464 |
-
//first time we're applying tax rate
|
465 |
-
$this->booking_tax_rate = $this->get_event()->get_tax_rate();
|
466 |
-
}
|
467 |
-
}
|
468 |
-
return $this->booking_tax_rate;
|
469 |
-
}
|
470 |
-
|
471 |
-
/**
|
472 |
-
* Returns an array of discounts to be applied to a booking. Here is an example of an array item that is expected:
|
473 |
-
* array('name' => 'Name of Discount', 'type'=>'% or #', 'amount'=> 0.00, 'desc' => 'Comments about discount', 'tax'=>'pre/post', 'data' => 'any info for hooks to use' );
|
474 |
-
* About the array keys:
|
475 |
-
* type - $ means a fixed amount of discount, % means a percentage off the base price
|
476 |
-
* amount - if type is a percentage, it is written as a number from 0-100, e.g. 10 = 10%
|
477 |
-
* tax - 'pre' means discount is applied before tax, 'post' means after tax
|
478 |
-
* data - any data to be stored that can be used by actions/filters
|
479 |
-
* @return array
|
480 |
-
*/
|
481 |
-
function get_price_discounts(){
|
482 |
-
$discounts = array();
|
483 |
-
if( !empty($this->booking_meta['discounts']) && is_array($this->booking_meta['discounts']) ){
|
484 |
-
$discounts = $this->booking_meta['discounts'];
|
485 |
-
}
|
486 |
-
return apply_filters('em_booking_get_price_discounts', $discounts, $this);
|
487 |
-
}
|
488 |
-
|
489 |
-
function get_price_discounts_amount( $pre_or_post = 'pre', $price = false ){
|
490 |
-
$discounts = $this->get_price_discounts_summary($pre_or_post, $price);
|
491 |
-
$discount_amount = 0;
|
492 |
-
foreach($discounts as $discount){
|
493 |
-
$discount_amount += $discount['amount_discounted'];
|
494 |
-
}
|
495 |
-
return $discount_amount;
|
496 |
-
}
|
497 |
-
|
498 |
-
function get_price_discounts_summary( $pre_or_post = 'pre', $price = false ){
|
499 |
-
$discounts= $this->get_price_discounts();
|
500 |
-
$discount_summary = array();
|
501 |
-
if( $price === false ){
|
502 |
-
$price = $this->get_price_base();
|
503 |
-
if( $pre_or_post == 'post' ) $price = $this->get_price_pre_taxes() + $this->get_price_taxes();
|
504 |
-
}
|
505 |
-
foreach($discounts as $discount){
|
506 |
-
$discount_amount = 0;
|
507 |
-
if( !empty($discount['amount']) ){
|
508 |
-
if( !empty($discount['tax']) && $discount['tax'] == $pre_or_post ){
|
509 |
-
if( !empty($discount['type']) ){
|
510 |
-
$discount_summary_item = array('name' => $discount['name'], 'desc' => $discount['desc'], 'discount'=>'0', 'amount_discounted'=>0);
|
511 |
-
if( $discount['type'] == '%' ){ //discount by percentage
|
512 |
-
$discount_summary_item['amount_discounted'] = round($price * ($discount['amount']/100),2);
|
513 |
-
$discount_summary_item['amount'] = $this->format_price($discount_summary_item['amount_discounted']);
|
514 |
-
$discount_summary_item['discount'] = number_format($discount['amount'],2).'%';
|
515 |
-
$discount_summary[] = $discount_summary_item;
|
516 |
-
}elseif( $discount['type'] == '#' ){ //discount by amount
|
517 |
-
$discount_summary_item['amount_discounted'] = round($discount['amount'],2);
|
518 |
-
$discount_summary_item['amount'] = $this->format_price($discount_summary_item['amount_discounted']);
|
519 |
-
$discount_summary_item['discount'] = $this->format_price($discount['amount']);
|
520 |
-
$discount_summary[] = $discount_summary_item;
|
521 |
-
}
|
522 |
-
}
|
523 |
-
}
|
524 |
-
}
|
525 |
-
}
|
526 |
-
return $discount_summary;
|
527 |
-
}
|
528 |
-
|
529 |
-
/**
|
530 |
-
* When generating totals at the bottom of a booking, this creates a useful array for displaying the summary in a meaningful way.
|
531 |
-
*/
|
532 |
-
function get_price_summary_array(){
|
533 |
-
$summary = array();
|
534 |
-
//get base price of bookings
|
535 |
-
$summary['total_base'] = $this->get_price_base();
|
536 |
-
//get discounts
|
537 |
-
//apply pre-tax discounts
|
538 |
-
$summary['discounts_pre_tax'] = $this->get_price_discounts_summary('pre');
|
539 |
-
//add taxes to price
|
540 |
-
$summary['taxes'] = array('rate'=> 0, 'amount'=> 0);
|
541 |
-
if( $this->get_price_taxes() > 0 ){
|
542 |
-
$summary['taxes'] = array('rate'=> number_format($this->get_tax_rate(),2).'%', 'amount'=> $this->get_price_taxes(true));
|
543 |
-
}
|
544 |
-
//apply post-tax discounts
|
545 |
-
$summary['discounts_post_tax'] = $this->get_price_discounts_summary('post');
|
546 |
-
//final price
|
547 |
-
$summary['total'] = $this->get_price(true);
|
548 |
-
return $summary;
|
549 |
-
}
|
550 |
-
|
551 |
-
/* Get Objects linked to booking */
|
552 |
-
|
553 |
-
/**
|
554 |
-
* Gets the event this booking belongs to and saves a refernece in the event property
|
555 |
-
* @return EM_Event
|
556 |
-
*/
|
557 |
-
function get_event(){
|
558 |
-
global $EM_Event;
|
559 |
-
if( is_object($this->event) && get_class($this->event)=='EM_Event' && $this->event->event_id == $this->event_id ){
|
560 |
-
return $this->event;
|
561 |
-
}elseif( is_object($EM_Event) && ( (is_object($this->event) && $this->event->event_id == $this->event_id) || empty($this->booking_id)) ){
|
562 |
-
$this->event = $EM_Event;
|
563 |
-
}else{
|
564 |
-
$this->event = new EM_Event($this->event_id, 'event_id');
|
565 |
-
}
|
566 |
-
return apply_filters('em_booking_get_event',$this->event, $this);
|
567 |
-
}
|
568 |
-
|
569 |
-
/**
|
570 |
-
* Gets the ticket object this booking belongs to, saves a reference in ticket property
|
571 |
-
* @return EM_Tickets
|
572 |
-
*/
|
573 |
-
function get_tickets(){
|
574 |
-
if( is_object($this->tickets) && get_class($this->tickets)=='EM_Tickets' ){
|
575 |
-
return apply_filters('em_booking_get_tickets', $this->tickets, $this);
|
576 |
-
}else{
|
577 |
-
$this->tickets = new EM_Tickets($this);
|
578 |
-
}
|
579 |
-
return apply_filters('em_booking_get_tickets', $this->tickets, $this);
|
580 |
-
}
|
581 |
-
|
582 |
-
/**
|
583 |
-
* Gets the ticket object this booking belongs to, saves a reference in ticket property
|
584 |
-
* @return EM_Tickets_Bookings
|
585 |
-
*/
|
586 |
-
function get_tickets_bookings(){
|
587 |
-
global $wpdb;
|
588 |
-
if( !is_object($this->tickets_bookings) || get_class($this->tickets_bookings)!='EM_Tickets_Bookings'){
|
589 |
-
$this->tickets_bookings = new EM_Tickets_Bookings($this);
|
590 |
-
}
|
591 |
-
return apply_filters('em_booking_get_tickets_bookings', $this->tickets_bookings, $this);
|
592 |
-
}
|
593 |
-
|
594 |
-
/**
|
595 |
-
* @return EM_Person
|
596 |
-
*/
|
597 |
-
function get_person(){
|
598 |
-
global $EM_Person;
|
599 |
-
if( is_object($this->person) && get_class($this->person)=='EM_Person' && ($this->person->ID == $this->person_id || empty($this->person_id) ) ){
|
600 |
-
//This person is already included, so don't do anything
|
601 |
-
}elseif( is_object($EM_Person) && ($EM_Person->ID === $this->person_id || $this->booking_id == '') ){
|
602 |
-
$this->person = $EM_Person;
|
603 |
-
$this->person_id = $this->person->ID;
|
604 |
-
}elseif( is_numeric($this->person_id) ){
|
605 |
-
$this->person = new EM_Person($this->person_id);
|
606 |
-
}else{
|
607 |
-
$this->person = new EM_Person(0);
|
608 |
-
$this->person_id = $this->person->ID;
|
609 |
-
}
|
610 |
-
//if this user is the parent user of disabled registrations, replace user details here:
|
611 |
-
if( get_option('dbem_bookings_registration_disable') && $this->person->ID == get_option('dbem_bookings_registration_user') && (empty($this->person->loaded_no_user) || $this->person->loaded_no_user != $this->booking_id) ){
|
612 |
-
//override any registration data into the person objet
|
613 |
-
if( !empty($this->booking_meta['registration']) ){
|
614 |
-
foreach($this->booking_meta['registration'] as $key => $value){
|
615 |
-
$this->person->$key = $value;
|
616 |
-
}
|
617 |
-
}
|
618 |
-
$this->person->user_email = ( !empty($this->booking_meta['registration']['user_email']) ) ? $this->booking_meta['registration']['user_email']:$this->person->user_email;
|
619 |
-
if( !empty($this->booking_meta['registration']['user_name']) ){
|
620 |
-
$name_string = explode(' ',$this->booking_meta['registration']['user_name']);
|
621 |
-
$this->booking_meta['registration']['first_name'] = array_shift($name_string);
|
622 |
-
$this->booking_meta['registration']['last_name'] = implode(' ', $name_string);
|
623 |
-
}
|
624 |
-
$this->person->user_firstname = ( !empty($this->booking_meta['registration']['first_name']) ) ? $this->booking_meta['registration']['first_name']:__('Guest User','dbem');
|
625 |
-
$this->person->first_name = $this->person->user_firstname;
|
626 |
-
$this->person->user_lastname = ( !empty($this->booking_meta['registration']['last_name']) ) ? $this->booking_meta['registration']['last_name']:'';
|
627 |
-
$this->person->last_name = $this->person->user_lastname;
|
628 |
-
$this->person->phone = ( !empty($this->booking_meta['registration']['dbem_phone']) ) ? $this->booking_meta['registration']['dbem_phone']:__('Not Supplied','dbem');
|
629 |
-
//build display name
|
630 |
-
$full_name = $this->person->user_firstname . " " . $this->person->user_lastname ;
|
631 |
-
$full_name = trim($full_name);
|
632 |
-
$display_name = ( empty($full_name) ) ? __('Guest User','dbem'):$full_name;
|
633 |
-
$this->person->display_name = $display_name;
|
634 |
-
$this->person->loaded_no_user = $this->booking_id;
|
635 |
-
}
|
636 |
-
return apply_filters('em_booking_get_person', $this->person, $this);
|
637 |
-
}
|
638 |
-
|
639 |
-
/**
|
640 |
-
* Gets personal information from the $_REQUEST array and saves it to the $EM_Booking->booking_meta['registration'] array
|
641 |
-
* @return boolean
|
642 |
-
*/
|
643 |
-
function get_person_post(){
|
644 |
-
$user_data = array();
|
645 |
-
$registration = true;
|
646 |
-
if( empty($this->booking_meta['registration']) ) $this->booking_meta['registration'] = array();
|
647 |
-
// Check the e-mail address
|
648 |
-
if ( $_REQUEST['user_email'] == '' ) {
|
649 |
-
$registration = false;
|
650 |
-
$this->add_error(__( '<strong>ERROR</strong>: Please type your e-mail address.', 'dbem') );
|
651 |
-
} elseif ( !is_email( $_REQUEST['user_email'] ) ) {
|
652 |
-
$registration = false;
|
653 |
-
$this->add_error( __( '<strong>ERROR</strong>: The email address isn’t correct.', 'dbem') );
|
654 |
-
}elseif(email_exists( $_REQUEST['user_email'] ) && !get_option('dbem_bookings_registration_disable_user_emails') ){
|
655 |
-
$registration = false;
|
656 |
-
$this->add_error( get_option('dbem_booking_feedback_email_exists') );
|
657 |
-
}else{
|
658 |
-
$user_data['user_email'] = $_REQUEST['user_email'];
|
659 |
-
}
|
660 |
-
//Check the user name
|
661 |
-
if( !empty($_REQUEST['user_name']) ){
|
662 |
-
//split full name up and save full, first and last names
|
663 |
-
$user_data['user_name'] = wp_kses($_REQUEST['user_name'], array());
|
664 |
-
$name_string = explode(' ',$user_data['user_name']);
|
665 |
-
$user_data['first_name'] = array_shift($name_string);
|
666 |
-
$user_data['last_name'] = implode(' ', $name_string);
|
667 |
-
}else{
|
668 |
-
//Check the first/last name
|
669 |
-
$name_string = array();
|
670 |
-
if( !empty($_REQUEST['first_name']) ){
|
671 |
-
$user_data['first_name'] = $name_string[] = wp_kses($_REQUEST['first_name'], array());
|
672 |
-
}
|
673 |
-
if( !empty($_REQUEST['last_name']) ){
|
674 |
-
$user_data['last_name'] = $name_string[] = wp_kses($_REQUEST['last_name'], array());
|
675 |
-
}
|
676 |
-
if( !empty($name_string) ) $user_data['user_name'] = implode(' ', $name_string);
|
677 |
-
}
|
678 |
-
//Save full name
|
679 |
-
if( !empty($user_data['first_name']) || !empty($user_data['last_name']) )
|
680 |
-
//Check the phone
|
681 |
-
if( !empty($_REQUEST['dbem_phone']) ){
|
682 |
-
$user_data['dbem_phone'] = wp_kses($_REQUEST['dbem_phone'], array());
|
683 |
-
}
|
684 |
-
//Add booking meta
|
685 |
-
if( $registration ){
|
686 |
-
$this->booking_meta['registration'] = array_merge($this->booking_meta['registration'], $user_data); //in case someone else added stuff
|
687 |
-
}
|
688 |
-
$registration = apply_filters('em_booking_get_person_post', $registration, $this);
|
689 |
-
if( $registration ){
|
690 |
-
$this->feedback_message = __('Personal details have successfully been modified.', 'dbem');
|
691 |
-
}
|
692 |
-
return $registration;
|
693 |
-
}
|
694 |
-
|
695 |
-
/**
|
696 |
-
* Displays a form containing user fields, used in no-user booking mode for editing guest users within a booking
|
697 |
-
* @return string
|
698 |
-
*/
|
699 |
-
function get_person_editor(){
|
700 |
-
ob_start();
|
701 |
-
$name = $this->get_person()->get_name();
|
702 |
-
$email = $this->get_person()->user_email;
|
703 |
-
$phone = ($this->get_person()->phone != __('Not Supplied','dbem')) ? $this->get_person()->phone:'';
|
704 |
-
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'booking_modify_person' ){
|
705 |
-
$name = !empty($_REQUEST['user_name']) ? $_REQUEST['user_name']:$name;
|
706 |
-
$email = !empty($_REQUEST['user_email']) ? $_REQUEST['user_email']:$email;
|
707 |
-
$phone = !empty($_REQUEST['dbem_phone']) ? $_REQUEST['dbem_phone']:$phone;
|
708 |
-
}
|
709 |
-
?>
|
710 |
-
<table class="em-form-fields">
|
711 |
-
<tr><th><?php _e('Name','dbem'); ?> : </th><td><input type="text" name="user_name" value="<?php echo esc_attr($name); ?>" /></td></tr>
|
712 |
-
<tr><th><?php _e('Email','dbem'); ?> : </th><td><input type="text" name="user_email" value="<?php echo esc_attr($email); ?>" /></td></tr>
|
713 |
-
<tr><th><?php _e('Phone','dbem'); ?> : </th><td><input type="text" name="dbem_phone" value="<?php echo esc_attr($phone); ?>" /></td></tr>
|
714 |
-
</table>
|
715 |
-
<?php
|
716 |
-
return apply_filters('em_booking_get_person_editor', ob_get_clean(), $this);
|
717 |
-
}
|
718 |
-
|
719 |
-
/**
|
720 |
-
* Returns a string representation of the booking's status
|
721 |
-
* @return string
|
722 |
-
*/
|
723 |
-
function get_status(){
|
724 |
-
$status = ($this->booking_status == 0 && !get_option('dbem_bookings_approval') ) ? 1:$this->booking_status;
|
725 |
-
return apply_filters('em_booking_get_status', $this->status_array[$status], $this);
|
726 |
-
}
|
727 |
-
|
728 |
-
/**
|
729 |
-
* I wonder what this does....
|
730 |
-
* @return boolean
|
731 |
-
*/
|
732 |
-
function delete(){
|
733 |
-
global $wpdb;
|
734 |
-
$result = false;
|
735 |
-
if( $this->can_manage('manage_bookings','manage_others_bookings') ){
|
736 |
-
$sql = $wpdb->prepare("DELETE FROM ". EM_BOOKINGS_TABLE . " WHERE booking_id=%d", $this->booking_id);
|
737 |
-
$result = $wpdb->query( $sql );
|
738 |
-
if( $result !== false ){
|
739 |
-
//delete the tickets too
|
740 |
-
$this->get_tickets_bookings()->delete();
|
741 |
-
$this->previous_status = $this->booking_status;
|
742 |
-
$this->booking_status = false;
|
743 |
-
$this->feedback_message = sprintf(__('%s deleted', 'dbem'), __('Booking','dbem'));
|
744 |
-
$wpdb->delete( EM_META_TABLE, array('meta_key'=>'booking-note', 'object_id' => $this->booking_id), array('%s','%d'));
|
745 |
-
}else{
|
746 |
-
$this->add_error(sprintf(__('%s could not be deleted', 'dbem'), __('Booking','dbem')));
|
747 |
-
}
|
748 |
-
}
|
749 |
-
return apply_filters('em_booking_delete',( $result !== false ), $this);
|
750 |
-
}
|
751 |
-
|
752 |
-
function cancel($email = true){
|
753 |
-
if( $this->person->ID == get_current_user_id() ){
|
754 |
-
$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.
|
755 |
-
}
|
756 |
-
return $this->set_status(3, $email);
|
757 |
-
}
|
758 |
-
|
759 |
-
/**
|
760 |
-
* Approve a booking.
|
761 |
-
* @return bool
|
762 |
-
*/
|
763 |
-
function approve($email = true, $ignore_spaces = false){
|
764 |
-
return $this->set_status(1, $email, $ignore_spaces);
|
765 |
-
}
|
766 |
-
/**
|
767 |
-
* Reject a booking and save
|
768 |
-
* @return bool
|
769 |
-
*/
|
770 |
-
function reject($email = true){
|
771 |
-
return $this->set_status(2, $email);
|
772 |
-
}
|
773 |
-
/**
|
774 |
-
* Unapprove a booking.
|
775 |
-
* @return bool
|
776 |
-
*/
|
777 |
-
function unapprove($email = true){
|
778 |
-
return $this->set_status(0, $email);
|
779 |
-
}
|
780 |
-
|
781 |
-
/**
|
782 |
-
* Change the status of the booking. This will save to the Database too.
|
783 |
-
* @param int $status
|
784 |
-
* @return boolean
|
785 |
-
*/
|
786 |
-
function set_status($status, $email = true, $ignore_spaces = false){
|
787 |
-
global $wpdb;
|
788 |
-
$action_string = strtolower($this->status_array[$status]);
|
789 |
-
//if we're approving we can't approve a booking if spaces are full, so check before it's approved.
|
790 |
-
if(!$ignore_spaces && $status == 1){
|
791 |
-
if( !$this->is_reserved() && $this->get_event()->get_bookings()->get_available_spaces() < $this->get_spaces() && !get_option('dbem_bookings_approval_overbooking') ){
|
792 |
-
$this->feedback_message = sprintf(__('Not approved, spaces full.','dbem'), $action_string);
|
793 |
-
$this->add_error($this->feedback_message);
|
794 |
-
return apply_filters('em_booking_set_status', false, $this);
|
795 |
-
}
|
796 |
-
}
|
797 |
-
$this->previous_status = $this->booking_status;
|
798 |
-
$this->booking_status = $status;
|
799 |
-
$result = $wpdb->query($wpdb->prepare('UPDATE '.EM_BOOKINGS_TABLE.' SET booking_status=%d WHERE booking_id=%d', array($status, $this->booking_id)));
|
800 |
-
if($result !== false){
|
801 |
-
$this->feedback_message = sprintf(__('Booking %s.','dbem'), $action_string);
|
802 |
-
if( $email ){
|
803 |
-
if( $this->email()
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
$
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
$result = true;
|
829 |
-
}elseif( $this->booking_status ==
|
830 |
-
$result = true;
|
831 |
-
}
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
*
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
$this->
|
854 |
-
$
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
$bookings_link =
|
869 |
-
}
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
$
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
$replace = $this->
|
918 |
-
break;
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
$
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
$this->
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
$msg['
|
1048 |
-
|
1049 |
-
|
1050 |
-
$msg['
|
1051 |
-
$msg['
|
1052 |
-
|
1053 |
-
|
1054 |
-
$msg['
|
1055 |
-
|
1056 |
-
|
1057 |
-
$msg['
|
1058 |
-
$msg['
|
1059 |
-
|
1060 |
-
|
1061 |
-
$msg['
|
1062 |
-
|
1063 |
-
|
1064 |
-
$msg['
|
1065 |
-
$msg['
|
1066 |
-
|
1067 |
-
|
1068 |
-
$msg['
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
$
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
}
|
1098 |
-
return $booking;
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* gets a booking in a more db-friendly manner, allows hooking into booking object right after instantiation
|
4 |
+
* @param mixed $id
|
5 |
+
* @param mixed $search_by
|
6 |
+
* @return EM_Booking
|
7 |
+
*/
|
8 |
+
function em_get_booking($id = false) {
|
9 |
+
global $EM_Booking;
|
10 |
+
//check if it's not already global so we don't instantiate again
|
11 |
+
if( is_object($EM_Booking) && get_class($EM_Booking) == 'EM_Booking' ){
|
12 |
+
if( is_object($id) && $EM_Booking->booking_id == $id->booking_id ){
|
13 |
+
return apply_filters('em_get_booking', $EM_Booking);
|
14 |
+
}else{
|
15 |
+
if( is_numeric($id) && $EM_Booking->booking_id == $id ){
|
16 |
+
return apply_filters('em_get_booking', $EM_Booking);
|
17 |
+
}elseif( is_array($id) && !empty($id['booking_id']) && $EM_Booking->booking_id == $id['booking_id'] ){
|
18 |
+
return apply_filters('em_get_booking', $EM_Booking);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
if( is_object($id) && get_class($id) == 'EM_Booking' ){
|
23 |
+
return apply_filters('em_get_booking', $id);
|
24 |
+
}else{
|
25 |
+
return apply_filters('em_get_booking', new EM_Booking($id));
|
26 |
+
}
|
27 |
+
}
|
28 |
+
/**
|
29 |
+
* Contains all information and relevant functions surrounding a single booking made with Events Manager
|
30 |
+
*/
|
31 |
+
class EM_Booking extends EM_Object{
|
32 |
+
//DB Fields
|
33 |
+
var $booking_id;
|
34 |
+
var $event_id;
|
35 |
+
var $person_id;
|
36 |
+
var $booking_price = null;
|
37 |
+
var $booking_spaces;
|
38 |
+
var $booking_comment;
|
39 |
+
var $booking_status = false;
|
40 |
+
var $booking_tax_rate = null;
|
41 |
+
var $booking_taxes = null;
|
42 |
+
var $booking_meta = array();
|
43 |
+
var $fields = array(
|
44 |
+
'booking_id' => array('name'=>'id','type'=>'%d'),
|
45 |
+
'event_id' => array('name'=>'event_id','type'=>'%d'),
|
46 |
+
'person_id' => array('name'=>'person_id','type'=>'%d'),
|
47 |
+
'booking_price' => array('name'=>'price','type'=>'%f'),
|
48 |
+
'booking_spaces' => array('name'=>'spaces','type'=>'%d'),
|
49 |
+
'booking_comment' => array('name'=>'comment','type'=>'%s'),
|
50 |
+
'booking_status' => array('name'=>'status','type'=>'%d'),
|
51 |
+
'booking_tax_rate' => array('name'=>'tax_rate','type'=>'%f','null'=>1),
|
52 |
+
'booking_taxes' => array('name'=>'taxes','type'=>'%f','null'=>1),
|
53 |
+
'booking_meta' => array('name'=>'meta','type'=>'%s')
|
54 |
+
);
|
55 |
+
//Other Vars
|
56 |
+
/**
|
57 |
+
* array of notes by admins on this booking. loaded from em_meta table in construct
|
58 |
+
* @var array
|
59 |
+
*/
|
60 |
+
var $notes;
|
61 |
+
var $timestamp;
|
62 |
+
var $person;
|
63 |
+
var $required_fields = array('booking_id', 'event_id', 'person_id', 'booking_spaces');
|
64 |
+
var $feedback_message = "";
|
65 |
+
var $errors = array();
|
66 |
+
/**
|
67 |
+
* when using EM_Booking::email_send(), this number is updated with sent emails
|
68 |
+
* @var int
|
69 |
+
*/
|
70 |
+
var $mails_sent = 0;
|
71 |
+
/**
|
72 |
+
* Contains an array of custom fields for a booking. This is loaded from em_meta, where the booking_custom name contains arrays of data.
|
73 |
+
* @var array
|
74 |
+
*/
|
75 |
+
var $custom = array();
|
76 |
+
/**
|
77 |
+
* If saved in this instance, you can see what previous approval status was.
|
78 |
+
* @var int
|
79 |
+
*/
|
80 |
+
var $previous_status = false;
|
81 |
+
/**
|
82 |
+
* The booking approval status number corresponds to a state in this array.
|
83 |
+
* @var unknown_type
|
84 |
+
*/
|
85 |
+
var $status_array = array();
|
86 |
+
/**
|
87 |
+
* @var EM_Tickets
|
88 |
+
*/
|
89 |
+
var $tickets;
|
90 |
+
/**
|
91 |
+
* @var EM_Event
|
92 |
+
*/
|
93 |
+
var $event;
|
94 |
+
/**
|
95 |
+
* @var EM_Tickets_Bookings
|
96 |
+
*/
|
97 |
+
var $tickets_bookings;
|
98 |
+
/**
|
99 |
+
* If set to true, this booking can be managed by any logged in user.
|
100 |
+
* @var EM_Tickets_Bookings
|
101 |
+
*/
|
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 |
+
*/
|
109 |
+
function __construct( $booking_data = false ){
|
110 |
+
//Get the person for this booking
|
111 |
+
global $wpdb;
|
112 |
+
if( $booking_data !== false ){
|
113 |
+
//Load booking data
|
114 |
+
$booking = array();
|
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 |
+
}
|
122 |
+
//booking meta
|
123 |
+
$booking['booking_meta'] = (!empty($booking['booking_meta'])) ? maybe_unserialize($booking['booking_meta']):array();
|
124 |
+
//Save into the object
|
125 |
+
$this->to_object($booking);
|
126 |
+
$this->previous_status = $this->booking_status;
|
127 |
+
$this->get_person();
|
128 |
+
$this->timestamp = !empty($booking['booking_date']) ? strtotime($booking['booking_date'], current_time('timestamp')):false;
|
129 |
+
}
|
130 |
+
//Do it here so things appear in the po file.
|
131 |
+
$this->status_array = array(
|
132 |
+
0 => __('Pending','dbem'),
|
133 |
+
1 => __('Approved','dbem'),
|
134 |
+
2 => __('Rejected','dbem'),
|
135 |
+
3 => __('Cancelled','dbem'),
|
136 |
+
4 => __('Awaiting Online Payment','dbem'),
|
137 |
+
5 => __('Awaiting Payment','dbem')
|
138 |
+
);
|
139 |
+
$this->compat_keys(); //depricating in 6.0
|
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);
|
147 |
+
}
|
148 |
+
|
149 |
+
function get_notes(){
|
150 |
+
global $wpdb;
|
151 |
+
if( !is_array($this->notes) && !empty($this->booking_id) ){
|
152 |
+
$notes = $wpdb->get_results("SELECT * FROM ". EM_META_TABLE ." WHERE meta_key='booking-note' AND object_id ='{$this->booking_id}'", ARRAY_A);
|
153 |
+
$this->notes = array();
|
154 |
+
foreach($notes as $note){
|
155 |
+
$this->notes[] = unserialize($note['meta_value']);
|
156 |
+
}
|
157 |
+
}elseif( empty($this->booking_id) ){
|
158 |
+
$this->notes = array();
|
159 |
+
}
|
160 |
+
return $this->notes;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Saves the booking into the database, whether a new or existing booking
|
165 |
+
* @param $mail whether or not to email the user and contact people
|
166 |
+
* @return boolean
|
167 |
+
*/
|
168 |
+
function save($mail = true){
|
169 |
+
global $wpdb;
|
170 |
+
$table = EM_BOOKINGS_TABLE;
|
171 |
+
do_action('em_booking_save_pre',$this);
|
172 |
+
if( $this->can_manage() ){
|
173 |
+
//update prices, spaces, person_id
|
174 |
+
$this->get_spaces(true);
|
175 |
+
$this->calculate_price();
|
176 |
+
$this->person_id = (empty($this->person_id)) ? $this->get_person()->ID : $this->person_id;
|
177 |
+
//Step 1. Save the booking
|
178 |
+
$data = $this->to_array();
|
179 |
+
$data['booking_meta'] = serialize($data['booking_meta']);
|
180 |
+
//update or save
|
181 |
+
if($this->booking_id != ''){
|
182 |
+
$update = true;
|
183 |
+
$where = array( 'booking_id' => $this->booking_id );
|
184 |
+
$result = $wpdb->update($table, $data, $where, $this->get_types($data));
|
185 |
+
$result = ($result !== false);
|
186 |
+
$this->feedback_message = __('Changes saved','dbem');
|
187 |
+
}else{
|
188 |
+
$update = false;
|
189 |
+
$data_types = $this->get_types($data);
|
190 |
+
$data['booking_date'] = current_time('mysql');
|
191 |
+
$data_types[] = '%s';
|
192 |
+
$result = $wpdb->insert($table, $data, $data_types);
|
193 |
+
$this->booking_id = $wpdb->insert_id;
|
194 |
+
$this->feedback_message = __('Your booking has been recorded','dbem');
|
195 |
+
}
|
196 |
+
//Step 2. Insert ticket bookings for this booking id if no errors so far
|
197 |
+
if( $result === false ){
|
198 |
+
$this->feedback_message = __('There was a problem saving the booking.', 'dbem');
|
199 |
+
$this->errors[] = __('There was a problem saving the booking.', 'dbem');
|
200 |
+
}else{
|
201 |
+
$tickets_bookings_result = $this->get_tickets_bookings()->save();
|
202 |
+
if( !$tickets_bookings_result ){
|
203 |
+
if( !$update ){
|
204 |
+
//delete the booking and tickets, instead of a transaction
|
205 |
+
$this->delete();
|
206 |
+
}
|
207 |
+
$this->errors[] = __('There was a problem saving the booking.', 'dbem');
|
208 |
+
$this->add_error( $this->get_tickets_bookings()->get_errors() );
|
209 |
+
}
|
210 |
+
}
|
211 |
+
//Step 3. email if necessary
|
212 |
+
if ( count($this->errors) == 0 && $mail ) {
|
213 |
+
$this->email();
|
214 |
+
}
|
215 |
+
$this->compat_keys();
|
216 |
+
return apply_filters('em_booking_save', ( count($this->errors) == 0 ), $this);
|
217 |
+
}else{
|
218 |
+
$this->feedback_message = __('There was a problem saving the booking.', 'dbem');
|
219 |
+
if( !$this->can_manage() ){
|
220 |
+
$this->add_error(sprintf(__('You cannot manage this %s.', 'dbem'),__('Booking','dbem')));
|
221 |
+
}
|
222 |
+
}
|
223 |
+
return apply_filters('em_booking_save', false, $this);
|
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
|
231 |
+
*/
|
232 |
+
function get($search) {
|
233 |
+
global $wpdb;
|
234 |
+
$conds = array();
|
235 |
+
foreach($search as $key => $value) {
|
236 |
+
if( array_key_exists($key, $this->fields) ){
|
237 |
+
$value = esc_sql($value);
|
238 |
+
$conds[] = "`$key`='$value'";
|
239 |
+
}
|
240 |
+
}
|
241 |
+
$sql = "SELECT * FROM ". $wpdb->EM_BOOKINGS_TABLE ." WHERE " . implode(' AND ', $conds) ;
|
242 |
+
$result = $wpdb->get_row($sql, ARRAY_A);
|
243 |
+
if($result){
|
244 |
+
$this->to_object($result);
|
245 |
+
$this->person = new EM_Person($this->person_id);
|
246 |
+
return true;
|
247 |
+
}else{
|
248 |
+
return false;
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Get posted data and save it into the object (not db)
|
254 |
+
* @return boolean
|
255 |
+
*/
|
256 |
+
function get_post( $override_availability = false ){
|
257 |
+
$this->tickets_bookings = new EM_Tickets_Bookings($this->booking_id);
|
258 |
+
do_action('em_booking_get_post_pre',$this);
|
259 |
+
$result = array();
|
260 |
+
$this->event_id = $_REQUEST['event_id'];
|
261 |
+
if( isset($_REQUEST['em_tickets']) && is_array($_REQUEST['em_tickets']) && ($_REQUEST['em_tickets'] || $override_availability) ){
|
262 |
+
foreach( $_REQUEST['em_tickets'] as $ticket_id => $values){
|
263 |
+
//make sure ticket exists
|
264 |
+
if( !empty($values['spaces']) || $override_availability ){
|
265 |
+
$args = array('ticket_id'=>$ticket_id, 'ticket_booking_spaces'=>$values['spaces'], 'booking_id'=>$this->booking_id);
|
266 |
+
if($this->get_event()->get_bookings()->ticket_exists($ticket_id)){
|
267 |
+
$EM_Ticket_Booking = new EM_Ticket_Booking($args);
|
268 |
+
$EM_Ticket_Booking->booking = $this;
|
269 |
+
if( !$this->tickets_bookings->add( $EM_Ticket_Booking, $override_availability ) ){
|
270 |
+
$this->add_error($this->tickets_bookings->get_errors());
|
271 |
+
}
|
272 |
+
}else{
|
273 |
+
$this->errors[]=__('You are trying to book a non-existent ticket for this event.','dbem');
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
277 |
+
$this->booking_comment = (!empty($_REQUEST['booking_comment'])) ? wp_kses_data(stripslashes($_REQUEST['booking_comment'])):'';
|
278 |
+
//allow editing of tax rate
|
279 |
+
if( !empty($this->booking_id) && $this->can_manage() ){
|
280 |
+
$this->booking_tax_rate = (!empty($_REQUEST['booking_tax_rate']) && is_numeric($_REQUEST['booking_tax_rate'])) ? $_REQUEST['booking_tax_rate']:$this->booking_tax_rate;
|
281 |
+
}
|
282 |
+
//recalculate spaces/price
|
283 |
+
$this->get_spaces(true);
|
284 |
+
$this->calculate_price();
|
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 |
+
}
|
292 |
+
|
293 |
+
function validate( $override_availability = false ){
|
294 |
+
//step 1, basic info
|
295 |
+
$basic = (
|
296 |
+
(empty($this->event_id) || is_numeric($this->event_id)) &&
|
297 |
+
(empty($this->person_id) || is_numeric($this->person_id)) &&
|
298 |
+
is_numeric($this->booking_spaces) && $this->booking_spaces > 0
|
299 |
+
);
|
300 |
+
//give some errors in step 1
|
301 |
+
if( $this->booking_spaces == 0 ){
|
302 |
+
$this->add_error(get_option('dbem_booking_feedback_min_space'));
|
303 |
+
}
|
304 |
+
//step 2, tickets bookings info
|
305 |
+
if( count($this->get_tickets_bookings()) > 0 ){
|
306 |
+
$ticket_validation = array();
|
307 |
+
foreach($this->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking){ /* @var $EM_Ticket_Booking EM_Ticket_Booking */
|
308 |
+
if ( !$EM_Ticket_Booking->validate() ){
|
309 |
+
$ticket_validation[] = false;
|
310 |
+
$result = $basic && !in_array(false,$ticket_validation);
|
311 |
+
}
|
312 |
+
$this->errors = array_merge($this->errors, $EM_Ticket_Booking->get_errors());
|
313 |
+
}
|
314 |
+
$result = $basic && !in_array(false,$ticket_validation);
|
315 |
+
}else{
|
316 |
+
$result = false;
|
317 |
+
}
|
318 |
+
//is there enough space overall?
|
319 |
+
if( !$override_availability && $this->get_event()->get_bookings()->get_available_spaces() < $this->get_spaces() ){
|
320 |
+
$result = false;
|
321 |
+
$this->add_error(get_option('dbem_booking_feedback_full'));
|
322 |
+
}
|
323 |
+
//can we book this amount of spaces at once?
|
324 |
+
if( $this->get_event()->event_rsvp_spaces > 0 && $this->get_spaces() > $this->get_event()->event_rsvp_spaces ){
|
325 |
+
$result = false;
|
326 |
+
$this->add_error( sprintf(get_option('dbem_booking_feedback_spaces_limit'), $this->get_event()->event_rsvp_spaces));
|
327 |
+
}
|
328 |
+
return apply_filters('em_booking_validate',$result,$this);
|
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 |
+
*/
|
336 |
+
function get_spaces( $force_refresh=false ){
|
337 |
+
if($this->booking_spaces == 0 || $force_refresh == true ){
|
338 |
+
$this->booking_spaces = $this->get_tickets_bookings()->get_spaces($force_refresh);
|
339 |
+
}
|
340 |
+
return apply_filters('em_booking_get_spaces',$this->booking_spaces,$this);
|
341 |
+
}
|
342 |
+
|
343 |
+
/* Price Calculations */
|
344 |
+
|
345 |
+
/**
|
346 |
+
* Gets the total price for this whole booking, including any discounts, taxes, and any other additional items. In other words, what the person has to pay or has supposedly paid.
|
347 |
+
* This price shouldn't change once established, unless there's any alteration to the booking itself that'd affect the price, such as a change in ticket numbers, discount, etc.
|
348 |
+
* @param boolean $format
|
349 |
+
* @return double|string
|
350 |
+
*/
|
351 |
+
function get_price( $format = false, $format_depricated = null ){
|
352 |
+
if( $format_depricated !== null ) $format = $format_depricated; //support for old parameters, will be depricated soon
|
353 |
+
//recalculate price here only if price is not actually set
|
354 |
+
if( $this->booking_price === null ){
|
355 |
+
$this->calculate_price();
|
356 |
+
$this->booking_price = apply_filters('em_booking_get_price', $this->booking_price, $this);
|
357 |
+
}
|
358 |
+
//return booking_price, formatted or not
|
359 |
+
if($format){
|
360 |
+
return $this->format_price($this->booking_price);
|
361 |
+
}
|
362 |
+
return round($this->booking_price,2);
|
363 |
+
}
|
364 |
+
|
365 |
+
/**
|
366 |
+
* Total of tickets without taxes, discounts or any other modification. No filter given here for that very reason!
|
367 |
+
* @param boolean $format
|
368 |
+
* @return double|string
|
369 |
+
*/
|
370 |
+
function get_price_base( $format = false ){
|
371 |
+
$price = $this->get_tickets_bookings()->get_price();
|
372 |
+
if($format){
|
373 |
+
return $this->format_price($price);
|
374 |
+
}
|
375 |
+
return $price;
|
376 |
+
}
|
377 |
+
|
378 |
+
function get_price_pre_taxes( $format = false ){
|
379 |
+
$price = $base_price = $this->get_price_base();
|
380 |
+
//apply pre-tax discounts
|
381 |
+
$price -= $this->get_price_discounts_amount('pre', $price);
|
382 |
+
if( $price < 0 ){ $price = 0; } //no negative prices
|
383 |
+
//return amount of taxes applied, formatted or not
|
384 |
+
if( $format ) return $this->format_price($price);
|
385 |
+
return $price;
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* Gets price AFTER taxes and post-tax discounts have also been added
|
390 |
+
* @param boolean $format
|
391 |
+
* @return double|string
|
392 |
+
*/
|
393 |
+
function get_price_post_taxes( $format = false ){
|
394 |
+
//get price before taxes
|
395 |
+
$price = $this->get_price_pre_taxes();
|
396 |
+
//add taxes to price
|
397 |
+
if( $this->get_tax_rate() > 0 ){
|
398 |
+
$this->booking_taxes = $price * ($this->get_tax_rate()/100); //calculate and save tax amount
|
399 |
+
$price += $this->booking_taxes; //add taxes
|
400 |
+
$this->taxes_applied = true;
|
401 |
+
}
|
402 |
+
//apply post-tax discounts
|
403 |
+
$price -= $this->get_price_discounts_amount('post', $price);
|
404 |
+
if( $price < 0 ){ $price = 0; } //no negative prices
|
405 |
+
//return amount of taxes applied, formatted or not
|
406 |
+
if( $format ) return $this->format_price($price);
|
407 |
+
return $price;
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Get amount of taxes applied to this booking price.
|
412 |
+
* @param boolean $format
|
413 |
+
* @return double|string
|
414 |
+
*/
|
415 |
+
function get_price_taxes( $format=false ){
|
416 |
+
if( $this->booking_taxes !== null ){
|
417 |
+
$this->booking_taxes; //taxes already calculated
|
418 |
+
}else{
|
419 |
+
$this->calculate_price(); //recalculate price and taxes
|
420 |
+
}
|
421 |
+
//return amount of taxes applied, formatted or not
|
422 |
+
if( $format ){
|
423 |
+
return $this->format_price($this->booking_taxes);
|
424 |
+
}
|
425 |
+
return $this->booking_taxes;
|
426 |
+
}
|
427 |
+
|
428 |
+
function get_price_discount(){
|
429 |
+
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Calculates (or recalculates) the price of this booking including taxes, discounts etc., saves it to the booking_price property and writes to relevant properties booking_meta variables
|
434 |
+
* @return double
|
435 |
+
*/
|
436 |
+
function calculate_price(){
|
437 |
+
//reset price and taxes calculations
|
438 |
+
$this->booking_price = $this->booking_taxes = null;
|
439 |
+
//get post-tax price and save it to booking_price
|
440 |
+
$this->booking_price = apply_filters('em_booking_calculate_price', $this->get_price_post_taxes(), $this);
|
441 |
+
return $this->booking_price;
|
442 |
+
}
|
443 |
+
|
444 |
+
/*
|
445 |
+
* Gets tax rate of booking
|
446 |
+
* @see EM_Object::get_tax_rate()
|
447 |
+
* @return double
|
448 |
+
*/
|
449 |
+
function get_tax_rate(){
|
450 |
+
if( $this->booking_tax_rate === null ){
|
451 |
+
//booking not saved or tax never defined
|
452 |
+
if( !empty($this->booking_id) && get_option('dbem_legacy_bookings_tax', 'x') !== 'x'){ //even if 0 if defined as tax rate we still use it, delete the option entirely to stop
|
453 |
+
//no tax applied yet to an existing booking, or tax possibly applied (but handled seperately in EM_Tickets_Bookings but in legacy < v5.4
|
454 |
+
//sort out MultiSite nuances
|
455 |
+
if( EM_MS_GLOBAL && $this->get_event()->blog_id != get_current_blog_id() ){
|
456 |
+
//MultiSite AND Global tables enabled AND this event belongs to another blog - get settings for blog that published the event
|
457 |
+
$this->booking_tax_rate = get_blog_option($this->get_event()->blog_id, 'dbem_legacy_bookings_tax');
|
458 |
+
}else{
|
459 |
+
//get booking from current site, whether or not we're in MultiSite
|
460 |
+
$this->booking_tax_rate = get_option('dbem_legacy_bookings_tax');
|
461 |
+
}
|
462 |
+
$this->legacy_tax_rate = true;
|
463 |
+
}else{
|
464 |
+
//first time we're applying tax rate
|
465 |
+
$this->booking_tax_rate = $this->get_event()->get_tax_rate();
|
466 |
+
}
|
467 |
+
}
|
468 |
+
return $this->booking_tax_rate;
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* Returns an array of discounts to be applied to a booking. Here is an example of an array item that is expected:
|
473 |
+
* array('name' => 'Name of Discount', 'type'=>'% or #', 'amount'=> 0.00, 'desc' => 'Comments about discount', 'tax'=>'pre/post', 'data' => 'any info for hooks to use' );
|
474 |
+
* About the array keys:
|
475 |
+
* type - $ means a fixed amount of discount, % means a percentage off the base price
|
476 |
+
* amount - if type is a percentage, it is written as a number from 0-100, e.g. 10 = 10%
|
477 |
+
* tax - 'pre' means discount is applied before tax, 'post' means after tax
|
478 |
+
* data - any data to be stored that can be used by actions/filters
|
479 |
+
* @return array
|
480 |
+
*/
|
481 |
+
function get_price_discounts(){
|
482 |
+
$discounts = array();
|
483 |
+
if( !empty($this->booking_meta['discounts']) && is_array($this->booking_meta['discounts']) ){
|
484 |
+
$discounts = $this->booking_meta['discounts'];
|
485 |
+
}
|
486 |
+
return apply_filters('em_booking_get_price_discounts', $discounts, $this);
|
487 |
+
}
|
488 |
+
|
489 |
+
function get_price_discounts_amount( $pre_or_post = 'pre', $price = false ){
|
490 |
+
$discounts = $this->get_price_discounts_summary($pre_or_post, $price);
|
491 |
+
$discount_amount = 0;
|
492 |
+
foreach($discounts as $discount){
|
493 |
+
$discount_amount += $discount['amount_discounted'];
|
494 |
+
}
|
495 |
+
return $discount_amount;
|
496 |
+
}
|
497 |
+
|
498 |
+
function get_price_discounts_summary( $pre_or_post = 'pre', $price = false ){
|
499 |
+
$discounts= $this->get_price_discounts();
|
500 |
+
$discount_summary = array();
|
501 |
+
if( $price === false ){
|
502 |
+
$price = $this->get_price_base();
|
503 |
+
if( $pre_or_post == 'post' ) $price = $this->get_price_pre_taxes() + $this->get_price_taxes();
|
504 |
+
}
|
505 |
+
foreach($discounts as $discount){
|
506 |
+
$discount_amount = 0;
|
507 |
+
if( !empty($discount['amount']) ){
|
508 |
+
if( !empty($discount['tax']) && $discount['tax'] == $pre_or_post ){
|
509 |
+
if( !empty($discount['type']) ){
|
510 |
+
$discount_summary_item = array('name' => $discount['name'], 'desc' => $discount['desc'], 'discount'=>'0', 'amount_discounted'=>0);
|
511 |
+
if( $discount['type'] == '%' ){ //discount by percentage
|
512 |
+
$discount_summary_item['amount_discounted'] = round($price * ($discount['amount']/100),2);
|
513 |
+
$discount_summary_item['amount'] = $this->format_price($discount_summary_item['amount_discounted']);
|
514 |
+
$discount_summary_item['discount'] = number_format($discount['amount'],2).'%';
|
515 |
+
$discount_summary[] = $discount_summary_item;
|
516 |
+
}elseif( $discount['type'] == '#' ){ //discount by amount
|
517 |
+
$discount_summary_item['amount_discounted'] = round($discount['amount'],2);
|
518 |
+
$discount_summary_item['amount'] = $this->format_price($discount_summary_item['amount_discounted']);
|
519 |
+
$discount_summary_item['discount'] = $this->format_price($discount['amount']);
|
520 |
+
$discount_summary[] = $discount_summary_item;
|
521 |
+
}
|
522 |
+
}
|
523 |
+
}
|
524 |
+
}
|
525 |
+
}
|
526 |
+
return $discount_summary;
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* When generating totals at the bottom of a booking, this creates a useful array for displaying the summary in a meaningful way.
|
531 |
+
*/
|
532 |
+
function get_price_summary_array(){
|
533 |
+
$summary = array();
|
534 |
+
//get base price of bookings
|
535 |
+
$summary['total_base'] = $this->get_price_base();
|
536 |
+
//get discounts
|
537 |
+
//apply pre-tax discounts
|
538 |
+
$summary['discounts_pre_tax'] = $this->get_price_discounts_summary('pre');
|
539 |
+
//add taxes to price
|
540 |
+
$summary['taxes'] = array('rate'=> 0, 'amount'=> 0);
|
541 |
+
if( $this->get_price_taxes() > 0 ){
|
542 |
+
$summary['taxes'] = array('rate'=> number_format($this->get_tax_rate(),2).'%', 'amount'=> $this->get_price_taxes(true));
|
543 |
+
}
|
544 |
+
//apply post-tax discounts
|
545 |
+
$summary['discounts_post_tax'] = $this->get_price_discounts_summary('post');
|
546 |
+
//final price
|
547 |
+
$summary['total'] = $this->get_price(true);
|
548 |
+
return $summary;
|
549 |
+
}
|
550 |
+
|
551 |
+
/* Get Objects linked to booking */
|
552 |
+
|
553 |
+
/**
|
554 |
+
* Gets the event this booking belongs to and saves a refernece in the event property
|
555 |
+
* @return EM_Event
|
556 |
+
*/
|
557 |
+
function get_event(){
|
558 |
+
global $EM_Event;
|
559 |
+
if( is_object($this->event) && get_class($this->event)=='EM_Event' && $this->event->event_id == $this->event_id ){
|
560 |
+
return $this->event;
|
561 |
+
}elseif( is_object($EM_Event) && ( (is_object($this->event) && $this->event->event_id == $this->event_id) || empty($this->booking_id)) ){
|
562 |
+
$this->event = $EM_Event;
|
563 |
+
}else{
|
564 |
+
$this->event = new EM_Event($this->event_id, 'event_id');
|
565 |
+
}
|
566 |
+
return apply_filters('em_booking_get_event',$this->event, $this);
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Gets the ticket object this booking belongs to, saves a reference in ticket property
|
571 |
+
* @return EM_Tickets
|
572 |
+
*/
|
573 |
+
function get_tickets(){
|
574 |
+
if( is_object($this->tickets) && get_class($this->tickets)=='EM_Tickets' ){
|
575 |
+
return apply_filters('em_booking_get_tickets', $this->tickets, $this);
|
576 |
+
}else{
|
577 |
+
$this->tickets = new EM_Tickets($this);
|
578 |
+
}
|
579 |
+
return apply_filters('em_booking_get_tickets', $this->tickets, $this);
|
580 |
+
}
|
581 |
+
|
582 |
+
/**
|
583 |
+
* Gets the ticket object this booking belongs to, saves a reference in ticket property
|
584 |
+
* @return EM_Tickets_Bookings
|
585 |
+
*/
|
586 |
+
function get_tickets_bookings(){
|
587 |
+
global $wpdb;
|
588 |
+
if( !is_object($this->tickets_bookings) || get_class($this->tickets_bookings)!='EM_Tickets_Bookings'){
|
589 |
+
$this->tickets_bookings = new EM_Tickets_Bookings($this);
|
590 |
+
}
|
591 |
+
return apply_filters('em_booking_get_tickets_bookings', $this->tickets_bookings, $this);
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* @return EM_Person
|
596 |
+
*/
|
597 |
+
function get_person(){
|
598 |
+
global $EM_Person;
|
599 |
+
if( is_object($this->person) && get_class($this->person)=='EM_Person' && ($this->person->ID == $this->person_id || empty($this->person_id) ) ){
|
600 |
+
//This person is already included, so don't do anything
|
601 |
+
}elseif( is_object($EM_Person) && ($EM_Person->ID === $this->person_id || $this->booking_id == '') ){
|
602 |
+
$this->person = $EM_Person;
|
603 |
+
$this->person_id = $this->person->ID;
|
604 |
+
}elseif( is_numeric($this->person_id) ){
|
605 |
+
$this->person = new EM_Person($this->person_id);
|
606 |
+
}else{
|
607 |
+
$this->person = new EM_Person(0);
|
608 |
+
$this->person_id = $this->person->ID;
|
609 |
+
}
|
610 |
+
//if this user is the parent user of disabled registrations, replace user details here:
|
611 |
+
if( get_option('dbem_bookings_registration_disable') && $this->person->ID == get_option('dbem_bookings_registration_user') && (empty($this->person->loaded_no_user) || $this->person->loaded_no_user != $this->booking_id) ){
|
612 |
+
//override any registration data into the person objet
|
613 |
+
if( !empty($this->booking_meta['registration']) ){
|
614 |
+
foreach($this->booking_meta['registration'] as $key => $value){
|
615 |
+
$this->person->$key = $value;
|
616 |
+
}
|
617 |
+
}
|
618 |
+
$this->person->user_email = ( !empty($this->booking_meta['registration']['user_email']) ) ? $this->booking_meta['registration']['user_email']:$this->person->user_email;
|
619 |
+
if( !empty($this->booking_meta['registration']['user_name']) ){
|
620 |
+
$name_string = explode(' ',$this->booking_meta['registration']['user_name']);
|
621 |
+
$this->booking_meta['registration']['first_name'] = array_shift($name_string);
|
622 |
+
$this->booking_meta['registration']['last_name'] = implode(' ', $name_string);
|
623 |
+
}
|
624 |
+
$this->person->user_firstname = ( !empty($this->booking_meta['registration']['first_name']) ) ? $this->booking_meta['registration']['first_name']:__('Guest User','dbem');
|
625 |
+
$this->person->first_name = $this->person->user_firstname;
|
626 |
+
$this->person->user_lastname = ( !empty($this->booking_meta['registration']['last_name']) ) ? $this->booking_meta['registration']['last_name']:'';
|
627 |
+
$this->person->last_name = $this->person->user_lastname;
|
628 |
+
$this->person->phone = ( !empty($this->booking_meta['registration']['dbem_phone']) ) ? $this->booking_meta['registration']['dbem_phone']:__('Not Supplied','dbem');
|
629 |
+
//build display name
|
630 |
+
$full_name = $this->person->user_firstname . " " . $this->person->user_lastname ;
|
631 |
+
$full_name = trim($full_name);
|
632 |
+
$display_name = ( empty($full_name) ) ? __('Guest User','dbem'):$full_name;
|
633 |
+
$this->person->display_name = $display_name;
|
634 |
+
$this->person->loaded_no_user = $this->booking_id;
|
635 |
+
}
|
636 |
+
return apply_filters('em_booking_get_person', $this->person, $this);
|
637 |
+
}
|
638 |
+
|
639 |
+
/**
|
640 |
+
* Gets personal information from the $_REQUEST array and saves it to the $EM_Booking->booking_meta['registration'] array
|
641 |
+
* @return boolean
|
642 |
+
*/
|
643 |
+
function get_person_post(){
|
644 |
+
$user_data = array();
|
645 |
+
$registration = true;
|
646 |
+
if( empty($this->booking_meta['registration']) ) $this->booking_meta['registration'] = array();
|
647 |
+
// Check the e-mail address
|
648 |
+
if ( $_REQUEST['user_email'] == '' ) {
|
649 |
+
$registration = false;
|
650 |
+
$this->add_error(__( '<strong>ERROR</strong>: Please type your e-mail address.', 'dbem') );
|
651 |
+
} elseif ( !is_email( $_REQUEST['user_email'] ) ) {
|
652 |
+
$registration = false;
|
653 |
+
$this->add_error( __( '<strong>ERROR</strong>: The email address isn’t correct.', 'dbem') );
|
654 |
+
}elseif(email_exists( $_REQUEST['user_email'] ) && !get_option('dbem_bookings_registration_disable_user_emails') ){
|
655 |
+
$registration = false;
|
656 |
+
$this->add_error( get_option('dbem_booking_feedback_email_exists') );
|
657 |
+
}else{
|
658 |
+
$user_data['user_email'] = $_REQUEST['user_email'];
|
659 |
+
}
|
660 |
+
//Check the user name
|
661 |
+
if( !empty($_REQUEST['user_name']) ){
|
662 |
+
//split full name up and save full, first and last names
|
663 |
+
$user_data['user_name'] = wp_kses($_REQUEST['user_name'], array());
|
664 |
+
$name_string = explode(' ',$user_data['user_name']);
|
665 |
+
$user_data['first_name'] = array_shift($name_string);
|
666 |
+
$user_data['last_name'] = implode(' ', $name_string);
|
667 |
+
}else{
|
668 |
+
//Check the first/last name
|
669 |
+
$name_string = array();
|
670 |
+
if( !empty($_REQUEST['first_name']) ){
|
671 |
+
$user_data['first_name'] = $name_string[] = wp_kses($_REQUEST['first_name'], array());
|
672 |
+
}
|
673 |
+
if( !empty($_REQUEST['last_name']) ){
|
674 |
+
$user_data['last_name'] = $name_string[] = wp_kses($_REQUEST['last_name'], array());
|
675 |
+
}
|
676 |
+
if( !empty($name_string) ) $user_data['user_name'] = implode(' ', $name_string);
|
677 |
+
}
|
678 |
+
//Save full name
|
679 |
+
if( !empty($user_data['first_name']) || !empty($user_data['last_name']) )
|
680 |
+
//Check the phone
|
681 |
+
if( !empty($_REQUEST['dbem_phone']) ){
|
682 |
+
$user_data['dbem_phone'] = wp_kses($_REQUEST['dbem_phone'], array());
|
683 |
+
}
|
684 |
+
//Add booking meta
|
685 |
+
if( $registration ){
|
686 |
+
$this->booking_meta['registration'] = array_merge($this->booking_meta['registration'], $user_data); //in case someone else added stuff
|
687 |
+
}
|
688 |
+
$registration = apply_filters('em_booking_get_person_post', $registration, $this);
|
689 |
+
if( $registration ){
|
690 |
+
$this->feedback_message = __('Personal details have successfully been modified.', 'dbem');
|
691 |
+
}
|
692 |
+
return $registration;
|
693 |
+
}
|
694 |
+
|
695 |
+
/**
|
696 |
+
* Displays a form containing user fields, used in no-user booking mode for editing guest users within a booking
|
697 |
+
* @return string
|
698 |
+
*/
|
699 |
+
function get_person_editor(){
|
700 |
+
ob_start();
|
701 |
+
$name = $this->get_person()->get_name();
|
702 |
+
$email = $this->get_person()->user_email;
|
703 |
+
$phone = ($this->get_person()->phone != __('Not Supplied','dbem')) ? $this->get_person()->phone:'';
|
704 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'booking_modify_person' ){
|
705 |
+
$name = !empty($_REQUEST['user_name']) ? $_REQUEST['user_name']:$name;
|
706 |
+
$email = !empty($_REQUEST['user_email']) ? $_REQUEST['user_email']:$email;
|
707 |
+
$phone = !empty($_REQUEST['dbem_phone']) ? $_REQUEST['dbem_phone']:$phone;
|
708 |
+
}
|
709 |
+
?>
|
710 |
+
<table class="em-form-fields">
|
711 |
+
<tr><th><?php _e('Name','dbem'); ?> : </th><td><input type="text" name="user_name" value="<?php echo esc_attr($name); ?>" /></td></tr>
|
712 |
+
<tr><th><?php _e('Email','dbem'); ?> : </th><td><input type="text" name="user_email" value="<?php echo esc_attr($email); ?>" /></td></tr>
|
713 |
+
<tr><th><?php _e('Phone','dbem'); ?> : </th><td><input type="text" name="dbem_phone" value="<?php echo esc_attr($phone); ?>" /></td></tr>
|
714 |
+
</table>
|
715 |
+
<?php
|
716 |
+
return apply_filters('em_booking_get_person_editor', ob_get_clean(), $this);
|
717 |
+
}
|
718 |
+
|
719 |
+
/**
|
720 |
+
* Returns a string representation of the booking's status
|
721 |
+
* @return string
|
722 |
+
*/
|
723 |
+
function get_status(){
|
724 |
+
$status = ($this->booking_status == 0 && !get_option('dbem_bookings_approval') ) ? 1:$this->booking_status;
|
725 |
+
return apply_filters('em_booking_get_status', $this->status_array[$status], $this);
|
726 |
+
}
|
727 |
+
|
728 |
+
/**
|
729 |
+
* I wonder what this does....
|
730 |
+
* @return boolean
|
731 |
+
*/
|
732 |
+
function delete(){
|
733 |
+
global $wpdb;
|
734 |
+
$result = false;
|
735 |
+
if( $this->can_manage('manage_bookings','manage_others_bookings') ){
|
736 |
+
$sql = $wpdb->prepare("DELETE FROM ". EM_BOOKINGS_TABLE . " WHERE booking_id=%d", $this->booking_id);
|
737 |
+
$result = $wpdb->query( $sql );
|
738 |
+
if( $result !== false ){
|
739 |
+
//delete the tickets too
|
740 |
+
$this->get_tickets_bookings()->delete();
|
741 |
+
$this->previous_status = $this->booking_status;
|
742 |
+
$this->booking_status = false;
|
743 |
+
$this->feedback_message = sprintf(__('%s deleted', 'dbem'), __('Booking','dbem'));
|
744 |
+
$wpdb->delete( EM_META_TABLE, array('meta_key'=>'booking-note', 'object_id' => $this->booking_id), array('%s','%d'));
|
745 |
+
}else{
|
746 |
+
$this->add_error(sprintf(__('%s could not be deleted', 'dbem'), __('Booking','dbem')));
|
747 |
+
}
|
748 |
+
}
|
749 |
+
return apply_filters('em_booking_delete',( $result !== false ), $this);
|
750 |
+
}
|
751 |
+
|
752 |
+
function cancel($email = true){
|
753 |
+
if( $this->person->ID == get_current_user_id() ){
|
754 |
+
$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.
|
755 |
+
}
|
756 |
+
return $this->set_status(3, $email);
|
757 |
+
}
|
758 |
+
|
759 |
+
/**
|
760 |
+
* Approve a booking.
|
761 |
+
* @return bool
|
762 |
+
*/
|
763 |
+
function approve($email = true, $ignore_spaces = false){
|
764 |
+
return $this->set_status(1, $email, $ignore_spaces);
|
765 |
+
}
|
766 |
+
/**
|
767 |
+
* Reject a booking and save
|
768 |
+
* @return bool
|
769 |
+
*/
|
770 |
+
function reject($email = true){
|
771 |
+
return $this->set_status(2, $email);
|
772 |
+
}
|
773 |
+
/**
|
774 |
+
* Unapprove a booking.
|
775 |
+
* @return bool
|
776 |
+
*/
|
777 |
+
function unapprove($email = true){
|
778 |
+
return $this->set_status(0, $email);
|
779 |
+
}
|
780 |
+
|
781 |
+
/**
|
782 |
+
* Change the status of the booking. This will save to the Database too.
|
783 |
+
* @param int $status
|
784 |
+
* @return boolean
|
785 |
+
*/
|
786 |
+
function set_status($status, $email = true, $ignore_spaces = false){
|
787 |
+
global $wpdb;
|
788 |
+
$action_string = strtolower($this->status_array[$status]);
|
789 |
+
//if we're approving we can't approve a booking if spaces are full, so check before it's approved.
|
790 |
+
if(!$ignore_spaces && $status == 1){
|
791 |
+
if( !$this->is_reserved() && $this->get_event()->get_bookings()->get_available_spaces() < $this->get_spaces() && !get_option('dbem_bookings_approval_overbooking') ){
|
792 |
+
$this->feedback_message = sprintf(__('Not approved, spaces full.','dbem'), $action_string);
|
793 |
+
$this->add_error($this->feedback_message);
|
794 |
+
return apply_filters('em_booking_set_status', false, $this);
|
795 |
+
}
|
796 |
+
}
|
797 |
+
$this->previous_status = $this->booking_status;
|
798 |
+
$this->booking_status = $status;
|
799 |
+
$result = $wpdb->query($wpdb->prepare('UPDATE '.EM_BOOKINGS_TABLE.' SET booking_status=%d WHERE booking_id=%d', array($status, $this->booking_id)));
|
800 |
+
if($result !== false){
|
801 |
+
$this->feedback_message = sprintf(__('Booking %s.','dbem'), $action_string);
|
802 |
+
if( $email ){
|
803 |
+
if( $this->email() ){
|
804 |
+
if( $this->mails_sent > 0 ){
|
805 |
+
$this->feedback_message .= " ".__('Email Sent.','dbem');
|
806 |
+
}
|
807 |
+
}else{
|
808 |
+
//extra errors may be logged by email() in EM_Object
|
809 |
+
$this->feedback_message .= ' <span style="color:red">'.__('ERROR : Email Not Sent.','dbem').'</span>';
|
810 |
+
$this->add_error(__('ERROR : Email Not Sent.','dbem'));
|
811 |
+
}
|
812 |
+
}
|
813 |
+
}else{
|
814 |
+
//errors should be logged by save()
|
815 |
+
$this->feedback_message = sprintf(__('Booking could not be %s.','dbem'), $action_string);
|
816 |
+
$this->add_error(sprintf(__('Booking could not be %s.','dbem'), $action_string));
|
817 |
+
$result = false;
|
818 |
+
}
|
819 |
+
return apply_filters('em_booking_set_status', $result, $this);
|
820 |
+
}
|
821 |
+
|
822 |
+
/**
|
823 |
+
* Returns true if booking is reserving a space at this event, whether confirmed or not
|
824 |
+
*/
|
825 |
+
function is_reserved(){
|
826 |
+
$result = false;
|
827 |
+
if( $this->booking_status == 0 && get_option('dbem_bookings_approval_reserved') ){
|
828 |
+
$result = true;
|
829 |
+
}elseif( $this->booking_status == 0 && !get_option('dbem_bookings_approval') ){
|
830 |
+
$result = true;
|
831 |
+
}elseif( $this->booking_status == 1 ){
|
832 |
+
$result = true;
|
833 |
+
}
|
834 |
+
return apply_filters('em_booking_is_reserved', $result, $this);
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* Returns true if booking is either pending or reserved but not confirmed (which is assumed pending)
|
839 |
+
*/
|
840 |
+
function is_pending(){
|
841 |
+
$result = ($this->is_reserved() || $this->booking_status == 0) && $this->booking_status != 1;
|
842 |
+
return apply_filters('em_booking_is_pending', $result, $this);
|
843 |
+
}
|
844 |
+
|
845 |
+
/**
|
846 |
+
* Add a booking note to this booking. returns wpdb result or false if use can't manage this event.
|
847 |
+
* @param string $note
|
848 |
+
* @return mixed
|
849 |
+
*/
|
850 |
+
function add_note( $note_text ){
|
851 |
+
global $wpdb;
|
852 |
+
if( $this->can_manage() ){
|
853 |
+
$this->get_notes();
|
854 |
+
$note = array('author'=>get_current_user_id(),'note'=>$note_text,'timestamp'=>current_time('timestamp'));
|
855 |
+
$this->notes[] = wp_kses_data($note);
|
856 |
+
$this->feedback_message = __('Booking note successfully added.','dbem');
|
857 |
+
return $wpdb->insert(EM_META_TABLE, array('object_id'=>$this->booking_id, 'meta_key'=>'booking-note', 'meta_value'=> serialize($note)),array('%d','%s','%s'));
|
858 |
+
}
|
859 |
+
return false;
|
860 |
+
}
|
861 |
+
|
862 |
+
function get_admin_url(){
|
863 |
+
if( get_option('dbem_edit_bookings_page') && (!is_admin() || !empty($_REQUEST['is_public'])) ){
|
864 |
+
$my_bookings_page = get_permalink(get_option('dbem_edit_bookings_page'));
|
865 |
+
$bookings_link = em_add_get_params($my_bookings_page, array('event_id'=>$this->event_id, 'booking_id'=>$this->booking_id), false);
|
866 |
+
}else{
|
867 |
+
if( $this->get_event()->blog_id != get_current_blog_id() ){
|
868 |
+
$bookings_link = get_admin_url($this->get_event()->blog_id, 'edit.php?post_type='.EM_POST_TYPE_EVENT."&page=events-manager-bookings&event_id=".$this->event_id."&booking_id=".$this->booking_id);
|
869 |
+
}else{
|
870 |
+
$bookings_link = EM_ADMIN_URL. "&page=events-manager-bookings&event_id=".$this->event_id."&booking_id=".$this->booking_id;
|
871 |
+
}
|
872 |
+
}
|
873 |
+
return apply_filters('em_booking_get_bookings_url', $bookings_link, $this);
|
874 |
+
}
|
875 |
+
|
876 |
+
function output($format, $target="html") {
|
877 |
+
preg_match_all("/(#@?_?[A-Za-z0-9]+)({([^}]+)})?/", $format, $placeholders);
|
878 |
+
foreach( $this->get_tickets() as $EM_Ticket){ /* @var $EM_Ticket EM_Ticket */ break; } //Get first ticket for single ticket placeholders
|
879 |
+
$output_string = $format;
|
880 |
+
$replaces = array();
|
881 |
+
foreach($placeholders[1] as $key => $result) {
|
882 |
+
$replace = '';
|
883 |
+
$full_result = $placeholders[0][$key];
|
884 |
+
switch( $result ){
|
885 |
+
case '#_BOOKINGID':
|
886 |
+
$replace = $this->booking_id;
|
887 |
+
break;
|
888 |
+
case '#_RESPNAME' : //Depreciated
|
889 |
+
case '#_BOOKINGNAME':
|
890 |
+
$replace = $this->get_person()->get_name();
|
891 |
+
break;
|
892 |
+
case '#_RESPEMAIL' : //Depreciated
|
893 |
+
case '#_BOOKINGEMAIL':
|
894 |
+
$replace = $this->get_person()->user_email;
|
895 |
+
break;
|
896 |
+
case '#_RESPPHONE' : //Depreciated
|
897 |
+
case '#_BOOKINGPHONE':
|
898 |
+
$replace = $this->get_person()->phone;
|
899 |
+
break;
|
900 |
+
case '#_BOOKINGSPACES':
|
901 |
+
$replace = $this->get_spaces();
|
902 |
+
break;
|
903 |
+
case '#_BOOKINGDATE':
|
904 |
+
$replace = ( $this->timestamp ) ? date_i18n(get_option('dbem_date_format'), $this->timestamp):'n/a';
|
905 |
+
break;
|
906 |
+
case '#_BOOKINGTIME':
|
907 |
+
$replace = ( $this->timestamp ) ? date_i18n(get_option('dbem_time_format'), $this->timestamp):'n/a';
|
908 |
+
break;
|
909 |
+
case '#_BOOKINGDATETIME':
|
910 |
+
$replace = ( $this->timestamp ) ? date_i18n(get_option('dbem_date_format').' '.get_option('dbem_time_format'), $this->timestamp):'n/a';
|
911 |
+
break;
|
912 |
+
case '#_BOOKINGLISTURL':
|
913 |
+
$replace = em_get_my_bookings_url();
|
914 |
+
break;
|
915 |
+
case '#_COMMENT' : //Depreciated
|
916 |
+
case '#_BOOKINGCOMMENT':
|
917 |
+
$replace = $this->booking_comment;
|
918 |
+
break;
|
919 |
+
$replace = $this->get_price(true); //if there's tax, it'll be added here
|
920 |
+
break;
|
921 |
+
case '#_BOOKINGPRICEWITHOUTTAX':
|
922 |
+
$replace = $this->format_price($this->get_price() - $this->get_price_taxes());
|
923 |
+
break;
|
924 |
+
case '#_BOOKINGPRICETAX':
|
925 |
+
$replace = $this->get_price_taxes(true);
|
926 |
+
break;
|
927 |
+
case '#_BOOKINGPRICEWITHTAX':
|
928 |
+
case '#_BOOKINGPRICE':
|
929 |
+
$replace = $this->get_price(true);
|
930 |
+
break;
|
931 |
+
case '#_BOOKINGTICKETNAME':
|
932 |
+
$replace = $EM_Ticket->name;
|
933 |
+
break;
|
934 |
+
case '#_BOOKINGTICKETDESCRIPTION':
|
935 |
+
$replace = $EM_Ticket->description;
|
936 |
+
break;
|
937 |
+
case '#_BOOKINGTICKETPRICEWITHTAX':
|
938 |
+
$replace = $this->format_price( $EM_Ticket->get_price_without_tax() * (1+$this->get_tax_rate()/100) );
|
939 |
+
break;
|
940 |
+
case '#_BOOKINGTICKETPRICEWITHOUTTAX':
|
941 |
+
$replace = $EM_Ticket->get_price_without_tax(true);
|
942 |
+
break;
|
943 |
+
case '#_BOOKINGTICKETTAX':
|
944 |
+
$replace = $this->format_price( $EM_Ticket->get_price_without_tax() * ($this->get_tax_rate()/100) );
|
945 |
+
break;
|
946 |
+
case '#_BOOKINGTICKETPRICE':
|
947 |
+
$replace = $EM_Ticket->get_price(true);
|
948 |
+
break;
|
949 |
+
case '#_BOOKINGTICKETS':
|
950 |
+
ob_start();
|
951 |
+
em_locate_template('emails/bookingtickets.php', true, array('EM_Booking'=>$this));
|
952 |
+
$replace = ob_get_clean();
|
953 |
+
break;
|
954 |
+
case '#_BOOKINGSUMMARY':
|
955 |
+
ob_start();
|
956 |
+
em_locate_template('emails/bookingsummary.php', true, array('EM_Booking'=>$this));
|
957 |
+
$replace = ob_get_clean();
|
958 |
+
break;
|
959 |
+
default:
|
960 |
+
$replace = $full_result;
|
961 |
+
break;
|
962 |
+
}
|
963 |
+
$replaces[$full_result] = apply_filters('em_booking_output_placeholder', $replace, $this, $full_result, $target);
|
964 |
+
}
|
965 |
+
//sort out replacements so that during replacements shorter placeholders don't overwrite longer varieties.
|
966 |
+
krsort($replaces);
|
967 |
+
foreach($replaces as $full_result => $replacement){
|
968 |
+
$output_string = str_replace($full_result, $replacement , $output_string );
|
969 |
+
}
|
970 |
+
//run event output too, since this is never run from within events and will not infinitely loop
|
971 |
+
$EM_Event = apply_filters('em_booking_output_event', $this->get_event(), $this); //allows us to override the booking event info if it belongs to a parent or translation
|
972 |
+
$output_string = $EM_Event->output($output_string, $target);
|
973 |
+
return apply_filters('em_booking_output', $output_string, $this, $format, $target);
|
974 |
+
}
|
975 |
+
|
976 |
+
/**
|
977 |
+
* @param EM_Booking $EM_Booking
|
978 |
+
* @param EM_Event $event
|
979 |
+
* @return boolean
|
980 |
+
*/
|
981 |
+
function email( $email_admin = true, $force_resend = false, $email_attendee = true ){
|
982 |
+
global $EM_Mailer;
|
983 |
+
$result = true;
|
984 |
+
$this->mails_sent = 0;
|
985 |
+
|
986 |
+
//FIXME ticket logic needed
|
987 |
+
$EM_Event = $this->get_event(); //We NEED event details here.
|
988 |
+
$EM_Event->get_bookings(true); //refresh all bookings
|
989 |
+
|
990 |
+
//Make sure event matches booking, and that booking used to be approved.
|
991 |
+
if( $this->booking_status !== $this->previous_status || $force_resend ){
|
992 |
+
//messages can be overriden just before being sent
|
993 |
+
$msg = $this->email_messages();
|
994 |
+
$output_type = get_option('dbem_smtp_html') ? 'html':'email';
|
995 |
+
|
996 |
+
//Send user (booker) emails
|
997 |
+
if( !empty($msg['user']['subject']) && $email_attendee ){
|
998 |
+
$msg['user']['subject'] = $this->output($msg['user']['subject'], 'raw');
|
999 |
+
$msg['user']['body'] = $this->output($msg['user']['body'], $output_type);
|
1000 |
+
//Send to the person booking
|
1001 |
+
if( !$this->email_send( $msg['user']['subject'], $msg['user']['body'], $this->get_person()->user_email) ){
|
1002 |
+
$result = false;
|
1003 |
+
}else{
|
1004 |
+
$this->mails_sent++;
|
1005 |
+
}
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
//Send admin/contact emails if this isn't the event owner or an events admin
|
1009 |
+
if( $email_admin && !empty($msg['admin']['subject']) ){ //emails won't be sent if admin is logged in unless they book themselves
|
1010 |
+
//get admin emails that need to be notified, hook here to add extra admin emails
|
1011 |
+
$admin_emails = str_replace(' ','',get_option('dbem_bookings_notify_admin'));
|
1012 |
+
$admin_emails = apply_filters('em_booking_admin_emails', explode(',', $admin_emails), $this); //supply emails as array
|
1013 |
+
if( get_option('dbem_bookings_contact_email') == 1 && !empty($EM_Event->get_contact()->user_email) ){
|
1014 |
+
//add event owner contact email to list of admin emails
|
1015 |
+
$admin_emails[] = $EM_Event->get_contact()->user_email;
|
1016 |
+
}
|
1017 |
+
foreach($admin_emails as $key => $email){ if( !is_email($email) ) unset($admin_emails[$key]); } //remove bad emails
|
1018 |
+
//proceed to email admins if need be
|
1019 |
+
if( !empty($admin_emails) ){
|
1020 |
+
//Only gets sent if this is a pending booking, unless approvals are disabled.
|
1021 |
+
$msg['admin']['subject'] = $this->output($msg['admin']['subject'],'raw');
|
1022 |
+
$msg['admin']['body'] = $this->output($msg['admin']['body'], $output_type);
|
1023 |
+
//email admins
|
1024 |
+
if( !$this->email_send( $msg['admin']['subject'], $msg['admin']['body'], $admin_emails) && current_user_can('list_users') ){
|
1025 |
+
$this->errors[] = __('Confirmation email could not be sent to admin. Registrant should have gotten their email (only admin see this warning).','dbem');
|
1026 |
+
$result = false;
|
1027 |
+
}else{
|
1028 |
+
$this->mails_sent++;
|
1029 |
+
}
|
1030 |
+
}
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
return $result;
|
1034 |
+
//TODO need error checking for booking mail send
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
function email_messages(){
|
1038 |
+
$msg = array( 'user'=> array('subject'=>'', 'body'=>''), 'admin'=> array('subject'=>'', 'body'=>'')); //blank msg template
|
1039 |
+
//admin messages won't change whether pending or already approved
|
1040 |
+
switch( $this->booking_status ){
|
1041 |
+
case 0:
|
1042 |
+
case 5: //TODO remove offline status from here and move to pro
|
1043 |
+
$msg['user']['subject'] = get_option('dbem_bookings_email_pending_subject');
|
1044 |
+
$msg['user']['body'] = get_option('dbem_bookings_email_pending_body');
|
1045 |
+
//admins should get something (if set to)
|
1046 |
+
$msg['admin']['subject'] = get_option('dbem_bookings_contact_email_pending_subject');
|
1047 |
+
$msg['admin']['body'] = get_option('dbem_bookings_contact_email_pending_body');
|
1048 |
+
break;
|
1049 |
+
case 1:
|
1050 |
+
$msg['user']['subject'] = get_option('dbem_bookings_email_confirmed_subject');
|
1051 |
+
$msg['user']['body'] = get_option('dbem_bookings_email_confirmed_body');
|
1052 |
+
//admins should get something (if set to)
|
1053 |
+
$msg['admin']['subject'] = get_option('dbem_bookings_contact_email_confirmed_subject');
|
1054 |
+
$msg['admin']['body'] = get_option('dbem_bookings_contact_email_confirmed_body');
|
1055 |
+
break;
|
1056 |
+
case 2:
|
1057 |
+
$msg['user']['subject'] = get_option('dbem_bookings_email_rejected_subject');
|
1058 |
+
$msg['user']['body'] = get_option('dbem_bookings_email_rejected_body');
|
1059 |
+
//admins should get something (if set to)
|
1060 |
+
$msg['admin']['subject'] = get_option('dbem_bookings_contact_email_rejected_subject');
|
1061 |
+
$msg['admin']['body'] = get_option('dbem_bookings_contact_email_rejected_body');
|
1062 |
+
break;
|
1063 |
+
case 3:
|
1064 |
+
$msg['user']['subject'] = get_option('dbem_bookings_email_cancelled_subject');
|
1065 |
+
$msg['user']['body'] = get_option('dbem_bookings_email_cancelled_body');
|
1066 |
+
//admins should get something (if set to)
|
1067 |
+
$msg['admin']['subject'] = get_option('dbem_bookings_contact_email_cancelled_subject');
|
1068 |
+
$msg['admin']['body'] = get_option('dbem_bookings_contact_email_cancelled_body');
|
1069 |
+
break;
|
1070 |
+
}
|
1071 |
+
return apply_filters('em_booking_email_messages', $msg, $this);
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
/**
|
1075 |
+
* Can the user manage this event?
|
1076 |
+
*/
|
1077 |
+
function can_manage( $owner_capability = false, $admin_capability = false, $user_to_check = false ){
|
1078 |
+
return $this->get_event()->can_manage('manage_bookings','manage_others_bookings') || empty($this->booking_id) || !empty($this->manage_override);
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
/**
|
1082 |
+
* Returns this object in the form of an array
|
1083 |
+
* @return array
|
1084 |
+
*/
|
1085 |
+
function to_array($person = false){
|
1086 |
+
$booking = array();
|
1087 |
+
//Core Data
|
1088 |
+
$booking = parent::to_array();
|
1089 |
+
//Person Data
|
1090 |
+
if($person && is_object($this->person)){
|
1091 |
+
$person = $this->person->to_array();
|
1092 |
+
$booking = array_merge($booking, $person);
|
1093 |
+
}
|
1094 |
+
return $booking;
|
1095 |
+
}
|
1096 |
+
}
|
|
|
|
|
|
|
|
|
1097 |
?>
|
classes/em-bookings-table.php
CHANGED
@@ -1,641 +1,645 @@
|
|
1 |
-
<?php
|
2 |
-
//Builds a table of bookings, still work in progress...
|
3 |
-
class EM_Bookings_Table{
|
4 |
-
/**
|
5 |
-
* associative array of collumns that'll be shown in order from left to right
|
6 |
-
*
|
7 |
-
* * key - collumn name in the databse, what will be used when searching
|
8 |
-
* * value - label for use in collumn headers
|
9 |
-
* @var array
|
10 |
-
*/
|
11 |
-
public $cols = array('user_name','event_name','booking_spaces','booking_status','booking_price','actions');
|
12 |
-
/**
|
13 |
-
* Asoociative array of available collumn keys and corresponding headers, which will be used to display this table of bookings
|
14 |
-
* @var unknown_type
|
15 |
-
*/
|
16 |
-
public $cols_template = array();
|
17 |
-
public $sortable_cols = array('booking_date');
|
18 |
-
/**
|
19 |
-
* Object we're viewing bookings in relation to.
|
20 |
-
* @var object
|
21 |
-
*/
|
22 |
-
public $cols_view;
|
23 |
-
/**
|
24 |
-
* Index key used for looking up status information we're filtering in the booking table
|
25 |
-
* @var string
|
26 |
-
*/
|
27 |
-
public $string = 'needs-attention';
|
28 |
-
/**
|
29 |
-
* Associative array of status information.
|
30 |
-
*
|
31 |
-
* * key - status index value
|
32 |
-
* * value - associative array containing keys
|
33 |
-
* ** label - the label for use in filter forms
|
34 |
-
* ** search - array or integer status numbers to search
|
35 |
-
*
|
36 |
-
* @var array
|
37 |
-
*/
|
38 |
-
public $statuses = array();
|
39 |
-
/**
|
40 |
-
* Maximum number of rows to show
|
41 |
-
* @var int
|
42 |
-
*/
|
43 |
-
public $limit = 20;
|
44 |
-
public $order = 'ASC';
|
45 |
-
public $orderby = 'booking_name';
|
46 |
-
public $page = 1;
|
47 |
-
public $offset = 0;
|
48 |
-
public $scope = 'future';
|
49 |
-
public $show_tickets = false;
|
50 |
-
|
51 |
-
function __construct($show_tickets = false){
|
52 |
-
$this->statuses = array(
|
53 |
-
'all' => array('label'=>__('All','dbem'), 'search'=>false),
|
54 |
-
'pending' => array('label'=>__('Pending','dbem'), 'search'=>0),
|
55 |
-
'confirmed' => array('label'=>__('Confirmed','dbem'), 'search'=>1),
|
56 |
-
'cancelled' => array('label'=>__('Cancelled','dbem'), 'search'=>3),
|
57 |
-
'rejected' => array('label'=>__('Rejected','dbem'), 'search'=>2),
|
58 |
-
'needs-attention' => array('label'=>__('Needs Attention','dbem'), 'search'=>array(0)),
|
59 |
-
'incomplete' => array('label'=>__('Incomplete Bookings','dbem'), 'search'=>array(0))
|
60 |
-
);
|
61 |
-
if( !get_option('dbem_bookings_approval') ){
|
62 |
-
unset($this->statuses['pending']);
|
63 |
-
unset($this->statuses['incomplete']);
|
64 |
-
$this->statuses['confirmed']['search'] = array(0,1);
|
65 |
-
}
|
66 |
-
//Set basic vars
|
67 |
-
$this->order = ( !empty($_REQUEST ['order']) && $_REQUEST ['order'] == 'DESC' ) ? 'DESC':'ASC';
|
68 |
-
$this->orderby = ( !empty($_REQUEST ['order'])
|
69 |
-
$this->limit = ( !empty($_REQUEST['limit']) && is_numeric($_REQUEST['
|
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()) ) ? $_REQUEST
|
73 |
-
$this->status = ( !empty($_REQUEST['status']) && array_key_exists($_REQUEST['status'], $this->statuses) ) ? $_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','dbem'),
|
77 |
-
'first_name'=>__('First Name','dbem'),
|
78 |
-
'last_name'=>__('Last Name','dbem'),
|
79 |
-
'event_name'=>__('Event','dbem'),
|
80 |
-
'event_date'=>__('Event Date(s)','dbem'),
|
81 |
-
'event_time'=>__('Event Time(s)','dbem'),
|
82 |
-
'user_email'=>__('E-mail','dbem'),
|
83 |
-
'dbem_phone'=>__('Phone Number','dbem'),
|
84 |
-
'booking_spaces'=>__('Spaces','dbem'),
|
85 |
-
'booking_status'=>__('Status','dbem'),
|
86 |
-
'booking_date'=>__('Booking Date','dbem'),
|
87 |
-
'booking_price'=>__('Total','dbem'),
|
88 |
-
'booking_id'=>__('Booking ID','dbem'),
|
89 |
-
'booking_comment'=>__('Booking Comment','dbem')
|
90 |
-
), $this);
|
91 |
-
$this->cols_tickets_template = apply_filters('em_bookings_table_cols_tickets_template', array(
|
92 |
-
'ticket_name'=>__('Ticket Name','dbem'),
|
93 |
-
'ticket_description'=>__('Ticket Description','dbem'),
|
94 |
-
'ticket_price'=>__('Ticket Price','dbem'),
|
95 |
-
'ticket_id'=>__('Ticket ID','dbem')
|
96 |
-
), $this);
|
97 |
-
//add tickets to template if we're showing rows by booking-ticket
|
98 |
-
if( $show_tickets ){
|
99 |
-
$this->show_tickets = true;
|
100 |
-
$this->cols = array('user_name','event_name','ticket_name','ticket_price','booking_spaces','booking_status','actions');
|
101 |
-
$this->cols_template = array_merge( $this->cols_template, $this->cols_tickets_template);
|
102 |
-
}
|
103 |
-
$this->cols_template['actions'] = __('Actions','dbem');
|
104 |
-
//calculate collumns if post requests
|
105 |
-
if( !empty($_REQUEST ['cols'])
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
$
|
128 |
-
}
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
$
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
$
|
210 |
-
|
211 |
-
|
212 |
-
$
|
213 |
-
|
214 |
-
|
215 |
-
$
|
216 |
-
$
|
217 |
-
|
218 |
-
|
219 |
-
$
|
220 |
-
|
221 |
-
|
222 |
-
$
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
do_action('
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
<?php
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
<?php
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
<?php
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
<?php
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
<?php if( $
|
330 |
-
<input type="hidden" name="
|
331 |
-
<?php endif; ?>
|
332 |
-
<?php if( $
|
333 |
-
<input type="hidden" name="
|
334 |
-
<?php endif; ?>
|
335 |
-
|
336 |
-
<input type="hidden" name="
|
337 |
-
|
338 |
-
<input type="hidden" name="
|
339 |
-
<input type="hidden" name="
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
$this->
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
<?php if( $
|
358 |
-
<input type="hidden" name="
|
359 |
-
<?php endif; ?>
|
360 |
-
<?php if( $
|
361 |
-
<input type="hidden" name="
|
362 |
-
<?php endif; ?>
|
363 |
-
|
364 |
-
<input type="hidden" name="
|
365 |
-
|
366 |
-
<input type="hidden" name="
|
367 |
-
<input type="hidden" name="
|
368 |
-
<input type="hidden" name="
|
369 |
-
<input type="hidden" name="
|
370 |
-
|
371 |
-
<
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
<
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
<option value="
|
392 |
-
<option value="
|
393 |
-
<option value="
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
<?php
|
410 |
-
<?php
|
411 |
-
<?php
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
/*
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
if(
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
$
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
}elseif($col == '
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
}elseif($col == '
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
}elseif($col == '
|
558 |
-
|
559 |
-
}elseif(
|
560 |
-
$
|
561 |
-
}elseif(
|
562 |
-
$
|
563 |
-
}elseif( $col == '
|
564 |
-
$
|
565 |
-
}elseif( $col == '
|
566 |
-
$
|
567 |
-
}elseif( $col == '
|
568 |
-
$
|
569 |
-
}elseif( $col == '
|
570 |
-
$
|
571 |
-
}elseif( $col == '
|
572 |
-
$
|
573 |
-
}
|
574 |
-
$val =
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
|
|
|
|
|
|
|
|
641 |
?>
|
1 |
+
<?php
|
2 |
+
//Builds a table of bookings, still work in progress...
|
3 |
+
class EM_Bookings_Table{
|
4 |
+
/**
|
5 |
+
* associative array of collumns that'll be shown in order from left to right
|
6 |
+
*
|
7 |
+
* * key - collumn name in the databse, what will be used when searching
|
8 |
+
* * value - label for use in collumn headers
|
9 |
+
* @var array
|
10 |
+
*/
|
11 |
+
public $cols = array('user_name','event_name','booking_spaces','booking_status','booking_price','actions');
|
12 |
+
/**
|
13 |
+
* Asoociative array of available collumn keys and corresponding headers, which will be used to display this table of bookings
|
14 |
+
* @var unknown_type
|
15 |
+
*/
|
16 |
+
public $cols_template = array();
|
17 |
+
public $sortable_cols = array('booking_date');
|
18 |
+
/**
|
19 |
+
* Object we're viewing bookings in relation to.
|
20 |
+
* @var object
|
21 |
+
*/
|
22 |
+
public $cols_view;
|
23 |
+
/**
|
24 |
+
* Index key used for looking up status information we're filtering in the booking table
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
public $string = 'needs-attention';
|
28 |
+
/**
|
29 |
+
* Associative array of status information.
|
30 |
+
*
|
31 |
+
* * key - status index value
|
32 |
+
* * value - associative array containing keys
|
33 |
+
* ** label - the label for use in filter forms
|
34 |
+
* ** search - array or integer status numbers to search
|
35 |
+
*
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
public $statuses = array();
|
39 |
+
/**
|
40 |
+
* Maximum number of rows to show
|
41 |
+
* @var int
|
42 |
+
*/
|
43 |
+
public $limit = 20;
|
44 |
+
public $order = 'ASC';
|
45 |
+
public $orderby = 'booking_name';
|
46 |
+
public $page = 1;
|
47 |
+
public $offset = 0;
|
48 |
+
public $scope = 'future';
|
49 |
+
public $show_tickets = false;
|
50 |
+
|
51 |
+
function __construct($show_tickets = false){
|
52 |
+
$this->statuses = array(
|
53 |
+
'all' => array('label'=>__('All','dbem'), 'search'=>false),
|
54 |
+
'pending' => array('label'=>__('Pending','dbem'), 'search'=>0),
|
55 |
+
'confirmed' => array('label'=>__('Confirmed','dbem'), 'search'=>1),
|
56 |
+
'cancelled' => array('label'=>__('Cancelled','dbem'), 'search'=>3),
|
57 |
+
'rejected' => array('label'=>__('Rejected','dbem'), 'search'=>2),
|
58 |
+
'needs-attention' => array('label'=>__('Needs Attention','dbem'), 'search'=>array(0)),
|
59 |
+
'incomplete' => array('label'=>__('Incomplete Bookings','dbem'), 'search'=>array(0))
|
60 |
+
);
|
61 |
+
if( !get_option('dbem_bookings_approval') ){
|
62 |
+
unset($this->statuses['pending']);
|
63 |
+
unset($this->statuses['incomplete']);
|
64 |
+
$this->statuses['confirmed']['search'] = array(0,1);
|
65 |
+
}
|
66 |
+
//Set basic vars
|
67 |
+
$this->order = ( !empty($_REQUEST ['order']) && $_REQUEST ['order'] == 'DESC' ) ? 'DESC':'ASC';
|
68 |
+
$this->orderby = ( !empty($_REQUEST ['order']) ) ? sanitize_sql_orderby($_REQUEST['order']):'booking_name';
|
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','dbem'),
|
77 |
+
'first_name'=>__('First Name','dbem'),
|
78 |
+
'last_name'=>__('Last Name','dbem'),
|
79 |
+
'event_name'=>__('Event','dbem'),
|
80 |
+
'event_date'=>__('Event Date(s)','dbem'),
|
81 |
+
'event_time'=>__('Event Time(s)','dbem'),
|
82 |
+
'user_email'=>__('E-mail','dbem'),
|
83 |
+
'dbem_phone'=>__('Phone Number','dbem'),
|
84 |
+
'booking_spaces'=>__('Spaces','dbem'),
|
85 |
+
'booking_status'=>__('Status','dbem'),
|
86 |
+
'booking_date'=>__('Booking Date','dbem'),
|
87 |
+
'booking_price'=>__('Total','dbem'),
|
88 |
+
'booking_id'=>__('Booking ID','dbem'),
|
89 |
+
'booking_comment'=>__('Booking Comment','dbem')
|
90 |
+
), $this);
|
91 |
+
$this->cols_tickets_template = apply_filters('em_bookings_table_cols_tickets_template', array(
|
92 |
+
'ticket_name'=>__('Ticket Name','dbem'),
|
93 |
+
'ticket_description'=>__('Ticket Description','dbem'),
|
94 |
+
'ticket_price'=>__('Ticket Price','dbem'),
|
95 |
+
'ticket_id'=>__('Ticket ID','dbem')
|
96 |
+
), $this);
|
97 |
+
//add tickets to template if we're showing rows by booking-ticket
|
98 |
+
if( $show_tickets ){
|
99 |
+
$this->show_tickets = true;
|
100 |
+
$this->cols = array('user_name','event_name','ticket_name','ticket_price','booking_spaces','booking_status','actions');
|
101 |
+
$this->cols_template = array_merge( $this->cols_template, $this->cols_tickets_template);
|
102 |
+
}
|
103 |
+
$this->cols_template['actions'] = __('Actions','dbem');
|
104 |
+
//calculate collumns if post requests
|
105 |
+
if( !empty($_REQUEST ['cols']) ){
|
106 |
+
if( is_array($_REQUEST ['cols']) ){
|
107 |
+
array_walk($_REQUEST['cols'], 'sanitize_text_field');
|
108 |
+
$this->cols = $_REQUEST['cols'];
|
109 |
+
}else{
|
110 |
+
$this->cols = explode(',',sanitize_text_field($_REQUEST['cols']));
|
111 |
+
}
|
112 |
+
}
|
113 |
+
//load collumn view settings
|
114 |
+
if( $this->get_person() !== false ){
|
115 |
+
$this->cols_view = $this->get_person();
|
116 |
+
}elseif( $this->get_ticket() !== false ){
|
117 |
+
$this->cols_view = $this->get_ticket();
|
118 |
+
}elseif( $this->get_event() !== false ){
|
119 |
+
$this->cols_view = $this->get_event();
|
120 |
+
}
|
121 |
+
//save collumns depending on context and user preferences
|
122 |
+
if( empty($_REQUEST['cols']) ){
|
123 |
+
if(!empty($this->cols_view) && is_object($this->cols_view)){
|
124 |
+
//check if user has settings for object type
|
125 |
+
$settings = get_user_meta(get_current_user_id(), 'em_bookings_view-'.get_class($this->cols_view), true );
|
126 |
+
}else{
|
127 |
+
$settings = get_user_meta(get_current_user_id(), 'em_bookings_view', true );
|
128 |
+
}
|
129 |
+
if( !empty($settings) ){
|
130 |
+
$this->cols = $settings;
|
131 |
+
}
|
132 |
+
}elseif( !empty($_REQUEST['cols']) && empty($_REQUEST['no_save']) ){ //save view settings for next time
|
133 |
+
if( !empty($this->cols_view) && is_object($this->cols_view) ){
|
134 |
+
update_user_meta(get_current_user_id(), 'em_bookings_view-'.get_class($this->cols_view), $this->cols );
|
135 |
+
}else{
|
136 |
+
update_user_meta(get_current_user_id(), 'em_bookings_view', $this->cols );
|
137 |
+
}
|
138 |
+
}
|
139 |
+
//clean any columns from saved views that no longer exist
|
140 |
+
foreach($this->cols as $col_key => $col_name){
|
141 |
+
if( !array_key_exists($col_name, $this->cols_template)){
|
142 |
+
unset($this->cols[$col_key]);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
do_action('em_bookings_table', $this);
|
146 |
+
}
|
147 |
+
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @return EM_Person|false
|
151 |
+
*/
|
152 |
+
function get_person(){
|
153 |
+
global $EM_Person;
|
154 |
+
if( !empty($this->person) && is_object($this->person) ){
|
155 |
+
return $this->person;
|
156 |
+
}elseif( !empty($_REQUEST['person_id']) && !empty($EM_Person) && is_object($EM_Person) ){
|
157 |
+
return $EM_Person;
|
158 |
+
}
|
159 |
+
return false;
|
160 |
+
}
|
161 |
+
/**
|
162 |
+
* @return EM_Ticket|false
|
163 |
+
*/
|
164 |
+
function get_ticket(){
|
165 |
+
global $EM_Ticket;
|
166 |
+
if( !empty($this->ticket) && is_object($this->ticket) ){
|
167 |
+
return $this->ticket;
|
168 |
+
}elseif( !empty($EM_Ticket) && is_object($EM_Ticket) ){
|
169 |
+
return $EM_Ticket;
|
170 |
+
}
|
171 |
+
return false;
|
172 |
+
}
|
173 |
+
/**
|
174 |
+
* @return $EM_Event|false
|
175 |
+
*/
|
176 |
+
function get_event(){
|
177 |
+
global $EM_Event;
|
178 |
+
if( !empty($this->event) && is_object($this->event) ){
|
179 |
+
return $this->event;
|
180 |
+
}elseif( !empty($EM_Event) && is_object($EM_Event) ){
|
181 |
+
return $EM_Event;
|
182 |
+
}
|
183 |
+
return false;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Gets the bookings for this object instance according to its settings
|
188 |
+
* @param boolean $force_refresh
|
189 |
+
* @return EM_Bookings
|
190 |
+
*/
|
191 |
+
function get_bookings($force_refresh = true){
|
192 |
+
if( empty($this->bookings) || $force_refresh ){
|
193 |
+
$this->events = array();
|
194 |
+
$EM_Ticket = $this->get_ticket();
|
195 |
+
$EM_Event = $this->get_event();
|
196 |
+
$EM_Person = $this->get_person();
|
197 |
+
if( $EM_Person !== false ){
|
198 |
+
$args = array('person'=>$EM_Person->ID,'scope'=>$this->scope,'status'=>$this->get_status_search(),'order'=>$this->order,'orderby'=>$this->orderby);
|
199 |
+
$this->bookings_count = EM_Bookings::count($args);
|
200 |
+
$this->bookings = EM_Bookings::get(array_merge($args, array('limit'=>$this->limit,'offset'=>$this->offset)));
|
201 |
+
foreach($this->bookings->bookings as $EM_Booking){
|
202 |
+
//create event
|
203 |
+
if( !array_key_exists($EM_Booking->event_id,$this->events) ){
|
204 |
+
$this->events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}elseif( $EM_Ticket !== false ){
|
208 |
+
//searching bookings with a specific ticket
|
209 |
+
$args = array('ticket_id'=>$EM_Ticket->ticket_id, 'order'=>$this->order,'orderby'=>$this->orderby);
|
210 |
+
$this->bookings_count = EM_Bookings::count($args);
|
211 |
+
$this->bookings = EM_Bookings::get(array_merge($args, array('limit'=>$this->limit,'offset'=>$this->offset)));
|
212 |
+
$this->events[$EM_Ticket->event_id] = $EM_Ticket->get_event();
|
213 |
+
}elseif( $EM_Event !== false ){
|
214 |
+
//bookings for an event
|
215 |
+
$args = array('event'=>$EM_Event->event_id,'scope'=>false,'status'=>$this->get_status_search(),'order'=>$this->order,'orderby'=>$this->orderby);
|
216 |
+
$args['owner'] = !current_user_can('manage_others_bookings') ? get_current_user_id() : false;
|
217 |
+
$this->bookings_count = EM_Bookings::count($args);
|
218 |
+
$this->bookings = EM_Bookings::get(array_merge($args, array('limit'=>$this->limit,'offset'=>$this->offset)));
|
219 |
+
$this->events[$EM_Event->event_id] = $EM_Event;
|
220 |
+
}else{
|
221 |
+
//all bookings for a status
|
222 |
+
$args = array('status'=>$this->get_status_search(),'scope'=>$this->scope,'order'=>$this->order,'orderby'=>$this->orderby);
|
223 |
+
$args['owner'] = !current_user_can('manage_others_bookings') ? get_current_user_id() : false;
|
224 |
+
$this->bookings_count = EM_Bookings::count($args);
|
225 |
+
$this->bookings = EM_Bookings::get(array_merge($args, array('limit'=>$this->limit,'offset'=>$this->offset)));
|
226 |
+
//Now let's create events and bookings for this instead of giving each booking an event
|
227 |
+
foreach($this->bookings->bookings as $EM_Booking){
|
228 |
+
//create event
|
229 |
+
if( !array_key_exists($EM_Booking->event_id,$this->events) ){
|
230 |
+
$this->events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
|
231 |
+
}
|
232 |
+
}
|
233 |
+
}
|
234 |
+
}
|
235 |
+
return $this->bookings;
|
236 |
+
}
|
237 |
+
|
238 |
+
function get_count(){
|
239 |
+
return $this->bookings_count;
|
240 |
+
}
|
241 |
+
|
242 |
+
function get_status_search(){
|
243 |
+
if(is_array($this->statuses[$this->status]['search'])){
|
244 |
+
return implode(',',$this->statuses[$this->status]['search']);
|
245 |
+
}
|
246 |
+
return $this->statuses[$this->status]['search'];
|
247 |
+
}
|
248 |
+
|
249 |
+
function output(){
|
250 |
+
do_action('em_bookings_table_header',$this); //won't be overwritten by JS
|
251 |
+
$this->output_overlays();
|
252 |
+
$this->output_table();
|
253 |
+
do_action('em_bookings_table_footer',$this); //won't be overwritten by JS
|
254 |
+
}
|
255 |
+
|
256 |
+
function output_overlays(){
|
257 |
+
$EM_Ticket = $this->get_ticket();
|
258 |
+
$EM_Event = $this->get_event();
|
259 |
+
$EM_Person = $this->get_person();
|
260 |
+
?>
|
261 |
+
<div id="em-bookings-table-settings" class="em-bookings-table-overlay" style="display:none;" title="<?php esc_attr_e('Bookings Table Settings','dbem'); ?>">
|
262 |
+
<form id="em-bookings-table-settings-form" class="em-bookings-table-form" action="" method="post">
|
263 |
+
<p><?php _e('Modify what information is displayed in this booking table.','dbem') ?></p>
|
264 |
+
<div id="em-bookings-table-settings-form-cols">
|
265 |
+
<p>
|
266 |
+
<strong><?php _e('Columns to show','dbem')?></strong><br />
|
267 |
+
<?php _e('Drag items to or from the left column to add or remove them.','dbem'); ?>
|
268 |
+
</p>
|
269 |
+
<ul id="em-bookings-cols-active" class="em-bookings-cols-sortable">
|
270 |
+
<?php foreach( $this->cols as $col_key ): ?>
|
271 |
+
<li class="ui-state-highlight">
|
272 |
+
<input id="em-bookings-col-<?php echo esc_attr($col_key); ?>" type="hidden" name="<?php echo esc_attr($col_key); ?>" value="1" class="em-bookings-col-item" />
|
273 |
+
<?php echo esc_html($this->cols_template[$col_key]); ?>
|
274 |
+
</li>
|
275 |
+
<?php endforeach; ?>
|
276 |
+
</ul>
|
277 |
+
<ul id="em-bookings-cols-inactive" class="em-bookings-cols-sortable">
|
278 |
+
<?php foreach( $this->cols_template as $col_key => $col_data ): ?>
|
279 |
+
<?php if( !in_array($col_key, $this->cols) ): ?>
|
280 |
+
<li class="ui-state-default">
|
281 |
+
<input id="em-bookings-col-<?php echo esc_attr($col_key); ?>" type="hidden" name="<?php echo esc_attr($col_key); ?>" value="0" class="em-bookings-col-item" />
|
282 |
+
<?php echo esc_html($col_data); ?>
|
283 |
+
</li>
|
284 |
+
<?php endif; ?>
|
285 |
+
<?php endforeach; ?>
|
286 |
+
</ul>
|
287 |
+
</div>
|
288 |
+
</form>
|
289 |
+
</div>
|
290 |
+
<div id="em-bookings-table-export" class="em-bookings-table-overlay" style="display:none;" title="<?php esc_attr_e('Export Bookings','dbem'); ?>">
|
291 |
+
<form id="em-bookings-table-export-form" class="em-bookings-table-form" action="" method="post">
|
292 |
+
<p><?php esc_html_e('Select the options below and export all the bookings you have currently filtered (all pages) into a CSV spreadsheet format.','dbem') ?></p>
|
293 |
+
<?php if( !get_option('dbem_bookings_tickets_single') ): //single ticket mode means no splitting by ticket type ?>
|
294 |
+
<p><?php esc_html_e('Split bookings by ticket type','dbem')?> <input type="checkbox" name="show_tickets" value="1" />
|
295 |
+
<a href="#" title="<?php esc_attr_e('If your events have multiple tickets, enabling this will show a seperate row for each ticket within a booking.','dbem'); ?>">?</a>
|
296 |
+
<?php endif; ?>
|
297 |
+
<?php do_action('em_bookings_table_export_options'); ?>
|
298 |
+
<div id="em-bookings-table-settings-form-cols">
|
299 |
+
<p><strong><?php esc_html_e('Columns to export','dbem')?></strong></p>
|
300 |
+
<ul id="em-bookings-export-cols-active" class="em-bookings-cols-sortable">
|
301 |
+
<?php foreach( $this->cols as $col_key ): ?>
|
302 |
+
<li class="ui-state-highlight">
|
303 |
+
<input id="em-bookings-col-<?php echo esc_attr($col_key); ?>" type="hidden" name="cols[<?php echo esc_attr($col_key); ?>]" value="1" class="em-bookings-col-item" />
|
304 |
+
<?php echo esc_html($this->cols_template[$col_key]); ?>
|
305 |
+
</li>
|
306 |
+
<?php endforeach; ?>
|
307 |
+
</ul>
|
308 |
+
<ul id="em-bookings-export-cols-inactive" class="em-bookings-cols-sortable">
|
309 |
+
<?php foreach( $this->cols_template as $col_key => $col_data ): ?>
|
310 |
+
<?php if( !in_array($col_key, $this->cols) ): ?>
|
311 |
+
<li class="ui-state-default">
|
312 |
+
<input id="em-bookings-col-<?php echo esc_attr($col_key); ?>" type="hidden" name="cols[<?php echo esc_attr($col_key); ?>]" value="0" class="em-bookings-col-item" />
|
313 |
+
<?php echo esc_html($col_data); ?>
|
314 |
+
</li>
|
315 |
+
<?php endif; ?>
|
316 |
+
<?php endforeach; ?>
|
317 |
+
<?php if( !$this->show_tickets ): ?>
|
318 |
+
<?php foreach( $this->cols_tickets_template as $col_key => $col_data ): ?>
|
319 |
+
<?php if( !in_array($col_key, $this->cols) ): ?>
|
320 |
+
<li class="ui-state-default <?php if(array_key_exists($col_key, $this->cols_tickets_template)) echo 'em-bookings-col-item-ticket'; ?>">
|
321 |
+
<input id="em-bookings-col-<?php echo esc_attr($col_key); ?>" type="hidden" name="cols[<?php echo esc_attr($col_key); ?>]" value="0" class="em-bookings-col-item" />
|
322 |
+
<?php echo esc_html($col_data); ?>
|
323 |
+
</li>
|
324 |
+
<?php endif; ?>
|
325 |
+
<?php endforeach; ?>
|
326 |
+
<?php endif; ?>
|
327 |
+
</ul>
|
328 |
+
</div>
|
329 |
+
<?php if( $EM_Event !== false ): ?>
|
330 |
+
<input type="hidden" name="event_id" value='<?php echo esc_attr($EM_Event->event_id); ?>' />
|
331 |
+
<?php endif; ?>
|
332 |
+
<?php if( $EM_Ticket !== false ): ?>
|
333 |
+
<input type="hidden" name="ticket_id" value='<?php echo esc_attr($EM_Ticket->ticket_id); ?>' />
|
334 |
+
<?php endif; ?>
|
335 |
+
<?php if( $EM_Person !== false ): ?>
|
336 |
+
<input type="hidden" name="person_id" value='<?php echo esc_attr($EM_Person->ID); ?>' />
|
337 |
+
<?php endif; ?>
|
338 |
+
<input type="hidden" name="scope" value='<?php echo esc_attr($this->scope); ?>' />
|
339 |
+
<input type="hidden" name="status" value='<?php echo esc_attr($this->status); ?>' />
|
340 |
+
<input type="hidden" name="no_save" value='1' />
|
341 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('export_bookings_csv'); ?>" />
|
342 |
+
<input type="hidden" name="action" value="export_bookings_csv" />
|
343 |
+
</form>
|
344 |
+
</div>
|
345 |
+
<br class="clear" />
|
346 |
+
<?php
|
347 |
+
}
|
348 |
+
|
349 |
+
function output_table(){
|
350 |
+
$EM_Ticket = $this->get_ticket();
|
351 |
+
$EM_Event = $this->get_event();
|
352 |
+
$EM_Person = $this->get_person();
|
353 |
+
$this->get_bookings(true); //get bookings and refresh
|
354 |
+
?>
|
355 |
+
<div class='em-bookings-table em_obj' id="em-bookings-table">
|
356 |
+
<form class='bookings-filter' method='post' action='<?php echo esc_url(bloginfo('wpurl')); ?>/wp-admin/edit.php'>
|
357 |
+
<?php if( $EM_Event !== false ): ?>
|
358 |
+
<input type="hidden" name="event_id" value='<?php echo esc_attr($EM_Event->event_id); ?>' />
|
359 |
+
<?php endif; ?>
|
360 |
+
<?php if( $EM_Ticket !== false ): ?>
|
361 |
+
<input type="hidden" name="ticket_id" value='<?php echo esc_attr($EM_Ticket->ticket_id); ?>' />
|
362 |
+
<?php endif; ?>
|
363 |
+
<?php if( $EM_Person !== false ): ?>
|
364 |
+
<input type="hidden" name="person_id" value='<?php echo esc_attr($EM_Person->ID); ?>' />
|
365 |
+
<?php endif; ?>
|
366 |
+
<input type="hidden" name="is_public" value="<?php echo ( !empty($_REQUEST['is_public']) || !is_admin() ) ? 1:0; ?>" />
|
367 |
+
<input type="hidden" name="pno" value='<?php echo esc_attr($this->page); ?>' />
|
368 |
+
<input type="hidden" name="order" value='<?php echo esc_attr($this->order); ?>' />
|
369 |
+
<input type="hidden" name="orderby" value='<?php echo esc_attr($this->orderby); ?>' />
|
370 |
+
<input type="hidden" name="_wpnonce" value="<?php echo ( !empty($_REQUEST['_wpnonce']) ) ? esc_attr($_REQUEST['_wpnonce']):wp_create_nonce('em_bookings_table'); ?>" />
|
371 |
+
<input type="hidden" name="action" value="em_bookings_table" />
|
372 |
+
<input type="hidden" name="cols" value="<?php echo esc_attr(implode(',', $this->cols)); ?>" />
|
373 |
+
|
374 |
+
<div class='tablenav'>
|
375 |
+
<div class="alignleft actions">
|
376 |
+
<a href="#" class="em-bookings-table-export" id="em-bookings-table-export-trigger" rel="#em-bookings-table-export" title="<?php _e('Export these bookings.','dbem'); ?>"></a>
|
377 |
+
<a href="#" class="em-bookings-table-settings" id="em-bookings-table-settings-trigger" rel="#em-bookings-table-settings"></a>
|
378 |
+
<?php if( $EM_Event === false ): ?>
|
379 |
+
<select name="scope">
|
380 |
+
<?php
|
381 |
+
foreach ( em_get_scopes() as $key => $value ) {
|
382 |
+
$selected = "";
|
383 |
+
if ($key == $this->scope)
|
384 |
+
$selected = "selected='selected'";
|
385 |
+
echo "<option value='".esc_attr($key)."' $selected>".esc_html($value)."</option> ";
|
386 |
+
}
|
387 |
+
?>
|
388 |
+
</select>
|
389 |
+
<?php endif; ?>
|
390 |
+
<select name="limit">
|
391 |
+
<option value="<?php echo esc_attr($this->limit) ?>"><?php echo esc_html(sprintf(__('%s Rows','dbem'),$this->limit)); ?></option>
|
392 |
+
<option value="5">5</option>
|
393 |
+
<option value="10">10</option>
|
394 |
+
<option value="25">25</option>
|
395 |
+
<option value="50">50</option>
|
396 |
+
<option value="100">100</option>
|
397 |
+
</select>
|
398 |
+
<select name="status">
|
399 |
+
<?php
|
400 |
+
foreach ( $this->statuses as $key => $value ) {
|
401 |
+
$selected = "";
|
402 |
+
if ($key == $this->status)
|
403 |
+
$selected = "selected='selected'";
|
404 |
+
echo "<option value='".esc_attr($key)."' $selected>".esc_html($value['label'])."</option> ";
|
405 |
+
}
|
406 |
+
?>
|
407 |
+
</select>
|
408 |
+
<input name="pno" type="hidden" value="1" />
|
409 |
+
<input id="post-query-submit" class="button-secondary" type="submit" value="<?php esc_attr_e( 'Filter' )?>" />
|
410 |
+
<?php if( $EM_Event !== false ): ?>
|
411 |
+
<?php esc_html_e('Displaying Event','dbem'); ?> : <?php echo esc_html($EM_Event->event_name); ?>
|
412 |
+
<?php elseif( $EM_Person !== false ): ?>
|
413 |
+
<?php esc_html_e('Displaying User','dbem'); echo ' : '.esc_html($EM_Person->get_name()); ?>
|
414 |
+
<?php endif; ?>
|
415 |
+
</div>
|
416 |
+
<?php
|
417 |
+
if ( $this->bookings_count >= $this->limit ) {
|
418 |
+
$bookings_nav = em_admin_paginate( $this->bookings_count, $this->limit, $this->page, array(),'#%#%','#');
|
419 |
+
echo $bookings_nav;
|
420 |
+
}
|
421 |
+
?>
|
422 |
+
</div>
|
423 |
+
<div class="clear"></div>
|
424 |
+
<div class='table-wrap'>
|
425 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
426 |
+
<thead>
|
427 |
+
<tr>
|
428 |
+
<?php /*
|
429 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
430 |
+
<input class='select-all' type="checkbox" value='1' />
|
431 |
+
</th>
|
432 |
+
*/ ?>
|
433 |
+
<th class='manage-column' scope='col'><?php echo implode("</th><th class='manage-column' scope='col'>", $this->get_headers()); ?></th>
|
434 |
+
</tr>
|
435 |
+
</thead>
|
436 |
+
<?php if( $this->bookings_count > 0 ): ?>
|
437 |
+
<tbody>
|
438 |
+
<?php
|
439 |
+
$rowno = 0;
|
440 |
+
$event_count = (!empty($event_count)) ? $event_count:0;
|
441 |
+
foreach ($this->bookings->bookings as $EM_Booking) {
|
442 |
+
?>
|
443 |
+
<tr>
|
444 |
+
<?php /*
|
445 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
446 |
+
*/
|
447 |
+
/* @var $EM_Booking EM_Booking */
|
448 |
+
/* @var $EM_Ticket_Booking EM_Ticket_Booking */
|
449 |
+
if( $this->show_tickets ){
|
450 |
+
foreach($EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking){
|
451 |
+
?><td><?php echo implode('</td><td>', $this->get_row($EM_Ticket_Booking)); ?></td><?php
|
452 |
+
}
|
453 |
+
}else{
|
454 |
+
?><td><?php echo implode('</td><td>', $this->get_row($EM_Booking)); ?></td><?php
|
455 |
+
}
|
456 |
+
?>
|
457 |
+
</tr>
|
458 |
+
<?php
|
459 |
+
}
|
460 |
+
?>
|
461 |
+
</tbody>
|
462 |
+
<?php else: ?>
|
463 |
+
<tbody>
|
464 |
+
<tr><td scope="row" colspan="<?php echo count($this->cols); ?>"><?php esc_html_e('No bookings.', 'dbem'); ?></td></tr>
|
465 |
+
</tbody>
|
466 |
+
<?php endif; ?>
|
467 |
+
</table>
|
468 |
+
</div>
|
469 |
+
<?php if( !empty($bookings_nav) && $this->bookings_count >= $this->limit ) : ?>
|
470 |
+
<div class='tablenav'>
|
471 |
+
<?php echo $bookings_nav; ?>
|
472 |
+
<div class="clear"></div>
|
473 |
+
</div>
|
474 |
+
<?php endif; ?>
|
475 |
+
</form>
|
476 |
+
</div>
|
477 |
+
<?php
|
478 |
+
}
|
479 |
+
|
480 |
+
function get_headers($csv = false){
|
481 |
+
$headers = array();
|
482 |
+
foreach($this->cols as $col){
|
483 |
+
if( $col == 'actions' ){
|
484 |
+
if( !$csv ) $headers[$col] = ' ';
|
485 |
+
}elseif(array_key_exists($col, $this->cols_template)){
|
486 |
+
/* for later - col ordering!
|
487 |
+
if($this->orderby == $col){
|
488 |
+
if($this->order == 'ASC'){
|
489 |
+
$headers[] = '<a class="em-bookings-orderby" href="#'.$col.'">'.$this->cols_template[$col].' (^)</a>';
|
490 |
+
}else{
|
491 |
+
$headers[] = '<a class="em-bookings-orderby" href="#'.$col.'">'.$this->cols_template[$col].' (d)</a>';
|
492 |
+
}
|
493 |
+
}else{
|
494 |
+
$headers[] = '<a class="em-bookings-orderby" href="#'.$col.'">'.$this->cols_template[$col].'</a>';
|
495 |
+
}
|
496 |
+
*/
|
497 |
+
$headers[$col] = $this->cols_template[$col];
|
498 |
+
}
|
499 |
+
}
|
500 |
+
return apply_filters('em_bookings_table_get_headers', $headers, $csv, $this);
|
501 |
+
}
|
502 |
+
|
503 |
+
function get_table(){
|
504 |
+
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* @param Object $object
|
509 |
+
* @return array()
|
510 |
+
*/
|
511 |
+
function get_row( $object, $csv = false ){
|
512 |
+
/* @var $EM_Ticket EM_Ticket */
|
513 |
+
/* @var $EM_Ticket_Booking EM_Ticket_Booking */
|
514 |
+
/* @var $EM_Booking EM_Booking */
|
515 |
+
if( get_class($object) == 'EM_Ticket_Booking' ){
|
516 |
+
$EM_Ticket_Booking = $object;
|
517 |
+
$EM_Ticket = $EM_Ticket_Booking->get_ticket();
|
518 |
+
$EM_Booking = $EM_Ticket_Booking->get_booking();
|
519 |
+
}else{
|
520 |
+
$EM_Booking = $object;
|
521 |
+
}
|
522 |
+
$cols = array();
|
523 |
+
foreach($this->cols as $col){
|
524 |
+
$val = ''; //reset value
|
525 |
+
//is col a user col or else?
|
526 |
+
//TODO fix urls so this works in all pages in front as well
|
527 |
+
if( $col == 'user_email' ){
|
528 |
+
$val = $EM_Booking->get_person()->user_email;
|
529 |
+
}elseif($col == 'dbem_phone'){
|
530 |
+
$val = esc_html($EM_Booking->get_person()->phone);
|
531 |
+
}elseif($col == 'user_name'){
|
532 |
+
if( $csv || ( get_option('dbem_bookings_registration_disable') && $EM_Booking->get_person()->ID == get_option('dbem_bookings_registration_user') ) ){
|
533 |
+
$val = $EM_Booking->get_person()->get_name();
|
534 |
+
}else{
|
535 |
+
$val = '<a href="'.esc_url(add_query_arg(array('person_id'=>$EM_Booking->person_id, 'event_id'=>null), $EM_Booking->get_event()->get_bookings_url())).'">'. $EM_Booking->person->get_name() .'</a>';
|
536 |
+
}
|
537 |
+
}elseif($col == 'first_name'){
|
538 |
+
$val = esc_html($EM_Booking->get_person()->first_name);
|
539 |
+
}elseif($col == 'last_name'){
|
540 |
+
$val = esc_html($EM_Booking->get_person()->last_name);
|
541 |
+
}elseif($col == 'event_name'){
|
542 |
+
if( $csv ){
|
543 |
+
$val = $EM_Booking->get_event()->event_name;
|
544 |
+
}else{
|
545 |
+
$val = '<a href="'.$EM_Booking->get_event()->get_bookings_url().'">'. esc_html($EM_Booking->get_event()->event_name) .'</a>';
|
546 |
+
}
|
547 |
+
}elseif($col == 'event_date'){
|
548 |
+
$val = $EM_Booking->get_event()->output('#_EVENTDATES');
|
549 |
+
}elseif($col == 'event_time'){
|
550 |
+
$val = $EM_Booking->get_event()->output('#_EVENTTIMES');
|
551 |
+
}elseif($col == 'booking_price'){
|
552 |
+
if($this->show_tickets && !empty($EM_Ticket)){
|
553 |
+
$val = em_get_currency_formatted(apply_filters('em_bookings_table_row_booking_price_ticket', $EM_Ticket_Booking->get_price(false,false, true), $EM_Booking, true));
|
554 |
+
}else{
|
555 |
+
$val = $EM_Booking->get_price(true);
|
556 |
+
}
|
557 |
+
}elseif($col == 'booking_status'){
|
558 |
+
$val = $EM_Booking->get_status(true);
|
559 |
+
}elseif($col == 'booking_date'){
|
560 |
+
$val = date_i18n(get_option('dbem_date_format').' '. get_option('dbem_time_format'), $EM_Booking->timestamp);
|
561 |
+
}elseif($col == 'actions' ){
|
562 |
+
if( !$csv ) $val = implode(' | ', $this->get_booking_actions($EM_Booking));
|
563 |
+
}elseif( $col == 'booking_spaces' ){
|
564 |
+
$val = ($this->show_tickets && !empty($EM_Ticket)) ? $EM_Ticket_Booking->get_spaces() : $EM_Booking->get_spaces();
|
565 |
+
}elseif( $col == 'booking_id' ){
|
566 |
+
$val = $EM_Booking->booking_id;
|
567 |
+
}elseif( $col == 'ticket_name' && $this->show_tickets && !empty($EM_Ticket) ){
|
568 |
+
$val = $csv ? $EM_Ticket->$col : esc_html($EM_Ticket->$col);
|
569 |
+
}elseif( $col == 'ticket_description' && $this->show_tickets && !empty($EM_Ticket) ){
|
570 |
+
$val = $csv ? $EM_Ticket->$col : esc_html($EM_Ticket->$col);
|
571 |
+
}elseif( $col == 'ticket_price' && $this->show_tickets && !empty($EM_Ticket) ){
|
572 |
+
$val = $EM_Ticket->get_price(true);
|
573 |
+
}elseif( $col == 'ticket_id' && $this->show_tickets && !empty($EM_Ticket) ){
|
574 |
+
$val = $EM_Ticket->ticket_id;
|
575 |
+
}elseif( $col == 'booking_comment' ){
|
576 |
+
$val = $csv ? $EM_Booking->booking_comment : esc_html($EM_Booking->booking_comment);
|
577 |
+
}
|
578 |
+
//use this
|
579 |
+
$val = apply_filters('em_bookings_table_rows_col_'.$col, $val, $EM_Booking, $this, $csv, $object);
|
580 |
+
$cols[] = apply_filters('em_bookings_table_rows_col', $val, $col, $EM_Booking, $this, $csv, $object); //deprecated, use the above filter instead for better performance
|
581 |
+
}
|
582 |
+
//clean up the cols to prevent nasty html or xss
|
583 |
+
global $allowedposttags;
|
584 |
+
foreach($cols as $key => $col){
|
585 |
+
$cols[$key] = wp_kses($col, $allowedposttags);
|
586 |
+
}
|
587 |
+
return $cols;
|
588 |
+
}
|
589 |
+
|
590 |
+
function get_row_csv($EM_Booking){
|
591 |
+
$row = $this->get_row($EM_Booking, true);
|
592 |
+
foreach($row as $k=>$v) $row[$k] = html_entity_decode($v); //remove things like & which may have been saved to the DB directly
|
593 |
+
return $row;
|
594 |
+
}
|
595 |
+
|
596 |
+
/**
|
597 |
+
* @param EM_Booking $EM_Booking
|
598 |
+
* @return mixed
|
599 |
+
*/
|
600 |
+
function get_booking_actions($EM_Booking){
|
601 |
+
$booking_actions = array();
|
602 |
+
$url = $EM_Booking->get_event()->get_bookings_url();
|
603 |
+
switch($EM_Booking->booking_status){
|
604 |
+
case 0: //pending
|
605 |
+
if( get_option('dbem_bookings_approval') ){
|
606 |
+
$booking_actions = array(
|
607 |
+
'approve' => '<a class="em-bookings-approve" href="'.em_add_get_params($url, array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Approve','dbem').'</a>',
|
608 |
+
'reject' => '<a class="em-bookings-reject" href="'.em_add_get_params($url, array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Reject','dbem').'</a>',
|
609 |
+
'delete' => '<span class="trash"><a class="em-bookings-delete" href="'.em_add_get_params($url, array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Delete','dbem').'</a></span>',
|
610 |
+
'edit' => '<a class="em-bookings-edit" href="'.em_add_get_params($EM_Booking->get_event()->get_bookings_url(), array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null)).'">'.__('Edit/View','dbem').'</a>',
|
611 |
+
);
|
612 |
+
break;
|
613 |
+
}//if approvals are off, treat as a 1
|
614 |
+
case 1: //approved
|
615 |
+
$booking_actions = array(
|
616 |
+
'unapprove' => '<a class="em-bookings-unapprove" href="'.em_add_get_params($url, array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Unapprove','dbem').'</a>',
|
617 |
+
'reject' => '<a class="em-bookings-reject" href="'.em_add_get_params($url, array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Reject','dbem').'</a>',
|
618 |
+
'delete' => '<span class="trash"><a class="em-bookings-delete" href="'.em_add_get_params($url, array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Delete','dbem').'</a></span>',
|
619 |
+
'edit' => '<a class="em-bookings-edit" href="'.em_add_get_params($EM_Booking->get_event()->get_bookings_url(), array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null)).'">'.__('Edit/View','dbem').'</a>',
|
620 |
+
);
|
621 |
+
break;
|
622 |
+
case 2: //rejected
|
623 |
+
$booking_actions = array(
|
624 |
+
'approve' => '<a class="em-bookings-approve" href="'.em_add_get_params($url, array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Approve','dbem').'</a>',
|
625 |
+
'delete' => '<span class="trash"><a class="em-bookings-delete" href="'.em_add_get_params($url, array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Delete','dbem').'</a></span>',
|
626 |
+
'edit' => '<a class="em-bookings-edit" href="'.em_add_get_params($EM_Booking->get_event()->get_bookings_url(), array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null)).'">'.__('Edit/View','dbem').'</a>',
|
627 |
+
);
|
628 |
+
break;
|
629 |
+
case 3: //cancelled
|
630 |
+
case 4: //awaiting online payment - similar to pending but always needs approval in EM Free
|
631 |
+
case 5: //awaiting payment - similar to pending but always needs approval in EM Free
|
632 |
+
$booking_actions = array(
|
633 |
+
'approve' => '<a class="em-bookings-approve" href="'.em_add_get_params($url, array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Approve','dbem').'</a>',
|
634 |
+
'delete' => '<span class="trash"><a class="em-bookings-delete" href="'.em_add_get_params($url, array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Delete','dbem').'</a></span>',
|
635 |
+
'edit' => '<a class="em-bookings-edit" href="'.em_add_get_params($EM_Booking->get_event()->get_bookings_url(), array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null)).'">'.__('Edit/View','dbem').'</a>',
|
636 |
+
);
|
637 |
+
break;
|
638 |
+
|
639 |
+
}
|
640 |
+
if( !get_option('dbem_bookings_approval') ) unset($booking_actions['unapprove']);
|
641 |
+
$booking_actions = apply_filters('em_bookings_table_booking_actions_'.$EM_Booking->booking_status ,$booking_actions, $EM_Booking);
|
642 |
+
return apply_filters('em_bookings_table_cols_col_action', $booking_actions, $EM_Booking);
|
643 |
+
}
|
644 |
+
}
|
645 |
?>
|
classes/em-bookings.php
CHANGED
@@ -1,718 +1,723 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Deals with the booking info for an event
|
4 |
-
* @author marcus
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class EM_Bookings extends EM_Object implements Iterator{
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Array of EM_Booking objects for a specific event
|
11 |
-
* @var array
|
12 |
-
*/
|
13 |
-
var $bookings = array();
|
14 |
-
/**
|
15 |
-
* @var EM_Tickets
|
16 |
-
*/
|
17 |
-
var $tickets;
|
18 |
-
/**
|
19 |
-
* @var int
|
20 |
-
*/
|
21 |
-
var $event_id;
|
22 |
-
/**
|
23 |
-
* How many spaces this event has
|
24 |
-
* @var int
|
25 |
-
*/
|
26 |
-
var $spaces;
|
27 |
-
/**
|
28 |
-
*
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
*
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
$this->
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
if($
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
$this->feedback_message
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
$
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
if
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
}
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
$
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
return
|
224 |
-
}
|
225 |
-
|
226 |
-
function
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
$
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
}
|
316 |
-
|
317 |
-
$this->feedback_message = __('
|
318 |
-
return
|
319 |
-
}
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
if(
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
$
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
$
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
$
|
528 |
-
|
529 |
-
//
|
530 |
-
$
|
531 |
-
|
532 |
-
$
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
$
|
541 |
-
$
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
$
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
return
|
566 |
-
}
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
$conditions['
|
635 |
-
}
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
if(
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
}
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
$var = ($
|
715 |
-
return $var;
|
716 |
-
}
|
717 |
-
|
|
|
|
|
|
|
|
|
|
|
718 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Deals with the booking info for an event
|
4 |
+
* @author marcus
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class EM_Bookings extends EM_Object implements Iterator{
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Array of EM_Booking objects for a specific event
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
var $bookings = array();
|
14 |
+
/**
|
15 |
+
* @var EM_Tickets
|
16 |
+
*/
|
17 |
+
var $tickets;
|
18 |
+
/**
|
19 |
+
* @var int
|
20 |
+
*/
|
21 |
+
var $event_id;
|
22 |
+
/**
|
23 |
+
* How many spaces this event has
|
24 |
+
* @var int
|
25 |
+
*/
|
26 |
+
var $spaces;
|
27 |
+
/**
|
28 |
+
* @var boolena Flag for Multilingual functionality, to help prevent unnecessary reloading of this object if already 'translated'
|
29 |
+
*/
|
30 |
+
var $translated;
|
31 |
+
/**
|
32 |
+
* If flag is true, a registration will be attempted when booking whether the user is logged in or not. Used in cases such as manual bookings (a Pro feature) and should only be enabled during manipulation by an event admin.
|
33 |
+
* @var unknown
|
34 |
+
*/
|
35 |
+
public static $force_registration;
|
36 |
+
/**
|
37 |
+
* If flag is true, bookings and forms will not impose restrictions for roles. Future iterations will remove restrictions on dates, space capacity, etc. This is mainly for use by event admins such as for a manual booking (a Pro feature).
|
38 |
+
* @var bool
|
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
|
45 |
+
* @return null
|
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);
|
55 |
+
}
|
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 |
+
/**
|
70 |
+
* Add a booking into this event (or add spaces if person already booked this). We assume at this point that the booking has already been validated usin $EM_Booking->validate()
|
71 |
+
* @param EM_Booking $EM_Booking
|
72 |
+
* @return boolean
|
73 |
+
*/
|
74 |
+
function add( $EM_Booking ){
|
75 |
+
global $wpdb,$EM_Mailer;
|
76 |
+
//Save the booking
|
77 |
+
$email = false;
|
78 |
+
//set status depending on approval settings
|
79 |
+
if( empty($EM_Booking->booking_status) ){ //if status is not set, give 1 or 0 depending on approval settings
|
80 |
+
$EM_Booking->booking_status = get_option('dbem_bookings_approval') ? 0:1;
|
81 |
+
}
|
82 |
+
$result = $EM_Booking->save(false);
|
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');
|
90 |
+
}else{
|
91 |
+
$this->feedback_message = get_option('dbem_booking_feedback');
|
92 |
+
}
|
93 |
+
if(!$email){
|
94 |
+
$EM_Booking->email_not_sent = true;
|
95 |
+
$this->feedback_message .= ' '.get_option('dbem_booking_feedback_nomail');
|
96 |
+
if( current_user_can('activate_plugins') ){
|
97 |
+
if( count($EM_Booking->get_errors()) > 0 ){
|
98 |
+
$this->feedback_message .= '<br/><strong>Errors:</strong> (only admins see this message)<br/><ul><li>'. implode('</li><li>', $EM_Booking->get_errors()).'</li></ul>';
|
99 |
+
}else{
|
100 |
+
$this->feedback_message .= '<br/><strong>No errors returned by mailer</strong> (only admins see this message)';
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
return apply_filters('em_bookings_add', true, $EM_Booking);
|
105 |
+
}else{
|
106 |
+
//Failure
|
107 |
+
$this->errors[] = "<strong>".get_option('dbem_booking_feedback_error')."</strong><br />". implode('<br />', $EM_Booking->errors);
|
108 |
+
}
|
109 |
+
return apply_filters('em_bookings_add', false, $EM_Booking);
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get POST data and create a booking for each ticket requested. If successful, a booking object is returned, false if not.
|
114 |
+
* @return false|object
|
115 |
+
*/
|
116 |
+
function add_from_post(){
|
117 |
+
$EM_Booking = new EM_booking();
|
118 |
+
$result = $EM_Booking->get_post();
|
119 |
+
if($result){
|
120 |
+
$result = $this->add($EM_Booking);
|
121 |
+
if($result){
|
122 |
+
$result = $EM_Booking;
|
123 |
+
}
|
124 |
+
$this->feedback_message = sprintf(__('%s created.','dbem'),__('Booking','dbem'));
|
125 |
+
}else{
|
126 |
+
$this->errors = array_merge($this->errors, $EM_Booking->errors);
|
127 |
+
}
|
128 |
+
return apply_filters('em_bookings_add_from_post',$result,$EM_Booking,$this);
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Smart event locator, saves a database read if possible. Note that if an event doesn't exist, a blank object will be created to prevent duplicates.
|
133 |
+
*/
|
134 |
+
function get_event(){
|
135 |
+
global $EM_Event;
|
136 |
+
if( is_object($EM_Event) && $EM_Event->event_id == $this->event_id ){
|
137 |
+
return $EM_Event;
|
138 |
+
}else{
|
139 |
+
if( is_numeric($this->event_id) && $this->event_id > 0 ){
|
140 |
+
return em_get_event($this->event_id, 'event_id');
|
141 |
+
}elseif( count($this->bookings) > 0 ){
|
142 |
+
foreach($this->bookings as $EM_Booking){
|
143 |
+
/* @var $EM_Booking EM_Booking */
|
144 |
+
return em_get_event($EM_Booking->event_id, 'event_id');
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
return em_get_event($this->event_id, 'event_id');
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Retrieve and save the bookings belonging to instance. If called again will return cached version, set $force_reload to true to create a new EM_Tickets object.
|
153 |
+
* @param boolean $force_reload
|
154 |
+
* @return EM_Tickets
|
155 |
+
*/
|
156 |
+
function get_tickets( $force_reload = false ){
|
157 |
+
if( !is_object($this->tickets) || $force_reload ){
|
158 |
+
$this->tickets = new EM_Tickets($this->event_id);
|
159 |
+
if( get_option('dbem_bookings_tickets_single') && count($this->tickets->tickets) == 1 && !empty($this->get_event()->rsvp_end) ){
|
160 |
+
//if in single ticket mode, then the event booking cut-off is the ticket end date
|
161 |
+
$EM_Ticket = $this->tickets->get_first();
|
162 |
+
$EM_Event = $this->get_event();
|
163 |
+
//if ticket has cut-off date, that should take precedence as we save the ticket cut-off date/time to the event in single ticket mode
|
164 |
+
if( !empty($EM_Ticket->ticket_end) ){
|
165 |
+
//if ticket end dates are set, move to event
|
166 |
+
$EM_Event->event_rsvp_date = date('Y-m-d', $EM_Ticket->end_timestamp);
|
167 |
+
$EM_Event->event_rsvp_time = date('H:i:00', $EM_Ticket->end_timestamp);
|
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;
|
175 |
+
$EM_Ticket->end_timestamp = $EM_Event->rsvp_end;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}else{
|
179 |
+
$this->tickets->event_id = $this->event_id;
|
180 |
+
}
|
181 |
+
return apply_filters('em_bookings_get_tickets', $this->tickets, $this);
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Returns EM_Tickets object with available tickets
|
186 |
+
* @param boolean $include_member_tickets - if set to true, member-ony tickets will be considered available even if logged out
|
187 |
+
* @return EM_Tickets
|
188 |
+
*/
|
189 |
+
function get_available_tickets( $include_member_tickets = false ){
|
190 |
+
$tickets = array();
|
191 |
+
foreach ($this->get_tickets() as $EM_Ticket){
|
192 |
+
/* @var $EM_Ticket EM_Ticket */
|
193 |
+
if( $EM_Ticket->is_available($include_member_tickets) ){
|
194 |
+
//within time range
|
195 |
+
if( $EM_Ticket->get_available_spaces() > 0 ){
|
196 |
+
$tickets[] = $EM_Ticket;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
$EM_Tickets = new EM_Tickets($tickets);
|
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){
|
217 |
+
$EM_Tickets = $this->get_tickets();
|
218 |
+
foreach( $EM_Tickets->tickets as $EM_Ticket){
|
219 |
+
if($EM_Ticket->ticket_id == $ticket_id){
|
220 |
+
return apply_filters('em_bookings_ticket_exists',true, $EM_Ticket, $this);
|
221 |
+
}
|
222 |
+
}
|
223 |
+
return apply_filters('em_bookings_ticket_exists',false, false,$this);
|
224 |
+
}
|
225 |
+
|
226 |
+
function has_space( $include_member_tickets = false ){
|
227 |
+
return count($this->get_available_tickets( $include_member_tickets )->tickets) > 0;
|
228 |
+
}
|
229 |
+
|
230 |
+
function has_open_time(){
|
231 |
+
$return = false;
|
232 |
+
$EM_Event = $this->get_event();
|
233 |
+
if(!empty($EM_Event->event_rsvp_date) && $EM_Event->rsvp_end > current_time('timestamp')){
|
234 |
+
$return = true;
|
235 |
+
}elseif( empty($EM_Event->event_rsvp_date) && $EM_Event->start > current_time('timestamp') ){
|
236 |
+
$return = true;
|
237 |
+
}
|
238 |
+
return $return;
|
239 |
+
}
|
240 |
+
|
241 |
+
function is_open($include_member_tickets = false){
|
242 |
+
//TODO extend booking options
|
243 |
+
$return = $this->has_open_time() && $this->has_space($include_member_tickets);
|
244 |
+
return apply_filters('em_bookings_is_open', $return, $this, $include_member_tickets);
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Delete bookings on this id
|
249 |
+
* @return boolean
|
250 |
+
*/
|
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 event_id IN (".implode(',',$booking_ids).")");
|
264 |
+
}
|
265 |
+
return ($result !== false && $result_tickets !== false);
|
266 |
+
}
|
267 |
+
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Will approve all supplied booking ids, which must be in the form of a numeric array or a single number.
|
271 |
+
* @param array|int $booking_ids
|
272 |
+
* @return boolean
|
273 |
+
*/
|
274 |
+
function approve( $booking_ids ){
|
275 |
+
$this->set_status(1, $booking_ids);
|
276 |
+
return false;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Will reject all supplied booking ids, which must be in the form of a numeric array or a single number.
|
281 |
+
* @param array|int $booking_ids
|
282 |
+
* @return boolean
|
283 |
+
*/
|
284 |
+
function reject( $booking_ids ){
|
285 |
+
return $this->set_status(2, $booking_ids);
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Will unapprove all supplied booking ids, which must be in the form of a numeric array or a single number.
|
290 |
+
* @param array|int $booking_ids
|
291 |
+
* @return boolean
|
292 |
+
*/
|
293 |
+
function unapprove( $booking_ids ){
|
294 |
+
return $this->set_status(0, $booking_ids);
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* @param int $status
|
299 |
+
* @param array|int $booking_ids
|
300 |
+
* @return bool
|
301 |
+
*/
|
302 |
+
function set_status($status, $booking_ids){
|
303 |
+
//FIXME status should work with instantiated object
|
304 |
+
if( self::array_is_numeric($booking_ids) ){
|
305 |
+
//Get all the bookings
|
306 |
+
$results = array();
|
307 |
+
$mails = array();
|
308 |
+
foreach( $booking_ids as $booking_id ){
|
309 |
+
$EM_Booking = em_get_booking($booking_id);
|
310 |
+
if( !$EM_Booking->can_manage() ){
|
311 |
+
$this->feedback_message = __('Bookings %s. Mails Sent.', 'dbem');
|
312 |
+
return false;
|
313 |
+
}
|
314 |
+
$results[] = $EM_Booking->set_status($status);
|
315 |
+
}
|
316 |
+
if( !in_array('false',$results) ){
|
317 |
+
$this->feedback_message = __('Bookings %s. Mails Sent.', 'dbem');
|
318 |
+
return true;
|
319 |
+
}else{
|
320 |
+
//TODO Better error handling needed if some bookings fail approval/failure
|
321 |
+
$this->feedback_message = __('An error occurred.', 'dbem');
|
322 |
+
return false;
|
323 |
+
}
|
324 |
+
}elseif( is_numeric($booking_ids) || is_object($booking_ids) ){
|
325 |
+
$EM_Booking = ( is_object($booking_ids) && get_class($booking_ids) == 'EM_Booking') ? $booking_ids : em_get_booking($booking_ids);
|
326 |
+
$result = $EM_Booking->set_status($status);
|
327 |
+
$this->feedback_message = $EM_Booking->feedback_message;
|
328 |
+
return $result;
|
329 |
+
}
|
330 |
+
return false;
|
331 |
+
}
|
332 |
+
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Get the total number of spaces this event has. This will show the lower value of event global spaces limit or total ticket spaces. Setting $force_refresh to true will recheck spaces, even if previously done so.
|
336 |
+
* @param boolean $force_refresh
|
337 |
+
* @return int
|
338 |
+
*/
|
339 |
+
function get_spaces( $force_refresh=false ){
|
340 |
+
if($force_refresh || $this->spaces == 0){
|
341 |
+
$this->spaces = $this->get_tickets()->get_spaces();
|
342 |
+
}
|
343 |
+
//check overall events cap
|
344 |
+
if(!empty($this->get_event()->event_spaces) && $this->get_event()->event_spaces < $this->spaces) $this->spaces = $this->get_event()->event_spaces;
|
345 |
+
return apply_filters('em_booking_get_spaces',$this->spaces,$this);
|
346 |
+
}
|
347 |
+
|
348 |
+
/**
|
349 |
+
* Returns number of available spaces for this event. If approval of bookings is on, will include pending bookings depending on em option.
|
350 |
+
* @return int
|
351 |
+
*/
|
352 |
+
function get_available_spaces(){
|
353 |
+
$spaces = $this->get_spaces();
|
354 |
+
$available_spaces = $spaces - $this->get_booked_spaces();
|
355 |
+
if( get_option('dbem_bookings_approval_reserved') ){ //deduct reserved/pending spaces from available spaces
|
356 |
+
$available_spaces -= $this->get_pending_spaces();
|
357 |
+
}
|
358 |
+
return apply_filters('em_booking_get_available_spaces', $available_spaces, $this);
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Returns number of booked spaces for this event. If approval of bookings is on, will return number of booked confirmed spaces.
|
363 |
+
* @return int
|
364 |
+
*/
|
365 |
+
function get_booked_spaces($force_refresh = false){
|
366 |
+
$booked_spaces = 0;
|
367 |
+
foreach ( $this->bookings as $EM_Booking ){
|
368 |
+
if( $EM_Booking->booking_status == 1 || (!get_option('dbem_bookings_approval') && $EM_Booking->booking_status == 0 ) ){
|
369 |
+
$booked_spaces += $EM_Booking->get_spaces($force_refresh);
|
370 |
+
}
|
371 |
+
}
|
372 |
+
return apply_filters('em_bookings_get_booked_spaces', $booked_spaces, $this);
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Gets number of pending spaces awaiting approval. Will return 0 if booking approval is not enabled.
|
377 |
+
* @return int
|
378 |
+
*/
|
379 |
+
function get_pending_spaces(){
|
380 |
+
if( get_option('dbem_bookings_approval') == 0 ){
|
381 |
+
return apply_filters('em_bookings_get_pending_spaces', 0, $this);
|
382 |
+
}
|
383 |
+
$pending = 0;
|
384 |
+
foreach ( $this->bookings as $booking ){
|
385 |
+
if($booking->booking_status == 0){
|
386 |
+
$pending += $booking->get_spaces();
|
387 |
+
}
|
388 |
+
}
|
389 |
+
return apply_filters('em_bookings_get_pending_spaces', $pending, $this);
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Gets number of bookings (not spaces). If booking approval is enabled, only the number of approved bookings will be shown.
|
394 |
+
* @return EM_Bookings
|
395 |
+
*/
|
396 |
+
function get_bookings( $all_bookings = false ){
|
397 |
+
$confirmed = array();
|
398 |
+
foreach ( $this->bookings as $booking ){
|
399 |
+
if( $booking->booking_status == 1 || (get_option('dbem_bookings_approval') == 0 && $booking->booking_status == 0) || $all_bookings ){
|
400 |
+
$confirmed[] = $booking;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
$EM_Bookings = new EM_Bookings($confirmed);
|
404 |
+
return $EM_Bookings;
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Get pending bookings. If booking approval is disabled, will return no bookings.
|
409 |
+
* @return EM_Bookings
|
410 |
+
*/
|
411 |
+
function get_pending_bookings(){
|
412 |
+
if( get_option('dbem_bookings_approval') == 0 ){
|
413 |
+
return new EM_Bookings();
|
414 |
+
}
|
415 |
+
$pending = array();
|
416 |
+
foreach ( $this->bookings as $booking ){
|
417 |
+
if($booking->booking_status == 0){
|
418 |
+
$pending[] = $booking;
|
419 |
+
}
|
420 |
+
}
|
421 |
+
$EM_Bookings = new EM_Bookings($pending);
|
422 |
+
return $EM_Bookings;
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Get rejected bookings. If booking approval is disabled, will return no bookings.
|
427 |
+
* @return array EM_Bookings
|
428 |
+
*/
|
429 |
+
function get_rejected_bookings(){
|
430 |
+
$rejected = array();
|
431 |
+
foreach ( $this->bookings as $booking ){
|
432 |
+
if($booking->booking_status == 2){
|
433 |
+
$rejected[] = $booking;
|
434 |
+
}
|
435 |
+
}
|
436 |
+
$EM_Bookings = new EM_Bookings($rejected);
|
437 |
+
return $EM_Bookings;
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Get cancelled bookings.
|
442 |
+
* @return array EM_Booking
|
443 |
+
*/
|
444 |
+
function get_cancelled_bookings(){
|
445 |
+
$cancelled = array();
|
446 |
+
foreach ( $this->bookings as $booking ){
|
447 |
+
if($booking->booking_status == 3){
|
448 |
+
$cancelled[] = $booking;
|
449 |
+
}
|
450 |
+
}
|
451 |
+
$EM_Bookings = new EM_Bookings($cancelled);
|
452 |
+
return $EM_Bookings;
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Checks if a person with similar details has booked for this before
|
457 |
+
* @param $person_id
|
458 |
+
* @return EM_Booking
|
459 |
+
*/
|
460 |
+
function find_previous_booking($EM_Booking){
|
461 |
+
//First see if we have a similar person on record that's making this booking
|
462 |
+
$EM_Booking->person->load_similar();
|
463 |
+
//If person exists on record, see if they've booked this event before, if so return the booking.
|
464 |
+
if( is_numeric($EM_Booking->person->ID) && $EM_Booking->person->ID > 0 ){
|
465 |
+
$EM_Booking->person_id = $EM_Booking->person->ID;
|
466 |
+
foreach ($this->bookings as $booking){
|
467 |
+
if( $booking->person_id == $EM_Booking->person->ID ){
|
468 |
+
return $booking;
|
469 |
+
}
|
470 |
+
}
|
471 |
+
}
|
472 |
+
return false;
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* Checks to see if user has a booking for this event
|
477 |
+
* @param unknown_type $user_id
|
478 |
+
*/
|
479 |
+
function has_booking( $user_id = false ){
|
480 |
+
if( $user_id === false ){
|
481 |
+
$user_id = get_current_user_id();
|
482 |
+
}
|
483 |
+
if( is_numeric($user_id) && $user_id > 0 ){
|
484 |
+
foreach ($this->bookings as $EM_Booking){
|
485 |
+
if( $EM_Booking->person->ID == $user_id && !in_array($EM_Booking->booking_status, array(2,3)) ){
|
486 |
+
return apply_filters('em_bookings_has_booking', $EM_Booking, $this);
|
487 |
+
}
|
488 |
+
}
|
489 |
+
}
|
490 |
+
return apply_filters('em_bookings_has_booking', false, $this);
|
491 |
+
}
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Get bookings that match the array of arguments passed.
|
495 |
+
* @return array
|
496 |
+
* @static
|
497 |
+
*/
|
498 |
+
public static function get( $args = array(), $count = false ){
|
499 |
+
global $wpdb,$current_user;
|
500 |
+
$bookings_table = EM_BOOKINGS_TABLE;
|
501 |
+
$events_table = EM_EVENTS_TABLE;
|
502 |
+
$locations_table = EM_LOCATIONS_TABLE;
|
503 |
+
|
504 |
+
//Quick version, we can accept an array of IDs, which is easy to retrieve
|
505 |
+
if( self::array_is_numeric($args) ){ //Array of numbers, assume they are event IDs to retreive
|
506 |
+
//We can just get all the events here and return them
|
507 |
+
$sql = "
|
508 |
+
SELECT * FROM $bookings_table b
|
509 |
+
LEFT JOIN $events_table e ON e.event_id=b.event_id
|
510 |
+
WHERE booking_id".implode(" OR booking_id=", $args);
|
511 |
+
$results = $wpdb->get_results(apply_filters('em_bookings_get_sql',$sql),ARRAY_A);
|
512 |
+
$bookings = array();
|
513 |
+
foreach($results as $result){
|
514 |
+
$bookings[] = em_get_booking($result);
|
515 |
+
}
|
516 |
+
return $bookings; //We return all the bookings matched as an EM_Booking array.
|
517 |
+
}
|
518 |
+
|
519 |
+
//We assume it's either an empty array or array of search arguments to merge with defaults
|
520 |
+
$args = self::get_default_search($args);
|
521 |
+
$limit = ( $args['limit'] && is_numeric($args['limit'])) ? "LIMIT {$args['limit']}" : '';
|
522 |
+
$offset = ( $limit != "" && is_numeric($args['offset']) ) ? "OFFSET {$args['offset']}" : '';
|
523 |
+
|
524 |
+
//Get the default conditions
|
525 |
+
$conditions = self::build_sql_conditions($args);
|
526 |
+
//Put it all together
|
527 |
+
$where = ( count($conditions) > 0 ) ? " WHERE " . implode ( " AND ", $conditions ):'';
|
528 |
+
|
529 |
+
//Get ordering instructions
|
530 |
+
$EM_Booking = em_get_booking();
|
531 |
+
$accepted_fields = $EM_Booking->get_fields(true);
|
532 |
+
$orderby = self::build_sql_orderby($args, $accepted_fields);
|
533 |
+
//Now, build orderby sql
|
534 |
+
$orderby_sql = ( count($orderby) > 0 ) ? 'ORDER BY '. implode(', ', $orderby) : 'ORDER BY booking_date';
|
535 |
+
//Selector
|
536 |
+
$selectors = ( $count ) ? 'COUNT(*)':'*';
|
537 |
+
|
538 |
+
//Create the SQL statement and execute
|
539 |
+
$sql = "
|
540 |
+
SELECT $selectors FROM $bookings_table
|
541 |
+
LEFT JOIN $events_table ON {$events_table}.event_id={$bookings_table}.event_id
|
542 |
+
LEFT JOIN $locations_table ON {$locations_table}.location_id={$events_table}.location_id
|
543 |
+
$where
|
544 |
+
$orderby_sql
|
545 |
+
$limit $offset
|
546 |
+
";
|
547 |
+
//If we're only counting results, return the number of results
|
548 |
+
if( $count ){
|
549 |
+
return apply_filters('em_bookings_get_count', $wpdb->get_var($sql), $args);
|
550 |
+
}
|
551 |
+
$results = $wpdb->get_results( apply_filters('em_events_get_sql',$sql, $args), ARRAY_A);
|
552 |
+
|
553 |
+
//If we want results directly in an array, why not have a shortcut here?
|
554 |
+
if( $args['array'] == true ){
|
555 |
+
return $results;
|
556 |
+
}
|
557 |
+
|
558 |
+
//Make returned results EM_Booking objects
|
559 |
+
$results = (is_array($results)) ? $results:array();
|
560 |
+
$bookings = array();
|
561 |
+
foreach ( $results as $booking ){
|
562 |
+
$bookings[] = em_get_booking($booking);
|
563 |
+
}
|
564 |
+
$EM_Bookings = new EM_Bookings($bookings);
|
565 |
+
return apply_filters('em_bookings_get', $EM_Bookings);
|
566 |
+
}
|
567 |
+
|
568 |
+
public static function count( $args = array() ){
|
569 |
+
return self::get($args, true);
|
570 |
+
}
|
571 |
+
|
572 |
+
|
573 |
+
//List of patients in the patient database, that a user can choose and go on to edit any previous treatment data, or add a new admission.
|
574 |
+
function export_csv() {
|
575 |
+
global $EM_Event;
|
576 |
+
if($EM_Event->event_id != $this->event_id ){
|
577 |
+
$event = $this->get_event();
|
578 |
+
$event_name = $event->name;
|
579 |
+
}else{
|
580 |
+
$event_name = $EM_Event->name;
|
581 |
+
}
|
582 |
+
// The name of the file on the user's pc
|
583 |
+
$file_name = sanitize_title($event_name). "-bookings.csv";
|
584 |
+
|
585 |
+
header("Content-Type: application/octet-stream");
|
586 |
+
header("Content-Disposition: Attachment; filename=$file_name");
|
587 |
+
em_locate_template('templates/csv-event-bookings.php', true);
|
588 |
+
exit();
|
589 |
+
}
|
590 |
+
|
591 |
+
static function enqueue_js(){
|
592 |
+
if( !defined('EM_BOOKING_JS_LOADED') ){ //request loading of JS file in footer of page load
|
593 |
+
add_action('wp_footer','EM_Bookings::em_booking_js_footer', 20);
|
594 |
+
add_action('admin_footer','EM_Bookings::em_booking_js_footer', 20);
|
595 |
+
define('EM_BOOKING_JS_LOADED',true);
|
596 |
+
}
|
597 |
+
}
|
598 |
+
|
599 |
+
static function em_booking_js_footer(){
|
600 |
+
?>
|
601 |
+
<script type="text/javascript">
|
602 |
+
jQuery(document).ready( function($){
|
603 |
+
<?php
|
604 |
+
//we call the segmented JS files and include them here
|
605 |
+
$include_path = dirname(dirname(__FILE__)); //get path to parent directory
|
606 |
+
include($include_path.'/includes/js/bookingsform.js');
|
607 |
+
do_action('em_gateway_js'); //deprecated use em_booking_js below instead
|
608 |
+
do_action('em_booking_js'); //use this instead
|
609 |
+
?>
|
610 |
+
});
|
611 |
+
<?php
|
612 |
+
do_action('em_booking_js_footer');
|
613 |
+
?>
|
614 |
+
</script>
|
615 |
+
<?php
|
616 |
+
}
|
617 |
+
|
618 |
+
/**
|
619 |
+
* Checks whether a booking being made should register user information as a booking from another user whilst an admin is logged in
|
620 |
+
* @return boolean
|
621 |
+
*/
|
622 |
+
public static function is_registration_forced(){
|
623 |
+
return ( defined('EM_FORCE_REGISTRATION') || self::$force_registration );
|
624 |
+
}
|
625 |
+
|
626 |
+
/* Overrides EM_Object method to apply a filter to result
|
627 |
+
* @see wp-content/plugins/events-manager/classes/EM_Object#build_sql_conditions()
|
628 |
+
*/
|
629 |
+
public static function build_sql_conditions( $args = array() ){
|
630 |
+
$conditions = apply_filters( 'em_bookings_build_sql_conditions', parent::build_sql_conditions($args), $args );
|
631 |
+
if( is_numeric($args['status']) ){
|
632 |
+
$conditions['status'] = 'booking_status='.$args['status'];
|
633 |
+
}elseif( self::array_is_numeric($args['status']) && count($args['status']) > 0 ){
|
634 |
+
$conditions['status'] = 'booking_status IN ('.implode(',',$args['status']).')';
|
635 |
+
}elseif( !is_array($args['status']) && preg_match('/^([0-9],?)+$/', $args['status']) ){
|
636 |
+
$conditions['status'] = 'booking_status IN ('.$args['status'].')';
|
637 |
+
}
|
638 |
+
if( is_numeric($args['person']) ){
|
639 |
+
$conditions['person'] = EM_BOOKINGS_TABLE.'.person_id='.$args['person'];
|
640 |
+
}
|
641 |
+
if( EM_MS_GLOBAL && !empty($args['blog']) && is_numeric($args['blog']) ){
|
642 |
+
if( is_main_site($args['blog']) ){
|
643 |
+
$conditions['blog'] = "(".EM_EVENTS_TABLE.".blog_id={$args['blog']} OR ".EM_EVENTS_TABLE.".blog_id IS NULL)";
|
644 |
+
}else{
|
645 |
+
$conditions['blog'] = "(".EM_EVENTS_TABLE.".blog_id={$args['blog']})";
|
646 |
+
}
|
647 |
+
}
|
648 |
+
if( empty($conditions['event']) && $args['event'] === false ){
|
649 |
+
$conditions['event'] = EM_BOOKINGS_TABLE.'.event_id != 0';
|
650 |
+
}
|
651 |
+
if( is_numeric($args['ticket_id']) ){
|
652 |
+
$EM_Ticket = new EM_Ticket($args['ticket_id']);
|
653 |
+
if( $EM_Ticket->can_manage() ){
|
654 |
+
$conditions['ticket'] = EM_BOOKINGS_TABLE.'.booking_id IN (SELECT booking_id FROM '.EM_TICKETS_BOOKINGS_TABLE." WHERE ticket_id='{$args['ticket_id']}')";
|
655 |
+
}
|
656 |
+
}
|
657 |
+
return apply_filters('em_bookings_build_sql_conditions', $conditions, $args);
|
658 |
+
}
|
659 |
+
|
660 |
+
/* Overrides EM_Object method to apply a filter to result
|
661 |
+
* @see wp-content/plugins/events-manager/classes/EM_Object#build_sql_orderby()
|
662 |
+
*/
|
663 |
+
public static function build_sql_orderby( $args, $accepted_fields, $default_order = 'ASC' ){
|
664 |
+
return apply_filters( 'em_bookings_build_sql_orderby', parent::build_sql_orderby($args, $accepted_fields, get_option('dbem_bookings_default_order','booking_date')), $args, $accepted_fields, $default_order );
|
665 |
+
}
|
666 |
+
|
667 |
+
/*
|
668 |
+
* Adds custom Events search defaults
|
669 |
+
* @param array $array_or_defaults may be the array to override defaults
|
670 |
+
* @param array $array
|
671 |
+
* @return array
|
672 |
+
* @uses EM_Object#get_default_search()
|
673 |
+
*/
|
674 |
+
public static function get_default_search( $array_or_defaults = array(), $array = array() ){
|
675 |
+
$defaults = array(
|
676 |
+
'status' => false,
|
677 |
+
'person' => true, //to add later, search by person's bookings...
|
678 |
+
'blog' => get_current_blog_id(),
|
679 |
+
'ticket_id' => false
|
680 |
+
);
|
681 |
+
//sort out whether defaults were supplied or just the array of search values
|
682 |
+
if( empty($array) ){
|
683 |
+
$array = $array_or_defaults;
|
684 |
+
}else{
|
685 |
+
$defaults = array_merge($defaults, $array_or_defaults);
|
686 |
+
}
|
687 |
+
//figure out default owning permissions
|
688 |
+
if( !current_user_can('edit_others_events') ){
|
689 |
+
$defaults['owner'] = get_current_user_id();
|
690 |
+
}else{
|
691 |
+
$defaults['owner'] = false;
|
692 |
+
}
|
693 |
+
if( EM_MS_GLOBAL && !is_admin() ){
|
694 |
+
if( empty($array['blog']) && is_main_site() && get_site_option('dbem_ms_global_events') ){
|
695 |
+
$array['blog'] = false;
|
696 |
+
}
|
697 |
+
}
|
698 |
+
return apply_filters('em_bookings_get_default_search', parent::get_default_search($defaults,$array), $array, $defaults);
|
699 |
+
}
|
700 |
+
|
701 |
+
//Iterator Implementation
|
702 |
+
public function rewind(){
|
703 |
+
reset($this->bookings);
|
704 |
+
}
|
705 |
+
public function current(){
|
706 |
+
$var = current($this->bookings);
|
707 |
+
return $var;
|
708 |
+
}
|
709 |
+
public function key(){
|
710 |
+
$var = key($this->bookings);
|
711 |
+
return $var;
|
712 |
+
}
|
713 |
+
public function next(){
|
714 |
+
$var = next($this->bookings);
|
715 |
+
return $var;
|
716 |
+
}
|
717 |
+
public function valid(){
|
718 |
+
$key = key($this->bookings);
|
719 |
+
$var = ($key !== NULL && $key !== FALSE);
|
720 |
+
return $var;
|
721 |
+
}
|
722 |
+
}
|
723 |
?>
|
classes/em-calendar.php
CHANGED
@@ -1,442 +1,454 @@
|
|
1 |
-
<?php
|
2 |
-
class EM_Calendar extends EM_Object {
|
3 |
-
|
4 |
-
public static function init(){
|
5 |
-
//nothing to init anymore
|
6 |
-
}
|
7 |
-
|
8 |
-
public static function get( $args ){
|
9 |
-
|
10 |
-
global $wpdb;
|
11 |
-
|
12 |
-
$calendar_array = array();
|
13 |
-
$calendar_array['cells'] = array();
|
14 |
-
|
15 |
-
$args = apply_filters('em_calendar_get_args', $args);
|
16 |
-
$original_args = $args;
|
17 |
-
$args = self::get_default_search($args);
|
18 |
-
$full = $args['full']; //For ZDE, don't delete pls
|
19 |
-
$month = $args['month'];
|
20 |
-
$year = $args['year'];
|
21 |
-
$long_events = $args['long_events'];
|
22 |
-
$limit = $args['limit']; //limit arg will be used per day and not for events search
|
23 |
-
|
24 |
-
$week_starts_on_sunday = get_option('dbem_week_starts_sunday');
|
25 |
-
$start_of_week = get_option('start_of_week');
|
26 |
-
|
27 |
-
if( !(is_numeric($month) && $month <= 12 && $month > 0) ) {
|
28 |
-
$month = date('m', current_time('timestamp'));
|
29 |
-
}
|
30 |
-
if( !( is_numeric($year) ) ){
|
31 |
-
$year = date('Y', current_time('timestamp'));
|
32 |
-
}
|
33 |
-
|
34 |
-
// Get the first day of the month
|
35 |
-
$month_start = mktime(0,0,0,$month, 1, $year);
|
36 |
-
$calendar_array['month_start'] = $month_start;
|
37 |
-
|
38 |
-
// Get friendly month name
|
39 |
-
$month_name = date('M',$month_start);
|
40 |
-
// Figure out which day of the week
|
41 |
-
// the month starts on.
|
42 |
-
$month_start_day = date('D', $month_start);
|
43 |
-
|
44 |
-
switch($month_start_day){
|
45 |
-
case "Sun": $offset = 0; break;
|
46 |
-
case "Mon": $offset = 1; break;
|
47 |
-
case "Tue": $offset = 2; break;
|
48 |
-
case "Wed": $offset = 3; break;
|
49 |
-
case "Thu": $offset = 4; break;
|
50 |
-
case "Fri": $offset = 5; break;
|
51 |
-
case "Sat": $offset = 6; break;
|
52 |
-
}
|
53 |
-
//We need to go back to the WP defined day when the week started, in case the event day is near the end
|
54 |
-
$offset -= $start_of_week;
|
55 |
-
if($offset<0)
|
56 |
-
$offset += 7;
|
57 |
-
|
58 |
-
// determine how many days are in the last month.
|
59 |
-
$month_last = $month-1;
|
60 |
-
$month_next = $month+1;
|
61 |
-
$
|
62 |
-
$
|
63 |
-
|
64 |
-
$
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$calendar_array['
|
74 |
-
$calendar_array['
|
75 |
-
|
76 |
-
$num_days_last = self::days_in_month($month_last, $year_last);
|
77 |
-
|
78 |
-
// determine how many days are in the current month.
|
79 |
-
$num_days_current = self::days_in_month($month, $year);
|
80 |
-
// Build an array for the current days
|
81 |
-
// in the month
|
82 |
-
for($i = 1; $i <= $num_days_current; $i++){
|
83 |
-
$num_days_array[] = mktime(0,0,0,$month, $i, $year);
|
84 |
-
}
|
85 |
-
// Build an array for the number of days
|
86 |
-
// in last month
|
87 |
-
for($i = 1; $i <= $num_days_last; $i++){
|
88 |
-
$num_days_last_array[] = mktime(0,0,0,$month_last, $i, $year_last);
|
89 |
-
}
|
90 |
-
// If the $offset from the starting day of the
|
91 |
-
// week happens to be Sunday, $offset would be 0,
|
92 |
-
// so don't need an offset correction.
|
93 |
-
|
94 |
-
if($offset > 0){
|
95 |
-
$offset_correction = array_slice($num_days_last_array, -$offset, $offset);
|
96 |
-
$new_count = array_merge($offset_correction, $num_days_array);
|
97 |
-
$offset_count = count($offset_correction);
|
98 |
-
} else { // The else statement is to prevent building the $offset array.
|
99 |
-
$offset_count = 0;
|
100 |
-
$new_count = $num_days_array;
|
101 |
-
}
|
102 |
-
// count how many days we have with the two
|
103 |
-
// previous arrays merged together
|
104 |
-
$current_num = count($new_count);
|
105 |
-
|
106 |
-
// Since we will have 5 HTML table rows (TR)
|
107 |
-
// with 7 table data entries (TD)
|
108 |
-
// we need to fill in 35 TDs
|
109 |
-
// so, we will have to figure out
|
110 |
-
// how many days to appened to the end
|
111 |
-
// of the final array to make it 35 days.
|
112 |
-
if( !empty($args['number_of_weeks']) && is_numeric($args['number_of_weeks']) ){
|
113 |
-
$num_weeks = $args['number_of_weeks'];
|
114 |
-
}elseif($current_num > 35){
|
115 |
-
$num_weeks = 6;
|
116 |
-
}else{
|
117 |
-
$num_weeks = 5;
|
118 |
-
}
|
119 |
-
$outset = ($num_weeks * 7) - $current_num;
|
120 |
-
// Outset Correction
|
121 |
-
for($i = 1; $i <= $outset; $i++){
|
122 |
-
$new_count[] = mktime(0,0,0,$month_next, $i, $year_next);
|
123 |
-
}
|
124 |
-
// Now let's "chunk" the $all_days array
|
125 |
-
// into weeks. Each week has 7 days
|
126 |
-
// so we will array_chunk it into 7 days.
|
127 |
-
$weeks = array_chunk($new_count, 7);
|
128 |
-
|
129 |
-
//Get an array of arguments that don't include default valued args
|
130 |
-
$link_args = self::
|
131 |
-
|
132 |
-
$previous_url =
|
133 |
-
$next_url =
|
134 |
-
|
135 |
-
$weekdays = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
|
136 |
-
if(!empty($args['full'])) {
|
137 |
-
if( get_option('dbem_full_calendar_abbreviated_weekdays') ) $weekdays = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
|
138 |
-
$day_initials_length = get_option('dbem_full_calendar_initials_length');
|
139 |
-
} else {
|
140 |
-
if ( get_option('dbem_small_calendar_abbreviated_weekdays') ) $weekdays = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
|
141 |
-
$day_initials_length = get_option('dbem_small_calendar_initials_length');
|
142 |
-
}
|
143 |
-
|
144 |
-
for( $n = 0; $n < $start_of_week; $n++ ) {
|
145 |
-
$last_day = array_shift($weekdays);
|
146 |
-
$weekdays[]= $last_day;
|
147 |
-
}
|
148 |
-
|
149 |
-
$days_initials_array = array();
|
150 |
-
foreach($weekdays as $weekday) {
|
151 |
-
$days_initials_array[] = self::translate_and_trim($weekday, $day_initials_length);
|
152 |
-
}
|
153 |
-
|
154 |
-
$calendar_array['links'] = array( 'previous_url'=>$previous_url, 'next_url'=>$next_url);
|
155 |
-
$calendar_array['row_headers'] = $days_initials_array;
|
156 |
-
|
157 |
-
// Now we break each key of the array
|
158 |
-
// into a week and create a new table row for each
|
159 |
-
// week with the days of that week in the table data
|
160 |
-
|
161 |
-
$i = 0;
|
162 |
-
$current_date = date('Y-m-d', current_time('timestamp'));
|
163 |
-
$week_count = 0;
|
164 |
-
foreach ( $weeks as $week ) {
|
165 |
-
foreach ( $week as $d ) {
|
166 |
-
$date = date('Y-m-d', $d);
|
167 |
-
$calendar_array['cells'][$date] = array('date'=>$d, 'events'=>array(), 'events_count'=>0); //set it up so we have the exact array of dates to be filled
|
168 |
-
if ($i < $offset_count) { //if it is PREVIOUS month
|
169 |
-
$calendar_array['cells'][$date]['type'] = 'pre';
|
170 |
-
}
|
171 |
-
if (($i >= $offset_count) && ($i < ($num_weeks * 7) - $outset)) { // if it is THIS month
|
172 |
-
if ( $current_date == $date ){
|
173 |
-
$calendar_array['cells'][$date]['type'] = 'today';
|
174 |
-
}
|
175 |
-
} elseif (($outset > 0)) { //if it is NEXT month
|
176 |
-
if (($i >= ($num_weeks * 7) - $outset)) {
|
177 |
-
$calendar_array['cells'][$date]['type'] = 'post';
|
178 |
-
}
|
179 |
-
}
|
180 |
-
$i ++;
|
181 |
-
}
|
182 |
-
$week_count++;
|
183 |
-
}
|
184 |
-
|
185 |
-
//query the database for events in this time span with $offset days before and $outset days after this month to account for these cells in the calendar
|
186 |
-
$scope_datetime_start = new DateTime("{$year}-{$month}-1");
|
187 |
-
$scope_datetime_end = new DateTime($scope_datetime_start->format('Y-m-t'));
|
188 |
-
$scope_datetime_start->modify("-$offset days");
|
189 |
-
$scope_datetime_end->modify("+$outset days");
|
190 |
-
//we have two methods here, one for high-volume event sites i.e. many thousands of events per month, and another for thousands or less per month.
|
191 |
-
$args['array'] = true; //we're getting an array first to avoid extra queries during object creation
|
192 |
-
unset($args['month']);
|
193 |
-
unset($args['year']);
|
194 |
-
unset($args['limit']); //limits in the events search won't help
|
195 |
-
if( defined('EM_CALENDAR_OPT') && EM_CALENDAR_OPT ){
|
196 |
-
//here we loop through each day, query that specific date, and then compile a list of event objects
|
197 |
-
//in this mode the count will never be accurate, we're grabing at most (31 + 14 days) * (limit + 1) events to reduce memory loads
|
198 |
-
$args['limit'] = $limit + 1;
|
199 |
-
$scope_datetime_loop = $scope_datetime_start->format('U');
|
200 |
-
$events = array();
|
201 |
-
while( $scope_datetime_loop <= $scope_datetime_end->format('U') ){
|
202 |
-
$args['scope'] = date('Y-m-d', $scope_datetime_loop);
|
203 |
-
foreach( EM_Events::get($args) as $event ){
|
204 |
-
$events[$event['event_id']] = $event;
|
205 |
-
}
|
206 |
-
$scope_datetime_loop += (86400); //add a day
|
207 |
-
}
|
208 |
-
}else{
|
209 |
-
//just load all the events for this time-range
|
210 |
-
$args['scope'] = array( $scope_datetime_start->format('Y-m-d'), $scope_datetime_end->format('Y-m-d'));
|
211 |
-
$events = EM_Events::get($args);
|
212 |
-
}
|
213 |
-
//back to what it was
|
214 |
-
$args['month'] = $month;
|
215 |
-
$args['year'] = $year;
|
216 |
-
$args['limit'] = $limit;
|
217 |
-
|
218 |
-
$event_format = get_option('dbem_full_calendar_event_format');
|
219 |
-
$event_title_format = get_option('dbem_small_calendar_event_title_format');
|
220 |
-
$event_title_separator_format = get_option('dbem_small_calendar_event_title_separator');
|
221 |
-
|
222 |
-
$eventful_days= array();
|
223 |
-
$eventful_days_count = array();
|
224 |
-
if($events){
|
225 |
-
//Go through the events and slot them into the right d-m index
|
226 |
-
foreach($events as $event) {
|
227 |
-
$event = apply_filters('em_calendar_output_loop_start', $event);
|
228 |
-
if( $long_events ){
|
229 |
-
//If $long_events is set then show a date as eventful if there is an multi-day event which runs during that day
|
230 |
-
$event_start_ts = strtotime($event['event_start_date']);
|
231 |
-
$event_end_ts = strtotime($event['event_end_date']);
|
232 |
-
$event_end_ts = $event_end_ts > $scope_datetime_end->format('U') ? $scope_datetime_end->format('U') : $event_end_ts;
|
233 |
-
while( $event_start_ts <= $event_end_ts ){ //we loop until the last day of our time-range, not the end date of the event, which could be in a year
|
234 |
-
//Ensure date is within event dates and also within the limits of events to show per day, if so add to eventful days array
|
235 |
-
$event_eventful_date = date('Y-m-d', $event_start_ts);
|
236 |
-
if( empty($eventful_days_count[$event_eventful_date]) || !$limit || $eventful_days_count[$event_eventful_date] < $limit ){
|
237 |
-
//now we know this is an event that'll be used, convert it to an object
|
238 |
-
$EM_Event = EM_MS_GLOBAL ? em_get_event($event['post_id'], $event['blog_id']) : $EM_Event = em_get_event($event['post_id'], 'post_id');
|
239 |
-
if( empty($eventful_days[$event_eventful_date]) || !is_array($eventful_days[$event_eventful_date]) ) $eventful_days[$event_eventful_date] = array();
|
240 |
-
//add event to array with a corresponding timestamp for sorting of times including long and all-day events
|
241 |
-
$event_ts_marker = ($EM_Event->event_all_day) ? 0 : (int) strtotime($event_eventful_date.' '.$EM_Event->event_start_time);
|
242 |
-
while( !empty($eventful_days[$event_eventful_date][$event_ts_marker]) ){
|
243 |
-
$event_ts_marker++; //add a second
|
244 |
-
}
|
245 |
-
$eventful_days[$event_eventful_date][$event_ts_marker] = $EM_Event;
|
246 |
-
}
|
247 |
-
//count events for that day
|
248 |
-
$eventful_days_count[$event_eventful_date] = empty($eventful_days_count[$event_eventful_date]) ? 1 : $eventful_days_count[$event_eventful_date]+1;
|
249 |
-
$event_start_ts += (86400); //add a day
|
250 |
-
}
|
251 |
-
}else{
|
252 |
-
//Only show events on the day that they start
|
253 |
-
$event_eventful_date = $event['event_start_date'];
|
254 |
-
if( empty($eventful_days_count[$event_eventful_date]) || !$limit || $eventful_days_count[$event_eventful_date] < $limit ){
|
255 |
-
$EM_Event = EM_MS_GLOBAL ? em_get_event($event['post_id'], $event['blog_id']) : em_get_event($event['post_id'], 'post_id');
|
256 |
-
if( empty($eventful_days[$event_eventful_date]) || !is_array($eventful_days[$event_eventful_date]) ) $eventful_days[$event_eventful_date] = array();
|
257 |
-
//add event to array with a corresponding timestamp for sorting of times including long and all-day events
|
258 |
-
$event_ts_marker = ($EM_Event->event_all_day) ? 0 : (int) $EM_Event->start;
|
259 |
-
while( !empty($eventful_days[$event_eventful_date][$event_ts_marker]) ){
|
260 |
-
$event_ts_marker++; //add a second
|
261 |
-
}
|
262 |
-
$eventful_days[$event_eventful_date][$event_ts_marker] = $EM_Event;
|
263 |
-
}
|
264 |
-
//count events for that day
|
265 |
-
$eventful_days_count[$event['event_start_date']] = empty($eventful_days_count[$event['event_start_date']]) ? 1 : $eventful_days_count[$event['event_start_date']]+1;
|
266 |
-
}
|
267 |
-
}
|
268 |
-
}
|
269 |
-
//generate a link argument string containing event search only
|
270 |
-
$day_link_args = self::
|
271 |
-
foreach($eventful_days as $day_key => $events) {
|
272 |
-
if( array_key_exists($day_key, $calendar_array['cells']) ){
|
273 |
-
//Get link title for this date
|
274 |
-
$events_titles = array();
|
275 |
-
foreach($events as $event) {
|
276 |
-
if( !$limit || count($events_titles) < $limit ){
|
277 |
-
$events_titles[] = $event->output($event_title_format);
|
278 |
-
}else{
|
279 |
-
$events_titles[] = get_option('dbem_display_calendar_events_limit_msg');
|
280 |
-
break;
|
281 |
-
}
|
282 |
-
}
|
283 |
-
$calendar_array['cells'][$day_key]['link_title'] = implode( $event_title_separator_format, $events_titles);
|
284 |
-
|
285 |
-
//Get the link to this calendar day
|
286 |
-
global $wp_rewrite;
|
287 |
-
if( $eventful_days_count[$day_key] > 1 || !get_option('dbem_calendar_direct_links') ){
|
288 |
-
if( get_option("dbem_events_page") > 0 ){
|
289 |
-
$event_page_link = get_permalink(get_option("dbem_events_page")); //PAGE URI OF EM
|
290 |
-
}else{
|
291 |
-
if( $wp_rewrite->using_permalinks() ){
|
292 |
-
$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.
|
293 |
-
}else{
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
$calendar_array['cells'][$day_key]['
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
//
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
$
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
*
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
$
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
'
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
$
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
add_action('init', array('EM_Calendar', 'init'));
|
1 |
+
<?php
|
2 |
+
class EM_Calendar extends EM_Object {
|
3 |
+
|
4 |
+
public static function init(){
|
5 |
+
//nothing to init anymore
|
6 |
+
}
|
7 |
+
|
8 |
+
public static function get( $args ){
|
9 |
+
|
10 |
+
global $wpdb;
|
11 |
+
|
12 |
+
$calendar_array = array();
|
13 |
+
$calendar_array['cells'] = array();
|
14 |
+
|
15 |
+
$args = apply_filters('em_calendar_get_args', $args);
|
16 |
+
$original_args = $args;
|
17 |
+
$args = self::get_default_search($args);
|
18 |
+
$full = $args['full']; //For ZDE, don't delete pls
|
19 |
+
$month = $args['month'];
|
20 |
+
$year = $args['year'];
|
21 |
+
$long_events = $args['long_events'];
|
22 |
+
$limit = $args['limit']; //limit arg will be used per day and not for events search
|
23 |
+
|
24 |
+
$week_starts_on_sunday = get_option('dbem_week_starts_sunday');
|
25 |
+
$start_of_week = get_option('start_of_week');
|
26 |
+
|
27 |
+
if( !(is_numeric($month) && $month <= 12 && $month > 0) ) {
|
28 |
+
$month = date('m', current_time('timestamp'));
|
29 |
+
}
|
30 |
+
if( !( is_numeric($year) ) ){
|
31 |
+
$year = date('Y', current_time('timestamp'));
|
32 |
+
}
|
33 |
+
|
34 |
+
// Get the first day of the month
|
35 |
+
$month_start = mktime(0,0,0,$month, 1, $year);
|
36 |
+
$calendar_array['month_start'] = $month_start;
|
37 |
+
|
38 |
+
// Get friendly month name
|
39 |
+
$month_name = date('M',$month_start);
|
40 |
+
// Figure out which day of the week
|
41 |
+
// the month starts on.
|
42 |
+
$month_start_day = date('D', $month_start);
|
43 |
+
|
44 |
+
switch($month_start_day){
|
45 |
+
case "Sun": $offset = 0; break;
|
46 |
+
case "Mon": $offset = 1; break;
|
47 |
+
case "Tue": $offset = 2; break;
|
48 |
+
case "Wed": $offset = 3; break;
|
49 |
+
case "Thu": $offset = 4; break;
|
50 |
+
case "Fri": $offset = 5; break;
|
51 |
+
case "Sat": $offset = 6; break;
|
52 |
+
}
|
53 |
+
//We need to go back to the WP defined day when the week started, in case the event day is near the end
|
54 |
+
$offset -= $start_of_week;
|
55 |
+
if($offset<0)
|
56 |
+
$offset += 7;
|
57 |
+
|
58 |
+
// determine how many days are in the last month.
|
59 |
+
$month_last = $month-1;
|
60 |
+
$month_next = $month+1;
|
61 |
+
$year_last = $year;
|
62 |
+
$year_next = $year;
|
63 |
+
|
64 |
+
if($month == 1) {
|
65 |
+
$month_last = 12;
|
66 |
+
$year_last = $year -1;
|
67 |
+
}elseif($month == 12){
|
68 |
+
$month_next = 1;
|
69 |
+
$year_next = $year + 1;
|
70 |
+
}
|
71 |
+
$calendar_array['month_next'] = $month_next;
|
72 |
+
$calendar_array['month_last'] = $month_last;
|
73 |
+
$calendar_array['year_last'] = $year_last;
|
74 |
+
$calendar_array['year_next'] = $year_next;
|
75 |
+
|
76 |
+
$num_days_last = self::days_in_month($month_last, $year_last);
|
77 |
+
|
78 |
+
// determine how many days are in the current month.
|
79 |
+
$num_days_current = self::days_in_month($month, $year);
|
80 |
+
// Build an array for the current days
|
81 |
+
// in the month
|
82 |
+
for($i = 1; $i <= $num_days_current; $i++){
|
83 |
+
$num_days_array[] = mktime(0,0,0,$month, $i, $year);
|
84 |
+
}
|
85 |
+
// Build an array for the number of days
|
86 |
+
// in last month
|
87 |
+
for($i = 1; $i <= $num_days_last; $i++){
|
88 |
+
$num_days_last_array[] = mktime(0,0,0,$month_last, $i, $year_last);
|
89 |
+
}
|
90 |
+
// If the $offset from the starting day of the
|
91 |
+
// week happens to be Sunday, $offset would be 0,
|
92 |
+
// so don't need an offset correction.
|
93 |
+
|
94 |
+
if($offset > 0){
|
95 |
+
$offset_correction = array_slice($num_days_last_array, -$offset, $offset);
|
96 |
+
$new_count = array_merge($offset_correction, $num_days_array);
|
97 |
+
$offset_count = count($offset_correction);
|
98 |
+
} else { // The else statement is to prevent building the $offset array.
|
99 |
+
$offset_count = 0;
|
100 |
+
$new_count = $num_days_array;
|
101 |
+
}
|
102 |
+
// count how many days we have with the two
|
103 |
+
// previous arrays merged together
|
104 |
+
$current_num = count($new_count);
|
105 |
+
|
106 |
+
// Since we will have 5 HTML table rows (TR)
|
107 |
+
// with 7 table data entries (TD)
|
108 |
+
// we need to fill in 35 TDs
|
109 |
+
// so, we will have to figure out
|
110 |
+
// how many days to appened to the end
|
111 |
+
// of the final array to make it 35 days.
|
112 |
+
if( !empty($args['number_of_weeks']) && is_numeric($args['number_of_weeks']) ){
|
113 |
+
$num_weeks = $args['number_of_weeks'];
|
114 |
+
}elseif($current_num > 35){
|
115 |
+
$num_weeks = 6;
|
116 |
+
}else{
|
117 |
+
$num_weeks = 5;
|
118 |
+
}
|
119 |
+
$outset = ($num_weeks * 7) - $current_num;
|
120 |
+
// Outset Correction
|
121 |
+
for($i = 1; $i <= $outset; $i++){
|
122 |
+
$new_count[] = mktime(0,0,0,$month_next, $i, $year_next);
|
123 |
+
}
|
124 |
+
// Now let's "chunk" the $all_days array
|
125 |
+
// into weeks. Each week has 7 days
|
126 |
+
// so we will array_chunk it into 7 days.
|
127 |
+
$weeks = array_chunk($new_count, 7);
|
128 |
+
|
129 |
+
//Get an array of arguments that don't include default valued args
|
130 |
+
$link_args = self::get_query_args($args);
|
131 |
+
$link_args['ajaxCalendar'] = 1;
|
132 |
+
$previous_url = esc_url_raw(add_query_arg( array_merge($link_args, array('mo'=>$month_last, 'yr'=>$year_last)) ));
|
133 |
+
$next_url = esc_url_raw(add_query_arg( array_merge($link_args, array('mo'=>$month_next, 'yr'=>$year_next)) ));
|
134 |
+
|
135 |
+
$weekdays = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
|
136 |
+
if(!empty($args['full'])) {
|
137 |
+
if( get_option('dbem_full_calendar_abbreviated_weekdays') ) $weekdays = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
|
138 |
+
$day_initials_length = get_option('dbem_full_calendar_initials_length');
|
139 |
+
} else {
|
140 |
+
if ( get_option('dbem_small_calendar_abbreviated_weekdays') ) $weekdays = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
|
141 |
+
$day_initials_length = get_option('dbem_small_calendar_initials_length');
|
142 |
+
}
|
143 |
+
|
144 |
+
for( $n = 0; $n < $start_of_week; $n++ ) {
|
145 |
+
$last_day = array_shift($weekdays);
|
146 |
+
$weekdays[]= $last_day;
|
147 |
+
}
|
148 |
+
|
149 |
+
$days_initials_array = array();
|
150 |
+
foreach($weekdays as $weekday) {
|
151 |
+
$days_initials_array[] = esc_html(self::translate_and_trim($weekday, $day_initials_length));
|
152 |
+
}
|
153 |
+
|
154 |
+
$calendar_array['links'] = array( 'previous_url'=>$previous_url, 'next_url'=>$next_url);
|
155 |
+
$calendar_array['row_headers'] = $days_initials_array;
|
156 |
+
|
157 |
+
// Now we break each key of the array
|
158 |
+
// into a week and create a new table row for each
|
159 |
+
// week with the days of that week in the table data
|
160 |
+
|
161 |
+
$i = 0;
|
162 |
+
$current_date = date('Y-m-d', current_time('timestamp'));
|
163 |
+
$week_count = 0;
|
164 |
+
foreach ( $weeks as $week ) {
|
165 |
+
foreach ( $week as $d ) {
|
166 |
+
$date = date('Y-m-d', $d);
|
167 |
+
$calendar_array['cells'][$date] = array('date'=>$d, 'events'=>array(), 'events_count'=>0); //set it up so we have the exact array of dates to be filled
|
168 |
+
if ($i < $offset_count) { //if it is PREVIOUS month
|
169 |
+
$calendar_array['cells'][$date]['type'] = 'pre';
|
170 |
+
}
|
171 |
+
if (($i >= $offset_count) && ($i < ($num_weeks * 7) - $outset)) { // if it is THIS month
|
172 |
+
if ( $current_date == $date ){
|
173 |
+
$calendar_array['cells'][$date]['type'] = 'today';
|
174 |
+
}
|
175 |
+
} elseif (($outset > 0)) { //if it is NEXT month
|
176 |
+
if (($i >= ($num_weeks * 7) - $outset)) {
|
177 |
+
$calendar_array['cells'][$date]['type'] = 'post';
|
178 |
+
}
|
179 |
+
}
|
180 |
+
$i ++;
|
181 |
+
}
|
182 |
+
$week_count++;
|
183 |
+
}
|
184 |
+
|
185 |
+
//query the database for events in this time span with $offset days before and $outset days after this month to account for these cells in the calendar
|
186 |
+
$scope_datetime_start = new DateTime("{$year}-{$month}-1");
|
187 |
+
$scope_datetime_end = new DateTime($scope_datetime_start->format('Y-m-t'));
|
188 |
+
$scope_datetime_start->modify("-$offset days");
|
189 |
+
$scope_datetime_end->modify("+$outset days");
|
190 |
+
//we have two methods here, one for high-volume event sites i.e. many thousands of events per month, and another for thousands or less per month.
|
191 |
+
$args['array'] = true; //we're getting an array first to avoid extra queries during object creation
|
192 |
+
unset($args['month']);
|
193 |
+
unset($args['year']);
|
194 |
+
unset($args['limit']); //limits in the events search won't help
|
195 |
+
if( defined('EM_CALENDAR_OPT') && EM_CALENDAR_OPT ){
|
196 |
+
//here we loop through each day, query that specific date, and then compile a list of event objects
|
197 |
+
//in this mode the count will never be accurate, we're grabing at most (31 + 14 days) * (limit + 1) events to reduce memory loads
|
198 |
+
$args['limit'] = $limit + 1;
|
199 |
+
$scope_datetime_loop = $scope_datetime_start->format('U');
|
200 |
+
$events = array();
|
201 |
+
while( $scope_datetime_loop <= $scope_datetime_end->format('U') ){
|
202 |
+
$args['scope'] = date('Y-m-d', $scope_datetime_loop);
|
203 |
+
foreach( EM_Events::get($args) as $event ){
|
204 |
+
$events[$event['event_id']] = $event;
|
205 |
+
}
|
206 |
+
$scope_datetime_loop += (86400); //add a day
|
207 |
+
}
|
208 |
+
}else{
|
209 |
+
//just load all the events for this time-range
|
210 |
+
$args['scope'] = array( $scope_datetime_start->format('Y-m-d'), $scope_datetime_end->format('Y-m-d'));
|
211 |
+
$events = EM_Events::get($args);
|
212 |
+
}
|
213 |
+
//back to what it was
|
214 |
+
$args['month'] = $month;
|
215 |
+
$args['year'] = $year;
|
216 |
+
$args['limit'] = $limit;
|
217 |
+
|
218 |
+
$event_format = get_option('dbem_full_calendar_event_format');
|
219 |
+
$event_title_format = get_option('dbem_small_calendar_event_title_format');
|
220 |
+
$event_title_separator_format = get_option('dbem_small_calendar_event_title_separator');
|
221 |
+
|
222 |
+
$eventful_days= array();
|
223 |
+
$eventful_days_count = array();
|
224 |
+
if($events){
|
225 |
+
//Go through the events and slot them into the right d-m index
|
226 |
+
foreach($events as $event) {
|
227 |
+
$event = apply_filters('em_calendar_output_loop_start', $event);
|
228 |
+
if( $long_events ){
|
229 |
+
//If $long_events is set then show a date as eventful if there is an multi-day event which runs during that day
|
230 |
+
$event_start_ts = strtotime($event['event_start_date']);
|
231 |
+
$event_end_ts = strtotime($event['event_end_date']);
|
232 |
+
$event_end_ts = $event_end_ts > $scope_datetime_end->format('U') ? $scope_datetime_end->format('U') : $event_end_ts;
|
233 |
+
while( $event_start_ts <= $event_end_ts ){ //we loop until the last day of our time-range, not the end date of the event, which could be in a year
|
234 |
+
//Ensure date is within event dates and also within the limits of events to show per day, if so add to eventful days array
|
235 |
+
$event_eventful_date = date('Y-m-d', $event_start_ts);
|
236 |
+
if( empty($eventful_days_count[$event_eventful_date]) || !$limit || $eventful_days_count[$event_eventful_date] < $limit ){
|
237 |
+
//now we know this is an event that'll be used, convert it to an object
|
238 |
+
$EM_Event = EM_MS_GLOBAL ? em_get_event($event['post_id'], $event['blog_id']) : $EM_Event = em_get_event($event['post_id'], 'post_id');
|
239 |
+
if( empty($eventful_days[$event_eventful_date]) || !is_array($eventful_days[$event_eventful_date]) ) $eventful_days[$event_eventful_date] = array();
|
240 |
+
//add event to array with a corresponding timestamp for sorting of times including long and all-day events
|
241 |
+
$event_ts_marker = ($EM_Event->event_all_day) ? 0 : (int) strtotime($event_eventful_date.' '.$EM_Event->event_start_time);
|
242 |
+
while( !empty($eventful_days[$event_eventful_date][$event_ts_marker]) ){
|
243 |
+
$event_ts_marker++; //add a second
|
244 |
+
}
|
245 |
+
$eventful_days[$event_eventful_date][$event_ts_marker] = $EM_Event;
|
246 |
+
}
|
247 |
+
//count events for that day
|
248 |
+
$eventful_days_count[$event_eventful_date] = empty($eventful_days_count[$event_eventful_date]) ? 1 : $eventful_days_count[$event_eventful_date]+1;
|
249 |
+
$event_start_ts += (86400); //add a day
|
250 |
+
}
|
251 |
+
}else{
|
252 |
+
//Only show events on the day that they start
|
253 |
+
$event_eventful_date = $event['event_start_date'];
|
254 |
+
if( empty($eventful_days_count[$event_eventful_date]) || !$limit || $eventful_days_count[$event_eventful_date] < $limit ){
|
255 |
+
$EM_Event = EM_MS_GLOBAL ? em_get_event($event['post_id'], $event['blog_id']) : em_get_event($event['post_id'], 'post_id');
|
256 |
+
if( empty($eventful_days[$event_eventful_date]) || !is_array($eventful_days[$event_eventful_date]) ) $eventful_days[$event_eventful_date] = array();
|
257 |
+
//add event to array with a corresponding timestamp for sorting of times including long and all-day events
|
258 |
+
$event_ts_marker = ($EM_Event->event_all_day) ? 0 : (int) $EM_Event->start;
|
259 |
+
while( !empty($eventful_days[$event_eventful_date][$event_ts_marker]) ){
|
260 |
+
$event_ts_marker++; //add a second
|
261 |
+
}
|
262 |
+
$eventful_days[$event_eventful_date][$event_ts_marker] = $EM_Event;
|
263 |
+
}
|
264 |
+
//count events for that day
|
265 |
+
$eventful_days_count[$event['event_start_date']] = empty($eventful_days_count[$event['event_start_date']]) ? 1 : $eventful_days_count[$event['event_start_date']]+1;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
//generate a link argument string containing event search only
|
270 |
+
$day_link_args = self::get_query_args( array_intersect_key($original_args, EM_Events::get_post_search($args, true) ));
|
271 |
+
foreach($eventful_days as $day_key => $events) {
|
272 |
+
if( array_key_exists($day_key, $calendar_array['cells']) ){
|
273 |
+
//Get link title for this date
|
274 |
+
$events_titles = array();
|
275 |
+
foreach($events as $event) {
|
276 |
+
if( !$limit || count($events_titles) < $limit ){
|
277 |
+
$events_titles[] = $event->output($event_title_format);
|
278 |
+
}else{
|
279 |
+
$events_titles[] = get_option('dbem_display_calendar_events_limit_msg');
|
280 |
+
break;
|
281 |
+
}
|
282 |
+
}
|
283 |
+
$calendar_array['cells'][$day_key]['link_title'] = implode( $event_title_separator_format, $events_titles);
|
284 |
+
|
285 |
+
//Get the link to this calendar day
|
286 |
+
global $wp_rewrite;
|
287 |
+
if( $eventful_days_count[$day_key] > 1 || !get_option('dbem_calendar_direct_links') ){
|
288 |
+
if( get_option("dbem_events_page") > 0 ){
|
289 |
+
$event_page_link = get_permalink(get_option("dbem_events_page")); //PAGE URI OF EM
|
290 |
+
}else{
|
291 |
+
if( $wp_rewrite->using_permalinks() ){
|
292 |
+
$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.
|
293 |
+
}else{
|
294 |
+
//not needed atm anyway, but we use esc_url later on, in case you're wondering ;)
|
295 |
+
$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.
|
296 |
+
}
|
297 |
+
}
|
298 |
+
if( $wp_rewrite->using_permalinks() && !defined('EM_DISABLE_PERMALINKS') ){
|
299 |
+
$calendar_array['cells'][$day_key]['link'] = trailingslashit($event_page_link).$day_key."/";
|
300 |
+
//add query vars to end of link
|
301 |
+
if( !empty($day_link_args) ){
|
302 |
+
$calendar_array['cells'][$day_key]['link'] = esc_url_raw(add_query_arg($day_link_args, $calendar_array['cells'][$day_key]['link']));
|
303 |
+
}
|
304 |
+
}else{
|
305 |
+
$day_link_args['calendar_day'] = $day_key;
|
306 |
+
$calendar_array['cells'][$day_key]['link'] = esc_url_raw(add_query_arg($day_link_args, $event_page_link));
|
307 |
+
}
|
308 |
+
}else{
|
309 |
+
foreach($events as $EM_Event){
|
310 |
+
$calendar_array['cells'][$day_key]['link'] = $EM_Event->get_permalink();
|
311 |
+
}
|
312 |
+
}
|
313 |
+
//Add events to array
|
314 |
+
$calendar_array['cells'][$day_key]['events_count'] = $eventful_days_count[$day_key];
|
315 |
+
$calendar_array['cells'][$day_key]['events'] = $events;
|
316 |
+
}
|
317 |
+
}
|
318 |
+
return apply_filters('em_calendar_get',$calendar_array, $args);
|
319 |
+
}
|
320 |
+
|
321 |
+
public static function output($args = array(), $wrapper = true) {
|
322 |
+
//Let month and year REQUEST override for non-JS users
|
323 |
+
$args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_display_calendar_events_limit'); //limit arg will be used per day and not for events search
|
324 |
+
if( !empty($_REQUEST['mo']) || !empty($args['mo']) ){
|
325 |
+
$args['month'] = ($_REQUEST['mo']) ? $_REQUEST['mo']:$args['mo'];
|
326 |
+
}
|
327 |
+
if( !empty($_REQUEST['yr']) || !empty($args['yr']) ){
|
328 |
+
$args['year'] = (!empty($_REQUEST['yr'])) ? $_REQUEST['yr']:$args['yr'];
|
329 |
+
}
|
330 |
+
$calendar_array = self::get($args);
|
331 |
+
$template = (!empty($args['full'])) ? 'templates/calendar-full.php':'templates/calendar-small.php';
|
332 |
+
ob_start();
|
333 |
+
em_locate_template($template, true, array('calendar'=>$calendar_array,'args'=>$args));
|
334 |
+
if($wrapper){
|
335 |
+
$calendar = '<div id="em-calendar-'.rand(100,200).'" class="em-calendar-wrapper">'.ob_get_clean().'</div>';
|
336 |
+
}else{
|
337 |
+
$calendar = ob_get_clean();
|
338 |
+
}
|
339 |
+
return apply_filters('em_calendar_output', $calendar, $args);
|
340 |
+
}
|
341 |
+
|
342 |
+
|
343 |
+
public static function days_in_month($month, $year) {
|
344 |
+
return date('t', mktime(0,0,0,$month,1,$year));
|
345 |
+
}
|
346 |
+
|
347 |
+
public static function translate_and_trim($string, $length = 1) {
|
348 |
+
if( $length > 0 ){
|
349 |
+
if(function_exists('mb_substr')){ //fix for diacritic calendar names
|
350 |
+
return mb_substr(__($string,'dbem'), 0, $length, 'UTF-8');
|
351 |
+
}else{
|
352 |
+
return substr(__($string,'dbem'), 0, $length);
|
353 |
+
}
|
354 |
+
}
|
355 |
+
return __($string,'dbem');
|
356 |
+
}
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Gets all the EM-supported search arguments and removes the ones that aren't the default in the $args array. Returns the arguments that have non-default values.
|
360 |
+
* @param array $args
|
361 |
+
* @return array
|
362 |
+
*/
|
363 |
+
public static function get_query_args( $args ){
|
364 |
+
unset($args['month']); unset($args['year']);
|
365 |
+
$default_args = self::get_default_search(array());
|
366 |
+
foreach($default_args as $arg_key => $arg_value){
|
367 |
+
if( !isset($args[$arg_key]) ){
|
368 |
+
unset($args[$arg_key]);
|
369 |
+
}else{
|
370 |
+
//check that argument doesn't match default
|
371 |
+
$arg = array($args[$arg_key], $arg_value);
|
372 |
+
foreach($arg as $k => $v){
|
373 |
+
if( is_string($v) || is_numeric($v) ){
|
374 |
+
//strings must be typecast to avoid false positive for something like 'string' == 0
|
375 |
+
$arg[$k] = (string) $v;
|
376 |
+
}elseif( is_bool($v) ){
|
377 |
+
$arg[$k] = $v ? '1':'0';
|
378 |
+
}
|
379 |
+
}
|
380 |
+
if( $arg[0] == $arg[1] ){
|
381 |
+
//argument same as default so it's not needed in link
|
382 |
+
unset($args[$arg_key]);
|
383 |
+
}
|
384 |
+
}
|
385 |
+
}
|
386 |
+
return $args;
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* DEPRECATED - use EM_Calendar::get_query_args() instead and manipulate the array.
|
391 |
+
* Left only to prevent 3rd party add-ons from potentially breaking if they use this
|
392 |
+
* Helper function to create a link querystring from array which contains arguments with only values that aren't defuaults.
|
393 |
+
*/
|
394 |
+
public static function get_link_args($args = array(), $html_entities=true){
|
395 |
+
$args = self::get_query_args($args);
|
396 |
+
$qs_array = array();
|
397 |
+
foreach($args as $key => $value){
|
398 |
+
if(is_array($value)){
|
399 |
+
$value = implode(',',$value);
|
400 |
+
}
|
401 |
+
$qs_array[] = "$key=".urlencode($value);
|
402 |
+
}
|
403 |
+
return ($html_entities) ? implode('&', $qs_array) : implode('&', $qs_array);
|
404 |
+
}
|
405 |
+
|
406 |
+
|
407 |
+
/*
|
408 |
+
* Adds custom calendar search defaults
|
409 |
+
* @param array $array_or_defaults may be the array to override defaults
|
410 |
+
* @param array $array
|
411 |
+
* @return array
|
412 |
+
* @uses EM_Object#get_default_search()
|
413 |
+
*/
|
414 |
+
public static function get_default_search( $array_or_defaults = array(), $array = array() ){
|
415 |
+
//These defaults aren't for db queries, but flags for what to display in calendar output
|
416 |
+
$defaults = array(
|
417 |
+
'full' => 0, //Will display a full calendar with event names
|
418 |
+
'long_events' => 0, //Events that last longer than a day
|
419 |
+
'scope' => false,
|
420 |
+
'status' => 1, //approved events only
|
421 |
+
'town' => false,
|
422 |
+
'state' => false,
|
423 |
+
'country' => false,
|
424 |
+
'region' => false,
|
425 |
+
'blog' => get_current_blog_id(),
|
426 |
+
'orderby' => get_option('dbem_display_calendar_orderby'),
|
427 |
+
'order' => get_option('dbem_display_calendar_order'),
|
428 |
+
'number_of_weeks' => false, //number of weeks to be displayed in the calendar
|
429 |
+
'limit' => get_option('dbem_display_calendar_events_limit')
|
430 |
+
);
|
431 |
+
//sort out whether defaults were supplied or just the array of search values
|
432 |
+
if( empty($array) ){
|
433 |
+
$array = $array_or_defaults;
|
434 |
+
}else{
|
435 |
+
$defaults = array_merge($defaults, $array_or_defaults);
|
436 |
+
}
|
437 |
+
$defaults['long_events'] = !empty($array['full']) ? get_option('dbem_full_calendar_long_events') : get_option('dbem_small_calendar_long_events');
|
438 |
+
//specific functionality
|
439 |
+
if(is_multisite()){
|
440 |
+
global $bp;
|
441 |
+
if( !is_main_site() && !array_key_exists('blog',$array) ){
|
442 |
+
//not the main blog, force single blog search
|
443 |
+
$array['blog'] = get_current_blog_id();
|
444 |
+
}elseif( empty($array['blog']) && get_site_option('dbem_ms_global_events') ) {
|
445 |
+
$array['blog'] = false;
|
446 |
+
}
|
447 |
+
}
|
448 |
+
$atts = parent::get_default_search($defaults, $array);
|
449 |
+
$atts['full'] = ($atts['full']==true) ? 1:0;
|
450 |
+
$atts['long_events'] = ($atts['long_events']==true) ? 1:0;
|
451 |
+
return apply_filters('em_calendar_get_default_search', $atts, $array, $defaults);
|
452 |
+
}
|
453 |
+
}
|
454 |
add_action('init', array('EM_Calendar', 'init'));
|
classes/em-categories-taxonomy.php
CHANGED
@@ -1,126 +1,126 @@
|
|
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','dbem');
|
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' && !empty($_GET['taxonomy']) && $_GET['taxonomy'] == EM_TAXONOMY_CATEGORY){
|
35 |
-
wp_enqueue_style( 'farbtastic' );
|
36 |
-
wp_enqueue_style( 'thickbox' );
|
37 |
-
|
38 |
-
wp_enqueue_script( 'em-categories-admin', plugins_url().'/events-manager/includes/js/categories-admin.js', array( 'jquery','media-upload','thickbox','farbtastic' ) );
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
public static function form($tag){
|
43 |
-
$category_color = '#FFFFFF';
|
44 |
-
$category_image = '';
|
45 |
-
if( $tag != EM_TAXONOMY_CATEGORY ){ //not an add new tag form
|
46 |
-
$EM_Category = new EM_Category($tag);
|
47 |
-
$category_color = $EM_Category->get_color();
|
48 |
-
$category_image = $EM_Category->get_image_url();
|
49 |
-
$category_image_id = $EM_Category->get_image_id();
|
50 |
-
}
|
51 |
-
?>
|
52 |
-
<tr class="form-field">
|
53 |
-
<th scope="row" valign="top"><label for="category-bgcolor"
|
54 |
-
<td>
|
55 |
-
<input type="text" name="category_bgcolor" id="category-bgcolor" class="colorwell" value="<?php echo esc_attr($category_color); ?>" style="width:100px;"/><br />
|
56 |
-
<p class="description"><?php echo sprintf(__('Choose a color for your category. You can access this using the %s placeholder.','dbem'),'<code>#_CATEGORYCOLOR</code>'); ?></p>
|
57 |
-
<div id="picker" style="position:absolute; display:none; background:#DEDEDE"></div>
|
58 |
-
</td>
|
59 |
-
</tr>
|
60 |
-
<tr class="form-field">
|
61 |
-
<th scope="row" valign="top"><label for="category-image"
|
62 |
-
<td>
|
63 |
-
<?php if( !empty($category_image) ): ?>
|
64 |
-
<p id="category-image-img"><img src="<?php echo $category_image; ?>" /></p>
|
65 |
-
<?php endif; ?>
|
66 |
-
<input type="text" name="category_image" id="category-image" value="<?php echo esc_attr($category_image); ?>" style="width:300px;" />
|
67 |
-
<input type="hidden" name="category_image_id" id="category-image-id" value="<?php echo esc_attr($category_image); ?>" />
|
68 |
-
<input id="upload_image_button" type="button" value="<?php _e('Choose/Upload Image','dbem'); ?>" class="button-secondary" style="width:auto;" />
|
69 |
-
<?php if( !empty($category_image) ): ?>
|
70 |
-
<input id="delete_image_button" type="button" value="<?php _e('Remove Image','dbem'); ?>" class="button-secondary" style="width:auto;" />
|
71 |
-
<?php endif; ?>
|
72 |
-
<br />
|
73 |
-
<p class="description"><?php echo sprintf(__('Choose an image for your category, which can be displayed using the %s placeholder.','dbem'),'<code>#_CATEGORYIMAGE</code>'); ?></p>
|
74 |
-
</td>
|
75 |
-
</tr>
|
76 |
-
<?php
|
77 |
-
}
|
78 |
-
|
79 |
-
public static function save($term_id, $tt_id){
|
80 |
-
global $wpdb;
|
81 |
-
if (!$term_id) return;
|
82 |
-
if( !empty($_POST['category_bgcolor']) && preg_match('/^#[a-zA-Z0-9]{6}$/', $_POST['category_bgcolor']) ){
|
83 |
-
//get results and save/update
|
84 |
-
$prev_settings = $wpdb->get_results('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$term_id}' AND meta_key='category-bgcolor'");
|
85 |
-
if( count($prev_settings) > 0 ){
|
86 |
-
$wpdb->update(EM_META_TABLE, array('object_id'=>$term_id,'meta_value'=>$_POST['category_bgcolor']), array('object_id'=>$term_id,'meta_key'=>'category-bgcolor'));
|
87 |
-
}else{
|
88 |
-
$wpdb->insert(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-bgcolor','meta_value'=>$_POST['category_bgcolor']));
|
89 |
-
}
|
90 |
-
}
|
91 |
-
if( !empty($_POST['category_image']) ){
|
92 |
-
//get results and save/update
|
93 |
-
$prev_settings = $wpdb->get_results('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$term_id}' AND meta_key='category-image'");
|
94 |
-
if( count($prev_settings) > 0 ){
|
95 |
-
$wpdb->update(EM_META_TABLE, array('object_id'=>$term_id,'meta_value'=>$_POST['category_image']), array('object_id'=>$term_id,'meta_key'=>'category-image'));
|
96 |
-
}else{
|
97 |
-
$wpdb->insert(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-image','meta_value'=>$_POST['category_image']));
|
98 |
-
}
|
99 |
-
if( !empty($_POST['category_image_id']) && is_numeric($_POST['category_image_id']) ){
|
100 |
-
//get results and save/update
|
101 |
-
$prev_settings = $wpdb->get_results('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$term_id}' AND meta_key='category-image-id'");
|
102 |
-
if( count($prev_settings) > 0 ){
|
103 |
-
$wpdb->update(EM_META_TABLE, array('object_id'=>$term_id,'meta_value'=>$_POST['category_image_id']), array('object_id'=>$term_id,'meta_key'=>'category-image-id'));
|
104 |
-
}else{
|
105 |
-
$wpdb->insert(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-image-id','meta_value'=>$_POST['category_image_id']));
|
106 |
-
}
|
107 |
-
}
|
108 |
-
}else{
|
109 |
-
//check if an image exists, if so remove association
|
110 |
-
$prev_settings = $wpdb->get_results('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$term_id}' AND meta_key='category-image'");
|
111 |
-
if( count($prev_settings) > 0 ){
|
112 |
-
$wpdb->delete(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-image'));
|
113 |
-
$wpdb->delete(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-image-id'));
|
114 |
-
}
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
public static function delete( $term_id ){
|
119 |
-
global $wpdb;
|
120 |
-
//delete category image and color
|
121 |
-
$wpdb->query('DELETE FROM '.EM_META_TABLE." WHERE object_id='$term_id' AND (meta_key='category-image' OR meta_key='category-bgcolor')");
|
122 |
-
//delete all events category relations
|
123 |
-
$wpdb->query('DELETE FROM '.EM_META_TABLE." WHERE meta_value='{$term_id}' AND meta_key='event-category'");
|
124 |
-
}
|
125 |
-
}
|
126 |
add_action('admin_init',array('EM_Categories_Taxonomy','init'));
|
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','dbem');
|
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' && !empty($_GET['taxonomy']) && $_GET['taxonomy'] == EM_TAXONOMY_CATEGORY){
|
35 |
+
wp_enqueue_style( 'farbtastic' );
|
36 |
+
wp_enqueue_style( 'thickbox' );
|
37 |
+
|
38 |
+
wp_enqueue_script( 'em-categories-admin', plugins_url().'/events-manager/includes/js/categories-admin.js', array( 'jquery','media-upload','thickbox','farbtastic' ) );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
public static function form($tag){
|
43 |
+
$category_color = '#FFFFFF';
|
44 |
+
$category_image = '';
|
45 |
+
if( $tag != EM_TAXONOMY_CATEGORY ){ //not an add new tag form
|
46 |
+
$EM_Category = new EM_Category($tag);
|
47 |
+
$category_color = $EM_Category->get_color();
|
48 |
+
$category_image = $EM_Category->get_image_url();
|
49 |
+
$category_image_id = $EM_Category->get_image_id();
|
50 |
+
}
|
51 |
+
?>
|
52 |
+
<tr class="form-field">
|
53 |
+
<th scope="row" valign="top"><label for="category-bgcolor"><?php esc_html_e('Color','dbem'); ?></label></th>
|
54 |
+
<td>
|
55 |
+
<input type="text" name="category_bgcolor" id="category-bgcolor" class="colorwell" value="<?php echo esc_attr($category_color); ?>" style="width:100px;"/><br />
|
56 |
+
<p class="description"><?php echo sprintf(__('Choose a color for your category. You can access this using the %s placeholder.','dbem'),'<code>#_CATEGORYCOLOR</code>'); ?></p>
|
57 |
+
<div id="picker" style="position:absolute; display:none; background:#DEDEDE"></div>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<tr class="form-field">
|
61 |
+
<th scope="row" valign="top"><label for="category-image"><?php esc_html_e('Image','dbem'); ?></label></th>
|
62 |
+
<td>
|
63 |
+
<?php if( !empty($category_image) ): ?>
|
64 |
+
<p id="category-image-img"><img src="<?php echo $category_image; ?>" /></p>
|
65 |
+
<?php endif; ?>
|
66 |
+
<input type="text" name="category_image" id="category-image" value="<?php echo esc_attr($category_image); ?>" style="width:300px;" />
|
67 |
+
<input type="hidden" name="category_image_id" id="category-image-id" value="<?php echo esc_attr($category_image); ?>" />
|
68 |
+
<input id="upload_image_button" type="button" value="<?php _e('Choose/Upload Image','dbem'); ?>" class="button-secondary" style="width:auto;" />
|
69 |
+
<?php if( !empty($category_image) ): ?>
|
70 |
+
<input id="delete_image_button" type="button" value="<?php _e('Remove Image','dbem'); ?>" class="button-secondary" style="width:auto;" />
|
71 |
+
<?php endif; ?>
|
72 |
+
<br />
|
73 |
+
<p class="description"><?php echo sprintf(__('Choose an image for your category, which can be displayed using the %s placeholder.','dbem'),'<code>#_CATEGORYIMAGE</code>'); ?></p>
|
74 |
+
</td>
|
75 |
+
</tr>
|
76 |
+
<?php
|
77 |
+
}
|
78 |
+
|
79 |
+
public static function save($term_id, $tt_id){
|
80 |
+
global $wpdb;
|
81 |
+
if (!$term_id) return;
|
82 |
+
if( !empty($_POST['category_bgcolor']) && preg_match('/^#[a-zA-Z0-9]{6}$/', $_POST['category_bgcolor']) ){
|
83 |
+
//get results and save/update
|
84 |
+
$prev_settings = $wpdb->get_results('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$term_id}' AND meta_key='category-bgcolor'");
|
85 |
+
if( count($prev_settings) > 0 ){
|
86 |
+
$wpdb->update(EM_META_TABLE, array('object_id'=>$term_id,'meta_value'=>$_POST['category_bgcolor']), array('object_id'=>$term_id,'meta_key'=>'category-bgcolor'));
|
87 |
+
}else{
|
88 |
+
$wpdb->insert(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-bgcolor','meta_value'=>$_POST['category_bgcolor']));
|
89 |
+
}
|
90 |
+
}
|
91 |
+
if( !empty($_POST['category_image']) ){
|
92 |
+
//get results and save/update
|
93 |
+
$prev_settings = $wpdb->get_results('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$term_id}' AND meta_key='category-image'");
|
94 |
+
if( count($prev_settings) > 0 ){
|
95 |
+
$wpdb->update(EM_META_TABLE, array('object_id'=>$term_id,'meta_value'=>$_POST['category_image']), array('object_id'=>$term_id,'meta_key'=>'category-image'));
|
96 |
+
}else{
|
97 |
+
$wpdb->insert(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-image','meta_value'=>$_POST['category_image']));
|
98 |
+
}
|
99 |
+
if( !empty($_POST['category_image_id']) && is_numeric($_POST['category_image_id']) ){
|
100 |
+
//get results and save/update
|
101 |
+
$prev_settings = $wpdb->get_results('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$term_id}' AND meta_key='category-image-id'");
|
102 |
+
if( count($prev_settings) > 0 ){
|
103 |
+
$wpdb->update(EM_META_TABLE, array('object_id'=>$term_id,'meta_value'=>$_POST['category_image_id']), array('object_id'=>$term_id,'meta_key'=>'category-image-id'));
|
104 |
+
}else{
|
105 |
+
$wpdb->insert(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-image-id','meta_value'=>$_POST['category_image_id']));
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}else{
|
109 |
+
//check if an image exists, if so remove association
|
110 |
+
$prev_settings = $wpdb->get_results('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$term_id}' AND meta_key='category-image'");
|
111 |
+
if( count($prev_settings) > 0 ){
|
112 |
+
$wpdb->delete(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-image'));
|
113 |
+
$wpdb->delete(EM_META_TABLE, array('object_id'=>$term_id,'meta_key'=>'category-image-id'));
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
public static function delete( $term_id ){
|
119 |
+
global $wpdb;
|
120 |
+
//delete category image and color
|
121 |
+
$wpdb->query('DELETE FROM '.EM_META_TABLE." WHERE object_id='$term_id' AND (meta_key='category-image' OR meta_key='category-bgcolor')");
|
122 |
+
//delete all events category relations
|
123 |
+
$wpdb->query('DELETE FROM '.EM_META_TABLE." WHERE meta_value='{$term_id}' AND meta_key='event-category'");
|
124 |
+
}
|
125 |
+
}
|
126 |
add_action('admin_init',array('EM_Categories_Taxonomy','init'));
|
classes/em-categories.php
CHANGED
@@ -1,306 +1,309 @@
|
|
1 |
-
<?php
|
2 |
-
class EM_Categories extends EM_Object implements Iterator{
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Array of EM_Category objects for a specific event
|
6 |
-
* @var array
|
7 |
-
*/
|
8 |
-
var $categories = array();
|
9 |
-
/**
|
10 |
-
* Event ID of this set of categories
|
11 |
-
* @var int
|
12 |
-
*/
|
13 |
-
var $event_id;
|
14 |
-
/**
|
15 |
-
* Post ID of this set of categories
|
16 |
-
* @var int
|
17 |
-
*/
|
18 |
-
var $post_id;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Creates an EM_Categories instance, currently accepts an EM_Event object (gets all Categories for that event) or array of any EM_Category objects, which can be manipulated in bulk with helper functions.
|
22 |
-
* @param mixed $data
|
23 |
-
* @return null
|
24 |
-
*/
|
25 |
-
function
|
26 |
-
global $wpdb;
|
27 |
-
self::ms_global_switch();
|
28 |
-
if( is_object($data) && get_class($data) == "EM_Event" && !empty($data->post_id) ){ //Creates a blank categories object if needed
|
29 |
-
$this->event_id = $data->event_id;
|
30 |
-
$this->post_id = $data->post_id;
|
31 |
-
if( EM_MS_GLOBAL && !is_main_site($data->blog_id) ){
|
32 |
-
$cat_ids = $wpdb->get_col('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$this->event_id}' AND meta_key='event-category'");
|
33 |
-
foreach($cat_ids as $cat_id){
|
34 |
-
$this->categories[$cat_id] = new EM_Category($cat_id);
|
35 |
-
}
|
36 |
-
}else{
|
37 |
-
$results = get_the_terms( $data->post_id, EM_TAXONOMY_CATEGORY );
|
38 |
-
if( is_array($results) ){
|
39 |
-
foreach($results as $result){
|
40 |
-
$this->categories[$result->term_id] = new EM_Category($result);
|
41 |
-
}
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}elseif( is_array($data) && self::array_is_numeric($data) ){
|
45 |
-
foreach($data as $category_id){
|
46 |
-
$this->categories[$category_id] = new EM_Category($category_id);
|
47 |
-
}
|
48 |
-
}elseif( is_array($data) ){
|
49 |
-
foreach( $data as $EM_Category ){
|
50 |
-
if( get_class($EM_Category) == 'EM_Category'){
|
51 |
-
$this->categories[] = $EM_Category;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
self::ms_global_switch_back();
|
56 |
-
do_action('em_categories', $this);
|
57 |
-
}
|
58 |
-
|
59 |
-
function get_post(){
|
60 |
-
self::ms_global_switch();
|
61 |
-
$this->categories = array();
|
62 |
-
if(!empty($_POST['event_categories']) && self::array_is_numeric($_POST['event_categories'])){
|
63 |
-
foreach( $_POST['event_categories'] as $term ){
|
64 |
-
$this->categories[$term] = new EM_Category($term);
|
65 |
-
}
|
66 |
-
}
|
67 |
-
self::ms_global_switch_back();
|
68 |
-
do_action('em_categories_get_post', $this);
|
69 |
-
}
|
70 |
-
|
71 |
-
function save(){
|
72 |
-
$term_slugs = array();
|
73 |
-
foreach($this->categories as $EM_Category){
|
74 |
-
/* @var $EM_Category EM_Category */
|
75 |
-
if( !empty($EM_Category->slug) ) $term_slugs[] = $EM_Category->slug; //save of category will soft-fail if slug is empty
|
76 |
-
}
|
77 |
-
if( count($term_slugs) == 0 && get_option('dbem_default_category') > 0 ){
|
78 |
-
$default_term = get_term_by('id',get_option('dbem_default_category'), EM_TAXONOMY_CATEGORY);
|
79 |
-
if($default_term) $term_slugs[] = $default_term->slug;
|
80 |
-
}
|
81 |
-
if( count($term_slugs) > 0 ){
|
82 |
-
if( is_multisite() ){
|
83 |
-
//In MS Global mode, we also save category meta information for global lookups
|
84 |
-
if( EM_MS_GLOBAL && !empty($this->event_id) ){
|
85 |
-
//delete categories
|
86 |
-
$this->save_index();
|
87 |
-
}
|
88 |
-
if( !EM_MS_GLOBAL || is_main_site() ){
|
89 |
-
wp_set_object_terms($this->post_id, $term_slugs, EM_TAXONOMY_CATEGORY);
|
90 |
-
}
|
91 |
-
}else{
|
92 |
-
wp_set_object_terms($this->post_id, $term_slugs, EM_TAXONOMY_CATEGORY);
|
93 |
-
}
|
94 |
-
}
|
95 |
-
do_action('em_categories_save', $this);
|
96 |
-
}
|
97 |
-
|
98 |
-
function save_index(){
|
99 |
-
global $wpdb;
|
100 |
-
$wpdb->query('DELETE FROM '.EM_META_TABLE." WHERE object_id='{$this->event_id}' AND meta_key='event-category'");
|
101 |
-
foreach($this->categories as $EM_Category){
|
102 |
-
$wpdb->insert(EM_META_TABLE, array('meta_value'=>$EM_Category->term_id,'object_id'=>$this->event_id,'meta_key'=>'event-category'));
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
public static function get( $args = array() ) {
|
107 |
-
//Quick version, we can accept an array of IDs, which is easy to retrieve
|
108 |
-
self::ms_global_switch();
|
109 |
-
if( self::array_is_numeric($args) ){ //Array of numbers, assume they are event IDs to retreive
|
110 |
-
$results = get_terms( EM_TAXONOMY_CATEGORY );
|
111 |
-
$categories = array();
|
112 |
-
foreach($results as $result){
|
113 |
-
if( in_array($result->term_id, $args) ){
|
114 |
-
$categories[$result->term_id] = new EM_Category($result);
|
115 |
-
}
|
116 |
-
}
|
117 |
-
}else{
|
118 |
-
//We assume it's either an empty array or array of search arguments to merge with defaults
|
119 |
-
$term_args = self::get_default_search($args);
|
120 |
-
$results = get_terms( EM_TAXONOMY_CATEGORY, $term_args);
|
121 |
-
|
122 |
-
//If we want results directly in an array, why not have a shortcut here? We don't use this in code, so if you're using it and filter the em_categories_get hook, you may want to do this one too.
|
123 |
-
if( !empty($args['array']) ){
|
124 |
-
return apply_filters('em_categories_get_array', $results, $args);
|
125 |
-
}
|
126 |
-
|
127 |
-
//Make returned results EM_Category objects
|
128 |
-
$results = (is_array($results)) ? $results:array();
|
129 |
-
$categories = array();
|
130 |
-
foreach ( $results as $category ){
|
131 |
-
$categories[$category->term_id] = new EM_Category($category);
|
132 |
-
}
|
133 |
-
}
|
134 |
-
self::ms_global_switch_back();
|
135 |
-
return apply_filters('em_categories_get', $categories, $args);
|
136 |
-
}
|
137 |
-
|
138 |
-
public static function output( $args ){
|
139 |
-
global $EM_Category;
|
140 |
-
$EM_Category_old = $EM_Category; //When looping, we can replace EM_Category global with the current event in the loop
|
141 |
-
//get page number if passed on by request (still needs pagination enabled to have effect)
|
142 |
-
$page_queryvar = !empty($args['page_queryvar']) ? $args['page_queryvar'] : 'pno';
|
143 |
-
if( !array_key_exists('page',$args) && !empty($args['pagination']) && !empty($_REQUEST[$page_queryvar]) && is_numeric($_REQUEST[$page_queryvar]) ){
|
144 |
-
$page = $args['page'] = $_REQUEST[$page_queryvar];
|
145 |
-
}
|
146 |
-
//Can be either an array for the get search or an array of EM_Category objects
|
147 |
-
if( is_object(current($args)) && get_class((current($args))) == 'EM_Category' ){
|
148 |
-
$func_args = func_get_args();
|
149 |
-
$categories = $func_args[0];
|
150 |
-
$args = (!empty($func_args[1])) ? $func_args[1] : array();
|
151 |
-
$args = apply_filters('em_categories_output_args', self::get_default_search($args), $categories);
|
152 |
-
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
153 |
-
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
|
154 |
-
$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:1;
|
155 |
-
}else{
|
156 |
-
$args = apply_filters('em_categories_output_args', self::get_default_search($args) );
|
157 |
-
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
158 |
-
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
|
159 |
-
$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:1;
|
160 |
-
$args['limit'] = $args['offset'] = $args['page'] = false; //we count overall categories here
|
161 |
-
$categories = self::get( $args );
|
162 |
-
$args['limit'] = $limit;
|
163 |
-
$args['offset'] = $offset;
|
164 |
-
$args['page'] = $page;
|
165 |
-
}
|
166 |
-
//What format shall we output this to, or use default
|
167 |
-
$format = ( $args['format'] == '' ) ? get_option( 'dbem_categories_list_item_format' ) : $args['format'] ;
|
168 |
-
|
169 |
-
$output = "";
|
170 |
-
$categories_count = count($categories);
|
171 |
-
$categories = apply_filters('em_categories_output_categories', $categories);
|
172 |
-
if ( count($categories) > 0 ) {
|
173 |
-
$category_count = 0;
|
174 |
-
$categories_shown = 0;
|
175 |
-
foreach ( $categories as $EM_Category ) {
|
176 |
-
if( ($categories_shown < $limit || empty($limit)) && ($category_count >= $offset || $offset === 0) ){
|
177 |
-
$output .= $EM_Category->output($format);
|
178 |
-
$categories_shown++;
|
179 |
-
}
|
180 |
-
$category_count++;
|
181 |
-
}
|
182 |
-
//Add headers and footers to output
|
183 |
-
if( $format == get_option
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
*
|
265 |
-
* @
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
'
|
274 |
-
'
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
public function
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
$var
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
$var
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
306 |
}
|
1 |
+
<?php
|
2 |
+
class EM_Categories extends EM_Object implements Iterator{
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Array of EM_Category objects for a specific event
|
6 |
+
* @var array
|
7 |
+
*/
|
8 |
+
var $categories = array();
|
9 |
+
/**
|
10 |
+
* Event ID of this set of categories
|
11 |
+
* @var int
|
12 |
+
*/
|
13 |
+
var $event_id;
|
14 |
+
/**
|
15 |
+
* Post ID of this set of categories
|
16 |
+
* @var int
|
17 |
+
*/
|
18 |
+
var $post_id;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Creates an EM_Categories instance, currently accepts an EM_Event object (gets all Categories for that event) or array of any EM_Category objects, which can be manipulated in bulk with helper functions.
|
22 |
+
* @param mixed $data
|
23 |
+
* @return null
|
24 |
+
*/
|
25 |
+
function __construct( $data = false ){
|
26 |
+
global $wpdb;
|
27 |
+
self::ms_global_switch();
|
28 |
+
if( is_object($data) && get_class($data) == "EM_Event" && !empty($data->post_id) ){ //Creates a blank categories object if needed
|
29 |
+
$this->event_id = $data->event_id;
|
30 |
+
$this->post_id = $data->post_id;
|
31 |
+
if( EM_MS_GLOBAL && !is_main_site($data->blog_id) ){
|
32 |
+
$cat_ids = $wpdb->get_col('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$this->event_id}' AND meta_key='event-category'");
|
33 |
+
foreach($cat_ids as $cat_id){
|
34 |
+
$this->categories[$cat_id] = new EM_Category($cat_id);
|
35 |
+
}
|
36 |
+
}else{
|
37 |
+
$results = get_the_terms( $data->post_id, EM_TAXONOMY_CATEGORY );
|
38 |
+
if( is_array($results) ){
|
39 |
+
foreach($results as $result){
|
40 |
+
$this->categories[$result->term_id] = new EM_Category($result);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}elseif( is_array($data) && self::array_is_numeric($data) ){
|
45 |
+
foreach($data as $category_id){
|
46 |
+
$this->categories[$category_id] = new EM_Category($category_id);
|
47 |
+
}
|
48 |
+
}elseif( is_array($data) ){
|
49 |
+
foreach( $data as $EM_Category ){
|
50 |
+
if( get_class($EM_Category) == 'EM_Category'){
|
51 |
+
$this->categories[] = $EM_Category;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
self::ms_global_switch_back();
|
56 |
+
do_action('em_categories', $this);
|
57 |
+
}
|
58 |
+
|
59 |
+
function get_post(){
|
60 |
+
self::ms_global_switch();
|
61 |
+
$this->categories = array();
|
62 |
+
if(!empty($_POST['event_categories']) && self::array_is_numeric($_POST['event_categories'])){
|
63 |
+
foreach( $_POST['event_categories'] as $term ){
|
64 |
+
$this->categories[$term] = new EM_Category($term);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
self::ms_global_switch_back();
|
68 |
+
do_action('em_categories_get_post', $this);
|
69 |
+
}
|
70 |
+
|
71 |
+
function save(){
|
72 |
+
$term_slugs = array();
|
73 |
+
foreach($this->categories as $EM_Category){
|
74 |
+
/* @var $EM_Category EM_Category */
|
75 |
+
if( !empty($EM_Category->slug) ) $term_slugs[] = $EM_Category->slug; //save of category will soft-fail if slug is empty
|
76 |
+
}
|
77 |
+
if( count($term_slugs) == 0 && get_option('dbem_default_category') > 0 ){
|
78 |
+
$default_term = get_term_by('id',get_option('dbem_default_category'), EM_TAXONOMY_CATEGORY);
|
79 |
+
if($default_term) $term_slugs[] = $default_term->slug;
|
80 |
+
}
|
81 |
+
if( count($term_slugs) > 0 ){
|
82 |
+
if( is_multisite() ){
|
83 |
+
//In MS Global mode, we also save category meta information for global lookups
|
84 |
+
if( EM_MS_GLOBAL && !empty($this->event_id) ){
|
85 |
+
//delete categories
|
86 |
+
$this->save_index();
|
87 |
+
}
|
88 |
+
if( !EM_MS_GLOBAL || is_main_site() ){
|
89 |
+
wp_set_object_terms($this->post_id, $term_slugs, EM_TAXONOMY_CATEGORY);
|
90 |
+
}
|
91 |
+
}else{
|
92 |
+
wp_set_object_terms($this->post_id, $term_slugs, EM_TAXONOMY_CATEGORY);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
do_action('em_categories_save', $this);
|
96 |
+
}
|
97 |
+
|
98 |
+
function save_index(){
|
99 |
+
global $wpdb;
|
100 |
+
$wpdb->query('DELETE FROM '.EM_META_TABLE." WHERE object_id='{$this->event_id}' AND meta_key='event-category'");
|
101 |
+
foreach($this->categories as $EM_Category){
|
102 |
+
$wpdb->insert(EM_META_TABLE, array('meta_value'=>$EM_Category->term_id,'object_id'=>$this->event_id,'meta_key'=>'event-category'));
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
public static function get( $args = array() ) {
|
107 |
+
//Quick version, we can accept an array of IDs, which is easy to retrieve
|
108 |
+
self::ms_global_switch();
|
109 |
+
if( self::array_is_numeric($args) ){ //Array of numbers, assume they are event IDs to retreive
|
110 |
+
$results = get_terms( EM_TAXONOMY_CATEGORY );
|
111 |
+
$categories = array();
|
112 |
+
foreach($results as $result){
|
113 |
+
if( in_array($result->term_id, $args) ){
|
114 |
+
$categories[$result->term_id] = new EM_Category($result);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}else{
|
118 |
+
//We assume it's either an empty array or array of search arguments to merge with defaults
|
119 |
+
$term_args = self::get_default_search($args);
|
120 |
+
$results = get_terms( EM_TAXONOMY_CATEGORY, $term_args);
|
121 |
+
|
122 |
+
//If we want results directly in an array, why not have a shortcut here? We don't use this in code, so if you're using it and filter the em_categories_get hook, you may want to do this one too.
|
123 |
+
if( !empty($args['array']) ){
|
124 |
+
return apply_filters('em_categories_get_array', $results, $args);
|
125 |
+
}
|
126 |
+
|
127 |
+
//Make returned results EM_Category objects
|
128 |
+
$results = (is_array($results)) ? $results:array();
|
129 |
+
$categories = array();
|
130 |
+
foreach ( $results as $category ){
|
131 |
+
$categories[$category->term_id] = new EM_Category($category);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
self::ms_global_switch_back();
|
135 |
+
return apply_filters('em_categories_get', $categories, $args);
|
136 |
+
}
|
137 |
+
|
138 |
+
public static function output( $args ){
|
139 |
+
global $EM_Category;
|
140 |
+
$EM_Category_old = $EM_Category; //When looping, we can replace EM_Category global with the current event in the loop
|
141 |
+
//get page number if passed on by request (still needs pagination enabled to have effect)
|
142 |
+
$page_queryvar = !empty($args['page_queryvar']) ? $args['page_queryvar'] : 'pno';
|
143 |
+
if( !array_key_exists('page',$args) && !empty($args['pagination']) && !empty($_REQUEST[$page_queryvar]) && is_numeric($_REQUEST[$page_queryvar]) ){
|
144 |
+
$page = $args['page'] = $_REQUEST[$page_queryvar];
|
145 |
+
}
|
146 |
+
//Can be either an array for the get search or an array of EM_Category objects
|
147 |
+
if( is_object(current($args)) && get_class((current($args))) == 'EM_Category' ){
|
148 |
+
$func_args = func_get_args();
|
149 |
+
$categories = $func_args[0];
|
150 |
+
$args = (!empty($func_args[1])) ? $func_args[1] : array();
|
151 |
+
$args = apply_filters('em_categories_output_args', self::get_default_search($args), $categories);
|
152 |
+
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
153 |
+
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
|
154 |
+
$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:1;
|
155 |
+
}else{
|
156 |
+
$args = apply_filters('em_categories_output_args', self::get_default_search($args) );
|
157 |
+
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
158 |
+
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
|
159 |
+
$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:1;
|
160 |
+
$args['limit'] = $args['offset'] = $args['page'] = false; //we count overall categories here
|
161 |
+
$categories = self::get( $args );
|
162 |
+
$args['limit'] = $limit;
|
163 |
+
$args['offset'] = $offset;
|
164 |
+
$args['page'] = $page;
|
165 |
+
}
|
166 |
+
//What format shall we output this to, or use default
|
167 |
+
$format = ( $args['format'] == '' ) ? get_option( 'dbem_categories_list_item_format' ) : $args['format'] ;
|
168 |
+
|
169 |
+
$output = "";
|
170 |
+
$categories_count = count($categories);
|
171 |
+
$categories = apply_filters('em_categories_output_categories', $categories);
|
172 |
+
if ( count($categories) > 0 ) {
|
173 |
+
$category_count = 0;
|
174 |
+
$categories_shown = 0;
|
175 |
+
foreach ( $categories as $EM_Category ) {
|
176 |
+
if( ($categories_shown < $limit || empty($limit)) && ($category_count >= $offset || $offset === 0) ){
|
177 |
+
$output .= $EM_Category->output($format);
|
178 |
+
$categories_shown++;
|
179 |
+
}
|
180 |
+
$category_count++;
|
181 |
+
}
|
182 |
+
//Add headers and footers to output
|
183 |
+
if( $format == get_option( 'dbem_categories_list_item_format' ) ){
|
184 |
+
//we're using the default format, so if a custom format header or footer is supplied, we can override it, if not use the default
|
185 |
+
$format_header = empty($args['format_header']) ? get_option('dbem_categories_list_item_format_header') : $args['format_header'];
|
186 |
+
$format_footer = empty($args['format_footer']) ? get_option('dbem_categories_list_item_format_footer') : $args['format_footer'];
|
187 |
+
}else{
|
188 |
+
//we're using a custom format, so if a header or footer isn't specifically supplied we assume it's blank
|
189 |
+
$format_header = !empty($args['format_header']) ? $args['format_header'] : '' ;
|
190 |
+
$format_footer = !empty($args['format_footer']) ? $args['format_footer'] : '' ;
|
191 |
+
}
|
192 |
+
$output = $format_header . $output . $format_footer;
|
193 |
+
//Pagination (if needed/requested)
|
194 |
+
if( !empty($args['pagination']) && !empty($limit) && $categories_count >= $limit ){
|
195 |
+
//Show the pagination links (unless there's less than 10 events, or the custom limit)
|
196 |
+
$output .= self::get_pagination_links($args, $categories_count);
|
197 |
+
}
|
198 |
+
} else {
|
199 |
+
$output = get_option ( 'dbem_no_categories_message' );
|
200 |
+
}
|
201 |
+
//FIXME check if reference is ok when restoring object, due to changes in php5 v 4
|
202 |
+
$EM_Category_old= $EM_Category;
|
203 |
+
return apply_filters('em_categories_output', $output, $categories, $args);
|
204 |
+
}
|
205 |
+
|
206 |
+
public static function get_pagination_links($args, $count, $search_action = 'search_cats', $default_args = array()){
|
207 |
+
//get default args if we're in a search, supply to parent since we can't depend on late static binding until WP requires PHP 5.3 or later
|
208 |
+
if( empty($default_args) && (!empty($args['ajax']) || !empty($_REQUEST['action']) && $_REQUEST['action'] == $search_action) ){
|
209 |
+
$default_args = self::get_default_search();
|
210 |
+
$default_args['limit'] = get_option('dbem_categories_default_limit');
|
211 |
+
}
|
212 |
+
return parent::get_pagination_links($args, $count, $search_action, $default_args);
|
213 |
+
}
|
214 |
+
|
215 |
+
public static function get_post_search($args = array(), $filter = false, $request = array(), $accepted_args = array()){
|
216 |
+
//supply $accepted_args to parent argument since we can't depend on late static binding until WP requires PHP 5.3 or later
|
217 |
+
$accepted_args = !empty($accepted_args) ? $accepted_args : array_keys(self::get_default_search());
|
218 |
+
return apply_filters('em_tags_get_post_search', parent::get_post_search($args, $filter, $request, $accepted_args));
|
219 |
+
}
|
220 |
+
|
221 |
+
function has( $search ){
|
222 |
+
if( is_numeric($search) ){
|
223 |
+
foreach($this->categories as $EM_Category){
|
224 |
+
if($EM_Category->term_id == $search) return apply_filters('em_categories_has', true, $search, $this);
|
225 |
+
}
|
226 |
+
}else{
|
227 |
+
foreach($this->categories as $EM_Category){
|
228 |
+
if($EM_Category->slug == $search || $EM_Category->name == $search ) return apply_filters('em_categories_has', true, $search, $this);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
return apply_filters('em_categories_has', false, $search, $this);
|
232 |
+
}
|
233 |
+
|
234 |
+
function get_first(){
|
235 |
+
foreach($this->categories as $EM_Category){
|
236 |
+
return $EM_Category;
|
237 |
+
}
|
238 |
+
return false;
|
239 |
+
}
|
240 |
+
|
241 |
+
function get_ids(){
|
242 |
+
$ids = array();
|
243 |
+
foreach($this->categories as $EM_Category){
|
244 |
+
if( !empty($EM_Category->term_id) ){
|
245 |
+
$ids[] = $EM_Category->term_id;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
return $ids;
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Gets the event for this object, or a blank event if none exists
|
253 |
+
* @return EM_Event
|
254 |
+
*/
|
255 |
+
function get_event(){
|
256 |
+
if( is_numeric($this->event_id) ){
|
257 |
+
return em_get_event($this->event_id);
|
258 |
+
}else{
|
259 |
+
return new EM_Event();
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
/*
|
264 |
+
* Adds custom calendar search defaults
|
265 |
+
* @param array $array_or_defaults may be the array to override defaults
|
266 |
+
* @param array $array
|
267 |
+
* @return array
|
268 |
+
* @uses EM_Object#get_default_search()
|
269 |
+
*/
|
270 |
+
public static function get_default_search( $array_or_defaults = array(), $array = array() ){
|
271 |
+
$defaults = array(
|
272 |
+
//added from get_terms, so they don't get filtered out
|
273 |
+
'orderby' => get_option('dbem_categories_default_orderby'), 'order' => get_option('dbem_categories_default_order'),
|
274 |
+
'hide_empty' => false, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(),
|
275 |
+
'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
|
276 |
+
'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '',
|
277 |
+
'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core'
|
278 |
+
);
|
279 |
+
//sort out whether defaults were supplied or just the array of search values
|
280 |
+
if( empty($array) ){
|
281 |
+
$array = $array_or_defaults;
|
282 |
+
}else{
|
283 |
+
$defaults = array_merge($defaults, $array_or_defaults);
|
284 |
+
}
|
285 |
+
return apply_filters('em_categories_get_default_search', parent::get_default_search($defaults,$array), $array, $defaults);
|
286 |
+
}
|
287 |
+
|
288 |
+
//Iterator Implementation
|
289 |
+
public function rewind(){
|
290 |
+
reset($this->categories);
|
291 |
+
}
|
292 |
+
public function current(){
|
293 |
+
$var = current($this->categories);
|
294 |
+
return $var;
|
295 |
+
}
|
296 |
+
public function key(){
|
297 |
+
$var = key($this->categories);
|
298 |
+
return $var;
|
299 |
+
}
|
300 |
+
public function next(){
|
301 |
+
$var = next($this->categories);
|
302 |
+
return $var;
|
303 |
+
}
|
304 |
+
public function valid(){
|
305 |
+
$key = key($this->categories);
|
306 |
+
$var = ($key !== NULL && $key !== FALSE);
|
307 |
+
return $var;
|
308 |
+
}
|
309 |
}
|
classes/em-category-taxonomy.php
CHANGED
@@ -1,169 +1,170 @@
|
|
1 |
-
<?php
|
2 |
-
class EM_Category_Taxonomy{
|
3 |
-
public static function init(){
|
4 |
-
if( !is_admin() ){
|
5 |
-
add_filter('taxonomy_template', array('EM_Category_Taxonomy','template'), 99);
|
6 |
-
add_filter('parse_query', array('EM_Category_Taxonomy','parse_query'));
|
7 |
-
}
|
8 |
-
}
|
9 |
-
/**
|
10 |
-
* Overrides archive pages e.g. locations, events, event categories, event tags based on user settings
|
11 |
-
* @param string $template
|
12 |
-
* @return string
|
13 |
-
*/
|
14 |
-
public static function template($template){
|
15 |
-
global $wp_query, $EM_Category, $em_category_id, $post;
|
16 |
-
if( is_tax(EM_TAXONOMY_CATEGORY) && !locate_template('taxonomy-'.EM_TAXONOMY_CATEGORY.'.php') && get_option('dbem_cp_categories_formats', true) ){
|
17 |
-
$EM_Category = em_get_category($wp_query->queried_object->term_id);
|
18 |
-
if( get_option('dbem_categories_page') ){
|
19 |
-
//less chance for things to go wrong with themes etc. so just reset the WP_Query to think it's a page rather than taxonomy
|
20 |
-
$wp_query = new WP_Query(array('page_id'=> get_option('dbem_categories_page')));
|
21 |
-
$wp_query->queried_object = $wp_query->post;
|
22 |
-
$wp_query->queried_object_id = $wp_query->post->ID;
|
23 |
-
$wp_query->post->post_title = $wp_query->posts[0]->post_title = $wp_query->queried_object->post_title = $EM_Category->output(get_option('dbem_category_page_title_format'));
|
24 |
-
if( !function_exists('yoast_breadcrumb') ){ //not needed by WP SEO Breadcrumbs
|
25 |
-
$wp_query->post->post_parent = $wp_query->posts[0]->post_parent = $wp_query->queried_object->post_parent = $EM_Category->output(get_option('dbem_categories_page'));
|
26 |
-
}
|
27 |
-
$post = $wp_query->post;
|
28 |
-
}else{
|
29 |
-
//we don't have a categories page, so we create a fake page
|
30 |
-
$wp_query->posts = array();
|
31 |
-
$wp_query->posts[0] = new stdClass();
|
32 |
-
$wp_query->posts[0]->post_title = $wp_query->queried_object->post_title = $EM_Category->output(get_option('dbem_category_page_title_format'));
|
33 |
-
$post_array = array('ID', 'post_author', 'post_date','post_date_gmt','post_content','post_excerpt','post_status','comment_status','ping_status','post_password','post_name','to_ping','pinged','post_modified','post_modified_gmt','post_content_filtered','post_parent','guid','menu_order','post_type','post_mime_type','comment_count','filter');
|
34 |
-
foreach($post_array as $post_array_item){
|
35 |
-
$wp_query->posts[0]->$post_array_item = '';
|
36 |
-
}
|
37 |
-
$wp_query->post = $wp_query->posts[0];
|
38 |
-
$wp_query->post_count = 1;
|
39 |
-
$wp_query->found_posts = 1;
|
40 |
-
$wp_query->max_num_pages = 1;
|
41 |
-
//tweak flags for determining page type
|
42 |
-
$wp_query->is_tax = 0;
|
43 |
-
$wp_query->is_page = 1;
|
44 |
-
$wp_query->is_single = 0;
|
45 |
-
$wp_query->is_singular = 1;
|
46 |
-
$wp_query->is_archive = 0;
|
47 |
-
}
|
48 |
-
remove_filter('the_content', 'em_content'); //one less filter
|
49 |
-
add_filter('the_content', array('EM_Category_Taxonomy','the_content')); //come in slightly early and consider other plugins
|
50 |
-
add_filter('wpseo_breadcrumb_links',array('EM_Category_Taxonomy','wpseo_breadcrumb_links')); //for Yoast WP SEO
|
51 |
-
$wp_query->em_category_id = $em_category_id = $EM_Category->term_id; //we assign $em_category_id just in case other themes/plugins do something out of the ordinary to WP_Query
|
52 |
-
$template = locate_template(array('page.php','index.php'),false); //category becomes a page
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
$
|
60 |
-
$
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
$wp_query->query_vars['
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
*
|
107 |
-
*
|
108 |
-
* @
|
109 |
-
* @
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
* @
|
115 |
-
* @
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
* @
|
122 |
-
* @
|
123 |
-
* @
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
$
|
137 |
-
$
|
138 |
-
$
|
139 |
-
$output .= $
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
$output .=
|
144 |
-
$output .=
|
145 |
-
|
146 |
-
}
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
*
|
151 |
-
*
|
152 |
-
* @
|
153 |
-
* @
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
$
|
162 |
-
$
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
$output .=
|
167 |
-
$output .=
|
168 |
-
|
|
|
169 |
}
|
1 |
+
<?php
|
2 |
+
class EM_Category_Taxonomy{
|
3 |
+
public static function init(){
|
4 |
+
if( !is_admin() ){
|
5 |
+
add_filter('taxonomy_template', array('EM_Category_Taxonomy','template'), 99);
|
6 |
+
add_filter('parse_query', array('EM_Category_Taxonomy','parse_query'));
|
7 |
+
}
|
8 |
+
}
|
9 |
+
/**
|
10 |
+
* Overrides archive pages e.g. locations, events, event categories, event tags based on user settings
|
11 |
+
* @param string $template
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
public static function template($template = ''){
|
15 |
+
global $wp_query, $EM_Category, $em_category_id, $post;
|
16 |
+
if( is_tax(EM_TAXONOMY_CATEGORY) && !locate_template('taxonomy-'.EM_TAXONOMY_CATEGORY.'.php') && get_option('dbem_cp_categories_formats', true) ){
|
17 |
+
$EM_Category = em_get_category($wp_query->queried_object->term_id);
|
18 |
+
if( get_option('dbem_categories_page') ){
|
19 |
+
//less chance for things to go wrong with themes etc. so just reset the WP_Query to think it's a page rather than taxonomy
|
20 |
+
$wp_query = new WP_Query(array('page_id'=> get_option('dbem_categories_page')));
|
21 |
+
$wp_query->queried_object = $wp_query->post;
|
22 |
+
$wp_query->queried_object_id = $wp_query->post->ID;
|
23 |
+
$wp_query->post->post_title = $wp_query->posts[0]->post_title = $wp_query->queried_object->post_title = $EM_Category->output(get_option('dbem_category_page_title_format'));
|
24 |
+
if( !function_exists('yoast_breadcrumb') ){ //not needed by WP SEO Breadcrumbs
|
25 |
+
$wp_query->post->post_parent = $wp_query->posts[0]->post_parent = $wp_query->queried_object->post_parent = $EM_Category->output(get_option('dbem_categories_page'));
|
26 |
+
}
|
27 |
+
$post = $wp_query->post;
|
28 |
+
}else{
|
29 |
+
//we don't have a categories page, so we create a fake page
|
30 |
+
$wp_query->posts = array();
|
31 |
+
$wp_query->posts[0] = new stdClass();
|
32 |
+
$wp_query->posts[0]->post_title = $wp_query->queried_object->post_title = $EM_Category->output(get_option('dbem_category_page_title_format'));
|
33 |
+
$post_array = array('ID', 'post_author', 'post_date','post_date_gmt','post_content','post_excerpt','post_status','comment_status','ping_status','post_password','post_name','to_ping','pinged','post_modified','post_modified_gmt','post_content_filtered','post_parent','guid','menu_order','post_type','post_mime_type','comment_count','filter');
|
34 |
+
foreach($post_array as $post_array_item){
|
35 |
+
$wp_query->posts[0]->$post_array_item = '';
|
36 |
+
}
|
37 |
+
$wp_query->post = $wp_query->posts[0];
|
38 |
+
$wp_query->post_count = 1;
|
39 |
+
$wp_query->found_posts = 1;
|
40 |
+
$wp_query->max_num_pages = 1;
|
41 |
+
//tweak flags for determining page type
|
42 |
+
$wp_query->is_tax = 0;
|
43 |
+
$wp_query->is_page = 1;
|
44 |
+
$wp_query->is_single = 0;
|
45 |
+
$wp_query->is_singular = 1;
|
46 |
+
$wp_query->is_archive = 0;
|
47 |
+
}
|
48 |
+
remove_filter('the_content', 'em_content'); //one less filter
|
49 |
+
add_filter('the_content', array('EM_Category_Taxonomy','the_content')); //come in slightly early and consider other plugins
|
50 |
+
add_filter('wpseo_breadcrumb_links',array('EM_Category_Taxonomy','wpseo_breadcrumb_links')); //for Yoast WP SEO
|
51 |
+
$wp_query->em_category_id = $em_category_id = $EM_Category->term_id; //we assign $em_category_id just in case other themes/plugins do something out of the ordinary to WP_Query
|
52 |
+
$template = locate_template(array('page.php','index.php'),false); //category becomes a page
|
53 |
+
do_action('em_category_taxonomy_template');
|
54 |
+
}
|
55 |
+
return $template;
|
56 |
+
}
|
57 |
+
|
58 |
+
public static function the_content($content){
|
59 |
+
global $wp_query, $EM_Category, $post, $em_category_id;
|
60 |
+
$is_categories_page = $post->ID == get_option('dbem_categories_page');
|
61 |
+
$category_flag = (!empty($wp_query->em_category_id) || !empty($em_category_id));
|
62 |
+
if( ($is_categories_page && $category_flag) || (empty($post->ID) && $category_flag) ){
|
63 |
+
$EM_Category = empty($wp_query->em_category_id) ? em_get_category($em_category_id):em_get_category($wp_query->em_category_id);
|
64 |
+
ob_start();
|
65 |
+
em_locate_template('templates/category-single.php',true);
|
66 |
+
return ob_get_clean();
|
67 |
+
}
|
68 |
+
return $content;
|
69 |
+
}
|
70 |
+
|
71 |
+
public static function parse_query( ){
|
72 |
+
global $wp_query, $post;
|
73 |
+
if( is_tax(EM_TAXONOMY_CATEGORY) ){
|
74 |
+
//Scope is future
|
75 |
+
$today = strtotime(date('Y-m-d', current_time('timestamp')));
|
76 |
+
if( get_option('dbem_events_current_are_past') ){
|
77 |
+
$wp_query->query_vars['meta_query'][] = array( 'key' => '_start_ts', 'value' => $today, 'compare' => '>=' );
|
78 |
+
}else{
|
79 |
+
$wp_query->query_vars['meta_query'][] = array( 'key' => '_end_ts', 'value' => $today, 'compare' => '>=' );
|
80 |
+
}
|
81 |
+
if( get_option('dbem_categories_default_archive_orderby') == 'title'){
|
82 |
+
$wp_query->query_vars['orderby'] = 'title';
|
83 |
+
}else{
|
84 |
+
$wp_query->query_vars['orderby'] = 'meta_value_num';
|
85 |
+
$wp_query->query_vars['meta_key'] = get_option('dbem_categories_default_archive_orderby','_start_ts');
|
86 |
+
}
|
87 |
+
$wp_query->query_vars['order'] = get_option('dbem_categories_default_archive_order','ASC');
|
88 |
+
}elseif( !empty($wp_query->em_category_id) ){
|
89 |
+
$post = $wp_query->post;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
public static function wpseo_breadcrumb_links( $links ){
|
94 |
+
global $wp_query;
|
95 |
+
array_pop($links);
|
96 |
+
if( get_option('dbem_categories_page') ){
|
97 |
+
$links[] = array('id'=> get_option('dbem_categories_page'));
|
98 |
+
}
|
99 |
+
$links[] = array('text'=> $wp_query->posts[0]->post_title);
|
100 |
+
return $links;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
EM_Category_Taxonomy::init();
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Create an array of Categories. Copied from Walker_CategoryDropdown, but makes it possible for the selected argument to be an array.
|
107 |
+
*
|
108 |
+
* @package WordPress
|
109 |
+
* @since 2.1.0
|
110 |
+
* @uses Walker
|
111 |
+
*/
|
112 |
+
class EM_Walker_Category extends Walker {
|
113 |
+
/**
|
114 |
+
* @see Walker::$tree_type
|
115 |
+
* @since 2.1.0
|
116 |
+
* @var string
|
117 |
+
*/
|
118 |
+
var $tree_type = 'event-category';
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @see Walker::$db_fields
|
122 |
+
* @since 2.1.0
|
123 |
+
* @todo Decouple this
|
124 |
+
* @var array
|
125 |
+
*/
|
126 |
+
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
|
127 |
+
|
128 |
+
function __construct(){
|
129 |
+
$tree_type = EM_TAXONOMY_CATEGORY;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* @see Walker::start_el()
|
134 |
+
*/
|
135 |
+
function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
136 |
+
$pad = str_repeat(' ', $depth * 3);
|
137 |
+
$cat_name = $object->name;
|
138 |
+
$name = !empty($args['name']) ? $args['name']:'event_categories[]';
|
139 |
+
$output .= !empty($args['before']) ? $args['after']:'';
|
140 |
+
$output .= $pad."<input type=\"checkbox\" name=\"$name\" class=\"level-$depth\" value=\"".$object->term_id."\"";
|
141 |
+
if ( (is_array($args['selected']) && in_array($object->term_id, $args['selected'])) || ($object->term_id == $args['selected']) )
|
142 |
+
$output .= ' checked="checked"';
|
143 |
+
$output .= ' /> ';
|
144 |
+
$output .= $cat_name;
|
145 |
+
$output .= !empty($args['after']) ? $args['after']:'<br />';
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Create an array of Categories. Copied from Walker_CategoryDropdown, but makes it possible for the selected argument to be an array.
|
151 |
+
*
|
152 |
+
* @package WordPress
|
153 |
+
* @since 2.1.0
|
154 |
+
* @uses Walker
|
155 |
+
*/
|
156 |
+
class EM_Walker_CategoryMultiselect extends EM_Walker_Category {
|
157 |
+
/**
|
158 |
+
* @see Walker::start_el()
|
159 |
+
*/
|
160 |
+
function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
161 |
+
$pad = str_repeat(' ', $depth * 3);
|
162 |
+
$cat_name = $object->name;
|
163 |
+
$output .= "\t<option class=\"level-$depth\" value=\"".$object->term_id."\"";
|
164 |
+
if ( (is_array($args['selected']) && in_array($object->term_id, $args['selected'])) || ($object->term_id == $args['selected']) )
|
165 |
+
$output .= ' selected="selected"';
|
166 |
+
$output .= '>';
|
167 |
+
$output .= $pad.$cat_name;
|
168 |
+
$output .= "</option>\n";
|
169 |
+
}
|
170 |
}
|
classes/em-category.php
CHANGED
@@ -1,299 +1,299 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Get an category in a db friendly way, by checking globals and passed variables to avoid extra class instantiations
|
4 |
-
* @param mixed $id
|
5 |
-
* @return EM_Category
|
6 |
-
*/
|
7 |
-
function em_get_category($id = false) {
|
8 |
-
global $EM_Category;
|
9 |
-
//check if it's not already global so we don't instantiate again
|
10 |
-
if( is_object($EM_Category) && get_class($EM_Category) == 'EM_Category' ){
|
11 |
-
if( $EM_Category->term_id == $id ){
|
12 |
-
return $EM_Category;
|
13 |
-
}elseif( is_object($id) && $EM_Category->term_id == $id->term_id ){
|
14 |
-
return $EM_Category;
|
15 |
-
}
|
16 |
-
}
|
17 |
-
if( is_object($id) && get_class($id) == 'EM_Category' ){
|
18 |
-
return $id;
|
19 |
-
}else{
|
20 |
-
return new EM_Category($id);
|
21 |
-
}
|
22 |
-
}
|
23 |
-
class EM_Category extends EM_Object {
|
24 |
-
//Taxonomy Fields
|
25 |
-
var $id = '';
|
26 |
-
var $term_id;
|
27 |
-
var $name;
|
28 |
-
var $slug;
|
29 |
-
var $term_group;
|
30 |
-
var $term_taxonomy_id;
|
31 |
-
var $taxonomy;
|
32 |
-
var $description = '';
|
33 |
-
var $parent = 0;
|
34 |
-
var $count;
|
35 |
-
//extra attributes imposed by EM_Category
|
36 |
-
var $image_url = '';
|
37 |
-
var $color;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Gets data from POST (default), supplied array, or from the database if an ID is supplied
|
41 |
-
* @param $category_data
|
42 |
-
* @return null
|
43 |
-
*/
|
44 |
-
function
|
45 |
-
global $wpdb;
|
46 |
-
self::ms_global_switch();
|
47 |
-
//Initialize
|
48 |
-
$category = array();
|
49 |
-
if( !empty($category_data) ){
|
50 |
-
//Load category data
|
51 |
-
if( is_object($category_data) && !empty($category_data->taxonomy) && $category_data->taxonomy == EM_TAXONOMY_CATEGORY ){
|
52 |
-
$category = $category_data;
|
53 |
-
}elseif( !is_numeric($category_data) ){
|
54 |
-
$category = get_term_by('slug', $category_data, EM_TAXONOMY_CATEGORY);
|
55 |
-
if( !$category ){
|
56 |
-
$category = get_term_by('name', $category_data, EM_TAXONOMY_CATEGORY);
|
57 |
-
}
|
58 |
-
}else{
|
59 |
-
$category = get_term_by('id', $category_data, EM_TAXONOMY_CATEGORY);
|
60 |
-
}
|
61 |
-
}
|
62 |
-
if( is_object($category) || is_array($category) ){
|
63 |
-
foreach($category as $key => $value){
|
64 |
-
$this->$key = $value;
|
65 |
-
}
|
66 |
-
}
|
67 |
-
$this->id = $this->term_id; //backward compatability
|
68 |
-
self::ms_global_switch_back();
|
69 |
-
do_action('em_category',$this, $category_data);
|
70 |
-
}
|
71 |
-
|
72 |
-
function get_color(){
|
73 |
-
if( empty($this->color) ){
|
74 |
-
global $wpdb;
|
75 |
-
$color = $wpdb->get_var('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$this->term_id}' AND meta_key='category-bgcolor' LIMIT 1");
|
76 |
-
$this->color = ($color != '') ? $color:get_option('dbem_category_default_color', '#FFFFFF');
|
77 |
-
}
|
78 |
-
return $this->color;
|
79 |
-
}
|
80 |
-
|
81 |
-
function get_image_url( $size = 'full' ){
|
82 |
-
if( empty($this->image_url) ){
|
83 |
-
global $wpdb;
|
84 |
-
$image_url = $wpdb->get_var('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$this->term_id}' AND meta_key='category-image' LIMIT 1");
|
85 |
-
$this->image_url = ($image_url != '') ? $image_url:'';
|
86 |
-
}
|
87 |
-
return $this->image_url;
|
88 |
-
}
|
89 |
-
|
90 |
-
function get_image_id(){
|
91 |
-
if( empty($this->image_id) ){
|
92 |
-
global $wpdb;
|
93 |
-
$image_id = $wpdb->get_var('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$this->term_id}' AND meta_key='category-image-id' LIMIT 1");
|
94 |
-
$this->image_id = ($image_id != '') ? $image_id:'';
|
95 |
-
}
|
96 |
-
return $this->image_id;
|
97 |
-
}
|
98 |
-
|
99 |
-
function get_url(){
|
100 |
-
if( empty($this->link) ){
|
101 |
-
self::ms_global_switch();
|
102 |
-
$this->link = get_term_link($this->slug, EM_TAXONOMY_CATEGORY);
|
103 |
-
self::ms_global_switch_back();
|
104 |
-
if ( is_wp_error($this->link) ) $this->link = '';
|
105 |
-
}
|
106 |
-
return apply_filters('em_category_get_url', $this->link);
|
107 |
-
}
|
108 |
-
|
109 |
-
function get_ical_url(){
|
110 |
-
global $wp_rewrite;
|
111 |
-
if( !empty($wp_rewrite) && $wp_rewrite->using_permalinks() ){
|
112 |
-
$return = trailingslashit($this->get_url()).'ical/';
|
113 |
-
}else{
|
114 |
-
$return = em_add_get_params($this->get_url(), array('ical'=>1));
|
115 |
-
}
|
116 |
-
return apply_filters('em_category_get_ical_url', $return);
|
117 |
-
}
|
118 |
-
|
119 |
-
function get_rss_url(){
|
120 |
-
global $wp_rewrite;
|
121 |
-
if( !empty($wp_rewrite) && $wp_rewrite->using_permalinks() ){
|
122 |
-
$return = trailingslashit($this->get_url()).'feed/';
|
123 |
-
}else{
|
124 |
-
$return = em_add_get_params($this->get_url(), array('feed'=>1));
|
125 |
-
}
|
126 |
-
return apply_filters('em_category_get_rss_url', $return);
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Depreciated, don't use.
|
131 |
-
* @return mixed
|
132 |
-
*/
|
133 |
-
function has_events(){
|
134 |
-
global $wpdb;
|
135 |
-
return false;
|
136 |
-
}
|
137 |
-
|
138 |
-
function output_single($target = 'html'){
|
139 |
-
$format = get_option ( 'dbem_category_page_format' );
|
140 |
-
return apply_filters('em_category_output_single', $this->output($format, $target), $this, $target);
|
141 |
-
}
|
142 |
-
|
143 |
-
function output($format, $target="html") {
|
144 |
-
preg_match_all('/\{([a-zA-Z0-9_]+)\}([^{]+)\{\/[a-zA-Z0-9_]+\}/', $format, $conditionals);
|
145 |
-
if( count($conditionals[0]) > 0 ){
|
146 |
-
//Check if the language we want exists, if not we take the first language there
|
147 |
-
foreach($conditionals[1] as $key => $condition){
|
148 |
-
$format = str_replace($conditionals[0][$key], apply_filters('em_category_output_condition', '', $condition, $conditionals[0][$key], $this), $format);
|
149 |
-
}
|
150 |
-
}
|
151 |
-
$category_string = $format;
|
152 |
-
preg_match_all("/(#@?_?[A-Za-z0-9]+)({([a-zA-Z0-9,]+)})?/", $format, $placeholders);
|
153 |
-
$replaces = array();
|
154 |
-
foreach($placeholders[1] as $key => $result) {
|
155 |
-
$replace = '';
|
156 |
-
$full_result = $placeholders[0][$key];
|
157 |
-
switch( $result ){
|
158 |
-
case '#_CATEGORYNAME':
|
159 |
-
$replace = $this->name;
|
160 |
-
break;
|
161 |
-
case '#_CATEGORYID':
|
162 |
-
$replace = $this->term_id;
|
163 |
-
break;
|
164 |
-
case '#_CATEGORYNOTES':
|
165 |
-
case '#_CATEGORYDESCRIPTION':
|
166 |
-
$replace = $this->description;
|
167 |
-
break;
|
168 |
-
case '#_CATEGORYIMAGE':
|
169 |
-
case '#_CATEGORYIMAGEURL':
|
170 |
-
if( $this->get_image_url() != ''){
|
171 |
-
$image_url = esc_url($this->get_image_url());
|
172 |
-
if($result == '#_CATEGORYIMAGEURL'){
|
173 |
-
$replace = $image_url;
|
174 |
-
}else{
|
175 |
-
if( empty($placeholders[3][$key]) ){
|
176 |
-
$replace = "<img src='".esc_url($this->get_image_url())."' alt='".esc_attr($this->name)."'/>";
|
177 |
-
}else{
|
178 |
-
$image_size = explode(',', $placeholders[3][$key]);
|
179 |
-
if( self::array_is_numeric($image_size) && count($image_size) > 1 ){
|
180 |
-
if( $this->get_image_id() ){
|
181 |
-
//get a thumbnail
|
182 |
-
if( get_option('dbem_disable_thumbnails') ){
|
183 |
-
$image_attr = '';
|
184 |
-
$image_args = array();
|
185 |
-
if( empty($image_size[1]) && !empty($image_size[0]) ){
|
186 |
-
$image_attr = 'width="'.$image_size[0].'"';
|
187 |
-
$image_args['w'] = $image_size[0];
|
188 |
-
}elseif( empty($image_size[0]) && !empty($image_size[1]) ){
|
189 |
-
$image_attr = 'height="'.$image_size[1].'"';
|
190 |
-
$image_args['h'] = $image_size[1];
|
191 |
-
}elseif( !empty($image_size[0]) && !empty($image_size[1]) ){
|
192 |
-
$image_attr = 'width="'.$image_size[0].'" height="'.$image_size[1].'"';
|
193 |
-
$image_args = array('w'=>$image_size[0], 'h'=>$image_size[1]);
|
194 |
-
}
|
195 |
-
$replace = "<img src='".esc_url(em_add_get_params($image_url, $image_args))."' alt='".esc_attr($this->name)."' $image_attr />";
|
196 |
-
}else{
|
197 |
-
//since we previously didn't store image ids along with the url to the image (since taxonomies don't allow normal featured images), sometimes we won't be able to do this, which is why we check there's a valid image id first
|
198 |
-
self::ms_global_switch();
|
199 |
-
$replace = wp_get_attachment_image($this->get_image_id(), $image_size);
|
200 |
-
self::ms_global_switch_back();
|
201 |
-
}
|
202 |
-
}
|
203 |
-
}else{
|
204 |
-
$replace = "<img src='".esc_url($this->get_image_url())."' alt='".esc_attr($this->name)."'/>";
|
205 |
-
}
|
206 |
-
}
|
207 |
-
}
|
208 |
-
}
|
209 |
-
break;
|
210 |
-
case '#_CATEGORYCOLOR':
|
211 |
-
$replace = $this->get_color();
|
212 |
-
break;
|
213 |
-
case '#_CATEGORYLINK':
|
214 |
-
case '#_CATEGORYURL':
|
215 |
-
$link = $this->get_url();
|
216 |
-
$replace = ($result == '#_CATEGORYURL') ? $link : '<a href="'.$link.'">'.esc_html($this->name).'</a>';
|
217 |
-
break;
|
218 |
-
case '#_CATEGORYICALURL':
|
219 |
-
case '#_CATEGORYICALLINK':
|
220 |
-
$replace = $this->get_ical_url();
|
221 |
-
if( $result == '#_CATEGORYICALLINK' ){
|
222 |
-
$replace = '<a href="'.esc_url($replace).'">iCal</a>';
|
223 |
-
}
|
224 |
-
break;
|
225 |
-
case '#_CATEGORYRSSURL':
|
226 |
-
case '#_CATEGORYRSSLINK':
|
227 |
-
$replace = $this->get_rss_url();
|
228 |
-
if( $result == '#_CATEGORYRSSLINK' ){
|
229 |
-
$replace = '<a href="'.esc_url($replace).'">RSS</a>';
|
230 |
-
}
|
231 |
-
break;
|
232 |
-
case '#_CATEGORYSLUG':
|
233 |
-
$replace = $this->slug;
|
234 |
-
break;
|
235 |
-
case '#_CATEGORYEVENTSPAST': //depreciated, erroneous documentation, left for compatability
|
236 |
-
case '#_CATEGORYEVENTSNEXT': //depreciated, erroneous documentation, left for compatability
|
237 |
-
case '#_CATEGORYEVENTSALL': //depreciated, erroneous documentation, left for compatability
|
238 |
-
case '#_CATEGORYPASTEVENTS':
|
239 |
-
case '#_CATEGORYNEXTEVENTS':
|
240 |
-
case '#_CATEGORYALLEVENTS':
|
241 |
-
//convert depreciated placeholders for compatability
|
242 |
-
$result = ($result == '#_CATEGORYEVENTSPAST') ? '#_CATEGORYPASTEVENTS':$result;
|
243 |
-
$result = ($result == '#_CATEGORYEVENTSNEXT') ? '#_CATEGORYNEXTEVENTS':$result;
|
244 |
-
$result = ($result == '#_CATEGORYEVENTSALL') ? '#_CATEGORYALLEVENTS':$result;
|
245 |
-
//forget it ever happened? :/
|
246 |
-
if ($result == '#_CATEGORYPASTEVENTS'){ $scope = 'past'; }
|
247 |
-
elseif ( $result == '#_CATEGORYNEXTEVENTS' ){ $scope = 'future'; }
|
248 |
-
else{ $scope = 'all'; }
|
249 |
-
$events_count = EM_Events::count( array('category'=>$this->term_id, 'scope'=>$scope) );
|
250 |
-
if ( $events_count > 0 ){
|
251 |
-
$args = array('category'=>$this->term_id, 'scope'=>$scope, 'pagination'=>1, 'ajax'=>0);
|
252 |
-
$args['format_header'] = get_option('dbem_category_event_list_item_header_format');
|
253 |
-
$args['format_footer'] = get_option('dbem_category_event_list_item_footer_format');
|
254 |
-
$args['format'] = get_option('dbem_category_event_list_item_format');
|
255 |
-
$args['limit'] = get_option('dbem_category_event_list_limit');
|
256 |
-
$args['page'] = (!empty($_REQUEST['pno']) && is_numeric($_REQUEST['pno']) )? $_REQUEST['pno'] : 1;
|
257 |
-
$replace = EM_Events::output($args);
|
258 |
-
} else {
|
259 |
-
$replace = get_option('dbem_category_no_events_message','</ul>');
|
260 |
-
}
|
261 |
-
break;
|
262 |
-
case '#_CATEGORYNEXTEVENT':
|
263 |
-
$events = EM_Events::get( array('category'=>$this->term_id, 'scope'=>'future', 'limit'=>1, 'orderby'=>'event_start_date,event_start_time') );
|
264 |
-
$replace = get_option('dbem_category_no_event_message');
|
265 |
-
foreach($events as $EM_Event){
|
266 |
-
$replace = $EM_Event->output(get_option('dbem_category_event_single_format'));
|
267 |
-
}
|
268 |
-
break;
|
269 |
-
default:
|
270 |
-
$replace = $full_result;
|
271 |
-
break;
|
272 |
-
}
|
273 |
-
$replaces[$full_result] = apply_filters('em_category_output_placeholder', $replace, $this, $full_result, $target);
|
274 |
-
}
|
275 |
-
krsort($replaces);
|
276 |
-
foreach($replaces as $full_result => $replacement){
|
277 |
-
$category_string = str_replace($full_result, $replacement , $category_string );
|
278 |
-
}
|
279 |
-
return apply_filters('em_category_output', $category_string, $this, $format, $target);
|
280 |
-
}
|
281 |
-
|
282 |
-
function can_manage( $capability_owner = 'edit_categories', $capability_admin = false, $user_to_check = false ){
|
283 |
-
global $em_capabilities_array;
|
284 |
-
//Figure out if this is multisite and require an extra bit of validation
|
285 |
-
$multisite_check = true;
|
286 |
-
$can_manage = current_user_can($capability_owner);
|
287 |
-
//if multisite and supoer admin, just return true
|
288 |
-
if( is_multisite() && is_super_admin() ){ return true; }
|
289 |
-
if( EM_MS_GLOBAL && !is_main_site() ){
|
290 |
-
//User can't admin this bit, as they're on a sub-blog
|
291 |
-
$can_manage = false;
|
292 |
-
if(array_key_exists($capability_owner, $em_capabilities_array) ){
|
293 |
-
$this->add_error( $em_capabilities_array[$capability_owner]);
|
294 |
-
}
|
295 |
-
}
|
296 |
-
return $can_manage;
|
297 |
-
}
|
298 |
-
}
|
299 |
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Get an category in a db friendly way, by checking globals and passed variables to avoid extra class instantiations
|
4 |
+
* @param mixed $id
|
5 |
+
* @return EM_Category
|
6 |
+
*/
|
7 |
+
function em_get_category($id = false) {
|
8 |
+
global $EM_Category;
|
9 |
+
//check if it's not already global so we don't instantiate again
|
10 |
+
if( is_object($EM_Category) && get_class($EM_Category) == 'EM_Category' ){
|
11 |
+
if( $EM_Category->term_id == $id ){
|
12 |
+
return $EM_Category;
|
13 |
+
}elseif( is_object($id) && $EM_Category->term_id == $id->term_id ){
|
14 |
+
return $EM_Category;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
if( is_object($id) && get_class($id) == 'EM_Category' ){
|
18 |
+
return $id;
|
19 |
+
}else{
|
20 |
+
return new EM_Category($id);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
class EM_Category extends EM_Object {
|
24 |
+
//Taxonomy Fields
|
25 |
+
var $id = '';
|
26 |
+
var $term_id;
|
27 |
+
var $name;
|
28 |
+
var $slug;
|
29 |
+
var $term_group;
|
30 |
+
var $term_taxonomy_id;
|
31 |
+
var $taxonomy;
|
32 |
+
var $description = '';
|
33 |
+
var $parent = 0;
|
34 |
+
var $count;
|
35 |
+
//extra attributes imposed by EM_Category
|
36 |
+
var $image_url = '';
|
37 |
+
var $color;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Gets data from POST (default), supplied array, or from the database if an ID is supplied
|
41 |
+
* @param $category_data
|
42 |
+
* @return null
|
43 |
+
*/
|
44 |
+
function __construct( $category_data = false ) {
|
45 |
+
global $wpdb;
|
46 |
+
self::ms_global_switch();
|
47 |
+
//Initialize
|
48 |
+
$category = array();
|
49 |
+
if( !empty($category_data) ){
|
50 |
+
//Load category data
|
51 |
+
if( is_object($category_data) && !empty($category_data->taxonomy) && $category_data->taxonomy == EM_TAXONOMY_CATEGORY ){
|
52 |
+
$category = $category_data;
|
53 |
+
}elseif( !is_numeric($category_data) ){
|
54 |
+
$category = get_term_by('slug', $category_data, EM_TAXONOMY_CATEGORY);
|
55 |
+
if( !$category ){
|
56 |
+
$category = get_term_by('name', $category_data, EM_TAXONOMY_CATEGORY);
|
57 |
+
}
|
58 |
+
}else{
|
59 |
+
$category = get_term_by('id', $category_data, EM_TAXONOMY_CATEGORY);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
if( is_object($category) || is_array($category) ){
|
63 |
+
foreach($category as $key => $value){
|
64 |
+
$this->$key = $value;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
$this->id = $this->term_id; //backward compatability
|
68 |
+
self::ms_global_switch_back();
|
69 |
+
do_action('em_category',$this, $category_data);
|
70 |
+
}
|
71 |
+
|
72 |
+
function get_color(){
|
73 |
+
if( empty($this->color) ){
|
74 |
+
global $wpdb;
|
75 |
+
$color = $wpdb->get_var('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$this->term_id}' AND meta_key='category-bgcolor' LIMIT 1");
|
76 |
+
$this->color = ($color != '') ? $color:get_option('dbem_category_default_color', '#FFFFFF');
|
77 |
+
}
|
78 |
+
return $this->color;
|
79 |
+
}
|
80 |
+
|
81 |
+
function get_image_url( $size = 'full' ){
|
82 |
+
if( empty($this->image_url) ){
|
83 |
+
global $wpdb;
|
84 |
+
$image_url = $wpdb->get_var('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$this->term_id}' AND meta_key='category-image' LIMIT 1");
|
85 |
+
$this->image_url = ($image_url != '') ? $image_url:'';
|
86 |
+
}
|
87 |
+
return $this->image_url;
|
88 |
+
}
|
89 |
+
|
90 |
+
function get_image_id(){
|
91 |
+
if( empty($this->image_id) ){
|
92 |
+
global $wpdb;
|
93 |
+
$image_id = $wpdb->get_var('SELECT meta_value FROM '.EM_META_TABLE." WHERE object_id='{$this->term_id}' AND meta_key='category-image-id' LIMIT 1");
|
94 |
+
$this->image_id = ($image_id != '') ? $image_id:'';
|
95 |
+
}
|
96 |
+
return $this->image_id;
|
97 |
+
}
|
98 |
+
|
99 |
+
function get_url(){
|
100 |
+
if( empty($this->link) ){
|
101 |
+
self::ms_global_switch();
|
102 |
+
$this->link = get_term_link($this->slug, EM_TAXONOMY_CATEGORY);
|
103 |
+
self::ms_global_switch_back();
|
104 |
+
if ( is_wp_error($this->link) ) $this->link = '';
|
105 |
+
}
|
106 |
+
return apply_filters('em_category_get_url', $this->link);
|
107 |
+
}
|
108 |
+
|
109 |
+
function get_ical_url(){
|
110 |
+
global $wp_rewrite;
|
111 |
+
if( !empty($wp_rewrite) && $wp_rewrite->using_permalinks() ){
|
112 |
+
$return = trailingslashit($this->get_url()).'ical/';
|
113 |
+
}else{
|
114 |
+
$return = em_add_get_params($this->get_url(), array('ical'=>1));
|
115 |
+
}
|
116 |
+
return apply_filters('em_category_get_ical_url', $return);
|
117 |
+
}
|
118 |
+
|
119 |
+
function get_rss_url(){
|
120 |
+
global $wp_rewrite;
|
121 |
+
if( !empty($wp_rewrite) && $wp_rewrite->using_permalinks() ){
|
122 |
+
$return = trailingslashit($this->get_url()).'feed/';
|
123 |
+
}else{
|
124 |
+
$return = em_add_get_params($this->get_url(), array('feed'=>1));
|
125 |
+
}
|
126 |
+
return apply_filters('em_category_get_rss_url', $return);
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Depreciated, don't use.
|
131 |
+
* @return mixed
|
132 |
+
*/
|
133 |
+
function has_events(){
|
134 |
+
global $wpdb;
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
function output_single($target = 'html'){
|
139 |
+
$format = get_option ( 'dbem_category_page_format' );
|
140 |
+
return apply_filters('em_category_output_single', $this->output($format, $target), $this, $target);
|
141 |
+
}
|
142 |
+
|
143 |
+
function output($format, $target="html") {
|
144 |
+
preg_match_all('/\{([a-zA-Z0-9_]+)\}([^{]+)\{\/[a-zA-Z0-9_]+\}/', $format, $conditionals);
|
145 |
+
if( count($conditionals[0]) > 0 ){
|
146 |
+
//Check if the language we want exists, if not we take the first language there
|
147 |
+
foreach($conditionals[1] as $key => $condition){
|
148 |
+
$format = str_replace($conditionals[0][$key], apply_filters('em_category_output_condition', '', $condition, $conditionals[0][$key], $this), $format);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
$category_string = $format;
|
152 |
+
preg_match_all("/(#@?_?[A-Za-z0-9]+)({([a-zA-Z0-9,]+)})?/", $format, $placeholders);
|
153 |
+
$replaces = array();
|
154 |
+
foreach($placeholders[1] as $key => $result) {
|
155 |
+
$replace = '';
|
156 |
+
$full_result = $placeholders[0][$key];
|
157 |
+
switch( $result ){
|
158 |
+
case '#_CATEGORYNAME':
|
159 |
+
$replace = $this->name;
|
160 |
+
break;
|
161 |
+
case '#_CATEGORYID':
|
162 |
+
$replace = $this->term_id;
|
163 |
+
break;
|
164 |
+
case '#_CATEGORYNOTES':
|
165 |
+
case '#_CATEGORYDESCRIPTION':
|
166 |
+
$replace = $this->description;
|
167 |
+
break;
|
168 |
+
case '#_CATEGORYIMAGE':
|
169 |
+
case '#_CATEGORYIMAGEURL':
|
170 |
+
if( $this->get_image_url() != ''){
|
171 |
+
$image_url = esc_url($this->get_image_url());
|
172 |
+
if($result == '#_CATEGORYIMAGEURL'){
|
173 |
+
$replace = $image_url;
|
174 |
+
}else{
|
175 |
+
if( empty($placeholders[3][$key]) ){
|
176 |
+
$replace = "<img src='".esc_url($this->get_image_url())."' alt='".esc_attr($this->name)."'/>";
|
177 |
+
}else{
|
178 |
+
$image_size = explode(',', $placeholders[3][$key]);
|
179 |
+
if( self::array_is_numeric($image_size) && count($image_size) > 1 ){
|
180 |
+
if( $this->get_image_id() ){
|
181 |
+
//get a thumbnail
|
182 |
+
if( get_option('dbem_disable_thumbnails') ){
|
183 |
+
$image_attr = '';
|
184 |
+
$image_args = array();
|
185 |
+
if( empty($image_size[1]) && !empty($image_size[0]) ){
|
186 |
+
$image_attr = 'width="'.$image_size[0].'"';
|
187 |
+
$image_args['w'] = $image_size[0];
|
188 |
+
}elseif( empty($image_size[0]) && !empty($image_size[1]) ){
|
189 |
+
$image_attr = 'height="'.$image_size[1].'"';
|
190 |
+
$image_args['h'] = $image_size[1];
|
191 |
+
}elseif( !empty($image_size[0]) && !empty($image_size[1]) ){
|
192 |
+
$image_attr = 'width="'.$image_size[0].'" height="'.$image_size[1].'"';
|
193 |
+
$image_args = array('w'=>$image_size[0], 'h'=>$image_size[1]);
|
194 |
+
}
|
195 |
+
$replace = "<img src='".esc_url(em_add_get_params($image_url, $image_args))."' alt='".esc_attr($this->name)."' $image_attr />";
|
196 |
+
}else{
|
197 |
+
//since we previously didn't store image ids along with the url to the image (since taxonomies don't allow normal featured images), sometimes we won't be able to do this, which is why we check there's a valid image id first
|
198 |
+
self::ms_global_switch();
|
199 |
+
$replace = wp_get_attachment_image($this->get_image_id(), $image_size);
|
200 |
+
self::ms_global_switch_back();
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}else{
|
204 |
+
$replace = "<img src='".esc_url($this->get_image_url())."' alt='".esc_attr($this->name)."'/>";
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
break;
|
210 |
+
case '#_CATEGORYCOLOR':
|
211 |
+
$replace = $this->get_color();
|
212 |
+
break;
|
213 |
+
case '#_CATEGORYLINK':
|
214 |
+
case '#_CATEGORYURL':
|
215 |
+
$link = $this->get_url();
|
216 |
+
$replace = ($result == '#_CATEGORYURL') ? $link : '<a href="'.$link.'">'.esc_html($this->name).'</a>';
|
217 |
+
break;
|
218 |
+
case '#_CATEGORYICALURL':
|
219 |
+
case '#_CATEGORYICALLINK':
|
220 |
+
$replace = $this->get_ical_url();
|
221 |
+
if( $result == '#_CATEGORYICALLINK' ){
|
222 |
+
$replace = '<a href="'.esc_url($replace).'">iCal</a>';
|
223 |
+
}
|
224 |
+
break;
|
225 |
+
case '#_CATEGORYRSSURL':
|
226 |
+
case '#_CATEGORYRSSLINK':
|
227 |
+
$replace = $this->get_rss_url();
|
228 |
+
if( $result == '#_CATEGORYRSSLINK' ){
|
229 |
+
$replace = '<a href="'.esc_url($replace).'">RSS</a>';
|
230 |
+
}
|
231 |
+
break;
|
232 |
+
case '#_CATEGORYSLUG':
|
233 |
+
$replace = $this->slug;
|
234 |
+
break;
|
235 |
+
case '#_CATEGORYEVENTSPAST': //depreciated, erroneous documentation, left for compatability
|
236 |
+
case '#_CATEGORYEVENTSNEXT': //depreciated, erroneous documentation, left for compatability
|
237 |
+
case '#_CATEGORYEVENTSALL': //depreciated, erroneous documentation, left for compatability
|
238 |
+
case '#_CATEGORYPASTEVENTS':
|
239 |
+
case '#_CATEGORYNEXTEVENTS':
|
240 |
+
case '#_CATEGORYALLEVENTS':
|
241 |
+
//convert depreciated placeholders for compatability
|
242 |
+
$result = ($result == '#_CATEGORYEVENTSPAST') ? '#_CATEGORYPASTEVENTS':$result;
|
243 |
+
$result = ($result == '#_CATEGORYEVENTSNEXT') ? '#_CATEGORYNEXTEVENTS':$result;
|
244 |
+
$result = ($result == '#_CATEGORYEVENTSALL') ? '#_CATEGORYALLEVENTS':$result;
|
245 |
+
//forget it ever happened? :/
|
246 |
+
if ($result == '#_CATEGORYPASTEVENTS'){ $scope = 'past'; }
|
247 |
+
elseif ( $result == '#_CATEGORYNEXTEVENTS' ){ $scope = 'future'; }
|
248 |
+
else{ $scope = 'all'; }
|
249 |
+
$events_count = EM_Events::count( array('category'=>$this->term_id, 'scope'=>$scope) );
|
250 |
+
if ( $events_count > 0 ){
|
251 |
+
$args = array('category'=>$this->term_id, 'scope'=>$scope, 'pagination'=>1, 'ajax'=>0);
|
252 |
+
$args['format_header'] = get_option('dbem_category_event_list_item_header_format');
|
253 |
+
$args['format_footer'] = get_option('dbem_category_event_list_item_footer_format');
|
254 |
+
$args['format'] = get_option('dbem_category_event_list_item_format');
|
255 |
+
$args['limit'] = get_option('dbem_category_event_list_limit');
|
256 |
+
$args['page'] = (!empty($_REQUEST['pno']) && is_numeric($_REQUEST['pno']) )? $_REQUEST['pno'] : 1;
|
257 |
+
$replace = EM_Events::output($args);
|
258 |
+
} else {
|
259 |
+
$replace = get_option('dbem_category_no_events_message','</ul>');
|
260 |
+
}
|
261 |
+
break;
|
262 |
+
case '#_CATEGORYNEXTEVENT':
|
263 |
+
$events = EM_Events::get( array('category'=>$this->term_id, 'scope'=>'future', 'limit'=>1, 'orderby'=>'event_start_date,event_start_time') );
|
264 |
+
$replace = get_option('dbem_category_no_event_message');
|
265 |
+
foreach($events as $EM_Event){
|
266 |
+
$replace = $EM_Event->output(get_option('dbem_category_event_single_format'));
|
267 |
+
}
|
268 |
+
break;
|
269 |
+
default:
|
270 |
+
$replace = $full_result;
|
271 |
+
break;
|
272 |
+
}
|
273 |
+
$replaces[$full_result] = apply_filters('em_category_output_placeholder', $replace, $this, $full_result, $target);
|
274 |
+
}
|
275 |
+
krsort($replaces);
|
276 |
+
foreach($replaces as $full_result => $replacement){
|
277 |
+
$category_string = str_replace($full_result, $replacement , $category_string );
|
278 |
+
}
|
279 |
+
return apply_filters('em_category_output', $category_string, $this, $format, $target);
|
280 |
+
}
|
281 |
+
|
282 |
+
function can_manage( $capability_owner = 'edit_categories', $capability_admin = false, $user_to_check = false ){
|
283 |
+
global $em_capabilities_array;
|
284 |
+
//Figure out if this is multisite and require an extra bit of validation
|
285 |
+
$multisite_check = true;
|
286 |
+
$can_manage = current_user_can($capability_owner);
|
287 |
+
//if multisite and supoer admin, just return true
|
288 |
+
if( is_multisite() && is_super_admin() ){ return true; }
|
289 |
+
if( EM_MS_GLOBAL && !is_main_site() ){
|
290 |
+
//User can't admin this bit, as they're on a sub-blog
|
291 |
+
$can_manage = false;
|
292 |
+
if(array_key_exists($capability_owner, $em_capabilities_array) ){
|
293 |
+
$this->add_error( $em_capabilities_array[$capability_owner]);
|
294 |
+
}
|
295 |
+
}
|
296 |
+
return $can_manage;
|
297 |
+
}
|
298 |
+
}
|
299 |
?>
|
classes/em-event-post-admin.php
CHANGED
@@ -1,443 +1,480 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Events Edit Page
|
4 |
-
*/
|
5 |
-
class EM_Event_Post_Admin{
|
6 |
-
public static function init(){
|
7 |
-
global $pagenow;
|
8 |
-
if($pagenow == 'post.php' || $pagenow == 'post-new.php' ){ //only needed if editing post
|
9 |
-
add_action('admin_head', array('EM_Event_Post_Admin','admin_head'));
|
10 |
-
//Meta Boxes
|
11 |
-
add_action('add_meta_boxes', array('EM_Event_Post_Admin','meta_boxes'));
|
12 |
-
//Notices
|
13 |
-
add_action('admin_notices',array('EM_Event_Post_Admin','admin_notices'));
|
14 |
-
}
|
15 |
-
//Save/Edit actions
|
16 |
-
add_filter('wp_insert_post_data',array('EM_Event_Post_Admin','wp_insert_post_data'),100,2); //validate post meta before saving is done
|
17 |
-
add_action('save_post',array('EM_Event_Post_Admin','save_post'),1,1); //set to 1 so metadata gets saved ASAP
|
18 |
-
add_action('before_delete_post',array('EM_Event_Post_Admin','before_delete_post'),10,1);
|
19 |
-
add_action('trashed_post',array('EM_Event_Post_Admin','trashed_post'),10,1);
|
20 |
-
add_action('untrash_post',array('EM_Event_Post_Admin','untrash_post'),10,1);
|
21 |
-
add_action('untrashed_post',array('EM_Event_Post_Admin','untrashed_post'),10,1);
|
22 |
-
//Notices
|
23 |
-
add_action('post_updated_messages',array('EM_Event_Post_Admin','admin_notices_filter'),1,1);
|
24 |
-
}
|
25 |
-
|
26 |
-
public static function admin_head(){
|
27 |
-
global $post, $EM_Event;
|
28 |
-
if( !empty($post) && $post->post_type == EM_POST_TYPE_EVENT ){
|
29 |
-
$EM_Event = em_get_event($post->ID, 'post_id');
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
public static function admin_notices(){
|
34 |
-
//When editing
|
35 |
-
global $post, $EM_Event, $pagenow;
|
36 |
-
if( $pagenow == 'post.php' && ($post->post_type == EM_POST_TYPE_EVENT || $post->post_type == 'event-recurring') ){
|
37 |
-
if ( $EM_Event->is_recurring() ) {
|
38 |
-
$warning = "<p><strong>".__( 'WARNING: This is a recurring event.', 'dbem' )."</strong></p>";
|
39 |
-
$warning .= "<p>". __( 'Modifications to this event will cause all recurrences of this event to be deleted and recreated and previous bookings will be deleted! You can edit individual recurrences and disassociate them with this recurring event.', 'dbem' );
|
40 |
-
?><div class="updated"><?php echo $warning; ?></div><?php
|
41 |
-
} elseif ( $EM_Event->is_recurrence() ) {
|
42 |
-
$warning = "<p><strong>".__('WARNING: This is a recurrence in a set of recurring events.', 'dbem')."</strong></p>";
|
43 |
-
$warning .= "<p>". sprintf(__('If you update this event data and save, it could get overwritten if you edit the recurring event template. To make it an independent, <a href="%s">detach it</a>.', 'dbem' ), $EM_Event->get_detach_url())."</p>";
|
44 |
-
$warning .= "<p>".sprintf(__('To manage the whole set, <a href="%s">edit the recurring event template</a>.', 'dbem'),admin_url('post.php?action=edit&post='.$EM_Event->get_event_recurrence()->post_id))."</p>";
|
45 |
-
?><div class="updated"><?php echo $warning; ?></div><?php
|
46 |
-
}
|
47 |
-
if( !empty($EM_Event->group_id) && function_exists('groups_get_group') ){
|
48 |
-
$group = groups_get_group(array('group_id'=>$EM_Event->group_id));
|
49 |
-
$warning = sprintf(__('WARNING: This is a event belonging to the group "%s". Other group admins can also modify this event.', 'dbem'), $group->name);
|
50 |
-
?><div class="updated"><p><?php echo $warning; ?></p></div><?php
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
public static function admin_notices_filter($messages){
|
56 |
-
//When editing
|
57 |
-
global $post, $EM_Notices;
|
58 |
-
if( $post->post_type == EM_POST_TYPE_EVENT || $post->post_type == 'event-recurring' ){
|
59 |
-
if ( $EM_Notices->count_errors() > 0 ) {
|
60 |
-
unset($_GET['message']);
|
61 |
-
}
|
62 |
-
}
|
63 |
-
return $messages;
|
64 |
-
}
|
65 |
-
|
66 |
-
public static function wp_insert_post_data( $data, $postarr ){
|
67 |
-
global $wpdb, $EM_Event, $EM_Location, $EM_Notices, $EM_SAVING_EVENT;
|
68 |
-
if( !empty($EM_SAVING_EVENT) ) return $data; //never proceed with this if using EM_Event::save();
|
69 |
-
$post_type = $data['post_type'];
|
70 |
-
$post_ID = !empty($postarr['ID']) ? $postarr['ID'] : false;
|
71 |
-
$is_post_type = $post_type == EM_POST_TYPE_EVENT || $post_type == 'event-recurring';
|
72 |
-
$saving_status = !in_array($data['post_status'], array('trash','auto-draft')) && !defined('DOING_AUTOSAVE');
|
73 |
-
$untrashing = $post_ID && defined('UNTRASHING_'.$post_ID);
|
74 |
-
if( !$untrashing && $is_post_type && $saving_status ){
|
75 |
-
if( !empty($_REQUEST['_emnonce']) && wp_verify_nonce($_REQUEST['_emnonce'], 'edit_event') ){
|
76 |
-
//this is only run if we know form data was submitted, hence the nonce
|
77 |
-
$EM_Event = em_get_event();
|
78 |
-
$EM_Event->post_type = $post_type;
|
79 |
-
//Handle Errors by making post draft
|
80 |
-
$get_meta = $EM_Event->get_post_meta();
|
81 |
-
$validate_meta = $EM_Event->validate_meta();
|
82 |
-
if( !$get_meta || !$validate_meta ) $data['post_status'] = 'draft';
|
83 |
-
}
|
84 |
-
}
|
85 |
-
return $data;
|
86 |
-
}
|
87 |
-
|
88 |
-
public static function save_post($post_id){
|
89 |
-
global $wpdb, $EM_Event, $EM_Location, $EM_Notices, $EM_SAVING_EVENT, $EM_EVENT_SAVE_POST;
|
90 |
-
if( !empty($EM_SAVING_EVENT) ) return; //never proceed with this if using EM_Event::save();
|
91 |
-
if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) && wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $post_id ) ) return; //don't proceed with saving when previewing, may cause issues
|
92 |
-
$post_type = get_post_type($post_id);
|
93 |
-
$is_post_type = $post_type == EM_POST_TYPE_EVENT || $post_type == 'event-recurring';
|
94 |
-
$saving_status = !in_array(get_post_status($post_id), array('trash','auto-draft')) && !defined('DOING_AUTOSAVE');
|
95 |
-
$EM_EVENT_SAVE_POST = true; //first filter for save_post in EM for events
|
96 |
-
if(!defined('UNTRASHING_'.$post_id) && $is_post_type && $saving_status ){
|
97 |
-
$EM_Event = em_get_event($post_id, 'post_id'); //grab event, via post info
|
98 |
-
$EM_Event->post_type = $post_type;
|
99 |
-
if( !empty($_REQUEST['_emnonce']) && wp_verify_nonce($_REQUEST['_emnonce'], 'edit_event') ){
|
100 |
-
//this is only run if we know form data was submitted, hence the nonce
|
101 |
-
do_action('em_event_save_pre', $EM_Event); //technically, the event is saved... but the meta isn't. wp doesn't give an pre-intervention action for this (or does it?)
|
102 |
-
//Handle Errors by making post draft
|
103 |
-
$get_meta = $EM_Event->get_post_meta();
|
104 |
-
$validate_meta = $EM_Event->validate_meta();
|
105 |
-
$save_meta = $EM_Event->save_meta();
|
106 |
-
$EM_Event->get_categories()->save(); //save categories in case of default category
|
107 |
-
if( !$get_meta || !$validate_meta || !$save_meta ){
|
108 |
-
//failed somewhere, set to draft, don't publish
|
109 |
-
$EM_Event->set_status(null, true);
|
110 |
-
if( $EM_Event->is_recurring() ){
|
111 |
-
$EM_Notices->add_error( '<strong>'.__('Your event details are incorrect and recurrences cannot be created, please correct these errors first:','dbem').'</strong>', true); //Always seems to redirect, so we make it static
|
112 |
-
}else{
|
113 |
-
$EM_Notices->add_error( '<strong>'.sprintf(__('Your %s details are incorrect and cannot be published, please correct these errors first:','dbem'),__('event','dbem')).'</strong>', true); //Always seems to redirect, so we make it static
|
114 |
-
}
|
115 |
-
$EM_Notices->add_error($EM_Event->get_errors(), true); //Always seems to redirect, so we make it static
|
116 |
-
apply_filters('em_event_save', false, $EM_Event);
|
117 |
-
}else{
|
118 |
-
//if this is just published, we need to email the user about the publication, or send to pending mode again for review
|
119 |
-
if( (!$EM_Event->is_recurring() && !current_user_can('publish_events')) || ($EM_Event->is_recurring() && !current_user_can('publish_recurring_events')) ){
|
120 |
-
if( $EM_Event->is_published() ){ $EM_Event->set_status(0, true); } //no publishing and editing... security threat
|
121 |
-
}
|
122 |
-
apply_filters('em_event_save', true, $EM_Event);
|
123 |
-
}
|
124 |
-
}else{
|
125 |
-
//we're updating only the quick-edit style information, which is only post info saved into the index
|
126 |
-
if( $EM_Event->validate() ){
|
127 |
-
do_action('em_event_save_pre', $EM_Event); //technically, the event is saved... but the meta isn't. wp doesn't give an pre-intervention action for this (or does it?)
|
128 |
-
//first things first, we must make sure we have an index, if not, reset it to a new one:
|
129 |
-
$event_truly_exists = $wpdb->get_var('SELECT event_id FROM '.EM_EVENTS_TABLE." WHERE event_id={$EM_Event->event_id}") == $EM_Event->event_id;
|
130 |
-
if(empty($EM_Event->event_id) || !$event_truly_exists){ $EM_Event->save_meta(); }
|
131 |
-
//we can save the status now
|
132 |
-
$EM_Event->get_previous_status(); //before we save anything
|
133 |
-
$event_status = $EM_Event->get_status(true);
|
134 |
-
//if this is just published, we need to email the user about the publication, or send to pending mode again for review
|
135 |
-
if( (!$EM_Event->is_recurring() && !current_user_can('publish_events')) || ($EM_Event->is_recurring() && !current_user_can('publish_recurring_events')) ){
|
136 |
-
if( $EM_Event->is_published() ){ $EM_Event->set_status(0, true); } //no publishing and editing... security threat
|
137 |
-
}
|
138 |
-
//now update the db
|
139 |
-
$where_array = array($EM_Event->event_name, $EM_Event->event_owner, $EM_Event->event_slug, $EM_Event->event_private, $EM_Event->event_id);
|
140 |
-
$sql = $wpdb->prepare("UPDATE ".EM_EVENTS_TABLE." SET event_name=%s, event_owner=%d, event_slug=%s, event_status={$event_status}, event_private=%d WHERE event_id=%d", $where_array);
|
141 |
-
$wpdb->query($sql);
|
142 |
-
if( $EM_Event->is_recurring() && $EM_Event->is_published()){
|
143 |
-
//recurrences are (re)saved only if event is published
|
144 |
-
$EM_Event->save_events();
|
145 |
-
}
|
146 |
-
apply_filters('em_event_save', true, $EM_Event);
|
147 |
-
}else{
|
148 |
-
do_action('em_event_save_pre', $EM_Event); //technically, the event is saved... but the meta isn't. wp doesn't give an pre-intervention action for this (or does it?)
|
149 |
-
//Event doesn't validate, so set status to null
|
150 |
-
$EM_Event->set_status(null, true);
|
151 |
-
apply_filters('em_event_save', false, $EM_Event);
|
152 |
-
}
|
153 |
-
}
|
154 |
-
self::maybe_publish_location($EM_Event);
|
155 |
-
}
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Publish the location if the event has just been approved and the location is pending. We assume an editor published the event and approves the location too.
|
160 |
-
* @param EM_Event $EM_Event
|
161 |
-
*/
|
162 |
-
public static function maybe_publish_location($EM_Event){
|
163 |
-
//do a dirty update for location too if it's not published
|
164 |
-
if( $EM_Event->is_published() && !empty($EM_Event->location_id) ){
|
165 |
-
$EM_Location = $EM_Event->get_location();
|
166 |
-
if( $EM_Location->location_status !== 1 ){
|
167 |
-
//let's also publish the location
|
168 |
-
$EM_Location->set_status(1, true);
|
169 |
-
}
|
170 |
-
}
|
171 |
-
}
|
172 |
-
|
173 |
-
public static function before_delete_post($post_id){
|
174 |
-
if(get_post_type($post_id) == EM_POST_TYPE_EVENT){
|
175 |
-
$EM_Event = em_get_event($post_id,'post_id');
|
176 |
-
do_action('em_event_delete_pre ',$EM_Event);
|
177 |
-
$EM_Event->delete_meta();
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
public static function trashed_post($post_id){
|
182 |
-
if(get_post_type($post_id) == EM_POST_TYPE_EVENT){
|
183 |
-
global $EM_Notices;
|
184 |
-
$EM_Event = em_get_event($post_id,'post_id');
|
185 |
-
$EM_Event->set_status(-1);
|
186 |
-
$EM_Notices->remove_all(); //no validation/notices needed
|
187 |
-
}
|
188 |
-
}
|
189 |
-
|
190 |
-
public static function untrash_post($post_id){
|
191 |
-
if(get_post_type($post_id) == EM_POST_TYPE_EVENT){
|
192 |
-
//set a constant so we know this event doesn't need 'saving'
|
193 |
-
if(!defined('UNTRASHING_'.$post_id)) define('UNTRASHING_'.$post_id, true);
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
public static function untrashed_post($post_id){
|
198 |
-
if(get_post_type($post_id) == EM_POST_TYPE_EVENT){
|
199 |
-
global $EM_Notices, $EM_Event;
|
200 |
-
$EM_Event = new EM_Event($post_id, 'post_id'); //get a refreshed $EM_Event because otherwise statuses don't get updated by WP
|
201 |
-
$EM_Event->set_status( $EM_Event->get_status() );
|
202 |
-
$EM_Notices->remove_all(); //no validation/notices needed
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
public static function meta_boxes(){
|
207 |
-
global $EM_Event;
|
208 |
-
if( !empty($EM_Event->event_owner_anonymous) ){
|
209 |
-
add_meta_box('em-event-anonymous', __('Anonymous Submitter Info','dbem'), array('EM_Event_Post_Admin','meta_box_anonymous'),EM_POST_TYPE_EVENT, 'side','high');
|
210 |
-
}
|
211 |
-
add_meta_box('em-event-when', __('When','dbem'), array('EM_Event_Post_Admin','meta_box_date'),EM_POST_TYPE_EVENT, 'side','high');
|
212 |
-
if(get_option('dbem_locations_enabled', true)){
|
213 |
-
add_meta_box('em-event-where', __('Where','dbem'), array('EM_Event_Post_Admin','meta_box_location'),EM_POST_TYPE_EVENT, 'normal','high');
|
214 |
-
}
|
215 |
-
if( defined('WP_DEBUG') && WP_DEBUG ){
|
216 |
-
add_meta_box('em-event-meta', 'Event Meta (debugging only)', array('EM_Event_Post_Admin','meta_box_metadump'),EM_POST_TYPE_EVENT, 'normal','high');
|
217 |
-
}
|
218 |
-
if(get_option('dbem_rsvp_enabled', true)){
|
219 |
-
add_meta_box('em-event-bookings', __('Bookings/Registration','dbem'), array('EM_Event_Post_Admin','meta_box_bookings'),EM_POST_TYPE_EVENT, 'normal','high');
|
220 |
-
if( !empty($EM_Event->event_id) && $EM_Event->event_rsvp ){
|
221 |
-
add_meta_box('em-event-bookings-stats', __('Bookings Stats','dbem'), array('EM_Event_Post_Admin','meta_box_bookings_stats'),EM_POST_TYPE_EVENT, 'side','core');
|
222 |
-
}
|
223 |
-
}
|
224 |
-
if( get_option('dbem_attributes_enabled', true) ){
|
225 |
-
add_meta_box('em-event-attributes', __('Attributes','dbem'), array('EM_Event_Post_Admin','meta_box_attributes'),EM_POST_TYPE_EVENT, 'normal','default');
|
226 |
-
}
|
227 |
-
if( EM_MS_GLOBAL && !is_main_site() && get_option('dbem_categories_enabled') ){
|
228 |
-
add_meta_box('em-event-categories', __('Site Categories','dbem'), array('EM_Event_Post_Admin','meta_box_ms_categories'),EM_POST_TYPE_EVENT, 'side','low');
|
229 |
-
}
|
230 |
-
}
|
231 |
-
|
232 |
-
public static function meta_box_metadump(){
|
233 |
-
global $post,$EM_Event;
|
234 |
-
echo "<pre>"; print_r($EM_Event); echo "</pre>";
|
235 |
-
}
|
236 |
-
|
237 |
-
public static function meta_box_anonymous(){
|
238 |
-
global $EM_Event;
|
239 |
-
?>
|
240 |
-
<div class='updated'><p><?php _e('This event was submitted by a guest. You will find their details in the <em>Anonymous Submitter Info</em> box','dbem')?></p></div>
|
241 |
-
<p><strong><?php _e('Name','dbem'); ?> :</strong> <?php echo $EM_Event->event_owner_name; ?></p>
|
242 |
-
<p><strong><?php _e('Name','dbem'); ?> :</strong> <?php echo $EM_Event->event_owner_email; ?></p>
|
243 |
-
<?php
|
244 |
-
}
|
245 |
-
|
246 |
-
public static function meta_box_date(){
|
247 |
-
//create meta box check of date nonce
|
248 |
-
?><input type="hidden" name="_emnonce" value="<?php echo wp_create_nonce('edit_event'); ?>" /><?php
|
249 |
-
em_locate_template('forms/event/when.php', true);
|
250 |
-
}
|
251 |
-
|
252 |
-
public static function meta_box_bookings_stats(){
|
253 |
-
em_locate_template('forms/event/booking-stats.php',true);
|
254 |
-
}
|
255 |
-
|
256 |
-
public static function meta_box_bookings(){
|
257 |
-
em_locate_template('forms/event/bookings.php', true);
|
258 |
-
add_action('admin_footer',array('EM_Event_Post_Admin','meta_box_bookings_overlay'));
|
259 |
-
}
|
260 |
-
|
261 |
-
public static function meta_box_bookings_overlay(){
|
262 |
-
em_locate_template('forms/tickets-form.php', true); //put here as it can't be in the add event form
|
263 |
-
}
|
264 |
-
|
265 |
-
public static function meta_box_attributes(){
|
266 |
-
em_locate_template('forms/event/attributes.php',true);
|
267 |
-
}
|
268 |
-
|
269 |
-
public static function meta_box_location(){
|
270 |
-
em_locate_template('forms/event/location.php',true);
|
271 |
-
}
|
272 |
-
|
273 |
-
public static function meta_box_ms_categories(){
|
274 |
-
global $EM_Event;
|
275 |
-
EM_Object::ms_global_switch();
|
276 |
-
$categories = EM_Categories::get(array('hide_empty'=>false));
|
277 |
-
?>
|
278 |
-
<?php if( count($categories) > 0 ): ?>
|
279 |
-
<p class="ms-global-categories">
|
280 |
-
<?php $selected = $EM_Event->get_categories()->get_ids(); ?>
|
281 |
-
<?php $walker = new EM_Walker_Category(); ?>
|
282 |
-
<?php $args_em = array( 'hide_empty' => 0, 'name' => 'event_categories[]', 'hierarchical' => true, 'id' => EM_TAXONOMY_CATEGORY, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $selected, 'walker'=> $walker); ?>
|
283 |
-
<?php echo walk_category_dropdown_tree($categories, 0, $args_em); ?>
|
284 |
-
</p>
|
285 |
-
<?php else: ?>
|
286 |
-
<p><?php sprintf(__('No categories available, <a href="%s">create one here first</a>','dbem'), get_bloginfo('wpurl').'/wp-admin/admin.php?page=events-manager-categories'); ?></p>
|
287 |
-
<?php endif; ?>
|
288 |
-
<!-- END Categories -->
|
289 |
-
<?php
|
290 |
-
EM_Object::ms_global_switch_back();
|
291 |
-
}
|
292 |
-
}
|
293 |
-
add_action('admin_init',array('EM_Event_Post_Admin','init'));
|
294 |
-
|
295 |
-
/*
|
296 |
-
* Recurring Events
|
297 |
-
*/
|
298 |
-
class EM_Event_Recurring_Post_Admin{
|
299 |
-
public static function init(){
|
300 |
-
global $pagenow;
|
301 |
-
if($pagenow == 'post.php' || $pagenow == 'post-new.php' ){ //only needed if editing post
|
302 |
-
add_action('admin_head', array('EM_Event_Recurring_Post_Admin','admin_head'));
|
303 |
-
//Meta Boxes
|
304 |
-
add_action('add_meta_boxes', array('EM_Event_Recurring_Post_Admin','meta_boxes'));
|
305 |
-
//Notices
|
306 |
-
add_action('admin_notices',array('EM_Event_Post_Admin','admin_notices')); //shared with posts
|
307 |
-
}
|
308 |
-
//Save/Edit actions
|
309 |
-
add_action('save_post',array('EM_Event_Recurring_Post_Admin','save_post'),10000,1); //late priority for checking non-EM meta data added later
|
310 |
-
add_action('before_delete_post',array('EM_Event_Recurring_Post_Admin','before_delete_post'),10,1);
|
311 |
-
add_action('trashed_post',array('EM_Event_Recurring_Post_Admin','trashed_post'),10,1);
|
312 |
-
add_action('untrash_post',array('EM_Event_Recurring_Post_Admin','untrash_post'),10,1);
|
313 |
-
add_action('untrashed_post',array('EM_Event_Recurring_Post_Admin','untrashed_post'),10,1);
|
314 |
-
//Notices
|
315 |
-
add_action('post_updated_messages',array('EM_Event_Post_Admin','admin_notices_filter'),1,1); //shared with posts
|
316 |
-
}
|
317 |
-
|
318 |
-
public static function admin_head(){
|
319 |
-
global $post, $EM_Event;
|
320 |
-
if( !empty($post) && $post->post_type == 'event-recurring' ){
|
321 |
-
$EM_Event = em_get_event($post->ID, 'post_id');
|
322 |
-
//quick hacks to make event admin table make more sense for events
|
323 |
-
?>
|
324 |
-
<script type="text/javascript">
|
325 |
-
jQuery(document).ready( function($){
|
326 |
-
if(!EM.recurrences_menu){
|
327 |
-
$('#menu-posts-'+EM.event_post_type+', #menu-posts-'+EM.event_post_type+' > a').addClass('wp-has-current-submenu');
|
328 |
-
}
|
329 |
-
});
|
330 |
-
</script>
|
331 |
-
<?php
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Beacuse in wp admin recurrences get saved early on during save_post, meta added by other plugins to the recurring event template don't get copied over to recurrences
|
337 |
-
* This re-saves meta late in save_post to correct this issue, in the future when recurrences refer to one post, this shouldn't be an issue
|
338 |
-
* @param int $post_id
|
339 |
-
*/
|
340 |
-
public static function save_post($post_id){
|
341 |
-
global $wpdb, $EM_Notices, $EM_SAVING_EVENT, $EM_EVENT_SAVE_POST;
|
342 |
-
if( !empty($EM_SAVING_EVENT) ) return; //never proceed with this if using EM_Event::save(); which only gets executed outside wp admin
|
343 |
-
$post_type = get_post_type($post_id);
|
344 |
-
$saving_status = !in_array(get_post_status($post_id), array('trash','auto-draft')) && !defined('DOING_AUTOSAVE');
|
345 |
-
if(!defined('UNTRASHING_'.$post_id) && $post_type == 'event-recurring' && $saving_status && !empty($EM_EVENT_SAVE_POST) ){
|
346 |
-
$EM_Event = em_get_event($post_id, 'post_id');
|
347 |
-
$EM_Event->post_type = $post_type;
|
348 |
-
//get the list post IDs for recurrences this recurrence
|
349 |
-
if( !$EM_Event->save_events() && $EM_Event->is_published() ){
|
350 |
-
$EM_Event->set_status(null, true);
|
351 |
-
$EM_Notices->add_error(__ ( 'Something went wrong with the recurrence update...', 'dbem' ). __ ( 'There was a problem saving the recurring events.', 'dbem' ));
|
352 |
-
}
|
353 |
-
}
|
354 |
-
$EM_EVENT_SAVE_POST = false; //last filter of save_post in EM for events
|
355 |
-
}
|
356 |
-
|
357 |
-
public static function before_delete_post($post_id){
|
358 |
-
if(get_post_type($post_id) == 'event-recurring'){
|
359 |
-
$EM_Event = em_get_event($post_id,'post_id');
|
360 |
-
do_action('em_event_delete_pre ',$EM_Event);
|
361 |
-
//now delete recurrences
|
362 |
-
//only delete other events if this isn't a draft-never-published event
|
363 |
-
if( !empty($EM_Event->event_id) ){
|
364 |
-
$events_array = EM_Events::get( array('recurrence'=>$EM_Event->event_id, 'scope'=>'all', 'status'=>'everything' ) );
|
365 |
-
foreach($events_array as $event){
|
366 |
-
/* @var $event EM_Event */
|
367 |
-
if($EM_Event->event_id == $event->recurrence_id && !empty($event->recurrence_id) ){ //double check the event is a recurrence of this event
|
368 |
-
wp_delete_post($event->post_id, true);
|
369 |
-
}
|
370 |
-
}
|
371 |
-
}
|
372 |
-
$EM_Event->post_type = EM_POST_TYPE_EVENT; //trick it into thinking it's one event.
|
373 |
-
$EM_Event->delete_meta();
|
374 |
-
}
|
375 |
-
}
|
376 |
-
|
377 |
-
public static function trashed_post($post_id){
|
378 |
-
if(get_post_type($post_id) == 'event-recurring'){
|
379 |
-
global $EM_Notices, $wpdb;
|
380 |
-
$EM_Event = em_get_event($post_id,'post_id');
|
381 |
-
$EM_Event->set_status(null);
|
382 |
-
//only trash other events if this isn't a draft-never-published event
|
383 |
-
if( !empty($EM_Event->event_id) ){
|
384 |
-
//now trash recurrences
|
385 |
-
$events_array = EM_Events::get( array('recurrence_id'=>$EM_Event->event_id, 'scope'=>'all', 'status'=>'everything' ) );
|
386 |
-
foreach($events_array as $event){
|
387 |
-
/* @var $event EM_Event */
|
388 |
-
if($EM_Event->event_id == $event->recurrence_id ){ //double check the event is a recurrence of this event
|
389 |
-
wp_trash_post($event->post_id);
|
390 |
-
}
|
391 |
-
}
|
392 |
-
}
|
393 |
-
$EM_Notices->remove_all(); //no validation/notices needed
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
public static function untrash_post($post_id){
|
398 |
-
if(get_post_type($post_id) == 'event-recurring'){
|
399 |
-
global $wpdb;
|
400 |
-
//set a constant so we know this event doesn't need 'saving'
|
401 |
-
if(!defined('UNTRASHING_'.$post_id)) define('UNTRASHING_'.$post_id, true);
|
402 |
-
$EM_Event = em_get_event($post_id,'post_id');
|
403 |
-
//only untrash other events if this isn't a draft-never-published event, because if so it never had other events to untrash
|
404 |
-
if( !empty($EM_Event->event_id) ){
|
405 |
-
$events_array = EM_Events::get( array('recurrence_id'=>$EM_Event->event_id, 'scope'=>'all', 'status'=>'everything' ) );
|
406 |
-
foreach($events_array as $event){
|
407 |
-
/* @var $event EM_Event */
|
408 |
-
if($EM_Event->event_id == $event->recurrence_id){
|
409 |
-
wp_untrash_post($event->post_id);
|
410 |
-
}
|
411 |
-
}
|
412 |
-
}
|
413 |
-
}
|
414 |
-
}
|
415 |
-
|
416 |
-
public static function untrashed_post($post_id){
|
417 |
-
if(get_post_type($post_id) == 'event-recurring'){
|
418 |
-
global $EM_Notices,$EM_Event;
|
419 |
-
$EM_Event->set_status(1);
|
420 |
-
$EM_Notices->remove_all(); //no validation/notices needed
|
421 |
-
}
|
422 |
-
}
|
423 |
-
|
424 |
-
public static function meta_boxes(){
|
425 |
-
add_meta_box('em-event-recurring', __('Recurrences','dbem'), array('EM_Event_Recurring_Post_Admin','meta_box_recurrence'),'event-recurring', 'normal','high');
|
426 |
-
//add_meta_box('em-event-meta', 'Event Meta (debugging only)', array('EM_Event_Post_Admin','meta_box_met
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|