PluginProbe
RSVP and Event Management / 2.7.5
RSVP and Event Management v2.7.5
trunk 0.5.0 0.6.0 0.7.0 0.8.0 0.9.0 0.9.5 1.0.0 1.1.0 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.5.0 1.6.0 1.6.1 1.6.2 1.6.5 1.7.0 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 All 136 releases
rsvp / includes / class-rsvp-admin.php

class-rsvp-admin.php in RSVP and Event Management 2.7.5, at includes/class-rsvp-admin.php

952 lines 38.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly.
4 if ( ! defined( 'ABSPATH' ) ) :
5 exit;
6 endif;
7
8
9 if ( ! class_exists( 'RSVP' ) ) {
10
11 class RSVP_Admin {
12
13 /**
14 * Holds the class object.
15 *
16 * @since 2.7.2
17 *
18 * @var object
19 */
20 public static $instance;
21
22 /**
23 * RSVP_Admin constructor.
24 *
25 * @since 2.7.2
26 */
27 public function __construct() {
28 add_action( 'admin_menu', array( $this, 'submenu_pages' ) );
29 add_action( 'admin_init', array( $this, 'rsvp_register_settings' ) );
30 add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
31
32 }
33
34 /**
35 * Returns the singleton instance of the class.
36 *
37 * @return object The RSVP_Admin object.
38 * @since 2.7.2
39 */
40 public static function get_instance() {
41
42 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof RSVP_Admin ) ) {
43 self::$instance = new RSVP_Admin();
44 }
45
46 return self::$instance;
47
48 }
49
50 /**
51 * Add submenu page
52 *
53 * @since 2.7.2
54 */
55 public function submenu_pages() {
56
57 $rsvp_helper = RSVP_Helper::get_instance();
58
59 $page = add_menu_page(
60 'RSVP',
61 'RSVP',
62 'publish_posts',
63 'rsvp-events',
64 array( $this, 'rsvp_admin_events' ),
65 plugins_url( 'images/rsvp_lite_icon.png', RSVP_PLUGIN_FILE )
66 );
67 add_action( 'admin_print_scripts-' . $page, 'rsvp_admin_scripts' );
68
69 $page = add_submenu_page(
70 'rsvp-events',
71 'Events',
72 'Events',
73 'publish_posts',
74 'rsvp-events',
75 array( $this, 'rsvp_admin_events' )
76 );
77 add_action( 'admin_print_scripts-' . $page, 'rsvp_admin_scripts' );
78
79 $page = add_submenu_page(
80 'rsvp-events',
81 'Attendees',
82 'Attendees',
83 'publish_posts',
84 'rsvp-top-level',
85 array( $this, 'rsvp_admin_guestlist' )
86 );
87 add_action( 'admin_print_scripts-' . $page, 'rsvp_admin_scripts' );
88
89 $page = add_submenu_page(
90 'rsvp-events',
91 'Add Guest',
92 'Add Guest',
93 'publish_posts',
94 'rsvp-admin-guest',
95 array( $this, 'rsvp_admin_guest' )
96 );
97 add_action( 'admin_print_scripts-' . $page, 'rsvp_admin_scripts' );
98
99 add_submenu_page(
100 'rsvp-events',
101 'RSVP Export',
102 'RSVP Export',
103 'publish_posts',
104 'rsvp-admin-export',
105 array( $rsvp_helper, 'rsvp_admin_export' )
106 );
107 add_submenu_page(
108 'rsvp-events',
109 'RSVP Import',
110 'RSVP Import',
111 'publish_posts',
112 'rsvp-admin-import',
113 array( $rsvp_helper, 'rsvp_admin_import' )
114 );
115 $page = add_submenu_page(
116 'rsvp-events',
117 'Custom Questions',
118 'Custom Questions',
119 'publish_posts',
120 'rsvp-admin-questions',
121 array( $this, 'rsvp_admin_questions' )
122 );
123 add_action( 'admin_print_scripts-' . $page, 'rsvp_admin_scripts' );
124
125 $page = add_submenu_page(
126 'rsvp-events',
127 'RSVP Settings', // page title
128 'RSVP Settings', // subpage title
129 'manage_options', // access
130 'rsvp-options', // current file
131 array( $this, 'rsvp_admin_guestlist_options' ) // options function above)
132 );
133 add_action( 'admin_print_scripts-' . $page, 'rsvp_admin_scripts' );
134
135 $page = add_submenu_page(
136 'rsvp-events',
137 'LITE vs Premium',
138 '<span id="rsvp_upgrade_to_pro_link">LITE vs Premium</span>',
139 'publish_posts',
140 'rsvp-upgrade-to-pro',
141 array( $this, 'rsvp_lite_vs_premium' )
142 );
143 add_action( 'admin_print_scripts-' . $page, 'rsvp_admin_scripts' );
144
145 }
146
147 /**
148 * Events page
149 *
150 * @since 2.7.2
151 */
152 public function rsvp_admin_events() {
153
154 if ( get_option( 'rsvp_db_version' ) != RSVP_DB_VERSION ) {
155 rsvp_database_setup();
156 }
157 rsvp_install_passcode_field();
158
159 ?>
160
161 <div class="wrap">
162 <div id="icon-edit" class="icon32"><br/></div>
163 <h1 class="wp-heading-inline"><?php echo esc_html__( 'RSVP Events', 'rsvp' ); ?></h1>
164 <hr class="wp-header-end">
165
166 <?php
167 do_action( 'rsvp_events_before_table' );
168 $views_table = new RSVP_Events_List_Table();
169 $views_table->display();
170 do_action( 'rsvp_events_after_table' );
171 ?>
172 </div>
173 <?php
174 }
175
176 /**
177 * Attendees page
178 *
179 * @since 2.7.2
180 */
181 public function rsvp_admin_guestlist() {
182 global $wpdb;
183 if ( get_option( 'rsvp_db_version' ) != RSVP_DB_VERSION ) {
184 rsvp_database_setup();
185 }
186 rsvp_install_passcode_field();
187
188 ?>
189
190 <div class="wrap">
191 <div id="icon-edit" class="icon32"><br/></div>
192 <h1 class="wp-heading-inline"><?php echo esc_html__( 'List of current attendees', 'rsvp' ); ?></h1>
193 <a class="page-title-action"
194 href="<?php echo esc_url( add_query_arg( array( 'page' => 'rsvp-admin-guest' ), admin_url( 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Add Guest', 'rsvp' ); ?></a>
195 <hr class="wp-header-end">
196 <?php
197
198 $views_table = new RSVP_Attendees_List_Table();
199 $views_table->views();
200 $views_table->display();
201 ?>
202 </div>
203 <?php
204 }
205
206 /**
207 * Guest add page
208 *
209 * @since 2.7.2
210 */
211 public function rsvp_admin_guest() {
212 global $wpdb;
213 $rsvp_helper = RSVP_Helper::get_instance();
214 echo '<div class="wrap"><h1 class="wp-heading-inline">' . esc_html__( 'Add guest', 'rsvp' ) . '</h1><hr class="wp-header-end">';
215 if ( ( count( $_POST ) > 0 ) && ! empty( $_POST['firstName'] ) && ! empty( $_POST['lastName'] ) ) {
216 check_admin_referer( 'rsvp_add_guest' );
217 $passcode = ( isset( $_POST['passcode'] ) ) ? sanitize_text_field( wp_unslash( $_POST['passcode'] ) ) : '';
218
219 if ( isset( $_POST['attendeeId'] ) && is_numeric( $_POST['attendeeId'] ) && ( $_POST['attendeeId'] > 0 ) ) {
220 $wpdb->update(
221 ATTENDEES_TABLE,
222 array(
223 'firstName' => ( isset( $_POST['firstName'] ) ) ? rsvp_smart_quote_replace( sanitize_text_field( wp_unslash( $_POST['firstName'] ) ) ) : '',
224 'lastName' => ( isset( $_POST['lastName'] ) ) ? rsvp_smart_quote_replace( sanitize_text_field( wp_unslash( $_POST['lastName'] ) ) ) : '',
225 'email' => ( isset( $_POST['email'] ) ) ? sanitize_email( wp_unslash( $_POST['email'] ) ) : '',
226 'personalGreeting' => ( isset( $_POST['personalGreeting'] ) ) ? sanitize_text_field( wp_unslash( $_POST['personalGreeting'] ) ) : '',
227 'rsvpStatus' => ( isset( $_POST['rsvpStatus'] ) ) ? sanitize_text_field( wp_unslash( $_POST['rsvpStatus'] ) ) : '',
228 ),
229 array( 'id' => absint( $_POST['attendeeId'] ) ),
230 array( '%s', '%s', '%s', '%s', '%s' ),
231 array( '%d' )
232 );
233 $attendeeId = absint( $_POST['attendeeId'] );
234 $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . ASSOCIATED_ATTENDEES_TABLE . ' WHERE attendeeId = %d', $attendeeId ) );
235 $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . ASSOCIATED_ATTENDEES_TABLE . ' WHERE associatedAttendeeID = %d', $attendeeId ) );
236 } else {
237 $wpdb->insert(
238 ATTENDEES_TABLE,
239 array(
240 'firstName' => ( isset( $_POST['firstName'] ) ) ? rsvp_smart_quote_replace( sanitize_text_field( wp_unslash( $_POST['firstName'] ) ) ) : '',
241 'lastName' => ( isset( $_POST['lastName'] ) ) ? rsvp_smart_quote_replace( sanitize_text_field( wp_unslash( $_POST['lastName'] ) ) ): '',
242 'email' => ( isset( $_POST['email'] ) ) ? sanitize_email( wp_unslash( $_POST['email'] ) ) : '',
243 'personalGreeting' => ( isset( $_POST['pesonalGreeting'] ) ) ? sanitize_text_field( wp_unslash( $_POST['personalGreeting'] ) ) : '',
244 'rsvpStatus' => ( isset( $_POST['rsvpStatus'] ) ) ? sanitize_text_field( wp_unslash( $_POST['rsvpStatus'] ) ) : '',
245 ),
246 array( '%s', '%s', '%s', '%s', '%s' )
247 );
248
249 $attendeeId = $wpdb->insert_id;
250 }
251 if ( isset( $_POST['associatedAttendees'] ) && is_array( $_POST['associatedAttendees'] ) ) {
252 foreach ( array_map( 'sanitize_text_field', array_map( 'wp_unslash', $_POST['associatedAttendees'] ) ) as $aid ) {
253 if ( is_numeric( $aid ) && ( $aid > 0 ) ) {
254 $wpdb->insert(
255 ASSOCIATED_ATTENDEES_TABLE,
256 array(
257 'attendeeID' => absint( $attendeeId ),
258 'associatedAttendeeID' => absint( $aid ),
259 ),
260 array( '%d', '%d' )
261 );
262 $wpdb->insert(
263 ASSOCIATED_ATTENDEES_TABLE,
264 array(
265 'attendeeID' => absint( $aid ),
266 'associatedAttendeeID' => absint( $attendeeId ),
267 ),
268 array( '%d', '%d' )
269 );
270 }
271 }
272 }
273
274 if ( rsvp_require_passcode() ) {
275 if ( empty( $passcode ) ) {
276 $passcode = rsvp_generate_passcode();
277 }
278 if ( rsvp_require_unique_passcode() && ! rsvp_is_passcode_unique( $passcode, $attendeeId ) ) {
279 $passcode = rsvp_generate_passcode();
280 }
281 $wpdb->update(
282 ATTENDEES_TABLE,
283 array( 'passcode' => sanitize_text_field( $passcode ) ),
284 array( 'id' => $attendeeId ),
285 array( '%s' ),
286 array( '%d' )
287 );
288 }
289 ?>
290 <p>
291 <?php
292 echo sprintf(
293 esc_html__( 'Attendee %1$s %2$s has been successfully saved.', 'rsvp' ),
294 esc_html( sanitize_text_field( wp_unslash( $_POST['firstName'] ) ) ),
295 esc_html( sanitize_text_field( wp_unslash( $_POST['lastName'] ) ) )
296 );
297 ?>
298 </p>
299 <p>
300 <a href="<?php echo esc_url( add_query_arg( array( 'page' => 'rsvp-top-level' ), admin_url( 'admin.php' ) ) ); ?>"
301 class="button button-secondary"><?php echo esc_html__( 'Continue to Attendee List', 'rsvp' ); ?></a>
302 <a href="<?php echo esc_url( add_query_arg( array( 'page' => 'rsvp-admin-guest' ), admin_url( 'admin.php' ) ) ); ?>"
303 class="button button-primary"><?php echo esc_html__( 'Add a Guest', 'rsvp' ); ?></a>
304 </p>
305 <?php
306 } else {
307 $attendee = null;
308 $associatedAttendees = array();
309 $firstName = '';
310 $lastName = '';
311 $email = '';
312 $personalGreeting = '';
313 $rsvpStatus = 'NoResponse';
314 $passcode = '';
315 $attendeeId = 0;
316
317 if ( isset( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) {
318 $attendee = $wpdb->get_row( 'SELECT id, firstName, lastName, email, personalGreeting, rsvpStatus, passcode FROM ' . ATTENDEES_TABLE . ' WHERE id = ' . absint( $_GET['id'] ) );
319 if ( $attendee != null ) {
320 $attendeeId = $attendee->id;
321 $firstName = stripslashes( $attendee->firstName );
322 $lastName = stripslashes( $attendee->lastName );
323 $email = stripslashes( $attendee->email );
324 $personalGreeting = stripslashes( $attendee->personalGreeting );
325 $rsvpStatus = $attendee->rsvpStatus;
326 $passcode = stripslashes( $attendee->passcode );
327
328 // Get the associated attendees and add them to an array
329 $associations = $wpdb->get_results(
330 'SELECT associatedAttendeeID FROM ' . ASSOCIATED_ATTENDEES_TABLE . ' WHERE attendeeId = ' . absint( $attendee->id ) .
331 ' UNION ' .
332 'SELECT attendeeID FROM ' . ASSOCIATED_ATTENDEES_TABLE . ' WHERE associatedAttendeeID = ' . absint( $attendee->id )
333 );
334 foreach ( $associations as $aId ) {
335 $associatedAttendees[] = $aId->associatedAttendeeID;
336 }
337 }
338 }
339 ?>
340 <div class="rsvp-left-panel">
341 <form name="contact" action="admin.php?page=rsvp-admin-guest" method="post">
342 <?php wp_nonce_field( 'rsvp_add_guest' ); ?>
343 <input type="hidden" name="attendeeId" value="<?php echo absint( $attendeeId ); ?>"/>
344 <p class="submit">
345 <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'rsvp' ); ?>"/>
346 </p>
347 <table class="form-table">
348 <tr valign="top">
349 <th scope="row"><label for="firstName"><?php echo esc_html__( 'First Name', 'rsvp' ); ?>
350 :</label>
351 </th>
352 <td align="left"><input type="text" name="firstName" id="firstName" size="30"
353 value="<?php echo esc_attr( $firstName ); ?>"/></td>
354 </tr>
355 <tr valign="top">
356 <th scope="row"><label for="lastName"><?php echo esc_html__( 'Last Name', 'rsvp' ); ?>
357 :</label></th>
358 <td align="left"><input type="text" name="lastName" id="lastName" size="30"
359 value="<?php echo esc_attr( $lastName ); ?>"/></td>
360 </tr>
361 <tr valign="top">
362 <th scope="row"><label for="email"><?php echo esc_html__( 'Email', 'rsvp' ); ?>:</label>
363 </th>
364 <td align="left"><input type="text" name="email" id="email" size="30"
365 value="<?php echo esc_attr( $email ); ?>"/></td>
366 </tr>
367 <?php
368 if ( rsvp_require_passcode() ) {
369 ?>
370 <tr valign="top">
371 <th scope="row"><label for="passcode"><?php echo esc_html__( 'Passcode', 'rsvp' ); ?>
372 :</label>
373 </th>
374 <td align="left"><input type="text" name="passcode" id="passcode" size="30"
375 value="<?php echo esc_attr( $passcode ); ?>"/></td>
376 </tr>
377 <?php
378 }
379 ?>
380 <tr>
381 <th scope="row"><label
382 for="rsvpStatus"><?php echo esc_html__( 'RSVP Status', 'rsvp' ); ?></label>
383 </th>
384 <td align="left">
385 <select name="rsvpStatus" id="rsvpStatus" size="1">
386 <option value="NoResponse"
387 <?php
388 echo( ( $rsvpStatus == 'NoResponse' ) ? ' selected="selected"' : '' );
389 ?>
390 ><?php echo esc_html__( 'No Response', 'rsvp' ); ?></option>
391 <option value="Yes"
392 <?php
393 echo( ( $rsvpStatus == 'Yes' ) ? ' selected="selected"' : '' );
394 ?>
395 ><?php echo esc_html__( 'Yes', 'rsvp' ); ?></option>
396 <option value="No"
397 <?php
398 echo( ( $rsvpStatus == 'No' ) ? ' selected="selected"' : '' );
399 ?>
400 ><?php echo esc_html__( 'No', 'rsvp' ); ?></option>
401 </select>
402 </td>
403 </tr>
404 <tr valign="top">
405 <th scope="row" valign="top"><label
406 for="personalGreeting"><?php echo esc_html__( 'Custom Message', 'rsvp' ); ?>
407 :</label>
408 </th>
409 <td align="left"><textarea name="personalGreeting" id="personalGreeting" rows="5"
410 cols="40"><?php echo esc_attr( $personalGreeting ); ?></textarea>
411 </td>
412 </tr>
413 <tr valign="top">
414 <th scope="row"><?php echo esc_html__( 'Associated Attendees', 'rsvp' ); ?>:</th>
415 <td align="left">
416 <p>
417 <span style="margin-left: -5px;"><?php esc_html_e( 'Non-Associated Attendees', 'rsvp' ); ?></span>
418 <span style="margin-left:26px;"><?php esc_html_e( 'Associated Attendees', 'rsvp' ); ?></span>
419 </p>
420 <select name="associatedAttendees[]" id="associatedAttendeesSelect"
421 multiple="multiple"
422 size="5"
423 style="height: 200px;">
424 <?php
425 $attendees = $rsvp_helper->get_attendees();
426
427 foreach ( $attendees as $a ) {
428 if ( $a->id != $attendeeId ) {
429 ?>
430 <option value="<?php echo esc_attr( $a->id ); ?>"
431 <?php echo( ( in_array( $a->id, $associatedAttendees ) ) ? 'selected="selected"' : '' ); ?>><?php echo esc_html( stripslashes( $a->firstName ) . ' ' . esc_html( $a->lastName ) ); ?></option>
432 <?php
433 }
434 }
435 ?>
436 </select>
437 </td>
438 </tr>
439 <?php
440 if ( ( $attendee != null ) && ( $attendee->id > 0 ) ) {
441 $sql = 'SELECT question, answer FROM ' . ATTENDEE_ANSWERS . ' ans
442 INNER JOIN ' . QUESTIONS_TABLE . ' q ON q.id = ans.questionID
443 WHERE attendeeID = %d
444 ORDER BY q.sortOrder';
445 $aRs = $wpdb->get_results( $wpdb->prepare( $sql, $attendee->id ) );
446 if ( count( $aRs ) > 0 ) {
447 ?>
448 <tr>
449 <td colspan="2">
450 <h4><?php echo esc_html__( 'Custom Questions Answered', 'rsvp' ); ?></h4>
451 <table cellpadding="2" cellspacing="0" border="0"
452 class="rsvp-answered-questions">
453 <tr>
454 <th><?php echo esc_html__( 'Question', 'rsvp' ); ?></th>
455 <th><?php echo esc_html__( 'Answer', 'rsvp' ); ?></th>
456 </tr>
457 <?php
458 foreach ( $aRs as $a ) {
459 ?>
460 <tr>
461 <td><?php echo esc_html( stripslashes( $a->question ) ); ?></td>
462 <td><?php echo esc_html( str_replace( '||', ', ', stripslashes( $a->answer ) ) ); ?></td>
463 </tr>
464 <?php
465 }
466 ?>
467 </table>
468 </td>
469 </tr>
470 <?php
471 }
472 }
473 ?>
474 </table>
475 <p class="submit">
476 <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save', 'rsvp' ); ?>"/>
477 </p>
478 </form>
479 </div>
480 <div class="rsvp-right-panel">
481 <?php do_action( 'rsvp_after_add_guest' ); ?>
482 </div>
483 <?php
484 }
485 echo '</div>'; // .wrap class div end
486 }
487
488 /**
489 * Questions page
490 *
491 * @since 2.7.2
492 */
493 public function rsvp_admin_questions() {
494 global $wpdb;
495 $rsvp_helper = RSVP_Helper::get_instance();
496
497 if ( isset( $_GET['action'] ) && ( 'add' === strtolower( sanitize_text_field( wp_unslash( $_GET['action'] ) ) ) ) ) {
498 rsvp_admin_custom_question();
499
500 return;
501 }
502
503 ?>
504 <div class="wrap">
505 <div id="icon-edit" class="icon32"><br/></div>
506 <h1 class="wp-heading-inline"><?php echo esc_html__( 'List of current custom questions', 'rsvp' ); ?></h1>
507 <a href="<?php echo esc_url( add_query_arg( 'action', 'add' ) ); ?>"
508 class="page-title-action"><?php esc_html_e( 'Add New', 'rsvp' ); ?></a>
509 <hr class="wp-header-end">
510 <?php
511 $questions_table = new RSVP_Questions_List_Table();
512 $questions_table->display();
513
514 do_action( 'rsvp_after_question_table' );
515 ?>
516 </div>
517 <?php
518 }
519
520 /**
521 * Settings page
522 *
523 * @since 2.7.2
524 */
525 public function rsvp_admin_guestlist_options() {
526 global $wpdb;
527
528 if ( rsvp_require_unique_passcode() ) {
529 $sql = 'SELECT id, passcode FROM ' . ATTENDEES_TABLE . " a
530 WHERE passcode <> '' AND (SELECT COUNT(*) FROM " . ATTENDEES_TABLE . ' WHERE passcode = a.passcode) > 1';
531 $attendees = $wpdb->get_results( $sql );
532 foreach ( $attendees as $a ) {
533 $wpdb->update(
534 ATTENDEES_TABLE,
535 array( 'passcode' => rsvp_generate_passcode() ),
536 array( 'id' => $a->id ),
537 array( '%s' ),
538 array( '%d' )
539 );
540 }
541 }
542
543 if ( rsvp_require_passcode() ) {
544 rsvp_install_passcode_field();
545
546 $sql = 'SELECT id, passcode FROM ' . ATTENDEES_TABLE . " WHERE passcode = ''";
547 $attendees = $wpdb->get_results( $sql );
548 foreach ( $attendees as $a ) {
549 $wpdb->update(
550 ATTENDEES_TABLE,
551 array( 'passcode' => rsvp_generate_passcode() ),
552 array( 'id' => $a->id ),
553 array( '%s' ),
554 array( '%d' )
555 );
556 }
557 }
558 ?>
559 <script type="text/javascript" language="javascript">
560 jQuery( document ).ready( function () {
561 jQuery( "#rsvp_opendate" ).datepicker();
562 jQuery( "#rsvp_deadline" ).datepicker();
563 } );
564 </script>
565 <div class="wrap">
566 <h2><?php echo esc_html__( 'RSVP Plugin Settings', 'rsvp' ); ?></h2>
567 <div class="rsvp-left-panel">
568 <form method="post" action="options.php">
569 <?php settings_fields( 'rsvp-option-group' ); ?>
570 <table class="form-table">
571 <tr valign="top">
572 <th scope="row"><label
573 for="rsvp_opendate"><?php echo esc_html__( 'RSVP Open Date:', 'rsvp' ); ?></label>
574 </th>
575 <td align="left"><input type="text" name="rsvp_opendate" id="rsvp_opendate"
576 value="<?php echo esc_attr( get_option( OPTION_OPENDATE ) ); ?>"/>
577 </td>
578 </tr>
579 <tr valign="top">
580 <th scope="row"><label
581 for="rsvp_deadline"><?php echo esc_html__( 'RSVP Deadline:', 'rsvp' ); ?></label>
582 </th>
583 <td align="left"><input type="text" name="rsvp_deadline" id="rsvp_deadline"
584 value="<?php echo esc_attr( get_option( OPTION_DEADLINE ) ); ?>"/>
585 </td>
586 </tr>
587 <tr valign="top">
588 <th scope="row"><label
589 for="rsvp_num_additional_guests"><?php echo esc_html__( 'Number of Additional Guests Allowed:', 'rsvp' ); ?></label>
590 </th>
591 <td align="left"><input type="text" name="rsvp_num_additional_guests"
592 id="rsvp_num_additional_guests"
593 value="<?php echo esc_attr( get_option( OPTION_RSVP_NUM_ADDITIONAL_GUESTS ) ); ?>"/>
594 <br/>
595 <span class="description"><?php esc_html_e( 'Default is three', 'rsvp' ); ?></span>
596 </td>
597 </tr>
598 <tr valign="top">
599 <th scope="row"><label
600 for="rsvp_custom_greeting"><?php echo esc_html__( 'Custom Greeting:', 'rsvp' ); ?></label>
601 </th>
602 <td align="left"><textarea name="rsvp_custom_greeting" id="rsvp_custom_greeting"
603 rows="5"
604 cols="60"><?php echo esc_attr( get_option( OPTION_GREETING ) ); ?></textarea>
605 </td>
606 </tr>
607 <tr valign="top">
608 <th scope="row"><label
609 for="rsvp_custom_welcome"><?php echo esc_html__( 'Custom Welcome:', 'rsvp' ); ?></label>
610 </th>
611 <td align="left">
612 <textarea name="rsvp_custom_welcome" id="rsvp_custom_welcome" rows="5"
613 cols="60"><?php echo esc_html( get_option( OPTION_WELCOME_TEXT ) ); ?></textarea>
614 <br/>
615 <span class="description"><?php esc_html_e( 'Default is: &quot;There are a few more questions we need to ask you if you could please fill them out below to finish up the RSVP process.&quot;', 'rsvp' ); ?></span>
616 </td>
617 </tr>
618 <tr valign="top">
619 <th scope="row"><label
620 for="<?php echo esc_attr( OPTION_RSVP_EMAIL_TEXT ); ?>"><?php echo wp_kses_post( __('Email Text: <br />Sent to guests in confirmation, at top of email', 'rsvp' ) ); ?></label>
621 </th>
622 <td align="left"><textarea name="<?php echo esc_attr( OPTION_RSVP_EMAIL_TEXT ); ?>"
623 id="<?php echo esc_attr( OPTION_RSVP_EMAIL_TEXT ); ?>" rows="5"
624 cols="60"><?php echo esc_html( get_option( OPTION_RSVP_EMAIL_TEXT ) ); ?></textarea>
625 </td>
626 </tr>
627 <tr valign="top">
628 <th scope="row"><label
629 for="rsvp_custom_question_text"><?php echo esc_html__( 'RSVP Question Verbiage:', 'rsvp' ); ?></label>
630 </th>
631 <td align="left">
632 <input type="text" name="rsvp_custom_question_text" id="rsvp_custom_question_text"
633 value="<?php echo esc_attr( get_option( OPTION_RSVP_QUESTION ) ); ?>"
634 size="65"/>
635 <br/>
636 <span class="description"><?php echo esc_html__( 'Default is: &quot;So, how about it?&quot;', 'rsvp' ); ?></span>
637 </td>
638 </tr>
639 <tr valign="top">
640 <th scope="row"><label
641 for="rsvp_yes_verbiage"><?php echo esc_html__( 'RSVP Yes Verbiage:', 'rsvp' ); ?></label>
642 </th>
643 <td align="left"><input type="text" name="rsvp_yes_verbiage" id="rsvp_yes_verbiage"
644 value="<?php echo esc_attr( get_option( OPTION_YES_VERBIAGE ) ); ?>"
645 size="65"/>
646 <br/>
647 <span class="description"><?php esc_html_e( 'Default is: &quot;Yes, I will attend.&quot;', 'rsvp' ); ?></span>
648 </td>
649 </tr>
650 <tr valign="top">
651 <th scope="row"><label
652 for="rsvp_no_verbiage"><?php echo esc_html__( 'RSVP No Verbiage:', 'rsvp' ); ?></label>
653 </th>
654 <td align="left"><input type="text" name="rsvp_no_verbiage" id="rsvp_no_verbiage"
655 value="<?php echo esc_attr( get_option( OPTION_NO_VERBIAGE ) ); ?>"
656 size="65"/>
657 <br/>
658 <span class="description"><?php esc_html_e( 'Default is: &quot;No, I will not be able to attend.&quot;', 'rsvp' ); ?></span>
659 </td>
660 </tr>
661 <tr valign="top">
662 <th scope="row"><label
663 for="rsvp_kids_meal_verbiage"><?php echo esc_html__( 'RSVP Kids Meal Verbiage:', 'rsvp' ); ?></label>
664 </th>
665 <td align="left"><input type="text" name="rsvp_kids_meal_verbiage"
666 id="rsvp_kids_meal_verbiage"
667 value="<?php echo esc_attr( get_option( OPTION_KIDS_MEAL_VERBIAGE ) ); ?>"
668 size="65"/>
669 <br/>
670 <span class="description"><?php esc_html_e( 'Default is: &quot;We have the option of getting cheese pizza for the kids (and only kids). Do you want pizza instead of \'adult food?\'&quot;', 'rsvp' ); ?></span>
671 </td>
672 </tr>
673 <tr valign="top">
674 <th scope="row"><label
675 for="rsvp_hide_kids_meal"><?php echo esc_html__( 'Hide Kids Meal Question:', 'rsvp' ); ?></label>
676 </th>
677 <td align="left"><input type="checkbox" name="rsvp_hide_kids_meal"
678 id="rsvp_hide_kids_meal"
679 value="Y" <?php echo( ( get_option( OPTION_HIDE_KIDS_MEAL ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
680 </td>
681 </tr>
682 <tr valign="top">
683 <th scope="row"><label
684 for="rsvp_veggie_meal_verbiage"><?php echo esc_html__( 'RSVP Vegetarian Meal Verbiage:', 'rsvp' ); ?></label>
685 </th>
686 <td align="left"><input type="text" name="rsvp_veggie_meal_verbiage"
687 id="rsvp_veggie_meal_verbiage"
688 value="<?php echo esc_attr( get_option( OPTION_VEGGIE_MEAL_VERBIAGE ) ); ?>"
689 size="65"/>
690 <br/>
691 <span class="description"><?php esc_html_e( 'Default is: &quot;We also have the option of getting individual vegetarian meals instead of the fish or meat. Would you like a vegetarian dinner?&quot;', 'rsvp' ); ?></span>
692 </td>
693 </tr>
694 <tr valign="top">
695 <th scope="row"><label
696 for="rsvp_hide_veggie"><?php echo esc_html__( 'Hide Vegetarian Meal Question:', 'rsvp' ); ?></label>
697 </th>
698 <td align="left"><input type="checkbox" name="rsvp_hide_veggie" id="rsvp_hide_veggie"
699 value="Y" <?php echo( ( get_option( OPTION_HIDE_VEGGIE ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
700 </td>
701 </tr>
702 <tr valign="top">
703 <th scope="row"><label
704 for="rsvp_note_verbiage"><?php echo esc_html__( 'Note Verbiage:', 'rsvp' ); ?></label>
705 </th>
706 <td align="left"><textarea name="rsvp_note_verbiage" id="rsvp_note_verbiage" rows="3"
707 cols="60">
708 <?php
709 echo esc_html( get_option( OPTION_NOTE_VERBIAGE ) );
710 ?>
711 </textarea>
712 <br/>
713 <span class="description"><?php esc_html_e( 'Default is: &quot;If you have any food allergies, please indicate what they are in the &quot;notes&quot; section below. Or, if you just want to send us a note, please feel free. If you have any questions, please send us an email.&quot;', 'rsvp' ); ?></span>
714 </td>
715 </tr>
716 <tr valign="top">
717 <th scope="row"><label
718 for="rsvp_hide_note_field"><?php echo esc_html__( 'Hide Note Field:', 'rsvp' ); ?></label>
719 </th>
720 <td align="left"><input type="checkbox" name="rsvp_hide_note_field"
721 id="rsvp_hide_note_field"
722 value="Y"
723 <?php echo( ( get_option( RSVP_OPTION_HIDE_NOTE ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
724 </td>
725 </tr>
726 <tr valign="top">
727 <th scope="row"><label
728 for="<?php echo esc_attr( OPTION_RSVP_HIDE_EMAIL_FIELD ); ?>"><?php echo esc_html__( 'Hide email field on rsvp form:', 'rsvp' ); ?></label>
729 </th>
730 <td align="left"><input type="checkbox"
731 name="<?php echo esc_attr( OPTION_RSVP_HIDE_EMAIL_FIELD ); ?>"
732 id="<?php echo esc_attr( OPTION_RSVP_HIDE_EMAIL_FIELD ); ?>"
733 value="Y" <?php echo( ( get_option( OPTION_RSVP_HIDE_EMAIL_FIELD ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
734 </td>
735 </tr>
736 <tr valign="top">
737 <th scope="row"><label
738 for="rsvp_custom_thankyou"><?php echo esc_html__( 'Custom Thank You:', 'rsvp' ); ?></label>
739 </th>
740 <td align="left"><textarea name="rsvp_custom_thankyou" id="rsvp_custom_thankyou"
741 rows="5"
742 cols="60"><?php echo esc_textarea( get_option( OPTION_THANKYOU ) ); ?></textarea>
743 </td>
744 </tr>
745 <tr>
746 <th scope="row"><label
747 for="rsvp_hide_add_additional"><?php echo esc_html__( 'Do not allow additional guests', 'rsvp' ); ?></label>
748 </th>
749 <td align="left"><input type="checkbox" name="rsvp_hide_add_additional"
750 id="rsvp_hide_add_additional" value="Y"
751 <?php echo( ( get_option( OPTION_HIDE_ADD_ADDITIONAL ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
752 </td>
753 </tr>
754 <tr valign="top">
755 <th scope="row"><label
756 for="<?php echo esc_attr( OPTION_RSVP_ADD_ADDITIONAL_VERBIAGE ); ?>"><?php echo esc_html__( 'Add Additional Verbiage:', 'rsvp' ); ?></label>
757 </th>
758 <td align="left"><input type="text"
759 name="<?php echo esc_attr( OPTION_RSVP_ADD_ADDITIONAL_VERBIAGE ); ?>"
760 id="<?php echo esc_attr( OPTION_RSVP_ADD_ADDITIONAL_VERBIAGE ); ?>"
761 value="<?php echo esc_attr( get_option( OPTION_RSVP_ADD_ADDITIONAL_VERBIAGE ) ); ?>"
762 size="65"/>
763 <br/>
764 <span class="description"><?php esc_html_e( 'Default is: &quot;Did we slip up and forget to invite someone? If so, please add him or her here:&quot;', 'rsvp' ); ?></span>
765 </td>
766 </tr>
767 <tr>
768 <th scope="row"><label
769 for="rsvp_notify_when_rsvp"><?php echo esc_html__( 'Notify When Guest RSVPs', 'rsvp' ); ?></label>
770 </th>
771 <td align="left"><input type="checkbox" name="rsvp_notify_when_rsvp"
772 id="rsvp_notify_when_rsvp"
773 value="Y"
774 <?php echo( ( get_option( OPTION_NOTIFY_ON_RSVP ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
775 </td>
776 </tr>
777 <tr>
778 <th scope="row"><label
779 for="rsvp_notify_email_address"><?php echo esc_html__( 'Email address to notify', 'rsvp' ); ?></label>
780 </th>
781 <td align="left"><input type="text" name="rsvp_notify_email_address"
782 id="rsvp_notify_email_address"
783 value="<?php echo esc_attr( get_option( OPTION_NOTIFY_EMAIL ) ); ?>"/>
784 </td>
785 </tr>
786 <tr valign="top">
787 <th scope="row"><label
788 for="rsvp_guest_email_confirmation"><?php echo esc_html__( 'Send email to main guest when they RSVP', 'rsvp' ); ?></label>
789 </th>
790 <td align="left"><input type="checkbox" name="rsvp_guest_email_confirmation"
791 id="rsvp_guest_email_confirmation" value="Y"
792 <?php echo( ( get_option( OPTION_RSVP_GUEST_EMAIL_CONFIRMATION ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
793 </td>
794 </tr>
795 <tr>
796 <th scope="ropw"><label
797 for="<?php echo esc_attr( OPTION_RSVP_PASSCODE ); ?>"><?php echo esc_html__( 'Require a Passcode to RSVP:', 'rsvp' ); ?></label>
798 </th>
799 <td align="left"><input type="checkbox" name="<?php echo esc_attr( OPTION_RSVP_PASSCODE ); ?>"
800 id="<?php echo esc_attr( OPTION_RSVP_PASSCODE ); ?>" value="Y"
801 <?php echo( ( get_option( OPTION_RSVP_PASSCODE ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
802 </td>
803 </tr>
804 <tr>
805 <th scope="ropw"><label
806 for="<?php echo esc_attr( OPTION_RSVP_ONLY_PASSCODE ); ?>"><?php echo wp_kses_post( __('Require only a Passcode to RSVP<br />(requires that passcodes are unique):', 'rsvp') ); ?></label>
807 </th>
808 <td align="left"><input type="checkbox" name="<?php echo esc_attr( OPTION_RSVP_ONLY_PASSCODE ); ?>"
809 id="<?php echo esc_attr( OPTION_RSVP_ONLY_PASSCODE ); ?>" value="Y"
810 <?php echo( ( get_option( OPTION_RSVP_ONLY_PASSCODE ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
811 </td>
812 </tr>
813 <tr valign="top">
814 <th scope="row"><label
815 for="<?php echo esc_attr( OPTION_RSVP_OPEN_REGISTRATION ); ?>"><?php echo esc_html__( 'Allow Open Registration (note - this will force passcodes for attendees):', 'rsvp' ); ?></label>
816 </th>
817 <td align="left"><input type="checkbox"
818 name="<?php echo esc_attr( OPTION_RSVP_OPEN_REGISTRATION ); ?>"
819 id="<?php echo esc_attr( OPTION_RSVP_OPEN_REGISTRATION ); ?>" value="Y"
820 <?php echo( ( get_option( OPTION_RSVP_OPEN_REGISTRATION ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
821 </td>
822 </tr>
823 <tr valign="top">
824 <th scope="row"><label
825 for="<?php echo esc_attr( OPTION_RSVP_DONT_USE_HASH ); ?>"><?php echo esc_html__( 'Do not scroll page to the top of the RSVP form:', 'rsvp' ); ?></label>
826 </th>
827 <td align="left"><input type="checkbox" name="<?php echo esc_attr( OPTION_RSVP_DONT_USE_HASH ); ?>"
828 id="<?php echo esc_attr( OPTION_RSVP_DONT_USE_HASH ); ?>" value="Y"
829 <?php echo( ( get_option( OPTION_RSVP_DONT_USE_HASH ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
830 </td>
831 </tr>
832 <tr valign="top">
833 <th scope="row"><label
834 for="<?php echo esc_attr( OPTION_RSVP_DISABLE_CUSTOM_EMAIL_FROM ); ?>"><?php echo wp_kses_post( __( 'Do not use the specified notification email as the from email<br /> (if you are not receiving email notifications try this):', 'rsvp' ) ); ?></label>
835 </th>
836 <td align="left"><input type="checkbox"
837 name="<?php echo esc_attr( OPTION_RSVP_DISABLE_CUSTOM_EMAIL_FROM ); ?>"
838 id="<?php echo esc_attr( OPTION_RSVP_DISABLE_CUSTOM_EMAIL_FROM ); ?>"
839 value="Y" <?php echo( ( get_option( OPTION_RSVP_DISABLE_CUSTOM_EMAIL_FROM ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
840 </td>
841 </tr>
842 <tr valign="top">
843 <th scope="row"><label
844 for="<?php echo esc_attr( OPTION_RSVP_DISABLE_USER_SEARCH ); ?>"><?php echo esc_html__( 'Disable searching for a user when no user is found:', 'rsvp' ); ?></label>
845 </th>
846 <td align="left"><input type="checkbox"
847 name="<?php echo esc_attr( OPTION_RSVP_DISABLE_USER_SEARCH ); ?>"
848 id="<?php echo esc_attr( OPTION_RSVP_DISABLE_USER_SEARCH ); ?>"
849 value="Y" <?php echo( ( get_option( OPTION_RSVP_DISABLE_USER_SEARCH ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
850 </td>
851 </tr>
852 <tr valign="top">
853 <th scope="row"><label
854 for="<?php echo esc_attr( RSVP_OPTION_DELETE_DATA_ON_UNINSTALL ); ?>"><?php echo esc_html__( 'Delete all data on uninstall:', 'rsvp' ); ?></label>
855 </th>
856 <td align="left"><input type="checkbox"
857 name="<?php echo esc_attr( RSVP_OPTION_DELETE_DATA_ON_UNINSTALL ); ?>"
858 id="<?php echo esc_attr( RSVP_OPTION_DELETE_DATA_ON_UNINSTALL ); ?>"
859 value="Y" <?php echo( ( get_option( RSVP_OPTION_DELETE_DATA_ON_UNINSTALL ) == 'Y' ) ? ' checked="checked"' : '' ); ?> />
860 </td>
861 </tr>
862 <tr valign="top">
863 <th scope="row"><label
864 for="<?php echo esc_attr( RSVP_OPTION_CSS_STYLING ); ?>"><?php echo esc_html__( 'Custom Styling:', 'rsvp' ); ?></label>
865 </th>
866 <td align="left"><textarea name="<?php echo esc_attr( RSVP_OPTION_CSS_STYLING ); ?>"
867 id="<?php echo esc_attr( RSVP_OPTION_CSS_STYLING ); ?>" rows="5"
868 cols="60"><?php echo esc_html( get_option( RSVP_OPTION_CSS_STYLING ) ); ?></textarea>
869 <br/>
870 <span class="description"><?php echo wp_kses_post( __( 'Add custom CSS for the RSVP plugin. More details <a href="https://www.rsvpproplugin.com/knowledge-base/customizing-the-rsvp-pro-front-end/">here</a>', 'rsvp' ) ); ?></span>
871 </td>
872 </tr>
873 </table>
874 <input type="hidden" name="action" value="update"/>
875 <p class="submit">
876 <input type="submit" class="button-primary"
877 value="<?php echo esc_html__( 'Save Changes', 'rsvp' ); ?>"/>
878 </p>
879 </form>
880 </div>
881 <div class="rsvp-right-panel">
882 <?php do_action( 'rsvp_settings_page' ); ?>
883 </div>
884 </div>
885 <?php
886 }
887
888 /**
889 * LITE vs Premium page
890 *
891 * @return void
892 */
893 public function rsvp_lite_vs_premium() {
894
895 include 'upgrade-to-pro-page.php';
896 }
897
898 /**
899 * Register our settings
900 *
901 * @since 2.7.2
902 */
903 public function rsvp_register_settings() {
904 register_setting( 'rsvp-option-group', OPTION_OPENDATE );
905 register_setting( 'rsvp-option-group', OPTION_GREETING );
906 register_setting( 'rsvp-option-group', OPTION_THANKYOU );
907 register_setting( 'rsvp-option-group', OPTION_HIDE_VEGGIE );
908 register_setting( 'rsvp-option-group', OPTION_HIDE_KIDS_MEAL );
909 register_setting( 'rsvp-option-group', OPTION_NOTE_VERBIAGE );
910 register_setting( 'rsvp-option-group', OPTION_VEGGIE_MEAL_VERBIAGE );
911 register_setting( 'rsvp-option-group', OPTION_KIDS_MEAL_VERBIAGE );
912 register_setting( 'rsvp-option-group', OPTION_YES_VERBIAGE );
913 register_setting( 'rsvp-option-group', OPTION_NO_VERBIAGE );
914 register_setting( 'rsvp-option-group', OPTION_DEADLINE );
915 register_setting( 'rsvp-option-group', OPTION_THANKYOU );
916 register_setting( 'rsvp-option-group', OPTION_HIDE_ADD_ADDITIONAL );
917 register_setting( 'rsvp-option-group', OPTION_NOTIFY_EMAIL );
918 register_setting( 'rsvp-option-group', OPTION_NOTIFY_ON_RSVP );
919 register_setting( 'rsvp-option-group', OPTION_DEBUG_RSVP_QUERIES );
920 register_setting( 'rsvp-option-group', OPTION_WELCOME_TEXT );
921 register_setting( 'rsvp-option-group', OPTION_RSVP_QUESTION );
922 register_setting( 'rsvp-option-group', OPTION_RSVP_CUSTOM_YES_NO );
923 register_setting( 'rsvp-option-group', OPTION_RSVP_PASSCODE );
924 register_setting( 'rsvp-option-group', RSVP_OPTION_HIDE_NOTE );
925 register_setting( 'rsvp-option-group', OPTION_RSVP_OPEN_REGISTRATION );
926 register_setting( 'rsvp-option-group', OPTION_RSVP_DONT_USE_HASH );
927 register_setting( 'rsvp-option-group', OPTION_RSVP_ADD_ADDITIONAL_VERBIAGE );
928 register_setting( 'rsvp-option-group', OPTION_RSVP_GUEST_EMAIL_CONFIRMATION );
929 register_setting( 'rsvp-option-group', OPTION_RSVP_NUM_ADDITIONAL_GUESTS );
930 register_setting( 'rsvp-option-group', OPTION_RSVP_HIDE_EMAIL_FIELD );
931 register_setting( 'rsvp-option-group', OPTION_RSVP_DISABLE_CUSTOM_EMAIL_FROM );
932 register_setting( 'rsvp-option-group', OPTION_RSVP_ONLY_PASSCODE );
933 register_setting( 'rsvp-option-group', OPTION_RSVP_EMAIL_TEXT );
934 register_setting( 'rsvp-option-group', OPTION_RSVP_DISABLE_USER_SEARCH );
935 register_setting( 'rsvp-option-group', RSVP_OPTION_DELETE_DATA_ON_UNINSTALL );
936 register_setting( 'rsvp-option-group', RSVP_OPTION_CSS_STYLING );
937 }
938
939 public function admin_scripts() {
940 $screen = get_current_screen();
941 $rsvp_pages = array( 'toplevel_page_rsvp-events', 'rsvp_page_rsvp-options', 'rsvp_page_rsvp-top-level', 'rsvp_page_rsvp-admin-guest', 'rsvp_page_rsvp-admin-import', 'rsvp_page_rsvp-admin-questions', 'rsvp_page_rsvp-options', 'rsvp_page_rsvp-upgrade-to-pro' );
942
943 if ( in_array( $screen->base, $rsvp_pages, true ) ) {
944 wp_enqueue_style( 'rsvp-admin-style', plugins_url( 'assets/admin/css/rsvp_admin.css', RSVP_PLUGIN_FILE ) );
945 }
946 }
947
948 }
949
950 RSVP_Admin::get_instance();
951 }
952