Events Manager - Version 3.0.81

Version Description

  • Fixed pagination bugs
  • Global locations map won't show locations with 0-0 coords
  • Fixed bug in recurrence description
  • Removed most (if not all) php warnings
  • Fixed booked seats calculation errors
  • Removed dependence on php calendar
Download this release

Release Info

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

Code changes from version 3.0.8 to 3.0.81

Files changed (45) hide show
  1. admin/{admin.php → em-admin.php} +0 -0
  2. admin/{bookings.php → em-bookings.php} +3 -3
  3. admin/{categories.php → em-categories.php} +9 -9
  4. admin/{event.php → em-event.php} +8 -8
  5. admin/{events.php → em-events.php} +21 -21
  6. admin/{help.php → em-help.php} +0 -0
  7. admin/{locations-search.php → em-locations-search.php} +0 -0
  8. admin/em-locations.php +237 -0
  9. admin/em-options.php +315 -0
  10. admin/{people.php → em-people.php} +0 -0
  11. admin/locations.php +0 -305
  12. admin/options.php +0 -315
  13. classes/{booking.php → em-booking.php} +0 -0
  14. classes/{bookings.php → em-bookings.php} +5 -4
  15. classes/{calendar.php → em-calendar.php} +5 -5
  16. classes/{category.php → em-category.php} +0 -0
  17. classes/{event.php → em-event.php} +115 -79
  18. classes/{events.php → em-events.php} +46 -19
  19. classes/{location.php → em-location.php} +32 -24
  20. classes/{locations.php → em-locations.php} +18 -10
  21. classes/{mailer.php → em-mailer.php} +0 -0
  22. classes/{map.php → em-map.php} +7 -3
  23. classes/{object.php → em-object.php} +43 -32
  24. classes/{people.php → em-people.php} +0 -0
  25. classes/{person.php → em-person.php} +0 -0
  26. classes/{recurrence.php → em-recurrence.php} +0 -0
  27. ajax.php → em-ajax.php +0 -0
  28. bookings.php → em-bookings.php +7 -7
  29. events.php → em-events.php +26 -15
  30. functions.php → em-functions.php +31 -29
  31. install.php → em-install.php +0 -0
  32. em-rss.php +38 -0
  33. shortcode.php → em-shortcode.php +1 -1
  34. template-tags-depreciated.php → em-template-tags-depreciated.php +66 -0
  35. template-tags.php → em-template-tags.php +0 -0
  36. events-manager.php +42 -43
  37. includes/css/events_manager.css +0 -11
  38. includes/css/events_manager_admin.css +10 -0
  39. includes/js/em_maps.js +18 -16
  40. locations.php +0 -75
  41. readme.txt +20 -4
  42. rss.php +0 -43
  43. widgets/{calendar.php → em-calendar.php} +0 -0
  44. widgets/{events.php → em-events.php} +0 -0
  45. widgets/{locations.php → em-locations.php} +0 -0
admin/{admin.php → em-admin.php} RENAMED
File without changes
admin/{bookings.php → em-bookings.php} RENAMED
@@ -3,7 +3,7 @@
3
* Check if there's any actions to take for bookings
4
* @return null
5
*/
6
- function dbem_admin_actions_bookings() {
7
global $dbem_form_add_message;
8
global $dbem_form_delete_message;
9
global $wpdb;
@@ -18,13 +18,13 @@ function dbem_admin_actions_bookings() {
18
}
19
}
20
}
21
- add_action('init','dbem_admin_actions_bookings');
22
23
/**
24
* Shows table of bookings for an event
25
* @return null
26
*/
27
- function dbem_bookings_table() {
28
global $EM_Event;
29
?>
30
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
3
* Check if there's any actions to take for bookings
4
* @return null
5
*/
6
+ function em_admin_actions_bookings() {
7
global $dbem_form_add_message;
8
global $dbem_form_delete_message;
9
global $wpdb;
18
}
19
}
20
}
21
+ add_action('init','em_admin_actions_bookings');
22
23
/**
24
* Shows table of bookings for an event
25
* @return null
26
*/
27
+ function em_bookings_table() {
28
global $EM_Event;
29
?>
30
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
admin/{categories.php → em-categories.php} RENAMED
@@ -1,10 +1,10 @@
1
<?php
2
- function dbem_categories_subpanel() {
3
global $wpdb;
4
5
if(isset($_GET['action']) && $_GET['action'] == "edit") {
6
// edit category
7
- dbem_categories_edit_layout();
8
} else {
9
// Insert/Update/Delete Record
10
$categories_table = $wpdb->prefix.EM_CATEGORIES_TABLE;
@@ -32,20 +32,20 @@ function dbem_categories_subpanel() {
32
}
33
}
34
//die(print_r($_POST));
35
- if ( is_numeric($validation_result) ) {
36
$message = (isset($message)) ? $message : __("Successfully {$_POST['action']}ed category", "dbem");
37
- dbem_categories_table_layout($message);
38
- } elseif ( $validation_result === false ) {
39
$message = (isset($message)) ? $message : __("There was a problem {$_POST['action']}ing your category, please try again.");
40
- dbem_categories_table_layout($message);
41
} else {
42
// no action, just a categories list
43
- dbem_categories_table_layout();
44
}
45
}
46
}
47
48
- function dbem_categories_table_layout($message = "") {
49
$categories = EM_Category::get();
50
$destination = get_bloginfo('url')."/wp-admin/admin.php";
51
?>
@@ -136,7 +136,7 @@ function dbem_categories_table_layout($message = "") {
136
}
137
138
139
- function dbem_categories_edit_layout($message = "") {
140
$category_id = $_GET['category_ID'];
141
$category = EM_Category::get($category_id);
142
?>
1
<?php
2
+ function em_categories_subpanel() {
3
global $wpdb;
4
5
if(isset($_GET['action']) && $_GET['action'] == "edit") {
6
// edit category
7
+ em_categories_edit_layout();
8
} else {
9
// Insert/Update/Delete Record
10
$categories_table = $wpdb->prefix.EM_CATEGORIES_TABLE;
32
}
33
}
34
//die(print_r($_POST));
35
+ if ( isset($validation_result) && is_numeric($validation_result) ) {
36
$message = (isset($message)) ? $message : __("Successfully {$_POST['action']}ed category", "dbem");
37
+ em_categories_table_layout($message);
38
+ } elseif ( isset($validation_result) && $validation_result === false ) {
39
$message = (isset($message)) ? $message : __("There was a problem {$_POST['action']}ing your category, please try again.");
40
+ em_categories_table_layout($message);
41
} else {
42
// no action, just a categories list
43
+ em_categories_table_layout();
44
}
45
}
46
}
47
48
+ function em_categories_table_layout($message = "") {
49
$categories = EM_Category::get();
50
$destination = get_bloginfo('url')."/wp-admin/admin.php";
51
?>
136
}
137
138
139
+ function em_categories_edit_layout($message = "") {
140
$category_id = $_GET['category_ID'];
141
$category = EM_Category::get($category_id);
142
?>
admin/{event.php → em-event.php} RENAMED
@@ -1,9 +1,9 @@
1
<?php
2
- function dbem_new_event_page() {
3
global $EM_Event;
4
$title = __ ( "Insert New Event", 'dbem' );
5
$EM_Event = new EM_Event(); //Empty event
6
- dbem_event_form ( $title );
7
}
8
9
/**
@@ -11,7 +11,7 @@ function dbem_new_event_page() {
11
* @param $title
12
* @return null
13
*/
14
- function dbem_event_form( $title ) {
15
global $EM_Event;
16
global $localised_date_formats;
17
$use_select_for_locations = get_option('dbem_use_select_for_locations');
@@ -78,7 +78,7 @@ function dbem_event_form( $title ) {
78
<select id="recurrence-frequency" name="recurrence_freq">
79
<?php
80
$freq_options = array ("daily" => __ ( 'Daily', 'dbem' ), "weekly" => __ ( 'Weekly', 'dbem' ), "monthly" => __ ( 'Monthly', 'dbem' ) );
81
- dbem_option_items ( $freq_options, $EM_Event->freq );
82
?>
83
</select>
84
</p>
@@ -102,7 +102,7 @@ function dbem_event_form( $title ) {
102
<p class="alternate-selector" id="weekly-selector">
103
<?php
104
$saved_bydays = ($EM_Event->is_recurring()) ? explode ( ",", $EM_Event->byday ) : array();
105
- dbem_checkbox_items ( 'recurrence_bydays[]', $days_names, $saved_bydays );
106
?>
107
</p>
108
<p class="alternate-selector" id="monthly-selector">
@@ -110,11 +110,11 @@ function dbem_event_form( $title ) {
110
<select id="monthly-modifier" name="recurrence_byweekno">
111
<?php
112
$weekno_options = array ("1" => __ ( 'first', 'dbem' ), '2' => __ ( 'second', 'dbem' ), '3' => __ ( 'third', 'dbem' ), '4' => __ ( 'fourth', 'dbem' ), '-1' => __ ( 'last', 'dbem' ) );
113
- dbem_option_items ( $weekno_options, $EM_Event->byweekno );
114
?>
115
</select>
116
<select id="recurrence-weekday" name="recurrence_byday">
117
- <?php dbem_option_items ( $days_names, $EM_Event->byday ); ?>
118
</select>
119
&nbsp;
120
</p>
@@ -510,7 +510,7 @@ function dbem_event_form( $title ) {
510
<a href="#" rel="<?php echo $count ?>">Remove</a>
511
</td>
512
<td>
513
- <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" />
514
</td>
515
</tr>
516
<?php
1
<?php
2
+ function em_new_event_page() {
3
global $EM_Event;
4
$title = __ ( "Insert New Event", 'dbem' );
5
$EM_Event = new EM_Event(); //Empty event
6
+ em_event_form ( $title );
7
}
8
9
/**
11
* @param $title
12
* @return null
13
*/
14
+ function em_event_form( $title ) {
15
global $EM_Event;
16
global $localised_date_formats;
17
$use_select_for_locations = get_option('dbem_use_select_for_locations');
78
<select id="recurrence-frequency" name="recurrence_freq">
79
<?php
80
$freq_options = array ("daily" => __ ( 'Daily', 'dbem' ), "weekly" => __ ( 'Weekly', 'dbem' ), "monthly" => __ ( 'Monthly', 'dbem' ) );
81
+ em_option_items ( $freq_options, $EM_Event->freq );
82
?>
83
</select>
84
</p>
102
<p class="alternate-selector" id="weekly-selector">
103
<?php
104
$saved_bydays = ($EM_Event->is_recurring()) ? explode ( ",", $EM_Event->byday ) : array();
105
+ em_checkbox_items ( 'recurrence_bydays[]', $days_names, $saved_bydays );
106
?>
107
</p>
108
<p class="alternate-selector" id="monthly-selector">
110
<select id="monthly-modifier" name="recurrence_byweekno">
111
<?php
112
$weekno_options = array ("1" => __ ( 'first', 'dbem' ), '2' => __ ( 'second', 'dbem' ), '3' => __ ( 'third', 'dbem' ), '4' => __ ( 'fourth', 'dbem' ), '-1' => __ ( 'last', 'dbem' ) );
113
+ em_option_items ( $weekno_options, $EM_Event->byweekno );
114
?>
115
</select>
116
<select id="recurrence-weekday" name="recurrence_byday">
117
+ <?php em_option_items ( $days_names, $EM_Event->byday ); ?>
118
</select>
119
&nbsp;
120
</p>
510
<a href="#" rel="<?php echo $count ?>">Remove</a>
511
</td>
512
<td>
513
+ <input type="text" name="mtm_<?php echo $count ?>_name" />
514
</td>
515
</tr>
516
<?php
admin/{events.php → em-events.php} RENAMED
@@ -4,17 +4,17 @@
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 dbem_events_subpanel() {
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 = $_GET ['action'];
12
- $action2 = $_GET ['action2'];
13
- $event_ID = $_GET ['event_id'];
14
- $recurrence_ID = $_GET ['recurrence_id'];
15
- $scope = ($_GET ['scope'] != '') ? $_GET['scope']:'future';
16
- $order = $_GET ['order']; //FIXME order not used consistently in admin area
17
- $selectedEvents = $_GET ['events'];
18
19
if ($order == ""){
20
$order = "ASC";
@@ -24,7 +24,7 @@ function dbem_events_subpanel() {
24
// DELETE action
25
if ( $action == 'deleteEvents' && EM_Object::array_is_numeric($selectedEvents) ) {
26
EM_Events::delete( $selectedEvents );
27
- dbem_events_table ( EM_Events::get( array('scope'=>$scope) ), "Future events" );
28
}
29
// UPDATE or CREATE action
30
if ($action == 'update_event') {
@@ -42,7 +42,7 @@ function dbem_events_subpanel() {
42
<p><?php echo $EM_Event->feedback_message ?></p>
43
</div>
44
<?php
45
- dbem_events_table ( EM_Events::get( array('limit'=>0,'scope'=>$scope) ), "Future events" );
46
}else{
47
// saving unsuccessful
48
?>
@@ -52,7 +52,7 @@ function dbem_events_subpanel() {
52
</p>
53
</div>
54
<?php
55
- dbem_event_form ( $title );
56
}
57
} else {
58
// validation unsuccessful
@@ -61,7 +61,7 @@ function dbem_events_subpanel() {
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
- dbem_event_form ( $title );
65
}
66
}
67
@@ -74,7 +74,7 @@ function dbem_events_subpanel() {
74
$title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
75
}
76
//Generate Event Form
77
- dbem_event_form ( $title );
78
}
79
80
//Copy the event
@@ -84,10 +84,10 @@ function dbem_events_subpanel() {
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
- dbem_event_form ( $title );
88
}else{
89
echo "<div class='error'><p>There was an error duplicating the event. Try again maybe?</div>";
90
- dbem_events_table ( EM_Events::get(array('limit'=>0,'scope'=>$scope)), $title );
91
}
92
}
93
@@ -105,11 +105,11 @@ function dbem_events_subpanel() {
105
$scope = "future";
106
}
107
$events = EM_Events::get( array('scope'=>$scope, 'limit'=>0, 'order'=>$order ) );
108
- dbem_events_table ( $events, $title );
109
}
110
}
111
112
- function dbem_events_table($events, $title) {
113
$limit = ( !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
114
$page = ( !empty($_GET['p']) ) ? $_GET['p']:1;
115
$offset = ( $page > 1 ) ? ($page-1)*$limit : 0;
@@ -118,7 +118,7 @@ function dbem_events_table($events, $title) {
118
'all' => __ ( 'All events', 'dbem' ),
119
'future' => __ ( 'Future events', 'dbem' )
120
);
121
- $scope = ( array_key_exists( $_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
122
$events_count = count ( $events );
123
124
$use_events_end = get_option ( 'dbem_use_event_end' );
@@ -165,14 +165,14 @@ function dbem_events_table($events, $title) {
165
//Pagination (if needed/requested)
166
if( $events_count >= $limit ){
167
//Show the pagination links (unless there's less than 10 events
168
- $page_link_template = preg_replace('/p=\d+/i','',$_SERVER['REQUEST_URI']);
169
$page_link_template = em_add_get_params($page_link_template, array('p'=>'%PAGE%'));
170
$events_nav = em_paginate( $page_link_template, $events_count, $limit, $page);
171
echo $events_nav;
172
}
173
?>
174
</div>
175
- <div class="clear"></div>
176
177
<?php
178
if (empty ( $events )) {
@@ -270,7 +270,7 @@ function dbem_events_table($events, $title) {
270
271
<div class='tablenav'>
272
<div class="alignleft actions">
273
- <?php echo $events_nav; ?>
274
<br class='clear' />
275
</div>
276
<br class='clear' />
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_events_subpanel() {
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
+ $action2 = ( !empty($_GET ['action2']) ) ? $_GET ['action2']:'';
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";
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') {
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
?>
52
</p>
53
</div>
54
<?php
55
+ em_event_form ( $title );
56
}
57
} else {
58
// validation unsuccessful
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
74
$title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
75
}
76
//Generate Event Form
77
+ em_event_form ( $title );
78
}
79
80
//Copy the event
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
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;
118
'all' => __ ( 'All events', 'dbem' ),
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' );
165
//Pagination (if needed/requested)
166
if( $events_count >= $limit ){
167
//Show the pagination links (unless there's less than 10 events
168
+ $page_link_template = preg_replace('/(&|\?)p=\d+/i','',$_SERVER['REQUEST_URI']);
169
$page_link_template = em_add_get_params($page_link_template, array('p'=>'%PAGE%'));
170
$events_nav = em_paginate( $page_link_template, $events_count, $limit, $page);
171
echo $events_nav;
172
}
173
?>
174
</div>
175
+ <br class="clear" />
176
177
<?php
178
if (empty ( $events )) {
270
271
<div class='tablenav'>
272
<div class="alignleft actions">
273
+ <?php echo ( !empty($events_nav) ) ? $events_nav:''; ?>
274
<br class='clear' />
275
</div>
276
<br class='clear' />
admin/{help.php → em-help.php} RENAMED
File without changes
admin/{locations-search.php → em-locations-search.php} RENAMED
File without changes
admin/em-locations.php ADDED
@@ -0,0 +1,237 @@
1
+ <?php
2
+ /**
3
+ * Looks at the request values, saves/updates and then displays the right menu in the admin
4
+ * @return null
5
+ */
6
+ function em_locations_page() {
7
+ //TODO EM_Location is globalized, use it fully here
8
+ global $EM_Location;
9
+
10
+ //Take actions
11
+ if( !empty($_REQUEST['action']) ){
12
+ if( $_REQUEST['action'] == "edit" || $_REQUEST['action'] == "add" ) {
13
+ //edit/add location
14
+ em_admin_location();
15
+ } elseif( $_REQUEST['action'] == "delete" ){
16
+ //delelte location
17
+ $locations = $_REQUEST['locations'];
18
+ foreach($locations as $location_id) {
19
+ $EM_Location = new EM_Location($location_id);
20
+ $EM_Location->delete();
21
+ }
22
+ em_admin_locations(__('Locations Deleted', "dbem" ));
23
+ } elseif( $_REQUEST['action'] == "save") {
24
+ // save (add/update) location
25
+ if( empty($EM_Location) || !is_object($EM_Location) ){
26
+ $EM_Location = new EM_Location(); //blank location
27
+ $success_message = __('The location has been added.', 'dbem');
28
+ }else{
29
+ $success_message = __('The location has been updated.', 'dbem');
30
+ }
31
+ $EM_Location->get_post();
32
+ $validation_result = $EM_Location->validate();
33
+ if ( $validation_result ) {
34
+ $EM_Location->save(); //FIXME better handling of db write fails when saving location
35
+ em_admin_locations($success_message);
36
+ } else {
37
+ ?>
38
+ <div id='message' class='error '>
39
+ <p>
40
+ <strong><?php _e( "Ach, there's a problem here:", "dbem" ) ?></strong><br /><br /><?php echo implode('<br />', $EM_Location->errors); ?>
41
+ </p>
42
+ </div>
43
+ <?php
44
+ unset($EM_Location);
45
+ em_admin_location();
46
+ }
47
+ }
48
+ } else {
49
+ // no action, just a locations list
50
+ em_admin_locations();
51
+ }
52
+ }
53
+
54
+ function em_admin_locations($message='', $fill_fields = false) {
55
+ $limit = ( !empty($_REQUEST['limit']) ) ? $_REQUEST['limit'] : 20;//Default limit
56
+ $page = ( !empty($_REQUEST['p']) ) ? $_REQUEST['p']:1;
57
+ $offset = ( $page > 1 ) ? ($page-1)*$limit : 0;
58
+ $locations = EM_Locations::get();
59
+ $locations_count = count($locations);
60
+ ?>
61
+ <div class='wrap'>
62
+ <div id='icon-edit' class='icon32'>
63
+ <br/>
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 != "") : ?>
71
+ <div id='message' class='updated fade below-h2'>
72
+ <p><?php echo $message ?></p>
73
+ </div>
74
+ <?php endif; ?>
75
+
76
+ <form id='bookings-filter' method='post' action=''>
77
+ <input type='hidden' name='page' value='locations'/>
78
+ <input type='hidden' name='limit' value='<?php echo $limit ?>' />
79
+ <input type='hidden' name='p' value='<?php echo $page ?>' />
80
+ <?php if ( $locations_count > 0 ) : ?>
81
+ <div class='tablenav'>
82
+ <div class="alignleft actions">
83
+ <select name="action">
84
+ <option value="" selected="selected"><?php _e ( 'Bulk Actions' ); ?></option>
85
+ <option value="delete"><?php _e ( 'Delete selected','dbem' ); ?></option>
86
+ </select>
87
+ <input type="submit" value="<?php _e ( 'Apply' ); ?>" id="doaction2" class="button-secondary action" />
88
+ <?php
89
+ //Pagination (if needed/requested)
90
+ if( $locations_count >= $limit ){
91
+ //Show the pagination links (unless there's less than 10 events
92
+ $page_link_template = preg_replace('/(&|\?)p=\d+/i','',$_SERVER['REQUEST_URI']);
93
+ $page_link_template = em_add_get_params($page_link_template, array('p'=>'%PAGE%'));
94
+ $locations_nav = em_paginate( $page_link_template, $locations_count, $limit, $page);
95
+ echo $locations_nav;
96
+ }
97
+ ?>
98
+ </div>
99
+ </div>
100
+ <table class='widefat'>
101
+ <thead>
102
+ <tr>
103
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
104
+ <th><?php _e('Name', 'dbem') ?></th>
105
+ <th><?php _e('Address', 'dbem') ?></th>
106
+ <th><?php _e('Town', 'dbem') ?></th>
107
+ </tr>
108
+ </thead>
109
+ <tfoot>
110
+ <tr>
111
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
112
+ <th><?php _e('Name', 'dbem') ?></th>
113
+ <th><?php _e('Address', 'dbem') ?></th>
114
+ <th><?php _e('Town', 'dbem') ?></th>
115
+ </tr>
116
+ </tfoot>
117
+ <tbody>
118
+ <?php $i = 1; ?>
119
+ <?php foreach ($locations as $EM_Location) : ?>
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&amp;action=edit&amp;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>
127
+ <?php endif; ?>
128
+ <?php $i++; ?>
129
+ <?php endforeach; ?>
130
+ </tbody>
131
+ </table>
132
+ <?php else: ?>
133
+ <p><?php _e('No venues have been inserted yet!', 'dbem') ?></p>
134
+ <?php endif; ?>
135
+ </form>
136
+ </div>
137
+ <?php
138
+ }
139
+
140
+ function em_admin_location($message = "") {
141
+ global $EM_Location;
142
+ if( empty($EM_Location) || !is_object($EM_Location) ){
143
+ $title = __('Add location', 'dbem');
144
+ $EM_Location = new EM_Location();
145
+ }else{
146
+ $title = __('Edit location', 'dbem');
147
+ }
148
+ ?>
149
+ <div class='wrap'>
150
+ <div id='icon-edit' class='icon32'>
151
+ <br/>
152
+ </div>
153
+ <h2><?php echo $title ?></h2>
154
+
155
+ <?php if($message != "") : ?>
156
+ <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
157
+ <p><?php echo $message ?></p>
158
+ </div>
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'>
166
+ <tr class='form-field form-required'>
167
+ <th scope='row' valign='top'><label for='location_name'><?php _e('Location name', 'dbem') ?></label></th>
168
+ <td><input name='location_name' id='location-name' type='text' value='<?php echo htmlspecialchars($EM_Location->name, ENT_QUOTES); ?>' size='40' /><br />
169
+ <?php _e('The name of the location', 'dbem') ?></td>
170
+ </tr>
171
+
172
+ <tr class='form-field'>
173
+ <th scope='row' valign='top'><label for='location_address'><?php _e('Location address', 'dbem') ?></label></th>
174
+ <td><input name='location_address' id='location-address' type='text' value='<?php echo htmlspecialchars($EM_Location->address, ENT_QUOTES); ?>' size='40' /><br />
175
+ <?php _e('The address of the location', 'dbem') ?>.</td>
176
+
177
+ </tr>
178
+
179
+ <tr class='form-field'>
180
+ <th scope='row' valign='top'> <label for='location_town'><?php _e('Location town', 'dbem') ?></label></th>
181
+ <td><input name='location_town' id='location-town' type='text' value='<?php echo htmlspecialchars($EM_Location->town, ENT_QUOTES); ?>' size='40' /><br />
182
+ <?php _e('The town where the location is located', 'dbem') ?>.</td>
183
+
184
+ </tr>
185
+
186
+ <tr style='display:none;'>
187
+ <td>Coordinates</td>
188
+ <td><input id='location-latitude' name='location_latitude' id='location_latitude' type='text' value='<?php echo $EM_Location->latitude ?>' size='15' />
189
+ <input id='location-longitude' name='location_longitude' id='location_longitude' type='text' value='<?php echo $EM_Location->longitude ?>' size='15' /></td>
190
+ </tr>
191
+
192
+ <?php if (get_option('dbem_gmap_is_active')) { ?>
193
+ <tr>
194
+ <th scope='row' valign='top'><label for='location_map'><?php _e('Location map', 'dbem') ?></label></th>
195
+ <td>
196
+ <div id='em-map-404' style='width: 450px; height: 350px; vertical-align:middle; text-align: center;'>
197
+ <p><em><?php _e ( 'Location not found', 'dbem' ); ?></em></p>
198
+ </div>
199
+ <div id='em-map' style='width: 450px; height: 350px; display: none;'></div>
200
+ </td>
201
+ </tr>
202
+ <?php
203
+ }
204
+ ?>
205
+ <tr class='form-field'>
206
+ <th scope='row' valign='top'><label for='location_description'><?php _e('Location description', 'dbem') ?></label></th>
207
+ <td>
208
+ <div class="inside">
209
+ <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
210
+ <?php the_editor($EM_Location->description); ?>
211
+ </div>
212
+ <?php _e('A description of the Location. You may include any kind of info here.', 'dbem') ?>
213
+ </div>
214
+ </td>
215
+ </tr>
216
+ <tr class='form-field'>
217
+ <th scope='row' valign='top'><label for='location_picture'><?php _e('Location image', 'dbem') ?></label></th>
218
+ <td>
219
+ <?php if ($EM_Location->image_url != '') : ?>
220
+ <img src='<?php echo $EM_Location->image_url; ?>' alt='<?php echo $EM_Location->name ?>'/>
221
+ <?php else : ?>
222
+ <?php _e('No image uploaded for this location yet', 'debm') ?>
223
+ <?php endif; ?>
224
+ </td>
225
+ </tr>
226
+ <tr>
227
+ <th scope='row' valign='top'><label for='location_image'><?php _e('Upload/change picture', 'dbem') ?></label></th>
228
+ <td><input id='location-image' name='location_image' id='location_image' type='file' size='40' /></td>
229
+ </tr>
230
+ </table>
231
+ <p class='submit'><input type='submit' class='button-primary' name='submit' value='<?php _e('Update location', 'dbem') ?>' /></p>
232
+ </form>
233
+ </div>
234
+ <?php
235
+ }
236
+
237
+ ?>
admin/em-options.php ADDED
@@ -0,0 +1,315 @@
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
9
+ $numeric_options = array('dbem_locations_default_limit','dbem_events_default_limit');
10
+ if( in_array($postKey,$numeric_options) && !is_numeric($postValue) ){
11
+ //Do nothing, keep old setting.
12
+ }else{
13
+ //TODO slashes being added?
14
+ //$postValue = EM_Object::sanitize($postValue)
15
+ update_option($postKey, stripslashes($postValue));
16
+ }
17
+ }
18
+ }
19
+ function em_options_saved_notice(){
20
+ ?>
21
+ <div class="updated"><p><strong><?php _e('Changes saved.'); ?></strong></p></div>
22
+ <?php
23
+ }
24
+ add_action ( 'admin_notices', 'em_options_saved_notice' );
25
+ }
26
+ }
27
+ add_action('admin_head', 'em_options_save');
28
+
29
+
30
+
31
+ function em_options_subpanel() {
32
+ //TODO place all options into an array
33
+ $save_button = '<tr><th>&nbsp;</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">
36
+ jQuery(document).ready(function($){
37
+ var close_text = '<?php _e('Collapse All','dbem'); ?>';
38
+ var open_text = '<?php _e('Expand All','dbem'); ?>';
39
+ var open_close = $('<a href="#" style="display:block; float:right; clear:right; margin:10px;">'+close_text+'</a>');
40
+ $('#icon-options-general').after(open_close);
41
+ open_close.click( function(e){
42
+ e.preventDefault();
43
+ if($(this).text() == close_text){
44
+ $(".postbox").addClass('closed');
45
+ $(this).text(open_text);
46
+ }else{
47
+ $(".postbox").removeClass('closed');
48
+ $(this).text(close_text);
49
+ }
50
+ });
51
+ //For rewrite titles
52
+ $('input:radio[name=dbem_disable_title_rewrites]').live('change',function(){
53
+ checked_check = $('input:radio[name=dbem_disable_title_rewrites]:checked');
54
+ if( checked_check.val() == 1 ){
55
+ $('#dbem_title_html_row').show();
56
+ }else{
57
+ $('#dbem_title_html_row').hide();
58
+ }
59
+ });
60
+ $('input:radio[name=dbem_disable_title_rewrites]').trigger('change');
61
+
62
+ });
63
+ </script>
64
+ <div class="wrap">
65
+ <div id='icon-options-general' class='icon32'><br />
66
+ </div>
67
+ <h2><?php _e ( 'Event Manager Options', 'dbem' ); ?></h2>
68
+
69
+ <form id="dbem_options_form" method="post" action="">
70
+
71
+ <div class="metabox-holder">
72
+ <!-- // TODO Move style in css -->
73
+ <div class='postbox-container' style='width: 99.5%'>
74
+ <div id="" class="meta-box-sortables" >
75
+
76
+ <div class="postbox " >
77
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'General options', 'dbem' ); ?> </span></h3>
78
+ <div class="inside">
79
+ <table class="form-table">
80
+ <?php
81
+ em_options_radio_binary ( __( 'Use dropdown for locations?' ), 'dbem_use_select_for_locations', __( 'Select yes to select location from a drow-down menu; location selection will be faster, but you will lose the ability to insert locations with events','dbem' ) );
82
+ em_options_radio_binary ( __( 'Use recurrence?' ), 'dbem_recurrence_enabled', __( 'Select yes to enable the recurrence features feature','dbem' ) );
83
+ em_options_radio_binary ( __( 'Use RSVP?' ), 'dbem_rsvp_enabled', __( 'Select yes to enable the RSVP feature','dbem' ) );
84
+ em_options_radio_binary ( __( 'Use categories?' ), 'dbem_categories_enabled', __( 'Select yes to enable the category features','dbem' ) );
85
+ em_options_radio_binary ( __( 'Use attributes?' ), 'dbem_attributes_enabled', __( 'Select yes to enable the attributes feature','dbem' ) );
86
+ echo $save_button;
87
+ ?>
88
+ </table>
89
+
90
+ </div> <!-- . inside -->
91
+ </div> <!-- .postbox -->
92
+
93
+ <div class="postbox " >
94
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Events page', 'dbem' ); ?> </span></h3>
95
+ <div class="inside">
96
+ <table class="form-table">
97
+ <?php
98
+ //Wordpress Pages
99
+ global $em_disable_filter; //Using a flag here instead
100
+ $em_disable_filter = true;
101
+ $get_pages = get_pages();
102
+ $events_page_options = array();
103
+ $events_page_options[0] = __('[No Events Page]');
104
+ //TODO Add the hierarchy style ddm, like when choosing page parents
105
+ foreach($get_pages as $page){
106
+ $events_page_options[$page->ID] = $page->post_title;
107
+ }
108
+ em_options_select ( __( 'Events page' ), 'dbem_events_page', $events_page_options, __( 'This option allows you to select which page to use as an events page','dbem' ) );
109
+ $em_disable_filter = false;
110
+ //Rest
111
+ em_options_radio_binary ( __( 'Show events page in lists?', 'dbem' ), 'dbem_list_events_page', __( 'Check this option if you want the events page to appear together with other pages in pages lists.', 'dbem' ) );
112
+ em_options_radio_binary ( __( 'Display calendar in events page?', 'dbem' ), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','dbem' ).' '.__('If you would like to show events that span over more than one day, see the Calendar section on this page.','dbem') );
113
+ em_options_radio_binary ( __( 'Disable title rewriting?', 'dbem' ), 'dbem_disable_title_rewrites', __( "Some wordpress themes don't follow best practices when generating navigation menus, and so the automatic title rewriting feature may cause problems, if your menus aren't working correctly on the event pages, try setting this to 'Yes', and provide an appropriate HTML title format below.",'dbem' ) );
114
+ em_options_input_text ( __( 'Event Manager titles', 'dbem' ), 'dbem_title_html', __( "This only setting only matters if you selected 'Yes' to above. You will notice the events page titles aren't being rewritten, and you have a new title underneath the default page name. This is where you control the HTML of this title. Make sure you keep the #_PAGETITLE placeholder here, as that's what is rewritten by events manager. To control what's rewritten in this title, see settings further down for page titles.", 'dbem' ) );
115
+ em_options_input_text ( __( 'Event List Limits', 'dbem' ), 'dbem_events_default_limit', __( "This will control how many events are shown on one list by default.", 'dbem' ) );
116
+ ?>
117
+ <tr valign="top" id='dbem_events_default_orderby_row'>
118
+ <th scope="row"><?php _e('Default event list ordering','dbem'); ?></th>
119
+ <td>
120
+ <select name="dbem_events_default_orderby" >
121
+ <?php
122
+ $orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
123
+ 'start_date,start_time,name' => __('Order by start date, start time, then event name','dbem'),
124
+ 'name,start_date,start_time' => __('Order by name, start date, then start time','dbem'),
125
+ 'name,end_date,end_time' => __('Order by name, end date, then end time','dbem'),
126
+ 'end_date,end_time,name' => __('Order by end date, end time, then event name','dbem'),
127
+ ));
128
+ ?>
129
+ <?php foreach($orderby_options as $key => $value) : ?>
130
+ <option value='<?php echo $key ?>' <?php echo ($key == get_option('dbem_events_default_orderby')) ? "selected='selected'" : ''; ?>>
131
+ <?php echo $value; ?>
132
+ </option>
133
+ <?php endforeach; ?>
134
+ </select>
135
+ <select name="dbem_events_default_order" >
136
+ <?php
137
+ $ascending = __('Ascending','dbem');
138
+ $descending = __('Descending','dbem');
139
+ $order_options = apply_filters('em_settings_events_default_order_ddm', array(
140
+ 'ASC' => __('All Ascending','dbem'),
141
+ 'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'dbem'),
142
+ 'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'dbem'),
143
+ 'DESC' => __('All Descending','dbem'),
144
+ 'ASC,DESC,ASC' => __("$ascending, $descending, $ascending",'dbem'),
145
+ 'ASC,DESC,DESC' => __("$ascending, $descending, $descending",'dbem'),
146
+ 'ASC,ASC,DESC' => __("$ascending, $ascending, $descending",'dbem'),
147
+ 'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'dbem'),
148
+ ));
149
+ ?>
150
+ <?php foreach( $order_options as $key => $value) : ?>
151
+ <option value='<?php echo $key ?>' <?php echo ($key == get_option('dbem_events_default_order')) ? "selected='selected'" : ''; ?>>
152
+ <?php echo $value; ?>
153
+ </option>
154
+ <?php endforeach; ?>
155
+ </select>
156
+ <br/>
157
+ <?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?>
158
+ </td>
159
+ </tr>
160
+ <?php
161
+ echo $save_button;
162
+ ?>
163
+ </table>
164
+ </div> <!-- . inside -->
165
+ </div> <!-- .postbox -->
166
+
167
+ <div class="postbox " >
168
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Events format', 'dbem' ); ?> </span></h3>
169
+ <div class="inside">
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.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_LOCATION</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_NOTES</code>.<br/> Use <code>#_EXCERPT</code> to show <code>#_NOTES</code> until you place a &lt;!&ndash;&ndash; more &ndash;&ndash;&gt; marker.<br/> Use <code>#_LINKEDNAME</code> for the event name with a link to the given event page.<br/> Use <code>#_EVENTPAGEURL</code> to print the event page URL and make your own customised links.<br/> Use <code>#_LOCATIONPAGEURL</code> to print the location page URL and make your own customised links.<br/>Use <code>#_EDITEVENTLINK</code> to add add a link to edit page for the event, which will appear only when a user is logged in.<br/>To insert date and time 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/> For the end time, put <code>#@</code> in front of the character, ie. <code>#@h</code>, <code>#@i</code>, etc.<br/> You can also create a date format without prepending <code>#</code> by wrapping it in #_{} or #@_{} (e.g. <code>#_{d/m/Y}</code>). If there is no end date, the value is not shown.<br/>Feel free to use HTML tags as <code>li</code>, <code>br</code> and so on.<br/>For custom attributes, you use <code>#_ATT{key}{alternative text}</code>, the second braces are optional and will appear if the attribute is not defined or left blank for that event. This key will appear as an option when adding attributes to your event.', 'dbem' ) );
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. Follow the previous formatting instructions.', 'dbem' ) );
176
+ em_options_textarea ( __( 'Default single event format', 'dbem' ), 'dbem_single_event_format', __( 'The format of a single event page.<br/>Follow the previous formatting instructions. <br/>Use <code>#_MAP</code> to insert a map.<br/>Use <code>#_CONTACTNAME</code>, <code>#_CONTACTEMAIL</code>, <code>#_CONTACTPHONE</code> to insert respectively the name, e-mail address and phone number of the designated contact person. <br/>Use <code>#_ADDBOOKINGFORM</code> to insert a form to allow the user to respond to your events reserving one or more places (RSVP).<br/> Use <code>#_REMOVEBOOKINGFORM</code> to insert a form where users, inserting their name and e-mail address, can remove their bookings.', 'dbem' ) );
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' ) );
180
+ echo $save_button;
181
+ ?>
182
+ </table>
183
+ </div> <!-- . inside -->
184
+ </div> <!-- .postbox -->
185
+
186
+ <div class="postbox " >
187
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Calendar format', 'dbem' ); ?></span></h3>
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;
197
+ ?>
198
+ </table>
199
+ </div> <!-- . inside -->
200
+ </div> <!-- .postbox -->
201
+
202
+ <div class="postbox " >
203
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Locations format', 'dbem' ); ?> </span></h3>
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.<br/>Follow the previous formatting instructions.', 'dbem' ) );
208
+ em_options_textarea ( __( 'Default single location page format', 'dbem' ), 'dbem_single_location_format', __( 'The format of a single location page.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code>.<br/> Use <code>#_MAP</code> to display a map of the event location, and <code>#_IMAGE</code> to display an image of the location.<br/> Use <code>#_NEXTEVENTS</code> to insert a list of the upcoming events, <code>#_PASTEVENTS</code> for a list of past events, <code>#_ALLEVENTS</code> for a list of all events taking place in this location.', 'dbem' ) );
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.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code> or <code>#_IMAGE</code>.', 'dbem' ) );
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. <br/> Follow the events formatting instructions', 'dbem' ) );
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
+ ?>
214
+ </table>
215
+ </div> <!-- . inside -->
216
+ </div> <!-- .postbox -->
217
+
218
+ <div class="postbox " >
219
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'RSS feed format', 'dbem' ); ?> </span></h3>
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. Follow the previous formatting instructions.', 'dbem' ) );
227
+ echo $save_button;
228
+ ?>
229
+ </table>
230
+ </div> <!-- . inside -->
231
+ </div> <!-- .postbox -->
232
+
233
+ <div class="postbox " >
234
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Maps and geotagging', 'dbem' ); ?> </span></h3>
235
+ <div class="inside">
236
+ <table class='form-table'>
237
+ <?php $gmap_is_active = get_option ( 'dbem_gmap_is_active' ); ?>
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'":''; ?> /><?php _e ( 'Yes' ); ?><br />
242
+ <input name="dbem_gmap_is_active" type="radio" value="0" <?php echo ($gmap_is_active) ? '':"checked='checked'"; ?> /> <?php _e ( 'No' ); ?> <br />
243
+ <?php _e ( 'Check this option to enable Goggle Map integration.', 'dbem' )?>
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.<br/>Follow the previous formatting instructions.', 'dbem' ) );
248
+ echo $save_button;
249
+ ?>
250
+ </table>
251
+ </div> <!-- . inside -->
252
+ </div> <!-- .postbox -->
253
+
254
+ <div class="postbox " >
255
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'RSVP and bookings', 'dbem' ); ?> </span></h3>
256
+ <div class="inside">
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 ( __( 'Enable the RSVP e-mail notifications?', 'dbem' ), 'dbem_rsvp_mail_notify_is_active', __( 'Check this option if you want to receive an email when someone books places for your events.', 'dbem' ) );
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. Follow the events formatting instructions. <br/>Use <code>#_RESPNAME</code>, <code>#_RESPEMAIL</code> and <code>#_RESPPHONE</code> to display respectively the name, e-mail, address and phone of the respondent.<br/>Use <code>#_SPACES</code> to display the number of spaces reserved by the respondent. Use <code>#_COMMENT</code> to display the respondent\'s comment. <br/> Use <code>#_BOOKEDSEATS</code> and <code>#_AVAILABLESEATS</code> to display respectively the number of booked and available seats.', 'dbem' ) );
262
+ em_options_textarea ( __( 'Contact person email format', 'dbem' ), 'dbem_respondent_email_body', __( 'The format of the email which will be sent to respondent. Follow the events formatting instructions. <br/>Use <code>#_RESPNAME</code> to display the name of the respondent.<br/>Use <code>#_CONTACTNAME</code> and <code>#_CONTACTEMAIL</code> a to display respectively the name and e-mail of the contact person.<br/>Use <code>#_SPACES</code> to display the number of spaces reserved by the respondent. Use <code>#_COMMENT</code> to display the respondent\'s comment.', 'dbem' ) );
263
+ em_options_input_text ( __( 'Default notification receiver address', 'dbem' ), 'dbem_mail_receiver_address', __( "Insert the address of the receiver of your notifications", 'dbem' ) );
264
+ echo $save_button;
265
+ ?>
266
+ </table>
267
+ </div> <!-- . inside -->
268
+ </div> <!-- .postbox -->
269
+
270
+ <div class="postbox " >
271
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Email Settings', 'dbem' ); ?> </span></h3>
272
+ <div class="inside">
273
+ <table class='form-table'>
274
+ <?php
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' ) );
282
+ em_options_input_password ( __( 'SMTP password', 'dbem' ), "dbem_smtp_password", __( "Insert the password to be used to access your SMTP server", 'dbem' ) );
283
+ echo $save_button;
284
+ ?>
285
+ </table>
286
+ </div> <!-- . inside -->
287
+ </div> <!-- .postbox -->
288
+
289
+ <div class="postbox " >
290
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Images size', 'dbem' ); ?> </span></h3>
291
+ <div class="inside">
292
+ <table class='form-table'>
293
+ <?php
294
+ em_options_input_text ( __( 'Maximum width (px)', 'dbem' ), 'dbem_image_max_width', __( 'The maximum allowed width for images uploades', 'dbem' ) );
295
+ em_options_input_text ( __( 'Maximum height (px)', 'dbem' ), 'dbem_image_max_height', __( "The maximum allowed height for images uploaded, in pixels", 'dbem' ) );
296
+ em_options_input_text ( __( 'Maximum size (bytes)', 'dbem' ), 'dbem_image_max_size', __( "The maximum allowed size for images uploaded, in pixels", 'dbem' ) );
297
+ ?>
298
+ </table>
299
+ </div> <!-- . inside -->
300
+ </div> <!-- .postbox -->
301
+
302
+ <p class="submit">
303
+ <input type="submit" id="dbem_options_submit" name="Submit" value="<?php _e ( 'Save Changes' )?>" />
304
+ <input type="hidden" name="em-submitted" value="1" />
305
+ </p>
306
+
307
+ </div> <!-- .metabox-sortables -->
308
+ </div> <!-- .postbox-container -->
309
+
310
+ </div> <!-- .metabox-holder -->
311
+ </form>
312
+ </div>
313
+ <?php
314
+ }
315
+ ?>
admin/{people.php → em-people.php} RENAMED
File without changes
admin/locations.php DELETED
@@ -1,305 +0,0 @@
1
- <?php
2
- /**
3
- * Looks at the request values, saves/updates and then displays the right menu in the admin
4
- * @return null
5
- */
6
- function dbem_locations_page() {
7
- //TODO EM_Location is globalized, use it fully here
8
- global $EM_Location;
9
-
10
- //First Delete any locations
11
- if(isset($_GET['page']) && $_GET['page'] == "locations") {
12
- if(isset($_GET['doaction2']) && $_GET['doaction2'] == "Delete") {
13
- if(isset($_GET['action2']) && $_GET['action2'] == "delete") {
14
- $locations = $_GET['locations'];
15
- foreach($locations as $location_id) {
16
- $EM_Location = new EM_Location($location_id);
17
- $EM_Location->delete();
18
- }
19
- ?>
20
- <div id='message' class='updated'><p><?php _e( "Locations Deleted", "dbem" ) ?></p></div>
21
- <?php
22
- }
23
- }
24
- }
25
- //Now take further actions
26
- if(isset($_GET['action']) && $_GET['action'] == "edit") {
27
- // edit location
28
- dbem_admin_location();
29
- } else {
30
- if(isset($_POST['action']) && $_POST['action'] == "editedlocation") {
31
- // location update required
32
- $EM_Location->get_post();
33
- $validation_result = $EM_Location->validate();
34
- if ( $validation_result ) {
35
- $EM_Location->save();
36
- $message = __('The location has been updated.', 'dbem');
37
- dbem_admin_locations($message);
38
- } else {
39
- ?>
40
- <div id='message' class='error '>
41
- <p>
42
- <strong><?php _e( "Ach, there's a problem here:", "dbem" ) ?></strong><br /><br /><?php echo implode('<br />', $EM_Location->errors); ?>
43
- </p>
44
- </div>
45
- <?php
46
- unset($EM_Location);
47
- dbem_admin_location($message);
48
- }
49
- } elseif(isset($_POST['action']) && $_POST['action'] == "addlocation") {
50
- $EM_Location = new EM_Location();
51
- $EM_Location->get_post();
52
- $validation_result = $EM_Location->validate();
53
- if ($validation_result) {
54
- $EM_Location->save();
55
- dbem_admin_locations(__('The location has been added.', 'dbem'));
56
- } else {
57
- ?>
58
- <div id='message' class='error '>
59
- <p>
60
- <strong><?php _e( "Ach, there's a problem here:", "dbem" ) ?></strong><br /><br /><?php echo implode('<br />', $EM_Location->errors); ?>
61
- </p>
62
- </div>
63
- <?php
64
- dbem_admin_locations('', true);
65
- }
66
- } else {
67
- // no action, just a locations list
68
- dbem_admin_locations();
69
- }
70
- }
71
- }
72
-
73
- function dbem_admin_locations($message='', $fill_fields = false) {
74
- global $EM_Location;
75
- $locations = EM_Locations::get();
76
- $new_location = (is_object($EM_Location) && get_class($EM_Location) == 'EM_Location' && $fill_fields ) ? $EM_Location->to_array() : array(); //let's avoid php warning for empty object
77
- $destination = get_bloginfo('wpurl')."/wp-admin/admin.php";
78
- ?>
79
- <div class='wrap'>
80
- <div id='icon-edit' class='icon32'>
81
- <br/>
82
- </div>
83
- <h2><?php _e('Locations', 'dbem'); ?></h2>
84
-
85
- <?php if($message != "") : ?>
86
- <div id='message' class='updated fade below-h2'>
87
- <p><?php echo $message ?></p>
88
- </div>
89
- <?php endif; ?>
90
-
91
- <div id='col-container'>
92
- <div id='col-right'>
93
- <div class='col-wrap'>
94
- <form id='bookings-filter' method='get' action='<?php echo $destination ?>'>
95
- <input type='hidden' name='page' value='locations'/>
96
- <input type='hidden' name='action' value='addlocation'/>
97
-
98
- <?php if (count($locations)>0) : ?>
99
- <table class='widefat'>
100
- <thead>
101
- <tr>
102
- <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
103
- <th><?php echo __('Name', 'dbem') ?></th>
104
- <th><?php echo __('Address', 'dbem') ?></th>
105
- <th><?php echo __('Town', 'dbem') ?></th>
106
- </tr>
107
- </thead>
108
- <tfoot>
109
- <tr>
110
- <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
111
- <th><?php echo __('Name', 'dbem') ?></th>
112
- <th><?php echo __('Address', 'dbem') ?></th>
113
- <th><?php echo __('Town', 'dbem') ?></th>
114
- </tr>
115
- </tfoot>
116
- <tbody>
117
- <?php foreach ($locations as $location) : ?>
118
- <tr>
119
- <td><input type='checkbox' class ='row-selector' value='<?php echo $location->id ?>' name='locations[]'/></td>
120
- <td><a href='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=locations&amp;action=edit&amp;location_id=<?php echo $location->id ?>'><?php echo $location->name ?></a></td>
121
- <td><?php echo $location->address ?></td>
122
- <td><?php echo $location->town ?></td>
123
- </tr>
124
- <?php endforeach; ?>
125
- </tbody>
126
-
127
- </table>
128
-
129
- <div class='tablenav'>
130
- <div class='alignleft actions'>
131
- <input type='hidden' name='action2' value='delete'/>
132
- <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>
133
- <br class='clear'/>
134
- </div>
135
- <br class='clear'/>
136
- </div>
137
- <?php else: ?>
138
- <p><?php echo __('No venues have been inserted yet!', 'dbem') ?></p>
139
- <?php endif; ?>
140
- </form>
141
- </div>
142
- </div> <!-- end col-right -->
143
-
144
- <div id='col-left'>
145
- <div class='col-wrap'>
146
- <div class='form-wrap'>
147
- <div id='ajax-response'/>
148
- <h3><?php echo __('Add location', 'dbem') ?></h3>
149
- <form enctype='multipart/form-data' name='addlocation' id='locationForm' method='post' action='admin.php?page=locations' class='add:the-list: validate'>
150
- <input type='hidden' name='action' value='addlocation' />
151
- <div class='form-field form-required'>
152
- <label for='location_name'><?php echo __('Location name', 'dbem') ?></label>
153
- <input id='location-name' name='location_name' id='location_name' type='text' value='<?php echo $new_location['location_name'] ?>' size='40' />
154
- <p><?php echo __('The name of the location', 'dbem') ?>.</p>
155
- </div>
156
-
157
- <div class='form-field'>
158
- <label for='location_address'><?php echo __('Location address', 'dbem') ?></label>
159
- <input id='location-address' name='location_address' id='location_address' type='text' value='<?php echo $new_location['location_address'] ?>' size='40' />
160
- <p><?php echo __('The address of the location', 'dbem') ?>.</p>
161
- </div>
162
-
163
- <div class='form-field '>
164
- <label for='location_town'><?php echo __('Location town', 'dbem') ?></label>
165
- <input id='location-town' name='location_town' id='location_town' type='text' value='<?php echo $new_location['location_town'] ?>' size='40' />
166
- <p><?php echo __('The town of the location', 'dbem') ?>.</p>
167
- </div>
168
-
169
- <div class='form-field' style='display:none;'>
170
- <label for='location_latitude'>LAT</label>
171
- <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $new_location['location_latitude'] ?>' size='40' />
172
- </div>
173
- <div class='form-field' style='display:none;'>
174
- <label for='location_longitude'>LONG</label>
175
- <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $new_location['location_longitude'] ?>' size='40' />
176
- </div>
177
-
178
- <?php if ( get_option('dbem_gmap_is_active') ) : ?>
179
- <div class="events-map">
180
- <div id='em-map-404' style='width: 450px; vertical-align:middle; text-align: center;'>
181
- <p><em><?php _e ( 'Location not found', 'dbem' ); ?></em></p>
182
- </div>
183
- <div id='em-map' style='width: 450px; height: 350px; display: none;'></div>
184
- <br style='clear:both;' />
185
- </div>
186
- <?php endif; ?>
187
-
188
- <div class='form-field'>
189
- <label for='location_image'><?php echo __('Location image', 'dbem') ?></label>
190
- <input id='location-image' name='location_image' id='location_image' type='file' size='35' />
191
- <p><?php echo __('Select an image to upload', 'dbem') ?>.</p>
192
- </div>
193
-
194
- <div id="poststuff">
195
- <label for='location_description'><?php _e('Location description', 'dbem') ?></label>
196
- <div class="inside">
197
- <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
198
- <?php the_editor($new_location['location_description']); ?>
199
- </div>
200
- <?php _e('A description of the Location. You may include any kind of info here.', 'dbem') ?>
201
- </div>
202
- </div>
203
- <p class='submit'><input type='submit' class='button' name='submit' value='<?php echo __('Add location', 'dbem') ?>' /></p>
204
- </form>
205
- </div>
206
- </div>
207
- </div> <!-- end col-left -->
208
- </div>
209
- </div>
210
- </div>
211
- <?php
212
- }
213
-
214
- function dbem_admin_location($message = "") {
215
- global $EM_Location;
216
- ?>
217
- <div class='wrap'>
218
- <div id='icon-edit' class='icon32'>
219
- <br/>
220
- </div>
221
- <h2><?php echo __('Edit location', 'dbem') ?></h2>
222
-
223
- <?php if($message != "") : ?>
224
- <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
225
- <p><?php echo $message ?></p>
226
- </div>
227
- <?php endif; ?>
228
- <div id='ajax-response'></div>
229
-
230
- <form enctype='multipart/form-data' name='editcat' id='locationForm' method='post' action='admin.php?page=locations' class='validate'>
231
- <input type='hidden' name='action' value='editedlocation' />
232
- <input type='hidden' name='location_id' value='<?php echo $EM_Location->id ?>'/>
233
- <table class='form-table'>
234
- <tr class='form-field form-required'>
235
- <th scope='row' valign='top'><label for='location_name'><?php echo __('Location name', 'dbem') ?></label></th>
236
- <td><input name='location_name' id='location-name' type='text' value='<?php echo htmlspecialchars($EM_Location->name, ENT_QUOTES); ?>' size='40' /><br />
237
- <?php echo __('The name of the location', 'dbem') ?></td>
238
- </tr>
239
-
240
- <tr class='form-field'>
241
- <th scope='row' valign='top'><label for='location_address'><?php echo __('Location address', 'dbem') ?></label></th>
242
- <td><input name='location_address' id='location-address' type='text' value='<?php echo htmlspecialchars($EM_Location->address, ENT_QUOTES); ?>' size='40' /><br />
243
- <?php echo __('The address of the location', 'dbem') ?>.</td>
244
-
245
- </tr>
246
-
247
- <tr class='form-field'>
248
- <th scope='row' valign='top'> <label for='location_town'><?php echo __('Location town', 'dbem') ?></label></th>
249
- <td><input name='location_town' id='location-town' type='text' value='<?php echo htmlspecialchars($EM_Location->town, ENT_QUOTES); ?>' size='40' /><br />
250
- <?php echo __('The town where the location is located', 'dbem') ?>.</td>
251
-
252
- </tr>
253
-
254
- <tr style='display:none;'>
255
- <td>Coordinates</td>
256
- <td><input id='location-latitude' name='location_latitude' id='location_latitude' type='text' value='<?php echo $EM_Location->latitude ?>' size='15' />
257
- <input id='location-longitude' name='location_longitude' id='location_longitude' type='text' value='<?php echo $EM_Location->longitude ?>' size='15' /></td>
258
- </tr>
259
-
260
- <?php if (get_option('dbem_gmap_is_active')) { ?>
261
- <tr>
262
- <th scope='row' valign='top'><label for='location_map'><?php echo __('Location map', 'dbem') ?></label></th>
263
- <td>
264
- <div id='em-map-404' style='width: 450px; height: 350px; vertical-align:middle; text-align: center;'>
265
- <p><em><?php _e ( 'Location not found', 'dbem' ); ?></em></p>
266
- </div>
267
- <div id='em-map' style='width: 450px; height: 350px; display: none;'></div>
268
- </td>
269
- </tr>
270
- <?php
271
- }
272
- ?>
273
- <tr class='form-field'>
274
- <th scope='row' valign='top'><label for='location_description'><?php _e('Location description', 'dbem') ?></label></th>
275
- <td>
276
- <div class="inside">
277
- <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
278
- <?php the_editor($EM_Location->description); ?>
279
- </div>
280
- <?php _e('A description of the Location. You may include any kind of info here.', 'dbem') ?>
281
- </div>
282
- </td>
283
- </tr>
284
- <tr class='form-field'>
285
- <th scope='row' valign='top'><label for='location_picture'><?php echo __('Location image', 'dbem') ?></label></th>
286
- <td>
287
- <?php if ($EM_Location->image_url != '') : ?>
288
- <img src='<?php echo $EM_Location->image_url; ?>' alt='<?php echo $EM_Location->name ?>'/>
289
- <?php else : ?>
290
- <?php echo __('No image uploaded for this location yet', 'debm') ?>
291
- <?php endif; ?>
292
- </td>
293
- </tr>
294
- <tr>
295
- <th scope='row' valign='top'><label for='location_image'><?php echo __('Upload/change picture', 'dbem') ?></label></th>
296
- <td><input id='location-image' name='location_image' id='location_image' type='file' size='40' /></td>
297
- </tr>
298
- </table>
299
- <p class='submit'><input type='submit' class='button-primary' name='submit' value='<?php echo __('Update location', 'dbem') ?>' /></p>
300
- </form>
301
- </div>
302
- <?php
303
- }
304
-
305
- ?>
admin/options.php DELETED
@@ -1,315 +0,0 @@
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
9
- $numeric_options = array('dbem_locations_default_limit','dbem_events_default_limit');
10
- if( in_array($postKey,$numeric_options) && !is_numeric($postValue) ){
11
- //Do nothing, keep old setting.
12
- }else{
13
- //TODO slashes being added?
14
- //$postValue = EM_Object::sanitize($postValue)
15
- update_option($postKey, stripslashes($postValue));
16
- }
17
- }
18
- }
19
- function em_options_saved_notice(){
20
- ?>
21
- <div class="updated"><p><strong><?php _e('Changes saved.'); ?></strong></p></div>
22
- <?php
23
- }
24
- add_action ( 'admin_notices', 'em_options_saved_notice' );
25
- }
26
- }
27
- add_action('admin_head', 'em_options_save');
28
-
29
-
30
-
31
- function dbem_options_subpanel() {
32
- //TODO place all options into an array
33
- $save_button = '<tr><th>&nbsp;</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">
36
- jQuery(document).ready(function($){
37
- var close_text = '<?php _e('Collapse All','dbem'); ?>';
38
- var open_text = '<?php _e('Expand All','dbem'); ?>';
39
- var open_close = $('<a href="#" style="display:block; float:right; clear:right; margin:10px;">'+close_text+'</a>');
40
- $('#icon-options-general').after(open_close);
41
- open_close.click( function(e){
42
- e.preventDefault();
43
- if($(this).text() == close_text){
44
- $(".postbox").addClass('closed');
45
- $(this).text(open_text);
46
- }else{
47
- $(".postbox").removeClass('closed');
48
- $(this).text(close_text);
49
- }
50
- });
51
- //For rewrite titles
52
- $('input:radio[name=dbem_disable_title_rewrites]').live('change',function(){
53
- checked_check = $('input:radio[name=dbem_disable_title_rewrites]:checked');
54
- if( checked_check.val() == 1 ){
55
- $('#dbem_title_html_row').show();
56
- }else{
57
- $('#dbem_title_html_row').hide();
58
- }
59
- });
60
- $('input:radio[name=dbem_disable_title_rewrites]').trigger('change');
61
-
62
- });
63
- </script>
64
- <div class="wrap">
65
- <div id='icon-options-general' class='icon32'><br />
66
- </div>
67
- <h2><?php _e ( 'Event Manager Options', 'dbem' ); ?></h2>
68
-
69
- <form id="dbem_options_form" method="post" action="">
70
-
71
- <div class="metabox-holder">
72
- <!-- // TODO Move style in css -->
73
- <div class='postbox-container' style='width: 99.5%'>
74
- <div id="" class="meta-box-sortables" >
75
-
76
- <div class="postbox " >
77
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'General options', 'dbem' ); ?> </span></h3>
78
- <div class="inside">
79
- <table class="form-table">
80
- <?php
81
- dbem_options_radio_binary ( __( 'Use dropdown for locations?' ), 'dbem_use_select_for_locations', __( 'Select yes to select location from a drow-down menu; location selection will be faster, but you will lose the ability to insert locations with events','dbem' ) );
82
- dbem_options_radio_binary ( __( 'Use recurrence?' ), 'dbem_recurrence_enabled', __( 'Select yes to enable the recurrence features feature','dbem' ) );
83
- dbem_options_radio_binary ( __( 'Use RSVP?' ), 'dbem_rsvp_enabled', __( 'Select yes to enable the RSVP feature','dbem' ) );
84
- dbem_options_radio_binary ( __( 'Use categories?' ), 'dbem_categories_enabled', __( 'Select yes to enable the category features','dbem' ) );
85
- dbem_options_radio_binary ( __( 'Use attributes?' ), 'dbem_attributes_enabled', __( 'Select yes to enable the attributes feature','dbem' ) );
86
- echo $save_button;
87
- ?>
88
- </table>
89
-
90
- </div> <!-- . inside -->
91
- </div> <!-- .postbox -->
92
-
93
- <div class="postbox " >
94
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Events page', 'dbem' ); ?> </span></h3>
95
- <div class="inside">
96
- <table class="form-table">
97
- <?php
98
- //Wordpress Pages
99
- global $em_disable_filter; //Using a flag here instead
100
- $em_disable_filter = true;
101
- $get_pages = get_pages();
102
- $events_page_options = array();
103
- $events_page_options[0] = __('[No Events Page]');
104
- //TODO Add the hierarchy style ddm, like when choosing page parents
105
- foreach($get_pages as $page){
106
- $events_page_options[$page->ID] = $page->post_title;
107
- }
108
- dbem_options_select ( __( 'Events page' ), 'dbem_events_page', $events_page_options, __( 'This option allows you to select which page to use as an events page','dbem' ) );
109
- $em_disable_filter = false;
110
- //Rest
111
- dbem_options_radio_binary ( __( 'Show events page in lists?', 'dbem' ), 'dbem_list_events_page', __( 'Check this option if you want the events page to appear together with other pages in pages lists.', 'dbem' ) );
112
- dbem_options_radio_binary ( __( 'Display calendar in events page?', 'dbem' ), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','dbem' ).' '.__('If you would like to show events that span over more than one day, see the Calendar section on this page.','dbem') );
113
- dbem_options_radio_binary ( __( 'Disable title rewriting?', 'dbem' ), 'dbem_disable_title_rewrites', __( "Some wordpress themes don't follow best practices when generating navigation menus, and so the automatic title rewriting feature may cause problems, if your menus aren't working correctly on the event pages, try setting this to 'Yes', and provide an appropriate HTML title format below.",'dbem' ) );
114
- dbem_options_input_text ( __( 'Event Manager titles', 'dbem' ), 'dbem_title_html', __( "This only setting only matters if you selected 'Yes' to above. You will notice the events page titles aren't being rewritten, and you have a new title underneath the default page name. This is where you control the HTML of this title. Make sure you keep the #_PAGETITLE placeholder here, as that's what is rewritten by events manager. To control what's rewritten in this title, see settings further down for page titles.", 'dbem' ) );
115
- dbem_options_input_text ( __( 'Event List Limits', 'dbem' ), 'dbem_events_default_limit', __( "This will control how many events are shown on one list by default.", 'dbem' ) );
116
- ?>
117
- <tr valign="top" id='dbem_events_default_orderby_row'>
118
- <th scope="row"><?php _e('Default event list ordering','dbem'); ?></th>
119
- <td>
120
- <select name="dbem_events_default_orderby" >
121
- <?php
122
- $orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
123
- 'start_date,start_time,name' => __('Order by start date, start time, then event name','dbem'),
124
- 'name,start_date,start_time' => __('Order by name, start date, then start time','dbem'),
125
- 'name,end_date,end_time' => __('Order by name, end date, then end time','dbem'),
126
- 'end_date,end_time,name' => __('Order by end date, end time, then event name','dbem'),
127
- ));
128
- ?>
129
- <?php foreach($orderby_options as $key => $value) : ?>
130
- <option value='<?php echo $key ?>' <?php echo ($key == get_option('dbem_events_default_orderby')) ? "selected='selected'" : ''; ?>>
131
- <?php echo $value; ?>
132
- </option>
133
- <?php endforeach; ?>
134
- </select>
135
- <select name="dbem_events_default_order" >
136
- <?php
137
- $ascending = __('Ascending','dbem');
138
- $descending = __('Descending','dbem');
139
- $order_options = apply_filters('em_settings_events_default_order_ddm', array(
140
- 'ASC' => __('All Ascending','dbem'),
141
- 'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'dbem'),
142
- 'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'dbem'),
143
- 'DESC' => __('All Descending','dbem'),
144
- 'ASC,DESC,ASC' => __("$ascending, $descending, $ascending",'dbem'),
145
- 'ASC,DESC,DESC' => __("$ascending, $descending, $descending",'dbem'),
146
- 'ASC,ASC,DESC' => __("$ascending, $ascending, $descending",'dbem'),
147
- 'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'dbem'),
148
- ));
149
- ?>
150
- <?php foreach( $order_options as $key => $value) : ?>
151
- <option value='<?php echo $key ?>' <?php echo ($key == get_option('dbem_events_default_order')) ? "selected='selected'" : ''; ?>>
152
- <?php echo $value; ?>
153
- </option>
154
- <?php endforeach; ?>
155
- </select>
156
- <br/>
157
- <?php _e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.','dbem'); ?>
158
- </td>
159
- </tr>
160
- <?php
161
- echo $save_button;
162
- ?>
163
- </table>
164
- </div> <!-- . inside -->
165
- </div> <!-- .postbox -->
166
-
167
- <div class="postbox " >
168
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Events format', 'dbem' ); ?> </span></h3>
169
- <div class="inside">
170
- <table class="form-table">
171
- <?php
172
- dbem_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
- dbem_options_textarea ( __( 'Default event list format', 'dbem' ), 'dbem_event_list_item_format', __( 'The format of any events in a list.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_LOCATION</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_NOTES</code>.<br/> Use <code>#_EXCERPT</code> to show <code>#_NOTES</code> until you place a &lt;!&ndash;&ndash; more &ndash;&ndash;&gt; marker.<br/> Use <code>#_LINKEDNAME</code> for the event name with a link to the given event page.<br/> Use <code>#_EVENTPAGEURL</code> to print the event page URL and make your own customised links.<br/> Use <code>#_LOCATIONPAGEURL</code> to print the location page URL and make your own customised links.<br/>Use <code>#_EDITEVENTLINK</code> to add add a link to edit page for the event, which will appear only when a user is logged in.<br/>To insert date and time 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/> For the end time, put <code>#@</code> in front of the character, ie. <code>#@h</code>, <code>#@i</code>, etc.<br/> You can also create a date format without prepending <code>#</code> by wrapping it in #_{} or #@_{} (e.g. <code>#_{d/m/Y}</code>). If there is no end date, the value is not shown.<br/>Feel free to use HTML tags as <code>li</code>, <code>br</code> and so on.<br/>For custom attributes, you use <code>#_ATT{key}{alternative text}</code>, the second braces are optional and will appear if the attribute is not defined or left blank for that event. This key will appear as an option when adding attributes to your event.', 'dbem' ) );
174
- dbem_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
- dbem_options_input_text ( __( 'Single event page title format', 'dbem' ), 'dbem_event_page_title_format', __( 'The format of a single event page title. Follow the previous formatting instructions.', 'dbem' ) );
176
- dbem_options_textarea ( __( 'Default single event format', 'dbem' ), 'dbem_single_event_format', __( 'The format of a single event page.<br/>Follow the previous formatting instructions. <br/>Use <code>#_MAP</code> to insert a map.<br/>Use <code>#_CONTACTNAME</code>, <code>#_CONTACTEMAIL</code>, <code>#_CONTACTPHONE</code> to insert respectively the name, e-mail address and phone number of the designated contact person. <br/>Use <code>#_ADDBOOKINGFORM</code> to insert a form to allow the user to respond to your events reserving one or more places (RSVP).<br/> Use <code>#_REMOVEBOOKINGFORM</code> to insert a form where users, inserting their name and e-mail address, can remove their bookings.', 'dbem' ) );
177
- dbem_options_input_text ( __( 'Events page title', 'dbem' ), 'dbem_events_page_title', __( 'The title on the multiple events page.', 'dbem' ) );
178
- dbem_options_input_text ( __( 'No events message', 'dbem' ), 'dbem_no_events_message', __( 'The message displayed when no events are available.', 'dbem' ) );
179
- dbem_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' ) );
180
- echo $save_button;
181
- ?>
182
- </table>
183
- </div> <!-- . inside -->
184
- </div> <!-- .postbox -->
185
-
186
- <div class="postbox " >
187
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Calendar format', 'dbem' ); ?></span></h3>
188
- <div class="inside">
189
- <table class="form-table">
190
- <?php
191
- dbem_options_input_text ( __( 'Small calendar title', 'dbem' ), 'dbem_small_calendar_event_title_format', __( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ) );
192
- dbem_options_input_text ( __( 'Small calendar title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
193
- dbem_options_input_text ( __( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ) );
194
- dbem_options_radio_binary ( __( 'Show long events on calendar pages?', 'dbem' ), 'dbem_full_calendar_long_events', __( "If you are showing a calendar on the events page (see Events format section on this page), you have the option of showing events that span over days on each day it occurs.",'dbem' ) );
195
- dbem_options_radio_binary ( __( 'Show list on day with single event?', 'dbem' ), 'dbem_display_calendar_day_single', __( "By default, if a calendar day only has one event, it display a single event when clicking on the link of that calendar date. If you select Yes here, you will get always see a list of events.",'dbem' ) );
196
- echo $save_button;
197
- ?>
198
- </table>
199
- </div> <!-- . inside -->
200
- </div> <!-- .postbox -->
201
-
202
- <div class="postbox " >
203
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Locations format', 'dbem' ); ?> </span></h3>
204
- <div class="inside">
205
- <table class="form-table">
206
- <?php
207
- dbem_options_input_text ( __( 'Single location page title format', 'dbem' ), 'dbem_location_page_title_format', __( 'The format of a single location page title.<br/>Follow the previous formatting instructions.', 'dbem' ) );
208
- dbem_options_textarea ( __( 'Default single location page format', 'dbem' ), 'dbem_single_location_format', __( 'The format of a single location page.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code>.<br/> Use <code>#_MAP</code> to display a map of the event location, and <code>#_IMAGE</code> to display an image of the location.<br/> Use <code>#_NEXTEVENTS</code> to insert a list of the upcoming events, <code>#_PASTEVENTS</code> for a list of past events, <code>#_ALLEVENTS</code> for a list of all events taking place in this location.', 'dbem' ) );
209
- dbem_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.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code> or <code>#_IMAGE</code>.', 'dbem' ) );
210
- dbem_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. <br/> Follow the events formatting instructions', 'dbem' ) );
211
- dbem_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
- ?>
214
- </table>
215
- </div> <!-- . inside -->
216
- </div> <!-- .postbox -->
217
-
218
- <div class="postbox " >
219
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'RSS feed format', 'dbem' ); ?> </span></h3>
220
- <div class="inside">
221
- <table class="form-table">
222
- <?php
223
- dbem_options_input_text ( __( 'RSS main title', 'dbem' ), 'dbem_rss_main_title', __( 'The main title of your RSS events feed.', 'dbem' ) );
224
- dbem_options_input_text ( __( 'RSS main description', 'dbem' ), 'dbem_rss_main_description', __( 'The main description of your RSS events feed.', 'dbem' ) );
225
- dbem_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
- dbem_options_input_text ( __( 'RSS description format', 'dbem' ), 'dbem_rss_description_format', __( 'The format of the description of each item in the events RSS feed. Follow the previous formatting instructions.', 'dbem' ) );
227
- echo $save_button;
228
- ?>
229
- </table>
230
- </div> <!-- . inside -->
231
- </div> <!-- .postbox -->
232
-
233
- <div class="postbox " >
234
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Maps and geotagging', 'dbem' ); ?> </span></h3>
235
- <div class="inside">
236
- <table class='form-table'>
237
- <?php $gmap_is_active = get_option ( 'dbem_gmap_is_active' ); ?>
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'":''; ?> /><?php _e ( 'Yes' ); ?><br />
242
- <input name="dbem_gmap_is_active" type="radio" value="0" <?php echo ($gmap_is_active) ? '':"checked='checked'"; ?> /> <?php _e ( 'No' ); ?> <br />
243
- <?php _e ( 'Check this option to enable Goggle Map integration.', 'dbem' )?>
244
- </td>
245
- </tr>
246
- <?php
247
- dbem_options_textarea ( __( 'Map text format', 'dbem' ), 'dbem_map_text_format', __( 'The text format inside the map balloons.<br/>Follow the previous formatting instructions.', 'dbem' ) );
248
- echo $save_button;
249
- ?>
250
- </table>
251
- </div> <!-- . inside -->
252
- </div> <!-- .postbox -->
253
-
254
- <div class="postbox " >
255
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'RSVP and bookings', 'dbem' ); ?> </span></h3>
256
- <div class="inside">
257
- <table class='form-table'>
258
- <?php
259
- dbem_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
- dbem_options_radio_binary ( __( 'Enable the RSVP e-mail notifications?', 'dbem' ), 'dbem_rsvp_mail_notify_is_active', __( 'Check this option if you want to receive an email when someone books places for your events.', 'dbem' ) );
261
- dbem_options_textarea ( __( 'Contact person email format', 'dbem' ), 'dbem_contactperson_email_body', __( 'The format of the email which will be sent to the contact person. Follow the events formatting instructions. <br/>Use <code>#_RESPNAME</code>, <code>#_RESPEMAIL</code> and <code>#_RESPPHONE</code> to display respectively the name, e-mail, address and phone of the respondent.<br/>Use <code>#_SPACES</code> to display the number of spaces reserved by the respondent. Use <code>#_COMMENT</code> to display the respondent\'s comment. <br/> Use <code>#_BOOKEDSEATS</code> and <code>#_AVAILABLESEATS</code> to display respectively the number of booked and available seats.', 'dbem' ) );
262
- dbem_options_textarea ( __( 'Contact person email format', 'dbem' ), 'dbem_respondent_email_body', __( 'The format of the email which will be sent to respondent. Follow the events formatting instructions. <br/>Use <code>#_RESPNAME</code> to display the name of the respondent.<br/>Use <code>#_CONTACTNAME</code> and <code>#_CONTACTEMAIL</code> a to display respectively the name and e-mail of the contact person.<br/>Use <code>#_SPACES</code> to display the number of spaces reserved by the respondent. Use <code>#_COMMENT</code> to display the respondent\'s comment.', 'dbem' ) );
263
- dbem_options_input_text ( __( 'Default notification receiver address', 'dbem' ), 'dbem_mail_receiver_address', __( "Insert the address of the receiver of your notifications", 'dbem' ) );
264
- echo $save_button;
265
- ?>
266
- </table>
267
- </div> <!-- . inside -->
268
- </div> <!-- .postbox -->
269
-
270
- <div class="postbox " >
271
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Email Settings', 'dbem' ); ?> </span></h3>
272
- <div class="inside">
273
- <table class='form-table'>
274
- <?php
275
- dbem_options_input_text ( __( 'Notification sender name', 'dbem' ), 'dbem_mail_sender_name', __( "Insert the display name of the notification sender.", 'dbem' ) );
276
- dbem_options_input_text ( __( 'Notification sender address', 'dbem' ), 'dbem_mail_sender_address', __( "Insert the address of the notification sender.", 'dbem' ) );
277
- dbem_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
- dbem_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
- dbem_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
- dbem_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
- dbem_options_input_text ( __( 'SMTP username', 'dbem' ), 'dbem_smtp_username', __( "Insert the username to be used to access your SMTP server.", 'dbem' ) );
282
- dbem_options_input_password ( __( 'SMTP password', 'dbem' ), "dbem_smtp_password", __( "Insert the password to be used to access your SMTP server", 'dbem' ) );
283
- echo $save_button;
284
- ?>
285
- </table>
286
- </div> <!-- . inside -->
287
- </div> <!-- .postbox -->
288
-
289
- <div class="postbox " >
290
- <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Images size', 'dbem' ); ?> </span></h3>
291
- <div class="inside">
292
- <table class='form-table'>
293
- <?php
294
- dbem_options_input_text ( __( 'Maximum width (px)', 'dbem' ), 'dbem_image_max_width', __( 'The maximum allowed width for images uploades', 'dbem' ) );
295
- dbem_options_input_text ( __( 'Maximum height (px)', 'dbem' ), 'dbem_image_max_height', __( "The maximum allowed height for images uploaded, in pixels", 'dbem' ) );
296
- dbem_options_input_text ( __( 'Maximum size (bytes)', 'dbem' ), 'dbem_image_max_size', __( "The maximum allowed size for images uploaded, in pixels", 'dbem' ) );
297
- ?>
298
- </table>
299
- </div> <!-- . inside -->
300
- </div> <!-- .postbox -->
301
-
302
- <p class="submit">
303
- <input type="submit" id="dbem_options_submit" name="Submit" value="<?php _e ( 'Save Changes' )?>" />
304
- <input type="hidden" name="em-submitted" value="1" />
305
- </p>
306
-
307
- </div> <!-- .metabox-sortables -->
308
- </div> <!-- .postbox-container -->
309
-
310
- </div> <!-- .metabox-holder -->
311
- </form>
312
- </div>
313
- <?php
314
- }
315
- ?>
classes/{booking.php → em-booking.php} RENAMED
File without changes
classes/{bookings.php → em-bookings.php} RENAMED
@@ -60,16 +60,18 @@ 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
- $EM_Booking->seats += $new_seats;
65
$result = $EM_Booking->save();
66
if($result){
67
$email = $this->email($EM_Booking);
68
}
69
} else {
70
//New booking, so let's save the booking
71
$result = $EM_Booking->save();
72
if($result){
73
$email = $this->email($EM_Booking);
74
}
75
}
@@ -169,9 +171,8 @@ class EM_Bookings extends EM_Object{
169
'#_RESPNAME' => '#_BOOKINGNAME',//Depreciated
170
'#_RESPEMAIL' => '#_BOOKINGEMAIL',//Depreciated
171
'#_RESPPHONE' => '#_BOOKINGPHONE',//Depreciated
172
- '#_SPACES' => '#_BOOKINGSPACES',//Depreciated
173
'#_COMMENT' => '#_BOOKINGCOMMENT',//Depreciated
174
- '#_RESERVEDSPACES' => '#_BOOKEDSEATS',//Depreciated
175
'#_BOOKINGNAME' => $EM_Booking->person->name,
176
'#_BOOKINGEMAIL' => $EM_Booking->person->email,
177
'#_BOOKINGPHONE' => $EM_Booking->person->phone,
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
72
$result = $EM_Booking->save();
73
if($result){
74
+ $this->bookings[] = $EM_Booking;
75
$email = $this->email($EM_Booking);
76
}
77
}
171
'#_RESPNAME' => '#_BOOKINGNAME',//Depreciated
172
'#_RESPEMAIL' => '#_BOOKINGEMAIL',//Depreciated
173
'#_RESPPHONE' => '#_BOOKINGPHONE',//Depreciated
174
'#_COMMENT' => '#_BOOKINGCOMMENT',//Depreciated
175
+ '#_RESERVEDSPACES' => '#_BOOKEDSPACES',//Depreciated
176
'#_BOOKINGNAME' => $EM_Booking->person->name,
177
'#_BOOKINGEMAIL' => $EM_Booking->person->email,
178
'#_BOOKINGPHONE' => $EM_Booking->person->phone,
classes/{calendar.php → em-calendar.php} RENAMED
@@ -222,8 +222,8 @@ class EM_Calendar extends EM_Object {
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 = strtotime($event->start_date);
226
- $event_end_date = strtotime($event->end_date);
227
if( $event_end_date == '' ) $event_end_date = $event_start_date;
228
while( $event_start_date <= $event_end_date ){
229
$event_eventful_date = date('Y-m-d', $event_start_date);
@@ -292,7 +292,7 @@ class EM_Calendar extends EM_Object {
292
}
293
}
294
}
295
- return '<div id="em-calendar-'.rand(100,200).'" class="em-calendar-wrapper">'.$calendar.'</div>';
296
}
297
298
/**
@@ -309,7 +309,7 @@ class EM_Calendar extends EM_Object {
309
310
311
function days_in_month($month, $year) {
312
- return cal_days_in_month(CAL_GREGORIAN, $month, $year);
313
}
314
315
function translate_and_trim($string, $length = 1) {
@@ -326,7 +326,7 @@ class EM_Calendar extends EM_Object {
326
$atts = parent::get_default_search($defaults, $array);
327
$atts['full'] = ($atts['full']==true) ? 1:0;
328
$atts['long_events'] = ($atts['long_events']==true) ? 1:0;
329
- return $atts;
330
}
331
}
332
add_action('init', array('EM_Calendar', 'init'));
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 = apply_filters('em_calendar_loop_date_start', strtotime($event->start));
226
+ $event_end_date = apply_filters('em_calendar_loop_date_end', strtotime($event->end));
227
if( $event_end_date == '' ) $event_end_date = $event_start_date;
228
while( $event_start_date <= $event_end_date ){
229
$event_eventful_date = date('Y-m-d', $event_start_date);
292
}
293
}
294
}
295
+ return apply_filters('em_calendar_output', '<div id="em-calendar-'.rand(100,200).'" class="em-calendar-wrapper">'.$calendar.'</div>');
296
}
297
298
/**
309
310
311
function days_in_month($month, $year) {
312
+ return date('t', strtotime("$year-$month-1"));
313
}
314
315
function translate_and_trim($string, $length = 1) {
326
$atts = parent::get_default_search($defaults, $array);
327
$atts['full'] = ($atts['full']==true) ? 1:0;
328
$atts['long_events'] = ($atts['long_events']==true) ? 1:0;
329
+ return apply_filters('em_calendar_get_default_search', $atts, $array, $defaults);
330
}
331
}
332
add_action('init', array('EM_Calendar', 'init'));
classes/{category.php → em-category.php} RENAMED
File without changes
classes/{event.php → em-event.php} RENAMED
@@ -39,6 +39,18 @@ class EM_Event extends EM_Object{
39
'recurrence_byweekno' => array( 'name'=>'byweekno', 'type'=>'%d' ) //if monthly which week (-1 is last)
40
);
41
42
/**
43
* @var EM_Location
44
*/
@@ -103,6 +115,10 @@ class EM_Event extends EM_Object{
103
$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
104
$this->to_object($event, true);
105
106
//Add Contact Person
107
if($this->contactperson_id){
108
if($this->contactperson_id > 0){
@@ -129,17 +145,17 @@ class EM_Event extends EM_Object{
129
*/
130
function get_post(){
131
//Build Event Array
132
- $post = $_POST;
133
- $this->name = stripslashes ( $_POST ["event_name"] );
134
- $this->start_date = $_POST ["event_start_date"];
135
- $this->end_date = ($_POST ['event_end_date'] == '') ? $this->start_date : $_POST ["event_end_date"];
136
- $this->rsvp = ( $_POST ['event_rsvp'] == 1 ) ? 1:0;
137
- $this->seats = ( is_numeric($_POST ['event_seats']) ) ? $_POST ['event_seats']:0;
138
- $this->notes = stripslashes ( $_POST ['content'] ); //WP TinyMCE field
139
//Sort out time
140
//TODO make time handling less painful
141
$match = array();
142
- if( preg_match ( '/^([01]\d|2[0-3]):([0-5]\d)(AM|PM)?#x2F;', $_POST['event_start_time'], $match ) ){
143
if( $match[3] == 'PM' && $match[1] != 12 ){
144
$match[1] = 12+$match[1];
145
}elseif( $match[3] == 'AM' && $match[1] == 12 ){
@@ -149,7 +165,7 @@ class EM_Event extends EM_Object{
149
}else{
150
$this->start_time = "00:00:00";
151
}
152
- if( preg_match ( '/^([01]\d|2[0-3]):([0-5]\d)(AM|PM)?#x2F;', $_POST['event_end_time'], $match ) ){
153
if( $match[3] == 'PM' && $match[1] != 12 ){
154
$match[1] = 12+$match[1];
155
}elseif( $match[3] == 'AM' && $match[1] == 12 ){
@@ -159,45 +175,48 @@ class EM_Event extends EM_Object{
159
}else{
160
$this->end_time = $this->start_time;
161
}
162
//Contact Person
163
- if ( is_numeric($_POST['event_contactperson_id']) ) {
164
//TODO contactperson choices needs limiting depending on role
165
- $this->contactperson_id = $_POST ['event_contactperson_id'];
166
}
167
//category
168
- if( is_numeric($_POST ['event_category_id']) ){
169
- $this->category_id = $_POST ['event_category_id'];
170
}
171
//Attributes
172
$event_attributes = array();
173
- for($i=1 ; trim($_POST["mtm_{$i}_ref"])!='' ; $i++ ){
174
- if(trim($_POST["mtm_{$i}_name"]) != ''){
175
$event_attributes[$_POST["mtm_{$i}_ref"]] = stripslashes($_POST["mtm_{$i}_name"]);
176
}
177
}
178
$this->attributes = $event_attributes;
179
//Recurrence data
180
- $this->recurrence_id = ( is_numeric($_POST ['recurrence_id']) ) ? $_POST ['recurrence_id'] : 0 ;
181
- if($_POST ['repeated_event']){
182
$this->recurrence = 1;
183
- $this->freq = in_array($_POST['recurrence_freq'], array('daily','weekly','monthly')) ? $_POST['recurrence_freq']:'daily';
184
- if($this->freq == 'weekly' && self::array_is_numeric($_POST ['recurrence_bydays'])){
185
- $this->byday = implode ( ",", $_POST ['recurrence_bydays'] );
186
- }elseif($this->freq == 'monthly'){
187
- $this->byday = $_POST ['recurrence_byday'];
188
}
189
- $this->interval = ($_POST ['recurrence_interval'] == "") ? 1 : $_POST ['recurrence_interval'];
190
- $this->byweekno = $_POST ['recurrence_byweekno'];
191
}
192
193
//Add location information, or just link to previous location, this is a requirement...
194
- if( isset($_POST['location-select-id']) && $_POST['location-select-id'] != "" ) {
195
$this->location = new EM_Location($_POST['location-select-id']);
196
} else {
197
$this->location = new EM_Location($_POST);
198
$this->location->load_similar($_POST);
199
}
200
- return $this->validate();
201
}
202
203
/**
@@ -208,12 +227,13 @@ class EM_Event extends EM_Object{
208
function save(){
209
//FIXME Event doesn't save title when inserting first time
210
global $wpdb, $current_user;
211
- get_currentuserinfo();;
212
$events_table = $wpdb->prefix.EM_EVENTS_TABLE;
213
//First let's save the location, no location no event!
214
if ( !$this->location->id && !$this->location->save() ){ //shouldn't try to save if location exists
215
$this->errors[] = __ ( 'There was a problem saving the location so event was not saved.', 'dbem' );
216
- return false;
217
}
218
$this->location_id = $this->location->id;
219
//TODO make contactperson_id NULL if not used
@@ -235,15 +255,15 @@ class EM_Event extends EM_Object{
235
$this->errors[] = __ ( 'Something went wrong with the recurrence update...', 'dbem' ).
236
__ ( 'There was a problem saving the recurring events.', 'dbem' );
237
$this->delete();
238
- return false;
239
}
240
//All good! Event Saved
241
$this->feedback_message = __ ( 'New recurrent event inserted!', 'dbem' );
242
- return true;
243
}
244
//Successful individual save
245
$this->feedback_message = __ ( 'New event successfully inserted!', 'dbem' );
246
- return true;
247
}else{
248
$this->errors[] = __ ( 'Could not save the event details due to a database error.', 'dbem' );
249
}
@@ -262,39 +282,42 @@ class EM_Event extends EM_Object{
262
if( !$this->save_events() ){
263
$this->errors[] = __ ( 'Something went wrong with the recurrence update...', 'dbem' ).
264
__ ( 'There was a problem saving the recurring events.', 'dbem' );
265
- return false;
266
}
267
$this->feedback_message = __ ( 'Recurrence updated!', 'dbem' );
268
- return true;
269
}
270
}else{
271
$this->errors[] = __('Could not save the event details due to a database error.', 'dbem');
272
- return false;
273
}
274
//Successful individual or recurrence save
275
$this->feedback_message = "'{$this->name}' " . __ ( 'updated', 'dbem' ) . "!";
276
if($this->rsvp == 0){
277
$this->delete_bookings();
278
}
279
- return true;
280
}
281
}
282
283
/**
284
* Delete whole event, including recurrence and recurring data
285
* @param $recurrence_id
286
- * @return null
287
*/
288
function delete(){
289
global $wpdb;
290
if( $this->is_recurring() ){
291
//Delete the recurrences then this recurrence event
292
$this->delete_events();
293
}
294
$result = $wpdb->query ( $wpdb->prepare("DELETE FROM ". $wpdb->prefix . EM_EVENTS_TABLE ." WHERE event_id=%d", $this->id) );
295
if($result !== false){
296
- $bookings_result = $this->get_bookings()->delete();
297
}
298
}
299
300
/**
@@ -312,10 +335,10 @@ class EM_Event extends EM_Object{
312
//Get the ID of the new item
313
$event_ID = $wpdb->insert_id;
314
$EM_Event = new EM_Event( $event_ID );
315
- return $EM_Event;
316
}else{
317
//TODO add error notifications for duplication failures.
318
- return false;
319
}
320
}
321
@@ -336,14 +359,14 @@ class EM_Event extends EM_Object{
336
// TODO Create friendly equivelant names for missing fields notice in validation
337
$this->errors[] = __ ( 'Missing fields: ' ) . implode ( ", ", $missing_fields ) . ". ";
338
}
339
- if ( $_POST ['repeated_event'] == "1" && $this->end_date == "" ){
340
$this->errors[] = __ ( 'Since the event is repeated, you must specify an event date.', 'dbem' );
341
}
342
if( !$this->location->validate() ){
343
$this->errors = array_merge($this->errors, $this->location->errors);
344
}
345
//TODO validate recurrence during event validate
346
- return ( count($this->errors) == 0 );
347
}
348
349
@@ -355,7 +378,7 @@ class EM_Event extends EM_Object{
355
global $wpdb;
356
$sql = "SELECT category_id, category_name FROM ".$wpdb->prefix.EM_EVENTS_TABLE." LEFT JOIN ".$wpdb->prefix.EM_CATEGORIES_TABLE." ON category_id=event_category_id WHERE event_id ='".$this->id."'";
357
$category = $wpdb->get_row($sql, ARRAY_A);
358
- return $category;
359
}
360
361
/**
@@ -363,7 +386,9 @@ class EM_Event extends EM_Object{
363
*/
364
function delete_bookings(){
365
global $wpdb;
366
- return $wpdb->query( $wpdb->prepare("DELETE FROM ".$wpdb->prefix.EM_BOOKINGS_TABLE." WHERE event_id=%d", $this->id) );
367
}
368
369
/**
@@ -377,7 +402,7 @@ class EM_Event extends EM_Object{
377
$this->bookings = new EM_Bookings($this);
378
}
379
}
380
- return $this->bookings;
381
}
382
383
/**
@@ -388,7 +413,7 @@ class EM_Event extends EM_Object{
388
*/
389
function output_single($target='html'){
390
$format = get_option ( 'dbem_single_event_format' );
391
- return $this->output($format, $target);
392
}
393
394
/**
@@ -399,7 +424,7 @@ class EM_Event extends EM_Object{
399
*/
400
function output_list($target='html'){
401
$format = get_option ( 'dbem_event_list_item_format' );
402
- return $this->output($format, $target);
403
}
404
405
/**
@@ -459,7 +484,7 @@ class EM_Event extends EM_Object{
459
case '#_EDITEVENTLINK':
460
if(is_user_logged_in()){
461
//TODO user should have permission to edit the event
462
- $replace = "<a href=' ".get_bloginfo('wpurl')."/wp-admin/edit.php?page=events-manager/events-manager.php&action=edit_event&event_id=".$this->id."'>".__('Edit').' '.__('Event', 'dbem')."</a>";
463
}
464
break;
465
//Bookings
@@ -501,7 +526,7 @@ class EM_Event extends EM_Object{
501
break;
502
case '#_CONTACTEMAIL':
503
case '#_CONTACTMAIL': //Depreciated
504
- $replace = dbem_ascii_encode($this->contact->user_email);
505
break;
506
case '#_CONTACTPHONE':
507
$replace = ( $this->contact->phone != '') ? $this->contact->phone : __('N/A', 'dbem');
@@ -512,7 +537,7 @@ class EM_Event extends EM_Object{
512
}
513
if($match){ //if true, we've got a placeholder that needs replacing
514
//TODO FILTER - placeholder filter
515
- $replace = apply_filters('em_placeholder', $replace, $result, $target); //USE WITH CAUTION! THIS MIGHT GET RENAMED
516
$event_string = str_replace($result, $replace , $event_string );
517
}
518
}
@@ -520,12 +545,16 @@ class EM_Event extends EM_Object{
520
foreach($placeholders[0] as $result) {
521
// matches all PHP START date and time placeholders
522
if (preg_match('/^#[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]#x2F;', $result)) {
523
- $event_string = str_replace($result, mysql2date(ltrim($result, "#"), $this->start_date.$this->start_time),$event_string );
524
}
525
// matches all PHP END time placeholders for endtime
526
if (preg_match('/^#@[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]#x2F;', $result)) {
527
- $event_string = str_replace($result, mysql2date(ltrim($result, "#@"), $this->end_date.$this->end_time), $event_string );
528
- }
529
}
530
//Time place holder that doesn't show if empty.
531
preg_match_all('/#@?_\{[A-Za-z0-9 -\/,\.\\\]+\}/', $format, $results);
@@ -548,17 +577,19 @@ class EM_Event extends EM_Object{
548
foreach($results[0] as $resultKey => $result) {
549
//Strip string of placeholder and just leave the reference
550
$attRef = substr( substr($result, 0, strpos($result, '}')), 6 );
551
- $attString = $this->attributes[$attRef];
552
- if( trim($attString) == '' && $results[1][$resultKey] != '' ){
553
- //Check to see if we have a second set of braces;
554
- $attString = substr( $results[1][$resultKey], 1, strlen(trim($results[1][$resultKey]))-2 );
555
}
556
$event_string = str_replace($result, $attString ,$event_string );
557
}
558
559
//Now do dependent objects
560
$event_string = $this->location->output($event_string, $target);
561
- return $event_string;
562
}
563
564
/**********************************************************
@@ -571,6 +602,7 @@ class EM_Event extends EM_Object{
571
*/
572
function save_events() {
573
if( $this->is_recurring() ){
574
global $wpdb;
575
$event_saves = array();
576
$matching_days = $this->get_recurrence_days(); //Get days where events recur
@@ -593,7 +625,7 @@ class EM_Event extends EM_Object{
593
//TODO should be EM_DEBUG, and do we really need it?
594
if( DEBUG ){ echo "Entering recurrence " . date("D d M Y", $day)."<br/>"; }
595
}
596
- return !in_array(false, $event_saves);
597
}
598
return false;
599
}
@@ -605,6 +637,7 @@ class EM_Event extends EM_Object{
605
*/
606
function delete_events(){
607
global $wpdb;
608
//So we don't do something we'll regret later, we could just supply the get directly into the delete, but this is safer
609
$EM_Events = EM_Events::get( array('recurrence_id'=>$this->id) );
610
$event_ids = array();
@@ -650,7 +683,7 @@ class EM_Event extends EM_Object{
650
if( $this->is_recurring() ){
651
652
$start_date = strtotime($this->start_date);
653
- $end_date = strtotime($this->end_date);
654
655
$weekdays = explode(",", $this->byday); //what days of the week (or if monthly, one value at index 0)
656
@@ -760,7 +793,6 @@ class EM_Event extends EM_Object{
760
$monthweek_name = array('1' => __('the first %s of the month', 'dbem'),'2' => __('the second %s of the month', 'dbem'), '3' => __('the third %s of the month', 'dbem'), '4' => __('the fourth %s of the month', 'dbem'), '-1' => __('the last %s of the month', 'dbem'));
761
$output = sprintf (__('From %1$s to %2$s', 'dbem'), $recurrence['event_start_date'], $recurrence['event_end_date']).", ";
762
if ($recurrence['recurrence_freq'] == 'daily') {
763
-
764
$freq_desc =__('everyday', 'dbem');
765
if ($recurrence['recurrence_interval'] > 1 ) {
766
$freq_desc = sprintf (__("every %s days", 'dbem'), $recurrence['recurrence_interval']);
@@ -769,20 +801,23 @@ class EM_Event extends EM_Object{
769
if ($recurrence['recurrence_freq'] == 'weekly') {
770
$weekday_array = explode(",", $recurrence['recurrence_byday']);
771
$natural_days = array();
772
- foreach($weekday_array as $day)
773
array_push($natural_days, $weekdays_name[$day]);
774
$output .= implode(" and ", $natural_days);
775
if ($recurrence['recurrence_interval'] > 1 ) {
776
$freq_desc = ", ".sprintf (__("every %s weeks", 'dbem'), $recurrence['recurrence_interval']);
777
}
778
779