Version Description
- Fixed small calendar discrepencies
- added event and location single shortcodes
- shortcodes now accept html within format attribute or within the shortcode tags [like]
this
[/like] - fixed pagination functionality (or lack thereof) in shortcodes
- improved user experience when navigating/editing events in admin area
- added #_CONTACTAVATAR placeholder - avatar for contact person
- ajax loading spinner graphic added to calendars
- internal wp_mail support added
- added "all events" link to events widget
- fixed date translations
- cleaned up the settings page documentation and added placeholder docs on help page.
- fixed "enable notification emails" option in settings
- added admin email option that would be send every event booking to admin
Download this release
Release Info
Developer | netweblogic |
Plugin | Events Manager |
Version | 3.0.9 |
Comparing to | |
See all releases |
Code changes from version 3.0.81 to 3.0.9
- admin/em-bookings.php +2 -3
- admin/em-categories.php +1 -1
- admin/em-docs.php +182 -0
- admin/em-event.php +73 -11
- admin/em-events.php +49 -118
- admin/em-help.php +13 -2
- admin/em-locations.php +4 -4
- admin/em-options.php +30 -22
- admin/em-people.php +1 -1
- classes/em-booking.php +13 -3
- classes/em-bookings.php +28 -11
- classes/em-calendar.php +73 -70
- classes/em-event.php +46 -16
- classes/em-events.php +11 -10
- classes/em-location.php +11 -8
- classes/em-locations.php +31 -6
- classes/em-mailer.php +23 -17
- classes/em-object.php +77 -50
- em-events.php +20 -16
- em-functions.php +22 -19
- em-install.php +24 -19
- em-shortcode.php +42 -3
- events-manager.php +12 -11
- includes/css/events_manager.css +5 -1
- includes/css/events_manager_admin.css +9 -1
- includes/css/images/loading.gif +0 -0
- includes/images/loading.gif +0 -0
- includes/js/em_admin.js +3 -3
- includes/js/em_calendar_ajax.js +5 -0
- readme.txt +10 -3
- widgets/em-events.php +29 -4
admin/em-bookings.php
CHANGED
@@ -28,10 +28,9 @@ function em_bookings_table() {
|
|
28 |
global $EM_Event;
|
29 |
?>
|
30 |
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
31 |
-
<input type='hidden' name='page' value='events-manager
|
32 |
-
<input type='hidden' name='action' value='edit_event'/>
|
33 |
<input type='hidden' name='event_id' value='<?php echo $EM_Event->id ?>'/>
|
34 |
-
<input type='hidden' name='
|
35 |
<div class='wrap'>
|
36 |
<h2>Bookings</h2>
|
37 |
<table id='dbem-bookings-table' class='widefat post fixed'>
|
28 |
global $EM_Event;
|
29 |
?>
|
30 |
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
31 |
+
<input type='hidden' name='page' value='events-manager-bookings'/>
|
|
|
32 |
<input type='hidden' name='event_id' value='<?php echo $EM_Event->id ?>'/>
|
33 |
+
<input type='hidden' name='action' value='delete'/>
|
34 |
<div class='wrap'>
|
35 |
<h2>Bookings</h2>
|
36 |
<table id='dbem-bookings-table' class='widefat post fixed'>
|
admin/em-categories.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
function
|
3 |
global $wpdb;
|
4 |
|
5 |
if(isset($_GET['action']) && $_GET['action'] == "edit") {
|
1 |
<?php
|
2 |
+
function em_admin_categories_page() {
|
3 |
global $wpdb;
|
4 |
|
5 |
if(isset($_GET['action']) && $_GET['action'] == "edit") {
|
admin/em-docs.php
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function em_docs_init(){
|
4 |
+
if( class_exists('EM_Event') ){
|
5 |
+
add_action('wp_head', 'emd_head');
|
6 |
+
//Generate the docs
|
7 |
+
global $EM_Documentation;
|
8 |
+
$EM_Event = new EM_Event();
|
9 |
+
$event_fields = $EM_Event->get_fields(true);
|
10 |
+
$EM_Location = new EM_Location();
|
11 |
+
$location_fields = $EM_Location->get_fields(true);
|
12 |
+
$EM_Documentation = array(
|
13 |
+
'arguments' => array(
|
14 |
+
'events' => array(
|
15 |
+
'limit' => array( 'default'=>'See the events lists limit option on the settings page.' ),
|
16 |
+
'orderby' => array( 'desc'=>'Choose what fields to order your results by. You can supply a single field or multiple comma-seperated fields (e.g. "start_date,name").', 'default'=>'See the event lists ordering option on the settings page.', 'args'=>'name, start_date, start_time, end_date, end_time'),
|
17 |
+
'order' => array( 'default'=>'See the event lists ordering option on the settings page.' )
|
18 |
+
),
|
19 |
+
'locations' => array(
|
20 |
+
'eventful' => array( 'desc'=>'If set to 1 will only show locations that have at least one event occurring during the scope.', 'default' => 0),
|
21 |
+
'eventless' => array( 'desc'=>'If set to 1 will only show locations that have no events occurring during the scope.', 'default' => 0),
|
22 |
+
'orderby' => array('desc'=>'Choose what fields to order your results by. You can supply a single field or multiple comma-seperated fields (e.g. "start_date,name").', 'default'=>'name', 'args' => 'name, address, town'),
|
23 |
+
'scope' => array( 'default' => 'all')
|
24 |
+
),
|
25 |
+
'calendar' => array(
|
26 |
+
'full' => array( 'desc'=>'If set to 1 it will display a full calendar that shows event names.', 'default' => 0),
|
27 |
+
'long_events' => array( 'desc'=>'If set to 1, will show events that last longer than a day.', 'default' => 0),
|
28 |
+
'order' => array( 'desc'=>'Same as for events.' ),
|
29 |
+
'scope' => array( 'default' => 'future')
|
30 |
+
),
|
31 |
+
//The object is commonly shared by all, so entries above overwrite entries here
|
32 |
+
'general' => array(
|
33 |
+
'limit' => array( 'desc'=>'Limits the amount of values returned to this number.', 'default'=>'0 (no limit)'),
|
34 |
+
'scope' => array( 'desc'=>'Choose the time frame of events to show. Accepted values are "future", "past" or "all" events. 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'),
|
35 |
+
'order' => array( 'desc'=>'Indicates the order of the events. Choose between ASC (ascending) and DESC (descending).', 'default'=>'ASC'),
|
36 |
+
'orderby' => array( 'desc'=>'Choose what fields to order your results by. You can supply a single field or multiple comma-seperated fields (e.g. "start_date,name"). See specific instances (e.g. events, locations, etc.) for field names.', 'default'=>0),
|
37 |
+
'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.', 'default'=>'The relevant default format will be taken from the settings page.'),
|
38 |
+
'event' => array( 'desc'=>'Supply a single id or comma-seperated ids (e.g. "1,2,3") to limit the search to events with these id(s).', 'default'=>0),
|
39 |
+
'category' => array( 'desc'=>'Supply a single id or comma-seperated ids (e.g. "1,2,3") to limit the search to events in these categories.', 'default'=>0),
|
40 |
+
'location' => array( 'desc'=>'Supply a single id or comma-seperated ids to limit the search to these locations (or events in these locations).', 'default'=>0),
|
41 |
+
'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),
|
42 |
+
'recurrence' => array( 'desc'=>'If set to 1, will show only events that are recurring (i.e. events that are repeated over different dates).', 'default'=>0),
|
43 |
+
'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),
|
44 |
+
'month' => array( 'desc'=>'If set to a month (1 to 12) only events that start or end during this month/year will be retured. Must be used in conjunction with year', 'default'=>''),
|
45 |
+
'year' => array( 'desc'=>'If set to a year (e.g. 2010) only events that start or end during this year/month will be returned. Must be used in conjunction with year', 'default'=>''),
|
46 |
+
'array' => array( 'desc'=>'If you supply this as an argument, the returned data will be in an array, no objects (only useful wen using PHP, not shortcodes)', 'default'=>0),
|
47 |
+
'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)
|
48 |
+
)
|
49 |
+
),
|
50 |
+
'placeholders' => array(
|
51 |
+
'events' => array(
|
52 |
+
'Event Details' => array(
|
53 |
+
'placeholders' => array(
|
54 |
+
'#_NAME' => array( 'desc' => 'Displays the name of the event.' ),
|
55 |
+
'#_NOTES' => array( 'desc' => 'Shows the description of the event.' ),
|
56 |
+
'#_EXCERPT' => array( 'desc' => '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 (currently, no read more link is added).' ),
|
57 |
+
'#_CATEGORY' => array( 'desc' => 'Shows the category name of the event.' )
|
58 |
+
)
|
59 |
+
),
|
60 |
+
'Time' => array(
|
61 |
+
'desc' => '',
|
62 |
+
'placeholders' => array(
|
63 |
+
'#_24HSTARTTIME' => array( 'desc' => 'Displays the start time in a 24 hours format (e.g. 16:30).' ),
|
64 |
+
'#_24HENDTIME' => array( 'desc' => 'Displays the end time in a 24 hours format (e.g. 18:30).' ),
|
65 |
+
'#_12HSTARTTIME' => array( 'desc' => 'Displays the start time in a 12 hours format (e.g. 4:30 PM).' ),
|
66 |
+
'#_12HENDTIME' => array( 'desc' => 'Displays the end time in a 12 hours format (e.g. 6:30 PM).' )
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'Custom Date/Time Formatting' => array(
|
70 |
+
'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.',
|
71 |
+
'placeholders' => array(
|
72 |
+
'# 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).' ),
|
73 |
+
'#{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 on day, e.g. <code>#j #M #Y #@_{ \u\n\t\i\l j M Y}</code>.' ),
|
74 |
+
)
|
75 |
+
),
|
76 |
+
'Links' => array(
|
77 |
+
'placeholders' => array(
|
78 |
+
'#_EVENTURL' => array( 'desc' => 'Simply prints the event URL. You can use this placeholder to build your own customised links.' ),
|
79 |
+
'#_EVENTLINK' => array( 'desc' => 'Displays the event name with a link to the event page.' ),
|
80 |
+
'#_EDITEVENTLINK' => array( 'desc' => 'Inserts a link to the edit event page, only if a user is logged in and is allowed to edit the event.' )
|
81 |
+
)
|
82 |
+
),
|
83 |
+
'Custom Attributes' => array(
|
84 |
+
'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/categories-and-attributes/">our online documentation</a> for more info on attributes.',
|
85 |
+
'placeholders' => array(
|
86 |
+
'#_ATT{key}{alternative text}' => array('desc'=>'This key will appear as an option when adding attributes to your event. The second braces are optional and will appear if the attribute is not defined or left blank for that event.')
|
87 |
+
)
|
88 |
+
),
|
89 |
+
'Bookings/RSVP' => array(
|
90 |
+
'desc' => 'These placeholders will only show if RSVP is enabled for the given event and in the events manager settings page. Spaces placeholders will default to 0',
|
91 |
+
'placeholders' => array(
|
92 |
+
'#_ADDBOOKINGFORM' => array( 'desc' => 'Adds a form which allows the visitors to register for an event.' ),
|
93 |
+
'#_REMOVEBOOKINGFORM' => array( 'desc' => 'Adds a form which allows the visitors to remove their booking.' ),
|
94 |
+
'#_BOOKINGFORM' => array( 'desc' => 'Adds a both booking forms (add and remove).' ),
|
95 |
+
'#_AVAILABLESPACES' => array( 'desc' => 'Shows available spaces for the event.' ),
|
96 |
+
'#_BOOKEDSPACES' => array( 'desc' => 'Shows the amount of currently booked seats for the event.' ),
|
97 |
+
'#_SPACES' => array( 'desc' => 'Shows the total spaces for the event.' )
|
98 |
+
)
|
99 |
+
),
|
100 |
+
'Contact Details' => array(
|
101 |
+
'desc' => 'The values here are taken from the chosen contact for the specific event, or the default contact in the settings page.',
|
102 |
+
'placeholders' => array(
|
103 |
+
'#_CONTACTNAME' => array( 'desc' => 'Name of the contact person for this event (as shown in the dropdown when adding an event).' ),
|
104 |
+
'#_CONTACTEMAIL' => array( 'desc' => 'E-mail of the contact person for this event.' ),
|
105 |
+
'#_CONTACTPHONE' => array( 'desc' => 'Phone number of the contact person for this event. Can be set in the user profile page.' ),
|
106 |
+
'#_CONTACTAVATAR' => array( 'desc' => 'Contact person\'s avatar.' )
|
107 |
+
)
|
108 |
+
),
|
109 |
+
),
|
110 |
+
'locations' => array(
|
111 |
+
'Location Details' => array(
|
112 |
+
'desc' => '',
|
113 |
+
'placeholders' => array(
|
114 |
+
'#_LOCATIONNAME' => array( 'desc' => 'Displays the location name.' ),
|
115 |
+
'#_LOCATIONADDRESS' => array( 'desc' => 'Displays the address.' ),
|
116 |
+
'#_LOCATIONTOWN' => array( 'desc' => 'Displays the town.' ),
|
117 |
+
'#_LOCATIONMAP' => array( 'desc' => 'Displays a google map showing where the event is located (Will not show if maps are disabled in the settings page)' ),
|
118 |
+
'#_LOCATIONNOTES' => array( 'desc' => 'Shows the location description.' ),
|
119 |
+
'#_LOCATIONEXCERPT' => array( 'desc' => '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 (currently, no read more link is added).' ),
|
120 |
+
'#_LOCATIONIMAGE' => array( 'desc' => 'Shows the location image.' )
|
121 |
+
)
|
122 |
+
),
|
123 |
+
'Links' => array(
|
124 |
+
'placeholders' => array(
|
125 |
+
'#_LOCATIONURL' => array( 'desc' => 'Simply prints the location URL. You can use this placeholder to build your own customised links.' ),
|
126 |
+
'#_LOCATIONLINK' => array( 'desc' => 'Displays the location name with a link to the location page.' )
|
127 |
+
)
|
128 |
+
),
|
129 |
+
'Related Events' => array(
|
130 |
+
'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.',
|
131 |
+
'placeholders' => array(
|
132 |
+
'#_LOCATIONPASTEVENTS' => array( 'desc' => 'Will show a list of all past events at this location.' ),
|
133 |
+
'#_LOCATIONNEXTEVENTS' => array( 'desc' => 'Will show a list of all future events at this location.' ),
|
134 |
+
'#_LOCATIONALLEVENTS' => array( 'desc' => 'Will show a list of all events at this location.' )
|
135 |
+
)
|
136 |
+
),
|
137 |
+
),
|
138 |
+
'bookings' => array(
|
139 |
+
'Booking Person Information' => array(
|
140 |
+
'desc' => 'When a specific booking is displayed (on screen and on email), you can use these placeholders to show specific information about the booking. For contact details of the contact of this event, see the events placeholders.',
|
141 |
+
'placeholders' => array(
|
142 |
+
'#_BOOKINGNAME' => array( 'desc' => 'Name of person who made the booking.' ),
|
143 |
+
'#_BOOKINGEMAIL' => array( 'desc' => 'Email of person who made the booking.' ),
|
144 |
+
'#_BOOKINGPHONE' => array( 'desc' => 'Phone number of person who made the booking.' ),
|
145 |
+
'#_BOOKINGSPACES' => array( 'desc' => 'Number of spaces the person has booked.' ),
|
146 |
+
'#_BOOKINGCOMMENT' => array( 'desc' => 'Any specific comments made by the person who made the booking.' )
|
147 |
+
)
|
148 |
+
)
|
149 |
+
),
|
150 |
+
)
|
151 |
+
);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
add_action('init', 'em_docs_init');
|
155 |
+
|
156 |
+
function em_docs_placeholders($atts){
|
157 |
+
ob_start();
|
158 |
+
?>
|
159 |
+
<div class="em-docs">
|
160 |
+
<?php
|
161 |
+
global $EM_Documentation;
|
162 |
+
$type = $atts['type'];
|
163 |
+
$data = $EM_Documentation['placeholders'][$type];
|
164 |
+
foreach($data as $sectionTitle => $details) : ?>
|
165 |
+
<div>
|
166 |
+
<h3><?php echo $sectionTitle; ?></h3>
|
167 |
+
<?php if($details['desc'] != ''): ?>
|
168 |
+
<p><?php echo $details['desc']; ?></p>
|
169 |
+
<?php endif; ?>
|
170 |
+
<dl>
|
171 |
+
<?php foreach($details['placeholders'] as $placeholder => $desc ): ?>
|
172 |
+
<dt><b><?php echo $placeholder; ?></b></dt>
|
173 |
+
<dd><?php echo $desc['desc']; ?></dd>
|
174 |
+
<?php endforeach; ?>
|
175 |
+
</dl>
|
176 |
+
</div>
|
177 |
+
<?php endforeach; ?>
|
178 |
+
</div>
|
179 |
+
<?php
|
180 |
+
return ob_get_clean();
|
181 |
+
}
|
182 |
+
?>
|
admin/em-event.php
CHANGED
@@ -1,23 +1,67 @@
|
|
1 |
<?php
|
2 |
-
function
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
}
|
|
|
8 |
|
9 |
/**
|
10 |
* Generates Event Admin page, for adding and updating a single (or recurring) event.
|
11 |
* @param $title
|
12 |
* @return null
|
13 |
*/
|
14 |
-
function
|
15 |
global $EM_Event;
|
16 |
-
global $localised_date_formats;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
$use_select_for_locations = get_option('dbem_use_select_for_locations');
|
18 |
// change prefix according to event/recurrence
|
19 |
$pref = "event_";
|
20 |
-
$form_destination = "edit.php?page=events-manager/events-manager.php&action=update_event&event_id=" . $EM_Event->id;
|
21 |
|
22 |
$locale_code = substr ( get_locale (), 0, 2 );
|
23 |
$localised_date_format = $localised_date_formats [$locale_code];
|
@@ -30,7 +74,22 @@ function em_event_form( $title ) {
|
|
30 |
|
31 |
$days_names = array (1 => __ ( 'Mon' ), 2 => __ ( 'Tue' ), 3 => __ ( 'Wed' ), 4 => __ ( 'Thu' ), 5 => __ ( 'Fri' ), 6 => __ ( 'Sat' ), 0 => __ ( 'Sun' ) );
|
32 |
?>
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
<div class="wrap">
|
35 |
<div id="icon-events" class="icon32"><br /></div>
|
36 |
<h2><?php echo $title; ?></h2>
|
@@ -126,7 +185,7 @@ function em_event_form( $title ) {
|
|
126 |
<p>
|
127 |
<?php echo $EM_Event->get_recurrence_description(); ?>
|
128 |
<br />
|
129 |
-
<a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager
|
130 |
<?php _e ( 'Reschedule', 'dbem' ); ?>
|
131 |
</a>
|
132 |
<input type="hidden" name="recurrence_id" value="<?php echo $EM_Event->recurrence_id; ?>" />
|
@@ -227,7 +286,7 @@ function em_event_form( $title ) {
|
|
227 |
|
228 |
<div id='major-publishing-actions'>
|
229 |
<div id='publishing-action'>
|
230 |
-
<a id='printable' target='_blank' href='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=people&action=printable&event_id=".$EM_Event->id ?>'><?php _e('Printable view','dbem')?></a>
|
231 |
<br class='clear'/>
|
232 |
</div>
|
233 |
<br class='clear'/>
|
@@ -534,6 +593,9 @@ function em_event_form( $title ) {
|
|
534 |
<p class="submit">
|
535 |
<input type="submit" name="events_update" value="<?php _e ( 'Submit Event', 'dbem' ); ?> »" />
|
536 |
</p>
|
|
|
|
|
|
|
537 |
</div>
|
538 |
</div>
|
539 |
</div>
|
1 |
<?php
|
2 |
+
function em_admin_event_actions(){
|
3 |
+
if( current_user_can(EM_MIN_CAPABILITY) && !empty($_GET['page']) && $_GET['page'] == 'events-manager-event' && !empty($_REQUEST ['action']) ){
|
4 |
+
global $wpdb;
|
5 |
+
global $EM_Event;
|
6 |
+
|
7 |
+
//if dealing with new event, we still want an event object
|
8 |
+
if( !is_object($EM_Event) ){
|
9 |
+
$EM_Event = new EM_Event();
|
10 |
+
}
|
11 |
+
|
12 |
+
// UPDATE or CREATE action
|
13 |
+
if ($_REQUEST['action'] == 'save') {
|
14 |
+
$validation = $EM_Event->get_post();
|
15 |
+
if ( $validation ) { //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
|
16 |
+
//Save
|
17 |
+
if( $EM_Event->save() ) {
|
18 |
+
$page = !empty($_REQUEST['p']) ? $_REQUEST['p']:'';
|
19 |
+
$scope = !empty($_REQUEST['scope']) ? $_REQUEST['scope']:'';
|
20 |
+
wp_redirect( get_bloginfo('wpurl').'/wp-admin/admin.php?page=events-manager&p='.$page.'&scope='.$scope.'&message='.urlencode($EM_Event->feedback_message));
|
21 |
+
}
|
22 |
+
}//errors added automatically to event global object
|
23 |
+
}
|
24 |
+
|
25 |
+
//Copy the event
|
26 |
+
if ($_REQUEST['action'] == 'duplicate') {
|
27 |
+
global $EZSQL_ERROR;
|
28 |
+
$EM_Event = $EM_Event->duplicate();
|
29 |
+
if( $EM_Event === false ){
|
30 |
+
$redirect_url = em_add_get_params($_SERVER['HTTP_REFERER'], array('error' => __('There was an error duplicating the event. Try again maybe?', 'dbem'), 'message'=>''), false);
|
31 |
+
wp_redirect($redirect_url);
|
32 |
+
}else{
|
33 |
+
$page = !empty($_REQUEST['p']) ? $_REQUEST['p']:'';
|
34 |
+
$scope = !empty($_REQUEST['scope']) ? $_REQUEST['scope']:'';
|
35 |
+
wp_redirect( get_bloginfo('wpurl').'/wp-admin/admin.php?page=events-manager-event&event_id='.$EM_Event->id.'&p='.$page.'&scope='.$scope.'&message='.urlencode($EM_Event->feedback_message));
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
}
|
40 |
+
add_action('admin_init', 'em_admin_event_actions');
|
41 |
|
42 |
/**
|
43 |
* Generates Event Admin page, for adding and updating a single (or recurring) event.
|
44 |
* @param $title
|
45 |
* @return null
|
46 |
*/
|
47 |
+
function em_admin_event_page() {
|
48 |
global $EM_Event;
|
49 |
+
global $localised_date_formats;
|
50 |
+
|
51 |
+
if( is_object($EM_Event) && $EM_Event->id > 0 ){
|
52 |
+
if($EM_Event->is_recurring()){
|
53 |
+
$title = __( "Reschedule", 'dbem' )." '{$EM_Event->name}'";
|
54 |
+
}else{
|
55 |
+
$title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
|
56 |
+
}
|
57 |
+
} else {
|
58 |
+
$EM_Event = new EM_Event();
|
59 |
+
$title = __ ( "Insert New Event", 'dbem' );
|
60 |
+
}
|
61 |
+
|
62 |
$use_select_for_locations = get_option('dbem_use_select_for_locations');
|
63 |
// change prefix according to event/recurrence
|
64 |
$pref = "event_";
|
|
|
65 |
|
66 |
$locale_code = substr ( get_locale (), 0, 2 );
|
67 |
$localised_date_format = $localised_date_formats [$locale_code];
|
74 |
|
75 |
$days_names = array (1 => __ ( 'Mon' ), 2 => __ ( 'Tue' ), 3 => __ ( 'Wed' ), 4 => __ ( 'Thu' ), 5 => __ ( 'Fri' ), 6 => __ ( 'Sat' ), 0 => __ ( 'Sun' ) );
|
76 |
?>
|
77 |
+
<?php if ( count($EM_Event->errors) > 0 || !empty($_GET['error']) ) : ?>
|
78 |
+
<div id='message' class='error '>
|
79 |
+
<p>
|
80 |
+
<?php if( count($EM_Event->errors) ){ ?>
|
81 |
+
<strong><?php echo __( "Ach, there's a problem here:", "dbem" ) ?></strong><br /><br />
|
82 |
+
<?php echo implode('<br />', $EM_Event->errors); ?>
|
83 |
+
<?php } else { echo $_GET['error']; } ?>
|
84 |
+
</p>
|
85 |
+
</div>
|
86 |
+
<?php endif; ?>
|
87 |
+
<?php if ( !empty($EM_Event->feedback_message) || !empty($_GET['message']) ) : ?>
|
88 |
+
<div id='message' class='updated fade'>
|
89 |
+
<p><?php echo !empty($EM_Event->feedback_message) ? $EM_Event->feedback_message : $_GET['message']; ?></p>
|
90 |
+
</div>
|
91 |
+
<?php endif; ?>
|
92 |
+
<form id="eventForm" method="post" action="">
|
93 |
<div class="wrap">
|
94 |
<div id="icon-events" class="icon32"><br /></div>
|
95 |
<h2><?php echo $title; ?></h2>
|
185 |
<p>
|
186 |
<?php echo $EM_Event->get_recurrence_description(); ?>
|
187 |
<br />
|
188 |
+
<a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager&action=edit_event&event_id=<?php echo $EM_Event->recurrence_id; ?>">
|
189 |
<?php _e ( 'Reschedule', 'dbem' ); ?>
|
190 |
</a>
|
191 |
<input type="hidden" name="recurrence_id" value="<?php echo $EM_Event->recurrence_id; ?>" />
|
286 |
|
287 |
<div id='major-publishing-actions'>
|
288 |
<div id='publishing-action'>
|
289 |
+
<a id='printable' target='_blank' href='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=events-manager-people&action=printable&event_id=".$EM_Event->id ?>'><?php _e('Printable view','dbem')?></a>
|
290 |
<br class='clear'/>
|
291 |
</div>
|
292 |
<br class='clear'/>
|
593 |
<p class="submit">
|
594 |
<input type="submit" name="events_update" value="<?php _e ( 'Submit Event', 'dbem' ); ?> »" />
|
595 |
</p>
|
596 |
+
<input type="hidden" name="p" value="<?php echo ( !empty($_REQUEST['p']) ) ? $_REQUEST['p']:''; ?>" /><a>
|
597 |
+
<input type="hidden" name="scope" value="<?php echo ( !empty($_REQUEST['scope']) ) ? $_REQUEST['scope']:'' ?>" /></a>
|
598 |
+
<input type="hidden" name="action" value="save" />
|
599 |
</div>
|
600 |
</div>
|
601 |
</div>
|
admin/em-events.php
CHANGED
@@ -4,112 +4,12 @@
|
|
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
|
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 |
$action = ( !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
12 |
-
$
|
13 |
-
$event_ID = ( !empty($_GET ['event_id']) ) ? $_GET ['event_id']:'';
|
14 |
-
$recurrence_ID = ( !empty($_GET ['recurrence_id']) ) ? $_GET ['recurrence_id']:'';
|
15 |
-
$scope = ( !empty($_GET ['scope']) ) ? $_GET['scope']:'future';
|
16 |
-
$order = ( !empty($_GET ['order']) ) ? $_GET ['order']:''; //FIXME order not used consistently in admin area
|
17 |
-
$selectedEvents = ( !empty($_GET ['events']) ) ? $_GET ['events']:'';
|
18 |
-
|
19 |
-
if ($order == ""){
|
20 |
-
$order = "ASC";
|
21 |
-
}
|
22 |
-
$event_table_name = $wpdb->prefix . EM_EVENTS_TABLE;
|
23 |
-
|
24 |
-
// DELETE action
|
25 |
-
if ( $action == 'deleteEvents' && EM_Object::array_is_numeric($selectedEvents) ) {
|
26 |
-
EM_Events::delete( $selectedEvents );
|
27 |
-
em_events_table ( EM_Events::get( array('scope'=>$scope) ), "Future events" );
|
28 |
-
}
|
29 |
-
// UPDATE or CREATE action
|
30 |
-
if ($action == 'update_event') {
|
31 |
-
|
32 |
-
if( !is_object($EM_Event) ){
|
33 |
-
$EM_Event = new EM_Event();
|
34 |
-
}
|
35 |
-
$validation = $EM_Event->get_post();
|
36 |
-
$title = ($EM_Event->is_recurring()) ? __( "Reschedule", 'dbem' )." '{$EM_Event->name}'" : "Edit event {$EM_Event->name}" ;
|
37 |
-
if ( $validation ) { //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
|
38 |
-
//Save
|
39 |
-
if( $EM_Event->save() ) {
|
40 |
-
?>
|
41 |
-
<div id='message' class='updated fade'>
|
42 |
-
<p><?php echo $EM_Event->feedback_message ?></p>
|
43 |
-
</div>
|
44 |
-
<?php
|
45 |
-
em_events_table ( EM_Events::get( array('limit'=>0,'scope'=>$scope) ), "Future events" );
|
46 |
-
}else{
|
47 |
-
// saving unsuccessful
|
48 |
-
?>
|
49 |
-
<div id='message' class='error '>
|
50 |
-
<p>
|
51 |
-
<?php echo "<strong>" . __( "Ach, there's a problem here:", "dbem" ) . "</strong><br /><br />" .implode('<br />', $EM_Event->errors); ?>
|
52 |
-
</p>
|
53 |
-
</div>
|
54 |
-
<?php
|
55 |
-
em_event_form ( $title );
|
56 |
-
}
|
57 |
-
} else {
|
58 |
-
// validation unsuccessful
|
59 |
-
?>
|
60 |
-
<div id='message' class='error '>
|
61 |
-
<p><?php echo "<strong>" . __( "Ach, there's a problem here:", "dbem" ) . "</strong><br /><br />" . implode('<br />', $EM_Event->errors); ?></p>
|
62 |
-
</div>
|
63 |
-
<?php
|
64 |
-
em_event_form ( $title );
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
//Add or Edit Events
|
69 |
-
if ($action == 'edit_event') {
|
70 |
-
if( !is_object($EM_Event) ){
|
71 |
-
$EM_Event = new EM_Event();
|
72 |
-
$title = __ ( "Insert New Event", 'dbem' );
|
73 |
-
} else {
|
74 |
-
$title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
|
75 |
-
}
|
76 |
-
//Generate Event Form
|
77 |
-
em_event_form ( $title );
|
78 |
-
}
|
79 |
-
|
80 |
-
//Copy the event
|
81 |
-
if ($action == 'duplicate_event') {
|
82 |
-
global $EZSQL_ERROR;
|
83 |
-
if( $EM_Event->duplicate() ){
|
84 |
-
//Now we edit the duplicated item
|
85 |
-
$title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
|
86 |
-
echo "<div id='message' class='updated below-h2'>You are now editing the duplicated event.</div>";
|
87 |
-
em_event_form ( $title );
|
88 |
-
}else{
|
89 |
-
echo "<div class='error'><p>There was an error duplicating the event. Try again maybe?</div>";
|
90 |
-
em_events_table ( EM_Events::get(array('limit'=>0,'scope'=>$scope)), $title );
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
if ($action == "-1" || $action == "") {
|
95 |
-
// No action, only showing the events list
|
96 |
-
switch ($scope) {
|
97 |
-
case "past" :
|
98 |
-
$title = __ ( 'Past Events', 'dbem' );
|
99 |
-
break;
|
100 |
-
case "all" :
|
101 |
-
$title = __ ( 'All Events', 'dbem' );
|
102 |
-
break;
|
103 |
-
default :
|
104 |
-
$title = __ ( 'Future Events', 'dbem' );
|
105 |
-
$scope = "future";
|
106 |
-
}
|
107 |
-
$events = EM_Events::get( array('scope'=>$scope, 'limit'=>0, 'order'=>$order ) );
|
108 |
-
em_events_table ( $events, $title );
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
function em_events_table($events, $title) {
|
113 |
$limit = ( !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
114 |
$page = ( !empty($_GET['p']) ) ? $_GET['p']:1;
|
115 |
$offset = ( $page > 1 ) ? ($page-1)*$limit : 0;
|
@@ -119,6 +19,26 @@ function em_events_table($events, $title) {
|
|
119 |
'future' => __ ( 'Future events', 'dbem' )
|
120 |
);
|
121 |
$scope = ( !empty($_GET ['scope']) && array_key_exists($_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
$events_count = count ( $events );
|
123 |
|
124 |
$use_events_end = get_option ( 'dbem_use_event_end' );
|
@@ -126,20 +46,31 @@ function em_events_table($events, $title) {
|
|
126 |
<div class="wrap">
|
127 |
<div id="icon-events" class="icon32"><br />
|
128 |
</div>
|
129 |
-
<h2
|
|
|
|
|
|
|
130 |
<?php
|
131 |
em_hello_to_new_user ();
|
132 |
|
133 |
$link = array ();
|
134 |
-
$link ['past'] = "<a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/
|
135 |
-
$link ['all'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/
|
136 |
-
$link ['future'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/
|
137 |
?>
|
138 |
-
|
139 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
<ul class="subsubsub">
|
141 |
-
<li><a href='
|
142 |
-
class="count">(<?php echo (count ( $events )); ?>)</span></a></li>
|
143 |
</ul>
|
144 |
|
145 |
<div class="tablenav">
|
@@ -195,15 +126,15 @@ function em_events_table($events, $title) {
|
|
195 |
</thead>
|
196 |
<tbody>
|
197 |
<?php
|
198 |
-
$i = 1;
|
199 |
$rowno = 0;
|
|
|
200 |
foreach ( $events as $event ) {
|
201 |
-
if( $
|
202 |
$rowno++;
|
203 |
$class = ($rowno % 2) ? ' class="alternate"' : '';
|
204 |
// FIXME set to american
|
205 |
-
$localised_start_date =
|
206 |
-
$localised_end_date =
|
207 |
$style = "";
|
208 |
$today = date ( "Y-m-d" );
|
209 |
$location_summary = "<b>" . $event->location->name . "</b><br/>" . $event->location->address . " - " . $event->location->town;
|
@@ -220,14 +151,14 @@ function em_events_table($events, $title) {
|
|
220 |
</td>
|
221 |
<td>
|
222 |
<strong>
|
223 |
-
<a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/
|
224 |
</strong>
|
225 |
<?php if($category) : ?>
|
226 |
<br/><span title='<?php _e( 'Category', 'dbem' ).": ".$category['category_name'] ?>'><?php $category['category_name'] ?></span>
|
227 |
<?php endif; ?>
|
228 |
</td>
|
229 |
<td>
|
230 |
-
<a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/
|
231 |
<strong>+</strong>
|
232 |
</a>
|
233 |
</td>
|
@@ -250,7 +181,7 @@ function em_events_table($events, $title) {
|
|
250 |
?>
|
251 |
<strong>
|
252 |
<?php echo $event->get_recurrence_description(); ?> <br />
|
253 |
-
<a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/
|
254 |
</strong>
|
255 |
<?php
|
256 |
}
|
@@ -259,7 +190,7 @@ function em_events_table($events, $title) {
|
|
259 |
</tr>
|
260 |
<?php
|
261 |
}
|
262 |
-
$
|
263 |
}
|
264 |
?>
|
265 |
</tbody>
|
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_admin_events_page() {
|
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 |
$action = ( !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
12 |
+
$order = ( !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
$limit = ( !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
14 |
$page = ( !empty($_GET['p']) ) ? $_GET['p']:1;
|
15 |
$offset = ( $page > 1 ) ? ($page-1)*$limit : 0;
|
19 |
'future' => __ ( 'Future events', 'dbem' )
|
20 |
);
|
21 |
$scope = ( !empty($_GET ['scope']) && array_key_exists($_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
|
22 |
+
$selectedEvents = ( !empty($_GET ['events']) ) ? $_GET ['events']:'';
|
23 |
+
|
24 |
+
// DELETE action
|
25 |
+
if ( $action == 'deleteEvents' && EM_Object::array_is_numeric($selectedEvents) ) {
|
26 |
+
EM_Events::delete( $selectedEvents );
|
27 |
+
}
|
28 |
+
|
29 |
+
// No action, only showing the events list
|
30 |
+
switch ($scope) {
|
31 |
+
case "past" :
|
32 |
+
$title = __ ( 'Past Events', 'dbem' );
|
33 |
+
break;
|
34 |
+
case "all" :
|
35 |
+
$title = __ ( 'All Events', 'dbem' );
|
36 |
+
break;
|
37 |
+
default :
|
38 |
+
$title = __ ( 'Future Events', 'dbem' );
|
39 |
+
$scope = "future";
|
40 |
+
}
|
41 |
+
$events = EM_Events::get( array('scope'=>$scope, 'limit'=>0, 'order'=>$order ) );
|
42 |
$events_count = count ( $events );
|
43 |
|
44 |
$use_events_end = get_option ( 'dbem_use_event_end' );
|
46 |
<div class="wrap">
|
47 |
<div id="icon-events" class="icon32"><br />
|
48 |
</div>
|
49 |
+
<h2>
|
50 |
+
<?php echo $title; ?>
|
51 |
+
<a href="admin.php?page=events-manager-event" class="button add-new-h2"><?php _e('Add New') ?></a>
|
52 |
+
</h2>
|
53 |
<?php
|
54 |
em_hello_to_new_user ();
|
55 |
|
56 |
$link = array ();
|
57 |
+
$link ['past'] = "<a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/admin.php?page=events-manager&scope=past&order=desc'>" . __ ( 'Past events', 'dbem' ) . "</a>";
|
58 |
+
$link ['all'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/admin.php?page=events-manager&scope=all&order=desc'>" . __ ( 'All events', 'dbem' ) . "</a>";
|
59 |
+
$link ['future'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/admin.php?page=events-manager&scope=future'>" . __ ( 'Future events', 'dbem' ) . "</a>";
|
60 |
?>
|
61 |
+
<?php if ( !empty($_GET['error']) ) : ?>
|
62 |
+
<div id='message' class='error'>
|
63 |
+
<p><?php echo $_GET['error']; ?></p>
|
64 |
+
</div>
|
65 |
+
<?php endif; ?>
|
66 |
+
<?php if ( !empty($_GET['message']) ) : ?>
|
67 |
+
<div id='message' class='updated fade'>
|
68 |
+
<p><?php echo $_GET['message']; ?></p>
|
69 |
+
</div>
|
70 |
+
<?php endif; ?>
|
71 |
+
<form id="posts-filter" action="" method="get"><input type='hidden' name='page' value='events-manager' />
|
72 |
<ul class="subsubsub">
|
73 |
+
<li><a href='#' class="current"><?php _e ( 'Total', 'dbem' ); ?> <span class="count">(<?php echo (count ( $events )); ?>)</span></a></li>
|
|
|
74 |
</ul>
|
75 |
|
76 |
<div class="tablenav">
|
126 |
</thead>
|
127 |
<tbody>
|
128 |
<?php
|
|
|
129 |
$rowno = 0;
|
130 |
+
$event_count = 0;
|
131 |
foreach ( $events as $event ) {
|
132 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
133 |
$rowno++;
|
134 |
$class = ($rowno % 2) ? ' class="alternate"' : '';
|
135 |
// FIXME set to american
|
136 |
+
$localised_start_date = date_i18n('D d M Y', $event->start);
|
137 |
+
$localised_end_date = date_i18n('D d M Y', $event->end);
|
138 |
$style = "";
|
139 |
$today = date ( "Y-m-d" );
|
140 |
$location_summary = "<b>" . $event->location->name . "</b><br/>" . $event->location->address . " - " . $event->location->town;
|
151 |
</td>
|
152 |
<td>
|
153 |
<strong>
|
154 |
+
<a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-event&event_id=<?php echo $event->id ?>&scope=<?php echo $scope ?>&p=<?php echo $page ?>"><?php echo ($event->name); ?></a>
|
155 |
</strong>
|
156 |
<?php if($category) : ?>
|
157 |
<br/><span title='<?php _e( 'Category', 'dbem' ).": ".$category['category_name'] ?>'><?php $category['category_name'] ?></span>
|
158 |
<?php endif; ?>
|
159 |
</td>
|
160 |
<td>
|
161 |
+
<a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-event&action=duplicate&event_id=<?php echo $event->id; ?>&scope=<?php echo $scope ?>&p=<?php echo $page ?>" title="<?php _e ( 'Duplicate this event', 'dbem' ); ?>">
|
162 |
<strong>+</strong>
|
163 |
</a>
|
164 |
</td>
|
181 |
?>
|
182 |
<strong>
|
183 |
<?php echo $event->get_recurrence_description(); ?> <br />
|
184 |
+
<a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-event&event_id=<?php echo $event->recurrence_id ?>&scope=<?php echo $scope ?>&p=<?php echo $page ?>"><?php _e ( 'Reschedule', 'dbem' ); ?></a>
|
185 |
</strong>
|
186 |
<?php
|
187 |
}
|
190 |
</tr>
|
191 |
<?php
|
192 |
}
|
193 |
+
$event_count++;
|
194 |
}
|
195 |
?>
|
196 |
</tbody>
|
admin/em-help.php
CHANGED
@@ -2,20 +2,31 @@
|
|
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
|
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 |
<p>
|
12 |
-
|
13 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<?php
|
15 |
//Is this a previously imported installation?
|
16 |
$old_table_name = $wpdb->prefix.'dbem_events';
|
17 |
if( $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") == $old_table_name ){
|
18 |
?>
|
|
|
19 |
<div class="updated">
|
20 |
<h3>Troubleshooting upgrades from version 2.x to 3.x</h3>
|
21 |
<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>
|
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 |
<p>
|
12 |
+
For further information on using this plugin, please view the <a href="http://wp-events-plugin.com/documentation/">documentation pages</a>. 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>.
|
13 |
</p>
|
14 |
+
<div class="em-docs">
|
15 |
+
<h2><?php _e('Placeholders for customizing event pages','dbem'); ?></h2>
|
16 |
+
<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'), 'admin.php?page=events-manager-options'); ?></p>
|
17 |
+
<h3><a name="event-placeholders"><?php _e('Event Related Placeholders','dbem'); ?></a></h3>
|
18 |
+
<?php echo em_docs_placeholders( array('type'=>'events') ); ?>
|
19 |
+
<h3><a name="location-placeholders"><?php _e('Location Related Placeholders','dbem'); ?></a></h3>
|
20 |
+
<?php echo em_docs_placeholders( array('type'=>'locations') ); ?>
|
21 |
+
<h3><a name="booking-placeholders"><?php _e('Booking Related Placeholders','dbem'); ?></a></h3>
|
22 |
+
<?php echo em_docs_placeholders( array('type'=>'bookings') ); ?>
|
23 |
+
</div>
|
24 |
<?php
|
25 |
//Is this a previously imported installation?
|
26 |
$old_table_name = $wpdb->prefix.'dbem_events';
|
27 |
if( $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") == $old_table_name ){
|
28 |
?>
|
29 |
+
<hr style="margin:30px 10px;" />
|
30 |
<div class="updated">
|
31 |
<h3>Troubleshooting upgrades from version 2.x to 3.x</h3>
|
32 |
<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>
|
admin/em-locations.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Looks at the request values, saves/updates and then displays the right menu in the admin
|
4 |
* @return null
|
5 |
*/
|
6 |
-
function
|
7 |
//TODO EM_Location is globalized, use it fully here
|
8 |
global $EM_Location;
|
9 |
|
@@ -64,7 +64,7 @@ function em_admin_locations($message='', $fill_fields = false) {
|
|
64 |
</div>
|
65 |
<h2>
|
66 |
<?php _e('Locations', 'dbem'); ?>
|
67 |
-
<a href="admin.php?page=locations&action=add" class="button add-new-h2"><?php _e('Add New') ?></a>
|
68 |
</h2>
|
69 |
|
70 |
<?php if($message != "") : ?>
|
@@ -120,7 +120,7 @@ function em_admin_locations($message='', $fill_fields = false) {
|
|
120 |
<?php if( $i >= $offset && $i <= $offset+$limit ): ?>
|
121 |
<tr>
|
122 |
<td><input type='checkbox' class ='row-selector' value='<?php echo $EM_Location->id ?>' name='locations[]'/></td>
|
123 |
-
<td><a href='admin.php?page=locations&action=edit&location_id=<?php echo $EM_Location->id ?>'><?php echo $EM_Location->name ?></a></td>
|
124 |
<td><?php echo $EM_Location->address ?></td>
|
125 |
<td><?php echo $EM_Location->town ?></td>
|
126 |
</tr>
|
@@ -159,7 +159,7 @@ function em_admin_location($message = "") {
|
|
159 |
<?php endif; ?>
|
160 |
<div id='ajax-response'></div>
|
161 |
|
162 |
-
<form enctype='multipart/form-data' name='editcat' id='locationForm' method='post' action='admin.php?page=locations' class='validate'>
|
163 |
<input type='hidden' name='action' value='save' />
|
164 |
<input type='hidden' name='location_id' value='<?php echo $EM_Location->id ?>'/>
|
165 |
<table class='form-table'>
|
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_locations_page() {
|
7 |
//TODO EM_Location is globalized, use it fully here
|
8 |
global $EM_Location;
|
9 |
|
64 |
</div>
|
65 |
<h2>
|
66 |
<?php _e('Locations', 'dbem'); ?>
|
67 |
+
<a href="admin.php?page=events-manager-locations&action=add" class="button add-new-h2"><?php _e('Add New') ?></a>
|
68 |
</h2>
|
69 |
|
70 |
<?php if($message != "") : ?>
|
120 |
<?php if( $i >= $offset && $i <= $offset+$limit ): ?>
|
121 |
<tr>
|
122 |
<td><input type='checkbox' class ='row-selector' value='<?php echo $EM_Location->id ?>' name='locations[]'/></td>
|
123 |
+
<td><a href='admin.php?page=events-manager-locations&action=edit&location_id=<?php echo $EM_Location->id ?>'><?php echo $EM_Location->name ?></a></td>
|
124 |
<td><?php echo $EM_Location->address ?></td>
|
125 |
<td><?php echo $EM_Location->town ?></td>
|
126 |
</tr>
|
159 |
<?php endif; ?>
|
160 |
<div id='ajax-response'></div>
|
161 |
|
162 |
+
<form enctype='multipart/form-data' name='editcat' id='locationForm' method='post' action='admin.php?page=events-manager-locations' class='validate'>
|
163 |
<input type='hidden' name='action' value='save' />
|
164 |
<input type='hidden' name='location_id' value='<?php echo $EM_Location->id ?>'/>
|
165 |
<table class='form-table'>
|
admin/em-options.php
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
//Function composing the options subpanel
|
3 |
function em_options_save(){
|
4 |
if( current_user_can('activate_plugins') && !empty($_POST['em-submitted']) ){
|
5 |
//Build the array of options here
|
|
|
6 |
foreach ($_POST as $postKey => $postValue){
|
7 |
if( substr($postKey, 0, 5) == 'dbem_' ){
|
8 |
//TODO some more validation/reporting
|
@@ -28,8 +30,14 @@ add_action('admin_head', 'em_options_save');
|
|
28 |
|
29 |
|
30 |
|
31 |
-
function
|
32 |
//TODO place all options into an array
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
$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' ) .' ('. __('All','dbem') .')" /></p></ts></td></tr>';
|
34 |
?>
|
35 |
<script type="text/javascript" charset="utf-8">
|
@@ -170,10 +178,10 @@ function em_options_subpanel() {
|
|
170 |
<table class="form-table">
|
171 |
<?php
|
172 |
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' ) );
|
173 |
-
em_options_textarea ( __( 'Default event list format', 'dbem' ), 'dbem_event_list_item_format', __( 'The format of any events in a list
|
174 |
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' ) );
|
175 |
-
em_options_input_text ( __( 'Single event page title format', 'dbem' ), 'dbem_event_page_title_format', __( 'The format of a single event page title.
|
176 |
-
em_options_textarea ( __( 'Default single event format', 'dbem' ), 'dbem_single_event_format', __( 'The format of a single event page
|
177 |
em_options_input_text ( __( 'Events page title', 'dbem' ), 'dbem_events_page_title', __( 'The title on the multiple events page.', 'dbem' ) );
|
178 |
em_options_input_text ( __( 'No events message', 'dbem' ), 'dbem_no_events_message', __( 'The message displayed when no events are available.', 'dbem' ) );
|
179 |
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' ) );
|
@@ -188,9 +196,9 @@ function em_options_subpanel() {
|
|
188 |
<div class="inside">
|
189 |
<table class="form-table">
|
190 |
<?php
|
191 |
-
em_options_input_text ( __( 'Small calendar title', 'dbem' ), 'dbem_small_calendar_event_title_format', __( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ) );
|
192 |
em_options_input_text ( __( 'Small calendar title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
|
193 |
-
em_options_input_text ( __( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ) );
|
194 |
em_options_radio_binary ( __( 'Show long events on calendar pages?', 'dbem' ), 'dbem_full_calendar_long_events', __( "If you are showing a calendar on the events page (see Events format section on this page), you have the option of showing events that span over days on each day it occurs.",'dbem' ) );
|
195 |
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' ) );
|
196 |
echo $save_button;
|
@@ -204,10 +212,10 @@ function em_options_subpanel() {
|
|
204 |
<div class="inside">
|
205 |
<table class="form-table">
|
206 |
<?php
|
207 |
-
em_options_input_text ( __( 'Single location page title format', 'dbem' ), 'dbem_location_page_title_format', __( 'The format of a single location page title
|
208 |
-
em_options_textarea ( __( 'Default single location page format', 'dbem' ), 'dbem_single_location_format', __( 'The format of a single location page
|
209 |
-
em_options_textarea ( __( 'Default location balloon format', 'dbem' ), 'dbem_location_baloon_format', __( 'The format of of the text appearing in the baloon describing the location in the map
|
210 |
-
em_options_textarea ( __( 'Default location event list format', 'dbem' ), 'dbem_location_event_list_item_format', __( 'The format of the events the list inserted in the location page through the <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> element.
|
211 |
em_options_textarea ( __( 'Default no events message', 'dbem' ), 'dbem_location_no_events_message', __( 'The message to be displayed in the list generated by <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> when no events are available.', 'dbem' ) );
|
212 |
echo $save_button;
|
213 |
?>
|
@@ -220,10 +228,10 @@ function em_options_subpanel() {
|
|
220 |
<div class="inside">
|
221 |
<table class="form-table">
|
222 |
<?php
|
223 |
-
em_options_input_text ( __( 'RSS main title', 'dbem' ), 'dbem_rss_main_title', __( 'The main title of your RSS events feed.', 'dbem' ) );
|
224 |
em_options_input_text ( __( 'RSS main description', 'dbem' ), 'dbem_rss_main_description', __( 'The main description of your RSS events feed.', 'dbem' ) );
|
225 |
-
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' ) );
|
226 |
-
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.
|
227 |
echo $save_button;
|
228 |
?>
|
229 |
</table>
|
@@ -238,13 +246,13 @@ function em_options_subpanel() {
|
|
238 |
<tr valign="top">
|
239 |
<th scope="row"><?php _e ( 'Enable Google Maps integration?', 'dbem' ); ?></th>
|
240 |
<td>
|
241 |
-
<input id="dbem_gmap_is_active_yes" name="dbem_gmap_is_active" type="radio" value="1" <?php echo ($gmap_is_active) ? "checked='checked'":''; ?>
|
242 |
-
<input name="dbem_gmap_is_active" type="radio" value="0" <?php echo ($gmap_is_active) ? '':"checked='checked'"; ?>
|
243 |
-
|
244 |
</td>
|
245 |
</tr>
|
246 |
<?php
|
247 |
-
em_options_textarea ( __( 'Map text format', 'dbem' ), 'dbem_map_text_format', __( 'The text format inside the map balloons
|
248 |
echo $save_button;
|
249 |
?>
|
250 |
</table>
|
@@ -257,10 +265,10 @@ function em_options_subpanel() {
|
|
257 |
<table class='form-table'>
|
258 |
<?php
|
259 |
em_options_select ( __( 'Default contact person', 'dbem' ), 'dbem_default_contact_person', em_get_wp_users (), __( 'Select the default contact person. This user will be employed whenever a contact person is not explicitly specified for an event', 'dbem' ) );
|
260 |
-
em_options_radio_binary ( __( '
|
261 |
-
em_options_textarea ( __( 'Contact person email format', 'dbem' ), 'dbem_contactperson_email_body', __( 'The format of the email which will be sent to the contact person.
|
262 |
-
em_options_textarea ( __( '
|
263 |
-
em_options_input_text ( __( '
|
264 |
echo $save_button;
|
265 |
?>
|
266 |
</table>
|
@@ -275,7 +283,7 @@ function em_options_subpanel() {
|
|
275 |
em_options_input_text ( __( 'Notification sender name', 'dbem' ), 'dbem_mail_sender_name', __( "Insert the display name of the notification sender.", 'dbem' ) );
|
276 |
em_options_input_text ( __( 'Notification sender address', 'dbem' ), 'dbem_mail_sender_address', __( "Insert the address of the notification sender.", 'dbem' ) );
|
277 |
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' ) );
|
278 |
-
em_options_select ( __( 'Mail sending method', 'dbem' ), 'dbem_rsvp_mail_send_method', array ('smtp' => 'SMTP', 'mail' => __( 'PHP mail function', 'dbem' ), 'sendmail' => 'Sendmail', 'qmail' => 'Qmail' ), __( 'Select the method to send email notification.', 'dbem' ) );
|
279 |
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' ) );
|
280 |
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' ) );
|
281 |
em_options_input_text ( __( 'SMTP username', 'dbem' ), 'dbem_smtp_username', __( "Insert the username to be used to access your SMTP server.", 'dbem' ) );
|
1 |
<?php
|
2 |
+
|
3 |
//Function composing the options subpanel
|
4 |
function em_options_save(){
|
5 |
if( current_user_can('activate_plugins') && !empty($_POST['em-submitted']) ){
|
6 |
//Build the array of options here
|
7 |
+
$post = $_POST;
|
8 |
foreach ($_POST as $postKey => $postValue){
|
9 |
if( substr($postKey, 0, 5) == 'dbem_' ){
|
10 |
//TODO some more validation/reporting
|
30 |
|
31 |
|
32 |
|
33 |
+
function em_admin_options_page() {
|
34 |
//TODO place all options into an array
|
35 |
+
$events_placeholders = '<a href="admin.php?page=events-manager-help#event-placeholders">'. __('Event Related Placeholders','dbem') .'</a>';
|
36 |
+
$locations_placeholders = '<a href="admin.php?page=events-manager-help#location-placeholders">'. __('Location Related Placeholders','dbem') .'</a>';
|
37 |
+
$events_placeholder_tip = " ". sprintf(__('This textbox accepts %s and %s placeholders.','dbem'),$events_placeholders, $locations_placeholders);
|
38 |
+
$locations_placeholder_tip = " ". sprintf(__('This textbox accepts %s placeholders.','dbem'), $locations_placeholders);
|
39 |
+
$bookings_placeholder_tip = " ". sprintf(__('This textbox accepts %s placeholders.','dbem'), $bookings_placeholders);
|
40 |
+
|
41 |
$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' ) .' ('. __('All','dbem') .')" /></p></ts></td></tr>';
|
42 |
?>
|
43 |
<script type="text/javascript" charset="utf-8">
|
178 |
<table class="form-table">
|
179 |
<?php
|
180 |
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' ) );
|
181 |
+
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 );
|
182 |
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' ) );
|
183 |
+
em_options_input_text ( __( 'Single event page title format', 'dbem' ), 'dbem_event_page_title_format', __( 'The format of a single event page title.', 'dbem' ).$events_placeholder_tip );
|
184 |
+
em_options_textarea ( __( 'Default single event format', 'dbem' ), 'dbem_single_event_format', __( 'The format of a single event page.', 'dbem' ).$events_placeholder_tip );
|
185 |
em_options_input_text ( __( 'Events page title', 'dbem' ), 'dbem_events_page_title', __( 'The title on the multiple events page.', 'dbem' ) );
|
186 |
em_options_input_text ( __( 'No events message', 'dbem' ), 'dbem_no_events_message', __( 'The message displayed when no events are available.', 'dbem' ) );
|
187 |
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' ) );
|
196 |
<div class="inside">
|
197 |
<table class="form-table">
|
198 |
<?php
|
199 |
+
em_options_input_text ( __( 'Small calendar title', 'dbem' ), 'dbem_small_calendar_event_title_format', __( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ).$events_placeholder_tip );
|
200 |
em_options_input_text ( __( 'Small calendar title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
|
201 |
+
em_options_input_text ( __( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ).$events_placeholder_tip );
|
202 |
em_options_radio_binary ( __( 'Show long events on calendar pages?', 'dbem' ), 'dbem_full_calendar_long_events', __( "If you are showing a calendar on the events page (see Events format section on this page), you have the option of showing events that span over days on each day it occurs.",'dbem' ) );
|
203 |
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' ) );
|
204 |
echo $save_button;
|
212 |
<div class="inside">
|
213 |
<table class="form-table">
|
214 |
<?php
|
215 |
+
em_options_input_text ( __( 'Single location page title format', 'dbem' ), 'dbem_location_page_title_format', __( 'The format of a single location page title.', 'dbem' ).$locations_placeholder_tip );
|
216 |
+
em_options_textarea ( __( 'Default single location page format', 'dbem' ), 'dbem_single_location_format', __( 'The format of a single location page.', 'dbem' ).$locations_placeholder_tip );
|
217 |
+
em_options_textarea ( __( 'Default location balloon format', 'dbem' ), 'dbem_location_baloon_format', __( 'The format of of the text appearing in the baloon describing the location in the map.', 'dbem' ).$locations_placeholder_tip );
|
218 |
+
em_options_textarea ( __( 'Default location event list format', 'dbem' ), 'dbem_location_event_list_item_format', __( 'The format of the events the list inserted in the location page through the <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> element.', 'dbem' ).$locations_placeholder_tip );
|
219 |
em_options_textarea ( __( 'Default no events message', 'dbem' ), 'dbem_location_no_events_message', __( 'The message to be displayed in the list generated by <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> when no events are available.', 'dbem' ) );
|
220 |
echo $save_button;
|
221 |
?>
|
228 |
<div class="inside">
|
229 |
<table class="form-table">
|
230 |
<?php
|
231 |
+
em_options_input_text ( __( 'RSS main title', 'dbem' ), 'dbem_rss_main_title', __( 'The main title of your RSS events feed.', 'dbem' ).$events_placeholder_tip );
|
232 |
em_options_input_text ( __( 'RSS main description', 'dbem' ), 'dbem_rss_main_description', __( 'The main description of your RSS events feed.', 'dbem' ) );
|
233 |
+
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 );
|
234 |
+
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 );
|
235 |
echo $save_button;
|
236 |
?>
|
237 |
</table>
|
246 |
<tr valign="top">
|
247 |
<th scope="row"><?php _e ( 'Enable Google Maps integration?', 'dbem' ); ?></th>
|
248 |
<td>
|
249 |
+
<?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'":''; ?> />
|
250 |
+
<?php _e ( 'No' ); ?> <input name="dbem_gmap_is_active" type="radio" value="0" <?php echo ($gmap_is_active) ? '':"checked='checked'"; ?> /><br />
|
251 |
+
<em><?php _e ( 'Check this option to enable Goggle Map integration.', 'dbem' )?></em>
|
252 |
</td>
|
253 |
</tr>
|
254 |
<?php
|
255 |
+
em_options_textarea ( __( 'Map text format', 'dbem' ), 'dbem_map_text_format', __( 'The text format inside the map balloons.', 'dbem' ).$events_placeholder_tip );
|
256 |
echo $save_button;
|
257 |
?>
|
258 |
</table>
|
265 |
<table class='form-table'>
|
266 |
<?php
|
267 |
em_options_select ( __( 'Default contact person', 'dbem' ), 'dbem_default_contact_person', em_get_wp_users (), __( 'Select the default contact person. This user will be employed whenever a contact person is not explicitly specified for an event', 'dbem' ) );
|
268 |
+
em_options_radio_binary ( __( 'Email contact person?', 'dbem' ), 'dbem_rsvp_notify_contact', __( 'Check this option if you want the event contact to receive an email when someone books places.', 'dbem' ) );
|
269 |
+
em_options_textarea ( __( 'Contact person email format', 'dbem' ), 'dbem_contactperson_email_body', __( 'The format of the email which will be sent to the contact person.', 'dbem' ).$bookings_placeholder_tip );
|
270 |
+
em_options_textarea ( __( 'Booking email format', 'dbem' ), 'dbem_respondent_email_body', __( 'The format of the email which will be sent to respondent.', 'dbem' ).$bookings_placeholder_tip );
|
271 |
+
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' ) );
|
272 |
echo $save_button;
|
273 |
?>
|
274 |
</table>
|
283 |
em_options_input_text ( __( 'Notification sender name', 'dbem' ), 'dbem_mail_sender_name', __( "Insert the display name of the notification sender.", 'dbem' ) );
|
284 |
em_options_input_text ( __( 'Notification sender address', 'dbem' ), 'dbem_mail_sender_address', __( "Insert the address of the notification sender.", 'dbem' ) );
|
285 |
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' ) );
|
286 |
+
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' ) );
|
287 |
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' ) );
|
288 |
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' ) );
|
289 |
em_options_input_text ( __( 'SMTP username', 'dbem' ), 'dbem_smtp_username', __( "Insert the username to be used to access your SMTP server.", 'dbem' ) );
|
admin/em-people.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
function
|
3 |
// Managing AJAX booking removal
|
4 |
if(isset($_GET['action']) && $_GET['action'] == 'remove_booking') {
|
5 |
if(isset($_POST['booking_id'])){
|
1 |
<?php
|
2 |
+
function em_admin_people_page() {
|
3 |
// Managing AJAX booking removal
|
4 |
if(isset($_GET['action']) && $_GET['action'] == 'remove_booking') {
|
5 |
if(isset($_POST['booking_id'])){
|
classes/em-booking.php
CHANGED
@@ -6,13 +6,15 @@ class EM_Booking extends EM_Object{
|
|
6 |
var $person_id;
|
7 |
var $seats;
|
8 |
var $comment;
|
|
|
9 |
//Other Vars
|
10 |
var $fields = array(
|
11 |
'booking_id' => array('name'=>'id','type'=>'%d'),
|
12 |
'event_id' => array('name'=>'event_id','type'=>'%d'),
|
13 |
'person_id' => array('name'=>'person_id','type'=>'%d'),
|
14 |
'booking_seats' => array('name'=>'seats','type'=>'%d'),
|
15 |
-
'booking_comment' => array('name'=>'comment','type'=>'%s')
|
|
|
16 |
);
|
17 |
var $person;
|
18 |
var $required_fields = array('booking_id', 'event_id', 'person_id', 'booking_seats');
|
@@ -120,15 +122,23 @@ class EM_Booking extends EM_Object{
|
|
120 |
return ( $wpdb->query( $sql ) !== false );
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
/**
|
124 |
* Returns this object in the form of an array
|
125 |
* @return array
|
126 |
*/
|
127 |
function to_array($person = false){
|
128 |
$booking = array();
|
129 |
-
//Core
|
130 |
$booking = parent::to_array();
|
131 |
-
//
|
132 |
if($person && is_object($this->person)){
|
133 |
$person = $this->person->to_array();
|
134 |
$booking = array_merge($booking, $person);
|
6 |
var $person_id;
|
7 |
var $seats;
|
8 |
var $comment;
|
9 |
+
var $approved = 0;
|
10 |
//Other Vars
|
11 |
var $fields = array(
|
12 |
'booking_id' => array('name'=>'id','type'=>'%d'),
|
13 |
'event_id' => array('name'=>'event_id','type'=>'%d'),
|
14 |
'person_id' => array('name'=>'person_id','type'=>'%d'),
|
15 |
'booking_seats' => array('name'=>'seats','type'=>'%d'),
|
16 |
+
'booking_comment' => array('name'=>'comment','type'=>'%s'),
|
17 |
+
'booking_approved' => array('name'=>'approved','type'=>'%d')
|
18 |
);
|
19 |
var $person;
|
20 |
var $required_fields = array('booking_id', 'event_id', 'person_id', 'booking_seats');
|
122 |
return ( $wpdb->query( $sql ) !== false );
|
123 |
}
|
124 |
|
125 |
+
/**
|
126 |
+
* Approve a booking.
|
127 |
+
*/
|
128 |
+
function approve(){
|
129 |
+
$this->approved = 1;
|
130 |
+
return $this->save();
|
131 |
+
}
|
132 |
+
|
133 |
/**
|
134 |
* Returns this object in the form of an array
|
135 |
* @return array
|
136 |
*/
|
137 |
function to_array($person = false){
|
138 |
$booking = array();
|
139 |
+
//Core Data
|
140 |
$booking = parent::to_array();
|
141 |
+
//Person Data
|
142 |
if($person && is_object($this->person)){
|
143 |
$person = $this->person->to_array();
|
144 |
$booking = array_merge($booking, $person);
|
classes/em-bookings.php
CHANGED
@@ -60,12 +60,16 @@ class EM_Bookings extends EM_Object{
|
|
60 |
if ( is_object($previous_booking) ) {
|
61 |
//Previously booked, so we add these seats to the booking
|
62 |
$new_seats = $EM_Booking->seats;
|
63 |
-
$EM_Booking = $previous_booking;
|
|
|
64 |
$result = $EM_Booking->save();
|
65 |
if($result){
|
|
|
|
|
|
|
|
|
66 |
$this->bookings[] = $EM_Booking;
|
67 |
$email = $this->email($EM_Booking);
|
68 |
-
$EM_Booking->seats += $new_seats;
|
69 |
}
|
70 |
} else {
|
71 |
//New booking, so let's save the booking
|
@@ -79,9 +83,9 @@ class EM_Bookings extends EM_Object{
|
|
79 |
//Success
|
80 |
$this->feedback_message = __('Booking successful.', 'dbem');
|
81 |
if(!$email){
|
82 |
-
$this->feedback_message .= ' '.__('However,
|
83 |
if( current_user_can('activate_plugins') ){
|
84 |
-
if( is_array($this->errors) ){
|
85 |
$this->feedback_message .= '<br/><strong>Errors:</strong> (only admins see this message)<br/><ul><li>'. implode('</li><li>', $EM_Mailer->errors).'</li></ul>';
|
86 |
}else{
|
87 |
$this->feedback_message .= '<br/><strong>No errors returned by mailer</strong> (only admins see this message)';
|
@@ -91,7 +95,7 @@ class EM_Bookings extends EM_Object{
|
|
91 |
return true;
|
92 |
}else{
|
93 |
//Failure
|
94 |
-
$this->errors[] = "<strong>".__('Booking could not be created').":</strong><br />". implode('<br />', $EM_Booking->errors);
|
95 |
}
|
96 |
} else {
|
97 |
$this->errors[] = __('Booking cannot be made, not enough seats available!', 'dbem');
|
@@ -184,8 +188,8 @@ class EM_Bookings extends EM_Object{
|
|
184 |
$booker_body= str_replace($key, $value, $booker_body);
|
185 |
}
|
186 |
|
187 |
-
$contact_body = $EM_Event->output( $contact_body );
|
188 |
$booker_body = $EM_Event->output( $booker_body );
|
|
|
189 |
|
190 |
//TODO offer subject changes
|
191 |
if( !$EM_Mailer->send(__('Reservation confirmed','dbem'),$booker_body, $EM_Booking->person->email) ){
|
@@ -194,12 +198,25 @@ class EM_Bookings extends EM_Object{
|
|
194 |
}
|
195 |
return false;
|
196 |
}
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
201 |
-
$this->errors[] = 'Confirmation email could not be sent to contact person. Registrant should have gotten their email (only admin see this warning).';
|
202 |
-
return false;
|
203 |
}
|
204 |
|
205 |
//TODO need error checking for booking mail send
|
60 |
if ( is_object($previous_booking) ) {
|
61 |
//Previously booked, so we add these seats to the booking
|
62 |
$new_seats = $EM_Booking->seats;
|
63 |
+
$EM_Booking = $previous_booking;
|
64 |
+
$EM_Booking->seats += $new_seats;
|
65 |
$result = $EM_Booking->save();
|
66 |
if($result){
|
67 |
+
//remove old booking
|
68 |
+
foreach($this->bookings as $key=>$booking){
|
69 |
+
if($booking->id == $EM_Booking->id){ unset($this->bookings[$key]); }
|
70 |
+
}
|
71 |
$this->bookings[] = $EM_Booking;
|
72 |
$email = $this->email($EM_Booking);
|
|
|
73 |
}
|
74 |
} else {
|
75 |
//New booking, so let's save the booking
|
83 |
//Success
|
84 |
$this->feedback_message = __('Booking successful.', 'dbem');
|
85 |
if(!$email){
|
86 |
+
$this->feedback_message .= ' '.__('However, there were some problems whilst sending confirmation emails to you and/or the event contact person. You may want to contact them directly and letting them know of this error.', 'dbem');
|
87 |
if( current_user_can('activate_plugins') ){
|
88 |
+
if( is_array($this->errors) && count($this->errors) > 0 ){
|
89 |
$this->feedback_message .= '<br/><strong>Errors:</strong> (only admins see this message)<br/><ul><li>'. implode('</li><li>', $EM_Mailer->errors).'</li></ul>';
|
90 |
}else{
|
91 |
$this->feedback_message .= '<br/><strong>No errors returned by mailer</strong> (only admins see this message)';
|
95 |
return true;
|
96 |
}else{
|
97 |
//Failure
|
98 |
+
$this->errors[] = "<strong>".__('Booking could not be created','dbem').":</strong><br />". implode('<br />', $EM_Booking->errors);
|
99 |
}
|
100 |
} else {
|
101 |
$this->errors[] = __('Booking cannot be made, not enough seats available!', 'dbem');
|
188 |
$booker_body= str_replace($key, $value, $booker_body);
|
189 |
}
|
190 |
|
|
|
191 |
$booker_body = $EM_Event->output( $booker_body );
|
192 |
+
$contact_body = ( get_option('dbem_bookings_notify_admin') || get_option('dbem_rsvp_notify_contact') ) ? $EM_Event->output( $contact_body ):$contact_body;
|
193 |
|
194 |
//TODO offer subject changes
|
195 |
if( !$EM_Mailer->send(__('Reservation confirmed','dbem'),$booker_body, $EM_Booking->person->email) ){
|
198 |
}
|
199 |
return false;
|
200 |
}
|
201 |
+
|
202 |
+
if( get_option('dbem_rsvp_notify_contact') == 1 ){
|
203 |
+
if( !$EM_Mailer->send(__("New booking",'dbem'), $contact_body, $EM_Event->contact->user_email) && current_user_can('activate_plugins')){
|
204 |
+
foreach($EM_Mailer->errors as $error){
|
205 |
+
$this->errors[] = $error;
|
206 |
+
}
|
207 |
+
$this->errors[] = __('Confirmation email could not be sent to contact person. Registrant should have gotten their email (only admin see this warning).','dbem');
|
208 |
+
return false;
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
if( get_option('dbem_bookings_notify_admin') != '' && preg_match('/^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$/', get_option('dbem_bookings_notify_admin')) ){
|
213 |
+
if( !$EM_Mailer->send(__("New booking",'dbem'), $contact_body, get_option('dbem_bookings_notify_admin')) ){
|
214 |
+
foreach($EM_Mailer->errors as $error){
|
215 |
+
$this->errors[] = $error;
|
216 |
+
}
|
217 |
+
$this->errors[] = __('Confirmation email could not be sent to admin. Registrant should have gotten their email (only admin see this warning).','dbem');
|
218 |
+
return false;
|
219 |
}
|
|
|
|
|
220 |
}
|
221 |
|
222 |
//TODO need error checking for booking mail send
|
classes/em-calendar.php
CHANGED
@@ -6,6 +6,8 @@ class EM_Calendar extends EM_Object {
|
|
6 |
}
|
7 |
|
8 |
function output($args = array()) {
|
|
|
|
|
9 |
$args = self::get_default_search($args);
|
10 |
$full = $args['full']; //For ZDE, don't delete pls
|
11 |
$month = $args['month'];
|
@@ -14,24 +16,18 @@ class EM_Calendar extends EM_Object {
|
|
14 |
|
15 |
$week_starts_on_sunday = get_option('dbem_week_starts_sunday');
|
16 |
$start_of_week = get_option('start_of_week');
|
17 |
-
|
18 |
-
global $wpdb;
|
19 |
if( !(is_numeric($month) && $month <= 12 && $month > 0) ) {
|
20 |
$month = date('m');
|
21 |
}
|
22 |
if( !( is_numeric($year) ) ){
|
23 |
$year = date('Y');
|
24 |
-
}
|
25 |
-
|
26 |
-
$date = mktime(0,0,0,$month, date('d', current_time('timestamp')), $year);
|
27 |
-
$day = date('d', $date);
|
28 |
-
// $month = date('m', $date);
|
29 |
-
// $year = date('Y', $date);
|
30 |
// Get the first day of the month
|
31 |
$month_start = mktime(0,0,0,$month, 1, $year);
|
32 |
-
// Get friendly month name
|
33 |
-
|
34 |
-
$month_name = mysql2date('M', "$year-$month-$day 00:00:00");
|
35 |
// Figure out which day of the week
|
36 |
// the month starts on.
|
37 |
$month_start_day = date('D', $month_start);
|
@@ -45,17 +41,22 @@ class EM_Calendar extends EM_Object {
|
|
45 |
case "Fri": $offset = 5; break;
|
46 |
case "Sat": $offset = 6; break;
|
47 |
}
|
48 |
-
|
49 |
$offset -= $start_of_week;
|
50 |
if($offset<0)
|
51 |
$offset += 7;
|
52 |
|
53 |
-
// determine how many days are in the last month.
|
|
|
|
|
|
|
|
|
54 |
if($month == 1) {
|
55 |
-
$
|
56 |
-
|
57 |
-
$num_days_last = self::days_in_month(($month-1), $year);
|
58 |
}
|
|
|
|
|
59 |
// determine how many days are in the current month.
|
60 |
$num_days_current = self::days_in_month($month, $year);
|
61 |
// Build an array for the current days
|
@@ -66,7 +67,7 @@ class EM_Calendar extends EM_Object {
|
|
66 |
// Build an array for the number of days
|
67 |
// in last month
|
68 |
for($i = 1; $i <= $num_days_last; $i++){
|
69 |
-
$num_days_last_array[] = $i;
|
70 |
}
|
71 |
// If the $offset from the starting day of the
|
72 |
// week happens to be Sunday, $offset would be 0,
|
@@ -76,10 +77,7 @@ class EM_Calendar extends EM_Object {
|
|
76 |
$offset_correction = array_slice($num_days_last_array, -$offset, $offset);
|
77 |
$new_count = array_merge($offset_correction, $num_days_array);
|
78 |
$offset_count = count($offset_correction);
|
79 |
-
}
|
80 |
-
|
81 |
-
// The else statement is to prevent building the $offset array.
|
82 |
-
else {
|
83 |
$offset_count = 0;
|
84 |
$new_count = $num_days_array;
|
85 |
}
|
@@ -108,7 +106,7 @@ class EM_Calendar extends EM_Object {
|
|
108 |
}
|
109 |
// Outset Correction
|
110 |
for($i = 1; $i <= $outset; $i++){
|
111 |
-
$new_count[] = $i;
|
112 |
}
|
113 |
// Now let's "chunk" the $all_days array
|
114 |
// into weeks. Each week has 7 days
|
@@ -157,7 +155,7 @@ class EM_Calendar extends EM_Object {
|
|
157 |
// Build the heading portion of the calendar table
|
158 |
$calendar .= "<table class='dbem-calendar-table $fullclass'>\n".
|
159 |
"<thead>\n<tr>\n".
|
160 |
-
"<td>$previous_link</td><td class='month_name' colspan='5'
|
161 |
"</tr>\n</thead>\n".
|
162 |
"<tr class='days-names'>\n".
|
163 |
$days_initials.
|
@@ -167,33 +165,32 @@ class EM_Calendar extends EM_Object {
|
|
167 |
// into a week and create a new table row for each
|
168 |
// week with the days of that week in the table data
|
169 |
|
170 |
-
$i = 0;
|
171 |
-
foreach($weeks as $week){
|
172 |
-
$calendar .= "<tr>\n";
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
$d=date('j', $d);
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
}
|
195 |
|
196 |
-
|
197 |
|
198 |
// query the database for events in this time span
|
199 |
if ($month == 1) {
|
@@ -219,20 +216,24 @@ class EM_Calendar extends EM_Object {
|
|
219 |
$eventful_days= array();
|
220 |
if($events){
|
221 |
//Go through the events and slot them into the right d-m index
|
222 |
-
foreach($events as $event) {
|
|
|
223 |
if( $long_events ){
|
224 |
//If $long_events is set then show a date as eventful if there is an multi-day event which runs during that day
|
225 |
-
$event_start_date =
|
226 |
-
$event_end_date =
|
227 |
if( $event_end_date == '' ) $event_end_date = $event_start_date;
|
228 |
-
while( $event_start_date <= $
|
229 |
-
|
230 |
-
if(
|
231 |
-
$
|
232 |
-
|
233 |
-
|
|
|
|
|
|
|
234 |
}
|
235 |
-
$event_start_date += (
|
236 |
}
|
237 |
}else{
|
238 |
//Only show events on the day that they start
|
@@ -242,6 +243,7 @@ class EM_Calendar extends EM_Object {
|
|
242 |
$eventful_days[$event->start_date] = array($event);
|
243 |
}
|
244 |
}
|
|
|
245 |
}
|
246 |
}
|
247 |
|
@@ -253,12 +255,13 @@ class EM_Calendar extends EM_Object {
|
|
253 |
//Set the date into the key
|
254 |
$event_start_date = explode('-', $day_key);
|
255 |
$cells[$day_key]['day'] = ltrim($event_start_date[2],'0');
|
256 |
-
$cells[$day_key]['month'] = $event_start_date[1];
|
|
|
257 |
$events_titles = array();
|
258 |
foreach($events as $event) {
|
259 |
$events_titles[] = $event->output($event_title_format);
|
260 |
}
|
261 |
-
$link_title =
|
262 |
|
263 |
$events_page_id = get_option('dbem_events_page');
|
264 |
$event_page_link = get_permalink($events_page_id);
|
@@ -282,13 +285,13 @@ class EM_Calendar extends EM_Object {
|
|
282 |
if($events){
|
283 |
foreach($cells as $cell) {
|
284 |
if ($cell['month'] == $month_pre) {
|
285 |
-
$calendar=str_replace("<td class='eventless-pre'>".$cell['day']."</td>","<td class='eventful-pre'>".$cell['cell']."</td>",$calendar);
|
286 |
} elseif($cell['month'] == $month_post) {
|
287 |
-
$calendar=str_replace("<td class='eventless-post'>".$cell['day']."</td>","<td class='eventful-post'>".$cell['cell']."</td>",$calendar);
|
288 |
-
} elseif(
|
289 |
-
$calendar=str_replace("<td class='eventless-today'>".$cell['day']."</td>","<td class='eventful-today'>".$cell['cell']."</td>",$calendar);
|
290 |
-
} elseif( $cell['month'] == $month ){
|
291 |
-
$calendar=str_replace("<td class='eventless'>".$cell['day']."</td>","<td class='eventful'>".$cell['cell']."</td>",$calendar);
|
292 |
}
|
293 |
}
|
294 |
}
|
@@ -301,15 +304,15 @@ class EM_Calendar extends EM_Object {
|
|
301 |
*/
|
302 |
function insert_js() {
|
303 |
?>
|
304 |
-
|
305 |
<?php include(WP_PLUGIN_DIR.'/events-manager/includes/js/em_calendar_ajax.js'); ?>
|
306 |
</script>
|
307 |
-
|
308 |
}
|
309 |
|
310 |
|
311 |
function days_in_month($month, $year) {
|
312 |
-
return date('t',
|
313 |
}
|
314 |
|
315 |
function translate_and_trim($string, $length = 1) {
|
6 |
}
|
7 |
|
8 |
function output($args = array()) {
|
9 |
+
global $wpdb;
|
10 |
+
|
11 |
$args = self::get_default_search($args);
|
12 |
$full = $args['full']; //For ZDE, don't delete pls
|
13 |
$month = $args['month'];
|
16 |
|
17 |
$week_starts_on_sunday = get_option('dbem_week_starts_sunday');
|
18 |
$start_of_week = get_option('start_of_week');
|
19 |
+
|
|
|
20 |
if( !(is_numeric($month) && $month <= 12 && $month > 0) ) {
|
21 |
$month = date('m');
|
22 |
}
|
23 |
if( !( is_numeric($year) ) ){
|
24 |
$year = date('Y');
|
25 |
+
}
|
26 |
+
|
|
|
|
|
|
|
|
|
27 |
// Get the first day of the month
|
28 |
$month_start = mktime(0,0,0,$month, 1, $year);
|
29 |
+
// Get friendly month name
|
30 |
+
$month_name = date('M',$month_start);
|
|
|
31 |
// Figure out which day of the week
|
32 |
// the month starts on.
|
33 |
$month_start_day = date('D', $month_start);
|
41 |
case "Fri": $offset = 5; break;
|
42 |
case "Sat": $offset = 6; break;
|
43 |
}
|
44 |
+
//We need to go back to the WP defined day when the week started, in case the event day is near the end
|
45 |
$offset -= $start_of_week;
|
46 |
if($offset<0)
|
47 |
$offset += 7;
|
48 |
|
49 |
+
// determine how many days are in the last month.
|
50 |
+
$month_last = $month-1;
|
51 |
+
$month_next = $month+1;
|
52 |
+
$year_last = $year;
|
53 |
+
$year_next = $year;
|
54 |
if($month == 1) {
|
55 |
+
$month_last = 12;
|
56 |
+
$year_last = $year -1;
|
|
|
57 |
}
|
58 |
+
$num_days_last = self::days_in_month($month_last, $year_last);
|
59 |
+
|
60 |
// determine how many days are in the current month.
|
61 |
$num_days_current = self::days_in_month($month, $year);
|
62 |
// Build an array for the current days
|
67 |
// Build an array for the number of days
|
68 |
// in last month
|
69 |
for($i = 1; $i <= $num_days_last; $i++){
|
70 |
+
$num_days_last_array[] = mktime(0,0,0,$month_last, $i, $year_last);
|
71 |
}
|
72 |
// If the $offset from the starting day of the
|
73 |
// week happens to be Sunday, $offset would be 0,
|
77 |
$offset_correction = array_slice($num_days_last_array, -$offset, $offset);
|
78 |
$new_count = array_merge($offset_correction, $num_days_array);
|
79 |
$offset_count = count($offset_correction);
|
80 |
+
} else { // The else statement is to prevent building the $offset array.
|
|
|
|
|
|
|
81 |
$offset_count = 0;
|
82 |
$new_count = $num_days_array;
|
83 |
}
|
106 |
}
|
107 |
// Outset Correction
|
108 |
for($i = 1; $i <= $outset; $i++){
|
109 |
+
$new_count[] = mktime(0,0,0,$month_next, $i, $year_next);
|
110 |
}
|
111 |
// Now let's "chunk" the $all_days array
|
112 |
// into weeks. Each week has 7 days
|
155 |
// Build the heading portion of the calendar table
|
156 |
$calendar .= "<table class='dbem-calendar-table $fullclass'>\n".
|
157 |
"<thead>\n<tr>\n".
|
158 |
+
"<td>$previous_link</td><td class='month_name' colspan='5'>". ucfirst(date_i18n('M', $month_start))." $year</td><td>$next_link</td>\n".
|
159 |
"</tr>\n</thead>\n".
|
160 |
"<tr class='days-names'>\n".
|
161 |
$days_initials.
|
165 |
// into a week and create a new table row for each
|
166 |
// week with the days of that week in the table data
|
167 |
|
168 |
+
$i = 0;
|
169 |
+
foreach ( $weeks as $week ) {
|
170 |
+
$calendar .= "<tr>\n";
|
171 |
+
foreach ( $week as $d ) {
|
172 |
+
if ($i < $offset_count) { //if it is PREVIOUS month
|
173 |
+
$calendar .= "<td class='eventless-pre'>" . date ( 'j', $d ) . "</td>\n";
|
174 |
+
}
|
175 |
+
if (($i >= $offset_count) && ($i < ($num_weeks * 7) - $outset)) { // if it is THIS month
|
176 |
+
$fullday = $d;
|
177 |
+
$d = date ( 'j', $d );
|
178 |
+
if ( date('Y-m-d', current_time('timestamp')) == "$year-$month-$d" ) {
|
179 |
+
$calendar .= "<td class='eventless-today'>$d</td>\n";
|
180 |
+
} else {
|
181 |
+
$calendar .= "<td class='eventless'>$d</td>\n";
|
182 |
+
}
|
183 |
+
} elseif (($outset > 0)) { //if it is NEXT month
|
184 |
+
if (($i >= ($num_weeks * 7) - $outset)) {
|
185 |
+
$calendar .= "<td class='eventless-post'>" . date ( 'j', $d ) . "</td>\n";
|
186 |
+
}
|
187 |
+
}
|
188 |
+
$i ++;
|
189 |
+
}
|
190 |
+
$calendar .= "</tr>\n";
|
191 |
+
}
|
|
|
192 |
|
193 |
+
$calendar .= " </table>\n</div>";
|
194 |
|
195 |
// query the database for events in this time span
|
196 |
if ($month == 1) {
|
216 |
$eventful_days= array();
|
217 |
if($events){
|
218 |
//Go through the events and slot them into the right d-m index
|
219 |
+
foreach($events as $event) {
|
220 |
+
$event = apply_filters('em_calendar_output_loop_start', $event);
|
221 |
if( $long_events ){
|
222 |
//If $long_events is set then show a date as eventful if there is an multi-day event which runs during that day
|
223 |
+
$event_start_date = mktime(0,0,0,$month_pre,1,$year_pre);
|
224 |
+
$event_end_date = mktime(0,0,0,$month_post,date('t', $event_start_date),$year_post );
|
225 |
if( $event_end_date == '' ) $event_end_date = $event_start_date;
|
226 |
+
while( $event_start_date <= $event->end ){
|
227 |
+
//Ensure date is within event dates, if so add to eventful days array
|
228 |
+
if( $event_start_date > $event->start - (86400) ){ //subtract a day since start may be later in day
|
229 |
+
$event_eventful_date = date('Y-m-d', $event_start_date);
|
230 |
+
if( array_key_exists($event_eventful_date, $eventful_days) && is_array($eventful_days[$event_eventful_date]) ){
|
231 |
+
$eventful_days[$event_eventful_date][] = $event;
|
232 |
+
} else {
|
233 |
+
$eventful_days[$event_eventful_date] = array($event);
|
234 |
+
}
|
235 |
}
|
236 |
+
$event_start_date += (86400); //add a day
|
237 |
}
|
238 |
}else{
|
239 |
//Only show events on the day that they start
|
243 |
$eventful_days[$event->start_date] = array($event);
|
244 |
}
|
245 |
}
|
246 |
+
$event = apply_filters('em_calendar_output_loop_end', $event);
|
247 |
}
|
248 |
}
|
249 |
|
255 |
//Set the date into the key
|
256 |
$event_start_date = explode('-', $day_key);
|
257 |
$cells[$day_key]['day'] = ltrim($event_start_date[2],'0');
|
258 |
+
$cells[$day_key]['month'] = $event_start_date[1];
|
259 |
+
$cells[$day_key]['year'] = $event_start_date[0];
|
260 |
$events_titles = array();
|
261 |
foreach($events as $event) {
|
262 |
$events_titles[] = $event->output($event_title_format);
|
263 |
}
|
264 |
+
$link_title = EM_Events::output($events, array('format'=>$event_title_format));
|
265 |
|
266 |
$events_page_id = get_option('dbem_events_page');
|
267 |
$event_page_link = get_permalink($events_page_id);
|
285 |
if($events){
|
286 |
foreach($cells as $cell) {
|
287 |
if ($cell['month'] == $month_pre) {
|
288 |
+
$calendar = str_replace("<td class='eventless-pre'>".$cell['day']."</td>","<td class='eventful-pre'>".$cell['cell']."</td>",$calendar);
|
289 |
} elseif($cell['month'] == $month_post) {
|
290 |
+
$calendar = str_replace("<td class='eventless-post'>".$cell['day']."</td>","<td class='eventful-post'>".$cell['cell']."</td>",$calendar);
|
291 |
+
} elseif( date('Y-m-d', current_time('timestamp')) == $cell['year']."-".$cell['month']."-".$cell['day'] ) {
|
292 |
+
$calendar = str_replace("<td class='eventless-today'>".$cell['day']."</td>","<td class='eventful-today'>".$cell['cell']."</td>",$calendar);
|
293 |
+
} elseif( $cell['month'] == $month && $cell['year'] == $year){
|
294 |
+
$calendar = str_replace("<td class='eventless'>".$cell['day']."</td>","<td class='eventful'>".$cell['cell']."</td>",$calendar);
|
295 |
}
|
296 |
}
|
297 |
}
|
304 |
*/
|
305 |
function insert_js() {
|
306 |
?>
|
307 |
+
<script type='text/javascript'>
|
308 |
<?php include(WP_PLUGIN_DIR.'/events-manager/includes/js/em_calendar_ajax.js'); ?>
|
309 |
</script>
|
310 |
+
<?php
|
311 |
}
|
312 |
|
313 |
|
314 |
function days_in_month($month, $year) {
|
315 |
+
return date('t', mktime(0,0,0,$month,1,$year));
|
316 |
}
|
317 |
|
318 |
function translate_and_trim($string, $length = 1) {
|
classes/em-event.php
CHANGED
@@ -38,6 +38,27 @@ class EM_Event extends EM_Object{
|
|
38 |
'recurrence_byday' => array( 'name'=>'byday', 'type'=>'%s' ), //if weekly or monthly, what days of the week?
|
39 |
'recurrence_byweekno' => array( 'name'=>'byweekno', 'type'=>'%d' ) //if monthly which week (-1 is last)
|
40 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
/**
|
43 |
* Timestamp of start date/time
|
@@ -94,7 +115,6 @@ class EM_Event extends EM_Object{
|
|
94 |
if( is_array($event_data) ){
|
95 |
//Accepts a raw array that'll just be imported directly into the object with no DB lookups (same for event and recurrence)
|
96 |
$event = $event_data;
|
97 |
-
//FIXME this could lead to potential blank locations, if not supplied in array... do we load or not?
|
98 |
$this->location = new EM_Location( $event );
|
99 |
}elseif( is_numeric($event_data) && $event_data > 0 ){
|
100 |
//Retreiving from the database
|
@@ -110,8 +130,12 @@ class EM_Event extends EM_Object{
|
|
110 |
$this->location = new EM_Location ( $event );
|
111 |
}
|
112 |
//Sort out attributes
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
115 |
$event['recurrence_byday'] = ( $event['recurrence_byday'] == 7 ) ? 0:$event['recurrence_byday']; //Backward compatibility (since 3.0.3), using 0 makes more sense due to date() function
|
116 |
$this->to_object($event, true);
|
117 |
|
@@ -136,6 +160,8 @@ class EM_Event extends EM_Object{
|
|
136 |
if( $this->is_recurrence() && !array_key_exists($this->recurrence_id, $EM_Recurrences) ){
|
137 |
$EM_Recurrences[$this->recurrence_id] = new EM_Event($this->recurrence_id);
|
138 |
}
|
|
|
|
|
139 |
}
|
140 |
}
|
141 |
|
@@ -292,7 +318,7 @@ class EM_Event extends EM_Object{
|
|
292 |
return apply_filters('em_event_save', false, $this);
|
293 |
}
|
294 |
//Successful individual or recurrence save
|
295 |
-
$this->feedback_message = "
|
296 |
if($this->rsvp == 0){
|
297 |
$this->delete_bookings();
|
298 |
}
|
@@ -328,13 +354,11 @@ class EM_Event extends EM_Object{
|
|
328 |
global $wpdb, $EZSQL_ERROR;
|
329 |
//First, duplicate.
|
330 |
$event_table_name = $wpdb->prefix . EM_EVENTS_TABLE;
|
331 |
-
$eventArray = $this->to_array();
|
332 |
unset($eventArray['event_id']);
|
333 |
-
$
|
334 |
-
if($
|
335 |
-
|
336 |
-
$event_ID = $wpdb->insert_id;
|
337 |
-
$EM_Event = new EM_Event( $event_ID );
|
338 |
return apply_filters('em_event_duplicate', $EM_Event, $this);
|
339 |
}else{
|
340 |
//TODO add error notifications for duplication failures.
|
@@ -484,7 +508,7 @@ class EM_Event extends EM_Object{
|
|
484 |
case '#_EDITEVENTLINK':
|
485 |
if(is_user_logged_in()){
|
486 |
//TODO user should have permission to edit the event
|
487 |
-
$replace = "<a href='
|
488 |
}
|
489 |
break;
|
490 |
//Bookings
|
@@ -531,6 +555,9 @@ class EM_Event extends EM_Object{
|
|
531 |
case '#_CONTACTPHONE':
|
532 |
$replace = ( $this->contact->phone != '') ? $this->contact->phone : __('N/A', 'dbem');
|
533 |
break;
|
|
|
|
|
|
|
534 |
default:
|
535 |
$match = false;
|
536 |
break;
|
@@ -545,18 +572,19 @@ class EM_Event extends EM_Object{
|
|
545 |
foreach($placeholders[0] as $result) {
|
546 |
// matches all PHP START date and time placeholders
|
547 |
if (preg_match('/^#[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]$/', $result)) {
|
548 |
-
$replace =
|
549 |
$replace = apply_filters('em_event_output_placeholder', $replace, $this, $result, $target);
|
550 |
$event_string = str_replace($result, $replace, $event_string );
|
551 |
}
|
552 |
// matches all PHP END time placeholders for endtime
|
553 |
if (preg_match('/^#@[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]$/', $result)) {
|
554 |
-
$replace =
|
555 |
$replace = apply_filters('em_event_output_placeholder', $replace, $this, $result, $target);
|
556 |
$event_string = str_replace($result, $replace, $event_string );
|
557 |
}
|
558 |
}
|
559 |
//Time place holder that doesn't show if empty.
|
|
|
560 |
preg_match_all('/#@?_\{[A-Za-z0-9 -\/,\.\\\]+\}/', $format, $results);
|
561 |
foreach($results[0] as $result) {
|
562 |
if(substr($result, 0, 3 ) == "#@_"){
|
@@ -566,17 +594,19 @@ class EM_Event extends EM_Object{
|
|
566 |
$date = 'start_date';
|
567 |
$offset = 3;
|
568 |
}
|
569 |
-
if( $date == 'end_date' && $this
|
570 |
-
$
|
571 |
}else{
|
572 |
-
$
|
573 |
}
|
|
|
574 |
}
|
575 |
//This is for the custom attributes
|
576 |
preg_match_all('/#_ATT\{.+?\}(\{.+?\})?/', $format, $results);
|
577 |
foreach($results[0] as $resultKey => $result) {
|
578 |
//Strip string of placeholder and just leave the reference
|
579 |
$attRef = substr( substr($result, 0, strpos($result, '}')), 6 );
|
|
|
580 |
if( array_key_exists($attRef, $this->attributes) ){
|
581 |
$attString = $this->attributes[$attRef];
|
582 |
if( trim($attString) == '' && $results[1][$resultKey] != '' ){
|
38 |
'recurrence_byday' => array( 'name'=>'byday', 'type'=>'%s' ), //if weekly or monthly, what days of the week?
|
39 |
'recurrence_byweekno' => array( 'name'=>'byweekno', 'type'=>'%d' ) //if monthly which week (-1 is last)
|
40 |
);
|
41 |
+
/* Field Names - see above for matching DB field names and other field meta data */
|
42 |
+
var $id;
|
43 |
+
var $author;
|
44 |
+
var $name;
|
45 |
+
var $start_time;
|
46 |
+
var $end_time;
|
47 |
+
var $start_date;
|
48 |
+
var $end_date;
|
49 |
+
var $notes;
|
50 |
+
var $rsvp;
|
51 |
+
var $seats;
|
52 |
+
var $contactperson_id;
|
53 |
+
var $location_id;
|
54 |
+
var $recurrence_id;
|
55 |
+
var $category_id;
|
56 |
+
var $attributes;
|
57 |
+
var $recurrence;
|
58 |
+
var $interval;
|
59 |
+
var $freq;
|
60 |
+
var $byday;
|
61 |
+
var $byweekno;
|
62 |
|
63 |
/**
|
64 |
* Timestamp of start date/time
|
115 |
if( is_array($event_data) ){
|
116 |
//Accepts a raw array that'll just be imported directly into the object with no DB lookups (same for event and recurrence)
|
117 |
$event = $event_data;
|
|
|
118 |
$this->location = new EM_Location( $event );
|
119 |
}elseif( is_numeric($event_data) && $event_data > 0 ){
|
120 |
//Retreiving from the database
|
130 |
$this->location = new EM_Location ( $event );
|
131 |
}
|
132 |
//Sort out attributes
|
133 |
+
if( !empty($event['event_attributes']) ){
|
134 |
+
if( is_serialized($event['event_attributes']) ){
|
135 |
+
$event['event_attributes'] = @unserialize($event['event_attributes']);
|
136 |
+
}
|
137 |
+
$event['event_attributes'] = (!is_array($event['event_attributes'])) ? array() : $event['event_attributes'] ;
|
138 |
+
}
|
139 |
$event['recurrence_byday'] = ( $event['recurrence_byday'] == 7 ) ? 0:$event['recurrence_byday']; //Backward compatibility (since 3.0.3), using 0 makes more sense due to date() function
|
140 |
$this->to_object($event, true);
|
141 |
|
160 |
if( $this->is_recurrence() && !array_key_exists($this->recurrence_id, $EM_Recurrences) ){
|
161 |
$EM_Recurrences[$this->recurrence_id] = new EM_Event($this->recurrence_id);
|
162 |
}
|
163 |
+
}else{
|
164 |
+
$this->location = new EM_Location(); //blank location
|
165 |
}
|
166 |
}
|
167 |
|
318 |
return apply_filters('em_event_save', false, $this);
|
319 |
}
|
320 |
//Successful individual or recurrence save
|
321 |
+
$this->feedback_message = "{$this->name} " . __ ( 'updated', 'dbem' ) . "!";
|
322 |
if($this->rsvp == 0){
|
323 |
$this->delete_bookings();
|
324 |
}
|
354 |
global $wpdb, $EZSQL_ERROR;
|
355 |
//First, duplicate.
|
356 |
$event_table_name = $wpdb->prefix . EM_EVENTS_TABLE;
|
357 |
+
$eventArray = $this->to_array(true);
|
358 |
unset($eventArray['event_id']);
|
359 |
+
$EM_Event = new EM_Event( $eventArray );
|
360 |
+
if( $EM_Event->save() ){
|
361 |
+
$EM_Event->feedback_message = __("You are now viewing the duplicated event", 'dbem');
|
|
|
|
|
362 |
return apply_filters('em_event_duplicate', $EM_Event, $this);
|
363 |
}else{
|
364 |
//TODO add error notifications for duplication failures.
|
508 |
case '#_EDITEVENTLINK':
|
509 |
if(is_user_logged_in()){
|
510 |
//TODO user should have permission to edit the event
|
511 |
+
$replace = "<a href='".get_bloginfo('wpurl')."/wp-admin/admin.php?page=events-manager-event&event_id={$this->id}'>".__('Edit').' '.__('Event', 'dbem')."</a>";
|
512 |
}
|
513 |
break;
|
514 |
//Bookings
|
555 |
case '#_CONTACTPHONE':
|
556 |
$replace = ( $this->contact->phone != '') ? $this->contact->phone : __('N/A', 'dbem');
|
557 |
break;
|
558 |
+
case '#_CONTACTAVATAR':
|
559 |
+
$replace = get_avatar( $this->contact->ID, $size = '50' );
|
560 |
+
break;
|
561 |
default:
|
562 |
$match = false;
|
563 |
break;
|
572 |
foreach($placeholders[0] as $result) {
|
573 |
// matches all PHP START date and time placeholders
|
574 |
if (preg_match('/^#[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]$/', $result)) {
|
575 |
+
$replace = date_i18n(ltrim($result, "#"), $this->start);
|
576 |
$replace = apply_filters('em_event_output_placeholder', $replace, $this, $result, $target);
|
577 |
$event_string = str_replace($result, $replace, $event_string );
|
578 |
}
|
579 |
// matches all PHP END time placeholders for endtime
|
580 |
if (preg_match('/^#@[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]$/', $result)) {
|
581 |
+
$replace = date_i18n(ltrim($result, "#@"), $this->end);
|
582 |
$replace = apply_filters('em_event_output_placeholder', $replace, $this, $result, $target);
|
583 |
$event_string = str_replace($result, $replace, $event_string );
|
584 |
}
|
585 |
}
|
586 |
//Time place holder that doesn't show if empty.
|
587 |
+
//TODO add filter here too
|
588 |
preg_match_all('/#@?_\{[A-Za-z0-9 -\/,\.\\\]+\}/', $format, $results);
|
589 |
foreach($results[0] as $result) {
|
590 |
if(substr($result, 0, 3 ) == "#@_"){
|
594 |
$date = 'start_date';
|
595 |
$offset = 3;
|
596 |
}
|
597 |
+
if( $date == 'end_date' && $this->end_date == $this->start_date ){
|
598 |
+
$replace = __( apply_filters('em_event_output_placeholder', '', $this, $result, $target) );
|
599 |
}else{
|
600 |
+
$replace = __( apply_filters('em_event_output_placeholder', mysql2date(substr($result, $offset, (strlen($result)-($offset+1)) ), $this->$date), $this, $result, $target) );
|
601 |
}
|
602 |
+
$event_string = str_replace($result,$replace,$event_string );
|
603 |
}
|
604 |
//This is for the custom attributes
|
605 |
preg_match_all('/#_ATT\{.+?\}(\{.+?\})?/', $format, $results);
|
606 |
foreach($results[0] as $resultKey => $result) {
|
607 |
//Strip string of placeholder and just leave the reference
|
608 |
$attRef = substr( substr($result, 0, strpos($result, '}')), 6 );
|
609 |
+
$attString = '';
|
610 |
if( array_key_exists($attRef, $this->attributes) ){
|
611 |
$attString = $this->attributes[$attRef];
|
612 |
if( trim($attString) == '' && $results[1][$resultKey] != '' ){
|
classes/em-events.php
CHANGED
@@ -132,17 +132,19 @@ class EM_Events extends EM_Object {
|
|
132 |
if( is_object(current($args)) && get_class((current($args))) == 'EM_Event' ){
|
133 |
$func_args = func_get_args();
|
134 |
$events = $func_args[0];
|
135 |
-
$args = $func_args[1];
|
136 |
-
$args = apply_filters('em_events_output_args', $args, $events);
|
137 |
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
138 |
-
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:
|
|
|
139 |
}else{
|
140 |
//Firstly, let's check for a limit/offset here, because if there is we need to remove it and manually do this
|
141 |
-
$args = apply_filters('em_events_output_args', $args);
|
142 |
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
143 |
-
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:
|
|
|
144 |
$args['limit'] = false;
|
145 |
$args['offset'] = false;
|
|
|
146 |
$events = self::get( $args );
|
147 |
}
|
148 |
//What format shall we output this to, or use default
|
@@ -171,10 +173,8 @@ class EM_Events extends EM_Object {
|
|
171 |
$output = $single_event_format_header . $output . $single_event_format_footer;
|
172 |
}
|
173 |
//Pagination (if needed/requested)
|
174 |
-
if( !empty($args['pagination']) && !empty($limit) && $events_count
|
175 |
-
//
|
176 |
-
$page = ($offset > 0) ? floor($offset/$limit)+1:1;
|
177 |
-
//Show the pagination links (unless there's less than 10 events
|
178 |
$page_link_template = preg_replace('/(&|\?)page=\d+/i','',$_SERVER['REQUEST_URI']);
|
179 |
$page_link_template = em_add_get_params($page_link_template, array('page'=>'%PAGE%'));
|
180 |
$output .= apply_filters('em_events_output_pagination', em_paginate( $page_link_template, $events_count, $limit, $page), $page_link_template, $events_count, $limit, $page);
|
@@ -184,7 +184,8 @@ class EM_Events extends EM_Object {
|
|
184 |
}
|
185 |
//TODO check if reference is ok when restoring object, due to changes in php5 v 4
|
186 |
$EM_Event = $EM_Event_old;
|
187 |
-
|
|
|
188 |
}
|
189 |
|
190 |
/* Overrides EM_Object method to apply a filter to result
|
132 |
if( is_object(current($args)) && get_class((current($args))) == 'EM_Event' ){
|
133 |
$func_args = func_get_args();
|
134 |
$events = $func_args[0];
|
135 |
+
$args = apply_filters('em_events_output_args', self::get_default_search($func_args[1]), $events);
|
|
|
136 |
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
137 |
+
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
|
138 |
+
$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:1;
|
139 |
}else{
|
140 |
//Firstly, let's check for a limit/offset here, because if there is we need to remove it and manually do this
|
141 |
+
$args = apply_filters('em_events_output_args', self::get_default_search($args) );
|
142 |
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
143 |
+
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
|
144 |
+
$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:1;
|
145 |
$args['limit'] = false;
|
146 |
$args['offset'] = false;
|
147 |
+
$args['page'] = false;
|
148 |
$events = self::get( $args );
|
149 |
}
|
150 |
//What format shall we output this to, or use default
|
173 |
$output = $single_event_format_header . $output . $single_event_format_footer;
|
174 |
}
|
175 |
//Pagination (if needed/requested)
|
176 |
+
if( !empty($args['pagination']) && !empty($limit) && $events_count > $limit ){
|
177 |
+
//Show the pagination links (unless there's less than $limit events)
|
|
|
|
|
178 |
$page_link_template = preg_replace('/(&|\?)page=\d+/i','',$_SERVER['REQUEST_URI']);
|
179 |
$page_link_template = em_add_get_params($page_link_template, array('page'=>'%PAGE%'));
|
180 |
$output .= apply_filters('em_events_output_pagination', em_paginate( $page_link_template, $events_count, $limit, $page), $page_link_template, $events_count, $limit, $page);
|
184 |
}
|
185 |
//TODO check if reference is ok when restoring object, due to changes in php5 v 4
|
186 |
$EM_Event = $EM_Event_old;
|
187 |
+
$output = apply_filters('em_events_output', $output, $events, $args);
|
188 |
+
return $output;
|
189 |
}
|
190 |
|
191 |
/* Overrides EM_Object method to apply a filter to result
|
classes/em-location.php
CHANGED
@@ -127,7 +127,7 @@ class EM_Location extends EM_Object {
|
|
127 |
//TODO better image upload error handling
|
128 |
do_action('em_location_image_upload_pre', $this);
|
129 |
$result = true;
|
130 |
-
if ($_FILES['location_image']['size']
|
131 |
if( !file_exists(ABSPATH.EM_IMAGE_UPLOAD_DIR) ){
|
132 |
mkdir(ABSPATH.EM_IMAGE_UPLOAD_DIR, 0777);
|
133 |
}
|
@@ -146,14 +146,17 @@ class EM_Location extends EM_Object {
|
|
146 |
|
147 |
function load_similar($criteria){
|
148 |
global $wpdb;
|
149 |
-
$
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
|
|
|
|
|
|
155 |
}
|
156 |
-
return apply_filters('em_location_load_similar',
|
157 |
}
|
158 |
|
159 |
/**
|
127 |
//TODO better image upload error handling
|
128 |
do_action('em_location_image_upload_pre', $this);
|
129 |
$result = true;
|
130 |
+
if ( !empty($_FILES['location_image']['size']) ) {
|
131 |
if( !file_exists(ABSPATH.EM_IMAGE_UPLOAD_DIR) ){
|
132 |
mkdir(ABSPATH.EM_IMAGE_UPLOAD_DIR, 0777);
|
133 |
}
|
146 |
|
147 |
function load_similar($criteria){
|
148 |
global $wpdb;
|
149 |
+
if( !empty($criteria['location_name']) && !empty($criteria['location_name']) && !empty($criteria['location_name']) ){
|
150 |
+
$locations_table = $wpdb->prefix.EM_LOCATIONS_TABLE;
|
151 |
+
$prepared_sql = $wpdb->prepare("SELECT * FROM $locations_table WHERE location_name = %s AND location_address = %s AND location_town = %s", stripcslashes($criteria['location_name']), stripcslashes($criteria['location_address']), stripcslashes($criteria['location_town']) );
|
152 |
+
//$wpdb->show_errors(true);
|
153 |
+
$location = $wpdb->get_row($prepared_sql, ARRAY_A);
|
154 |
+
if( is_array($location) ){
|
155 |
+
$this->to_object($location);
|
156 |
+
}
|
157 |
+
return apply_filters('em_location_load_similar', $location, $this);
|
158 |
}
|
159 |
+
return apply_filters('em_location_load_similar', false, $this);
|
160 |
}
|
161 |
|
162 |
/**
|
classes/em-locations.php
CHANGED
@@ -85,19 +85,38 @@ class EM_Locations extends EM_Object {
|
|
85 |
$EM_Location_old = $EM_Location; //When looping, we can replace EM_Location global with the current event in the loop
|
86 |
//Can be either an array for the get search or an array of EM_Location objects
|
87 |
if( is_object(current($args)) && get_class((current($args))) == 'EM_Location' ){
|
88 |
-
$
|
|
|
|
|
|
|
|
|
|
|
89 |
}else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
$locations = self::get( $args );
|
91 |
}
|
92 |
//What format shall we output this to, or use default
|
93 |
$format = ( $args['format'] == '' ) ? get_option( 'dbem_location_list_item_format' ) : $args['format'] ;
|
94 |
|
95 |
$output = "";
|
|
|
|
|
|
|
96 |
if ( count($locations) > 0 ) {
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
//Add headers and footers to output
|
103 |
if( $format == get_option ( 'dbem_location_list_item_format' ) ){
|
@@ -107,7 +126,13 @@ class EM_Locations extends EM_Object {
|
|
107 |
$single_event_format_footer = ( $single_event_format_footer != '' ) ? $single_event_format_footer : "</ul>";
|
108 |
$output = $single_event_format_header . $output . $single_event_format_footer;
|
109 |
}
|
110 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
} else {
|
112 |
$output = get_option ( 'dbem_no_events_message' );
|
113 |
}
|
85 |
$EM_Location_old = $EM_Location; //When looping, we can replace EM_Location global with the current event in the loop
|
86 |
//Can be either an array for the get search or an array of EM_Location objects
|
87 |
if( is_object(current($args)) && get_class((current($args))) == 'EM_Location' ){
|
88 |
+
$func_args = func_get_args();
|
89 |
+
$locations = $func_args[0];
|
90 |
+
$args = apply_filters('em_locations_output_args', self::get_default_search($func_args[1]), $locations);
|
91 |
+
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
92 |
+
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
|
93 |
+
$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:1;
|
94 |
}else{
|
95 |
+
$args = apply_filters('em_locations_output_args', self::get_default_search($args) );
|
96 |
+
$limit = ( !empty($args['limit']) && is_numeric($args['limit']) ) ? $args['limit']:false;
|
97 |
+
$offset = ( !empty($args['offset']) && is_numeric($args['offset']) ) ? $args['offset']:0;
|
98 |
+
$page = ( !empty($args['page']) && is_numeric($args['page']) ) ? $args['page']:1;
|
99 |
+
$args['limit'] = false;
|
100 |
+
$args['offset'] = false;
|
101 |
+
$args['page'] = false;
|
102 |
$locations = self::get( $args );
|
103 |
}
|
104 |
//What format shall we output this to, or use default
|
105 |
$format = ( $args['format'] == '' ) ? get_option( 'dbem_location_list_item_format' ) : $args['format'] ;
|
106 |
|
107 |
$output = "";
|
108 |
+
$locations_count = count($locations);
|
109 |
+
$locations = apply_filters('em_locations_output_locations', $locations);
|
110 |
+
|
111 |
if ( count($locations) > 0 ) {
|
112 |
+
$location_count = 0;
|
113 |
+
$locations_shown = 0;
|
114 |
+
foreach ( $locations as $EM_Location ) {
|
115 |
+
if( ($locations_shown < $limit || empty($limit)) && ($location_count >= $offset || $offset === 0) ){
|
116 |
+
$output .= $EM_Location->output($format);
|
117 |
+
$locations_shown++;
|
118 |
+
}
|
119 |
+
$location_count++;
|
120 |
}
|
121 |
//Add headers and footers to output
|
122 |
if( $format == get_option ( 'dbem_location_list_item_format' ) ){
|
126 |
$single_event_format_footer = ( $single_event_format_footer != '' ) ? $single_event_format_footer : "</ul>";
|
127 |
$output = $single_event_format_header . $output . $single_event_format_footer;
|
128 |
}
|
129 |
+
//Pagination (if needed/requested)
|
130 |
+
if( !empty($args['pagination']) && !empty($limit) && $locations_count >= $limit ){
|
131 |
+
//Show the pagination links (unless there's less than 10 events
|
132 |
+
$page_link_template = preg_replace('/(&|\?)page=\d+/i','',$_SERVER['REQUEST_URI']);
|
133 |
+
$page_link_template = em_add_get_params($page_link_template, array('page'=>'%PAGE%'));
|
134 |
+
$output .= apply_filters('em_events_output_pagination', em_paginate( $page_link_template, $locations_count, $limit, $page), $page_link_template, $locations_count, $limit, $page);
|
135 |
+
}
|
136 |
} else {
|
137 |
$output = get_option ( 'dbem_no_events_message' );
|
138 |
}
|
classes/em-mailer.php
CHANGED
@@ -34,29 +34,35 @@ class EM_Mailer {
|
|
34 |
$mail->port = get_option('dbem_rsvp_mail_port');
|
35 |
$mail->Username = get_option('dbem_smtp_username');
|
36 |
$mail->Password = get_option('dbem_smtp_password');
|
37 |
-
$mail->From = get_option('dbem_mail_sender_address');
|
38 |
-
|
39 |
-
//Protocols
|
40 |
-
if( get_option('dbem_rsvp_mail_send_method') == 'qmail' ){
|
41 |
-
$mail->IsQmail();
|
42 |
-
} else {
|
43 |
-
$mail->Mailer = get_option('dbem_rsvp_mail_send_method');
|
44 |
-
}
|
45 |
-
if(get_option('dbem_rsvp_mail_SMTPAuth') == '1'){
|
46 |
-
$mail->SMTPAuth = TRUE;
|
47 |
-
}
|
48 |
-
|
49 |
$mail->FromName = get_option('dbem_mail_sender_name'); // This is the from name in the email, you can put anything you like here
|
50 |
$mail->Body = $body;
|
51 |
$mail->Subject = $subject;
|
52 |
$mail->AddAddress($receiver);
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
57 |
}else{
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}else{
|
61 |
$this->errors = __('Please supply a valid email format.', 'dbem');
|
62 |
return false;
|
34 |
$mail->port = get_option('dbem_rsvp_mail_port');
|
35 |
$mail->Username = get_option('dbem_smtp_username');
|
36 |
$mail->Password = get_option('dbem_smtp_password');
|
37 |
+
$mail->From = get_option('dbem_mail_sender_address');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
$mail->FromName = get_option('dbem_mail_sender_name'); // This is the from name in the email, you can put anything you like here
|
39 |
$mail->Body = $body;
|
40 |
$mail->Subject = $subject;
|
41 |
$mail->AddAddress($receiver);
|
42 |
|
43 |
+
//Protocols
|
44 |
+
if ( get_option('dbem_rsvp_mail_send_method') == 'wp_mail' ){
|
45 |
+
$mail->Mailer = 'wp_mail';
|
46 |
+
$send = wp_mail($receiver, $subject, $body);
|
47 |
+
if(!$send){
|
48 |
+
global $phpmailer;
|
49 |
+
$this->errors[] = $phpmailer->ErrorInfo;
|
50 |
+
}
|
51 |
}else{
|
52 |
+
if( get_option('dbem_rsvp_mail_send_method') == 'qmail' ){
|
53 |
+
$mail->IsQmail();
|
54 |
+
}else {
|
55 |
+
$mail->Mailer = get_option('dbem_rsvp_mail_send_method');
|
56 |
+
}
|
57 |
+
if(get_option('dbem_rsvp_mail_SMTPAuth') == '1'){
|
58 |
+
$mail->SMTPAuth = TRUE;
|
59 |
+
}
|
60 |
+
$send = $mail->Send();
|
61 |
+
if(!$send){
|
62 |
+
$this->errors[] = $mail->ErrorInfo;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
return $send;
|
66 |
}else{
|
67 |
$this->errors = __('Please supply a valid email format.', 'dbem');
|
68 |
return false;
|
classes/em-object.php
CHANGED
@@ -23,8 +23,10 @@ class EM_Object {
|
|
23 |
'orderby' => false,
|
24 |
'format' => '',
|
25 |
'category' => 0,
|
26 |
-
'location' => 0,
|
27 |
-
'
|
|
|
|
|
28 |
'recurrence'=>0,
|
29 |
'recurring'=>false,
|
30 |
'month'=>'',
|
@@ -45,31 +47,12 @@ class EM_Object {
|
|
45 |
if( array_key_exists('category_id', $array) && !array_key_exists('category', $array) ) { $array['category'] = $array['category_id']; }
|
46 |
|
47 |
if(is_array($array)){
|
48 |
-
//
|
49 |
-
|
50 |
-
|
51 |
-
$array['location'] = (int) $array['location'];
|
52 |
-
} elseif( preg_match('/^([0-9],?)+$/', $array['location']) ) {
|
53 |
-
$array['location'] = explode(',', $array['location']);
|
54 |
-
}else{
|
55 |
-
//No format we accept
|
56 |
-
unset($array['location']);
|
57 |
-
}
|
58 |
-
}
|
59 |
-
//Category - for now we just make both keys have an id number
|
60 |
-
if( array_key_exists('category', $array)){
|
61 |
-
if ( is_numeric($array['category']) ) {
|
62 |
-
$array['category'] = (int) $array['category'];
|
63 |
-
} elseif( preg_match('/^([0-9],?)+$/', $array['category']) ) {
|
64 |
-
$array['category'] = explode(',', $array['category']);
|
65 |
-
}else{
|
66 |
-
//No format we accept
|
67 |
-
unset($array['category']);
|
68 |
-
}
|
69 |
-
}
|
70 |
//OrderBy - can be a comma-seperated array of field names to order by (field names of object, not db)
|
71 |
if( array_key_exists('orderby', $array)){
|
72 |
-
if( preg_match('/,/', $array['orderby']) ) {
|
73 |
$array['orderby'] = explode(',', $array['orderby']);
|
74 |
}
|
75 |
}
|
@@ -109,8 +92,14 @@ class EM_Object {
|
|
109 |
$defaults['array'] = ($defaults['array'] == true);
|
110 |
$defaults['pagination'] = ($defaults['pagination'] == true);
|
111 |
$defaults['limit'] = (is_numeric($defaults['limit'])) ? $defaults['limit']:$super_defaults['limit'];
|
|
|
112 |
$defaults['recurring'] = ($defaults['recurring'] == true);
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
114 |
return apply_filters('em_object_get_default_search', $defaults, $array, $super_defaults);
|
115 |
}
|
116 |
|
@@ -132,6 +121,7 @@ class EM_Object {
|
|
132 |
$recurrence = $args['recurrence'];
|
133 |
$category = $args['category'];
|
134 |
$location = $args['location'];
|
|
|
135 |
$month = $args['month'];
|
136 |
$year = $args['year'];
|
137 |
$today = date('Y-m-d', current_time('timestamp'));
|
@@ -146,7 +136,7 @@ class EM_Object {
|
|
146 |
}else{
|
147 |
$conditions['recurring'] = "(`recurrence`!=1 OR `recurrence` IS NULL)";
|
148 |
}
|
149 |
-
//Dates - first check 'month', and 'year'
|
150 |
if( !($month=='' && $year=='') ){
|
151 |
//Sort out month range, if supplied an array of array(month,month), it'll check between these two months
|
152 |
if( self::array_is_numeric($month) ){
|
@@ -162,30 +152,27 @@ class EM_Object {
|
|
162 |
}else{
|
163 |
$date_year_start = $date_year_end = $year;
|
164 |
}
|
165 |
-
$date_start =
|
166 |
$date_end = date('Y-m-t', mktime(0,0,0,$date_month_end,1,$date_year_end));
|
167 |
-
$
|
168 |
-
$search_by_monthyear = true;
|
169 |
}
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
$conditions['scope'] = " (event_start_date >= CAST('$today' AS DATE) OR (event_end_date >= CAST('$today' AS DATE) AND event_end_date != '0000-00-00' AND event_end_date IS NOT NULL))";
|
188 |
-
}
|
189 |
}
|
190 |
}
|
191 |
|
@@ -201,12 +188,26 @@ class EM_Object {
|
|
201 |
$location_ids[] = $EM_Location->id;
|
202 |
}
|
203 |
$conditions['location'] = "( {$locations_table}.location_id=". implode(" {$locations_table}.location_id=", $location_ids) ." )";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
|
206 |
//Add conditions for category selection
|
207 |
//Filter by category, can be id or comma seperated ids
|
208 |
//TODO create an exclude category option
|
209 |
-
if ( $category
|
210 |
$conditions['category'] = " event_category_id = $category";
|
211 |
}elseif( self::array_is_numeric($category) ){
|
212 |
$conditions['category'] = "( event_category_id = ". implode(' OR event_category_id = ', $category).")";
|
@@ -340,6 +341,32 @@ class EM_Object {
|
|
340 |
return apply_filters('em_object_sanitize', $value);
|
341 |
}
|
342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
/**
|
344 |
* Will return true if this is a simple (non-assoc) numeric array, meaning it has at one or more numeric entries and nothing else
|
345 |
* @param mixed $array
|
23 |
'orderby' => false,
|
24 |
'format' => '',
|
25 |
'category' => 0,
|
26 |
+
'location' => 0,
|
27 |
+
'event' => 0,
|
28 |
+
'offset'=>0,
|
29 |
+
'page'=>1,//basically, if greater than 0, calculates offset at end
|
30 |
'recurrence'=>0,
|
31 |
'recurring'=>false,
|
32 |
'month'=>'',
|
47 |
if( array_key_exists('category_id', $array) && !array_key_exists('category', $array) ) { $array['category'] = $array['category_id']; }
|
48 |
|
49 |
if(is_array($array)){
|
50 |
+
//Clean all id lists
|
51 |
+
$array = self::clean_id_atts($array, array('location', 'event', 'category'));
|
52 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
//OrderBy - can be a comma-seperated array of field names to order by (field names of object, not db)
|
54 |
if( array_key_exists('orderby', $array)){
|
55 |
+
if( !is_array($array['orderby']) && preg_match('/,/', $array['orderby']) ) {
|
56 |
$array['orderby'] = explode(',', $array['orderby']);
|
57 |
}
|
58 |
}
|
92 |
$defaults['array'] = ($defaults['array'] == true);
|
93 |
$defaults['pagination'] = ($defaults['pagination'] == true);
|
94 |
$defaults['limit'] = (is_numeric($defaults['limit'])) ? $defaults['limit']:$super_defaults['limit'];
|
95 |
+
$defaults['offset'] = (is_numeric($defaults['offset'])) ? $defaults['offset']:$super_defaults['offset'];
|
96 |
$defaults['recurring'] = ($defaults['recurring'] == true);
|
97 |
+
//Calculate offset in event page is set
|
98 |
+
if($defaults['page'] > 1){
|
99 |
+
$defaults['offset'] = $defaults['limit'] * ($defaults['page']-1);
|
100 |
+
}else{
|
101 |
+
$defaults['page'] = ($defaults['limit'] > 0 ) ? floor($defaults['offset']/$defaults['limit']) + 1 : 1;
|
102 |
+
}
|
103 |
return apply_filters('em_object_get_default_search', $defaults, $array, $super_defaults);
|
104 |
}
|
105 |
|
121 |
$recurrence = $args['recurrence'];
|
122 |
$category = $args['category'];
|
123 |
$location = $args['location'];
|
124 |
+
$event = $args['event'];
|
125 |
$month = $args['month'];
|
126 |
$year = $args['year'];
|
127 |
$today = date('Y-m-d', current_time('timestamp'));
|
136 |
}else{
|
137 |
$conditions['recurring'] = "(`recurrence`!=1 OR `recurrence` IS NULL)";
|
138 |
}
|
139 |
+
//Dates - first check 'month', and 'year', and adjust scope if needed
|
140 |
if( !($month=='' && $year=='') ){
|
141 |
//Sort out month range, if supplied an array of array(month,month), it'll check between these two months
|
142 |
if( self::array_is_numeric($month) ){
|
152 |
}else{
|
153 |
$date_year_start = $date_year_end = $year;
|
154 |
}
|
155 |
+
$date_start = $date_year_start."-".$date_month_start."-01";
|
156 |
$date_end = date('Y-m-t', mktime(0,0,0,$date_month_end,1,$date_year_end));
|
157 |
+
$scope = "$date_start,$date_end"; //just modify the scope here
|
|
|
158 |
}
|
159 |
+
//No date requested, so let's look at scope
|
160 |
+
if ( preg_match ( "/^[0-9]{4}-[0-9]{2}-[0-9]{2},[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $scope ) ) {
|
161 |
+
//This is an array, let's split it up
|
162 |
+
$dates = explode(',', $scope);
|
163 |
+
$date_start = $dates[0];
|
164 |
+
$date_end = $dates[1];
|
165 |
+
$conditions['scope'] = " ( ( event_start_date <= CAST('$date_end' AS DATE) AND event_end_date >= CAST('$date_start' AS DATE) ) OR (event_start_date BETWEEN CAST('$date_start' AS DATE) AND CAST('$date_end' AS DATE)) OR (event_end_date BETWEEN CAST('$date_start' AS DATE) AND CAST('$date_end' AS DATE)) )";
|
166 |
+
} elseif ( preg_match ( "/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $scope ) ) {
|
167 |
+
//Scope can also be a specific date. However, if 'day', 'month', or 'year' are set, that will take precedence
|
168 |
+
$conditions['scope'] = " ( event_start_date = CAST('$scope' AS DATE) OR ( event_start_date <= CAST('$scope' AS DATE) AND event_end_date >= CAST('$scope' AS DATE) ) )";
|
169 |
+
} else {
|
170 |
+
if ($scope == "past"){
|
171 |
+
$conditions['scope'] = " event_start_date < '$today'";
|
172 |
+
}elseif ($scope == "today"){
|
173 |
+
$conditions['scope'] = " ( (event_start_date = CAST('$today' AS DATE)) OR (event_start_date <= CAST('$today' AS DATE) AND event_end_date >= CAST('$today' AS DATE)) )";
|
174 |
+
}elseif ($scope == "future" || $scope != 'all'){
|
175 |
+
$conditions['scope'] = " (event_start_date >= CAST('$today' AS DATE) OR (event_end_date >= CAST('$today' AS DATE) AND event_end_date != '0000-00-00' AND event_end_date IS NOT NULL))";
|
|
|
|
|
176 |
}
|
177 |
}
|
178 |
|
188 |
$location_ids[] = $EM_Location->id;
|
189 |
}
|
190 |
$conditions['location'] = "( {$locations_table}.location_id=". implode(" {$locations_table}.location_id=", $location_ids) ." )";
|
191 |
+
}
|
192 |
+
|
193 |
+
//Filter by Event - can be object, array, or id
|
194 |
+
if ( is_numeric($event) && $event > 0 ) { //event ID takes precedence
|
195 |
+
$conditions['event'] = " {$events_table}.event_id = $event";
|
196 |
+
}elseif ( self::array_is_numeric($event) ){ //array of ids
|
197 |
+
$conditions['event'] = "( {$events_table}.event_id = " . implode(" OR {$events_table}.event_id = ", $event) .' )';
|
198 |
+
}elseif ( is_object($event) && get_class($event)=='EM_Event' ){ //Now we deal with objects
|
199 |
+
$conditions['event'] = " {$events_table}.event_id = $event->id";
|
200 |
+
}elseif ( is_array($event) && @get_class(current($event)=='EM_Event') ){ //we can accept array of ids or EM_event objects
|
201 |
+
foreach($event as $EM_Event){
|
202 |
+
$event_ids[] = $EM_Event->id;
|
203 |
+
}
|
204 |
+
$conditions['event'] = "( {$events_table}.event_id=". implode(" {$events_table}.event_id=", $event_ids) ." )";
|
205 |
}
|
206 |
|
207 |
//Add conditions for category selection
|
208 |
//Filter by category, can be id or comma seperated ids
|
209 |
//TODO create an exclude category option
|
210 |
+
if ( is_numeric($category) && $category > 0 ){
|
211 |
$conditions['category'] = " event_category_id = $category";
|
212 |
}elseif( self::array_is_numeric($category) ){
|
213 |
$conditions['category'] = "( event_category_id = ". implode(' OR event_category_id = ', $category).")";
|
341 |
return apply_filters('em_object_sanitize', $value);
|
342 |
}
|
343 |
|
344 |
+
/**
|
345 |
+
* Cleans arrays that contain id lists. Takes an array of items and will clean the keys passed in second argument so that if they keep numbers, explode comma-seperated numbers, and unsets the key if there's any other value
|
346 |
+
* @param array $array
|
347 |
+
* @param array $id_atts
|
348 |
+
*/
|
349 |
+
function clean_id_atts( $array = array(), $id_atts = array() ){
|
350 |
+
if( is_array($array) && is_array($id_atts) ){
|
351 |
+
foreach( $array as $key => $string ){
|
352 |
+
if( in_array($key, $id_atts) ){
|
353 |
+
//This is in the list of atts we want cleaned
|
354 |
+
if( is_numeric($string) ){
|
355 |
+
$array[$key] = (int) $string;
|
356 |
+
}elseif( self::array_is_numeric($string) ){
|
357 |
+
$array[$key] = $string;
|
358 |
+
}elseif( preg_match('/^([0-9],?)+$/', $string) ){
|
359 |
+
$array[$key] = explode(',', $string);
|
360 |
+
}else{
|
361 |
+
//No format we accept
|
362 |
+
unset($array[$key]);
|
363 |
+
}
|
364 |
+
}
|
365 |
+
}
|
366 |
+
}
|
367 |
+
return $array;
|
368 |
+
}
|
369 |
+
|
370 |
/**
|
371 |
* Will return true if this is a simple (non-assoc) numeric array, meaning it has at one or more numeric entries and nothing else
|
372 |
* @param mixed $array
|
em-events.php
CHANGED
@@ -28,9 +28,11 @@ function em_content($content) {
|
|
28 |
$args['limit'] = get_option('dbem_events_default_limit');
|
29 |
$args['offset'] = $args['limit'] * ($page-1);
|
30 |
$content = EM_Events::output($events, apply_filters('em_content_calendar_day_output_args', $args) );
|
31 |
-
}
|
32 |
$EM_Event = $events[0];
|
33 |
$content = $EM_Event->output_single();
|
|
|
|
|
34 |
}
|
35 |
} elseif ( !empty($_REQUEST['location_id']) && is_numeric($_REQUEST['location_id']) ) {
|
36 |
//Just a single location
|
@@ -42,21 +44,22 @@ function em_content($content) {
|
|
42 |
$content = $event->output_single();
|
43 |
} else {
|
44 |
// Multiple events page
|
45 |
-
$scope = (!empty($_REQUEST['scope'])) ? EM_Object::sanitize($_REQUEST['scope']) : "future";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
if (get_option ( 'dbem_display_calendar_in_events_page' )){
|
47 |
-
$args =
|
|
|
48 |
$content = EM_Calendar::output( apply_filters('em_content_calendar_args', $args) );
|
49 |
}else{
|
50 |
-
|
51 |
-
$
|
52 |
-
$args =
|
53 |
-
'limit'=> get_option('dbem_events_default_limit'),
|
54 |
-
'orderby' => get_option('dbem_events_default_orderby'),
|
55 |
-
'order' => get_option('dbem_events_default_order'),
|
56 |
-
'scope' => $scope,
|
57 |
-
'pagination' => 1
|
58 |
-
);
|
59 |
-
$args['offset'] = $args['limit'] * ($page-1);
|
60 |
$content = EM_Events::output( apply_filters('em_content_events_args', $args) );
|
61 |
}
|
62 |
}
|
@@ -65,8 +68,9 @@ function em_content($content) {
|
|
65 |
$content = str_replace('#_PAGETITLE', em_events_page_title(''), get_option('dbem_title_html')) . $content;
|
66 |
}
|
67 |
//TODO FILTER - filter em page content before display
|
|
|
68 |
}
|
69 |
-
return
|
70 |
}
|
71 |
add_filter ( 'the_content', 'em_content' );
|
72 |
|
@@ -83,8 +87,7 @@ function em_events_page_title($content) {
|
|
83 |
if ( $post->ID == $events_page_id && $events_page_id != 0 ) {
|
84 |
if (isset ( $_REQUEST['calendar_day'] ) && $_REQUEST['calendar_day'] != '') {
|
85 |
$events = EM_Events::get(array('limit'=>2,'scope'=>$_REQUEST['calendar_day']));
|
86 |
-
|
87 |
-
if ( count($events) > 1 || get_option('dbem_display_calendar_day_single') == 1 ) {
|
88 |
//We only support dates for the calendar day list title, so we do a simple filter for the supplied calendar_day
|
89 |
$content = get_option ('dbem_list_date_title');
|
90 |
preg_match_all("/#[A-Za-z0-9]+/", $content, $placeholders);
|
@@ -95,6 +98,7 @@ function em_events_page_title($content) {
|
|
95 |
}
|
96 |
}
|
97 |
}else{
|
|
|
98 |
$content = $event->output( get_option('dbem_event_page_title_format') );
|
99 |
}
|
100 |
}elseif (isset ( $_REQUEST ['location_id'] ) && $_REQUEST ['location_id'] |= '') {
|
28 |
$args['limit'] = get_option('dbem_events_default_limit');
|
29 |
$args['offset'] = $args['limit'] * ($page-1);
|
30 |
$content = EM_Events::output($events, apply_filters('em_content_calendar_day_output_args', $args) );
|
31 |
+
} elseif( count($events) == 1 ) {
|
32 |
$EM_Event = $events[0];
|
33 |
$content = $EM_Event->output_single();
|
34 |
+
} else {
|
35 |
+
$content = get_option('dbem_no_events_message');
|
36 |
}
|
37 |
} elseif ( !empty($_REQUEST['location_id']) && is_numeric($_REQUEST['location_id']) ) {
|
38 |
//Just a single location
|
44 |
$content = $event->output_single();
|
45 |
} else {
|
46 |
// Multiple events page
|
47 |
+
$scope = ( !empty($_REQUEST['scope']) ) ? EM_Object::sanitize($_REQUEST['scope']) : "future";
|
48 |
+
//If we have a $_GET['page'] var, use it to calculate the offset/limit ratios (safer than offset/limit get vars)
|
49 |
+
$args = array(
|
50 |
+
'orderby' => get_option('dbem_events_default_orderby'),
|
51 |
+
'order' => get_option('dbem_events_default_order'),
|
52 |
+
'scope' => $scope
|
53 |
+
);
|
54 |
+
if ( !empty($_REQUEST['category_id']) ) $args['category'] = $_REQUEST['category_id'];
|
55 |
if (get_option ( 'dbem_display_calendar_in_events_page' )){
|
56 |
+
$args['full'] = 1;
|
57 |
+
$args['long_events'] = get_option('dbem_full_calendar_long_events');
|
58 |
$content = EM_Calendar::output( apply_filters('em_content_calendar_args', $args) );
|
59 |
}else{
|
60 |
+
$args['limit'] = get_option('dbem_events_default_limit');
|
61 |
+
$args['pagination'] = 1;
|
62 |
+
$args['page'] = ( !empty($_GET['page']) && is_numeric($_GET['page']) )? $_GET['page'] : 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
$content = EM_Events::output( apply_filters('em_content_events_args', $args) );
|
64 |
}
|
65 |
}
|
68 |
$content = str_replace('#_PAGETITLE', em_events_page_title(''), get_option('dbem_title_html')) . $content;
|
69 |
}
|
70 |
//TODO FILTER - filter em page content before display
|
71 |
+
return apply_filters('em_content', '<div id="em-wrapper">'.$content.'</div>');
|
72 |
}
|
73 |
+
return $content;
|
74 |
}
|
75 |
add_filter ( 'the_content', 'em_content' );
|
76 |
|
87 |
if ( $post->ID == $events_page_id && $events_page_id != 0 ) {
|
88 |
if (isset ( $_REQUEST['calendar_day'] ) && $_REQUEST['calendar_day'] != '') {
|
89 |
$events = EM_Events::get(array('limit'=>2,'scope'=>$_REQUEST['calendar_day']));
|
90 |
+
if ( count($events) != 1 || get_option('dbem_display_calendar_day_single') == 1 ) {
|
|
|
91 |
//We only support dates for the calendar day list title, so we do a simple filter for the supplied calendar_day
|
92 |
$content = get_option ('dbem_list_date_title');
|
93 |
preg_match_all("/#[A-Za-z0-9]+/", $content, $placeholders);
|
98 |
}
|
99 |
}
|
100 |
}else{
|
101 |
+
$event = array_shift($events);
|
102 |
$content = $event->output( get_option('dbem_event_page_title_format') );
|
103 |
}
|
104 |
}elseif (isset ( $_REQUEST ['location_id'] ) && $_REQUEST ['location_id'] |= '') {
|
em-functions.php
CHANGED
@@ -5,7 +5,7 @@ function em_hello_to_new_user() {
|
|
5 |
$advice = sprintf ( __ ( "<p>Hey, <strong>%s</strong>, welcome to <strong>Events Manager</strong>! We hope you like it around here.</p>
|
6 |
<p>Now it's time to insert events lists through <a href='%s' title='Widgets page'>widgets</a>, <a href='%s' title='Template tags documentation'>template tags</a> or <a href='%s' title='Shortcodes documentation'>shortcodes</a>.</p>
|
7 |
<p>By the way, have you taken a look at the <a href='%s' title='Change settings'>Settings page</a>? That's where you customize the way events and locations are displayed.</p>
|
8 |
-
<p>What? Tired of seeing this advice? I hear you, <a href='%s' title='Don't show this advice again'>click here</a> and you won't see this again!</p>", 'dbem' ), $current_user->display_name, get_bloginfo ( 'url' ) . '/wp-admin/widgets.php', 'http://wp-events-plugin.com/documentation/template-tags/', 'http://wp-events-plugin.com/documentation/shortcodes/', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager
|
9 |
?>
|
10 |
<div id="message" class="updated">
|
11 |
<?php echo $advice; ?>
|
@@ -41,8 +41,8 @@ function em_paginate($link, $total, $limit, $page=1, $pagesToShow=10){
|
|
41 |
}
|
42 |
}
|
43 |
//Add the forward and last buttons
|
44 |
-
$string .= ($
|
45 |
-
$string .= ($i < $maxPages) ? ' <a href="'.str_replace($placeholder,$maxPages,$link).'">>></a> ' : '>> ';
|
46 |
//Return the string
|
47 |
return $string;
|
48 |
}
|
@@ -53,14 +53,15 @@ function em_paginate($link, $total, $limit, $page=1, $pagesToShow=10){
|
|
53 |
* @param string $url
|
54 |
* @param array $params
|
55 |
*/
|
56 |
-
function em_add_get_params($url, $params=array()){
|
57 |
$has_querystring = (stristr($url, "?"));
|
58 |
$count = 0;
|
59 |
foreach($params as $key=>$value){
|
|
|
60 |
if( $count == 0 && !$has_querystring ){
|
61 |
-
$url .= "?{$key}="
|
62 |
}else{
|
63 |
-
$url .= "&{$key}="
|
64 |
}
|
65 |
$count++;
|
66 |
}
|
@@ -129,9 +130,9 @@ function em_options_input_text($title, $name, $description) {
|
|
129 |
<th scope="row"><?php _e($title, 'dbem') ?></th>
|
130 |
<td>
|
131 |
<input name="<?php echo $name ?>" type="text" id="<?php echo $title ?>" style="width: 95%" value="<?php echo htmlspecialchars(get_option($name), ENT_QUOTES); ?>" size="45" /><br />
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
<?php
|
136 |
}
|
137 |
function em_options_input_password($title, $name, $description) {
|
@@ -140,9 +141,9 @@ function em_options_input_password($title, $name, $description) {
|
|
140 |
<th scope="row"><?php _e($title, 'dbem') ?></th>
|
141 |
<td>
|
142 |
<input name="<?php echo $name ?>" type="password" id="<?php echo $title ?>" style="width: 95%" value="<?php echo get_option($name); ?>" size="45" /><br />
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
<?php
|
147 |
}
|
148 |
|
@@ -150,8 +151,10 @@ function em_options_textarea($title, $name, $description) {
|
|
150 |
?>
|
151 |
<tr valign="top" id='<?php echo $name;?>_row'>
|
152 |
<th scope="row"><?php _e($title,'dbem')?></th>
|
153 |
-
<td
|
154 |
-
<?php echo $
|
|
|
|
|
155 |
</tr>
|
156 |
<?php
|
157 |
}
|
@@ -161,10 +164,10 @@ function em_options_radio_binary($title, $name, $description) {
|
|
161 |
|
162 |
<tr valign="top" id='<?php echo $name;?>_row'>
|
163 |
<th scope="row"><?php _e($title,'dbem'); ?></th>
|
164 |
-
<td>
|
165 |
-
|
166 |
-
<input id="<?php echo $name ?>_no" name="<?php echo $name ?>" type="radio" value="0" <?php if(!$list_events_page) echo "checked='checked'"; ?>
|
167 |
-
|
168 |
</td>
|
169 |
</tr>
|
170 |
<?php
|
@@ -185,7 +188,7 @@ function em_options_select($title, $name, $list, $description) {
|
|
185 |
</option>
|
186 |
<?php endforeach; ?>
|
187 |
</select> <br/>
|
188 |
-
|
189 |
</td>
|
190 |
</tr>
|
191 |
<?php
|
5 |
$advice = sprintf ( __ ( "<p>Hey, <strong>%s</strong>, welcome to <strong>Events Manager</strong>! We hope you like it around here.</p>
|
6 |
<p>Now it's time to insert events lists through <a href='%s' title='Widgets page'>widgets</a>, <a href='%s' title='Template tags documentation'>template tags</a> or <a href='%s' title='Shortcodes documentation'>shortcodes</a>.</p>
|
7 |
<p>By the way, have you taken a look at the <a href='%s' title='Change settings'>Settings page</a>? That's where you customize the way events and locations are displayed.</p>
|
8 |
+
<p>What? Tired of seeing this advice? I hear you, <a href='%s' title='Don't show this advice again'>click here</a> and you won't see this again!</p>", 'dbem' ), $current_user->display_name, get_bloginfo ( 'url' ) . '/wp-admin/widgets.php', 'http://wp-events-plugin.com/documentation/template-tags/', 'http://wp-events-plugin.com/documentation/shortcodes/', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager&disable_hello_to_user=true' );
|
9 |
?>
|
10 |
<div id="message" class="updated">
|
11 |
<?php echo $advice; ?>
|
41 |
}
|
42 |
}
|
43 |
//Add the forward and last buttons
|
44 |
+
$string .= ($page < $maxPages) ? ' <a href="'.str_replace($placeholder,$page+1,$link).'">></a> ' :' > ' ;
|
45 |
+
$string .= ($i-1 < $maxPages) ? ' <a href="'.str_replace($placeholder,$maxPages,$link).'">>></a> ' : '>> ';
|
46 |
//Return the string
|
47 |
return $string;
|
48 |
}
|
53 |
* @param string $url
|
54 |
* @param array $params
|
55 |
*/
|
56 |
+
function em_add_get_params($url, $params=array(), $html=true, $encode=true){
|
57 |
$has_querystring = (stristr($url, "?"));
|
58 |
$count = 0;
|
59 |
foreach($params as $key=>$value){
|
60 |
+
$value = ($encode) ? urlencode($value):$value;
|
61 |
if( $count == 0 && !$has_querystring ){
|
62 |
+
$url .= "?{$key}=".$value;
|
63 |
}else{
|
64 |
+
$url .= ($html) ? "&{$key}=".$value:"&{$key}=".$value;
|
65 |
}
|
66 |
$count++;
|
67 |
}
|
130 |
<th scope="row"><?php _e($title, 'dbem') ?></th>
|
131 |
<td>
|
132 |
<input name="<?php echo $name ?>" type="text" id="<?php echo $title ?>" style="width: 95%" value="<?php echo htmlspecialchars(get_option($name), ENT_QUOTES); ?>" size="45" /><br />
|
133 |
+
<em><?php echo $description; ?></em>
|
134 |
+
</td>
|
135 |
+
</tr>
|
136 |
<?php
|
137 |
}
|
138 |
function em_options_input_password($title, $name, $description) {
|
141 |
<th scope="row"><?php _e($title, 'dbem') ?></th>
|
142 |
<td>
|
143 |
<input name="<?php echo $name ?>" type="password" id="<?php echo $title ?>" style="width: 95%" value="<?php echo get_option($name); ?>" size="45" /><br />
|
144 |
+
<em><?php echo $description; ?></em>
|
145 |
+
</td>
|
146 |
+
</tr>
|
147 |
<?php
|
148 |
}
|
149 |
|
151 |
?>
|
152 |
<tr valign="top" id='<?php echo $name;?>_row'>
|
153 |
<th scope="row"><?php _e($title,'dbem')?></th>
|
154 |
+
<td>
|
155 |
+
<textarea name="<?php echo $name ?>" id="<?php echo $name ?>" rows="6" cols="60"><?php echo htmlspecialchars(get_option($name), ENT_QUOTES);?></textarea><br/>
|
156 |
+
<em><?php echo $description; ?></em>
|
157 |
+
</td>
|
158 |
</tr>
|
159 |
<?php
|
160 |
}
|
164 |
|
165 |
<tr valign="top" id='<?php echo $name;?>_row'>
|
166 |
<th scope="row"><?php _e($title,'dbem'); ?></th>
|
167 |
+
<td>
|
168 |
+
<?php _e('Yes'); ?> <input id="<?php echo $name ?>_yes" name="<?php echo $name ?>" type="radio" value="1" <?php if($list_events_page) echo "checked='checked'"; ?> />
|
169 |
+
<?php _e('No'); ?> <input id="<?php echo $name ?>_no" name="<?php echo $name ?>" type="radio" value="0" <?php if(!$list_events_page) echo "checked='checked'"; ?> />
|
170 |
+
<br/><em><?php echo $description; ?></em>
|
171 |
</td>
|
172 |
</tr>
|
173 |
<?php
|
188 |
</option>
|
189 |
<?php endforeach; ?>
|
190 |
</select> <br/>
|
191 |
+
<em><?php echo $description; ?></em>
|
192 |
</td>
|
193 |
</tr>
|
194 |
<?php
|
em-install.php
CHANGED
@@ -62,7 +62,7 @@ function em_create_events_table() {
|
|
62 |
recurrence_freq tinytext NULL DEFAULT NULL,
|
63 |
recurrence_byday tinytext NULL DEFAULT NULL,
|
64 |
recurrence_byweekno int(4) NULL DEFAULT NULL,
|
65 |
-
|
66 |
) DEFAULT CHARSET=utf8 ;";
|
67 |
|
68 |
$old_table_name = $wpdb->prefix.EM_OLD_EVENTS_TABLE;
|
@@ -97,7 +97,7 @@ function em_create_locations_table() {
|
|
97 |
location_latitude float DEFAULT NULL,
|
98 |
location_longitude float DEFAULT NULL,
|
99 |
location_description text DEFAULT NULL,
|
100 |
-
|
101 |
) DEFAULT CHARSET=utf8 ;";
|
102 |
|
103 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
@@ -127,7 +127,7 @@ function em_create_bookings_table() {
|
|
127 |
booking_seats int(5) NOT NULL,
|
128 |
booking_comment text DEFAULT NULL,
|
129 |
booking_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
130 |
-
|
131 |
) DEFAULT CHARSET=utf8 ;";
|
132 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
133 |
dbDelta($sql);
|
@@ -143,7 +143,7 @@ function em_create_people_table() {
|
|
143 |
person_name tinytext NOT NULL,
|
144 |
person_email tinytext NOT NULL,
|
145 |
person_phone tinytext NOT NULL,
|
146 |
-
|
147 |
) DEFAULT CHARSET=utf8 ;";
|
148 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
149 |
dbDelta($sql);
|
@@ -175,31 +175,31 @@ function em_create_categories_table() {
|
|
175 |
|
176 |
|
177 |
function em_add_options() {
|
178 |
-
$contact_person_email_body_localizable = __("#
|
179 |
-
$respondent_email_body_localizable = __("Dear #
|
180 |
|
181 |
$dbem_options = array(
|
182 |
-
'dbem_event_list_item_format' => '<li>#j #M #Y - #H:#i<br/> #
|
183 |
'dbem_display_calendar_in_events_page' => 0,
|
184 |
-
'dbem_single_event_format' => '<h3>#_NAME</h3><p>#j #M #Y - #H:#i</p><p>#
|
185 |
'dbem_event_page_title_format' => '#_NAME',
|
186 |
'dbem_list_events_page' => 1,
|
187 |
'dbem_events_page_title' => __('Events','dbem'),
|
188 |
'dbem_no_events_message' => __('No events','dbem'),
|
189 |
-
'dbem_location_page_title_format' => '#
|
190 |
-
'dbem_location_baloon_format' => "<strong>#
|
191 |
-
'dbem_location_event_list_item_format' => "<li>#
|
192 |
-
'dbem_location_list_item_format' => '#_LOCATIONLINK<ul><li>#
|
193 |
'dbem_location_no_events_message' => __('<li>No events in this location</li>', 'dbem'),
|
194 |
-
'dbem_single_location_format' => '<p>#
|
195 |
-
'dbem_map_text_format' => '<strong>#_LOCATION</strong><p>#
|
196 |
'dbem_rss_main_title' => get_bloginfo('title')." - ".__('Events'),
|
197 |
'dbem_rss_main_description' => get_bloginfo('description')." - ".__('Events'),
|
198 |
-
'dbem_rss_description_format' => "#j #M #y - #H:#i <br/>#_LOCATION <br/>#
|
199 |
'dbem_rss_title_format' => "#_NAME",
|
200 |
'dbem_gmap_is_active'=> 1,
|
201 |
'dbem_default_contact_person' => 1,
|
202 |
-
'
|
203 |
'dbem_contactperson_email_body' => __(str_replace("<br/>", "\n\r", $contact_person_email_body_localizable)),
|
204 |
'dbem_respondent_email_body' => __(str_replace("<br/>", "\n\r", $respondent_email_body_localizable)),
|
205 |
'dbem_rsvp_mail_port' => 465,
|
@@ -211,7 +211,7 @@ function em_add_options() {
|
|
211 |
'dbem_image_max_height' => 700,
|
212 |
'dbem_image_max_size' => 204800,
|
213 |
'dbem_list_date_title' => __('Events', 'dbem').' - #j #M #y',
|
214 |
-
'dbem_full_calendar_event_format' => '<li>#
|
215 |
'dbem_full_calendar_long_events' => '0',
|
216 |
'dbem_small_calendar_event_title_format' => "#_NAME",
|
217 |
'dbem_small_calendar_event_title_separator' => ", ",
|
@@ -225,13 +225,18 @@ function em_add_options() {
|
|
225 |
'dbem_title_html' => '<h2>#_PAGETITLE</h2>',
|
226 |
'dbem_events_default_orderby' => 'start_date,start_time,name',
|
227 |
'dbem_events_default_order' => 'ASC',
|
228 |
-
'dbem_events_default_limit' => 10
|
|
|
|
|
229 |
);
|
230 |
|
231 |
foreach($dbem_options as $key => $value){
|
232 |
add_option($key, $value);
|
233 |
}
|
234 |
-
|
|
|
|
|
|
|
235 |
}
|
236 |
|
237 |
function em_create_events_page(){
|
62 |
recurrence_freq tinytext NULL DEFAULT NULL,
|
63 |
recurrence_byday tinytext NULL DEFAULT NULL,
|
64 |
recurrence_byweekno int(4) NULL DEFAULT NULL,
|
65 |
+
PRIMARY KEY (event_id)
|
66 |
) DEFAULT CHARSET=utf8 ;";
|
67 |
|
68 |
$old_table_name = $wpdb->prefix.EM_OLD_EVENTS_TABLE;
|
97 |
location_latitude float DEFAULT NULL,
|
98 |
location_longitude float DEFAULT NULL,
|
99 |
location_description text DEFAULT NULL,
|
100 |
+
PRIMARY KEY (location_id)
|
101 |
) DEFAULT CHARSET=utf8 ;";
|
102 |
|
103 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
127 |
booking_seats int(5) NOT NULL,
|
128 |
booking_comment text DEFAULT NULL,
|
129 |
booking_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
130 |
+
PRIMARY KEY (booking_id)
|
131 |
) DEFAULT CHARSET=utf8 ;";
|
132 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
133 |
dbDelta($sql);
|
143 |
person_name tinytext NOT NULL,
|
144 |
person_email tinytext NOT NULL,
|
145 |
person_phone tinytext NOT NULL,
|
146 |
+
PRIMARY KEY (person_id)
|
147 |
) DEFAULT CHARSET=utf8 ;";
|
148 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
149 |
dbDelta($sql);
|
175 |
|
176 |
|
177 |
function em_add_options() {
|
178 |
+
$contact_person_email_body_localizable = __("#_BOOKINGNAME (#_BOOKINGEMAIL) will attend #_NAME on #m #d, #Y. He wants to reserve #_BOOKINGSPACES spaces.<br/> Now there are #_BOOKEDSPACES spaces reserved, #_AVAILABLESPACES are still available.<br/>Yours faithfully,<br/>Events Manager",'dbem') ;
|
179 |
+
$respondent_email_body_localizable = __("Dear #_BOOKINGNAME, <br/>you have successfully reserved #_BOOKEDSPACES space/spaces for #_NAME.<br/>Yours faithfully,<br/>#_CONTACTNAME",'dbem');
|
180 |
|
181 |
$dbem_options = array(
|
182 |
+
'dbem_event_list_item_format' => '<li>#j #M #Y - #H:#i<br/> #_EVENTLINK<br/>#_LOCATIONTOWN </li>',
|
183 |
'dbem_display_calendar_in_events_page' => 0,
|
184 |
+
'dbem_single_event_format' => '<h3>#_NAME</h3><p>#j #M #Y - #H:#i</p><p>#_LOCATIONTOWN</p>',
|
185 |
'dbem_event_page_title_format' => '#_NAME',
|
186 |
'dbem_list_events_page' => 1,
|
187 |
'dbem_events_page_title' => __('Events','dbem'),
|
188 |
'dbem_no_events_message' => __('No events','dbem'),
|
189 |
+
'dbem_location_page_title_format' => '#_LOCATIONNAME',
|
190 |
+
'dbem_location_baloon_format' => "<strong>#_LOCATIONNAME</strong><br/>#_LOCATIONADDRESS - #_LOCATIONTOWN<br/><a href='#_LOCATIONPAGEURL'>Details</a>",
|
191 |
+
'dbem_location_event_list_item_format' => "<li>#_LOCATIONNAME - #j #M #Y - #H:#i</li>",
|
192 |
+
'dbem_location_list_item_format' => '#_LOCATIONLINK<ul><li>#_LOCATIONADDRESS</li><li>#_LOCATIONTOWN</li></ul>',
|
193 |
'dbem_location_no_events_message' => __('<li>No events in this location</li>', 'dbem'),
|
194 |
+
'dbem_single_location_format' => '<p>#_LOCATIONADDRESS</p><p>#_LOCATIONTOWN</p>',
|
195 |
+
'dbem_map_text_format' => '<strong>#_LOCATION</strong><p>#_LOCATIONADDRESS</p><p>#_LOCATIONTOWN</p>',
|
196 |
'dbem_rss_main_title' => get_bloginfo('title')." - ".__('Events'),
|
197 |
'dbem_rss_main_description' => get_bloginfo('description')." - ".__('Events'),
|
198 |
+
'dbem_rss_description_format' => "#j #M #y - #H:#i <br/>#_LOCATION <br/>#_LOCATIONADDRESS <br/>#_LOCATIONTOWN",
|
199 |
'dbem_rss_title_format' => "#_NAME",
|
200 |
'dbem_gmap_is_active'=> 1,
|
201 |
'dbem_default_contact_person' => 1,
|
202 |
+
'dbem_rsvp_notify_contact' => 1 ,
|
203 |
'dbem_contactperson_email_body' => __(str_replace("<br/>", "\n\r", $contact_person_email_body_localizable)),
|
204 |
'dbem_respondent_email_body' => __(str_replace("<br/>", "\n\r", $respondent_email_body_localizable)),
|
205 |
'dbem_rsvp_mail_port' => 465,
|
211 |
'dbem_image_max_height' => 700,
|
212 |
'dbem_image_max_size' => 204800,
|
213 |
'dbem_list_date_title' => __('Events', 'dbem').' - #j #M #y',
|
214 |
+
'dbem_full_calendar_event_format' => '<li>#_EVENTLINK</li>',
|
215 |
'dbem_full_calendar_long_events' => '0',
|
216 |
'dbem_small_calendar_event_title_format' => "#_NAME",
|
217 |
'dbem_small_calendar_event_title_separator' => ", ",
|
225 |
'dbem_title_html' => '<h2>#_PAGETITLE</h2>',
|
226 |
'dbem_events_default_orderby' => 'start_date,start_time,name',
|
227 |
'dbem_events_default_order' => 'ASC',
|
228 |
+
'dbem_events_default_limit' => 10,
|
229 |
+
//'dbem_bookings_approval' => 1,
|
230 |
+
'dbem_bookings_notify_admin' => ''
|
231 |
);
|
232 |
|
233 |
foreach($dbem_options as $key => $value){
|
234 |
add_option($key, $value);
|
235 |
}
|
236 |
+
//Customization for new options on updated plugins (not new installs)
|
237 |
+
if( get_option('dbem_version') != '' ){
|
238 |
+
//update_option('dbem_bookings_approval',0); //Previously in <3.0.9 bookings were never approvable
|
239 |
+
}
|
240 |
}
|
241 |
|
242 |
function em_create_events_page(){
|
em-shortcode.php
CHANGED
@@ -31,22 +31,61 @@ add_shortcode('locations-map', 'em_get_locations_map_shortcode'); //Depreciate t
|
|
31 |
* @param array $atts
|
32 |
* @return string
|
33 |
*/
|
34 |
-
function em_get_events_list_shortcode($atts) {
|
35 |
-
//TODO sort out attributes so it's consistent everywhere
|
36 |
$atts = (array) $atts;
|
|
|
|
|
|
|
|
|
37 |
return EM_Events::output( $atts );
|
38 |
}
|
39 |
add_shortcode ( 'events_list', 'em_get_events_list_shortcode' );
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* Returns list of locations according to given specifications. Accepts any location query attribute.
|
43 |
*/
|
44 |
-
function em_get_locations_list_shortcode( $atts ){
|
45 |
$atts = (array) $atts;
|
|
|
|
|
|
|
|
|
46 |
return EM_Locations::output( $atts );
|
47 |
}
|
48 |
add_shortcode('locations_list', 'em_get_locations_list_shortcode');
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
/**
|
51 |
* DO NOT DOCUMENT! This should be replaced with shortcodes events-link and events_uri
|
52 |
* @param array $atts
|
31 |
* @param array $atts
|
32 |
* @return string
|
33 |
*/
|
34 |
+
function em_get_events_list_shortcode($atts, $format='') {
|
|
|
35 |
$atts = (array) $atts;
|
36 |
+
$atts['format'] = ($format != '' || empty($atts['format'])) ? $format : $atts['format'];
|
37 |
+
$atts['format'] = html_entity_decode($atts['format']); //shorcode doesn't accept html
|
38 |
+
$atts['page'] = ( !empty($atts['page']) && is_numeric($atts['page']) )? $atts['page'] : 1;
|
39 |
+
$atts['page'] = ( !empty($_GET['page']) && is_numeric($_GET['page']) )? $_GET['page'] : $atts['page'];
|
40 |
return EM_Events::output( $atts );
|
41 |
}
|
42 |
add_shortcode ( 'events_list', 'em_get_events_list_shortcode' );
|
43 |
|
44 |
+
/**
|
45 |
+
* Shows a list of events according to given specifications. Accepts any event query attribute.
|
46 |
+
* @param array $atts
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
function em_get_event_shortcode($atts, $format='') {
|
50 |
+
$atts = (array) $atts;
|
51 |
+
$atts['format'] = ($format != '' || empty($atts['format'])) ? $format : $atts['format'];
|
52 |
+
$atts['format'] = html_entity_decode($atts['format']); //shorcode doesn't accept html
|
53 |
+
if( !empty($atts['event']) && is_numeric($atts['event']) ){
|
54 |
+
$EM_Event = new EM_Event($atts['event']);
|
55 |
+
return ( !empty($atts['format']) ) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
|
56 |
+
}
|
57 |
+
}
|
58 |
+
add_shortcode ( 'event', 'em_get_event_shortcode' );
|
59 |
+
|
60 |
/**
|
61 |
* Returns list of locations according to given specifications. Accepts any location query attribute.
|
62 |
*/
|
63 |
+
function em_get_locations_list_shortcode( $atts, $format='' ) {
|
64 |
$atts = (array) $atts;
|
65 |
+
$atts['format'] = ($format != '' || empty($atts['format'])) ? $format : $atts['format'];
|
66 |
+
$atts['format'] = html_entity_decode($atts['format']); //shorcode doesn't accept html
|
67 |
+
$atts['page'] = ( !empty($atts['page']) && is_numeric($atts['page']) )? $atts['page'] : 1;
|
68 |
+
$atts['page'] = ( !empty($_GET['page']) && is_numeric($_GET['page']) )? $_GET['page'] : $atts['page'];
|
69 |
return EM_Locations::output( $atts );
|
70 |
}
|
71 |
add_shortcode('locations_list', 'em_get_locations_list_shortcode');
|
72 |
|
73 |
+
/**
|
74 |
+
* Shows a single location according to given specifications. Accepts any event query attribute.
|
75 |
+
* @param array $atts
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
function em_get_location_shortcode($atts, $format='') {
|
79 |
+
$atts = (array) $atts;
|
80 |
+
$atts['format'] = ($format != '' || empty($atts['format'])) ? $format : $atts['format'];
|
81 |
+
$atts['format'] = html_entity_decode($atts['format']); //shorcode doesn't accept html
|
82 |
+
if( !empty($atts['location']) && is_numeric($atts['location']) ){
|
83 |
+
$EM_Location = new EM_Location($atts['location']);
|
84 |
+
return ( !empty($atts['format']) ) ? $EM_Location->output($atts['format']) : $EM_Location->output_single();
|
85 |
+
}
|
86 |
+
}
|
87 |
+
add_shortcode ( 'location', 'em_get_location_shortcode' );
|
88 |
+
|
89 |
/**
|
90 |
* DO NOT DOCUMENT! This should be replaced with shortcodes events-link and events_uri
|
91 |
* @param array $atts
|
events-manager.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Events Manager
|
4 |
-
Version: 3.0.
|
5 |
Plugin URI: http://wp-events-plugin.com
|
6 |
Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
|
7 |
Author: Davide Benini, Marcus Sykes
|
@@ -75,6 +75,7 @@ if( is_admin() ){
|
|
75 |
include_once('admin/em-admin.php');
|
76 |
include_once('admin/em-bookings.php');
|
77 |
include_once('admin/em-categories.php');
|
|
|
78 |
include_once('admin/em-event.php');
|
79 |
include_once('admin/em-events.php');
|
80 |
include_once('admin/em-help.php');
|
@@ -85,7 +86,7 @@ if( is_admin() ){
|
|
85 |
|
86 |
|
87 |
// Setting constants
|
88 |
-
define('EM_VERSION', 3.
|
89 |
define('EM_CATEGORIES_TABLE', 'em_categories'); //TABLE NAME
|
90 |
define('EM_EVENTS_TABLE','em_events'); //TABLE NAME
|
91 |
define('EM_RECURRENCE_TABLE','dbem_recurrence'); //TABLE NAME
|
@@ -175,16 +176,16 @@ add_filter( 'plugin_row_meta', 'em_set_plugin_meta', 10, 2 );
|
|
175 |
function em_create_events_submenu () {
|
176 |
if(function_exists('add_submenu_page')) {
|
177 |
//TODO Add flexible permissions
|
178 |
-
add_object_page(__('Events', 'dbem'),__('Events', 'dbem'),EM_MIN_CAPABILITY,
|
179 |
// Add a submenu to the custom top-level menu:
|
180 |
$plugin_pages = array();
|
181 |
-
$plugin_pages[] = add_submenu_page(
|
182 |
-
$plugin_pages[] = add_submenu_page(
|
183 |
-
$plugin_pages[] = add_submenu_page(
|
184 |
-
$plugin_pages[] = add_submenu_page(
|
185 |
-
$plugin_pages[] = add_submenu_page(
|
186 |
-
$plugin_pages[] = add_submenu_page(
|
187 |
-
$plugin_pages[] = add_submenu_page(
|
188 |
foreach($plugin_pages as $plugin_page){
|
189 |
add_action( 'admin_print_scripts-'. $plugin_page, 'em_admin_load_scripts' );
|
190 |
add_action( 'admin_head-'. $plugin_page, 'em_admin_general_script' );
|
@@ -212,7 +213,7 @@ add_action ( 'template_redirect', 'em_enqueue_public' );
|
|
212 |
*/
|
213 |
function em_favorite_menu($actions) {
|
214 |
// add quick link to our favorite plugin
|
215 |
-
$actions ['admin.php?page=
|
216 |
return $actions;
|
217 |
}
|
218 |
add_filter ( 'favorite_actions', 'em_favorite_menu' );
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Events Manager
|
4 |
+
Version: 3.0.9
|
5 |
Plugin URI: http://wp-events-plugin.com
|
6 |
Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
|
7 |
Author: Davide Benini, Marcus Sykes
|
75 |
include_once('admin/em-admin.php');
|
76 |
include_once('admin/em-bookings.php');
|
77 |
include_once('admin/em-categories.php');
|
78 |
+
include_once('admin/em-docs.php');
|
79 |
include_once('admin/em-event.php');
|
80 |
include_once('admin/em-events.php');
|
81 |
include_once('admin/em-help.php');
|
86 |
|
87 |
|
88 |
// Setting constants
|
89 |
+
define('EM_VERSION', 3.09); //self expanatory
|
90 |
define('EM_CATEGORIES_TABLE', 'em_categories'); //TABLE NAME
|
91 |
define('EM_EVENTS_TABLE','em_events'); //TABLE NAME
|
92 |
define('EM_RECURRENCE_TABLE','dbem_recurrence'); //TABLE NAME
|
176 |
function em_create_events_submenu () {
|
177 |
if(function_exists('add_submenu_page')) {
|
178 |
//TODO Add flexible permissions
|
179 |
+
add_object_page(__('Events', 'dbem'),__('Events', 'dbem'),EM_MIN_CAPABILITY,'events-manager','em_admin_events_page', '../wp-content/plugins/events-manager/includes/images/calendar-16.png');
|
180 |
// Add a submenu to the custom top-level menu:
|
181 |
$plugin_pages = array();
|
182 |
+
$plugin_pages[] = add_submenu_page('events-manager', __('Edit'),__('Edit'),EM_MIN_CAPABILITY,'events-manager','em_admin_events_page');
|
183 |
+
$plugin_pages[] = add_submenu_page('events-manager', __('Add new', 'dbem'), __('Add new','dbem'), EM_MIN_CAPABILITY, 'events-manager-event', "em_admin_event_page");
|
184 |
+
$plugin_pages[] = add_submenu_page('events-manager', __('Locations', 'dbem'), __('Locations', 'dbem'), EM_MIN_CAPABILITY, 'events-manager-locations', "em_admin_locations_page");
|
185 |
+
$plugin_pages[] = add_submenu_page('events-manager', __('People', 'dbem'), __('People', 'dbem'), EM_MIN_CAPABILITY, 'events-manager-people', "em_admin_people_page");
|
186 |
+
$plugin_pages[] = add_submenu_page('events-manager', __('Event Categories','dbem'),__('Categories','dbem'), EM_SETTING_CAPABILITY, "events-manager-categories", 'em_admin_categories_page');
|
187 |
+
$plugin_pages[] = add_submenu_page('events-manager', __('Events Manager Settings','dbem'),__('Settings','dbem'), EM_SETTING_CAPABILITY, "events-manager-options", 'em_admin_options_page');
|
188 |
+
$plugin_pages[] = add_submenu_page('events-manager', __('Getting Help for Events Manager','dbem'),__('Help','dbem'), EM_SETTING_CAPABILITY, "events-manager-help", 'em_admin_help_page');
|
189 |
foreach($plugin_pages as $plugin_page){
|
190 |
add_action( 'admin_print_scripts-'. $plugin_page, 'em_admin_load_scripts' );
|
191 |
add_action( 'admin_head-'. $plugin_page, 'em_admin_general_script' );
|
213 |
*/
|
214 |
function em_favorite_menu($actions) {
|
215 |
// add quick link to our favorite plugin
|
216 |
+
$actions ['admin.php?page=events-manager-event'] = array (__ ( 'Add an event', 'dbem' ), EM_MIN_CAPABILITY );
|
217 |
return $actions;
|
218 |
}
|
219 |
add_filter ( 'favorite_actions', 'em_favorite_menu' );
|
includes/css/events_manager.css
CHANGED
@@ -129,6 +129,10 @@ table.fullcalendar td {
|
|
129 |
list-style: none;
|
130 |
}
|
131 |
|
|
|
|
|
|
|
|
|
132 |
/*
|
133 |
Maps - if the info balloons don't look right on your site, chances are it's a CSS issue.
|
134 |
Google is VERY sensitive to CSS rules for the infowindows, making it hard to accommodate every theme in WP.
|
@@ -143,4 +147,4 @@ Please edit your theme's CSS to override this
|
|
143 |
height:auto !important;
|
144 |
max-height:none !important;
|
145 |
}
|
146 |
-
.em-location-map img, .em-locations-map img { max-width:none !important; }
|
129 |
list-style: none;
|
130 |
}
|
131 |
|
132 |
+
div.em-calendar-wrapper { position:relative; }
|
133 |
+
div#em-loading { position:absolute; width:100%; height:100%; background:#FFFFFF url(../images/loading.gif) 50% 50% no-repeat; left:0px; top:0px; opacity:0.8; filter:alpha(opacity=80)}
|
134 |
+
|
135 |
+
|
136 |
/*
|
137 |
Maps - if the info balloons don't look right on your site, chances are it's a CSS issue.
|
138 |
Google is VERY sensitive to CSS rules for the infowindows, making it hard to accommodate every theme in WP.
|
147 |
height:auto !important;
|
148 |
max-height:none !important;
|
149 |
}
|
150 |
+
.em-location-map img, .em-locations-map img { max-width:none !important; background:none !important; border:none !important; margin:0 !important; padding:0 !important; height:auto !important; width:auto !important; }
|
includes/css/events_manager_admin.css
CHANGED
@@ -50,4 +50,12 @@ p#recurrence_warning {
|
|
50 |
}
|
51 |
div#icon-events{
|
52 |
background:url('../images/calendar-32.png') no-repeat center;
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
div#icon-events{
|
52 |
background:url('../images/calendar-32.png') no-repeat center;
|
53 |
+
}
|
54 |
+
|
55 |
+
/*Help Docs*/
|
56 |
+
.em-docs h3 a { font-size:16px; padding:20px 0px 10px; text-decoration:underline; display:block; }
|
57 |
+
.em-docs dl, .em-docs h2, .em-docs h3, .em-docs h4, .em-docs dl { clear:left; }
|
58 |
+
.em-docs dl dt { display:block; float:left; min-width:160px; margin-right:10px; }
|
59 |
+
.em-docs dl dd { display:block; margin-left:170px; }
|
60 |
+
.em-docs-atts dl dt { min-width:110px !important; }
|
61 |
+
.em-docs-atts dl dd { margin-left:120px !important; }
|
includes/css/images/loading.gif
ADDED
Binary file
|
includes/images/loading.gif
ADDED
Binary file
|
includes/js/em_admin.js
CHANGED
@@ -5,11 +5,11 @@ jQuery(document).ready( function($) {
|
|
5 |
idToRemove = (jQuery(this).parents('tr:first').attr('id').split("-"))[1];
|
6 |
$.ajax({
|
7 |
type: "POST",
|
8 |
-
url: "admin.php?page=people&action=remove_booking",
|
9 |
data: "booking_id="+ idToRemove,
|
10 |
success: function(){
|
11 |
$('tr#booking-' + idToRemove).fadeOut('slow');
|
12 |
-
$.getJSON("admin.php?page=people&dbem_ajax_action=booking_data",{id: eventId, ajax: 'true'}, function(data){
|
13 |
booked = data[0].bookedSeats;
|
14 |
available = data[0].availableSeats;
|
15 |
$('td#booked-seats').text(booked);
|
@@ -111,7 +111,7 @@ jQuery(document).ready( function($) {
|
|
111 |
}
|
112 |
});
|
113 |
*/
|
114 |
-
$( "#eventForm input#location-name" ).autocomplete( '../wp-content/plugins/events-manager/admin/locations-search.php', {
|
115 |
multiple: true,
|
116 |
width: 350,
|
117 |
scroll:false,
|
5 |
idToRemove = (jQuery(this).parents('tr:first').attr('id').split("-"))[1];
|
6 |
$.ajax({
|
7 |
type: "POST",
|
8 |
+
url: "admin.php?page=events-manager-people&action=remove_booking",
|
9 |
data: "booking_id="+ idToRemove,
|
10 |
success: function(){
|
11 |
$('tr#booking-' + idToRemove).fadeOut('slow');
|
12 |
+
$.getJSON("admin.php?page=events-manager-people&dbem_ajax_action=booking_data",{id: eventId, ajax: 'true'}, function(data){
|
13 |
booked = data[0].bookedSeats;
|
14 |
available = data[0].availableSeats;
|
15 |
$('td#booked-seats').text(booked);
|
111 |
}
|
112 |
});
|
113 |
*/
|
114 |
+
$( "#eventForm input#location-name" ).autocomplete( '../wp-content/plugins/events-manager/admin/em-locations-search.php', {
|
115 |
multiple: true,
|
116 |
width: 350,
|
117 |
scroll:false,
|
includes/js/em_calendar_ajax.js
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
//inserted at wp_head
|
2 |
jQuery(document).ready( function($) {
|
|
|
|
|
3 |
$('a.em-calnav, a.em-calnav').live('click', function(e){
|
4 |
e.preventDefault();
|
|
|
5 |
$(this).parents('.em-calendar-wrapper').first().load($(this).attr('href'));
|
6 |
} );
|
|
|
|
|
7 |
});
|
1 |
//inserted at wp_head
|
2 |
jQuery(document).ready( function($) {
|
3 |
+
|
4 |
+
|
5 |
$('a.em-calnav, a.em-calnav').live('click', function(e){
|
6 |
e.preventDefault();
|
7 |
+
$(this).parents('.em-calendar-wrapper').first().prepend('<div class="loading" id="em-loading"></div>');
|
8 |
$(this).parents('.em-calendar-wrapper').first().load($(this).attr('href'));
|
9 |
} );
|
10 |
+
|
11 |
+
|
12 |
});
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: nutsmuggler, netweblogic
|
|
3 |
Donate link: http://wp-events-plugin.com
|
4 |
Tags: events, manager, calendar, gigs, concert, maps, geotagging, rsvp
|
5 |
Requires at least: 2.9
|
6 |
-
Tested up to: 3.0.
|
7 |
-
Stable tag: 3.0.
|
8 |
|
9 |
Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
|
10 |
|
@@ -115,7 +115,14 @@ At this stage, Events Manager is only available in English and Italian. Yet, the
|
|
115 |
* shortcodes now accept html within format attribute or within the shortcode tags [like]<p>this</p>[/like]
|
116 |
* fixed pagination functionality (or lack thereof) in shortcodes
|
117 |
* improved user experience when navigating/editing events in admin area
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
= 3.0.81 =
|
121 |
* Fixed pagination bugs
|
3 |
Donate link: http://wp-events-plugin.com
|
4 |
Tags: events, manager, calendar, gigs, concert, maps, geotagging, rsvp
|
5 |
Requires at least: 2.9
|
6 |
+
Tested up to: 3.0.4
|
7 |
+
Stable tag: 3.0.9
|
8 |
|
9 |
Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
|
10 |
|
115 |
* shortcodes now accept html within format attribute or within the shortcode tags [like]<p>this</p>[/like]
|
116 |
* fixed pagination functionality (or lack thereof) in shortcodes
|
117 |
* improved user experience when navigating/editing events in admin area
|
118 |
+
* added #_CONTACTAVATAR placeholder - avatar for contact person
|
119 |
+
* ajax loading spinner graphic added to calendars
|
120 |
+
* internal wp_mail support added
|
121 |
+
* added "all events" link to events widget
|
122 |
+
* fixed date translations
|
123 |
+
* cleaned up the settings page documentation and added placeholder docs on help page.
|
124 |
+
* fixed "enable notification emails" option in settings
|
125 |
+
* added admin email option that would be send every event booking to admin
|
126 |
|
127 |
= 3.0.81 =
|
128 |
* Fixed pagination bugs
|
widgets/em-events.php
CHANGED
@@ -31,7 +31,12 @@ class EM_Widget extends WP_Widget {
|
|
31 |
}else{
|
32 |
echo '<li>'.__('No events', 'dbem').'</li>';
|
33 |
}
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
echo $args['after_widget'];
|
37 |
}
|
@@ -49,7 +54,7 @@ class EM_Widget extends WP_Widget {
|
|
49 |
'orderby' => 'start_date,start_time,name'
|
50 |
);
|
51 |
foreach($defaults as $key => $value){
|
52 |
-
if($new_instance[$key]
|
53 |
$new_instance[$key] = $value;
|
54 |
}
|
55 |
}
|
@@ -65,8 +70,20 @@ class EM_Widget extends WP_Widget {
|
|
65 |
</p>
|
66 |
<p>
|
67 |
<label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Number of events','dbem'); ?>: </label>
|
68 |
-
<input type="text" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" value="<?php echo $instance['limit']; ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
</p>
|
|
|
70 |
<p>
|
71 |
<label for="<?php echo $this->get_field_id('scope'); ?>"><?php _e('Scope of the events','dbem'); ?>:</label><br/>
|
72 |
<select id="<?php echo $this->get_field_id('scope'); ?>" name="<?php echo $this->get_field_name('scope'); ?>" >
|
@@ -87,7 +104,7 @@ class EM_Widget extends WP_Widget {
|
|
87 |
));
|
88 |
?>
|
89 |
<?php foreach($orderby_options as $key => $value) : ?>
|
90 |
-
<option value='<?php echo $key ?>' <?php echo ($key == $instance['orderby']) ? "selected='selected'" : ''; ?>>
|
91 |
<?php echo $value; ?>
|
92 |
</option>
|
93 |
<?php endforeach; ?>
|
@@ -113,6 +130,14 @@ class EM_Widget extends WP_Widget {
|
|
113 |
<label for="<?php echo $this->get_field_id('format'); ?>"><?php _e('List item format','dbem'); ?>: </label>
|
114 |
<textarea rows="5" cols="24" id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>"><?php echo $instance['format']; ?></textarea>
|
115 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
<?php
|
117 |
}
|
118 |
}
|
31 |
}else{
|
32 |
echo '<li>'.__('No events', 'dbem').'</li>';
|
33 |
}
|
34 |
+
if ( !empty($instance['all_events']) ){
|
35 |
+
$events_link = (!empty($instance['all_events_link'])) ? em_get_link($instance['all_events_link']) : em_get_link(__('all events','dbem'));
|
36 |
+
echo '<li>'.$events_link.'</li>';
|
37 |
+
}
|
38 |
+
echo "</ul>";
|
39 |
+
|
40 |
|
41 |
echo $args['after_widget'];
|
42 |
}
|
54 |
'orderby' => 'start_date,start_time,name'
|
55 |
);
|
56 |
foreach($defaults as $key => $value){
|
57 |
+
if( !empty($new_instance[$key]) ){
|
58 |
$new_instance[$key] = $value;
|
59 |
}
|
60 |
}
|
70 |
</p>
|
71 |
<p>
|
72 |
<label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Number of events','dbem'); ?>: </label>
|
73 |
+
<input type="text" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" size="3" value="<?php echo $instance['limit']; ?>" />
|
74 |
+
</p>
|
75 |
+
<!--
|
76 |
+
<p>
|
77 |
+
<label for="<?php echo $this->get_field_id('limit_time'); ?>"><?php _e('Time Limit','dbem'); ?>: </label><br/>
|
78 |
+
<select id="<?php echo $this->get_field_id('time_scope'); ?>" name="<?php echo $this->get_field_name('time_scope'); ?>" >
|
79 |
+
<option value="this-month" <?php echo (!empty($instance['time_scope']) && $instance['time_scope'] == 'this-month') ? 'selected="selected"':''; ?>><?php _e('This Month','dbem'); ?></option>
|
80 |
+
<option value="two-months" <?php echo (!empty($instance['time_scope']) && $instance['time_scope'] == 'two-months') ? 'selected="selected"':''; ?>><?php _e('Next two months','dbem'); ?></option>
|
81 |
+
<option value="three-months" <?php echo (!empty($instance['time_scope']) && $instance['time_scope'] == 'three-months') ? 'selected="selected"':''; ?>><?php _e('Next three month','dbem'); ?></option>
|
82 |
+
<option value="six-months" <?php echo (!empty($instance['time_scope']) && $instance['time_scope'] == 'six-months') ? 'selected="selected"':''; ?>><?php _e('Next six month','dbem'); ?></option>
|
83 |
+
<option value="twelve-months" <?php echo (!empty($instance['time_scope']) && $instance['time_scope'] == 'twelve-months') ? 'selected="selected"':''; ?>><?php _e('Next twelve month','dbem'); ?></option>
|
84 |
+
</select>
|
85 |
</p>
|
86 |
+
-->
|
87 |
<p>
|
88 |
<label for="<?php echo $this->get_field_id('scope'); ?>"><?php _e('Scope of the events','dbem'); ?>:</label><br/>
|
89 |
<select id="<?php echo $this->get_field_id('scope'); ?>" name="<?php echo $this->get_field_name('scope'); ?>" >
|
104 |
));
|
105 |
?>
|
106 |
<?php foreach($orderby_options as $key => $value) : ?>
|
107 |
+
<option value='<?php echo $key ?>' <?php echo ( !empty($instance['orderby']) && $key == $instance['orderby']) ? "selected='selected'" : ''; ?>>
|
108 |
<?php echo $value; ?>
|
109 |
</option>
|
110 |
<?php endforeach; ?>
|
130 |
<label for="<?php echo $this->get_field_id('format'); ?>"><?php _e('List item format','dbem'); ?>: </label>
|
131 |
<textarea rows="5" cols="24" id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>"><?php echo $instance['format']; ?></textarea>
|
132 |
</p>
|
133 |
+
<p>
|
134 |
+
<label for="<?php echo $this->get_field_id('all_events'); ?>"><?php _e('Show all events link at bottom?','dbem'); ?>: </label>
|
135 |
+
<input type="checkbox" id="<?php echo $this->get_field_id('all_events'); ?>" name="<?php echo $this->get_field_name('all_events'); ?>" <?php echo (!empty($instance['all_events']) && $instance['all_events']) ? 'checked':''; ?> >
|
136 |
+
</p>
|
137 |
+
<p>
|
138 |
+
<label for="<?php echo $this->get_field_id('all_events'); ?>"><?php _e('All events link text?','dbem'); ?>: </label>
|
139 |
+
<input type="text" id="<?php echo $this->get_field_id('all_events_text'); ?>" name="<?php echo $this->get_field_name('all_events_text'); ?>" value="<?php echo (!empty($instance['all_events_text'])) ? $instance['all_events_text']:__('all events','dbem'); ?>" >
|
140 |
+
</p>
|
141 |
<?php
|
142 |
}
|
143 |
}
|