function event_register() { load_plugin_textdomain('quick-event-manager', false, basename(dirname(__FILE__)) . '/languages'); qem_generate_csv(); qem_create_css_file(''); if (!post_type_exists('event')) { $labels = array('name' => _x('Events', 'post type general name', 'quick-event-manager'), 'singular_name' => _x('Event', 'post type singular name', 'quick-event-manager'), 'add_new' => _x('Add New', 'event', 'quick-event-manager'), 'add_new_item' => __('Add New Event', 'quick-event-manager'), 'edit_item' => __('Edit Event', 'quick-event-manager'), 'new_item' => __('New Event', 'quick-event-manager'), 'view_item' => __('View Event', 'quick-event-manager'), 'search_items' => __('Search event', 'quick-event-manager'), 'not_found' => __('Nothing found', 'quick-event-manager'), 'not_found_in_trash' => __('Nothing found in Trash', 'quick-event-manager'), 'parent_item_colon' => ''); $args = array('labels' => $labels, 'public' => true, 'menu_icon' => 'dashicons-calendar-alt', 'publicly_queryable' => true, 'exclude_from_search' => false, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'show_in_menu' => true, 'capability_type' => array('event', 'events'), 'map_meta_cap' => true, 'hierarchical' => false, 'has_archive' => true, 'menu_position' => null, 'taxonomies' => array('category', 'post_tag'), 'supports' => array('title', 'editor', 'author', 'thumbnail', 'comments', 'excerpt'), 'show_ui' => true); register_post_type('event', $args); } }
function event_get_stored_options() { $event = get_option('event_settings'); if (!is_array($event)) { $event = array(); $version = get_option('qem_version'); if ($version != '6.3.1') { qem_create_css_file('update'); update_option('qem_version', '6.3.1'); } } $option_default = event_get_default_options(); $event = array_merge($option_default, $event); return $event; }
function qem_register() { $processpercent = $processfixed = $qem_apikey = ''; if (isset($_POST['Submit']) && check_admin_referer("save_qem")) { $options = array('useform', 'formwidth', 'notarchive', 'useqpp', 'usename', 'usemail', 'usetelephone', 'useplaces', 'usemessage', 'useattend', 'usecaptcha', 'useblank1', 'useblank2', 'usedropdown', 'useselector', 'usenumber1', 'reqname', 'reqmail', 'reqtelephone', 'reqmessage', 'reqblank1', 'reqblank2', 'reqdropdown', 'reqnumber1', 'formborder', 'sendemail', 'subject', 'subjecttitle', 'subjectdate', 'title', 'blurb', 'yourname', 'youremail', 'yourtelephone', 'yourplaces', 'yourmessage', 'yourcaptcha', 'yourattend', 'yourblank1', 'yourblank2', 'yourdropdown', 'yourselector', 'yournumber1', 'useaddinfo', 'addinfo', 'qemsubmit', 'error', 'replytitle', 'replyblurb', 'whoscoming', 'whosavatar', 'whoscomingmessage', 'placesbefore', 'placesafter', 'eventfull', 'eventfullmessage', 'eventlist', 'showuser', 'linkback', 'usecopy', 'copyblurb', 'alreadyregistered', 'useread_more', 'read_more', 'sort', 'registeredusers', 'paypal', 'qempaypalsubmit', 'numberattending', 'numberattendingbefore', 'numberattendingafter', 'allowmultiple', 'nameremoved', 'checkremoval', 'allowtags', 'useterms', 'termslabel', 'termsurl', 'termstarget', 'ontheright', 'usemorenames', 'morenames'); foreach ($options as $item) { $register[$item] = stripslashes($_POST[$item]); if ($_POST['allowtags']) { $register[$item] = strip_tags($register[$item], '<p><b><a><em><i><strong>'); } else { $register[$item] = filter_var($register[$item], FILTER_SANITIZE_STRING); } } update_option('qem_register', $register); qem_create_css_file('update'); qem_admin_notice(__('The registration form settings have been updated', 'quick-event-manager')); } if (isset($_POST['Reset']) && check_admin_referer("save_qem")) { delete_option('qem_register'); qem_admin_notice(__('The registration form settings have been reset', 'quick-event-manager')); } if (isset($_POST['Validate']) && check_admin_referer("save_qem")) { $apikey = $_POST['qem_apikey']; $blogurl = get_site_url(); $akismet = new qem_akismet($blogurl, $apikey); if ($akismet->isKeyValid()) { qem_admin_notice("Valid Akismet API Key. All messages will now be checked against the Akismet database."); update_option('qem-akismet', $apikey); } else { qem_admin_notice("Your Akismet API Key is not Valid"); } } if (isset($_POST['Delete']) && check_admin_referer("save_qem")) { delete_option('qem-akismet'); qem_admin_notice("Akismet validation is no longer active on the Quick Event Manager"); } $register = qem_get_stored_register(); $content = '<div class="qem-settings"><div class="qem-options"> <form id="" method="post" action=""> <table width="100%"> <tr> <td colspan="3"><h2>' . __('General Settings', 'quick-event-manager') . '</h2></td></tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="useform"' . $register['useform'] . ' value="checked" /></td> <td colspan="2">' . __('Add a registration form to ALL your events', 'quick-event-manager') . '<br> <span class="description">' . __('To add a registration form to individual events use the event editor', 'quick-event-manager') . '.</span></td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="formborder"' . $register['formborder'] . ' value="checked" /></td> <td colspan="2">' . __('Add a border to the form', 'quick-event-manager') . '</td> </tr> <tr> <td></td> <td colspan="2">' . __('Form Width', 'quick-event-manager') . '<input type="text" style="width:4em" name="formwidth" value="' . $register['formwidth'] . '" /> use px, em or %. Default is px.</td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="ontheright"' . $register['ontheright'] . ' value="checked" /></td> <td colspan="2">' . __('Display the registration form on the right below the event image and map (if used)', 'quick-event-manager') . '</td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="notarchive" ' . $register['notarchive'] . ' value="checked" /></td> <td colspan="2">' . __('Do not display registration form on old events', 'quick-event-manager') . '</td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="showuser" ' . $register['showuser'] . ' value="checked" /></td> <td colspan="2">' . __('Pre-fill user name if logged in', 'quick-event-manager') . '</td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="registeredusers" ' . $register['registeredusers'] . ' value="checked" /></td> <td colspan="2">' . __('Only users who have logged in can register', 'quick-event-manager') . '</td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="allowmultiple" ' . $register['allowmultiple'] . ' value="checked" /></td> <td colspan="2">' . __('Allow multiple registrations', 'quick-event-manager') . '</td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="eventfull" ' . $register['eventfull'] . ' value="checked" /></td> <td colspan="2">' . __('Hide registration form when event is full', 'quick-event-manager') . '</td> </tr> <tr> <td></td> <td>' . __('Message to display', 'quick-event-manager') . ':</td> <td><input type="text" style="" name="eventfullmessage" value="' . $register['eventfullmessage'] . '" /></td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="allowtags"' . $register['allowtags'] . ' value="cheFcked" /></td> <td colspan="2">' . __('Allow HTML tags', 'quick-event-manager') . ' ' . __('Warning: this may leave your site open to CSRF and XSS attacks so be careful.', 'quick-event-manager') . '</td> </tr> <td colspan="3"><h2>' . __('Notifications', 'quick-event-manager') . '</h2></td> <tr> <td colspan="2">' . __('Your Email Address', 'quick-event-manager') . '</td> <td><input type="text" style="" name="sendemail" value="' . $register['sendemail'] . '" /><br><span class="description">' . __('This is where registration notifications will be sent', 'quick-event-manager') . '</span></td> </tr> <tr> <td colspan="3"><h2>' . __('Registration Form', 'quick-event-manager') . '</h2></td> </tr> <tr> <td colspan="2">' . __('Form title', 'quick-event-manager') . '</td> <td><input type="text" style="" name="title" value="' . $register['title'] . '" /></td> </tr> <tr> <td colspan="2">' . __('Form blurb', 'quick-event-manager') . '</td> <td><input type="text" style="" name="blurb" value="' . $register['blurb'] . '" /></td> </tr> <td colspan="2">' . __('Submit Button', 'quick-event-manager') . '</td> <td><input type="text" style="" name="qemsubmit" value="' . $register['qemsubmit'] . '" /></td> </tr> </table> <p>' . __('Check those fields you want to use. Drag and drop to change the order', 'quick-event-manager') . '.</p> <style>table#sorting{width:100%;} #sorting tbody tr{outline: 1px solid #888;background:#E0E0E0;} #sorting tbody td{padding: 2px;vertical-align:middle;} #sorting{border-collapse:separate;border-spacing:0 5px;}</style> <script> jQuery(function() {var qem_rsort = jQuery( "#qem_rsort" ).sortable( {axis: "y",cursor: "move",opacity:0.8,update:function(e,ui) {var order = qem_rsort.sortable("toArray").join();jQuery("#qem_register_sort").val(order);}});}); </script> <table id="sorting"> <thead> <tr> <th width="5%">U</th> <th width="5%">R</th> <th width="20%">' . __('Field', 'quick-event-manager') . '</th> <th>' . __('Label', 'quick-event-manager') . '</th> </tr> </thead><tbody id="qem_rsort">'; $sort = explode(",", $register['sort']); foreach ($sort as $name) { switch ($name) { case 'field1': $use = 'usename'; $req = 'reqname'; $label = __('Name', 'quick-event-manager'); $input = 'yourname'; break; case 'field2': $use = 'usemail'; $req = 'reqmail'; $label = __('Email', 'quick-event-manager'); $input = 'youremail'; break; case 'field3': $use = 'useattend'; $req = ''; $label = __('Not Attending', 'quick-event-manager'); $input = 'yourattend'; break; case 'field4': $use = 'usetelephone'; $req = 'reqtelephone'; $label = __('Telephone', 'quick-event-manager'); $input = 'yourtelephone'; break; case 'field5': $use = 'useplaces'; $req = ''; $label = __('Places', 'quick-event-manager'); $input = 'yourplaces'; break; case 'field6': $use = 'usemessage'; $req = 'reqmessage'; $label = __('Message', 'quick-event-manager'); $input = 'yourmessage'; break; case 'field7': $use = 'usecaptcha'; $req = ''; $label = __('Captcha', 'quick-event-manager'); $input = 'Displays a simple maths captcha to confuse the spammers.'; break; case 'field8': $use = 'usecopy'; $req = ''; $label = __('Copy Message', 'quick-event-manager'); $input = 'copyblurb'; break; case 'field9': $use = 'useblank1'; $req = 'reqblank1'; $label = __('User defined', 'quick-event-manager'); $input = 'yourblank1'; break; case 'field10': $use = 'useblank2'; $req = 'reqblank2'; $label = __('User defined', 'quick-event-manager'); $input = 'yourblank2'; break; case 'field11': $use = 'usedropdown'; $req = ''; $label = __('Dropdown', 'quick-event-manager'); $input = 'yourdropdown'; break; case 'field12': $use = 'usenumber1'; $req = 'reqnumber1'; $label = __('Number', 'quick-event-manager'); $input = 'yournumber1'; break; case 'field13': $use = 'useaddinfo'; $req = ''; $label = __('Additional Info (displays as plain text)', 'quick-event-manager'); $input = 'addinfo'; break; case 'field14': $use = 'useselector'; $req = ''; $label = __('Dropdown', 'quick-event-manager'); $input = 'yourselector'; break; } $content .= '<tr id="' . $name . '"> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="' . $use . '" ' . $register[$use] . ' value="checked" /></td> <td width="5%">'; if ($req) { $content .= '<input type="checkbox" style="margin:0; padding: 0; border: none" name="' . $req . '" ' . $register[$req] . ' value="checked" />'; } $content .= '</td><td width="20%">' . $label . '</td><td>'; if ($name == 'field7') { $content .= $input; } else { $content .= '<input type="text" style="padding:1px;border: 1px solid #343838;" name="' . $input . '" value="' . $register[$input] . '" />'; } $content .= '</td></tr>'; } $content .= '</tbody> </table> <input type="hidden" id="qem_register_sort" name="sort" value="' . $register['sort'] . '" /> <table> <td colspan="3"><h2>' . __('Show box for more names', 'quick-event-manager') . '</h2></td> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="usemorenames" ' . $register['usemorenames'] . ' value="checked" /></td> <td colspan="2">' . __('Show box to add more names if number attending is greater than 1') . '</td> </tr> <tr> <td></td> <td>' . __('More names label', 'quick-event-manager') . '</td> <td><input type="text" style="" name="morenames" value="' . $register['morenames'] . '" /></td> </tr> <tr> <td colspan="3"><h2>' . __('Terms and Conditions', 'quick-event-manager') . '</h2></td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="useterms" ' . $register['useterms'] . ' value="checked" /> </td> <td colspan="2">' . __('Include Terms and Conditions checkbox') . '</td> </tr> <tr> <td></td> <td>' . __('T&C label', 'quick-event-manager') . '</td> <td><input type="text" style="" name="termslabel" value="' . $register['termslabel'] . '" /></td> </tr> <tr> <td></td> <td>' . __('T&C URL', 'quick-event-manager') . '</td> <td><input type="text" style="" name="termsurl" value="' . $register['termsurl'] . '" /></td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="termstarget" ' . $register['termstarget'] . ' value="checked" /></td> <td colspan="2">' . __('Open link in new Tab/Window') . '</td> </tr> <tr> <td colspan="3"><h2>' . __('Error and Thank-you messages', 'quick-event-manager') . '</h2></td> </tr> <tr> <td colspan="2">' . __('Thank you message title', 'quick-event-manager') . '</td> <td><input type="text" style="" name="replytitle" value="' . $register['replytitle'] . '" /></td> </tr> <tr> <td colspan="2">' . __('Thank you message blurb', 'quick-event-manager') . '</td> <td><textarea style="width:100%;height:100px;" name="replyblurb">' . $register['replyblurb'] . '</textarea></td> </tr> <tr> <td colspan="2">' . __('Error Message', 'quick-event-manager') . '</td> <td><input type="text" style="" name="error" value="' . $register['error'] . '" /></td> </tr> <tr> <td colspan="2">' . __('Already Registered', 'quick-event-manager') . '</td> <td><input type="text" style="" name="alreadyregistered" value="' . $register['alreadyregistered'] . '" /></td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="checkremoval" ' . $register['checkremoval'] . ' value="checked" /></td> <td colspan="2">' . __('Use \'Not Attending\' option to allow people to remove their names from the list', 'quick-event-manager') . '</td> </tr> <tr> <td></td> <td>' . __('Name Removed Message', 'quick-event-manager') . '</td> <td><input type="text" style="" name="nameremoved" value="' . $register['nameremoved'] . '" /></td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="useread_more"' . $register['useread_more'] . ' value="checked" /></td> <td colspan="2">' . __('Display a \'return to event\' message after registration', 'quick-event-manager') . '</td> </tr> <tr> <td></td> <td>' . __('Return to event message:', 'quick-event-manager') . '</td> <td><input type="text" style="width:100%;" label="read_more" name="read_more" value="' . $register['read_more'] . '" /></td> </tr> <tr> <td colspan="3"><h2>' . __('Confirmation Email', 'quick-event-manager') . '</h2></td> </tr> <tr> <td colspan="3">You can reply to the sender using the <a href="?page=quick-event-manager/settings.php&tab=auto">Auto Responder</a>.</td> </tr> <tr> <td colspan="3"><h2>' . __('Show Attendees', 'quick-event-manager') . '</h2></td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="whoscoming" ' . $register['whoscoming'] . ' value="checked" /></td> <td colspan="2">' . __('List attendees', 'quick-event-manager') . '</td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="whosavatar" ' . $register['whosavatar'] . ' value="checked" /></td> <td colspan="2">' . __('Show avatars', 'quick-event-manager') . '</td> </tr> <tr> <td colspan="2">' . __('Message', 'quick-event-manager') . '</td> <td><input type="text" style="" name="whoscomingmessage" value="' . $register['whoscomingmessage'] . '" /></td> </tr> <tr> <td colspan="3"><h2>' . __('Places Available and Numbers Attending', 'quick-event-manager') . '</h2></td> </tr> <tr> <td colspan="3">' . __('Show how many places are left for an event', 'quick-event-manager') . '. ' . __('Set the number of places in the event editor', 'quick-event-manager') . '.</td> </tr> <tr> <td></td> <td>' . __('Message to display', 'quick-event-manager') . ':</td> <td><input type="text" style="width:40%;" name="placesbefore" value="' . $register['placesbefore'] . '" /> {number} <input type="text" style="width:40%;" name="placesafter" value="' . $register['placesafter'] . '" /> </td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="eventlist" ' . $register['eventlist'] . ' value="checked" /></td> <td colspan="2">' . __('Show places available on event list - this only works if you have selected \'Add an attendee counter to this form\' on the event editor.', 'quick-event-manager') . '</td> </tr> <tr> <td width="5%"><input type="checkbox" style="margin:0; padding: 0; border: none" name="numberattending" ' . $register['numberattending'] . ' value="checked" /></td> <td colspan="2">' . __('Show number of people attending.', 'quick-event-manager') . '</td> </tr> <tr> <td></td><td>' . __('Message to display', 'quick-event-manager') . ':</td> <td><input type="text" style="width:40%; " name="numberattendingbefore" value="' . $register['numberattendingbefore'] . '" /> {number} <input type="text" style="width:40%; " name="numberattendingafter" value="' . $register['numberattendingafter'] . '" /></td> </tr> </table> <p><input type="submit" name="Submit" class="button-primary" style="color: #FFF;" value="' . __('Save Changes', 'quick-event-manager') . '" /> <input type="submit" name="Reset" class="button-primary" style="color: #FFF;" value="' . __('Reset', 'quick-event-manager') . '" onclick="return window.confirm( \'' . __('Are you sure you want to reset the registration form?', 'quick-event-manager') . '\' );"/></p> <h2>' . __('Use Akismet Validation', 'quick-event-manager') . '</h2> <p>' . __('Enter your API Key to check all messages against the Akismet database.', 'quick-event-manager') . '</p> <p><input type="text" label="akismet" name="qem_apikey" value="' . $qem_apikey . '" /></p> <p><input type="submit" name="Validate" class="button-primary" style="color: #FFF;" value="Activate Akismet Validation" /> <input type="submit" name="Delete" class="button-secondary" value="Deactivate Aksimet Validation" onclick="return window.confirm( \'This will delete the Akismet Key.\\nAre you sure you want to do this?\' );"/></p>'; $content .= wp_nonce_field("save_qem"); $content .= '</form> </div> <div class="qem-options" style="float:right"> <h2>' . __('Example form', 'quick-event-manager') . '</h2> <p>' . __('This is an example of the form. When it appears on your site it will use your theme styles.', 'quick-event-manager') . '</p>'; $content .= qem_loop(); $content .= '</div></div>'; echo $content; }