function enlightenment_submit_button($args, $echo = true) { $defaults = array('name' => '', 'class' => 'button', 'id' => '', 'value' => ''); $args = wp_parse_args($args, $defaults); $args = apply_filters('enlightenment_submit_button_args', $args); $output = ''; $output .= '<input '; $output .= 'name="' . apply_filters('enlightenment_submit_button_name', esc_attr($args['name'])) . '"'; $output .= enlightenment_class($args['class']); $output .= enlightenment_id($args['id']) . ' '; $output .= 'value="' . esc_attr($args['value']) . '" '; $output .= 'type="submit" '; $output .= '/>'; $output = apply_filters('enlightenment_submit_button', $output, $args); if (!$echo) { return $output; } echo $output; }
function enlightenment_search_form($args = null) { $defaults = array('container_class' => 'form-search', 'container_id' => 'searchform', 'before' => '', 'after' => '', 'input_class' => 'search-query', 'input_id' => 's', 'placeholder' => __('Search this website', 'enlightenment'), 'submit_class' => '', 'submit_id' => 'searchsubmit', 'submit_extra_atts' => ' type="submit"', 'submit' => __('Search', 'enlightenment'), 'before_submit' => '', 'after_submit' => '', 'echo' => true); $defaults = apply_filters('enlightenment_search_form_args', $defaults); $args = wp_parse_args($args, $defaults); $output = enlightenment_open_tag('form', $args['container_class'], $args['container_id'], array('action' => home_url('/'), 'method' => 'get', 'role' => 'search')); $output .= $args['before']; $output .= '<input name="s"' . enlightenment_class($args['input_class']) . enlightenment_id($args['input_id']) . ' type="text" value="' . get_search_query() . '"' . (!empty($args['placeholder']) ? ' placeholder="' . esc_attr($args['placeholder']) . '"' : '') . ' />'; $output .= $args['before_submit']; $output .= enlightenment_open_tag('button', $args['submit_class'], $args['submit_id'], $args['submit_extra_atts']); $output .= strip_tags($args['submit'], '<span><i>'); $output .= enlightenment_close_tag('button'); $output .= $args['after_submit']; $output .= $args['after']; $output .= enlightenment_close_tag('form'); $output = apply_filters('enlightenment_search_form', $output, $args); if (!$args['echo']) { return $output; } echo $output; }
function enlightenment_comment_form_defaults($defaults) { $args = array('container' => 'p', 'container_class' => 'comment-form-comment', 'label_class' => '', 'textarea_class' => '', 'textarea_id' => 'comment', 'cols' => 45, 'rows' => 8, 'before_label' => '', 'after_label' => ''); $args = apply_filters('enlightenment_comment_form_defaults_args', $args); $defaults['comment_field'] = enlightenment_open_tag($args['container'], $args['container_class']) . '<label' . ('' != $args['textarea_id'] ? ' for="' . $args['textarea_id'] . '"' : '') . enlightenment_class($args['label_class']) . '>' . $args['before_label'] . _x('Comment', 'noun', 'enlightenment') . '</label>' . '<textarea' . enlightenment_id($args['textarea_id']) . enlightenment_class($args['textarea_class']) . ' name="comment" cols="' . intval($args['cols']) . '" rows="' . intval($args['rows']) . '" aria-required="true"></textarea>' . enlightenment_close_tag($args['container']); return $defaults; }