Advertisement
eventsmanager

(captcha) custom event-editor.php

Jul 23rd, 2013
597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.30 KB | None | 0 0
  1. <?php
  2. /* WARNING! This file may change in the near future as we intend to add features to the event editor. If at all possible, try making customizations using CSS, jQuery, or using our hooks and filters. - 2012-02-14 */
  3. /*
  4. * To ensure compatability, it is recommended you maintain class, id and form name attributes, unless you now what you're doing.
  5. * You also must keep the _wpnonce hidden field in this form too.
  6. */
  7. global $EM_Event, $EM_Notices, $bp;
  8.  
  9. //check that user can access this page
  10. if( is_object($EM_Event) && !$EM_Event->can_manage('edit_events','edit_others_events') ){
  11. ?>
  12. <div class="wrap"><h2><?php _e('Unauthorized Access','dbem'); ?></h2><p><?php echo sprintf(__('You do not have the rights to manage this %s.','dbem'),__('Event','dbem')); ?></p></div>
  13. <?php
  14. return false;
  15. }elseif( !is_object($EM_Event) ){
  16. $EM_Event = new EM_Event();
  17. }
  18. $required = '*';
  19.  
  20. echo $EM_Notices;
  21. //Success notice
  22. if( !empty($_REQUEST['success']) ){
  23. if(!get_option('dbem_events_form_reshow')) return false;
  24. }
  25. ?>
  26. <form enctype='multipart/form-data' id="event-form" method="post" action="<?php echo add_query_arg(array('success'=>null)); ?>">
  27. <div class="wrap">
  28. <?php do_action('em_front_event_form_header'); ?>
  29. <?php if(get_option('dbem_events_anonymous_submissions') && !is_user_logged_in()): ?>
  30. <h3 class="event-form-submitter"><?php _e ( 'Your Details', 'dbem' ); ?></h3>
  31. <div class="inside event-form-submitter">
  32. <p>
  33. <label><?php _e('Name', 'dbem'); ?></label>
  34. <input type="text" name="event_owner_name" id="event-owner-name" value="<?php echo esc_attr($EM_Event->event_owner_name); ?>" />
  35. </p>
  36. <p>
  37. <label><?php _e('Email', 'dbem'); ?></label>
  38. <input type="text" name="event_owner_email" id="event-owner-email" value="<?php echo esc_attr($EM_Event->event_owner_email); ?>" />
  39. </p>
  40. <?php do_action('em_font_event_form_guest'); ?>
  41. </div>
  42. <?php endif; ?>
  43. <h3 class="event-form-name"><?php _e ( 'Event Name', 'dbem' ); ?></h3>
  44. <div class="inside event-form-name">
  45. <input type="text" name="event_name" id="event-name" value="<?php echo esc_attr($EM_Event->event_name,ENT_QUOTES); ?>" /><?php echo $required; ?>
  46. <br />
  47. <?php _e ( 'The event name. Example: Birthday party', 'dbem' )?>
  48. <?php em_locate_template('forms/event/group.php',true); ?>
  49. </div>
  50.  
  51. <h3 class="event-form-when"><?php _e ( 'When', 'dbem' ); ?></h3>
  52. <div class="inside event-form-when">
  53. <?php
  54. if( empty($EM_Event->event_id) && $EM_Event->can_manage('edit_recurring_events','edit_others_recurring_events') && get_option('dbem_recurrence_enabled') ){
  55. em_locate_template('forms/event/when-with-recurring.php',true);
  56. }elseif( $EM_Event->is_recurring() ){
  57. em_locate_template('forms/event/recurring-when.php',true);
  58. }else{
  59. em_locate_template('forms/event/when.php',true);
  60. }
  61. ?>
  62. </div>
  63.  
  64. <?php if( get_option('dbem_locations_enabled') ): ?>
  65. <h3 class="event-form-where"><?php _e ( 'Where', 'dbem' ); ?></h3>
  66. <div class="inside event-form-where">
  67. <?php em_locate_template('forms/event/location.php',true); ?>
  68. </div>
  69. <?php endif; ?>
  70.  
  71. <h3 class="event-form-details"><?php _e ( 'Details', 'dbem' ); ?></h3>
  72. <div class="inside event-form-details">
  73. <div class="event-editor">
  74. <?php if( get_option('dbem_events_form_editor') && function_exists('wp_editor') ): ?>
  75. <?php wp_editor($EM_Event->post_content, 'em-editor-content', array('textarea_name'=>'content') ); ?>
  76. <?php else: ?>
  77. <textarea name="content" rows="10" style="width:100%"><?php echo $EM_Event->post_content ?></textarea>
  78. <br />
  79. <?php _e ( 'Details about the event.', 'dbem' )?> <?php _e ( 'HTML allowed.', 'dbem' )?>
  80. <?php endif; ?>
  81. </div>
  82. <div class="event-extra-details">
  83. <?php if(get_option('dbem_attributes_enabled')) { em_locate_template('forms/event/attributes-public.php',true); } ?>
  84. <?php if(get_option('dbem_categories_enabled')) { em_locate_template('forms/event/categories-public.php',true); } ?>
  85. </div>
  86. </div>
  87.  
  88. <?php if( $EM_Event->can_manage('upload_event_images','upload_event_images') ): ?>
  89. <h3><?php _e ( 'Event Image', 'dbem' ); ?></h3>
  90. <div class="inside event-form-image">
  91. <?php em_locate_template('forms/event/featured-image-public.php',true); ?>
  92. </div>
  93. <?php endif; ?>
  94.  
  95. <?php if( get_option('dbem_rsvp_enabled') && $EM_Event->can_manage('manage_bookings','manage_others_bookings') ) : ?>
  96. <!-- START Bookings -->
  97. <h3><?php _e('Bookings/Registration','dbem'); ?></h3>
  98. <div class="inside event-form-bookings">
  99. <?php em_locate_template('forms/event/bookings.php',true); ?>
  100. </div>
  101. <!-- END Bookings -->
  102. <?php endif; ?>
  103.  
  104. <?php do_action('em_front_event_form_footer'); ?>
  105. </div>
  106.  
  107. <?php if ( !is_user_logged_in() ){ ?>
  108. <?php
  109. $captcha_instance = new ReallySimpleCaptcha();
  110. $captcha_instance->chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
  111. $captcha_instance->char_length = '4';
  112. // Width/Height dimensions of CAPTCHA image.
  113. $captcha_instance->img_size = array( '72', '24' );
  114. // Font color of CAPTCHA characters, in RGB (0 - 255).
  115. $captcha_instance->fg = array( '0', '0', '0' );
  116. // Background color of CAPTCHA image, in RGB (0 - 255).
  117. $captcha_instance->bg = array( '255', '255', '255' );
  118. // Font Size of CAPTCHA characters.
  119. $captcha_instance->font_size = '16';
  120. // Width between CAPTCHA characters.
  121. $captcha_instance->font_char_width = '15';
  122. // CAPTCHA image type. Can be 'png', 'jpeg', or 'gif'
  123. $captcha_instance->img_type = 'png';
  124. $captcha_instance_word = $captcha_instance->generate_random_word();
  125. $captcha_instance_prefix = mt_rand();
  126. $captcha_instance_image_name = $captcha_instance->generate_image($captcha_instance_prefix, $captcha_instance_word);
  127. $captcha_instance_image_url = get_bloginfo('wpurl') . '/wp-content/plugins/really-simple-captcha/tmp/';
  128. $captcha_instance_image_src = $captcha_instance_image_url.$captcha_instance_image_name;
  129. $captcha_instance_image_width = $captcha_instance->img_size[0];
  130. $captcha_instance_image_height = $captcha_instance->img_size[1];
  131. $captcha_instance_field_size = $captcha_instance->char_length;
  132. $captcha_instance_form_label = 'Anti-Spam:';
  133. ?>
  134. <p class="comment-form-captcha">
  135. <img src="<?php echo $captcha_instance_image_src; ?>" alt="captcha" width="<?php echo $captcha_instance_image_width; ?>" height="<?php echo $captcha_instance_image_height; ?>" />
  136. <label for="captcha_code"><?php echo $captcha_instance_form_label; ?></label>
  137. <input id="captcha_instance_code" name="captcha_instance_code" size="<?php echo $captcha_instance_field_size; ?>" type="text" />
  138. <input id="captcha_instance_prefix" name="captcha_instance_prefix" type="hidden" value="<?php echo $captcha_instance_prefix; ?>" />
  139. </p>
  140. <?php } ?>
  141.  
  142. <p class="submit">
  143. <input type="submit" name="events_update" value="<?php _e ( 'Submit Event', 'dbem' ); ?> &raquo;" />
  144. </p>
  145. <input type="hidden" name="event_id" value="<?php echo $EM_Event->event_id; ?>" />
  146. <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('wpnonce_event_save'); ?>" />
  147. <input type="hidden" name="action" value="event_save" />
  148. <?php if( !empty($_REQUEST['redirect_to']) ): ?>
  149. <input type="hidden" name="redirect_to" value="<?php echo esc_attr($_REQUEST['redirect_to']); ?>" />
  150. <?php endif; ?>
  151. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement