|
1 <?php |
|
2 /* |
|
3 Copyright (c) 2005-2008, Alex Tingle. |
|
4 |
|
5 This program is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU General Public License |
|
7 as published by the Free Software Foundation; either version 2 |
|
8 of the License, or (at your option) any later version. |
|
9 |
|
10 This program is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 GNU General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU General Public License |
|
16 along with this program; if not, write to the Free Software |
|
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
18 */ |
|
19 |
|
20 |
|
21 class ec3_Admin |
|
22 { |
|
23 |
|
24 |
|
25 function filter_admin_head() |
|
26 { |
|
27 global $ec3; |
|
28 |
|
29 // Turn OFF advanced mode when we're in the admin screens. |
|
30 $ec3->advanced=false; |
|
31 |
|
32 ?> |
|
33 <!-- Added by eventcalendar3/admin.php --> |
|
34 <style type='text/css' media='screen'> |
|
35 @import url(<?php echo $ec3->myfiles; ?>/admin.css); |
|
36 </style> |
|
37 <!-- These scripts are only needed by edit_form screens. --> |
|
38 <script type='text/javascript' src='<?php echo $ec3->myfiles; ?>/addEvent.js'></script> |
|
39 <script type='text/javascript' src='<?php echo $ec3->myfiles; ?>/edit_form.js'></script> |
|
40 <script type='text/javascript'><!-- |
|
41 Ec3EditForm.event_cat_id='<?php echo $ec3->wp_in_category.$ec3->event_category; ?>'; |
|
42 Ec3EditForm.start_of_week=<?php echo intval( get_option('start_of_week') ); ?>; |
|
43 // --></script> |
|
44 <!-- jscalendar 1.0 JavaScripts and css locations --> |
|
45 <style type="text/css">@import url(<?php echo $ec3->myfiles; ?>/css/calendar-blue.css);</style> |
|
46 <script type="text/javascript" src="<?php echo $ec3->myfiles; ?>/js/calendar.js"></script> |
|
47 <script type="text/javascript" src="<?php echo $ec3->myfiles; ?>/js/calendar-en.js"></script> |
|
48 <script type="text/javascript" src="<?php echo $ec3->myfiles; ?>/js/calendar-setup.js"></script> |
|
49 |
|
50 <?php |
|
51 } |
|
52 |
|
53 |
|
54 // |
|
55 // EDIT FORM |
|
56 // |
|
57 |
|
58 |
|
59 /** Only for pre WP2.5. Inserts the Event Editor into the Write Post page. */ |
|
60 function filter_edit_form() |
|
61 { ?> |
|
62 |
|
63 <!-- Build the user interface for Event Calendar. --> |
|
64 <div class="dbx-b-ox-wrapper"> |
|
65 <fieldset id='ec3_schedule_editor' class="dbx-box"> |
|
66 <div class="dbx-h-andle-wrapper"> |
|
67 <h3 class="dbx-handle"><?php _e('Event Editor','ec3'); ?></h3> |
|
68 </div> |
|
69 <div class="dbx-c-ontent-wrapper"> |
|
70 <div class="dbx-content"> |
|
71 |
|
72 <?php $this->event_editor_box() ?> |
|
73 |
|
74 </div> |
|
75 </div> |
|
76 </fieldset> |
|
77 </div> |
|
78 |
|
79 <?php |
|
80 } |
|
81 |
|
82 |
|
83 function event_editor_box() |
|
84 { |
|
85 global $ec3,$wp_version,$wpdb,$post_ID; |
|
86 if(isset($post_ID)) |
|
87 $schedule = $wpdb->get_results( |
|
88 "SELECT |
|
89 sched_id, |
|
90 DATE_FORMAT(start,'%Y-%m-%d %H:%i') AS start, |
|
91 DATE_FORMAT(end,'%Y-%m-%d %H:%i') AS end, |
|
92 allday, |
|
93 rpt |
|
94 FROM $ec3->schedule WHERE post_id=$post_ID ORDER BY start"); |
|
95 else |
|
96 $schedule = false; |
|
97 |
|
98 if(function_exists('wp_create_nonce')) |
|
99 { |
|
100 echo '<input type="hidden" name="ec3_nonce" id="ec3_nonce" value="' . |
|
101 wp_create_nonce( plugin_basename(__FILE__) ) . '" />'; |
|
102 } |
|
103 ?> |
|
104 |
|
105 <!-- Event Calendar: Event Editor --> |
|
106 <table width="100%" cellspacing="2" cellpadding="5" class="editform"> |
|
107 <thead><tr> |
|
108 <th><?php _e('Start','ec3'); ?></th> |
|
109 <th><?php _e('End','ec3'); ?></th> |
|
110 <th style="text-align:center"><?php _e('All Day','ec3'); ?></th> |
|
111 <!-- th><?php _e('Repeat','ec3'); ?></th --> |
|
112 <th></th> |
|
113 </tr></thead> |
|
114 <tbody> |
|
115 <?php |
|
116 $ec3_rows=0; |
|
117 if($schedule) |
|
118 { |
|
119 foreach($schedule as $s) |
|
120 $this->schedule_row( |
|
121 $s->start,$s->end,$s->sched_id,'update',$s->allday |
|
122 ); |
|
123 $ec3_rows=count($schedule); |
|
124 } |
|
125 $default=ec3_strftime('%Y-%m-%d %H:00',3600+time()); |
|
126 $this->schedule_row($default,$default,'_','create',False); |
|
127 ?> |
|
128 <tr> |
|
129 <td colspan="4" style="text-align:left"> |
|
130 <p style="margin:0;padding:0;text-align:left"> |
|
131 <input type="button" name="ec3_new_row" value=" + " |
|
132 title="<?php _e('Add a new event','ec3'); ?>" |
|
133 onclick="Ec3EditForm.add_row()" /> |
|
134 <input type="hidden" id="ec3_rows" name="ec3_rows" |
|
135 value="<?php echo $ec3_rows; ?>" /> |
|
136 </p> |
|
137 </td> |
|
138 </tr> |
|
139 </tbody> |
|
140 </table> |
|
141 |
|
142 <?php |
|
143 } |
|
144 |
|
145 /** Utility function called by event_editor_box(). */ |
|
146 function schedule_row($start,$end,$sid,$action,$allday) |
|
147 { |
|
148 $s="ec3_start_$sid"; |
|
149 $e="ec3_end_$sid"; |
|
150 ?> |
|
151 <tr class="ec3_schedule_row" valign="middle"<?php |
|
152 if('create'==$action){ echo ' style="display:none"'; } ?>> |
|
153 <td> |
|
154 <input type="hidden" name="ec3_action_<?php echo $sid; |
|
155 ?>" value="<?php echo $action; ?>" /> |
|
156 <input type="text" name="<?php echo $s; |
|
157 if('update'==$action){ echo "\" id=\"$s"; } |
|
158 ?>" value="<?php echo $start; ?>" /> |
|
159 <button type="reset" id="trigger_<?php echo $s; ?>">…</button> |
|
160 </td> |
|
161 <td> |
|
162 <input type="text" name="<?php echo $e; |
|
163 if('update'==$action){ echo "\" id=\"$e"; } |
|
164 ?>" value="<?php echo $end; ?>" /> |
|
165 <button type="reset" id="trigger_<?php echo $e; ?>">…</button> |
|
166 </td> |
|
167 <td style="text-align:center"> |
|
168 <input type="checkbox" name="ec3_allday_<?php echo $sid; |
|
169 ?>" value="1"<?php if($allday){ echo ' checked="checked"'; } ?> /> |
|
170 </td> |
|
171 <!-- td> |
|
172 <input type="text" name="ec3_repeat_<?php echo $sid; ?>" value="<?php echo $s->rpt; ?>" /> |
|
173 </td --> |
|
174 <td> |
|
175 <p style="margin:0;padding:0"> |
|
176 <input type="button" name="ec3_del_row_<?php echo $sid; |
|
177 ?>" value=" — " |
|
178 title="<?php _e('Delete this event','ec3'); ?>" |
|
179 onclick="Ec3EditForm.del_row(this)" /> |
|
180 </p> |
|
181 </td> |
|
182 </tr> |
|
183 <?php |
|
184 } |
|
185 |
|
186 |
|
187 function action_save_post($post_ID) |
|
188 { |
|
189 if(!$_POST) |
|
190 return; |
|
191 |
|
192 if(function_exists('wp_verify_nonce')) |
|
193 { |
|
194 if(!wp_verify_nonce($_POST['ec3_nonce'], plugin_basename(__FILE__) )) |
|
195 return; |
|
196 } |
|
197 |
|
198 // if(function_exists('current_user_can')) |
|
199 // { |
|
200 // if(!current_user_can('edit_post',$post_id)) |
|
201 // return; |
|
202 // } |
|
203 |
|
204 // Ensure that we only save each post once. |
|
205 if(isset($this->save_post_called) && $this->save_post_called[$post_ID]) |
|
206 return; |
|
207 if(!isset($this->save_post_called)) |
|
208 $this->save_post_called=array(); |
|
209 $this->save_post_called[$post_ID]=true; |
|
210 |
|
211 global $ec3,$wpdb; |
|
212 // Use this to check the DB before DELETE/UPDATE. Should use |
|
213 // ...IGNORE, but some people insist on using ancient version of MySQL. |
|
214 $count_where="SELECT COUNT(0) FROM $ec3->schedule WHERE"; |
|
215 |
|
216 // If this post is no longer an event, then purge all schedule records. |
|
217 if(isset($_POST['ec3_rows']) && '0'==$_POST['ec3_rows']) |
|
218 { |
|
219 if($wpdb->get_var("$count_where post_id=$post_ID")) |
|
220 $wpdb->query("DELETE FROM $ec3->schedule WHERE post_id=$post_ID"); |
|
221 return; |
|
222 } |
|
223 |
|
224 // Find all of our parameters |
|
225 $sched_entries=array(); |
|
226 $fields =array('start','end','allday','rpt'); |
|
227 foreach($_POST as $k => $v) |
|
228 { |
|
229 if(preg_match('/^ec3_(action|'.implode('|',$fields).')_(_?)([0-9]+)$/',$k,$match)) |
|
230 { |
|
231 $sid=intval($match[3]); |
|
232 if(!isset( $sched_entries[$sid] )) |
|
233 $sched_entries[ $sid ]=array('allday' => 0); |
|
234 $sched_entries[ $sid ][ $match[1] ] = $v; |
|
235 } |
|
236 } |
|
237 |
|
238 foreach($sched_entries as $sid => $vals) |
|
239 { |
|
240 // Bail out if the input data looks suspect. |
|
241 if(!array_key_exists('action',$vals) || count($vals)<3) |
|
242 continue; |
|
243 // Save the value of 'action' and remove it. Leave just the column vals. |
|
244 $action=$vals['action']; |
|
245 unset($vals['action']); |
|
246 // Reformat the column values for SQL: |
|
247 foreach($vals as $k => $v) |
|
248 if('allday'==$k) |
|
249 $vals[$k]=intval($v); |
|
250 else |
|
251 $vals[$k]="'".$wpdb->escape($v)."'"; |
|
252 $sid_ok=$wpdb->get_var("$count_where post_id=$post_ID AND sched_id=$sid"); |
|
253 // Execute the SQL. |
|
254 if($action=='delete' && $sid>0 && $sid_ok): |
|
255 $wpdb->query( |
|
256 "DELETE FROM $ec3->schedule |
|
257 WHERE post_id=$post_ID |
|
258 AND sched_id=$sid" |
|
259 ); |
|
260 elseif($action=='update' && $sid>0 && $sid_ok): |
|
261 $wpdb->query( |
|
262 "UPDATE $ec3->schedule |
|
263 SET ".$this->implode_assoc(', ',$vals)." |
|
264 WHERE post_id=$post_ID |
|
265 AND sched_id=$sid" |
|
266 ); |
|
267 elseif($action=='create'): |
|
268 $wpdb->query( |
|
269 "INSERT INTO $ec3->schedule |
|
270 (post_id, ".implode(', ',array_keys($vals)).") |
|
271 VALUES ($post_ID,".implode(', ',array_values($vals)).")" |
|
272 ); |
|
273 endif; |
|
274 } |
|
275 // Force all end dates to be >= start dates. |
|
276 $wpdb->query("UPDATE $ec3->schedule SET end=start WHERE end<start"); |
|
277 } // end function action_save_post() |
|
278 |
|
279 /** Utility function called by action_save_post(). */ |
|
280 function implode_assoc($glue,$arr) |
|
281 { |
|
282 $result=array(); |
|
283 foreach($arr as $key=>$value) |
|
284 $result[]=$key."=".$value; |
|
285 return implode($glue,$result); |
|
286 } |
|
287 |
|
288 |
|
289 // |
|
290 // OPTIONS |
|
291 // |
|
292 |
|
293 |
|
294 /** Upgrade the installation, if necessary. */ |
|
295 function upgrade_database() |
|
296 { |
|
297 global $ec3,$wpdb; |
|
298 // Check version - return if no upgrade required. |
|
299 $installed_version=get_option('ec3_version'); |
|
300 if($installed_version==$ec3->version) |
|
301 return; |
|
302 |
|
303 $v0=$this->ec3_version($installed_version); |
|
304 $v1=$this->ec3_version($ec3->version); |
|
305 for($i=0; $i<min(count($v0),count($v1)); $i++) |
|
306 { |
|
307 if( $v0[$i] > $v1[$i] ) |
|
308 return; // Installed version later than this one ?!?! |
|
309 if( $v0[$i] < $v1[$i] ) |
|
310 break; // Installed version earlier than this one. |
|
311 } |
|
312 |
|
313 // Upgrade. |
|
314 $tables=$wpdb->get_results('SHOW TABLES',ARRAY_N); |
|
315 if(!$tables) |
|
316 die(__('Error upgrading database for EventCalendar plugin.','ec3')); |
|
317 |
|
318 $table_exists=false; |
|
319 foreach($tables as $t) |
|
320 if(preg_match("/$ec3->schedule/",$t[0])) |
|
321 $table_exists=true; |
|
322 |
|
323 if(!$table_exists) |
|
324 { |
|
325 $wpdb->query( |
|
326 "CREATE TABLE $ec3->schedule ( |
|
327 sched_id BIGINT(20) AUTO_INCREMENT, |
|
328 post_id BIGINT(20), |
|
329 start DATETIME, |
|
330 end DATETIME, |
|
331 allday BOOL, |
|
332 rpt VARCHAR(64), |
|
333 PRIMARY KEY(sched_id) |
|
334 )"); |
|
335 // Force the special upgrade page if we are coming from v3.0 |
|
336 if( $ec3->event_category && |
|
337 ( empty($v0) || $v0[0]<3 || ($v0[0]==3 && $v0[1]==0) ) ) |
|
338 { |
|
339 update_option('ec3_upgrade_posts',1); |
|
340 } |
|
341 } // end if(!$table_exists) |
|
342 |
|
343 // Record the new version number |
|
344 update_option('ec3_version',$ec3->version); |
|
345 echo '<div id="message" class="updated fade"><p><strong>' |
|
346 . sprintf( |
|
347 __('Upgraded database to EventCalendar Version %s','ec3'), |
|
348 $ec3->version |
|
349 ); |
|
350 if($table_exists) |
|
351 echo '<br />('.__('Table already existed','ec3').')'; |
|
352 echo ".</strong></p></div>\n"; |
|
353 } // end function upgrade_database(); |
|
354 |
|
355 /** Utility function used by upgrade_database(). |
|
356 * Breaks apart a version string into an array of comparable parts. */ |
|
357 function ec3_version($str) |
|
358 { |
|
359 $s=preg_replace('/([a-z])([0-9])/','\1.\2',$str); |
|
360 $v=explode('.',$s); |
|
361 $result=array(); |
|
362 foreach($v as $i) |
|
363 { |
|
364 if(preg_match('/^[0-9]+$/',$i)) |
|
365 $result[]=intval($i); |
|
366 elseif(empty($i)) |
|
367 $result[]=0; |
|
368 else |
|
369 $result[]=$i; |
|
370 } |
|
371 return $result; |
|
372 } |
|
373 |
|
374 |
|
375 function action_admin_menu() |
|
376 { |
|
377 global $ec3; |
|
378 add_options_page( |
|
379 __('Event Calendar Options','ec3'), |
|
380 'EventCalendar', |
|
381 6, |
|
382 'ec3_admin', |
|
383 'ec3_options_subpanel' |
|
384 ); |
|
385 |
|
386 if(empty($ec3->event_category)) |
|
387 return; // Until EC is properly configured, only show the options page. |
|
388 |
|
389 if(function_exists('add_meta_box')) |
|
390 { |
|
391 add_meta_box( |
|
392 'ec3_schedule_editor', // HTML id for container div |
|
393 __('Event Editor','ec3'), |
|
394 'ec3_event_editor_box', // callback function |
|
395 'post', // page type |
|
396 'advanced', // context |
|
397 'high' // priority |
|
398 ); |
|
399 } |
|
400 else |
|
401 { |
|
402 // Old (pre WP2.5) functionality. |
|
403 add_filter('simple_edit_form', array(&$ec3_admin,'filter_edit_form')); |
|
404 if($ec3->wp_have_dbx) |
|
405 add_filter('dbx_post_advanced', array(&$ec3_admin,'filter_edit_form')); |
|
406 else |
|
407 add_filter('edit_form_advanced',array(&$ec3_admin,'filter_edit_form')); |
|
408 } |
|
409 } |
|
410 |
|
411 |
|
412 function options_subpanel() |
|
413 { |
|
414 global $ec3; |
|
415 |
|
416 if(isset($_POST['info_update'])) |
|
417 { |
|
418 echo '<div id="message" class="updated fade"><p><strong>'; |
|
419 if(isset($_POST['ec3_event_category'])) |
|
420 $ec3->set_event_category( intval($_POST['ec3_event_category']) ); |
|
421 if(isset($_POST['ec3_num_months'])) |
|
422 $ec3->set_num_months( intval($_POST['ec3_num_months']) ); |
|
423 if(isset($_POST['ec3_show_only_events'])) |
|
424 $ec3->set_show_only_events( intval($_POST['ec3_show_only_events']) ); |
|
425 if(isset($_POST['ec3_day_length'])) |
|
426 $ec3->set_day_length( intval($_POST['ec3_day_length']) ); |
|
427 if(isset($_POST['ec3_hide_logo'])) |
|
428 $ec3->set_hide_logo( intval($_POST['ec3_hide_logo']) ); |
|
429 if(isset($_POST['ec3_hide_event_box'])) |
|
430 $ec3->set_hide_event_box( intval($_POST['ec3_hide_event_box']) ); |
|
431 if(isset($_POST['ec3_advanced'])) |
|
432 $ec3->set_advanced( intval($_POST['ec3_advanced']) ); |
|
433 if(isset($_POST['ec3_navigation'])) |
|
434 $ec3->set_navigation( intval($_POST['ec3_navigation']) ); |
|
435 if(isset($_POST['ec3_disable_popups'])) |
|
436 $ec3->set_disable_popups( intval($_POST['ec3_disable_popups']) ); |
|
437 if(isset($_POST['ec3_tz'])) |
|
438 $ec3->set_tz( $_POST['ec3_tz'] ); |
|
439 _e('Options saved.'); |
|
440 echo '</strong></p></div>'; |
|
441 } |
|
442 ?> |
|
443 |
|
444 <div class="wrap"> |
|
445 <form method="post"> |
|
446 <h2><?php _e('Event Calendar Options','ec3'); ?></h2> |
|
447 |
|
448 <?php if(isset($_GET['ec3_easteregg'])): ?> |
|
449 |
|
450 <h3><?php _e('Easter Egg','ec3') ?>: |
|
451 <input type="submit" name="ec3_upgrade_posts" |
|
452 value="<?php _e('Upgrade Event Posts','ec3') ?>" /></h3> |
|
453 |
|
454 <?php endif ?> |
|
455 |
|
456 <table class="form-table"> |
|
457 |
|
458 <tr valign="top"> |
|
459 <th width="33%" scope="row"><?php _e('Event category','ec3'); ?>:</th> |
|
460 <td> |
|
461 <select name="ec3_event_category"> |
|
462 <?php |
|
463 if(0==$ec3->event_category) |
|
464 echo '<option value="0">'.__('- Select -').'</option>'; |
|
465 wp_dropdown_cats( 0, $ec3->event_category ); |
|
466 ?> |
|
467 </select> |
|
468 <br /><em> |
|
469 <?php _e("Event posts are put into this category for you. Don't make this your default post category.",'ec3'); ?> |
|
470 </em> |
|
471 </td> |
|
472 </tr> |
|
473 |
|
474 <tr valign="top"> |
|
475 <th width="33%" scope="row"><?php _e('Show schedule within posts','ec3'); ?>:</th> |
|
476 <td> |
|
477 <select name="ec3_hide_event_box"> |
|
478 <option value='0'<?php if(!$ec3->hide_event_box) echo " selected='selected'" ?> > |
|
479 <?php _e('Show Schedule','ec3'); ?> |
|
480 </option> |
|
481 <option value='1'<?php if($ec3->hide_event_box) echo " selected='selected'" ?> > |
|
482 <?php _e('Hide Schedule','ec3'); ?> |
|
483 </option> |
|
484 </select> |
|
485 </td> |
|
486 </tr> |
|
487 |
|
488 <tr valign="top"> |
|
489 <th width="33%" scope="row"><?php _e('Show events as blog entries','ec3'); ?>:</th> |
|
490 <td> |
|
491 <select name="ec3_advanced"> |
|
492 <option value='0'<?php if(!$ec3->advanced_setting) echo " selected='selected'" ?> > |
|
493 <?php _e('Events are Normal Posts','ec3'); ?> |
|
494 </option> |
|
495 <option value='1'<?php if($ec3->advanced_setting) echo " selected='selected'" ?> > |
|
496 <?php _e('Keep Events Separate','ec3'); ?> |
|
497 </option> |
|
498 </select> |
|
499 <br /><em> |
|
500 <?php _e('Keep Events Separate: the Event Category page shows future events, in date order. Events do not appear on front page.','ec3'); ?> |
|
501 </em> |
|
502 </td> |
|
503 |
|
504 <tr valign="top"> |
|
505 <?php if($ec3->tz_disabled): ?> |
|
506 <th style="color:gray" width="33%" scope="row"><?php _e('Timezone','ec3'); ?>:</th> |
|
507 <td> |
|
508 <input disabled="disabled" type="text" value="<?php |
|
509 if(empty($ec3->tz)) |
|
510 _e('unknown','ec3'); |
|
511 else |
|
512 echo $ec3->tz; ?>" /> |
|
513 <br /><em> |
|
514 <?php _e("You cannot change your timezone. Turn off PHP's 'safe mode' or upgrade to PHP5.",'ec3'); ?> |
|
515 </em> |
|
516 </td> |
|
517 <?php else: ?> |
|
518 <th width="33%" scope="row"><?php _e('Timezone','ec3'); ?>:</th> |
|
519 <td> |
|
520 <select name="ec3_tz"> |
|
521 <option value="wordpress">WordPress</option> |
|
522 <?php ec3_get_tz_options($ec3->tz); ?> |
|
523 </select> |
|
524 </td> |
|
525 <?php endif; ?> |
|
526 </tr> |
|
527 |
|
528 </table> |
|
529 |
|
530 <h3><?php _e('Calendar Display','ec3'); ?></h3> |
|
531 |
|
532 <table class="form-table"> |
|
533 |
|
534 <tr valign="top"> |
|
535 <th width="33%" scope="row"><?php _e('Number of months','ec3'); ?>:</th> |
|
536 <td> |
|
537 <input type="text" name="ec3_num_months" value="<?php echo $ec3->num_months; ?>" /> |
|
538 </td> |
|
539 </tr> |
|
540 |
|
541 <tr valign="top"> |
|
542 <th width="33%" scope="row"><?php _e('Show all categories in calendar','ec3'); ?>:</th> |
|
543 <td> |
|
544 <select name="ec3_show_only_events"> |
|
545 <option value='1'<?php if($ec3->show_only_events) echo " selected='selected'" ?> > |
|
546 <?php _e('Only Show Events','ec3'); ?> |
|
547 </option> |
|
548 <option value='0'<?php if(!$ec3->show_only_events) echo " selected='selected'" ?> > |
|
549 <?php _e('Show All Posts','ec3'); ?> |
|
550 </option> |
|
551 </select> |
|
552 </td> |
|
553 </tr> |
|
554 |
|
555 <tr valign="top"> |
|
556 <th width="33%" scope="row"><?php _e('Show day names as','ec3'); ?>:</th> |
|
557 <td> |
|
558 <select name="ec3_day_length"> |
|
559 <option value='1'<?php if($ec3->day_length<3) echo " selected='selected'" ?> > |
|
560 <?php _e('Single Letter','ec3'); ?> |
|
561 </option> |
|
562 <option value='3'<?php if(3==$ec3->day_length) echo " selected='selected'" ?> > |
|
563 <?php _e('3-Letter Abbreviation','ec3'); ?> |
|
564 </option> |
|
565 <option value='9'<?php if($ec3->day_length>3) echo " selected='selected'" ?> > |
|
566 <?php _e('Full Day Name','ec3'); ?> |
|
567 </option> |
|
568 </select> |
|
569 </td> |
|
570 </tr> |
|
571 |
|
572 <tr valign="top"> |
|
573 <th width="33%" scope="row"><?php _e('Show Event Calendar logo','ec3'); ?>:</th> |
|
574 <td> |
|
575 <select name="ec3_hide_logo"> |
|
576 <option value='0'<?php if(!$ec3->hide_logo) echo " selected='selected'" ?> > |
|
577 <?php _e('Show Logo','ec3'); ?> |
|
578 </option> |
|
579 <option value='1'<?php if($ec3->hide_logo) echo " selected='selected'" ?> > |
|
580 <?php _e('Hide Logo','ec3'); ?> |
|
581 </option> |
|
582 </select> |
|
583 </td> |
|
584 </tr> |
|
585 |
|
586 <tr valign="top"> |
|
587 <th width="33%" scope="row"><?php _e('Position of navigation links','ec3'); ?>:</th> |
|
588 <td> |
|
589 <select name="ec3_navigation"> |
|
590 <option value='0'<?php if(0==!$ec3->navigation) echo " selected='selected'" ?> > |
|
591 <?php _e('Above Calendar','ec3'); ?> |
|
592 </option> |
|
593 <option value='1'<?php if(1==$ec3->navigation) echo " selected='selected'" ?> > |
|
594 <?php _e('Below Calendar','ec3'); ?> |
|
595 </option> |
|
596 <option value='2'<?php if(2==$ec3->navigation) echo " selected='selected'" ?> > |
|
597 <?php _e('Hidden','ec3'); ?> |
|
598 </option> |
|
599 </select> |
|
600 <br /><em> |
|
601 <?php _e('The navigation links are more usable when they are above the calendar, but you might prefer them below or hidden for aesthetic reasons.','ec3'); ?> |
|
602 </em> |
|
603 </td> |
|
604 </tr> |
|
605 |
|
606 <tr valign="top"> |
|
607 <th width="33%" scope="row"><?php _e('Popup event lists','ec3'); ?>:</th> |
|
608 <td> |
|
609 <select name="ec3_disable_popups"> |
|
610 <option value='0'<?php if(!$ec3->disable_popups) echo " selected='selected'" ?> > |
|
611 <?php _e('Show Popups','ec3'); ?> |
|
612 </option> |
|
613 <option value='1'<?php if($ec3->disable_popups) echo " selected='selected'" ?> > |
|
614 <?php _e('Hide Popups','ec3'); ?> |
|
615 </option> |
|
616 </select> |
|
617 <br /><em> |
|
618 <?php _e('You might want to disable popups if you use Nicetitles.','ec3'); ?> |
|
619 </em> |
|
620 </td> |
|
621 </tr> |
|
622 |
|
623 </table> |
|
624 |
|
625 <p class="submit"><input type="submit" name="info_update" |
|
626 value="<?php _e('Save Changes') ?>" /></p> |
|
627 </form> |
|
628 |
|
629 </div> <?php |
|
630 } // end function options_subpanel() |
|
631 |
|
632 }; // end class ec3_Admin |
|
633 |
|
634 |
|
635 $ec3_admin=new ec3_Admin(); |
|
636 |
|
637 function ec3_options_subpanel() |
|
638 { |
|
639 global $ec3_admin; |
|
640 |
|
641 // Upgrade |
|
642 if(isset($_POST['ec3_cancel_upgrade'])) |
|
643 update_option('ec3_upgrade_posts',0); |
|
644 |
|
645 $ec3_admin->upgrade_database(); // May set option ec3_force_upgrade |
|
646 |
|
647 if( intval(get_option('ec3_upgrade_posts')) || |
|
648 isset($_POST['ec3_upgrade_posts']) ) |
|
649 { |
|
650 require_once(dirname(__FILE__).'/upgrade-posts.php'); |
|
651 ec3_upgrade_posts(); |
|
652 return; |
|
653 } |
|
654 |
|
655 // Normal options page... |
|
656 $ec3_admin->options_subpanel(); |
|
657 } |
|
658 |
|
659 function ec3_event_editor_box() |
|
660 { |
|
661 global $ec3_admin; |
|
662 $ec3_admin->event_editor_box(); |
|
663 } |
|
664 |
|
665 |
|
666 // |
|
667 // Hook in... |
|
668 if($ec3->event_category) |
|
669 { |
|
670 add_filter('admin_head',array(&$ec3_admin,'filter_admin_head')); |
|
671 add_action('save_post', array(&$ec3_admin,'action_save_post')); |
|
672 // TODO v3.2 - don't use the edit_post hook. |
|
673 add_action('edit_post', array(&$ec3_admin,'action_save_post')); |
|
674 } |
|
675 |
|
676 // Always hook into the admin_menu - it's required to allow users to |
|
677 // set things up. |
|
678 add_action('admin_menu', array(&$ec3_admin,'action_admin_menu')); |
|
679 |
|
680 ?> |