/** * Shows the message field. * * The function echoes the textarea where the user * may input the ticket description. The field can be * either a textarea or a WYSIWYG depending on the plugin settings. * The WYSIWYG editor uses TinyMCE with a minimal configuration. * * @since 3.0.0 * @param array $editor_args Arguments used for TinyMCE * @return void */ function wpas_get_message_textarea($editor_args = array()) { /** * Check if the description field should use the WYSIWYG editor * * @var string */ $textarea_class = true === ($wysiwyg = boolval(wpas_get_option('frontend_wysiwyg_editor'))) ? 'wpas-wysiwyg' : 'wpas-textarea'; if (true === $wysiwyg) { $editor_defaults = apply_filters('wpas_ticket_editor_args', array('media_buttons' => false, 'textarea_name' => 'wpas_message', 'textarea_rows' => 10, 'tabindex' => 2, 'editor_class' => wpas_get_field_class('wpas_message', $textarea_class, false), 'quicktags' => false, 'tinymce' => array('toolbar1' => 'bold,italic,underline,strikethrough,hr,|,bullist,numlist,|,link,unlink', 'toolbar2' => ''))); ?> <div class="wpas-submit-ticket-wysiwyg"><?php wp_editor(wpas_get_field_value('wpas_message'), 'wpas-ticket-message', apply_filters('wpas_reply_wysiwyg_args', $editor_defaults)); ?> </div><?php } else { /** * Define if the body can be submitted empty or not. * * @since 3.0.0 * @var boolean */ $can_submit_empty = apply_filters('wpas_can_message_be_empty', false); ?> <div class="wpas-submit-ticket-wysiwyg"> <textarea <?php wpas_get_field_class('wpas_message', $textarea_class); ?> id="wpas-ticket-message" name="wpas_message" placeholder="<?php echo apply_filters('wpas_form_field_placeholder_wpas_message', __('Describe your problem as accurately as possible', 'wpas')); ?> " rows="10" <?php if (false === $can_submit_empty) { ?> required="required"<?php } ?> ><?php echo wpas_get_field_value('wpas_message'); ?> </textarea> </div> <?php } }
" name="email" value="<?php echo wpas_get_registration_field_value('email'); ?> " required> <small class="wpas-help-block" id="email-validation" style="display: none;"></small> </div> <div <?php wpas_get_field_container_class('pwd'); ?> > <label><?php _e('Enter a password', 'wpas'); ?> </label> <input <?php wpas_get_field_class('pwd', 'wpas-pwd'); ?> type="password" placeholder="<?php _e('Password'); ?> " id="password" name="pwd" required> </div> <div class="wpas-checkbox"> <label><input type="checkbox" name="pwdshow" id="pwdshow" class="wpas-form-control-checkbox"> <?php echo _x('Show Password', 'Login form', 'wpas'); ?> </label> </div> <?php /**
* * @since 3.0.0 */ do_action('wpas_submission_form_inside_before_subject'); ?> <div <?php wpas_get_field_container_class('wpas_title'); ?> > <label><?php _e('Subject', 'wpas'); ?> </label> <input name="wpas_title" type="text" <?php wpas_get_field_class('wpas_title'); ?> value="<?php echo wpas_get_field_value('wpas_title', true); ?> " placeholder="<?php echo apply_filters('wpas_form_field_placeholder_wpas_title', __('What is this about?', 'wpas')); ?> " required> </div> <?php /** * The wpas_submission_form_inside_after_subject hook has to be placed * right after the subject field. *
/** * "Fake" taxonomy select. * * @param array $field Field options * @since 3.0.0 */ public static function taxonomy($field) { global $post; $field_id = 'wpas_' . $field['name']; $label = wpas_get_field_title($field); $current = get_the_terms($post->ID, sanitize_text_field($field['name'])); $terms = get_terms(sanitize_text_field($field['name']), array('hide_empty' => 0)); $value = ''; $ordered_terms = array(); if (is_array($current)) { foreach ($current as $term) { $value = $term->slug; } } /* In case the taxonomy does not exist */ if (is_wp_error($terms)) { return; } /** * Re-order the terms hierarchically. */ wpas_sort_terms_hierarchicaly($terms, $ordered_terms); ?> <div <?php wpas_get_field_container_class($field_id); ?> id="<?php echo $field_id; ?> _container"> <label for="<?php echo $field_id; ?> "><strong><?php echo $label; ?> </strong></label> <?php if (!is_admin() || current_user_can($field['args']['capability'])) { ?> <select name="<?php echo $field_id; ?> " id="<?php echo $field_id; ?> " <?php wpas_get_field_class($field_id); ?> > <option value=""><?php _e('Please select', 'wpas'); ?> </option> <?php foreach ($ordered_terms as $term) { wpas_hierarchical_taxonomy_dropdown_options($term, $value); } ?> </select> <?php } else { ?> <p id="<?php echo $field_id; ?> "><?php echo $value; ?> </p> <?php } if (isset($field['args']['desc']) && '' != $field['args']['desc'] && WPAS_FIELDS_DESC) { ?> <p class="<?php echo is_admin() ? 'description' : 'wpas-help-block'; ?> "><?php echo wp_kses($field['args']['desc']); ?> </p><?php } ?> </div> <?php }