public function fields()
 {
     global $post;
     comment_id_fields($this->post_id);
     do_action('comment_form', $post->ID);
 }
Beispiel #2
0
/**
 * Generates the legacy comment form
 *
 * We removed the functionality because WordPress supplies its own function comment_form()
 *
 * @deprecated 1.0.2.3
 */
function thematic_legacy_comment_form()
{
    _deprecated_function(__FUNCTION__, '1.0.2.3', 'comment_form( thematic_comment_form_args() )');
    $user = wp_get_current_user();
    $user_ID = !is_wp_error($user) ? $user->ID : FALSE;
    ?>
			
	<div id="respond">
	
 		<h3><?php 
    comment_form_title(thematic_postcomment_text(), thematic_postreply_text());
    ?>
</h3>
 		<div id="cancel-comment-reply"><?php 
    cancel_comment_reply_link();
    ?>
</div>
		
		<?php 
    if (get_option('comment_registration') && !$user_ID) {
        ?>
		
			<p id="login-req"><?php 
        printf(__('You must be %1$slogged in%2$s to post a comment.', 'thematic'), sprintf('<a href="%s" title ="%s">', wp_login_url(apply_filters('the_permalink', get_permalink())), esc_attr__('Log in', 'thematic')), '</a>');
        ?>
</p>
			
		<?php 
    } else {
        ?>
		
			<div class="formcontainer">	
				<?php 
        // action hook for inserting content above #commentform
        thematic_abovecommentsform();
        ?>
					
	
				<form id="commentform" action="<?php 
        echo site_url('/wp-comments-post.php');
        ?>
" method="post">
				
				<?php 
        if ($user_ID) {
            ?>
					<p id="login"><span class="loggedin"><?php 
            _e('Logged in as', 'thematic') . printf(' <a href="%1$s" title="%2$s">%3$s</a>', admin_url('profile.php'), sprintf(esc_attr__('Logged in as %s', 'thematic'), $user_identity), $user_identity);
            ?>
</span> <span class="logout"><?php 
            printf('<a href="%s" title="%s">%s</a>', esc_attr(wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))), esc_attr__('Log out of this account', 'thematic'), __('Log out?', 'thematic'));
            ?>
</span>
					</p>
	
				<?php 
        } else {
            ?>

					<p id="comment-notes"><?php 
            printf(_x('Your email is %1$snever%2$s published nor shared.', '%$1s and %$2s are <em> tags for emphasis on never', 'thematic'), '<em>', '</em>');
            ?>
</p>
	
                    <div id="form-section-author" class="form-section">
						<div class="form-label"><label for="author"><?php 
            _e('Name', 'thematic');
            ?>
</label> <?php 
            if ($req) {
                _e('<span class="required">*</span>', 'thematic');
            }
            ?>
</div>
						<div class="form-input"><input id="author" name="author" type="text" value="<?php 
            echo $comment_author;
            ?>
" size="30" maxlength="20" tabindex="3" /></div>
                    </div><!-- #form-section-author .form-section -->
	
                    <div id="form-section-email" class="form-section">
						<div class="form-label"><label for="email"><?php 
            _e('Email', 'thematic');
            ?>
</label> <?php 
            if ($req) {
                _e('<span class="required">*</span>', 'thematic');
            }
            ?>
</div>
						<div class="form-input"><input id="email" name="email" type="text" value="<?php 
            echo $comment_author_email;
            ?>
" size="30" maxlength="50" tabindex="4" /></div>
                    </div><!-- #form-section-email .form-section -->
	
                    <div id="form-section-url" class="form-section">
						<div class="form-label"><label for="url"><?php 
            _e('Website', 'thematic');
            ?>
</label></div>
						<div class="form-input"><input id="url" name="url" type="text" value="<?php 
            echo $comment_author_url;
            ?>
" size="30" maxlength="50" tabindex="5" /></div>
	                </div><!-- #form-section-url .form-section -->
	
				<?php 
        }
        ?>
	
	            <div id="form-section-comment" class="form-section">
					<div class="form-label"><label for="comment"><?php 
        _e(thematic_commentbox_text(), 'thematic');
        ?>
</label></div>
	    			<div class="form-textarea"><textarea id="comment" name="comment" cols="45" rows="8" tabindex="6"></textarea></div>
	            </div><!-- #form-section-comment .form-section -->
	                            
                <div id="form-allowed-tags" class="form-section">
                    <p><span><?php 
        printf(_x('You may use these %1$sHTML%2$s tags and attributes', '%$1s and %$2s are <abbr> tags', 'thematic'), '<abbr title="HyperText Markup Language">', '</abbr>');
        ?>
</span> <code><?php 
        echo allowed_tags();
        ?>
</code></p>
                </div>
								
       			<?php 
        do_action('comment_form', $post->ID);
        ?>
	                  
				<div class="form-submit"><input id="submit" name="submit" type="submit" value="<?php 
        echo thematic_commentbutton_text();
        ?>
" tabindex="7" /><input type="hidden" name="comment_post_ID" value="<?php 
        echo $id;
        ?>
" /></div>
	
                <?php 
        comment_id_fields();
        ?>
    
	
			</form><!-- #commentform -->
	
			<?php 
        // action hook for inserting content below #commentform
        thematic_belowcommentsform();
        ?>
	
		</div><!-- .formcontainer -->
		<?php 
    }
    ?>
		
	</div><!-- #respond -->
	
<?php 
}
/**
 * Outputs a complete commenting form for use within a template.
 * Most strings and form fields may be controlled through the $args array passed
 * into the function, while you may also choose to use the comment_form_default_fields
 * filter to modify the array of default fields if you'd just like to add a new
 * one or remove a single field. All fields are also individually passed through
 * a filter of the form comment_form_field_$name where $name is the key used
 * in the array of fields.
 *
 * @since 3.0.0
 * @param array $args Options for strings, fields etc in the form
 * @param mixed $post_id Post ID to generate the form for, uses the current post if null
 * @return void
 */
function comment_form($args = array(), $post_id = null)
{
    global $id;
    global $txt_privacy_stat;
    global $txt_compat_rat;
    global $txt_use_tags;
    global $txt_logged_in_as;
    global $txt_logout;
    global $txt_send_comment;
    global $txt_cancel_reply;
    global $txt_reply_to;
    global $txt_comments;
    global $txt_comment;
    global $txt_to_comment;
    global $txt_website;
    global $txt_att_filetypes;
    global $txt_att_maxsize;
    global $txt_att_attachment;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = !empty($user->ID) ? $user->display_name : '';
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __('Email') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></p>', 'url' => '<!-- p class="comment-form-url"><label for="url">' . __($txt_website) . '</label>' . '<input id="url" name="url" type="text" value="" size="30" /></p -->');
    // original version
    //	'url'    => '<p class="comment-form-url"><label for="url">' . __( $txt_website ) . '</label>' .
    //	            '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p >',
    $required_text = sprintf(' ' . __('Required fields are marked %s'), '<span class="required">*</span>');
    //rating image
    ob_start();
    //if(function_exists('the_ratings'))
    //{
    $returnval .= the_ratings();
    //}
    $out1 = ob_get_contents();
    ob_end_clean();
    if ($out1 == "") {
        $out1 = "Error: No rating found";
    }
    $lhg_rating_line = "";
    if (is_single()) {
        $lhg_rating_line = '
        <div style="border: 0px solid #000;">
          <div style="width: 145px; float: left; margin-right: 5px; font:normal 11px Arial, Helvetica, sans-serif;">' . $txt_compat_rat . '
          </div>

          <div style="border: 1px solid #d0d0d0; float: left; background-color: #f6f6f6; padding: 5px;">' . $out1 . '
          </div>
        </div>
        <br />
        <br />
        ';
    }
    // original line
    //'comment_field'        => '<div style="border: 0px solid #000;"><div style="width: 145px; float: left; margin-right: 5px; font:normal 11px Arial, Helvetica, sans-serif;">'.$txt_compat_rat.'</div><div style="border: 1px solid #d0d0d0; float: left; background-color: #f6f6f6; padding: 5px;">'.$out1.'</div></div> <br><br><p class="comment-form-comment"><label for="comment">' . _x( $txt_to_comment, 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
    $tmp1 = $lhg_rating_line . '<p class="comment-form-comment"><label for="comment">' . _x($txt_to_comment, 'noun') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>';
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => sprintf($tmp1), 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__($txt_logged_in_as . ' <a href="%1$s">%2$s</a>. <a href="%3$s" title="Abmelden">' . $txt_logout . '?</a>'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __($txt_privacy_stat) . ($req ? $required_text : '') . '</p>', 'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf(__($txt_use_tags . ': %s'), ' <code>' . allowed_tags() . '</code>') . '</p>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __("{$txt_comment} "), 'title_reply_to' => __($txt_reply_to . ' %s'), 'cancel_reply_link' => __($txt_cancel_reply), 'label_submit' => __($txt_send_comment));
    // 'comment_field'        => $lhg_rating_line . '<p class="comment-form-comment"><label for="comment">' . _x( $txt_to_comment, 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    ?>
		<?php 
    if (comments_open()) {
        ?>
			<?php 
        do_action('comment_form_before');
        ?>
			<div id="respond">
				<?php 
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        ?>
 <small><?php 
        cancel_comment_reply_link($args['cancel_reply_link']);
        ?>
</small>
				<?php 
        if (get_option('comment_registration') && !is_user_logged_in()) {
            ?>
					<?php 
            echo $args['must_log_in'];
            ?>
					<?php 
            do_action('comment_form_must_log_in_after');
            ?>
				<?php 
        } else {
            ?>
					<form action="<?php 
            echo site_url('/wp-comments-post.php');
            ?>
" method="post" enctype="multipart/form-data" id="<?php 
            echo esc_attr($args['id_form']);
            ?>
">
						<?php 
            do_action('comment_form_top');
            ?>
						<?php 
            if (is_user_logged_in()) {
                ?>
							<?php 
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                ?>
							<?php 
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
                ?>
						<?php 
            } else {
                ?>
							<?php 
                echo $args['comment_notes_before'];
                ?>
							<?php 
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                }
                do_action('comment_form_after_fields');
                ?>
						<?php 
            }
            ?>
						<?php 
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            ?>
						<?php 
            echo $args['comment_notes_after'];
            ?>

						<?php 
            global $ATT_MAX;
            //$required = ATT_REQ ? ' <span class="required">*</span>' : '';
            global $region;
            if ($ATT_MAX == "") {
                $ATT_MAX = 2;
            }
            #if ($region != "de")
            echo '
                                                        <p class="comment-form-url comment-form-attachment">

                                                            <label for="attachment">' . $txt_att_attachment . '</label>
					                    <input id="attachment" name="attachment" type="file" /><br />
                                                            <span style="margin-left:150px;">
                                                               ' . $txt_att_filetypes . ': <strong>txt, jpg, png, gif</strong>, ' . $txt_att_maxsize . ': ' . $ATT_MAX . 'MB.
                                                            </span>
                                                        </p>';
            ?>

						<p class="form-submit">
							<button name="submit_comments" type="submit" value="<?php 
            echo esc_attr($args['label_submit']);
            ?>
" ><?php 
            echo esc_attr($args['label_submit']) . '&nbsp;<i class="icon-arrow-right icon-button"></i>';
            ?>
</button>
							<?php 
            comment_id_fields($post_id);
            ?>
						</p>
						<?php 
            do_action('comment_form', $post_id);
            ?>
					</form>
				<?php 
        }
        ?>
			</div><!-- #respond -->
			<?php 
        do_action('comment_form_after');
        ?>
		<?php 
    } else {
        ?>
			<?php 
        do_action('comment_form_comments_closed');
        ?>
		<?php 
    }
    ?>
	<?php 
}
Beispiel #4
0
    function wp_comment_form($args = array(), $post_id = null)
    {
        global $user_identity, $id;
        if (null === $post_id) {
            $post_id = $id;
        } else {
            $id = $post_id;
        }
        $commenter = wp_get_current_commenter();
        $req = get_option('require_name_email');
        $aria_req = $req ? " aria-required='true'" : '';
        $defaut = array('comment_author' => __('Name*', 'wpdance'), 'comment_author_email' => __('Email*', 'wpdance'), 'comment_author_url' => __('Website', 'wpdance'));
        extract($defaut, EXTR_OVERWRITE);
        extract(array_filter(array('comment_author' => esc_attr($commenter['comment_author']), 'comment_author_email' => esc_attr($commenter['comment_author_email']), 'comment_author_url' => esc_attr($commenter['comment_author_url']))), EXTR_OVERWRITE);
        $fields = array('author' => '<span class="label">Your name:</span><p class="comment-form-author">' . '<input id="author" class="input-text" name="author" type="text" value="' . $comment_author . '" defaultvalue="' . $defaut['comment_author'] . '" size="30"' . $aria_req . ' />' . '</p>', 'email' => '<span class="label">Your email address:</span><p class="comment-form-email"><input id="email" class="input-text" name="email" type="text" value="' . $comment_author_email . '" size="30"' . $aria_req . ' defaultvalue="' . $defaut['comment_author_email'] . '"/>' . '</p>');
        $required_text = sprintf(' ' . __('Required fields are marked %s', 'wpdance'), '<span class="required">*</span>');
        $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<span class="label">Your message:</span><p class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'wpdance'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'wpdance'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '', 'comment_notes_after' => '', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('WRITE YOUR COMMENT', 'wpdance'), 'title_reply_to' => __('Leave a Reply to %s', 'wpdance'), 'cancel_reply_link' => __('Cancel reply', 'wpdance'), 'label_submit' => __('Submit Comment', 'wpdance'));
        $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
        ?>
			<?php 
        if (comments_open()) {
            ?>
				<?php 
            do_action('comment_form_before');
            ?>
				<div id="respond">
					<h3 id="reply-title" class="title-box"><?php 
            comment_form_title($args['title_reply'], $args['title_reply_to']);
            ?>
 <small><?php 
            cancel_comment_reply_link($args['cancel_reply_link']);
            ?>
</small></h3>
					<?php 
            if (get_option('comment_registration') && !is_user_logged_in()) {
                ?>
						<?php 
                echo $args['must_log_in'];
                ?>
						<?php 
                do_action('comment_form_must_log_in_after');
                ?>
					<?php 
            } else {
                ?>
						<form action="<?php 
                echo site_url('/wp-comments-post.php');
                ?>
" method="post" id="<?php 
                echo esc_attr($args['id_form']);
                ?>
">
							<?php 
                do_action('comment_form_top');
                ?>
							<?php 
                if (is_user_logged_in()) {
                    ?>
								<?php 
                    echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                    ?>
								<?php 
                    do_action('comment_form_logged_in_after', $commenter, $user_identity);
                    ?>
							<?php 
                } else {
                    ?>
								<?php 
                    echo $args['comment_notes_before'];
                    ?>
								<?php 
                    do_action('comment_form_before_fields');
                    foreach ((array) $args['fields'] as $name => $field) {
                        echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                    }
                    ?>
							<?php 
                }
                ?>
							<?php 
                echo apply_filters('comment_form_field_comment', $args['comment_field']);
                ?>
							<?php 
                echo $args['comment_notes_after'];
                ?>
							<?php 
                if (!is_user_logged_in()) {
                    do_action('comment_form_after_fields');
                }
                ?>
							<p class="form-submit">
								<button class="button" type="submit" id="<?php 
                echo esc_attr($args['id_submit']);
                ?>
"><span><span><?php 
                echo esc_attr($args['label_submit']);
                ?>
</span></span></button>

								<?php 
                comment_id_fields($post_id);
                ?>
							</p>
							<?php 
                do_action('comment_form', $post_id);
                ?>
						</form>
					<?php 
            }
            ?>
				</div><!-- #respond -->
				<?php 
            do_action('comment_form_after');
            ?>
				<script type="text/javascript">
				//<![CDATA[
					jQuery('#commentform').find('input').focus(function() {
						if(jQuery(this).val() == jQuery(this).attr('defaultvalue'))
							jQuery(this).val('');
					}).blur(function() {
						if(jQuery(this).val() == '')
							jQuery(this).val(jQuery(this).attr('defaultvalue'));
					});
					jQuery('#commentform').submit(function() {
						jQuery(this).find('input').each(function(input){
							if(jQuery(this).val() == jQuery(this).attr('defaultvalue'))
								jQuery(this).val('');
						});	
						return true;
					});
				//]]>	
				</script>
			<?php 
        } else {
            ?>
				<?php 
            do_action('comment_form_comments_closed');
            ?>
			<?php 
        }
        ?>
		<?php 
    }
Beispiel #5
0
        }
        ?>
                                <div class="clear"></div>
                                <?php 
        echo apply_filters('comment_form_field_comment', $args['comment_field']);
        ?>
                                <div class="form-submit">
                                    <input name="submit" type="submit" id="submit" value="<?php 
        _e('Submit Comment', OP_P_SN);
        ?>
" class="silver-button" /> <p>* <?php 
        _e('Denotes Required Field', OP_P_SN);
        ?>
</p>
                                    <?php 
        comment_id_fields($post_id);
        ?>
                                </div>
                                <?php 
        do_action('comment_form', $post_id);
        ?>
                            </form>
                        <?php 
    }
    ?>
                    </div>
                    <?php 
} else {
    ?>
                        <?php 
    do_action('comment_form_comments_closed');
Beispiel #6
0
    function comment_form_tm($args = array(), $post_id = null)
    {
        if (null === $post_id) {
            $post_id = get_the_ID();
        } else {
            $id = $post_id;
        }
        $commenter = wp_get_current_commenter();
        $user = wp_get_current_user();
        $user_identity = $user->exists() ? $user->display_name : '';
        $args = wp_parse_args($args);
        if (!isset($args['format'])) {
            $args['format'] = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml';
        }
        $req = get_option('require_name_email');
        $aria_req = $req ? " aria-required='true'" : '';
        $html5 = 'html5' === $args['format'];
        $fields = array('author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name', 'cactusthemes') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __('Email', 'cactusthemes') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<input id="email" name="email" ' . ($html5 ? 'type="email"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></p>', 'url' => '<p class="comment-form-url"><label for="url">' . __('Website', 'cactusthemes') . '</label> ' . '<input id="url" name="url" ' . ($html5 ? 'type="url"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></p>');
        $required_text = sprintf(' ' . __('Required fields are marked %s', 'cactusthemes'), '<span class="required">*</span>');
        /**
         * Filter the default comment form fields.
         *
         * @since 3.0.0
         *
         * @param array $fields The default comment fields.
         */
        $fields = apply_filters('comment_form_default_fields', $fields);
        $defaults = array('fields' => $fields, 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Comment', 'cactusthemes') . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'cactusthemes'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'cactusthemes'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.', 'cactusthemes') . ($req ? $required_text : '') . '</p>', 'comment_notes_after' => '', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Leave a Reply', 'cactusthemes'), 'title_reply_to' => __('Leave a Reply to %s', 'cactusthemes'), 'cancel_reply_link' => __('Cancel reply', 'cactusthemes'), 'label_submit' => __('Submit &rsaquo;', 'cactusthemes'), 'format' => 'xhtml');
        /**
         * Filter the comment form default arguments.
         *
         * Use 'comment_form_default_fields' to filter the comment fields.
         *
         * @since 3.0.0
         *
         * @param array $defaults The default comment form arguments.
         */
        $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
        ?>
		<?php 
        if (comments_open($post_id)) {
            ?>
			<?php 
            /**
             * Fires before the comment form.
             *
             * @since 3.0.0
             */
            do_action('comment_form_before');
            ?>
            
            
			<div id="respond" class="comment-respond">
            
              <div class="author-current">
                  <?php 
            $user_ID = get_current_user_id();
            if (isset($_is_retina_) && $_is_retina_) {
                echo get_avatar($comment, 50, get_template_directory_uri() . '/images/avatar-2x.png');
            } else {
                echo get_avatar($user_ID, 50, get_template_directory_uri() . '/images/avatar.png');
            }
            ?>
              </div>

				<h3 id="reply-title" class="comment-reply-title"><?php 
            comment_form_title($args['title_reply'], $args['title_reply_to']);
            ?>
 <small><?php 
            cancel_comment_reply_link($args['cancel_reply_link']);
            ?>
</small></h3>
				<?php 
            if (get_option('comment_registration') && !is_user_logged_in()) {
                ?>
					<?php 
                echo $args['must_log_in'];
                ?>
					<?php 
                /**
                 * Fires after the HTML-formatted 'must log in after' message in the comment form.
                 *
                 * @since 3.0.0
                 */
                do_action('comment_form_must_log_in_after');
                ?>
				<?php 
            } else {
                ?>
					<form action="<?php 
                echo site_url('/wp-comments-post.php');
                ?>
" method="post" id="<?php 
                echo esc_attr($args['id_form']);
                ?>
" class="comment-form"<?php 
                echo $html5 ? ' novalidate' : '';
                ?>
>
						<?php 
                /**
                 * Fires at the top of the comment form, inside the <form> tag.
                 *
                 * @since 3.0.0
                 */
                do_action('comment_form_top');
                ?>
						<?php 
                if (is_user_logged_in()) {
                    ?>
							<?php 
                    /**
                     * Filter the 'logged in' message for the comment form for display.
                     *
                     * @since 3.0.0
                     *
                     * @param string $args['logged_in_as'] The logged-in-as HTML-formatted message.
                     * @param array  $commenter            An array containing the comment author's username, email, and URL.
                     * @param string $user_identity        If the commenter is a registered user, the display name, blank otherwise.
                     */
                    echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                    ?>
							<?php 
                    /**
                     * Fires after the is_user_logged_in() check in the comment form.
                     *
                     * @since 3.0.0
                     *
                     * @param array  $commenter     An array containing the comment author's username, email, and URL.
                     * @param string $user_identity If the commenter is a registered user, the display name, blank otherwise.
                     */
                    do_action('comment_form_logged_in_after', $commenter, $user_identity);
                    ?>
						<?php 
                } else {
                    ?>
							<?php 
                    echo $args['comment_notes_before'];
                    ?>
							<?php 
                    /**
                     * Fires before the comment fields in the comment form.
                     *
                     * @since 3.0.0
                     */
                    do_action('comment_form_before_fields');
                    /**
                     * Fires after the comment fields in the comment form.
                     *
                     * @since 3.0.0
                     */
                    do_action('comment_form_after_fields');
                    ?>
						<?php 
                }
                ?>
						<?php 
                /**
                 * Filter the content of the comment textarea field for display.
                 *
                 * @since 3.0.0
                 *
                 * @param string $args['comment_field'] The content of the comment textarea field.
                 */
                echo apply_filters('comment_form_field_comment', $args['comment_field']);
                ?>
						<?php 
                echo $args['comment_notes_after'];
                if (!is_user_logged_in()) {
                    foreach ((array) $args['fields'] as $name => $field) {
                        /**
                         * Filter a comment form field for display.
                         *
                         * The dynamic portion of the filter hook, $name, refers to the name
                         * of the comment form field. Such as 'author', 'email', or 'url'.
                         *
                         * @since 3.0.0
                         *
                         * @param string $field The HTML-formatted output of the comment form field.
                         */
                        echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                    }
                }
                ?>

						<p class="form-submit">
							<input name="submit" type="submit" id="<?php 
                echo esc_attr($args['id_submit']);
                ?>
" value="<?php 
                echo esc_attr($args['label_submit']);
                ?>
" />
							<?php 
                comment_id_fields($post_id);
                ?>
						</p>
						<?php 
                /**
                 * Fires at the bottom of the comment form, inside the closing </form> tag.
                 *
                 * @since 1.5.2
                 *
                 * @param int $post_id The post ID.
                 */
                do_action('comment_form', $post_id);
                ?>
					</form>
				<?php 
            }
            ?>
			</div><!-- #respond -->
			<?php 
            /**
             * Fires after the comment form.
             *
             * @since 3.0.0
             */
            do_action('comment_form_after');
        } else {
            /**
             * Fires after the comment form if comments are closed.
             *
             * @since 3.0.0
             */
            do_action('comment_form_comments_closed');
        }
    }
Beispiel #7
0
    <?php else : ?>

   	<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

	<?php if ( $user_ID ) : ?>
			
	<p class="logged">Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
			
	<?php else : ?>
			
	<p><input type="text" class="textfield" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /><label  class="textfield_label" for="author"><?php echo _e('Name *', 'epanel'); ?></label></p>
			
	<p><input type="text" class="textfield" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /><label class="textfield_label" for="email"><?php echo _e('Email *', 'epanel');?></label></p>
			
	<p><input type="text" class="textfield" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /><label  class="textfield_label" for="url"><?php echo _e('Website', 'epanel');?></label></p>
			
	<?php endif; ?>
			
	<p><textarea class="textarea" name="comment" id="comment" cols="70" rows="10" tabindex="4"></textarea></p>

	<p><input type="submit" class="button" value="<?php echo _e('Submit Comment', 'epanel');?>" /><?php comment_id_fields(); ?></p>
		    
	<?php do_action('comment_form', $post->ID); ?>
	
	</form>
	
<?php endif; ?>

</div><!--/respond-->

<?php endif; ?>
Beispiel #8
0
function cp_main_comment_form()
{
    global $post;
    ?>

    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    jQuery(document).ready(function($) {
        /* initialize the form validation */
        $(function() {
            $("#commentform").validate({
                errorClass: "invalid",
                errorElement: "div",
                errorPlacement: function(error, element) {
                    error.insertAfter(element);
                   }
            });
	    $("#commentform").fadeIn();
        });
        
    });
    //-->!]]>
    </script>

    <div id="respond">

        <h2 class="dotted"><?php 
    comment_form_title(__('Leave a Reply', APP_TD), __('Leave a Reply to %s', APP_TD));
    ?>
</h2>

        <div class="cancel-comment-reply">

                <small><?php 
    cancel_comment_reply_link();
    ?>
</small>

        </div>


        <?php 
    if (get_option('comment_registration') && !is_user_logged_in()) {
        ?>

            <p><?php 
        printf(__("You must be <a href='%s'>logged in</a> to post a comment.", APP_TD), wp_login_url(get_permalink()));
        ?>
</p>

        <?php 
    } else {
        ?>

            <form action="<?php 
        echo site_url('/wp-comments-post.php');
        ?>
" method="post" id="commentform" class="commentform">

								<?php 
        do_action('comment_form_top');
        ?>

                <fieldset class="form-comments">

                <?php 
        if (is_user_logged_in()) {
            global $user_identity;
            ?>

                    <p><?php 
            _e('Logged in as', APP_TD);
            ?>
 <a href="<?php 
            echo CP_PROFILE_URL;
            ?>
"><?php 
            echo $user_identity;
            ?>
</a>. <a href="<?php 
            echo cp_logout_url();
            ?>
" title="<?php 
            _e('Logout of this account', APP_TD);
            ?>
"><?php 
            _e('Logout', APP_TD);
            ?>
 &raquo;</a></p>

                <?php 
        } else {
            ?>
                
                    <?php 
            $commenter = wp_get_current_commenter();
            $req = get_option('require_name_email');
            ?>

                    <p class="comments">
                        <label for="author"><?php 
            _e('Name', APP_TD);
            ?>
 <?php 
            if ($req) {
                _e('(required)', APP_TD);
            }
            ?>
</label>
                        <input type="text" name="author" id="author" class="text required" value="<?php 
            echo esc_attr($commenter['comment_author']);
            ?>
" size="22" tabindex="1" />
                    </p>
    
                    <div class="clr"></div>
    
                    <p class="comments">
                        <label for="email"><?php 
            _e('Email (will not be visible)', APP_TD);
            ?>
 <?php 
            if ($req) {
                _e('(required)', APP_TD);
            }
            ?>
</label>
                        <input type="text" name="email" id="email" class="text required email" value="<?php 
            echo esc_attr($commenter['comment_author_email']);
            ?>
" size="22" tabindex="2" />                                
                    </p>
    
                    <div class="clr"></div>
    
                   <p class="comments">
                        <label for="url"><?php 
            _e('Website', APP_TD);
            ?>
</label>
                        <input type="text" name="url" id="url" class="text" value="<?php 
            echo esc_attr($commenter['comment_author_url']);
            ?>
" size="22" tabindex="3" />
                    </p>
    
                   <div class="clr"></div>

                <?php 
        }
        ?>
                
                <!--<li><small><strong>XHTML:</strong> You can use these tags: <?php 
        echo allowed_tags();
        ?>
</small><div class="clr"></div></li>-->

                <p class="comments-box">
                    <textarea name="comment" rows="" cols="" id="comment" class="required" tabindex="4"></textarea>
                </p>

                <div class="clr"></div>

                <p class="comments">
                    <input name="submit" type="submit" id="submit" tabindex="5" class="btn_orange" value="<?php 
        _e('Leave a Reply', APP_TD);
        ?>
" />
                    <input type="hidden" name="comment_post_ID" value="<?php 
        echo $post->ID;
        ?>
" />
                </p>

                <?php 
        comment_id_fields();
        ?>
                <?php 
        do_action('comment_form', $post->ID);
        ?>

                 </fieldset>
                
            </form>

        <?php 
    }
    // if logged in
    ?>

        <div class="clr"></div>

    </div> <!-- /respond -->

<?php 
}
Beispiel #9
0
/**
 * Outputs a complete ticket form for use within a template.
 * Most strings and form fields may be controlled through the $args array passed
 * into the function, while you may also choose to use the ticket_form_basic_fields,
 * ticket_form_advanced_fields, or ticket_form_meta_fields
 * filter to modify the array of default fields if you'd just like to add a new
 * one or remove a single field. All fields are also individually passed through
 * a filter of the form ticket_form_field_$name where $name is the key used
 * in the array of fields.
 *
 * @since Quality Control 0.1.5
 * @param array $args Options for strings, fields, etc in the form.
 * @param mixed $post_id Post ID to generate the form for, uses current post if null.
 * @return void
 */
function quality_ticket_form($args = array(), $post_id = null)
{
    global $post, $quality_options;
    $category = get_the_category($post->ID);
    $taglist = quality_get_ticket_tags($post->ID);
    if ($args['location'] == 'page') {
        $taglist = quality_form_data('ticket_tags');
    }
    $basic_fields = array('id' => 'ticket', 'label' => __('Basic Info', 'quality'), 'fields' => array('title' => '<p id="ticket-title">
								<label for="ticket_title">' . __('Title:', 'quality') . '</label>
								<input type="text" name="ticket_title" value="' . quality_form_data('ticket_title') . '" />
							</p>', 'tags' => '<p id="ticket-tags">
								<label for="ticket_tags">' . __('Tags: <em>(Optional)</em>', 'quality') . '</label>
								<input type="text" name="ticket_tags" value="' . $taglist . '" />
							</p>', 'comment' => '<p>
								<label for="comment">' . __('Description:', 'quality') . '</label>
								<textarea name="comment" id="comment"></textarea>
							</p>'));
    $advanced_fields = array('id' => 'ticket-properties', 'label' => __('Ticket Properties', 'quality'), 'fields' => array('ticket-status' => '<p id="ticket-status" class="inline-input">
										<label for="ticket_status">' . __('Status:', 'quality') . '</label>' . wp_dropdown_categories(array('name' => 'ticket_status', 'hide_empty' => 0, 'taxonomy' => 'ticket_status', 'hierarchical' => 1, 'selected' => $args['location'] == 'page' ? quality_form_data('ticket_status') ? quality_form_data('ticket_status') : $quality_options['default_status'] : quality_ticket_status($post->ID), 'echo' => 0)) . '
									</p>', 'ticket-milestone' => '<p id="ticket-milestone" class="inline-input">
										<label for="ticket_milestone">' . __('Milestone:', 'quality') . '</label>' . wp_dropdown_categories(array('name' => 'ticket_milestone', 'hide_empty' => 0, 'taxonomy' => 'ticket_milestone', 'hierarchical' => 1, 'selected' => $args['location'] == 'page' ? quality_form_data('ticket_milestone') : quality_ticket_status($post->ID, 'term_id', 'ticket_milestone'), 'echo' => 0)) . '
									</p>', 'ticket-category' => '<p id="ticket-category" class="inline-input">
										<label for="ticket_category">' . __('Category:', 'quality') . '</label>' . wp_dropdown_categories(array('name' => 'ticket_category', 'hide_empty' => 0, 'hierarchical' => 1, 'selected' => $args['location'] == 'page' ? quality_form_data('ticket_category') ? quality_form_data('ticket_category') : get_option('default_category') : $category[0]->cat_ID, 'echo' => 0)) . '
									</p>', 'ticket-assign' => '<p id="ticket-assign" class="inline-input">
										<label for="ticket_assign">' . __('Assigned To: <em>(Optional) Separated multiple usernames by comma. You are automatically assigned.</em>', 'quality') . '</label>
										<input type="text" name="ticket_assign" value="' . ($args['location'] == 'ticket' ? quality_get_ticket_assigned_to() : quality_form_data('ticket_assign')) . '" />
									</p>'));
    $meta_fields = array('id' => 'ticket-meta', 'label' => __('Other Options', 'quality'), 'fields' => array('ticket-attachment' => '<p id="ticket-attachment">
										<label for="ticket_attachment">' . __('Attach File', 'quality') . '</label>
										<input type="file" name="ticket_attachment" id="ticket_attachment"/>
									</p>'));
    $defaults = array('location' => 'page', 'basic_fields' => apply_filters('ticket_form_basic_fields', $basic_fields), 'advanced_fields' => apply_filters('ticket_form_advanced_fields', $advanced_fields), 'meta_fields' => apply_filters('ticket_form_meta_fields', $meta_fields), 'ticket_form_before' => '', 'ticket_form_after' => '', 'id_form' => 'ticket_form', 'id_submit' => 'submit', 'label_submit' => $args['location'] == 'page' ? __('Create Ticket', 'quality') : __('Update Ticket', 'quality'));
    $args = wp_parse_args($args, apply_filters('ticket_form_defaults', $defaults));
    if ($args['location'] == 'ticket') {
        unset($args['basic_fields']['fields']['title']);
        unset($args['advanced_fields']['fields']['ticket-cc']);
    }
    ?>

	<?php 
    do_action('ticket_form_before');
    ?>
	
	<form action="<?php 
    echo $args['location'] == 'page' ? '#respond' : site_url('wp-comments-post.php');
    ?>
" method="post" name="add-ticket" enctype="multipart/form-data" id="<?php 
    echo esc_attr($args['id_form']);
    ?>
">
	
		<?php 
    do_action('ticket_form_top');
    ?>
		
		<?php 
    do_action('ticket_form_before_fields');
    ?>
	
		<fieldset id="<?php 
    echo esc_attr($args['basic_fields']['id']);
    ?>
">
		
			<legend><?php 
    echo esc_attr($args['basic_fields']['label']);
    ?>
</legend>
		
			<?php 
    do_action('ticket_form_before_basic_fields');
    foreach ($args['basic_fields']['fields'] as $name => $field) {
        echo apply_filters("ticket_form_field_{$name}", $field) . "\n";
    }
    do_action('ticket_form_after_basic_fields');
    ?>
			
		</fieldset>
		
		<fieldset id="<?php 
    echo esc_attr($args['advanced_fields']['id']);
    ?>
">
			
			<legend><?php 
    echo esc_attr($args['advanced_fields']['label']);
    ?>
</legend>
		
			<?php 
    do_action('ticket_form_before_advanced_fields');
    foreach ($args['advanced_fields']['fields'] as $name => $field) {
        echo apply_filters("ticket_form_field_{$name}", $field) . "\n";
    }
    do_action('ticket_form_after_advanced_fields');
    ?>
		
		</fieldset>
		
		<fieldset id="<?php 
    echo esc_attr($args['meta_fields']['id']);
    ?>
">
			
			<legend><?php 
    echo esc_attr($args['meta_fields']['label']);
    ?>
</legend>
		
			<?php 
    do_action('ticket_form_before_meta_fields');
    foreach ($args['meta_fields']['fields'] as $name => $field) {
        echo apply_filters("ticket_form_field_{$name}", $field) . "\n";
    }
    do_action('ticket_form_after_meta_fields');
    ?>
		
		</fieldset>
		
		<?php 
    do_action('ticket_form_after_fields');
    ?>
		
		<p id="ticket-create">
		
			<?php 
    if ($args['location'] == 'page') {
        ?>
				<input type="hidden" name="create_ticket" value="proccess" />
			<?php 
    } else {
        ?>
				<?php 
        do_action('comment_form', $post->ID);
        ?>
				<?php 
        comment_id_fields();
        ?>
			<?php 
    }
    ?>
			
			<input type="submit" name="submit" id="<?php 
    echo esc_attr($args['id_submit']);
    ?>
" value="<?php 
    echo esc_attr($args['label_submit']);
    ?>
" />
		</p>
		
		<?php 
    do_action('ticket_form_bottom');
    ?>
		
	</form>
	
	<?php 
    do_action('ticket_form_after');
    ?>

<?php 
}
function dt_comment_form($args = array(), $post_id = null)
{
    if (null === $post_id) {
        $post_id = get_the_ID();
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = $user->exists() ? $user->display_name : '';
    $args = wp_parse_args($args);
    if (!isset($args['format'])) {
        $args['format'] = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml';
    }
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $html5 = 'html5' === $args['format'];
    /*$fields   =  array(
        'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
                    '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
        'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
                    '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
        'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
                    '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
      );*/
    $fields = array('author' => '<div class="row">
                    <div class="form-group col-xs-12 col-sm-4">
                    <input type="text" class="form-control" name="author" id="author" placeholder="' . __('full name', 'Krypton') . '" required>
                  </div>', 'email' => '<div class="form-group col-xs-12 col-sm-4">
                      <input type="email" class="form-control"  name="email" id="email" placeholder="' . __('email address', 'Krypton') . '" required>
                  </div>', 'url' => '<div class="form-group col-xs-12 col-sm-4">
                  <input type="text" class="form-control" name="url" id="url" placeholder="website">
                </div>
              </div>');
    $required_text = sprintf(' ' . __('Required fields are marked %s', 'Krypton'), '<span class="required">*</span>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<div class="row">
                                  <div class="form-group col-xs-12">
                                    <textarea class="form-control" rows="3" name="comment" id="comment" placeholder="' . __('your message', 'Krypton') . '" required></textarea>

                                  </div>
                              </div>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'Krypton'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'Krypton'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.', 'Krypton') . ($req ? $required_text : '') . '</p>', 'comment_notes_after' => '', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => '<hr /><div class="col-sm-12 comment-leave-title">' . __('Leave a Comment', 'Krypton') . '</div><hr />', 'title_reply_to' => __('Leave a Comment to %s', 'Krypton'), 'cancel_reply_link' => __('Cancel reply', 'Krypton'), 'label_submit' => __('Submit', 'Krypton'), 'format' => 'html5');
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    ?>
    <?php 
    if (comments_open($post_id)) {
        ?>

      <?php 
        do_action('comment_form_before');
        ?>
      <section id="respond" class="comment-respond">
        <h3 id="reply-title" class="comment-reply-title"><?php 
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        ?>
 <small><?php 
        cancel_comment_reply_link($args['cancel_reply_link']);
        ?>
</small></h3>
        <?php 
        if (get_option('comment_registration') && !is_user_logged_in()) {
            ?>
          <?php 
            echo $args['must_log_in'];
            ?>
          <?php 
            do_action('comment_form_must_log_in_after');
            ?>
        <?php 
        } else {
            ?>
          <form action="<?php 
            echo site_url('/wp-comments-post.php');
            ?>
" method="post" id="<?php 
            echo esc_attr($args['id_form']);
            ?>
" class="comment-form"<?php 
            echo $html5 ? ' novalidate' : '';
            ?>
 data-abide>
            <?php 
            do_action('comment_form_top');
            ?>
            <?php 
            if (is_user_logged_in()) {
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
                echo $args['comment_notes_before'];
            } else {
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                }
                do_action('comment_form_after_fields');
            }
            ?>
            <?php 
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            ?>
            <?php 
            echo $args['comment_notes_after'];
            ?>
            <p class="form-submit">
              <input name="submit" type="submit" id="<?php 
            echo esc_attr($args['id_submit']);
            ?>
" value="<?php 
            echo esc_attr($args['label_submit']);
            ?>
" />
              <?php 
            comment_id_fields($post_id);
            ?>
            </p>
            <?php 
            do_action('comment_form', $post_id);
            ?>
          </form>
        <?php 
        }
        ?>
      </section><!-- #respond -->
      <?php 
        do_action('comment_form_after');
        ?>
    <?php 
    } else {
        ?>
      <?php 
        do_action('comment_form_comments_closed');
        ?>
    <?php 
    }
    ?>
  <?php 
}
Beispiel #11
0
/**
 * Outputs a complete commenting form for use within a template.
 * Most strings and form fields may be controlled through the $args array passed
 * into the function, while you may also choose to use the comment_form_default_fields
 * filter to modify the array of default fields if you'd just like to add a new
 * one or remove a single field. All fields are also individually passed through
 * a filter of the form comment_form_field_$name where $name is the key used
 * in the array of fields.
 *
 * @since 3.0.0
 * @param array $args Options for strings, fields etc in the form
 * @param mixed $post_id Post ID to generate the form for, uses the current post if null
 * @return void
 */
function toolbox_comment_form($args = array(), $post_id = null)
{
    global $id;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = !empty($user->ID) ? $user->display_name : '';
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true' required='required'" : '';
    $class_req = $req ? ' required' : '';
    $fields = array('author' => '<p class="comment-form-author' . $class_req . '">' . '<label for="author">' . __('Name') . ' </label>' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email' . $class_req . '">' . '<label for="email">' . __('Email') . ' </label>' . '<input id="email" name="email" type="email" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></p>', 'url' => '<p class="comment-form-url">' . '<label for="url">' . __('Website') . ' </label>' . '<input id="url" name="url" type="url" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></p>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x('Comment', 'noun') . ' </label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required="required"></textarea></p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.') . '</p>', 'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf(__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s'), ' <code>' . allowed_tags() . '</code>') . '</p>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Leave a Reply'), 'title_reply_to' => __('Leave a Reply to %s'), 'cancel_reply_link' => __('Cancel reply'), 'label_submit' => __('Post Comment'));
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    if (comments_open()) {
        do_action('comment_form_before');
        echo '<div id="respond">';
        echo '<h3 id="reply-title">';
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        echo ' <small>';
        cancel_comment_reply_link($args['cancel_reply_link']);
        echo '</small></h3>';
        if (get_option('comment_registration') && !is_user_logged_in()) {
            echo $args['must_log_in'];
            do_action('comment_form_must_log_in_after');
        } else {
            echo '<form action="' . site_url('/wp-comments-post.php') . '" method="post" id="' . esc_attr($args['id_form']) . '">';
            do_action('comment_form_top');
            if (is_user_logged_in()) {
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
            } else {
                echo $args['comment_notes_before'];
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                }
                do_action('comment_form_after_fields');
            }
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            echo $args['comment_notes_after'];
            echo '<p class="form-submit">';
            echo '<button name="submit" value="submit" id="' . esc_attr($args['id_submit']) . '">' . esc_attr($args['label_submit']) . '</button>';
            comment_id_fields($post_id);
            echo '</p>';
            do_action('comment_form', $post_id);
            echo '</form>';
        }
        echo '</div>';
        do_action('comment_form_after');
    } else {
        do_action('comment_form_comments_closed');
    }
}
Beispiel #12
0
    function form()
    {
        global $thesis_site;
        if (comments_open()) {
            #wp
            global $user_ID, $user_identity;
            if (get_option('comment_registration') && !$user_ID) {
                // If registration is required and the user is NOT logged in... #wp
                echo "\t\t\t\t<div class=\"login_alert\">\n";
                echo "\t\t\t\t\t<p>" . sprintf(__('You must <a href="%s" rel="nofollow">log in</a> to post a comment.', 'thesis'), get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode(get_permalink())) . "</p>\n";
                #wp
                echo "\t\t\t\t</div>\n";
            } else {
                // Otherwise, show the user the stinkin' comment form already!
                echo "\t\t\t\t<div id=\"respond\">\n";
                echo "\t\t\t\t\t<div id=\"respond_intro\">\n";
                if (get_option('thread_comments')) {
                    cancel_comment_reply_link(__('Cancel reply', 'thesis'));
                }
                #wp
                echo "\t\t\t\t\t\t<p>" . apply_filters('thesis_comment_form_title', __('Leave a Comment', 'thesis')) . "</p>\n";
                #filter
                echo "\t\t\t\t\t</div>\n";
                echo "\t\t\t\t\t<form action=\"" . get_option('siteurl') . "/wp-comments-post.php\" method=\"post\" id=\"commentform\">\n";
                #wp
                thesis_hook_comment_form_top();
                if ($user_ID) {
                    // If the user is logged in... #wp
                    echo "\t\t\t\t\t\t<p>" . sprintf(__('Logged in as <a href="%1$s" rel="nofollow">%2$s</a>.', 'thesis'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity) . ' ' . sprintf(__('<a href="%s" title="Log out of this account" rel="nofollow">Logout &rarr;</a>', 'thesis'), thesis_logout_url()) . "</p>\n";
                } else {
                    // Otherwise, give your name to the doorman
                    $req = (bool) get_option('require_name_email');
                    ?>
						<p><input class="text_input" type="text" name="author" id="author" value="<?php 
                    echo $comment_author;
                    ?>
" tabindex="1"<?php 
                    if ($req) {
                        echo ' aria-required="true"';
                    }
                    ?>
 /><label for="author"><?php 
                    _e('Name', 'thesis');
                    if ($req) {
                        _e(' <span class="required" title="Required">*</span>', 'thesis');
                    }
                    ?>
</label></p>
						<p><input class="text_input" type="text" name="email" id="email" value="<?php 
                    echo $comment_author_email;
                    ?>
" tabindex="2"<?php 
                    if ($req) {
                        echo ' aria-required="true"';
                    }
                    ?>
 /><label for="email"><?php 
                    _e('E-mail', 'thesis');
                    if ($req) {
                        _e(' <span class="required" title="Required">*</span>', 'thesis');
                    }
                    ?>
</label></p>
						<p><input class="text_input" type="text" name="url" id="url" value="<?php 
                    echo $comment_author_url;
                    ?>
" tabindex="3" /><label for="url"><?php 
                    _e('Website', 'thesis');
                    ?>
</label></p>
<?php 
                }
                thesis_hook_comment_field();
                echo "\t\t\t\t\t\t<p class=\"comment_box\">\n";
                echo "\t\t\t\t\t\t\t<textarea name=\"comment\" id=\"comment\" tabindex=\"4\" cols=\"40\" rows=\"8\"></textarea>\n";
                echo "\t\t\t\t\t\t</p>\n";
                thesis_hook_after_comment_box();
                echo "\t\t\t\t\t\t<p class=\"remove_bottom_margin\">\n";
                echo "\t\t\t\t\t\t\t<input name=\"submit\" class=\"form_submit\" type=\"submit\" id=\"submit\" tabindex=\"5\" value=\"" . __('Submit', 'thesis') . "\" />\n";
                comment_id_fields();
                #wp
                echo "\t\t\t\t\t\t</p>\n";
                thesis_hook_comment_form_bottom();
                do_action('comment_form', $post->ID);
                #wp
                echo "\t\t\t\t\t</form>\n";
                echo "\t\t\t\t</div>\n";
            }
        } elseif ($thesis_site->comments['show_closed']) {
            echo "\t\t\t\t<div class=\"comments_closed\">\n";
            echo "\t\t\t\t\t<p>" . apply_filters('thesis_comments_closed', __('Comments on this entry are closed.', 'thesis')) . "</p>\n";
            echo "\t\t\t\t</div>\n";
        }
    }
/**
 *  This is how the comment form will look
 */
function digressit_comment_form()
{
    global $blog_id;
    ?>
    <a class="hidden-offscreen" href="#commentformend">Skip over comment form.</a>
    <form method="post" action="/" id="add-comment">

        <?php 
    if (!is_user_logged_in()) {
        ?>
            <?php 
        if (function_exists('display_recaptcha')) {
            ?>
                <p><input type="text" class="comment-field-area" id="display_name"  name="author" value="Your Name" ><label for="display_name">Display Name</label><p>
                <p><input type="text" class="comment-field-area" id="user_email" name="email" value="Email"><label for="user_email">Email</label><p>
            <?php 
        } else {
            ?>
                <p><input type="text" class="comment-field-area" id="display_name"  name="display_name" value="Your Name" ><label for="display_name">Display Name</label><p>
                <p><input type="text" class="comment-field-area" id="user_email" name="user_email" value="Email"><label for="user_email">Email</label><p>
            <?php 
        }
        ?>
        <?php 
    }
    ?>
        
        <label for='comment' id="comment-label" class="hidden-offscreen">
            
            <span id="comment-label-comment">
                Enter your comment on the selected section here. If you have not selected a numbered section to comment on, 
                you must do so before commenting. If you have trouble commenting, please <a href="mailto:regulationroom@cornell.edu">email us for technical assistance</a>.
            </span>
    
            <span id="comment-label-reply" style="display: none;">
                Enter your reply to the selected comment here. 
                If you have trouble replying, please <a href="mailto:regulationroom@cornell.edu">email us for technical assistance</a>.
            </span>
                    
        </label>
        <div id="textarea-wrapper" class="wrapper-disabled">
            <div class="left"></div>
            <div class="right">            
            <textarea name="comment" class="comment-textarea comment-collapsed" id="comment"><?php 
    _e('Click here to add a new comment...');
    ?>
</textarea>
            </div>
        </div>
    
        <input name="blog_id" type="hidden"  value="<?php 
    echo $blog_id;
    ?>
" />
        <input name="selected_paragraph_number" type="hidden" id="selected_paragraph_number"  value="0" />
    
        <div id="submit-wrapper" class="wrapper-disabled">
            <?php 
    do_action('secondary_comment_buttons');
    ?>
                <div class="loading-bars"></div><input name="submit" id="submit-comment" class="submit-comment submit ajax disabled" type="button" value="<?php 
    _e('Submit Comment');
    ?>
" disabled="disabled" />
        </div>
        <?php 
    comment_id_fields();
    ?>
        <?php 
    do_action('comment_form', $post->ID);
    ?>
    </form>
    <?php 
    do_action('digressit_after_comment_form');
    ?>
    <?php 
}
Beispiel #14
0
 /**
  * Adds hidden comment submission form fields. Alias for comment_id_fields().
  */
 public function comment_hidden_fields()
 {
     comment_id_fields();
 }
Beispiel #15
0
 public function html($args = array())
 {
     global $thesis, $user_ID, $post;
     #wp
     if (!comments_open()) {
         return;
     }
     extract($args = is_array($args) ? $args : array());
     $tab = str_repeat("\t", $depth = !empty($depth) ? $depth : 0);
     $hook = trim($thesis->api->esc(!empty($this->options['hook']) ? $this->options['hook'] : 'comment_form'));
     if (get_option('comment_registration') && !!!$user_ID) {
         #wp
         echo "{$tab}<p class=\"login_alert\">", __('You must log in to post a comment.', 'thesis'), " <a href=\"", wp_login_url(get_permalink()), "\" rel=\"nofollow\">", __('Log in now.', 'thesis'), "</a></p>\n";
     } else {
         do_action("hook_before_{$hook}");
         echo "{$tab}<form id=\"commentform\" method=\"post\" action=\"", site_url('wp-comments-post.php'), "\">\n";
         #wp
         do_action("hook_top_{$hook}");
         $this->rotator(array_merge($args, array('depth' => $depth + 1, 'req' => get_option('require_name_email'))));
         do_action("hook_bottom_{$hook}");
         do_action('comment_form', $post->ID);
         #wp
         comment_id_fields();
         #wp
         echo "{$tab}</form>\n";
         do_action("hook_after_{$hook}");
     }
 }
Beispiel #16
0
    function fotos_get_comment_form()
    {
        global $post;
        ?>

		<form class="ba-fotos-commentform" action="<?php 
        echo get_option('siteurl');
        ?>
/wp-comments-post.php" method="post" id="commentform-<?php 
        echo $post->ID;
        ?>
">

			<div class="row">
				<div class="span6 zmb">
					<label class="fotos-label-control" for="author-<?php 
        echo $post->ID;
        ?>
">Name</label>
					<input class="fotos-label-full" type="text" name="author" id="author-<?php 
        echo $post->ID;
        ?>
" value="" size="22" tabindex="1" />
				</div>

				<div class="span6 zmb">
					<label class="fotos-label-control" for="email-<?php 
        echo $post->ID;
        ?>
" >Email</label>
					<input class="fotos-label-full" type="email" required name="email" id="email-<?php 
        echo $post->ID;
        ?>
" value="" size="22" tabindex="2" />
				</div>
			</div>

			<div class="row">
				<div class="span12 zmb">
					<label class="fotos-label-control" for="url-<?php 
        echo $post->ID;
        ?>
">Website</label>
					<input class="fotos-label-full" type="url" name="url" id="url-<?php 
        echo $post->ID;
        ?>
" value="" size="22" tabindex="3" />
				</div>
			</div>

			<label class="fotos-label-control" for="comment-<?php 
        echo $post->ID;
        ?>
">Message</label>
			<textarea name="comment" id="comment-<?php 
        echo $post->ID;
        ?>
" type="comment" required rows="2" tabindex="4"></textarea>

			<button class="btn btn-fotos fotos-form-submit" name="submit" type="submit" tabindex="4" value="Submit"> Submit</button>
			<?php 
        comment_id_fields();
        ?>

			<?php 
        do_action('comment_form', $post->ID);
        ?>
		</form>

	<?php 
    }
Beispiel #17
0
    function form($user_data, $depth = 4)
    {
        global $thesis_design, $post;
        if (comments_open()) {
            #wp
            $tab = str_repeat("\t", $depth);
            if (get_option('comment_registration') && !$user_data['user_ID']) {
                #wp
                echo "{$tab}<div class=\"login_alert\">\n";
                echo "{$tab}\t<p>" . sprintf(__('You must <a href="%s" rel="nofollow">log in</a> to post a comment.', 'thesis'), wp_login_url(get_permalink())) . "</p>\n";
                #wp
                echo "{$tab}</div>\n";
            } else {
                echo "{$tab}<div id=\"respond\">\n";
                echo "{$tab}\t<div id=\"respond_intro\">\n";
                if (get_option('thread_comments')) {
                    cancel_comment_reply_link(__('Cancel reply', 'thesis'));
                }
                #wp
                echo "{$tab}\t\t<p>" . apply_filters('thesis_comment_form_title', __('Leave a Comment', 'thesis')) . "</p>\n";
                #filter
                echo "{$tab}\t</div>\n";
                echo "{$tab}\t<form action=\"" . get_option('siteurl') . "/wp-comments-post.php\" method=\"post\" id=\"commentform\">\n";
                #wp
                thesis_hook_comment_form_top();
                #hook
                if ($user_data['user_ID']) {
                    // #wp
                    echo "{$tab}\t\t<p>" . sprintf(__('Logged in as <a href="%1$s" rel="nofollow">%2$s</a>.', 'thesis'), get_option('siteurl') . '/wp-admin/profile.php', $user_data['user_identity']) . ' ' . sprintf(__('<a href="%s" title="Log out of this account" rel="nofollow">Logout &rarr;</a>', 'thesis'), wp_logout_url(get_permalink())) . "</p>\n";
                } else {
                    ?>
						<p><input class="text_input" type="text" name="author" id="author" value="<?php 
                    echo $user_data['comment_author'];
                    ?>
" tabindex="1"<?php 
                    if ($user_data['req']) {
                        echo ' aria-required="true"';
                    }
                    ?>
 /><label for="author"><?php 
                    _e('Name', 'thesis');
                    if ($user_data['req']) {
                        _e(' <span class="required" title="Required">*</span>', 'thesis');
                    }
                    ?>
</label></p>
						<p><input class="text_input" type="text" name="email" id="email" value="<?php 
                    echo $user_data['comment_author_email'];
                    ?>
" tabindex="2"<?php 
                    if ($user_data['req']) {
                        echo ' aria-required="true"';
                    }
                    ?>
 /><label for="email"><?php 
                    _e('E-mail', 'thesis');
                    if ($user_data['req']) {
                        _e(' <span class="required" title="Required">*</span>', 'thesis');
                    }
                    ?>
</label></p>
						<p><input class="text_input" type="text" name="url" id="url" value="<?php 
                    echo $user_data['comment_author_url'];
                    ?>
" tabindex="3" /><label for="url"><?php 
                    _e('Website', 'thesis');
                    ?>
</label></p>
<?php 
                }
                thesis_hook_comment_field();
                #hook
                echo "{$tab}\t\t<p class=\"comment_box\">\n";
                echo "{$tab}\t\t\t<textarea name=\"comment\" id=\"comment\" tabindex=\"4\" cols=\"40\" rows=\"8\"></textarea>\n";
                echo "{$tab}\t\t</p>\n";
                thesis_hook_after_comment_box();
                #hook
                echo "{$tab}\t\t<p class=\"remove_bottom_margin\">\n";
                echo "{$tab}\t\t\t<input name=\"submit\" class=\"form_submit\" type=\"submit\" id=\"submit\" tabindex=\"5\" value=\"" . __('Submit', 'thesis') . "\" />\n";
                comment_id_fields();
                #wp
                echo "{$tab}\t\t</p>\n";
                thesis_hook_comment_form_bottom();
                #hook
                do_action('comment_form', $post->ID);
                #wp
                echo "{$tab}\t</form>\n";
                echo "{$tab}</div>\n";
            }
        } elseif ($thesis_design->display['comments']['show_closed']) {
            echo "{$tab}<div class=\"comments_closed\">\n";
            echo "{$tab}\t<p>" . apply_filters('thesis_comments_closed', __('Comments on this entry are closed.', 'thesis')) . "</p>\n";
            #filter
            echo "{$tab}</div>\n";
        }
    }
Beispiel #18
0
/**
 * Outputs a complete commenting form for use within a template.
 * This is a custom one of the WordPress buildin.
 *
 * @since 0.0.1
 *
 * @param mixed $post_id Post ID to generate the form for, uses the current post if null
 * @return void
 */
function vp_comment_form($post_id = null)
{
    if (!is_user_logged_in()) {
        return;
    }
    global $id;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    if (comments_open()) {
        ?>
		<section id="respond" class="box">
		  <div class="heading">
			  <h2 id="reply-title" class="xsmall fade"><?php 
        _e('Add a reply', 'v2press');
        ?>
</h2>
			</div>
			<div class="inner">
				<form id="respond-form" action="<?php 
        echo site_url('/wp-comments-post.php');
        ?>
" method="post">
					<fieldset>
					  <p>
					    <textarea id="comment" class="form-field required" name="comment" cols="45" rows="8" aria-required="true"></textarea>
					  </p>
					  <p class="form-submit">
							<input name="submit" type="submit" class="btn" value="<?php 
        _e('Add Reply', 'v2press');
        ?>
" />
							<?php 
        comment_id_fields($post_id);
        ?>
						</p>
						<?php 
        do_action('comment_form', $post_id);
        ?>
					</fieldset>
				</form>
			</div>
			<div class="footing">
			  <p class="xsmall fade"><?php 
        _e('Please avoid posting pointless replies, it\'s always great to save everyone\'s precious time.', 'v2press');
        ?>
</p>
			</div>
		</section>
		<?php 
    }
    ?>
	<?php 
}
    /**
     * Output a complete commenting form for use within a template.
     *
     * Most strings and form fields may be controlled through the $args array passed
     * into the function, while you may also choose to use the comment_form_default_fields
     * filter to modify the array of default fields if you'd just like to add a new
     * one or remove a single field. All fields are also individually passed through
     * a filter of the form comment_form_field_$name where $name is the key used
     * in the array of fields.
     *
     * @since 3.0.0
     *
     * @param array       $args {
     *     Optional. Default arguments and form fields to override.
     *
     *     @type array 'fields' {
     *         Default comment fields, filterable by default via the 'comment_form_default_fields' hook.
     *
     *         @type string 'author' The comment author field HTML.
     *         @type string 'email'  The comment author email field HTML.
     *         @type string 'url'    The comment author URL field HTML.
     *     }
     *     @type string 'comment_field'        The comment textarea field HTML.
     *     @type string 'must_log_in'          HTML element for a 'must be logged in to comment' message.
     *     @type string 'logged_in_as'         HTML element for a 'logged in as <user>' message.
     *     @type string 'comment_notes_before' HTML element for a message displayed before the comment form.
     *                                         Default 'Your email address will not be published.'.
     *     @type string 'comment_notes_after'  HTML element for a message displayed after the comment form.
     *                                         Default 'You may use these HTML tags and attributes ...'.
     *     @type string 'id_form'              The comment form element id attribute. Default 'commentform'.
     *     @type string 'id_submit'            The comment submit element id attribute. Default 'submit'.
     *     @type string 'title_reply'          The translatable 'reply' button label. Default 'Leave a Reply'.
     *     @type string 'title_reply_to'       The translatable 'reply-to' button label. Default 'Leave a Reply to %s',
     *                                         where %s is the author of the comment being replied to.
     *     @type string 'cancel_reply_link'    The translatable 'cancel reply' button label. Default 'Cancel reply'.
     *     @type string 'label_submit'         The translatable 'submit' button label. Default 'Post a comment'.
     *     @type string 'format'               The comment form format. Default 'xhtml'. Accepts 'xhtml', 'html5'.
     * }
     * @param int|WP_Post $post_id Optional. Post ID or WP_Post object to generate the form for. Default current post.
     */
    function wft_comment_form($args = array(), $post_id = null)
    {
        if (null === $post_id) {
            $post_id = get_the_ID();
        } else {
            $id = $post_id;
        }
        $commenter = wp_get_current_commenter();
        $user = wp_get_current_user();
        $user_identity = $user->exists() ? $user->display_name : '';
        $args = wp_parse_args($args);
        if (!isset($args['format'])) {
            $args['format'] = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml';
        }
        $req = get_option('require_name_email');
        $aria_req = $req ? " aria-required='true'" : '';
        $html5 = 'html5' === $args['format'];
        $fields = array('author' => '<li class="clearfix m_bottom_15"> <label for="author">' . __('Name', '') . ($req ? ' <span class="required">*</span>' : '') . '</label>
                    <input id="author" name="author" type="text" class="full_width r_corners" value="' . esc_attr($commenter['comment_author']) . '" ' . $aria_req . ' /> </li>', 'url' => '<li class="clearfix m_bottom_15"> <label for="website">' . __('Website', '') . '</label> ' . '<input id="website" name="website" ' . ($html5 ? 'type="tel"' : 'type="text"') . ' class="full_width r_corners" value="' . (isset($commenter['comment_author_phone']) ? esc_attr($commenter['comment_author_phone']) : '') . '"  /> </li>', 'email' => '<li class="clearfix m_bottom_15">
				<label for="email">' . __('Email', '') . ($req ? ' <span class="required">*</span>' : '') . '</label>
                    <input id="email" name="email" class="full_width r_corners" ' . ($html5 ? 'type="email"' : 'type="text"') . '
                     value="' . esc_attr($commenter['comment_author_email']) . '" ' . $aria_req . ' /> </li>');
        $required_text = sprintf(' ' . __('Required fields are marked %s', ''), '<span class="required">*</span>');
        /**
         * Filter the default comment form fields.
         *
         * @since 3.0.0
         *
         * @param array $fields The default comment fields.
         */
        $fields = apply_filters('comment_form_default_fields', $fields);
        $defaults = array('fields' => $fields, 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x('Comment', 'noun', '') . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.', '') . ($req ? $required_text : '') . '</p>', 'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf(__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s'), ' <code>' . allowed_tags() . '</code>') . '</p>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Leave a Reply', ''), 'title_reply_to' => __('Leave a Reply to %s', ''), 'cancel_reply_link' => __('Cancel reply', ''), 'label_submit' => __('Post Comment', ''), 'format' => 'xhtml');
        /**
         * Filter the comment form default arguments.
         *
         * Use 'comment_form_default_fields' to filter the comment fields.
         *
         * @since 3.0.0
         *
         * @param array $defaults The default comment form arguments.
         */
        $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
        ?>
		<?php 
        if (comments_open($post_id)) {
            ?>
			<?php 
            /**
             * Fires before the comment form.
             *
             * @since 3.0.0
             */
            do_action('comment_form_before');
            ?>

				<h3 id="reply-title" class="comment-reply-title"><?php 
            comment_form_title($args['title_reply'], $args['title_reply_to']);
            ?>
</h3>
				<?php 
            if (get_option('comment_registration') && !is_user_logged_in()) {
                ?>
					<?php 
                echo $args['must_log_in'];
                ?>
					<?php 
                /**
                 * Fires after the HTML-formatted 'must log in after' message in the comment form.
                 *
                 * @since 3.0.0
                 */
                do_action('comment_form_must_log_in_after');
                ?>
				<?php 
            } else {
                ?>
					<form action="<?php 
                echo site_url('/wp-comments-post.php');
                ?>
" method="post" id="<?php 
                echo esc_attr($args['id_form']);
                ?>
" 
					 class="bs_inner_offsets full_width bg_light_color_3 r_corners shadow m_xs_bottom_30"<?php 
                echo $html5 ? ' novalidate' : '';
                ?>
>
					  <ul>
						<?php 
                /**
                 * Fires at the top of the comment form, inside the <form> tag.
                 *
                 * @since 3.0.0
                 */
                do_action('comment_form_top');
                ?>
						<?php 
                if (is_user_logged_in()) {
                    ?>
							<?php 
                    /**
                     * Filter the 'logged in' message for the comment form for display.
                     *
                     * @since 3.0.0
                     *
                     * @param string $args['logged_in_as'] The logged-in-as HTML-formatted message.
                     * @param array  $commenter            An array containing the comment author's username, email, and URL.
                     * @param string $user_identity        If the commenter is a registered user, the display name, blank otherwise.
                     */
                    echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                    ?>
							<?php 
                    /**
                     * Fires after the is_user_logged_in() check in the comment form.
                     *
                     * @since 3.0.0
                     *
                     * @param array  $commenter     An array containing the comment author's username, email, and URL.
                     * @param string $user_identity If the commenter is a registered user, the display name, blank otherwise.
                     */
                    do_action('comment_form_logged_in_after', $commenter, $user_identity);
                    ?>
						<?php 
                } else {
                    ?>
							<?php 
                    echo $args['comment_notes_before'];
                    ?>
							<?php 
                    /**
                     * Fires before the comment fields in the comment form.
                     *
                     * @since 3.0.0
                     */
                    do_action('comment_form_before_fields');
                    $args['fields'] = (array) $args['fields'];
                    if (!empty($args['fields'])) {
                        $fields_count = count($args['fields']);
                        $fields_middle = round($fields_count / 2);
                        $fields['left'] = array();
                        $fields['right'] = array();
                        $i = 1;
                        foreach ($args['fields'] as $name => $field) {
                            if ($i <= $fields_middle) {
                                $fields['left'][$name] = $field;
                            } else {
                                $fields['right'][$name] = $field;
                            }
                            $i++;
                        }
                        foreach ($fields['left'] as $name => $field) {
                            /**
                             * Filter a comment form field for display.
                             *
                             * The dynamic portion of the filter hook, $name, refers to the name
                             * of the comment form field. Such as 'author', 'email', or 'url'.
                             *
                             * @since 3.0.0
                             *
                             * @param string $field The HTML-formatted output of the comment form field.
                             */
                            echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                        }
                        if (!empty($fields['right'])) {
                            foreach ($fields['right'] as $name => $field) {
                                /**
                                 * Filter a comment form field for display.
                                 *
                                 * The dynamic portion of the filter hook, $name, refers to the name
                                 * of the comment form field. Such as 'author', 'email', or 'url'.
                                 *
                                 * @since 3.0.0
                                 *
                                 * @param string $field The HTML-formatted output of the comment form field.
                                 */
                                echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                            }
                        }
                    }
                    /**
                     * Fires after the comment fields in the comment form.
                     *
                     * @since 3.0.0
                     */
                    do_action('comment_form_after_fields');
                    ?>
						<?php 
                }
                ?>
						<?php 
                /**
                 * Filter the content of the comment textarea field for display.
                 *
                 * @since 3.0.0
                 *
                 * @param string $args['comment_field'] The content of the comment textarea field.
                 */
                echo apply_filters('comment_form_field_comment', $args['comment_field']);
                ?>
						<?php 
                echo $args['comment_notes_after'];
                ?>

						<br/>
						<br/>

						<input name="submit" type="submit" id="<?php 
                echo esc_attr($args['id_submit']);
                ?>
" class="button button_form r_corners button_type_4 bg_light_color_2 mw_0 color_dark tr_all_hover" value="<?php 
                echo esc_attr($args['label_submit']);
                ?>
" />
						<span class="pull-right button"><?php 
                cancel_comment_reply_link($args['cancel_reply_link']);
                ?>
</span>
						<?php 
                comment_id_fields($post_id);
                ?>

						<?php 
                /**
                 * Fires at the bottom of the comment form, inside the closing </form> tag.
                 *
                 * @since 1.5.2
                 *
                 * @param int $post_id The post ID.
                 */
                do_action('comment_form', $post_id);
                ?>
					</ul>
					</form>
				<?php 
            }
            ?>
			<?php 
            /**
             * Fires after the comment form.
             *
             * @since 3.0.0
             */
            do_action('comment_form_after');
        } else {
            /**
             * Fires after the comment form if comments are closed.
             *
             * @since 3.0.0
             */
            do_action('comment_form_comments_closed');
        }
    }
    /**
     * Get comment form
     * 
     * @since roen 1.0
     */
    function roen_comment_form()
    {
        global $user_identity;
        $commenter = wp_get_current_commenter();
        $req = get_option('require_name_email');
        $aria_req = $req ? " aria-required='true'" : '';
        if (comments_open()) {
            ?>

    <div id="respond">
        <div id="reply-title" class="roen-title">
            <h4 class="post-title"><?php 
            comment_form_title(__('Leave A Comment', 'ROEN'), __('Leave A Comment', 'ROEN'));
            ?>
</h4>
            <div class="line"><span class="left-line"></span><span class="right-line"></span></div>
            <div class="clear"></div>
        </div>
		<?php 
            cancel_comment_reply_link();
            ?>

        <form id="comment-form" action="<?php 
            echo get_option('siteurl');
            ?>
/wp-comments-post.php" method="post">
        <?php 
            if (is_user_logged_in()) {
                ?>

            <p><?php 
                _e('Logged in as', 'ROEN');
                ?>
 <a href="<?php 
                echo get_option('siteurl');
                ?>
/wp-admin/profile.php"><?php 
                echo $user_identity;
                ?>
</a>. <a href="<?php 
                echo wp_logout_url(get_permalink());
                ?>
" title="Log out of this account"><?php 
                _e('Log out &raquo;', 'ROEN');
                ?>
</a></p>
            <div id="comment-fields">
                <div id="comment-textarea">
                     <label for="comment"><?php 
                _e('Comment Message', 'ROEN');
                ?>
<span class="description"><?php 
                _e('(required)', 'ROEN');
                ?>
</span></label>
                    <textarea name="comment" id="comment" cols="60" rows="5" tabindex="4" class="textarea-comment logged-in"></textarea>
                </div>
            </div>
            <div id="comment-alert-error" class="alert alert-warning">
                <span class="comment-alert-error-message"><?php 
                _e('Please enter message.', 'ROEN');
                ?>
</span>
            </div>
            <div id="comment-submit">
                <button type="submit" class="btn btn-theme float-btn no-margin"><i class="fa fa-comment-o"></i><?php 
                _e('Post Comment', 'ROEN');
                ?>
</button>
                <?php 
                comment_id_fields();
                ?>

                <?php 
                do_action('comment_form', get_the_ID());
                ?>

            </div>
		<?php 
            } else {
                ?>

            <div id="comment-fields">
                <div id="comment-author">
                    <label for="author"><?php 
                _e('Name', 'ROEN');
                ?>
<span class="description"><?php 
                _e('(required)', 'ROEN');
                ?>
</span></label>
                    <input type="text" name="author" id="author" tabindex="1" <?php 
                if ($req) {
                    echo "aria-required='true'";
                }
                ?>
 class="input-name">
                </div>
                <div id="comment-email">
                    <label for="email"><?php 
                _e('Email', 'ROEN');
                ?>
<span class="description"><?php 
                _e('(required)', 'ROEN');
                ?>
</span></label>
                    <input type="text" name="email" id="email" tabindex="2" <?php 
                if ($req) {
                    echo "aria-required='true'";
                }
                ?>
 class="input-email">
                </div>
                <div id="comment-url">
                <label for="url"><?php 
                _e('Website', 'ROEN');
                ?>
</label>
                <input type="text" name="url" id="url" tabindex="3" class="input-website">
                </div>
                <div id="comment-textarea">
                    <label for="comment"><?php 
                _e('Comment Message', 'ROEN');
                ?>
<span class="description"><?php 
                _e('(required)', 'ROEN');
                ?>
</span></label>
                    <textarea name="comment" id="comment" cols="60" rows="5" tabindex="4" class="textarea-comment"></textarea>
                </div>
            </div>
            <div id="comment-alert-error" class="alert alert-warning">
                <span class="comment-alert-error-name"><?php 
                _e('Please enter your name.', 'ROEN');
                ?>
</span>
                <span class="comment-alert-error-email"><?php 
                _e('Please enter an valid email address.', 'ROEN');
                ?>
</span>
                <span class="comment-alert-error-message"><?php 
                _e('Please enter message.', 'ROEN');
                ?>
</span>
            </div>
            <div id="comment-submit">
                <button type="submit" class="btn btn-theme float-btn no-margin"><i class="fa fa-comment-o"></i><?php 
                _e('Post Comment', 'ROEN');
                ?>
</button>
                <?php 
                comment_id_fields();
                ?>

                <?php 
                do_action('comment_form', get_the_ID());
                ?>

            </div>
        <?php 
            }
            ?>

        </form>
    </div>
	<?php 
        }
    }
function ts_comment_form($args = array(), $post_id = null)
{
    global $user_identity;
    if (null === $post_id) {
        $post_id = get_the_ID();
    }
    $allowed_html = array('span' => array('class' => array()), 'a' => array('href' => array(), 'title' => array()));
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $comment_author = '';
    $comment_author_email = '';
    $comment_author_url = '';
    extract(array_filter(array('comment_author' => esc_attr($commenter['comment_author']), 'comment_author_email' => esc_attr($commenter['comment_author_email']), 'comment_author_url' => esc_attr($commenter['comment_author_url']))), EXTR_OVERWRITE);
    $fields = array('author' => '<label>' . wp_kses(__('Your Name <span class="required">*</span>', 'gon'), $allowed_html) . '</label><p class="comment-form-author">' . '<input id="author" class="input-text" name="author" type="text" value="' . $comment_author . '" size="30"' . $aria_req . ' />' . '</p>', 'email' => '<label>' . wp_kses(__('Email Address <span class="required">*</span>', 'gon'), $allowed_html) . '</label><p class="comment-form-email"><input id="email" class="input-text" name="email" type="text" value="' . $comment_author_email . '" size="30"' . $aria_req . '/>' . '</p>', 'url' => '<label>' . esc_html__('Website', 'gon') . '</label><p class="comment-form-url"><input id="url" class="input-text" name="url" type="text" value="' . $comment_author_url . '" size="30"/>' . '</p>');
    $required_text = sprintf(' ' . wp_kses(__('Required fields are marked %s', 'gon'), $allowed_html), '<span class="required">*</span>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'fields_before' => '<div class="info-wrapper">', 'fields_after' => '</div>', 'comment_field' => '<div class="message-wrapper"><label>' . esc_html__('Your message', 'gon') . '</label><p class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p></div>', 'must_log_in' => '<p class="must-log-in">' . sprintf(wp_kses(__('You must be <a href="%s">logged in</a> to post a comment.', 'gon'), $allowed_html), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(wp_kses(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'gon'), $allowed_html), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '', 'comment_notes_after' => '', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => esc_html__('Leave a comment', 'gon'), 'title_reply_to' => esc_html__('Leave a Reply to %s', 'gon'), 'cancel_reply_link' => esc_html__('Cancel reply', 'gon'), 'label_submit' => esc_html__('Submit', 'gon'));
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    ?>
		<?php 
    if (comments_open()) {
        ?>
			<?php 
        do_action('comment_form_before');
        ?>
			<section id="comment-wrapper">
				<header class="heading-wrapper">
					<h2 class="heading-title"><?php 
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        ?>
 <small><?php 
        cancel_comment_reply_link($args['cancel_reply_link']);
        ?>
</small></h2>
				</header>
				
				<?php 
        if (get_option('comment_registration') && !is_user_logged_in()) {
            echo $args['must_log_in'];
            do_action('comment_form_must_log_in_after');
        } else {
            ?>
					<form action="<?php 
            echo site_url('/wp-comments-post.php');
            ?>
" method="post" id="<?php 
            echo esc_attr($args['id_form']);
            ?>
">
						<?php 
            do_action('comment_form_top');
            if (is_user_logged_in()) {
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
            } else {
                echo $args['comment_notes_before'];
                echo $args['fields_before'];
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                }
                echo $args['fields_after'];
            }
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            echo $args['comment_notes_after'];
            if (!is_user_logged_in()) {
                do_action('comment_form_after_fields');
            }
            ?>
						<p class="form-submit">
							<button class="button button-secondary" type="submit" id="<?php 
            echo esc_attr($args['id_submit']);
            ?>
"><?php 
            echo esc_attr($args['label_submit']);
            ?>
</button>

							<?php 
            comment_id_fields($post_id);
            ?>
						</p>
						<?php 
            do_action('comment_form', $post_id);
            ?>
					</form>
				<?php 
        }
        ?>
			</section>
			<?php 
        do_action('comment_form_after');
        ?>
		<?php 
    } else {
        ?>
			<?php 
        do_action('comment_form_comments_closed');
        ?>
		<?php 
    }
}
Beispiel #22
0
              </div><!-- #form-section-email .form-section -->

              <div id="form-section-url" class="form-section">
								<div class="form-label"><label for="url"><?php _e('Website', 'uthili') ?></label></div>
								<div class="form-input"><input id="url" name="url" type="text" value="<?php echo $comment_author_url ?>" size="30" maxlength="50" tabindex="5" /></div>
              </div><!-- #form-section-url .form-section -->

<?php endif /* if ( $user_ID ) */ ?>

              <div id="form-section-comment" class="form-section">
								<div class="form-label"><label for="comment"><?php _e('Comment', 'uthili') ?></label></div>
								<div class="form-textarea"><textarea id="comment" name="comment" cols="45" rows="8" tabindex="6"></textarea></div>
              </div><!-- #form-section-comment .form-section -->
              
              <div id="form-allowed-tags" class="form-section">
	              <p><span><?php _e('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:', 'uthili') ?></span> <code><?php echo allowed_tags(); ?></code></p>
              </div>
							
<?php do_action('comment_form', $post->ID); ?>
                  
							<div class="form-submit"><input id="submit" name="submit" type="submit" value="<?php _e('Post Comment', 'uthili') ?>" tabindex="7" /><input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /></div>

<?php comment_id_fields(); ?>    

						</form><!-- #commentform -->										
					</div><!-- .formcontainer -->
<?php endif /* if ( get_option('comment_registration') && !$user_ID ) */ ?>
				</div><!-- #respond -->
<?php endif /* if ( 'open' == $post->comment_status ) */ ?>
			</div><!-- #comments -->
Beispiel #23
0
    function spec_comments_form()
    {
        global $post, $id, $comment, $user_ID, $current_user, $user_identity;
        if (comments_open()) {
            if (!is_user_logged_in()) {
                $commenter = wp_get_current_commenter();
            }
            if (spec_comment_option('form_avatar')) {
                $avatar = get_avatar(isset($current_user->user_email) ? $current_user->user_email : $commenter['comment_author_email'], apply_filters('spec_avatar_size_large', 64));
            }
            ?>

			<li class="depth-1<?php 
            echo isset($avatar) && $avatar ? ' with-avatar' : '';
            ?>
" id="response-cont">

			<?php 
            do_action('before_comment_respond', $post->ID);
            $form_title = spec_comment_option('form_title');
            if ($form_title != '') {
                echo '<div class="comment-title">' . $form_title . '</div>';
            }
            ?>

				<div id="respond" class="comment-body"><?php 
            // Not logged in, then you're not getting the form.
            if (get_option('comment_registration') && !$user_ID) {
                _e('You must be logged in to comment.', SPEC_COMMENT_DOM);
                echo ' ';
                // Adding this here rather than the string above so translations will still work from the old version
                wp_loginout(get_permalink());
            } else {
                if (get_option('show_avatars') && isset($avatar) && $avatar != '') {
                    ?>
							<div class="comment-author-avatar">
								<?php 
                    echo isset($current_user->user_email) || isset($commenter['comment_author_email']) ? '<a href="http://gravatar.com/site/login" title="' . __('Change Your Avatar', SPEC_COMMENT_DOM) . '">' . $avatar . '</a>' : $avatar;
                    ?>
							</div><?php 
                }
                do_action('before_comment_form', $post->ID);
                ?>

						<form action="<?php 
                echo get_option('siteurl');
                ?>
/wp-comments-post.php" method="post" id="comment-form">
							<fieldset><?php 
                do_action('comment_form_start', $post->ID);
                if ($user_ID) {
                    ?>
								<div class="comment-meta">
									<cite class="fn"><?php 
                    echo $user_identity;
                    ?>
</cite>
								</div>

								<?php 
                } else {
                    $req = get_option('require_name_email');
                    ?>

								<div class="comment-form-row">
									<label for="author"><?php 
                    _e('Name', SPEC_COMMENT_DOM);
                    ?>
</label>
									<input type="text" name="author" id="author" value="<?php 
                    echo esc_attr($commenter['comment_author']);
                    ?>
" size="30" tabindex="1"<?php 
                    echo $req ? ' class="vital"' : '';
                    ?>
/>
								</div>

								<div class="comment-form-row">
									<label for="email"><?php 
                    _e('Email', SPEC_COMMENT_DOM);
                    ?>
</label>
									<input type="text" name="email" id="email" value="<?php 
                    echo esc_attr($commenter['comment_author_email']);
                    ?>
" size="30" tabindex="2"<?php 
                    echo $req ? ' class="vital"' : '';
                    ?>
/>
								</div>

								<div class="comment-form-row">
									<label for="url"><?php 
                    _e('Website', SPEC_COMMENT_DOM);
                    ?>
</label>
									<input type="text" name="url" id="url" value="<?php 
                    echo esc_attr($commenter['comment_author_url']);
                    ?>
" size="30" tabindex="3" />
								</div>
								<?php 
                }
                ?>

								<div class="textarea-border">
									<textarea name="comment" id="comment" cols="50" rows="3" tabindex="4" class="vital"></textarea>
								</div>

								<div class="comment-buttons">
									<input name="submit" type="submit" tabindex="5" value="<?php 
                _e('Post your comment', SPEC_COMMENT_DOM);
                ?>
" class="submit" />
									<?php 
                cancel_comment_reply_link(__('Cancel reply', SPEC_COMMENT_DOM));
                if ($user_ID) {
                    ?>

									<a class="comment-button" href="<?php 
                    echo admin_url('profile.php');
                    ?>
"><?php 
                    _e('Edit profile', SPEC_COMMENT_DOM);
                    ?>
 </a>
									<a class="comment-button" href="<?php 
                    echo wp_logout_url($_SERVER['REQUEST_URI']);
                    ?>
" title="<?php 
                    _e('Log out of this account', SPEC_COMMENT_DOM);
                    ?>
"><?php 
                    _e('Log Out', SPEC_COMMENT_DOM);
                    ?>
</a><?php 
                }
                ?>
								</div>

								<input type="hidden" name="comment_post_ID" value="<?php 
                echo $id;
                ?>
" /><?php 
                comment_id_fields();
                do_action('comment_form', $post->ID);
                ?>
							</fieldset>
						</form><?php 
                do_action('after_comment_form', $post->ID);
            }
            ?>
				</div>
			</li><?php 
            do_action('after_comment_respond', $post->ID);
        }
    }
Beispiel #24
0
    /**
     * Comment form
     */
    function zee_comment_form($args = array(), $post_id = null)
    {
        if (null === $post_id) {
            $post_id = get_the_ID();
        } else {
            $id = $post_id;
        }
        $commenter = wp_get_current_commenter();
        $user = wp_get_current_user();
        $user_identity = $user->exists() ? $user->display_name : '';
        if (!isset($args['format'])) {
            $args['format'] = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml';
        }
        $req = get_option('require_name_email');
        $aria_req = $req ? " aria-required='true'" : '';
        $html5 = 'html5' === $args['format'];
        $fields = array('author' => '
        <div class="form-group">
        <div class="col-sm-6 comment-form-author">
        <input   class="form-control"  id="author" 
        placeholder="' . __('Name', ZEETEXTDOMAIN) . '" name="author" type="text" 
        value="' . esc_attr($commenter['comment_author']) . '" ' . $aria_req . ' />
        </div>', 'email' => '<div class="col-sm-6 comment-form-email">
        <input id="email" class="form-control" name="email" 
        placeholder="' . __('Email', ZEETEXTDOMAIN) . '" ' . ($html5 ? 'type="email"' : 'type="text"') . ' 
        value="' . esc_attr($commenter['comment_author_email']) . '" ' . $aria_req . ' />
        </div>
        </div>', 'url' => '<div class="form-group">
        <div class=" col-sm-12 comment-form-url">' . '<input  class="form-control" placeholder="' . __('Website', ZEETEXTDOMAIN) . '"  id="url" name="url" ' . ($html5 ? 'type="url"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_url']) . '"  />
        </div></div>');
        $required_text = sprintf(' ' . __('Required fields are marked %s', ZEETEXTDOMAIN), '<span class="required">*</span>');
        $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '
    <div class="form-group comment-form-comment">
    <div class="col-sm-12">
    <textarea class="form-control" id="comment" name="comment" placeholder="' . _x('Comment', 'noun', ZEETEXTDOMAIN) . '" rows="8" aria-required="true"></textarea>
    </div>
    </div>
    ', 'must_log_in' => '


    <div class="alert alert-danger must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</div>', 'logged_in_as' => '<div class="alert alert-info logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', ZEETEXTDOMAIN), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</div>', 'comment_notes_before' => '<div class="alert alert-info comment-notes">' . __('Your email address will not be published.', ZEETEXTDOMAIN) . ($req ? $required_text : '') . '</div>', 'comment_notes_after' => '<div class="form-allowed-tags">' . sprintf(__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s', ZEETEXTDOMAIN), ' <code>' . allowed_tags() . '</code>') . '</div>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Leave a Reply', ZEETEXTDOMAIN), 'title_reply_to' => __('Leave a Reply to %s', ZEETEXTDOMAIN), 'cancel_reply_link' => __('Cancel reply', ZEETEXTDOMAIN), 'label_submit' => __('Post Comment', ZEETEXTDOMAIN), 'format' => 'xhtml');
        $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
        if (comments_open($post_id)) {
            ?>

<?php 
            do_action('comment_form_before');
            ?>

<div id="respond" class="comment-respond">

    <h3 id="reply-title" class="comment-reply-title">
        <?php 
            comment_form_title($args['title_reply'], $args['title_reply_to']);
            ?>
 
        <small><?php 
            cancel_comment_reply_link($args['cancel_reply_link']);
            ?>
</small>
    </h3>

    <?php 
            if (get_option('comment_registration') && !is_user_logged_in()) {
                ?>

    <?php 
                echo $args['must_log_in'];
                ?>

    <?php 
                do_action('comment_form_must_log_in_after');
                ?>

    <?php 
            } else {
                ?>

    <form action="<?php 
                echo site_url('/wp-comments-post.php');
                ?>
" method="post" id="<?php 
                echo esc_attr($args['id_form']);
                ?>
" 
        class="form-horizontal comment-form"<?php 
                echo $html5 ? ' novalidate' : '';
                ?>
 role="form">
        <?php 
                do_action('comment_form_top');
                ?>

        <?php 
                if (is_user_logged_in()) {
                    ?>

        <?php 
                    echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                    ?>

        <?php 
                    do_action('comment_form_logged_in_after', $commenter, $user_identity);
                    ?>

        <?php 
                } else {
                    ?>

        <?php 
                    echo $args['comment_notes_before'];
                    ?>

        <?php 
                    do_action('comment_form_before_fields');
                    foreach ((array) $args['fields'] as $name => $field) {
                        echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                    }
                    do_action('comment_form_after_fields');
                }
                echo apply_filters('comment_form_field_comment', $args['comment_field']);
                echo $args['comment_notes_after'];
                ?>

    <div class="form-submit">
        <input class="btn btn-danger btn-lg" name="submit" type="submit" id="<?php 
                echo esc_attr($args['id_submit']);
                ?>
" value="<?php 
                echo esc_attr($args['label_submit']);
                ?>
" />
        <?php 
                comment_id_fields($post_id);
                ?>
    </div>

    <?php 
                do_action('comment_form', $post_id);
                ?>

</form>

<?php 
            }
            ?>

</div><!-- #respond -->
<?php 
            do_action('comment_form_after');
        } else {
            do_action('comment_form_comments_closed');
        }
    }
        if (!is_user_logged_in()) {
            ?>
<small>Message</small><?php 
        }
        ?>
            <p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>

    <!--<p class="allowed-tags"><small><strong>XHTML:</strong> You can use these tags: <code><?php 
        echo allowed_tags();
        ?>
</code></small></p>-->

          </div>
          <p class="clear"><input name="submit" type="submit" id="submit" tabindex="5" value="Post Comment" />
        <?php 
        comment_id_fields();
        ?>
          </p>

    <?php 
        do_action('comment_form', $post->ID);
        ?>

        </form>

  <?php 
    }
    // If registration required and not logged in
    ?>
    </div>
  </div>
Beispiel #26
0
/**
 * returns the formatted form of the comments
 *
 * @param	array	$args		an array of arguments to be filtered
 * @param	int		$post_id	if form is called within the loop then post_id is optional
 *
 * @return	string	Return the comment form
 */
function sh_comment_form($args = array(), $post_id = null, $review = false)
{
    if (null === $post_id) {
        $post_id = get_the_ID();
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = $user->exists() ? $user->display_name : '';
    $args = wp_parse_args($args);
    if (!isset($args['format'])) {
        $args['format'] = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml';
    }
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $html5 = 'html5' === $args['format'];
    $fields = array('author' => '<div class="col-md-6"><div class="form-group"><input id="author" placeholder="' . esc_html__('Name', SH_NAME) . '" class="form-control" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></div></div>', 'email' => '<div class="col-md-6"><div class="form-group"><input id="email" placeholder="' . esc_html__('Email', SH_NAME) . '" class="form-control" name="email" ' . ($html5 ? 'type="email"' : 'type="text"') . ' value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></div></div>');
    $required_text = sprintf(' ' . esc_html__('Required fields are marked %s', SH_NAME), '<span class="required">*</span>');
    /**
     * Filter the default comment form fields.
     *
     * @since 3.0.0
     *
     * @param array $fields The default comment fields.
     */
    $fields = apply_filters('comment_form_default_fields', $fields);
    $defaults = array('fields' => $fields, 'comment_field' => '<div class="col-md-12"><div class="form-group"><textarea id="comment" placeholder="' . esc_html__('Comment', SH_NAME) . '" class="form-control" name="comment" cols="45" rows="8" aria-required="true"></textarea></div></div>', 'must_log_in' => '<p class="col-md-12 col-sm-12">' . sprintf(esc_html__('You must be <a href="%s">logged in</a> to post a comment.', SH_NAME), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="col-md-12 col-sm-12">' . sprintf(esc_html__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', SH_NAME), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="col-md-12 col-sm-12">' . esc_html__('Your email address will not be published.', SH_NAME) . ($req ? $required_text : '') . '</p>', 'comment_notes_after' => '<p class="col-md-12 col-sm-12">' . sprintf(esc_html__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s', SH_NAME), ' <code>' . allowed_tags() . '</code>') . '</p>', 'id_form' => 'comments_form', 'id_submit' => 'submit', 'title_reply' => esc_html__('Leave a Reply', SH_NAME), 'title_reply_to' => esc_html__('Leave a Reply to %s', SH_NAME), 'cancel_reply_link' => esc_html__('Cancel reply', SH_NAME), 'label_submit' => esc_html__('Send', SH_NAME), 'format' => 'xhtml');
    /**
     * Filter the comment form default arguments.
     *
     * Use 'comment_form_default_fields' to filter the comment fields.
     *
     * @since 3.0.0
     *
     * @param array $defaults The default comment form arguments.
     */
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    ?>
		<?php 
    if (comments_open($post_id)) {
        ?>
			<?php 
        /**
         * Fires before the comment form.
         *
         * @since 3.0.0
         */
        do_action('comment_form_before');
        ?>
			<div id="respond" class="comment-respond">
				
				<div class="post-header">
					<div class="uppercase no-margin h2"><?php 
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        ?>
 <small><?php 
        cancel_comment_reply_link($args['cancel_reply_link']);
        ?>
</small></div>
				</div>	
				
				<?php 
        if (get_option('comment_registration') && !is_user_logged_in()) {
            ?>
					<?php 
            echo blanaceTags($args['must_log_in']);
            ?>
					<?php 
            /**
             * Fires after the HTML-formatted 'must log in after' message in the comment form.
             *
             * @since 3.0.0
             */
            do_action('comment_form_must_log_in_after');
            ?>
				<?php 
        } else {
            ?>
					<form action="<?php 
            echo site_url('/wp-comments-post.php');
            ?>
" method="post" id="<?php 
            echo esc_attr($args['id_form']);
            ?>
" class="row"<?php 
            echo esc_attr($html5) ? ' novalidate' : '';
            ?>
>
						<?php 
            /**
             * Fires at the top of the comment form, inside the <form> tag.
             *
             * @since 3.0.0
             */
            do_action('comment_form_top');
            ?>

						<?php 
            if (is_user_logged_in()) {
                ?>
							<?php 
                /**
                 * Filter the 'logged in' message for the comment form for display.
                 *
                 * @since 3.0.0
                 *
                 * @param string $args['logged_in_as'] The logged-in-as HTML-formatted message.
                 * @param array  $commenter            An array containing the comment author's username, email, and URL.
                 * @param string $user_identity        If the commenter is a registered user, the display name, blank otherwise.
                 */
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                ?>
							<?php 
                /**
                 * Fires after the is_user_logged_in() check in the comment form.
                 *
                 * @since 3.0.0
                 *
                 * @param array  $commenter     An array containing the comment author's username, email, and URL.
                 * @param string $user_identity If the commenter is a registered user, the display name, blank otherwise.
                 */
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
                ?>
						<?php 
            } else {
                ?>
							<?php 
                echo balanceTags($args['comment_notes_before']);
                ?>
							
							
								<?php 
                /**
                 * Fires before the comment fields in the comment form.
                 *
                 * @since 3.0.0
                 */
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    /**
                     * Filter a comment form field for display.
                     *
                     * The dynamic portion of the filter hook, $name, refers to the name
                     * of the comment form field. Such as 'author', 'email', or 'url'.
                     *
                     * @since 3.0.0
                     *
                     * @param string $field The HTML-formatted output of the comment form field.
                     */
                    echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                }
                /**
                 * Fires after the comment fields in the comment form.
                 *
                 * @since 3.0.0
                 */
                do_action('comment_form_after_fields');
                ?>
							
						<?php 
            }
            ?>
						<?php 
            /**
             * Filter the content of the comment textarea field for display.
             *
             * @since 3.0.0
             *
             * @param string $args['comment_field'] The content of the comment textarea field.
             */
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            ?>

						<div class="clearfix"></div>
						
						<?php 
            echo balanceTags($args['comment_notes_after']);
            ?>
						<div class="col-md-12">
							<input name="submit" type="submit" class="btn btn-primary pull-left" id="<?php 
            echo esc_attr($args['id_submit']);
            ?>
" value="<?php 
            echo esc_attr($args['label_submit']);
            ?>
" />
							<?php 
            comment_id_fields($post_id);
            ?>
						</div>
						<?php 
            /**
             * Fires at the bottom of the comment form, inside the closing </form> tag.
             *
             * @since 1.5.2
             *
             * @param int $post_id The post ID.
             */
            do_action('comment_form', $post_id);
            ?>
					</form>
				<?php 
        }
        ?>
			</div><!-- #respond -->
			<?php 
        /**
         * Fires after the comment form.
         *
         * @since 3.0.0
         */
        do_action('comment_form_after');
    } else {
        /**
         * Fires after the comment form if comments are closed.
         *
         * @since 3.0.0
         */
        do_action('comment_form_comments_closed');
    }
}
    function render($params = array())
    {
        global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
        global $gantry;
        $fparams = $this->_getParams($params);
        $comment_layout_name = 'comment_' . $fparams->commentLayout;
        $layout = $gantry->_getLayout($comment_layout_name);
        $className = 'GantryLayout' . ucfirst($comment_layout_name);
        // Do not delete these lines
        ob_start();
        if (post_password_required()) {
            ?>
            <span class="alert"><?php 
            _ge('This post is password protected. Enter the password to view comments.');
            ?>
</span>
            <?php 
            return ob_get_clean();
        }
        ?>
        <!-- You can start editing here. -->
        <?php 
        if (have_comments()) {
            ?>
            <br/>
            <div class="comment-section">
                <div class="contentheading"><?php 
            comments_number(_g('No Comments'), _g('1 Comment'), _g('% Comments'));
            ?>
</div>
            </div>
            <ol class="commentlist">
            <?php 
            wp_list_comments(array('style' => 'ol', 'callback' => array($className, 'render_comment'), 'reply_text' => _g('Reply')));
            ?>
            </ol>
            <div class="rt-pagination nav">
                <div class="alignleft"><?php 
            next_comments_link('&laquo; ' . _g('Older Comments'));
            ?>
</div>
                <div class="alignright"><?php 
            previous_comments_link(_g('Newer Comments') . ' &raquo;');
            ?>
</div>
                <div class="clear"></div>
            </div>
        <?php 
        } else {
            // this is displayed if there are no comments so far
            ?>
            <?php 
            if (comments_open()) {
                ?>
                <!-- If comments are open, but there are no comments. -->
            <?php 
            } else {
                // comments are closed
                ?>
                <!-- If comments are closed. -->
                <div class="attention">
                    <div class="icon"><?php 
                _ge('Comments are closed.');
                ?>
</div>
                </div>
            <?php 
            }
            ?>
        <?php 
        }
        ?>
        <!-- RESPOND -->
        <?php 
        if (comments_open()) {
            ?>
            <div id="respond">
            <div class="comment-section">
                <div class="contentheading"><?php 
            comment_form_title(_g('Leave a Reply'), _g('Leave a Reply to %s'));
            ?>
</div>
            </div>
            <div class="cancel-comment-reply">
                <small><?php 
            cancel_comment_reply_link();
            ?>
</small>
            </div>
            <?php 
            if (get_option('comment_registration') && !is_user_logged_in()) {
                ?>
                <div class="attention">
                    <div class="icon"><?php 
                _ge('You must be');
                ?>
 <a
                            href="<?php 
                echo wp_login_url(get_permalink());
                ?>
"><?php 
                _ge('logged in');
                ?>
</a> <?php 
                _ge('to post a comment.');
                ?>
                    </div>
                </div>
            <?php 
            } else {
                ?>
                <!-- Begin Form -->
                <form action="<?php 
                echo get_option('siteurl');
                ?>
/wp-comments-post.php" method="post" id="commentform">
                    <?php 
                if (is_user_logged_in()) {
                    ?>
                        <p><?php 
                    _ge('Logged in as');
                    ?>
 <a
                                href="<?php 
                    echo get_option('siteurl');
                    ?>
/wp-admin/profile.php"><?php 
                    echo $user_identity;
                    ?>
</a>.
                            <a href="<?php 
                    echo wp_logout_url(get_permalink());
                    ?>
"
                               title="<?php 
                    _ge('Log out of this account');
                    ?>
"><?php 
                    _ge('Log out');
                    ?>
 &raquo;</a></p>
                    <?php 
                } else {
                    ?>
                        <p>
                            <input type="text" name="author" id="author"
                                   onblur="if(this.value=='') this.value='<?php 
                    _ge('Name (Required)');
                    ?>
';"
                                   onfocus="if(this.value=='<?php 
                    _ge('Name (Required)');
                    ?>
') this.value='';"
                                   value="Name (Required)" size="22"
                                   tabindex="1" <?php 
                    if ($req) {
                        echo "aria-required='true'";
                    }
                    ?>
 />
                        </p>
                        <p>
                            <input type="text" name="email" id="email"
                                   onblur="if(this.value=='') this.value='<?php 
                    _ge('E-mail (Required)');
                    ?>
';"
                                   onfocus="if(this.value=='<?php 
                    _ge('E-mail (Required)');
                    ?>
') this.value='';"
                                   value="E-mail (Required)" size="22"
                                   tabindex="2" <?php 
                    if ($req) {
                        echo "aria-required='true'";
                    }
                    ?>
 />
                        </p>
                        <p>
                            <input type="text" name="url" id="url"
                                   onblur="if(this.value=='') this.value='<?php 
                    _ge('Website');
                    ?>
';"
                                   onfocus="if(this.value=='<?php 
                    _ge('Website');
                    ?>
') this.value='';" value="Website" size="22"
                                   tabindex="3"/>
                        </p>
                    <?php 
                }
                ?>
                    <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php 
                echo allowed_tags();
                ?>
</code></small></p>-->
                    <p style="margin: 0;">
                        <textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea>
                    </p><br/>
    
                    <input class="button" name="submit" type="submit" id="submit" tabindex="5"
                           value="<?php 
                _ge('Submit');
                ?>
"/>

                    <div class="clear"></div>
                    <?php 
                comment_id_fields();
                ?>
                    <?php 
                do_action('comment_form', $post->ID);
                ?>
                </form>
            <!-- End Form -->
            <?php 
            }
            // If registration required and not logged in
            ?>
            </div>
        <?php 
        }
        // if you delete this the sky will fall on your head
        ?>
        <?php 
        return ob_get_clean();
    }
Beispiel #28
0
/**
 * Customize comments form
 *
 *@return void
 *@since 1.0
 **/
function oxy_comment_form($args = array(), $post_id = null)
{
    global $user_identity, $id;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '<div class="control-group"><div class="controls"><input id="author" name="author" placeholder="' . __('your name', THEME_FRONT_TD) . '" type="text" class="input-xlarge" value="' . esc_attr($commenter['comment_author']) . '"/></div></div>', 'email' => '<div class="control-group"><div class="controls"><input id="email" name="email" placeholder="' . __('your email address', THEME_FRONT_TD) . '" type="text" class="input-xlarge" value="' . esc_attr($commenter['comment_author_email']) . '" /></div></div>', 'url' => '');
    $required_text = sprintf(' ' . __('Required fields are marked %s', THEME_FRONT_TD), '<span class="required"><a>*</a></span>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<div class="control-group message"><div class="controls"><textarea id="comment" name="comment" placeholder="' . __('add your comment here ', THEME_FRONT_TD) . '" class="input-xxlarge" rows="3"></textarea></div></div>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', THEME_FRONT_TD), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', THEME_FRONT_TD), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '', 'comment_notes_after' => '', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Add your comment', THEME_FRONT_TD), 'title_reply_to' => __('Leave a Reply', THEME_FRONT_TD), 'cancel_reply_link' => __('Cancel reply', THEME_FRONT_TD), 'label_submit' => __('Add comment', THEME_FRONT_TD));
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    ?>
        <?php 
    if (comments_open()) {
        ?>
            <?php 
        do_action('comment_form_before');
        ?>
            <div class="comments-form"  id="respond">
                <h3 id="reply-title" class="comment-form small-screen-center"><?php 
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        ?>
 <small id="cancel-comment-reply"><?php 
        cancel_comment_reply_link('Cancel');
        ?>
</small></h3>
                <?php 
        if (get_option('comment_registration') && !is_user_logged_in()) {
            ?>
                    <?php 
            echo $args['must_log_in'];
            ?>
                    <?php 
            do_action('comment_form_must_log_in_after');
            ?>
                <?php 
        } else {
            ?>
                    <form action="<?php 
            echo site_url('/wp-comments-post.php');
            ?>
" method="post" id="<?php 
            echo esc_attr($args['id_form']);
            ?>
">
                        <fieldset>
                        <?php 
            do_action('comment_form_top');
            ?>
                        <?php 
            if (is_user_logged_in()) {
                ?>
                            <?php 
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                ?>
                            <?php 
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
                ?>
                        <?php 
            } else {
                ?>
                            <?php 
                echo $args['comment_notes_before'];
                ?>
                            <?php 
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    echo apply_filters('comment_form_field_' . $name, $field) . "\n";
                }
                do_action('comment_form_after_fields');
                ?>
                        <?php 
            }
            ?>
                        <?php 
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            ?>
                        <?php 
            echo $args['comment_notes_after'];
            ?>
                        <div class="control-group">
                            <div class="controls small-screen-center">
                                <button name="submit" type="submit" class="btn btn-primary" id="<?php 
            echo esc_attr($args['id_submit']);
            ?>
" value="<?php 
            echo esc_attr($args['label_submit']);
            ?>
"><?php 
            echo esc_attr($args['label_submit']);
            ?>
</button>
                                <?php 
            comment_id_fields();
            ?>
                            </div>
                        </div>


                        <?php 
            do_action('comment_form', $post_id);
            ?>
                        </fieldset>
                    </form>
                <?php 
        }
        ?>
            </div><!-- #respond -->
            <?php 
        do_action('comment_form_after');
        ?>
        <?php 
    } else {
        ?>
            <?php 
        do_action('comment_form_comments_closed');
        ?>
        <?php 
    }
    ?>
    <?php 
}
/**
 * Function Name: origines_comment_form
 * Description: Custom comment form for bootstrap.
 */
function origines_comment_form($args = array(), $post_id = null)
{
    global $id;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = $user->exists() ? $user->display_name : '';
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '<label for="author">' . __('Name') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' />', 'email' => '<label for="email">' . __('Email') . ($req ? ' <span class="required">*</span>' : '') . '</label> ' . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' />', 'url' => '<label for="url">' . __('Website') . '</label>' . '<input id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" />');
    $required_text = sprintf(' ' . __('Required fields are marked %s'), '<span class="required">*</span>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<label for="comment">' . _x('Comment', 'noun') . '</label><textarea id="comment" name="comment" cols="45" rows="4" aria-required="true" class="span9"></textarea>', 'must_log_in' => '<span class="help-block must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</span>', 'logged_in_as' => '<span class="help-block logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</span>', 'comment_notes_before' => '<span class="help-block comment-notes">' . __('Your email address will not be published.') . ($req ? $required_text : '') . '</span>', 'comment_notes_after' => '<span class="help-block form-allowed-tags">' . sprintf(__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s'), ' <code>' . allowed_tags() . '</code>') . '</span>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Leave a Reply'), 'title_reply_to' => __('Leave a Reply to %s'), 'cancel_reply_link' => __('Cancel reply'), 'label_submit' => __('Post Comment'));
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    ?>
		<?php 
    if (comments_open($post_id)) {
        ?>
			
			<?php 
        do_action('comment_form_before');
        ?>

			<div id="respond" class="row">
			<form action="<?php 
        echo site_url('/wp-comments-post.php');
        ?>
" method="post" id="<?php 
        echo esc_attr($args['id_form']);
        ?>
">
  			<fieldset class="span9">
  			<legend><?php 
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        ?>
 <small><?php 
        cancel_comment_reply_link($args['cancel_reply_link']);
        ?>
</small></legend>
  			<?php 
        if (get_option('comment_registration') && !is_user_logged_in()) {
            ?>
				<?php 
            echo $args['must_log_in'];
            ?>
				<?php 
            do_action('comment_form_must_log_in_after');
            ?>
			<?php 
        } else {
            ?>
					<?php 
            do_action('comment_form_top');
            ?>
						<?php 
            if (is_user_logged_in()) {
                ?>
							<?php 
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                ?>
							<?php 
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
                ?>
						<?php 
            } else {
                ?>
							<?php 
                echo $args['comment_notes_before'];
                ?>
							<?php 
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                }
                do_action('comment_form_after_fields');
                ?>
						<?php 
            }
            ?>
						<?php 
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            ?>
						<?php 
            /* echo $args['comment_notes_after']; */
            ?>
						<div class="form-actions">
							<button type="submit" class="btn btn-primary" id="<?php 
            echo esc_attr($args['id_submit']);
            ?>
"><?php 
            echo esc_attr($args['label_submit']);
            ?>
</button>
							<?php 
            comment_id_fields($post_id);
            ?>
						</div>
						<?php 
            do_action('comment_form', $post_id);
            ?>
			<?php 
        }
        ?>
			</fieldset>
			</form>
			</div> <!-- #respond -->

			<?php 
        do_action('comment_form_after');
        ?>

		<?php 
    } else {
        ?>

			<?php 
        do_action('comment_form_comments_closed');
        ?>
			
		<?php 
    }
    ?>
	<?php 
}
Beispiel #30
-3
function m18pud_comment_form($args = array(), $post_id = null)
{
    global $user_identity, $id;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '<p class="comment-form-author">' . '<label for="author">' . ($req ? '<span class="required">*</span>' . __('名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称') . '</label> ' : '') . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . ($req ? '<span class="required">*</span>' . __('Email') . '</label> ' : '') . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></p>', 'url' => '<p class="comment-form-url"><label for="url">' . __('网&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;站') . '</label>' . '<input id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></p>');
    $required_text = sprintf(' ' . __('Required fields are marked %s'), '<span class="required">*</span>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . '<span class="required">*</span>' . _x('评&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;论', 'noun') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.') . ($req ? $required_text : '') . '</p>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Leave a Reply'), 'title_reply_to' => __('Leave a Reply to %s'), 'cancel_reply_link' => __('Cancel reply'), 'label_submit' => __('Post Comment'));
    $args = wp_parse_args($args, apply_filters('comment_form_defaults', $defaults));
    ?>
		<?php 
    if (comments_open()) {
        ?>
			<?php 
        do_action('comment_form_before');
        ?>
			<div id="respond">
				<h3 id="reply-title"><?php 
        comment_form_title($args['title_reply'], $args['title_reply_to']);
        ?>
 <small><?php 
        cancel_comment_reply_link($args['cancel_reply_link']);
        ?>
</small></h3>
				<?php 
        if (get_option('comment_registration') && !is_user_logged_in()) {
            ?>
					<?php 
            echo $args['must_log_in'];
            ?>
					<?php 
            do_action('comment_form_must_log_in_after');
            ?>
				<?php 
        } else {
            ?>
					<form action="<?php 
            echo site_url('/wp-comments-post.php');
            ?>
" method="post" id="<?php 
            echo esc_attr($args['id_form']);
            ?>
">
						<?php 
            do_action('comment_form_top');
            ?>
						<?php 
            if (is_user_logged_in()) {
                ?>
							<?php 
                echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity);
                ?>
							<?php 
                do_action('comment_form_logged_in_after', $commenter, $user_identity);
                ?>
						<?php 
            } else {
                ?>
							<?php 
                echo $args['comment_notes_before'];
                ?>
							<?php 
                do_action('comment_form_before_fields');
                foreach ((array) $args['fields'] as $name => $field) {
                    echo apply_filters("comment_form_field_{$name}", $field) . "\n";
                }
                do_action('comment_form_after_fields');
                ?>
						<?php 
            }
            ?>
						<?php 
            echo apply_filters('comment_form_field_comment', $args['comment_field']);
            ?>
						<?php 
            echo $args['comment_notes_after'];
            ?>
						<p class="form-submit">
							<input name="submit" type="submit" id="<?php 
            echo esc_attr($args['id_submit']);
            ?>
" value="<?php 
            echo esc_attr($args['label_submit']);
            ?>
" />
							<?php 
            comment_id_fields();
            ?>
						</p>
						<?php 
            do_action('comment_form', $post_id);
            ?>
					</form>
				<?php 
        }
        ?>
			</div><!-- #respond -->
			<?php 
        do_action('comment_form_after');
        ?>
		<?php 
    } else {
        ?>
			<?php 
        do_action('comment_form_comments_closed');
        ?>
		<?php 
    }
    ?>
	<?php 
}