Event List - Version 0.4.3

Version Description

(2013-07-05) =

  • added possibility to edit existing categories
  • added tooptip texts for the widget option
  • changed css classes to differ between event-list-view and single-event-view
  • added missing permission check for new events and about page
  • do not change publish date and user when an event is modified
  • fixed a small issue in info messages
  • code improvements and cleanup in admin pages
Download this release

Release Info

Developer mibuthu
Plugin Icon 128x128 Event List
Version 0.4.3
Comparing to
See all releases

Code changes from version 0.4.2 to 0.4.3

admin/admin.php CHANGED
@@ -1,653 +1,94 @@
1
  <?php
2
- if( !defined( 'ABSPATH' ) ) {
3
  exit;
4
  }
5
 
6
- require_once( EL_PATH.'includes/db.php' );
7
- require_once( EL_PATH.'includes/options.php' );
8
- require_once( EL_PATH.'includes/sc_event-list.php' );
9
- require_once( EL_PATH.'includes/categories.php' );
10
- require_once( EL_PATH.'admin/includes/event_table.php' );
11
-
12
  // This class handles all available admin pages
13
  class EL_Admin {
14
- private $db;
15
- private $options;
16
- private $shortcode;
17
- private $categories;
18
- private $event_action = false;
19
- private $event_action_error = false;
20
 
21
- public function __construct() {
22
- $this->db = &EL_Db::get_instance();
23
- $this->options = &EL_Options::get_instance();
24
- $this->shortcode = &SC_Event_List::get_instance();
25
- $this->categories = &EL_Categories::get_instance();
26
- $this->event_action = null;
27
- $this->event_action_error = null;
 
 
 
 
 
 
28
  }
29
 
30
  /**
31
  * Add and register all admin pages in the admin menu
32
  */
33
  public function register_pages() {
34
- add_menu_page( 'Event List', 'Event List', 'edit_posts', 'el_admin_main', array( &$this, 'show_main' ) );
35
- $page = add_submenu_page( 'el_admin_main', 'Events', 'All Events', 'edit_posts', 'el_admin_main', array( &$this, 'show_main' ) );
36
- add_action( 'admin_print_scripts-'.$page, array( &$this, 'embed_admin_main_scripts' ) );
37
- $page = add_submenu_page( 'el_admin_main', 'Add New Event', 'Add New', 'edit_posts', 'el_admin_new', array( &$this, 'show_new' ) );
38
- add_action( 'admin_print_scripts-'.$page, array( &$this, 'embed_admin_new_scripts' ) );
39
- $page = add_submenu_page( 'el_admin_main', 'Event List Settings', 'Settings', 'manage_options', 'el_admin_settings', array( &$this, 'show_settings' ) );
40
- add_action( 'admin_print_scripts-'.$page, array( &$this, 'embed_admin_settings_scripts' ) );
41
- $page = add_submenu_page( 'el_admin_main', 'About Event List', 'About', 'edit_posts', 'el_admin_about', array( &$this, 'show_about' ) );
42
- add_action( 'admin_print_scripts-'.$page, array( &$this, 'embed_admin_about_scripts' ) );
43
- }
44
-
45
- // show the main admin page
46
- public function show_main() {
47
- if ( !current_user_can( 'edit_posts' ) ) {
48
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
49
- }
50
- $action = '';
51
- // is there POST data an event was edited must be updated
52
- if( !empty( $_POST ) ) {
53
- $this->event_action_error = !$this->db->update_event( $_POST, __( 'Y/m/d' ) );
54
- $this->event_action = isset( $_POST['id'] ) ? 'modified' : 'added';
55
- }
56
- // get action
57
- if( isset( $_GET['action'] ) ) {
58
- $action = $_GET['action'];
59
- }
60
- // if an event should be edited a different page must be displayed
61
- if( $action === 'edit' ) {
62
- $this->show_edit();
63
- return;
64
- }
65
- // delete events if required
66
- if( $action === 'delete' && isset( $_GET['id'] ) ) {
67
- $this->event_action_error = !$this->db->delete_events( explode(',', $_GET['id'] ) );
68
- $this->event_action = 'deleted';
69
- }
70
- // automatically set order of table to date, if no manual sorting is set
71
- if( !isset( $_GET['orderby'] ) ) {
72
- $_GET['orderby'] = 'date';
73
- $_GET['order'] = 'asc';
74
- }
75
-
76
- // headline for the normal page
77
- $out ='
78
- <div class="wrap">
79
- <div id="icon-edit-pages" class="icon32"><br /></div><h2>Events <a href="?page=el_admin_new" class="add-new-h2">Add New</a></h2>';
80
- // added messages if required
81
- $out .= $this->show_messages();
82
- // list event table
83
- $out .= $this->list_events();
84
- $out .= '</div>';
85
- echo $out;
86
- }
87
-
88
- public function show_new() {
89
- $out = '<div class="wrap">
90
- <div id="icon-edit-pages" class="icon32"><br /></div><h2>Add New Event</h2>';
91
- $out .= $this->edit_event();
92
- $out .= '</div>';
93
- echo $out;
94
- }
95
-
96
- private function show_edit() {
97
- $out = '<div class="wrap">
98
- <div id="icon-edit-pages" class="icon32"><br /></div><h2>Edit Event</h2>';
99
- $out .= $this->edit_event();
100
- $out .= '</div>';
101
- echo $out;
102
- }
103
-
104
- public function show_settings () {
105
- if (!current_user_can('manage_options')) {
106
- wp_die( __('You do not have sufficient permissions to access this page.') );
107
- }
108
- $out = '';
109
- if( isset( $_GET['settings-updated'] ) ) {
110
- $out .= '<div id="message" class="updated">
111
- <p><strong>'.__( 'Settings saved.' ).'</strong></p>
112
- </div>';
113
- }
114
-
115
- // get action
116
- $action = '';
117
- if( isset( $_GET['action'] ) ) {
118
- $action = $_GET['action'];
119
- }
120
- // delete categories if required
121
- if( $action === 'delete' && isset( $_GET['slug'] ) ) {
122
- $slug_array = explode(', ', $_GET['slug'] );
123
- $num_affected_events = $this->db->remove_category_in_events( $slug_array );
124
- require_once( EL_PATH.'admin/includes/category_table.php' );
125
- if( $this->categories->remove_categories( $slug_array ) ) {
126
- $out .= '<div id="message" class="updated">
127
- <p><strong>'.sprintf( __( 'Category %s was deleted).<br />This Category was also removed in %d events.' ), $_GET['slug'], $num_affected_events ).'</strong></p>
128
- </div>';
129
- }
130
- else {
131
- $out .= '<div id="message" class="error below-h2"><p><strong>Error while deleting category "'.$_GET['slug'].'".</strong></p></div>';
132
- }
133
- }
134
-
135
- $out.= '<div class="wrap">
136
- <div id="icon-edit-pages" class="icon32"><br /></div><h2>Event List Settings</h2>';
137
- if( !isset( $_GET['tab'] ) ) {
138
- $_GET['tab'] = 'category';
139
- }
140
- $out .= $this->show_tabs( $_GET['tab'] );
141
- $out .= '<div id="posttype-page" class="posttypediv">';
142
- $out .= $this->show_options( $_GET['tab'] );
143
- $out .= '
144
- </div>
145
- </div>';
146
- echo $out;
147
- }
148
-
149
- public function show_about() {
150
- $out = '<div class="wrap">
151
- <div id="icon-edit-pages" class="icon32"><br /></div><h2>About Event List</h2>
152
- <h3>Help and Instructions</h3>
153
- <p>You can manage your events <a href="admin.php?page=el_admin_main">here</a>.</p>
154
- <p>To show the events on your site you have two possibilities:
155
- <ul class="el-show-event-options"><li>you can place the <strong>shortcode</strong> <code>[event-list]</code> on any page or post</li>
156
- <li>you can add the <strong>widget</strong> "Event List" in your sidebars</li></ul>
157
- The displayed events and their style can be modified with the available widget settings and the available attributes for the shortcode.<br />
158
- A list of all available shortcode attributes with their description is listed below.<br />
159
- The most available options of the widget should be clear by there description.<br />
160
- It is important to know that you have to insert an URL to the linked event-list page if you enable one of the links options ("Add links to the single events" or "Add a link to an event page").
161
- This is required because the widget didn´t know in which page or post you have insert the shortcode.<br />
162
- Additonally you have to insert the correct Shortcode ID on the linked page. This ID describes which shortcode should be used on the given page or post if you have more than one.
163
- So the standard value "1" is normally o.k., but you can check the ID if you have a look into the URL of an event link on your linked page or post.
164
- The ID is given behind the "_" (e.g. <i>http://www.your-homepage.com/?page_id=99&event_id_<strong>1</strong>=11</i>).
165
- </p>
166
- <p>Be sure to also check the <a href="admin.php?page=el_admin_settings">settings page</a> to get Event List behaving just the way you want.</p>
167
- </div>';
168
- $out .= $this->html_atts();
169
- echo $out;
170
- }
171
-
172
- public function embed_admin_main_scripts() {
173
- // If edit event is selected switch to embed admin_new
174
- if( isset( $_GET['action'] ) && 'edit' === $_GET['action'] ) {
175
- $this->embed_admin_new_scripts();
176
- }
177
- else {
178
- // Proceed with embedding for admin_main
179
- wp_enqueue_script( 'eventlist_admin_main_js', EL_URL.'admin/js/admin_main.js' );
180
- wp_enqueue_style( 'eventlist_admin_main', EL_URL.'admin/css/admin_main.css' );
181
- }
182
- }
183
-
184
- public function embed_admin_new_scripts() {
185
- wp_enqueue_script( 'jquery-ui-datepicker' );
186
- wp_enqueue_script( 'link' );
187
- wp_enqueue_script( 'eventlist_admin_new_js', EL_URL.'admin/js/admin_new.js' );
188
- wp_enqueue_style( 'eventlist_admin_new', EL_URL.'admin/css/admin_new.css' );
189
- }
190
 
191
- public function embed_admin_settings_scripts() {
192
- wp_enqueue_script( 'eventlist_admin_settings_js', EL_URL.'admin/js/admin_settings.js' );
193
- }
194
 
195
- public function embed_admin_about_scripts() {
196
- wp_enqueue_style( 'eventlist_admin_about', EL_URL.'admin/css/admin_about.css' );
197
- }
198
 
199
- private function list_events() {
200
- // show calendar navigation
201
- $out = $this->show_calendar_nav();
202
- // set date range of events being displayed
203
- $date_range = 'upcoming';
204
- if( isset( $_GET['ytd'] ) && is_numeric( $_GET['ytd'] ) ) {
205
- $date_range = $_GET['ytd'];
206
- }
207
- // show event table
208
- // the form is required for bulk actions, the page field is required for plugins to ensure that the form posts back to the current page
209
- $out .= '<form id="event-filter" method="get">
210
- <input type="hidden" name="page" value="'.$_REQUEST['page'].'" />';
211
- // show table
212
- $table = new EL_Event_Table();
213
- $table->prepare_items( $date_range );
214
- ob_start();
215
- $table->display();
216
- $out .= ob_get_contents();
217
- ob_end_clean();
218
- $out .= '</form>';
219
- return $out;
220
- }
221
 
222
- private function edit_event() {
223
- $edit = false;
224
- if( isset( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) {
225
- // existing event
226
- $event = $this->db->get_event( $_GET['id'] );
227
- if( isset( $_GET['action'] ) && $_GET['action'] === 'edit' ) {
228
- // editing of an existing event, if not it would be copy of an existing event
229
- $edit = true;
230
- }
231
- $start_date = strtotime( $event->start_date );
232
- $end_date = strtotime( $event->end_date );
233
- }
234
- else {
235
- //new event
236
- $start_date = time()+1*24*60*60;
237
- $end_date = $start_date;
238
- }
239
-
240
- // Add required data for javascript in a hidden field
241
- $json = json_encode( array( 'el_url' => EL_URL,
242
- 'el_date_format' => $this->datepicker_format( __( 'Y/m/d' ) ) ) );
243
- $out = '
244
- <form method="POST" action="?page=el_admin_main">';
245
- $out .= "
246
- <input type='hidden' id='json_for_js' value='".$json."' />"; // single quote required for value due to json layout
247
- // TODO: saving changed metabox status and order is not working yet
248
- $out .= wp_nonce_field('autosavenonce', 'autosavenonce', false, false );
249
- $out .= wp_nonce_field('closedpostboxesnonce', 'closedpostboxesnonce', false, false );
250
- $out .= wp_nonce_field('meta-box-order-nonce', 'meta-box-order-nonce', false, false );
251
- $out .= '
252
- <div id="poststuff">
253
- <div id="post-body" class="metabox-holder columns-2">
254
- <div id="post-body-content">';
255
- if( true === $edit ) {
256
- $out .= '<input type="hidden" name="id" value="'.$_GET['id'].'" />';
257
- }
258
- $out .= '<table class="form-table">
259
- <tr>
260
- <th><label>Event Title (required)</label></th>
261
- <td><input type="text" class="text form-required" name="title" id="title" value="'.str_replace( '"', '&quot;', isset( $event->title ) ? $event->title : '' ).'" /></td>
262
- </tr>
263
- <tr>
264
- <th><label>Event Date (required)</label></th>
265
- <td><input type="text" class="text datepicker form-required" name="start_date" id="start_date" value="'.date_i18n( __( 'Y/m/d' ), $start_date ).'" />
266
- <span id="end_date_area"> - <input type="text" class="text datepicker" name="end_date" id="end_date" value="'.date_i18n( __( 'Y/m/d' ), $end_date ).'" /></span>
267
- <label><input type="checkbox" name="multiday" id="multiday" value="1" /> Multi-Day Event</label></td>
268
- </tr>
269
- <tr>
270
- <th><label>Event Time</label></th>
271
- <td><input type="text" class="text" name="time" id="time" value="'.str_replace( '"', '&quot;', isset( $event->time ) ? $event->time : '' ).'" /></td>
272
- </tr>
273
- <tr>
274
- <th><label>Event Location</label></th>
275
- <td><input type="text" class="text" name="location" id="location" value="'.str_replace( '"', '&quot;', isset( $event->location ) ? $event->location : '' ).'" /></td>
276
- </tr>
277
- <tr>
278
- <th><label>Event Details</label></th>
279
- <td>';
280
- $editor_settings = array( 'media_buttons' => true,
281
- 'wpautop' => false,
282
- 'textarea_rows' => 20 );
283
- ob_start();
284
- wp_editor( isset( $event->details ) ? $event->details : '', 'details', $editor_settings);
285
- $out .= ob_get_contents();
286
- ob_end_clean();
287
- $out .= '<p class="note">NOTE: In the text editor, use RETURN to start a new paragraph - use SHIFT-RETURN to start a new line.</p></td>
288
- </tr>
289
- </table>';
290
- $out .= '
291
- </div>
292
- <div id="postbox-container-1" class="postbox-container">
293
- <div id="side-sortables" class="meta-box-sortables ui-sortable">';
294
- add_meta_box( 'event-publish', __( 'Publish' ), array( &$this, 'render_publish_metabox' ), 'event-list' );
295
- $metabox_args = isset( $event->categories ) ? array( 'event_cats' => $event->categories ) : null;
296
- add_meta_box( 'event-categories', __( 'Categories' ), array( &$this, 'render_category_metabox' ), 'event-list', 'advanced', 'default', $metabox_args );
297
- ob_start();
298
- do_meta_boxes('event-list', 'advanced', null);
299
- $out .= ob_get_contents();
300
- ob_end_clean();
301
- $out .= '
302
- </div>
303
- </div>
304
- </div>
305
- </div>
306
- </form>';
307
- return $out;
308
  }
309
 
310
- private function show_calendar_nav() {
311
- $first_year = $this->db->get_event_date( 'first' );
312
- $last_year = $this->db->get_event_date( 'last' );
313
-
314
- // Calendar Navigation
315
- if( true === is_admin() ) {
316
- $url = "?page=el_admin_main";
317
- $out = '<ul class="subsubsub">';
318
- if( isset( $_GET['ytd'] ) || isset( $_GET['event_id'] ) ) {
319
- $out .= '<li class="upcoming"><a href="'.$url.'">Upcoming</a></li>';
320
- }
321
- else {
322
- $out .= '<li class="upcoming"><a class="current" href="'.$url.'">Upcoming</a></li>';
323
- }
324
- for( $year=$last_year; $year>=$first_year; $year-- ) {
325
- $out .= ' | ';
326
- if( isset( $_GET['ytd'] ) && $year == $_GET['ytd'] ) {
327
- $out .= '<li class="year"><a class="current" href="'.$url.'ytd='.$year.'">'.$year.'</a></li>';
328
- }
329
- else {
330
- $out .= '<li class="year"><a href="'.$url.'&amp;ytd='.$year.'">'.$year.'</a></li>';
331
- }
332
- }
333
- $out .= '</ul><br />';
334
- }
335
- return $out;
336
  }
337
 
338
- private function show_messages() {
339
- $out = '';
340
- // event added
341
- if( 'added' === $this->event_action ) {
342
- if( false === $this->event_action_error ) {
343
- $out .= '<div id="message" class="updated below-h2"><p><strong>New Event "'.$_POST['title'].'" was added.</strong></p></div>';
344
- }
345
- else {
346
- $out .= '<div id="message" class="error below-h2"><p><strong>Error: New Event "'.$_POST['title'].'" could not be added.</strong></p></div>';
347
- }
348
- }
349
- // event modified
350
- elseif( 'modified' === $this->event_action ) {
351
- if( false === $this->event_action_error ) {
352
- $out .= '<div id="message" class="updated below-h2"><p><strong>Event "'.$_POST['title'].'" (id: '.$_POST['id'].') was modified.</strong></p></div>';
353
- }
354
- else {
355
- $out .= '<div id="message" class="error below-h2"><p><strong>Error: Event "'.$_POST['title'].'" (id: '.$_POST['id'].') could not be modified.</strong></p></div>';
356
- }
357
- }
358
- // event deleted
359
- elseif( 'deleted' === $this->event_action ) {
360
- $num_deleted = count( explode( ',', $_GET['id'] ) );
361
- $plural = '';
362
- if( $num_deleted > 1 ) {
363
- $plural = 's';
364
- }
365
- if( false === $this->event_action_error ) {
366
- $out .= '<div id="message" class="updated below-h2"><p><strong>'.$num_deleted.' Event'.$plural.' deleted (id'.$plural.': '.$_GET['id'].').</strong></p></div>';
367
- }
368
- else {
369
- $out .= '<div id="message" class="error below-h2"><p><strong>Error while deleting '.$num_deleted.' Event'.$plural.'.</strong></p></div>';
370
- }
371
- }
372
- return $out;
373
  }
374
 
375
- private function show_tabs( $current = 'category' ) {
376
- $tabs = array( 'category' => 'Categories', 'general' => 'General' );
377
- $out = '<h3 class="nav-tab-wrapper">';
378
- foreach( $tabs as $tab => $name ){
379
- $class = ( $tab == $current ) ? ' nav-tab-active' : '';
380
- $out .= "<a class='nav-tab$class' href='?page=el_admin_settings&amp;tab=$tab'>$name</a>";
381
- }
382
- $out .= '</h3>';
383
- return $out;
384
  }
385
 
386
- private function show_options( $section ) {
387
- $out = '';
388
- if( 'category' === $section ) {
389
- $out .= $this->show_category();
390
- }
391
- else {
392
- $out .= '
393
- <form method="post" action="options.php">
394
- ';
395
- ob_start();
396
- settings_fields( 'el_'.$_GET['tab'] );
397
- $out .= ob_get_contents();
398
- ob_end_clean();
399
- $out .= '
400
- <div style="padding:0 10px">
401
- <table class="form-table">';
402
- foreach( $this->options->options as $oname => $o ) {
403
- if( $o['section'] == $section ) {
404
- $out .= '
405
- <tr style="vertical-align:top;">
406
- <th>';
407
- if( $o['label'] != '' ) {
408
- $out .= '<label for="'.$oname.'">'.$o['label'].':</label>';
409
- }
410
- $out .= '</th>
411
- <td>';
412
- switch( $o['type'] ) {
413
- case 'checkbox':
414
- $out .= $this->show_checkbox( $oname, $this->options->get( $oname ), $o['caption'] );
415
- break;
416
- case 'radio':
417
- $out .= $this->show_radio( $oname, $this->options->get( $oname ), $o['caption'] );
418
- break;
419
- case 'text':
420
- $out .= $this->show_text( $oname, $this->options->get( $oname ) );
421
- break;
422
- case 'textarea':
423
- $out .= $this->show_textarea( $oname, $this->options->get( $oname ) );
424
- break;
425
- }
426
- $out .= '
427
- </td>
428
- <td class="description">'.$o['desc'].'</td>
429
- </tr>';
430
- }
431
- }
432
- $out .= '
433
- </table>
434
- </div>';
435
- ob_start();
436
- submit_button();
437
- $out .= ob_get_contents();
438
- ob_end_clean();
439
- $out .='
440
- </form>';
441
- }
442
- return $out;
443
  }
444
 
445
- private function show_checkbox( $name, $value, $caption ) {
446
- $out = '
447
- <label for="'.$name.'">
448
- <input name="'.$name.'" type="checkbox" id="'.$name.'" value="1"';
449
- if( $value == 1 ) {
450
- $out .= ' checked="checked"';
451
- }
452
- $out .= ' />
453
- '.$caption.'
454
- </label>';
455
- return $out;
456
  }
457
 
458
- private function show_radio( $name, $value, $caption ) {
459
- $out = '
460
- <fieldset>';
461
- foreach( $caption as $okey => $ocaption ) {
462
- $checked = ($value === $okey) ? 'checked="checked" ' : '';
463
- $out .= '
464
- <label title="'.$ocaption.'">
465
- <input type="radio" '.$checked.'value="'.$okey.'" name="'.$name.'">
466
- <span>'.$ocaption.'</span>
467
- </label>
468
- <br />';
469
- }
470
- $out .= '
471
- </fieldset>';
472
- return $out;
473
  }
474
 
475
- private function show_text( $name, $value ) {
476
- $out = '
477
- <input name="'.$name.'" type="text" id="'.$name.'" value="'.$value.'" />';
478
- return $out;
479
  }
480
 
481
- private function show_textarea( $name, $value ) {
482
- $out = '
483
- <textarea name="'.$name.'" id="'.$name.'" rows="5" class="large-text code">'.$value.'</textarea>';
484
- return $out;
485
  }
486
 
487
- private function show_category() {
488
- $out = '';
489
- // Check if a category was added
490
- if( !empty( $_POST ) ) {
491
- if( $this->categories->add_category( $_POST ) ) {
492
- $out .= '<div id="message" class="updated below-h2"><p><strong>New Category "'.$_POST['name'].'" was added.</strong></p></div>';
493
- }
494
- else {
495
- $out .= '<div id="message" class="error below-h2"><p><strong>Error: New Category "'.$_POST['name'].'" could not be added.</strong></p></div>';
496
- }
497
- }
498
- // show category table
499
- $out .= '
500
- <div id="col-container">
501
- <div id="col-right">
502
- <div class="col-wrap">
503
- <form id="category-filter" method="get">
504
- <input type="hidden" name="page" value="'.$_REQUEST['page'].'" />';
505
- // show table
506
- require_once( EL_PATH.'admin/includes/category_table.php' );
507
- $category_table = new EL_Category_Table();
508
- $category_table->prepare_items();
509
- ob_start();
510
- $category_table->display();
511
- $out .= ob_get_contents();
512
- ob_end_clean();
513
- $out .= '
514
- </form>
515
- </div>
516
- </div>';
517
- // show add category form
518
- $out .= '
519
- <div id="col-left">
520
- <div class="col-wrap">
521
- <div class="form-wrap">
522
- <h3>'.__( 'Add New Category' ).'</h3>
523
- <form id="addtag" method="POST" action="?page=el_admin_settings&amp;tab=category">';
524
- $out .= '
525
- <div class="form-field form-required"><label for="name">Name: </label>';
526
- $out .= $this->show_text( 'name', '' );
527
- $out .= '<p>'.__( 'The name is how it appears on your site.' ).'</p></div>
528
- <div class="form-field"><label for="name">Slug: </label>';
529
- $out .= $this->show_text( 'slug', '' );
530
- $out .= '<p>'.__( 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ).'</p></div>
531
- <div class="form-field"><label for="name">Description: </label>';
532
- $out .= $this->show_textarea( 'desc', '' );
533
- $out .= '</div>
534
- <p class="submit"><input type="submit" class="button-primary" name="add_cat" value="'.__( 'Add New Category' ).'" id="submitbutton"></p>';
535
- $out .= '
536
- </form>
537
- </div>
538
- </div>
539
- </div>
540
- </div>';
541
- return $out;
542
- }
543
-
544
- public function render_publish_metabox() {
545
- $out = '<div class="submitbox">
546
- <div id="delete-action"><a href="?page=el_admin_main" class="submitdelete deletion">'.__( 'Cancel' ).'</a></div>
547
- <div id="publishing-action"><input type="submit" class="button button-primary button-large" name="publish" value="'.__( 'Publish' ).'" id="publish"></div>
548
- <div class="clear"></div>
549
- </div>';
550
- echo $out;
551
- }
552
-
553
- public function render_category_metabox( $post, $metabox ) {
554
- $out = '
555
- <div id="taxonomy-category" class="categorydiv">
556
- <div id="category-all" class="tabs-panel">';
557
- $cat_array = (array) $this->options->get( 'el_categories' );
558
- if( empty( $cat_array ) ) {
559
- $out .= __( 'No categories available.' );
560
- }
561
- else {
562
- $out .= '
563
- <ul id="categorychecklist" class="categorychecklist form-no-clear">';
564
- $event_cats = explode( '|', substr($metabox['args']['event_cats'], 1, -1 ) );
565
- foreach( $cat_array as $cat ) {
566
- $checked = in_array( $cat['slug'], $event_cats ) ? 'checked="checked" ' : '';
567
- $out .= '
568
- <li id="'.$cat['slug'].'" class="popular-catergory">
569
- <label class="selectit">
570
- <input value="'.$cat['slug'].'" type="checkbox" name="categories[]" id="categories" '.$checked.'/> '.$cat['name'].'
571
- </label>
572
- </li>';
573
- }
574
- $out .= '
575
- </ul>';
576
- }
577
-
578
- $out .= '
579
- </div>';
580
- // TODO: Adding new categories in edit event form
581
- /* <div id="category-adder" class="wp-hidden-children">
582
- <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js">'.__( '+ Add New Category' ).'</a></h4>
583
- <p id="category-add" class="category-add wp-hidden-child">
584
- <label class="screen-reader-text" for="newcategory">'.__( 'Category Name' ).'</label>
585
- <input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="" aria-required="true"/>
586
- <input type="button" id="category-add-submit" class="button category-add-submit" value="'.__( 'Add Category' ).'" />
587
- </p>
588
- </div>*/
589
- $out .= '
590
- <div id="category-manager">
591
- <a id="category-manage-link" href="?page=el_admin_settings&amp;tab=category">'.__( 'Goto Category Settings' ).'</a>
592
- </div>
593
- </div>';
594
- echo $out;
595
- }
596
-
597
- private function html_atts() {
598
- $out = '
599
- <h3 class="el-headline">Available Shortcode Attributes</h3>
600
- <div>
601
- You have the possibility to modify the output if you add some of the following attributes to the shortcode.<br />
602
- You can combine as much attributes as you want. E.g.the shortcode including the attributes "num_events" and "show_nav" would looks like this:
603
- <p><code>[event-list num_events=10 show_nav=false]</code></p>
604
- <p>Below you can find a list of all supported attributes with their descriptions and available options:</p>';
605
- $out .= $this->html_atts_table();
606
- $out .= '
607
- </div>';
608
- return $out;
609
- }
610
-
611
- private function html_atts_table() {
612
- $out = '
613
- <table class="el-atts-table">
614
- <tr>
615
- <th class="el-atts-table-name">Attribute name</th>
616
- <th class="el-atts-table-options">Value options</th>
617
- <th class="el-atts-table-default">Default value</th>
618
- <th class="el-atts-table-desc">Description</th>
619
- </tr>';
620
- $atts = $this->shortcode->get_atts();
621
- foreach( $atts as $aname => $a ) {
622
- $out .= '
623
- <tr>
624
- <td>'.$aname.'</td>
625
- <td>'.$a['val'].'</td>
626
- <td>'.$a['std_val'].'</td>
627
- <td>'.$a['desc'].'</td>
628
- </tr>';
629
- }
630
- $out .= '
631
- </table>';
632
- return $out;
633
- }
634
-
635
- /**
636
- * Convert a date format to a jQuery UI DatePicker format
637
- *
638
- * @param string $format a date format
639
- * @return string
640
- */
641
- private function datepicker_format( $format ) {
642
- $chars = array(
643
- // Day
644
- 'd' => 'dd', 'j' => 'd', 'l' => 'DD', 'D' => 'D',
645
- // Month
646
- 'm' => 'mm', 'n' => 'm', 'F' => 'MM', 'M' => 'M',
647
- // Year
648
- 'Y' => 'yy', 'y' => 'y',
649
- );
650
- return strtr((string)$format, $chars);
651
  }
652
  }
653
  ?>
1
  <?php
2
+ if(!defined('ABSPATH')) {
3
  exit;
4
  }
5
 
 
 
 
 
 
 
6
  // This class handles all available admin pages
7
  class EL_Admin {
8
+ private static $instance;
 
 
 
 
 
9
 
10
+ public static function &get_instance() {
11
+ // Create class instance if required
12
+ if(!isset(self::$instance)) {
13
+ self::$instance = new EL_Admin();
14
+ }
15
+ // Return class instance
16
+ return self::$instance;
17
+ }
18
+
19
+ public function init_admin_page() {
20
+ // Register actions
21
+ add_action('admin_menu', array(&$this, 'register_pages'));
22
+ add_action('plugins_loaded', array(&$this, 'db_upgrade_check'));
23
  }
24
 
25
  /**
26
  * Add and register all admin pages in the admin menu
27
  */
28
  public function register_pages() {
29
+ // Main Menu page
30
+ add_menu_page('Event List', 'Event List', 'edit_posts', 'el_admin_main', array(&$this, 'show_main_page'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ // All Events subpage
33
+ $page = add_submenu_page('el_admin_main', 'Events', 'All Events', 'edit_posts', 'el_admin_main', array(&$this, 'show_main_page'));
34
+ add_action('admin_print_scripts-'.$page, array(&$this, 'embed_main_scripts'));
35
 
36
+ // New Event subpage
37
+ $page = add_submenu_page('el_admin_main', 'Add New Event', 'Add New', 'edit_posts', 'el_admin_new', array(&$this, 'show_new_page'));
38
+ add_action('admin_print_scripts-'.$page, array(&$this, 'embed_new_scripts'));
39
 
40
+ // Settings subpage
41
+ $page = add_submenu_page('el_admin_main', 'Event List Settings', 'Settings', 'manage_options', 'el_admin_settings', array(&$this, 'show_settings_page'));
42
+ add_action('admin_print_scripts-'.$page, array(&$this, 'embed_settings_scripts'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
+ // About subpage
45
+ $page = add_submenu_page('el_admin_main', 'About Event List', 'About', 'edit_posts', 'el_admin_about', array(&$this, 'show_about_page'));
46
+ add_action('admin_print_scripts-'.$page, array(&$this, 'embed_about_scripts'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
+ public function db_upgrade_check() {
50
+ require_once(EL_PATH.'includes/db.php');
51
+ EL_Db::get_instance()->upgrade_check();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
 
54
+ public function show_main_page() {
55
+ require_once(EL_PATH.'admin/includes/admin-main.php');
56
+ EL_Admin_Main::get_instance()->show_main();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
+ public function embed_main_scripts() {
60
+ require_once(EL_PATH.'admin/includes/admin-main.php');
61
+ EL_Admin_Main::get_instance()->embed_main_scripts();
 
 
 
 
 
 
62
  }
63
 
64
+ public function show_new_page() {
65
+ require_once(EL_PATH.'admin/includes/admin-new.php');
66
+ EL_Admin_New::get_instance()->show_new();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
68
 
69
+ public function embed_new_scripts() {
70
+ require_once(EL_PATH.'admin/includes/admin-new.php');
71
+ EL_Admin_New::get_instance()->embed_new_scripts();
 
 
 
 
 
 
 
 
72
  }
73
 
74
+ public function show_settings_page() {
75
+ require_once(EL_PATH.'admin/includes/admin-settings.php');
76
+ EL_Admin_Settings::get_instance()->show_settings();
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
+ public function embed_settings_scripts() {
80
+ require_once(EL_PATH.'admin/includes/admin-settings.php');
81
+ EL_Admin_Settings::get_instance()->embed_settings_scripts();
 
82
  }
83
 
84
+ public function show_about_page() {
85
+ require_once(EL_PATH.'admin/includes/admin-about.php');
86
+ EL_Admin_About::get_instance()->show_about();
 
87
  }
88
 
89
+ public function embed_about_scripts() {
90
+ require_once(EL_PATH.'admin/includes/admin-about.php');
91
+ EL_Admin_About::get_instance()->embed_about_scripts();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
93
  }
94
  ?>
admin/includes/admin-about.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!defined('ABSPATH')) {
3
+ exit;
4
+ }
5
+
6
+ // This class handles all data for the admin about page
7
+ class EL_Admin_About {
8
+ private static $instance;
9
+
10
+ public static function &get_instance() {
11
+ // Create class instance if required
12
+ if(!isset(self::$instance)) {
13
+ self::$instance = new EL_Admin_About();
14
+ }
15
+ // Return class instance
16
+ return self::$instance;
17
+ }
18
+
19
+ private function __construct() {
20
+
21
+ }
22
+
23
+ public function show_about() {
24
+ if(!current_user_can('edit_posts')) {
25
+ wp_die(__('You do not have sufficient permissions to access this page.'));
26
+ }
27
+ $out = '<div class="wrap">
28
+ <div id="icon-edit-pages" class="icon32"><br /></div><h2>About Event List</h2>
29
+ <h3>Help and Instructions</h3>
30
+ <p>You can manage your events <a href="admin.php?page=el_admin_main">here</a>.</p>
31
+ <p>To show the events on your site you have two possibilities:
32
+ <ul class="el-show-event-options"><li>you can place the <strong>shortcode</strong> <code>[event-list]</code> on any page or post</li>
33
+ <li>you can add the <strong>widget</strong> "Event List" in your sidebars</li></ul>
34
+ The displayed events and their style can be modified with the available widget settings and the available attributes for the shortcode.<br />
35
+ A list of all available shortcode attributes with their description is listed below.<br />
36
+ The most available options of the widget should be clear by there description.<br />
37
+ It is important to know that you have to insert an URL to the linked event-list page if you enable one of the links options ("Add links to the single events" or "Add a link to an event page").
38
+ This is required because the widget didn´t know in which page or post you have insert the shortcode.<br />
39
+ Additonally you have to insert the correct Shortcode ID on the linked page. This ID describes which shortcode should be used on the given page or post if you have more than one.
40
+ So the standard value "1" is normally o.k., but you can check the ID if you have a look into the URL of an event link on your linked page or post.
41
+ The ID is given behind the "_" (e.g. <i>http://www.your-homepage.com/?page_id=99&event_id_<strong>1</strong>=11</i>).
42
+ </p>
43
+ <p>Be sure to also check the <a href="admin.php?page=el_admin_settings">settings page</a> to get Event List behaving just the way you want.</p>
44
+ </div>';
45
+ $out .= $this->show_atts();
46
+ echo $out;
47
+ }
48
+
49
+ public function embed_about_scripts() {
50
+ wp_enqueue_style('eventlist_admin_about', EL_URL.'admin/css/admin_about.css');
51
+ }
52
+
53
+ private function show_atts() {
54
+ $out = '
55
+ <h3 class="el-headline">Available Shortcode Attributes</h3>
56
+ <div>
57
+ You have the possibility to modify the output if you add some of the following attributes to the shortcode.<br />
58
+ You can combine as much attributes as you want. E.g.the shortcode including the attributes "num_events" and "show_nav" would looks like this:
59
+ <p><code>[event-list num_events=10 show_nav=false]</code></p>
60
+ <p>Below you can find a list of all supported attributes with their descriptions and available options:</p>';
61
+ $out .= $this->show_atts_table();
62
+ $out .= '
63
+ </div>';
64
+ return $out;
65
+ }
66
+
67
+ private function show_atts_table() {
68
+ require_once(EL_PATH.'includes/sc_event-list.php');
69
+ $shortcode = &SC_Event_List::get_instance();
70
+ $atts = $shortcode->get_atts();
71
+ $out = '
72
+ <table class="el-atts-table">
73
+ <tr>
74
+ <th class="el-atts-table-name">Attribute name</th>
75
+ <th class="el-atts-table-options">Value options</th>
76
+ <th class="el-atts-table-default">Default value</th>
77
+ <th class="el-atts-table-desc">Description</th>
78
+ </tr>';
79
+ foreach($atts as $aname => $a) {
80
+ $out .= '
81
+ <tr>
82
+ <td>'.$aname.'</td>
83
+ <td>'.$a['val'].'</td>
84
+ <td>'.$a['std_val'].'</td>
85
+ <td>'.$a['desc'].'</td>
86
+ </tr>';
87
+ }
88
+ $out .= '
89
+ </table>';
90
+ return $out;
91
+ }
92
+ }
93
+ ?>
admin/includes/admin-main.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!defined('ABSPATH')) {
3
+ exit;
4
+ }
5
+
6
+ require_once(EL_PATH.'includes/db.php');
7
+ require_once(EL_PATH.'admin/includes/event_table.php');
8
+
9
+ // This class handles all data for the admin main page
10
+ class EL_Admin_Main {
11
+ private static $instance;
12
+ private $db;
13
+ private $event_action = false;
14
+ private $event_action_error = false;
15
+
16
+ public static function &get_instance() {
17
+ // Create class instance if required
18
+ if(!isset(self::$instance)) {
19
+ self::$instance = new EL_Admin_Main();
20
+ }
21
+ // Return class instance
22
+ return self::$instance;
23
+ }
24
+
25
+ private function __construct() {
26
+ $this->db = &EL_Db::get_instance();
27
+ $this->event_action = null;
28
+ $this->event_action_error = null;
29
+ }
30
+
31
+ // show the main admin page
32
+ public function show_main() {
33
+ if(!current_user_can('edit_posts')) {
34
+ wp_die(__('You do not have sufficient permissions to access this page.'));
35
+ }
36
+ $action = '';
37
+ // is there POST data an event was edited must be updated
38
+ if(!empty($_POST)) {
39
+ $this->event_action_error = !$this->db->update_event($_POST, __('Y/m/d'));
40
+ $this->event_action = isset($_POST['id']) ? 'modified' : 'added';
41
+ }
42
+ // get action
43
+ if(isset($_GET['action'])) {
44
+ $action = $_GET['action'];
45
+ }
46
+ // if an event should be edited a different page must be displayed
47
+ if($action === 'edit') {
48
+ $this->show_edit();
49
+ return;
50
+ }
51
+ // delete events if required
52
+ if($action === 'delete' && isset($_GET['id'])) {
53
+ $this->event_action_error = !$this->db->delete_events(explode(',', $_GET['id']));
54
+ $this->event_action = 'deleted';
55
+ }
56
+ // automatically set order of table to date, if no manual sorting is set
57
+ if(!isset($_GET['orderby'])) {
58
+ $_GET['orderby'] = 'date';
59
+ $_GET['order'] = 'asc';
60
+ }
61
+
62
+ // headline for the normal page
63
+ $out ='
64
+ <div class="wrap">
65
+ <div id="icon-edit-pages" class="icon32"><br /></div><h2>Events <a href="?page=el_admin_new" class="add-new-h2">Add New</a></h2>';
66
+ // added messages if required
67
+ $out .= $this->show_messages();
68
+ // list event table
69
+ $out .= $this->list_events();
70
+ $out .= '</div>';
71
+ echo $out;
72
+ }
73
+
74
+ private function show_edit() {
75
+ $out = '<div class="wrap">
76
+ <div id="icon-edit-pages" class="icon32"><br /></div><h2>Edit Event</h2>';
77
+ require_once(EL_PATH.'admin/includes/admin-new.php');
78
+ $out .= EL_Admin_New::get_instance()->edit_event();
79
+ $out .= '</div>';
80
+ echo $out;
81
+ }
82
+
83
+ public function embed_main_scripts() {
84
+ // If edit event is selected switch to embed admin_new
85
+ if(isset($_GET['action']) && 'edit' === $_GET['action']) {
86
+ require_once(EL_PATH.'admin/includes/admin-new.php');
87
+ EL_Admin_New::get_instance()->embed_new_scripts();
88
+ }
89
+ else {
90
+ // Proceed with embedding for admin_main
91
+ wp_enqueue_script('eventlist_admin_main_js', EL_URL.'admin/js/admin_main.js');
92
+ wp_enqueue_style('eventlist_admin_main', EL_URL.'admin/css/admin_main.css');
93
+ }
94
+ }
95
+
96
+ private function list_events() {
97
+ // show calendar navigation
98
+ $out = $this->show_calendar_nav();
99
+ // set date range of events being displayed
100
+ $date_range = 'upcoming';
101
+ if(isset($_GET['ytd']) && is_numeric($_GET['ytd'])) {
102
+ $date_range = $_GET['ytd'];
103
+ }
104
+ // show event table
105
+ // the form is required for bulk actions, the page field is required for plugins to ensure that the form posts back to the current page
106
+ $out .= '<form id="event-filter" method="get">
107
+ <input type="hidden" name="page" value="'.$_REQUEST['page'].'" />';
108
+ // show table
109
+ $table = new EL_Event_Table();
110
+ $table->prepare_items($date_range);
111
+ ob_start();
112
+ $table->display();
113
+ $out .= ob_get_contents();
114
+ ob_end_clean();
115
+ $out .= '</form>';
116
+ return $out;
117
+ }
118
+
119
+ private function show_calendar_nav() {
120
+ $first_year = $this->db->get_event_date('first');
121
+ $last_year = $this->db->get_event_date('last');
122
+
123
+ // Calendar Navigation
124
+ if(true === is_admin()) {
125
+ $url = "?page=el_admin_main";
126
+ $out = '<ul class="subsubsub">';
127
+ if(isset($_GET['ytd']) || isset($_GET['event_id'])) {
128
+ $out .= '<li class="upcoming"><a href="'.$url.'">Upcoming</a></li>';
129
+ }
130
+ else {
131
+ $out .= '<li class="upcoming"><a class="current" href="'.$url.'">Upcoming</a></li>';
132
+ }
133
+ for($year=$last_year; $year>=$first_year; $year--) {
134
+ $out .= ' | ';
135
+ if(isset($_GET['ytd']) && $year == $_GET['ytd']) {
136
+ $out .= '<li class="year"><a class="current" href="'.$url.'ytd='.$year.'">'.$year.'</a></li>';
137
+ }
138
+ else {
139
+ $out .= '<li class="year"><a href="'.$url.'&amp;ytd='.$year.'">'.$year.'</a></li>';
140
+ }
141
+ }
142
+ $out .= '</ul><br />';
143
+ }
144
+ return $out;
145
+ }
146
+
147
+ private function show_messages() {
148
+ $out = '';
149
+ // event added
150
+ if('added' === $this->event_action) {
151
+ if(false === $this->event_action_error) {
152
+ $out .= '<div id="message" class="updated below-h2"><p><strong>New Event "'.stripslashes($_POST['title']).'" was added.</strong></p></div>';
153
+ }
154
+ else {
155
+ $out .= '<div id="message" class="error below-h2"><p><strong>Error: New Event "'.stripslashes($_POST['title']).'" could not be added.</strong></p></div>';
156
+ }
157
+ }
158
+ // event modified
159
+ elseif('modified' === $this->event_action) {
160
+ if(false === $this->event_action_error) {
161
+ $out .= '<div id="message" class="updated below-h2"><p><strong>Event "'.stripslashes($_POST['title']).'" (id: '.$_POST['id'].') was modified.</strong></p></div>';
162
+ }
163
+ else {
164
+ $out .= '<div id="message" class="error below-h2"><p><strong>Error: Event "'.stripslashes($_POST['title']).'" (id: '.$_POST['id'].') could not be modified.</strong></p></div>';
165
+ }
166
+ }
167
+ // event deleted
168
+ elseif('deleted' === $this->event_action) {
169
+ $num_deleted = count(explode(',', $_GET['id']));
170
+ $plural = '';
171
+ if($num_deleted > 1) {
172
+ $plural = 's';
173
+ }
174
+ if(false === $this->event_action_error) {
175
+ $out .= '<div id="message" class="updated below-h2"><p><strong>'.$num_deleted.' Event'.$plural.' deleted (id'.$plural.': '.$_GET['id'].').</strong></p></div>';
176
+ }
177
+ else {
178
+ $out .= '<div id="message" class="error below-h2"><p><strong>Error while deleting '.$num_deleted.' Event'.$plural.'.</strong></p></div>';
179
+ }
180
+ }
181
+ return $out;
182
+ }
183
+ }
184
+ ?>
admin/includes/admin-new.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!defined('ABSPATH')) {
3
+ exit;
4
+ }
5
+
6
+ require_once(EL_PATH.'includes/db.php');
7
+ require_once(EL_PATH.'includes/options.php');
8
+
9
+ // This class handles all data for the admin new event page
10
+ class EL_Admin_New {
11
+ private static $instance;
12
+ private $db;
13
+ private $options;
14
+
15
+ public static function &get_instance() {
16
+ // Create class instance if required
17
+ if(!isset(self::$instance)) {
18
+ self::$instance = new EL_Admin_New();
19
+ }
20
+ // Return class instance
21
+ return self::$instance;
22
+ }
23
+
24
+ private function __construct() {
25
+ $this->db = &EL_Db::get_instance();
26
+ $this->options = &EL_Options::get_instance();
27
+ }
28
+
29
+ public function show_new() {
30
+ if(!current_user_can('edit_posts')) {
31
+ wp_die(__('You do not have sufficient permissions to access this page.'));
32
+ }
33
+ $out = '<div class="wrap">
34
+ <div id="icon-edit-pages" class="icon32"><br /></div><h2>Add New Event</h2>';
35
+ $out .= $this->edit_event();
36
+ $out .= '</div>';
37
+ echo $out;
38
+ }
39
+
40
+ public function embed_new_scripts() {
41
+ wp_enqueue_script('jquery-ui-datepicker');
42
+ wp_enqueue_script('link');
43
+ wp_enqueue_script('eventlist_admin_new_js', EL_URL.'admin/js/admin_new.js');
44
+ wp_enqueue_style('eventlist_admin_new', EL_URL.'admin/css/admin_new.css');
45
+ }
46
+
47
+ public function edit_event() {
48
+ $edit = false;
49
+ if(isset($_GET['id']) && is_numeric($_GET['id'])) {
50
+ // existing event
51
+ $event = $this->db->get_event($_GET['id']);
52
+ if(isset($_GET['action']) && $_GET['action'] === 'edit') {
53
+ // editing of an existing event, if not it would be copy of an existing event
54
+ $edit = true;
55
+ }
56
+ $start_date = strtotime($event->start_date);
57
+ $end_date = strtotime($event->end_date);
58
+ }
59
+ else {
60
+ //new event
61
+ $start_date = time()+1*24*60*60;
62
+ $end_date = $start_date;
63
+ }
64
+
65
+ // Add required data for javascript in a hidden field
66
+ $json = json_encode(array('el_url' => EL_URL,
67
+ 'el_date_format' => $this->datepicker_format(__('Y/m/d'))));
68
+ $out = '
69
+ <form method="POST" action="?page=el_admin_main">';
70
+ $out .= "
71
+ <input type='hidden' id='json_for_js' value='".$json."' />"; // single quote required for value due to json layout
72
+ // TODO: saving changed metabox status and order is not working yet
73
+ $out .= wp_nonce_field('autosavenonce', 'autosavenonce', false, false);
74
+ $out .= wp_nonce_field('closedpostboxesnonce', 'closedpostboxesnonce', false, false);
75
+ $out .= wp_nonce_field('meta-box-order-nonce', 'meta-box-order-nonce', false, false);
76
+ $out .= '
77
+ <div id="poststuff">
78
+ <div id="post-body" class="metabox-holder columns-2">
79
+ <div id="post-body-content">';
80
+ if(true === $edit) {
81
+ $out .= '<input type="hidden" name="id" value="'.$_GET['id'].'" />';
82
+ }
83
+ $out .= '<table class="form-table">
84
+ <tr>
85
+ <th><label>Event Title (required)</label></th>
86
+ <td><input type="text" class="text form-required" name="title" id="title" value="'.str_replace('"', '&quot;', isset($event->title) ? $event->title : '').'" /></td>
87
+ </tr>
88
+ <tr>
89
+ <th><label>Event Date (required)</label></th>
90
+ <td><input type="text" class="text datepicker form-required" name="start_date" id="start_date" value="'.date_i18n(__('Y/m/d'), $start_date).'" />
91
+ <span id="end_date_area"> - <input type="text" class="text datepicker" name="end_date" id="end_date" value="'.date_i18n(__('Y/m/d'), $end_date).'" /></span>
92
+ <label><input type="checkbox" name="multiday" id="multiday" value="1" /> Multi-Day Event</label></td>
93
+ </tr>
94
+ <tr>
95
+ <th><label>Event Time</label></th>
96
+ <td><input type="text" class="text" name="time" id="time" value="'.str_replace('"', '&quot;', isset($event->time) ? $event->time : '').'" /></td>
97
+ </tr>
98
+ <tr>
99
+ <th><label>Event Location</label></th>
100
+ <td><input type="text" class="text" name="location" id="location" value="'.str_replace('"', '&quot;', isset($event->location) ? $event->location : '').'" /></td>
101
+ </tr>
102
+ <tr>
103
+ <th><label>Event Details</label></th>
104
+ <td>';
105
+ $editor_settings = array('media_buttons' => true,
106
+ 'wpautop' => false,
107
+ 'textarea_rows' => 20);
108
+ ob_start();
109
+ wp_editor(isset($event->details) ? $event->details : '', 'details', $editor_settings);
110
+ $out .= ob_get_contents();
111
+ ob_end_clean();
112
+ $out .= '<p class="note">NOTE: In the text editor, use RETURN to start a new paragraph - use SHIFT-RETURN to start a new line.</p></td>
113
+ </tr>
114
+ </table>';
115
+ $out .= '
116
+ </div>
117
+ <div id="postbox-container-1" class="postbox-container">
118
+ <div id="side-sortables" class="meta-box-sortables ui-sortable">';
119
+ add_meta_box('event-publish', __('Publish'), array(&$this, 'render_publish_metabox'), 'event-list');
120
+ $metabox_args = isset($event->categories) ? array('event_cats' => $event->categories) : null;
121
+ add_meta_box('event-categories', __('Categories'), array(&$this, 'render_category_metabox'), 'event-list', 'advanced', 'default', $metabox_args);
122
+ ob_start();
123
+ do_meta_boxes('event-list', 'advanced', null);
124
+ $out .= ob_get_contents();
125
+ ob_end_clean();
126
+ $out .= '
127
+ </div>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ </form>';
132
+ return $out;
133
+ }
134
+
135
+ public function render_publish_metabox() {
136
+ $out = '<div class="submitbox">
137
+ <div id="delete-action"><a href="?page=el_admin_main" class="submitdelete deletion">'.__('Cancel').'</a></div>
138
+ <div id="publishing-action"><input type="submit" class="button button-primary button-large" name="publish" value="'.__('Publish').'" id="publish"></div>
139
+ <div class="clear"></div>
140
+ </div>';
141
+ echo $out;
142
+ }
143
+
144
+ public function render_category_metabox($post, $metabox) {
145
+ $out = '
146
+ <div id="taxonomy-category" class="categorydiv">
147
+ <div id="category-all" class="tabs-panel">';
148
+ $cat_array = (array) $this->options->get('el_categories');
149
+ if(empty($cat_array)) {
150
+ $out .= __('No categories available.');
151
+ }
152
+ else {
153
+ $out .= '
154
+ <ul id="categorychecklist" class="categorychecklist form-no-clear">';
155
+ $event_cats = explode('|', substr($metabox['args']['event_cats'], 1, -1));
156
+ foreach($cat_array as $cat) {
157
+ $checked = in_array($cat['slug'], $event_cats) ? 'checked="checked" ' : '';
158
+ $out .= '
159
+ <li id="'.$cat['slug'].'" class="popular-catergory">
160
+ <label class="selectit">
161
+ <input value="'.$cat['slug'].'" type="checkbox" name="categories[]" id="categories" '.$checked.'/> '.$cat['name'].'
162
+ </label>
163
+ </li>';
164
+ }
165
+ $out .= '
166
+ </ul>';
167
+ }
168
+
169
+ $out .= '
170
+ </div>';
171
+ // TODO: Adding new categories in edit event form
172
+ /* <div id="category-adder" class="wp-hidden-children">
173
+ <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js">'.__('+ Add New Category').'</a></h4>
174
+ <p id="category-add" class="category-add wp-hidden-child">
175
+ <label class="screen-reader-text" for="newcategory">'.__('Category Name').'</label>
176
+ <input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="" aria-required="true"/>
177
+ <input type="button" id="category-add-submit" class="button category-add-submit" value="'.__('Add Category').'" />
178
+ </p>
179
+ </div>*/
180
+ $out .= '
181
+ <div id="category-manager">
182
+ <a id="category-manage-link" href="?page=el_admin_settings&amp;tab=category">'.__('Goto Category Settings').'</a>
183
+ </div>
184
+ </div>';
185
+ echo $out;
186
+ }
187
+
188
+ /**
189
+ * Convert a date format to a jQuery UI DatePicker format
190
+ *
191
+ * @param string $format a date format
192
+ * @return string
193
+ */
194
+ private function datepicker_format($format) {
195
+ $chars = array(
196
+ // Day
197
+ 'd' => 'dd', 'j' => 'd', 'l' => 'DD', 'D' => 'D',
198
+ // Month
199
+ 'm' => 'mm', 'n' => 'm', 'F' => 'MM', 'M' => 'M',
200
+ // Year
201
+ 'Y' => 'yy', 'y' => 'y',
202
+ );
203
+ return strtr((string)$format, $chars);
204
+ }
205
+ }
206
+ ?>
admin/includes/admin-settings.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!defined('ABSPATH')) {
3
+ exit;
4
+ }
5
+
6
+ require_once(EL_PATH.'includes/db.php');
7
+ require_once(EL_PATH.'includes/options.php');
8
+ require_once(EL_PATH.'includes/categories.php');
9
+
10
+ // This class handles all data for the admin settings page
11
+ class EL_Admin_Settings {
12
+ private static $instance;
13
+ private $db;
14
+ private $options;
15
+ private $categories;
16
+
17
+ public static function &get_instance() {
18
+ // Create class instance if required
19
+ if(!isset(self::$instance)) {
20
+ self::$instance = new EL_Admin_Settings();
21
+ }
22
+ // Return class instance
23
+ return self::$instance;
24
+ }
25
+
26
+ private function __construct() {
27
+ $this->db = &EL_Db::get_instance();
28
+ $this->options = &EL_Options::get_instance();
29
+ $this->categories = &EL_Categories::get_instance();
30
+ }
31
+
32
+ public function show_settings () {
33
+ if(!current_user_can('manage_options')) {
34
+ wp_die(__('You do not have sufficient permissions to access this page.'));
35
+ }
36
+ $out = '';
37
+ if(isset($_GET['settings-updated'])) {
38
+ $out .= '<div id="message" class="updated">
39
+ <p><strong>'.__('Settings saved.').'</strong></p>
40
+ </div>';
41
+ }
42
+
43
+ // get action
44
+ $action = '';
45
+ if(isset($_GET['action'])) {
46
+ $action = $_GET['action'];
47
+ }
48
+ $out .= $this->check_for_actions_and_show_messages($action);
49
+
50
+ // normal output
51
+ $out.= '<div class="wrap">
52
+ <div id="icon-edit-pages" class="icon32"><br /></div><h2>Event List Settings</h2>';
53
+ if(!isset($_GET['tab'])) {
54
+ $_GET['tab'] = 'category';
55
+ }
56
+ $out .= $this->show_tabs($_GET['tab']);
57
+ $out .= '<div id="posttype-page" class="posttypediv">';
58
+ if('category' === $_GET['tab']) {
59
+ $out .= $this->show_category_tab($action);
60
+ }
61
+ else {
62
+ $out .= $this->show_option_tab($_GET['tab']);
63
+ }
64
+ $out .= '
65
+ </div>
66
+ </div>';
67
+ echo $out;
68
+ }
69
+
70
+ public function embed_settings_scripts() {
71
+ wp_enqueue_script('eventlist_admin_settings_js', EL_URL.'admin/js/admin_settings.js');
72
+ }
73
+
74
+ private function show_tabs($current = 'category') {
75
+ $tabs = array('category' => 'Categories', 'general' => 'General');
76
+ $out = '<h3 class="nav-tab-wrapper">';
77
+ foreach($tabs as $tab => $name){
78
+ $class = ($tab == $current) ? ' nav-tab-active' : '';
79
+ $out .= '<a class="nav-tab'.$class.'" href="?page=el_admin_settings&amp;tab='.$tab.'">'.$name.'</a>';
80
+ }
81
+ $out .= '</h3>';
82
+ return $out;
83
+ }
84
+
85
+ private function show_category_tab($action) {
86
+ $out = '';
87
+ if('edit' === $action && isset($_GET['id'])) {
88
+ $out .=$this->show_edit_category_form(__('Edit Category'), __('Update Category'), $this->categories->get_category_data($_GET['id']));
89
+ }
90
+ else {
91
+ // show category table
92
+ $out .= $this->show_category_table();
93
+ // show add category form
94
+ $out .= $this->show_edit_category_form(__('Add New Category'), __('Add New Category'));
95
+ }
96
+ return $out;
97
+ }
98
+
99
+ private function check_for_actions_and_show_messages($action) {
100
+ $out = '';
101
+ if('delete' === $action && isset($_GET['slug'])) {
102
+ // delete categories
103
+ $slug_array = explode(', ', $_GET['slug']);
104
+ $num_affected_events = $this->db->remove_category_in_events($slug_array);
105
+ require_once(EL_PATH.'admin/includes/category_table.php');
106
+ if($this->categories->remove_categories($slug_array)) {
107
+ $out .= '<div id="message" class="updated">
108
+ <p><strong>'.sprintf(__('Category "%s" deleted.'), $_GET['slug']);
109
+ if($num_affected_events > 0) {
110
+ $out .= '<br />'.sprintf(__('This Category was also removed from %d events.'), $num_affected_events);
111
+ }
112
+ $out .= '</strong></p>
113
+ </div>';
114
+ }
115
+ else {
116
+ $out .= '<div id="message" class="error below-h2"><p><strong>Error while deleting category "'.$_GET['slug'].'".</strong></p></div>';
117
+ }
118
+ }
119
+ else if(!empty($_POST)) {
120
+ if(!isset($_POST['id'])) {
121
+ // add new category
122
+ if($this->categories->add_category($_POST)) {
123
+ $out .= '<div id="message" class="updated below-h2"><p><strong>New Category "'.$_POST['name'].'" was added.</strong></p></div>';
124
+ }
125
+ else {
126
+ $out .= '<div id="message" class="error below-h2"><p><strong>Error: New Category "'.$_POST['name'].'" could not be added.</strong></p></div>';
127
+ }
128
+ }
129
+ else {
130
+ // edit category
131
+ if($this->categories->edit_category($_POST, $_POST['id'])) {
132
+ $this->db->change_category_slug_in_events($_POST['id'], $_POST['slug']);
133
+ $out .= '<div id="message" class="updated below-h2"><p><strong>Category "'.$_POST['id'].'" was modified.</strong></p></div>';
134
+ }
135
+ else {
136
+ $out .= '<div id="message" class="error below-h2"><p><strong>Error: Category "'.$_POST['id'].'" could not be modified.</strong></p></div>';
137
+ }
138
+ }
139
+ }
140
+ return $out;
141
+ }
142
+
143
+ private function show_edit_category_form($title, $button_text, $cat_data=null) {
144
+ $is_new_event = (null == $cat_data);
145
+ if($is_new_event) {
146
+ $cat_data['name'] = '';
147
+ $cat_data['slug'] = '';
148
+ $cat_data['desc'] = '';
149
+ }
150
+ $out = '
151
+ <div id="col-left">
152
+ <div class="col-wrap">
153
+ <div class="form-wrap">
154
+ <h3>'.$title.'</h3>
155
+ <form id="addtag" method="POST" action="?page=el_admin_settings&amp;tab=category">';
156
+ if(!$is_new_event) {
157
+ $out .= '
158
+ <input type="hidden" name="id" value="'.$cat_data['slug'].'">';
159
+ }
160
+ // Category Name
161
+ $out .= '
162
+ <div class="form-field form-required"><label for="name">Name: </label>';
163
+ $out .= $this->show_text('name', $cat_data['name']);
164
+ $out .= '<p>'.__('The name is how it appears on your site.').'</p></div>';
165
+ // Category Slug
166
+ $out .= '
167
+ <div class="form-field"><label for="name">Slug: </label>';
168
+ $out .= $this->show_text('slug', $cat_data['slug']);
169
+ $out .= '<p>'.__('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.').'</p></div>';
170
+ // Category Description
171
+ $out .= '
172
+ <div class="form-field"><label for="name">Description: </label>';
173
+ $out .= $this->show_textarea('desc', $cat_data['desc']);
174
+ $out .= '</div>
175
+ <p class="submit"><input type="submit" class="button-primary" name="add_cat" value="'.$button_text.'" id="submitbutton"></p>';
176
+ $out .= '
177
+ </form>
178
+ </div>
179
+ </div>
180
+ </div>
181
+ </div>';
182
+ return $out;
183
+ }
184
+
185
+ private function show_category_table() {
186
+ $out = '
187
+ <div id="col-container">
188
+ <div id="col-right">
189
+ <div class="col-wrap">
190
+ <form id="category-filter" method="get">
191
+ <input type="hidden" name="page" value="'.$_REQUEST['page'].'" />';
192
+ require_once(EL_PATH.'admin/includes/category_table.php');
193
+ $category_table = new EL_Category_Table();
194
+ $category_table->prepare_items();
195
+ ob_start();
196
+ $category_table->display();
197
+ $out .= ob_get_contents();
198
+ ob_end_clean();
199
+ $out .= '
200
+ </form>
201
+ </div>
202
+ </div>';
203
+ return $out;
204
+ }
205
+
206
+ private function show_option_tab($section) {
207
+ $out = '
208
+ <form method="post" action="options.php">
209
+ ';
210
+ ob_start();
211
+ settings_fields('el_'.$_GET['tab']);
212
+ $out .= ob_get_contents();
213
+ ob_end_clean();
214
+ $out .= '
215
+ <div style="padding:0 10px">
216
+ <table class="form-table">';
217
+ foreach($this->options->options as $oname => $o) {
218
+ if($o['section'] == $section) {
219
+ $out .= '
220
+ <tr style="vertical-align:top;">
221
+ <th>';
222
+ if($o['label'] != '') {
223
+ $out .= '<label for="'.$oname.'">'.$o['label'].':</label>';
224
+ }
225
+ $out .= '</th>
226
+ <td>';
227
+ switch($o['type']) {
228
+ case 'checkbox':
229
+ $out .= $this->show_checkbox($oname, $this->options->get($oname), $o['caption']);
230
+ break;
231
+ case 'radio':
232
+ $out .= $this->show_radio($oname, $this->options->get($oname), $o['caption']);
233
+ break;
234
+ case 'text':
235
+ $out .= $this->show_text($oname, $this->options->get($oname));
236
+ break;
237
+ case 'textarea':
238
+ $out .= $this->show_textarea($oname, $this->options->get($oname));
239
+ break;
240
+ }
241
+ $out .= '
242
+ </td>
243
+ <td class="description">'.$o['desc'].'</td>
244
+ </tr>';
245
+ }
246
+ }
247
+ $out .= '
248
+ </table>
249
+ </div>';
250
+ ob_start();
251
+ submit_button();
252
+ $out .= ob_get_contents();
253
+ ob_end_clean();
254
+ $out .='
255
+ </form>';
256
+ return $out;
257
+ }
258
+
259
+ private function show_checkbox($name, $value, $caption) {
260
+ $out = '
261
+ <label for="'.$name.'">
262
+ <input name="'.$name.'" type="checkbox" id="'.$name.'" value="1"';
263
+ if($value == 1) {
264
+ $out .= ' checked="checked"';
265
+ }
266
+ $out .= ' />
267
+ '.$caption.'
268
+ </label>';
269
+ return $out;
270
+ }
271
+
272
+ private function show_radio($name, $value, $caption) {
273
+ $out = '
274
+ <fieldset>';
275
+ foreach($caption as $okey => $ocaption) {
276
+ $checked = ($value === $okey) ? 'checked="checked" ' : '';
277
+ $out .= '
278
+ <label title="'.$ocaption.'">
279
+ <input type="radio" '.$checked.'value="'.$okey.'" name="'.$name.'">
280
+ <span>'.$ocaption.'</span>
281
+ </label>
282
+ <br />';
283
+ }
284
+ $out .= '
285
+ </fieldset>';
286
+ return $out;
287
+ }
288
+
289
+ private function show_text($name, $value) {
290
+ $out = '
291
+ <input name="'.$name.'" type="text" id="'.$name.'" value="'.$value.'" />';
292
+ return $out;
293
+ }
294
+
295
+ private function show_textarea($name, $value) {
296
+ $out = '
297
+ <textarea name="'.$name.'" id="'.$name.'" rows="5" class="large-text code">'.$value.'</textarea>';
298
+ return $out;
299
+ }
300
+ }
301
+ ?>
admin/includes/category_table.php CHANGED
@@ -64,8 +64,7 @@ class EL_Category_Table extends WP_List_Table {
64
  protected function column_name($item) {
65
  //Prepare Columns
66
  $actions = array(
67
- // TODO: edit category not implemented yet
68
- /*'edit' => '<a href="?page='.$_REQUEST['page'].'&amp;id='.$item['slug'].'&amp;action=edit">Edit</a>',*/
69
  'delete' => '<a href="#" onClick="eventlist_deleteCategory(\''.$item['slug'].'\');return false;">Delete</a>'
70
  );
71
  //Return the title contents
64
  protected function column_name($item) {
65
  //Prepare Columns
66
  $actions = array(
67
+ 'edit' => '<a href="?page='.$_REQUEST['page'].'&amp;id='.$item['slug'].'&amp;action=edit">Edit</a>',
 
68
  'delete' => '<a href="#" onClick="eventlist_deleteCategory(\''.$item['slug'].'\');return false;">Delete</a>'
69
  );
70
  //Return the title contents
event-list.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Event List
4
  Plugin URI: http://wordpress.org/extend/plugins/event-list/
5
  Description: Manage your events and show them in a list view on your site.
6
- Version: 0.4.2
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
@@ -55,10 +55,7 @@ class Event_List {
55
  if ( is_admin() ) {
56
  // Include required php-files and initialize required objects
57
  require_once( EL_PATH.'admin/admin.php' );
58
- $admin = new EL_Admin();
59
- // Register actions
60
- add_action( 'admin_menu', array( &$admin, 'register_pages' ) );
61
- add_action( 'plugins_loaded', array( &$this, 'db_upgrade_check' ) );
62
  }
63
 
64
  // FRONT PAGE:
@@ -86,12 +83,6 @@ class Event_List {
86
  wp_register_style('event-list_css', EL_URL.'/includes/css/event-list.css');
87
  wp_enqueue_style( 'event-list_css');
88
  }
89
-
90
- public function db_upgrade_check() {
91
- require_once( EL_PATH.'includes/db.php' );
92
- $db = EL_Db::get_instance();
93
- $db->upgrade_check();
94
- }
95
  } // end class linkview
96
 
97
 
3
  Plugin Name: Event List
4
  Plugin URI: http://wordpress.org/extend/plugins/event-list/
5
  Description: Manage your events and show them in a list view on your site.
6
+ Version: 0.4.3
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
55
  if ( is_admin() ) {
56
  // Include required php-files and initialize required objects
57
  require_once( EL_PATH.'admin/admin.php' );
58
+ EL_Admin::get_instance()->init_admin_page();
 
 
 
59
  }
60
 
61
  // FRONT PAGE:
83
  wp_register_style('event-list_css', EL_URL.'/includes/css/event-list.css');
84
  wp_enqueue_style( 'event-list_css');
85
  }
 
 
 
 
 
 
86
  } // end class linkview
87
 
88
 
includes/categories.php CHANGED
@@ -62,6 +62,15 @@ class EL_Categories {
62
  return $this->safe_categories();
63
  }
64
 
 
 
 
 
 
 
 
 
 
65
  public function remove_categories( $slugs ) {
66
  foreach( $slugs as $slug ) {
67
  unset( $this->cat_array[$slug] );
@@ -69,12 +78,6 @@ class EL_Categories {
69
  return $this->safe_categories();
70
  }
71
 
72
- //TODO: missing function: edit_category
73
- /*
74
- public function edit_category( $slug, $item ) {
75
-
76
- }*/
77
-
78
  private function safe_categories() {
79
  if( !sort( $this->cat_array ) ) {
80
  return false;
@@ -89,6 +92,10 @@ class EL_Categories {
89
  return $this->cat_array;
90
  }
91
 
 
 
 
 
92
  public function get_category_string( $slugs ) {
93
  if( 2 >= strlen( $slugs ) ) {
94
  return '';
62
  return $this->safe_categories();
63
  }
64
 
65
+ public function edit_category( $cat_data, $old_slug ) {
66
+ // check if slug already exists
67
+ if(!isset($this->cat_array[$old_slug])) {
68
+ return false;
69
+ }
70
+ unset($this->cat_array[$old_slug]);
71
+ return $this->add_category($cat_data);
72
+ }
73
+
74
  public function remove_categories( $slugs ) {
75
  foreach( $slugs as $slug ) {
76
  unset( $this->cat_array[$slug] );
78
  return $this->safe_categories();
79
  }
80
 
 
 
 
 
 
 
81
  private function safe_categories() {
82
  if( !sort( $this->cat_array ) ) {
83
  return false;
92
  return $this->cat_array;
93
  }
94
 
95
+ public function get_category_data($slug) {
96
+ return $this->cat_array[$slug];
97
+ }
98
+
99
  public function get_category_string( $slugs ) {
100
  if( 2 >= strlen( $slugs ) ) {
101
  return '';
includes/css/event-list.css CHANGED
@@ -1,42 +1,3 @@
1
- /*
2
- ===================
3
- Event List Layout
4
- ===================
5
-
6
- <ul class="event-list">
7
-
8
- <li class="event">
9
- <div class="date">
10
-
11
- <!-- ONLY OUTPUT FOR MULTI-DAY EVENTS -->
12
- <div class="start-date">
13
- <div class="weekday"></div>
14
- <div class="day"></div>
15
- <div class="month"></div>
16
- <div class="year"></div>
17
- </div>
18
- <!-- ONLY OUTPUT FOR MULTI-DAY EVENTS FINISH -->
19
-
20
- <div class="end-date">
21
- <div class="weekday"></div>
22
- <div class="day"></div>
23
- <div class="month"></div>
24
- <div class="year"></div>
25
- </div>
26
- </div>
27
- <div class="event-info">
28
- <h3 class="event-title"></h3>
29
- <span class="event-time"></span>
30
- <span class="event-location"></span>
31
- <div class="event-cat"></div>
32
- <div class="event-details"></div>
33
- </div>
34
- </li>
35
-
36
- </ul>
37
-
38
- =======================================
39
- */
40
  /*
41
  a.rss-link {
42
  display:block;
@@ -48,7 +9,7 @@ a.rss-link {
48
  }
49
  */
50
 
51
- ul.event-list {
52
  list-style: none;
53
  margin: 1em 0 1.5em 0;
54
  padding: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /*
2
  a.rss-link {
3
  display:block;
9
  }
10
  */
11
 
12
+ ul.event-list-view, ul.single-event-view {
13
  list-style: none;
14
  margin: 1em 0 1.5em 0;
15
  padding: 0;
includes/db.php CHANGED
@@ -111,10 +111,13 @@ class EL_Db {
111
  global $wpdb;
112
  // prepare and validate sqldata
113
  $sqldata = array();
114
- //pub_user
115
- $sqldata['pub_user'] = isset( $event_data['pub_user'] ) ? $event_data['pub_user'] : wp_get_current_user()->ID;
116
- //pub_date
117
- $sqldata['pub_date'] = isset( $event_data['pub_date'] ) ? $event_data['pub_date'] : date( "Y-m-d H:i:s" );
 
 
 
118
  //start_date
119
  if( !isset( $event_data['start_date']) ) { return false; }
120
  $start_timestamp = 0;
@@ -191,12 +194,24 @@ class EL_Db {
191
  else {
192
  $event['categories'] = explode( '|', substr($event['categories'], 1, -1 ) );
193
  }
194
- print_r( $event['categories']);
195
  $this->update_event( $event );
196
  }
197
  return count( $affected_events );
198
  }
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  public function count_events( $slug ) {
201
  global $wpdb;
202
  $sql = 'SELECT COUNT(*) FROM '.$this->table.' WHERE categories LIKE "%|'.$slug.'|%"';
111
  global $wpdb;
112
  // prepare and validate sqldata
113
  $sqldata = array();
114
+ if(!isset($event_data['id'])) {
115
+ // for new events only:
116
+ //pub_user
117
+ $sqldata['pub_user'] = isset($event_data['id']) ? $event_data['pub_user'] : wp_get_current_user()->ID;
118
+ //pub_date
119
+ $sqldata['pub_date'] = isset($event_data['pub_date']) ? $event_data['pub_date'] : date("Y-m-d H:i:s");
120
+ }
121
  //start_date
122
  if( !isset( $event_data['start_date']) ) { return false; }
123
  $start_timestamp = 0;
194
  else {
195
  $event['categories'] = explode( '|', substr($event['categories'], 1, -1 ) );
196
  }
 
197
  $this->update_event( $event );
198
  }
199
  return count( $affected_events );
200
  }
201
 
202
+ public function change_category_slug_in_events($old_slug, $new_slug) {
203
+ global $wpdb;
204
+ $sql = 'SELECT * FROM '.$this->table.' WHERE categories LIKE "%|'.$old_slug.'|%"';
205
+ $affected_events = $wpdb->get_results($sql, ARRAY_A);
206
+ foreach( $affected_events as $event ) {
207
+ // replace slug in categorystring
208
+ $event['categories'] = str_replace('|'.$old_slug.'|', '|'.$new_slug.'|', $event['categories']);
209
+ $event['categories'] = explode( '|', substr($event['categories'], 1, -1 ) );
210
+ $this->update_event( $event );
211
+ }
212
+ return count( $affected_events );
213
+ }
214
+
215
  public function count_events( $slug ) {
216
  global $wpdb;
217
  $sql = 'SELECT COUNT(*) FROM '.$this->table.' WHERE categories LIKE "%|'.$slug.'|%"';
includes/sc_event-list.php CHANGED
@@ -170,16 +170,20 @@ class SC_Event_List {
170
  $a['sc_id_for_url'] = $a['sc_id'];
171
  }
172
 
 
 
173
  if( is_numeric( $a['event_id'] ) ) {
174
  // show events details if event_id is set
175
  $this->single_event = true;
176
- $out = $this->html_event_details( $a );
177
  }
178
  else {
179
  // show full event list
180
  $this->single_event = false;
181
- $out = $this->html_events( $a );
182
  }
 
 
183
  return $out;
184
  }
185
 
@@ -188,7 +192,7 @@ class SC_Event_List {
188
  $out = $this->html_calendar_nav( $a );
189
  $out .= '
190
  <h2>Event Information:</h2>
191
- <ul class="event-list">';
192
  $out .= $this->html_event( $event, $a );
193
  $out .= '</ul>';
194
  return $out;
@@ -225,7 +229,7 @@ class SC_Event_List {
225
  else {
226
  // print available events
227
  $out .= '
228
- <ul class="event-list">';
229
  $single_day_only = $this->is_single_day_only( $events );
230
  foreach ($events as $event) {
231
  $out .= $this->html_event( $event, $a, $single_day_only );
170
  $a['sc_id_for_url'] = $a['sc_id'];
171
  }
172
 
173
+ $out = '
174
+ <div class="event-list">';
175
  if( is_numeric( $a['event_id'] ) ) {
176
  // show events details if event_id is set
177
  $this->single_event = true;
178
+ $out .= $this->html_event_details( $a );
179
  }
180
  else {
181
  // show full event list
182
  $this->single_event = false;
183
+ $out .= $this->html_events( $a );
184
  }
185
+ $out .= '
186
+ </div>';
187
  return $out;
188
  }
189
 
192
  $out = $this->html_calendar_nav( $a );
193
  $out .= '
194
  <h2>Event Information:</h2>
195
+ <ul class="single-event-view">';
196
  $out .= $this->html_event( $event, $a );
197
  $out .= '</ul>';
198
  return $out;
229
  else {
230
  // print available events
231
  $out .= '
232
+ <ul class="event-list-view">';
233
  $single_day_only = $this->is_single_day_only( $events );
234
  foreach ($events as $event) {
235
  $out .= $this->html_event( $event, $a, $single_day_only );
includes/widget.php CHANGED
@@ -26,6 +26,7 @@ class EL_Widget extends WP_Widget {
26
  'std_value' => __( 'Upcoming events', 'text_domain' ),
27
  'caption' => __( 'Title:' ),
28
  'caption_after' => null,
 
29
  'form_style' => null,
30
  'form_width' => null ),
31
 
@@ -33,6 +34,7 @@ class EL_Widget extends WP_Widget {
33
  'std_value' => '3',
34
  'caption' => __( 'Number of upcoming events:' ),
35
  'caption_after' => null,
 
36
  'form_style' => null,
37
  'form_width' => 30 ),
38
 
@@ -40,6 +42,7 @@ class EL_Widget extends WP_Widget {
40
  'std_value' => '0',
41
  'caption' => __( 'Truncate event title to' ),
42
  'caption_after' => __( 'chars' ),
 
43
  'form_style' => null,
44
  'form_width' => 30 ),
45
 
@@ -47,6 +50,7 @@ class EL_Widget extends WP_Widget {
47
  'std_value' => 'true',
48
  'caption' => __( 'Show event starttime' ),
49
  'caption_after' => null,
 
50
  'form_style' => null,
51
  'form_width' => null ),
52
 
@@ -54,6 +58,7 @@ class EL_Widget extends WP_Widget {
54
  'std_value' => 'false',
55
  'caption' => __( 'Show event location' ),
56
  'caption_after' => null,
 
57
  'form_style' => 'margin:0 0 0.2em 0',
58
  'form_width' => null ),
59
 
@@ -61,6 +66,7 @@ class EL_Widget extends WP_Widget {
61
  'std_value' => '0',
62
  'caption' => __( 'Truncate location to' ),
63
  'caption_after' => __( 'chars' ),
 
64
  'form_style' => 'margin:0 0 0.6em 0.9em',
65
  'form_width' => 30 ),
66
 
@@ -68,6 +74,7 @@ class EL_Widget extends WP_Widget {
68
  'std_value' => 'false',
69
  'caption' => __( 'Show event details' ),
70
  'caption_after' => null,
 
71
  'form_style' => 'margin:0 0 0.2em 0',
72
  'form_width' => null ),
73
 
@@ -75,6 +82,7 @@ class EL_Widget extends WP_Widget {
75
  'std_value' => '0',
76
  'caption' => __( 'Truncate details to' ),
77
  'caption_after' => __( 'characters' ),
 
78
  'form_style' => 'margin:0 0 0.6em 0.9em',
79
  'form_width' => 30 ),
80
 
@@ -82,6 +90,7 @@ class EL_Widget extends WP_Widget {
82
  'std_value' => '',
83
  'caption' => __( 'URL to the linked eventlist page:' ),
84
  'caption_after' => null,
 
85
  'form_style' => 'margin:0 0 0.4em 0',
86
  'form_width' => null ),
87
 
@@ -89,6 +98,7 @@ class EL_Widget extends WP_Widget {
89
  'std_value' => '1',
90
  'caption' => __( 'Shortcode ID on linked page:' ),
91
  'caption_after' => null,
 
92
  'form_style' => null,
93
  'form_width' => 30 ),
94
 
@@ -96,6 +106,7 @@ class EL_Widget extends WP_Widget {
96
  'std_value' => 'false',
97
  'caption' => __( 'Add links to the single events' ),
98
  'caption_after' => null,
 
99
  'form_style' => 'margin-left:0.8em',
100
  'form_width' => null ),
101
 
@@ -103,6 +114,7 @@ class EL_Widget extends WP_Widget {
103
  'std_value' => 'false',
104
  'caption' => __( 'Add a link to an event page' ),
105
  'caption_after' => null,
 
106
  'form_style' => 'margin:0 0 0.2em 0.8em',
107
  'form_width' => null ),
108
 
@@ -110,6 +122,7 @@ class EL_Widget extends WP_Widget {
110
  'std_value' => __( 'show event-list page', 'text_domain' ),
111
  'caption' => __( 'Caption for the link:' ),
112
  'caption_after' => null,
 
113
  'form_style' => 'margin:0 0 1em 2.5em',
114
  'form_width' => null ),
115
  );
@@ -197,7 +210,7 @@ class EL_Widget extends WP_Widget {
197
  if( 'checkbox' === $item['type'] ) {
198
  $checked_text = ( 'true'===$instance[$itemname] || 1==$instance[$itemname] ) ? 'checked = "checked" ' : '';
199
  $out .= '
200
- <p'.$style_text.'>
201
  <label><input class="widefat" id="'.$this->get_field_id( $itemname ).'" name="'.$this->get_field_name( $itemname ).'" type="checkbox" '.$checked_text.'value="1" /> '.$item['caption'].'</label>
202
  </p>';
203
  }
@@ -205,7 +218,7 @@ class EL_Widget extends WP_Widget {
205
  $width_text = ( null === $item['form_width'] ) ? '' : 'style="width:'.$item['form_width'].'px" ';
206
  $caption_after_text = ( null === $item['caption_after'] ) ? '' : '<label>'.$item['caption_after'].'</label>';
207
  $out .= '
208
- <p'.$style_text.'>
209
  <label for="'.$this->get_field_id( $itemname ).'">'.$item['caption'].' </label>
210
  <input '.$width_text.'class="widefat" id="'.$this->get_field_id( $itemname ).'" name="'.$this->get_field_name( $itemname ).'" type="text" value="'.esc_attr( $instance[$itemname] ).'" />'.$caption_after_text.'
211
  </p>';
26
  'std_value' => __( 'Upcoming events', 'text_domain' ),
27
  'caption' => __( 'Title:' ),
28
  'caption_after' => null,
29
+ 'tooltip' => __( 'The title for the widget' ),
30
  'form_style' => null,
31
  'form_width' => null ),
32
 
34
  'std_value' => '3',
35
  'caption' => __( 'Number of upcoming events:' ),
36
  'caption_after' => null,
37
+ 'tooltip' => __( 'The number of events to display' ),
38
  'form_style' => null,
39
  'form_width' => 30 ),
40
 
42
  'std_value' => '0',
43
  'caption' => __( 'Truncate event title to' ),
44
  'caption_after' => __( 'chars' ),
45
+ 'tooltip' => __( 'This option specifies the number of displayed characters for the event title. Set this value to 0 to view the full title.' ),
46
  'form_style' => null,
47
  'form_width' => 30 ),
48
 
50
  'std_value' => 'true',
51
  'caption' => __( 'Show event starttime' ),
52
  'caption_after' => null,
53
+ 'tooltip' => __( 'This option defines if the event start time will be displayed.' ),
54
  'form_style' => null,
55
  'form_width' => null ),
56
 
58
  'std_value' => 'false',
59
  'caption' => __( 'Show event location' ),
60
  'caption_after' => null,
61
+ 'tooltip' => __( 'This option defines if the event location will be displayed.' ),
62
  'form_style' => 'margin:0 0 0.2em 0',
63
  'form_width' => null ),
64
 
66
  'std_value' => '0',
67
  'caption' => __( 'Truncate location to' ),
68
  'caption_after' => __( 'chars' ),
69
+ 'tooltip' => __( 'If the event location is diplayed this option specifies the number of displayed characters. Set this value to 0 to view the full location.' ),
70
  'form_style' => 'margin:0 0 0.6em 0.9em',
71
  'form_width' => 30 ),
72
 
74
  'std_value' => 'false',
75
  'caption' => __( 'Show event details' ),
76
  'caption_after' => null,
77
+ 'tooltip' => __( 'This option defines if the event details will be displayed.' ),
78
  'form_style' => 'margin:0 0 0.2em 0',
79
  'form_width' => null ),
80
 
82
  'std_value' => '0',
83
  'caption' => __( 'Truncate details to' ),
84
  'caption_after' => __( 'characters' ),
85
+ 'tooltip' => __( 'If the event details are diplayed this option specifies the number of diplayed characters. Set this value to 0 to view the full details.' ),
86
  'form_style' => 'margin:0 0 0.6em 0.9em',
87
  'form_width' => 30 ),
88
 
90
  'std_value' => '',
91
  'caption' => __( 'URL to the linked eventlist page:' ),
92
  'caption_after' => null,
93
+ 'tooltip' => __( 'This options specifies the url to the linked event-list page. This option is required if you want to use one of the options below.' ),
94
  'form_style' => 'margin:0 0 0.4em 0',
95
  'form_width' => null ),
96
 
98
  'std_value' => '1',
99
  'caption' => __( 'Shortcode ID on linked page:' ),
100
  'caption_after' => null,
101
+ 'tooltip' => __( 'This option specifies the shortcode-id for the event-list on the linked page. Normally the standard value 1 is correct, you only have to change it if you use multiple event-list shortcodes on the linked page.' ),
102
  'form_style' => null,
103
  'form_width' => 30 ),
104
 
106
  'std_value' => 'false',
107
  'caption' => __( 'Add links to the single events' ),
108
  'caption_after' => null,
109
+ 'tooltip' => __( 'With this option you can add a link to the single event page for every displayed event. You have to specify the url to the page and the shortcode id option if you want to use it.' ),
110
  'form_style' => 'margin-left:0.8em',
111
  'form_width' => null ),
112
 
114
  'std_value' => 'false',
115
  'caption' => __( 'Add a link to an event page' ),
116
  'caption_after' => null,
117
+ 'tooltip' => __( 'With this option you can add a link to the event-list page below the diplayed events. You have to specify the url to page option if you want to use it.' ),
118
  'form_style' => 'margin:0 0 0.2em 0.8em',
119
  'form_width' => null ),
120
 
122
  'std_value' => __( 'show event-list page', 'text_domain' ),
123
  'caption' => __( 'Caption for the link:' ),
124
  'caption_after' => null,
125
+ 'tooltip' => __( 'This option specifies the text for the link to the event-list page if the approriate option is selected.' ),
126
  'form_style' => 'margin:0 0 1em 2.5em',
127
  'form_width' => null ),
128
  );
210
  if( 'checkbox' === $item['type'] ) {
211
  $checked_text = ( 'true'===$instance[$itemname] || 1==$instance[$itemname] ) ? 'checked = "checked" ' : '';
212
  $out .= '
213
+ <p'.$style_text.' title="'.$item['tooltip'].'">
214
  <label><input class="widefat" id="'.$this->get_field_id( $itemname ).'" name="'.$this->get_field_name( $itemname ).'" type="checkbox" '.$checked_text.'value="1" /> '.$item['caption'].'</label>
215
  </p>';
216
  }
218
  $width_text = ( null === $item['form_width'] ) ? '' : 'style="width:'.$item['form_width'].'px" ';
219
  $caption_after_text = ( null === $item['caption_after'] ) ? '' : '<label>'.$item['caption_after'].'</label>';
220
  $out .= '
221
+ <p'.$style_text.' title="'.$item['tooltip'].'">
222
  <label for="'.$this->get_field_id( $itemname ).'">'.$item['caption'].' </label>
223
  <input '.$width_text.'class="widefat" id="'.$this->get_field_id( $itemname ).'" name="'.$this->get_field_name( $itemname ).'" type="text" value="'.esc_attr( $instance[$itemname] ).'" />'.$caption_after_text.'
224
  </p>';
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mibuthu
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W54LNZMWF9KW2
4
  Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, admin, attribute, widget, sidebar
5
  Requires at least: 3.3
6
- Tested up to: 3.5.1
7
- Stable tag: 0.4.2
8
  Plugin URI: http://wordpress.org/extend/plugins/event-list
9
  Licence: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -51,7 +51,7 @@ Insert the shortcode [event-list] in your page.
51
  Event List uses the built-in Wordpress WYSIWYG editor. It's exactly the same process you use when creating Posts or Pages.
52
 
53
  = Can I call the shortcode directly via php e.g. for my own template, theme or plugin? =
54
- Yes, you can create an instance of the "SC_Event_List" class which located in "php/sc_event-list.php" in the plugin folder and call the function show_html($atts).With $atts you can specify all the shortcode attributes you require. Another possibility would be to call the wordpress function "do_shortcode()".
55
 
56
 
57
  == Screenshots ==
@@ -66,6 +66,16 @@ Yes, you can create an instance of the "SC_Event_List" class which located in "p
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
 
 
 
 
 
69
  = 0.4.2 (2013-06-09) =
70
 
71
  * fixed links urls to events in eventlist-widget
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W54LNZMWF9KW2
4
  Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, admin, attribute, widget, sidebar
5
  Requires at least: 3.3
6
+ Tested up to: 3.5.2
7
+ Stable tag: 0.4.3
8
  Plugin URI: http://wordpress.org/extend/plugins/event-list
9
  Licence: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
51
  Event List uses the built-in Wordpress WYSIWYG editor. It's exactly the same process you use when creating Posts or Pages.
52
 
53
  = Can I call the shortcode directly via php e.g. for my own template, theme or plugin? =
54
+ Yes, you can create an instance of the "SC_Event_List" class which located in "includes/sc_event-list.php" in the plugin folder and call the function show_html($atts).With $atts you can specify all the shortcode attributes you require. Another possibility would be to call the wordpress function "do_shortcode()".
55
 
56
 
57
  == Screenshots ==
66
 
67
  == Changelog ==
68
 
69
+ = 0.4.3 (2013-07-05) =
70
+
71
+ * added possibility to edit existing categories
72
+ * added tooptip texts for the widget option
73
+ * changed css classes to differ between event-list-view and single-event-view
74
+ * added missing permission check for new events and about page
75
+ * do not change publish date and user when an event is modified
76
+ * fixed a small issue in info messages
77
+ * code improvements and cleanup in admin pages
78
+
79
  = 0.4.2 (2013-06-09) =
80
 
81
  * fixed links urls to events in eventlist-widget