mp-wp_genesis           1 <?php
mp-wp_genesis           2 /**
mp-wp_genesis           3  * Comment template functions
mp-wp_genesis           4  *
mp-wp_genesis           5  * These functions are meant to live inside of the WordPress loop.
mp-wp_genesis           6  *
mp-wp_genesis           7  * @package WordPress
mp-wp_genesis           8  * @subpackage Template
mp-wp_genesis           9  */
mp-wp_genesis          10 
mp-wp_genesis          11 /**
mp-wp_genesis          12  * Retrieve the author of the current comment.
mp-wp_genesis          13  *
mp-wp_genesis          14  * If the comment has an empty comment_author field, then 'Anonymous' person is
mp-wp_genesis          15  * assumed.
mp-wp_genesis          16  *
mp-wp_genesis          17  * @since 1.5.0
mp-wp_genesis          18  * @uses apply_filters() Calls 'get_comment_author' hook on the comment author
mp-wp_genesis          19  *
mp-wp_genesis          20  * @return string The comment author
mp-wp_genesis          21  */
mp-wp_genesis          22 function get_comment_author() {
mp-wp_genesis          23 	global $comment;
mp-wp_genesis          24 	if ( empty($comment->comment_author) ) {
mp-wp_genesis          25 		if (!empty($comment->user_id)){
mp-wp_genesis          26 			$user=get_userdata($comment->user_id);
mp-wp_genesis          27 			$author=$user->user_login;
mp-wp_genesis          28 		} else {
mp-wp_genesis          29 			$author = __('Anonymous');
mp-wp_genesis          30 		}
mp-wp_genesis          31 	} else {
mp-wp_genesis          32 		$author = $comment->comment_author;
mp-wp_genesis          33 	}
mp-wp_genesis          34 	return apply_filters('get_comment_author', $author);
mp-wp_genesis          35 }
mp-wp_genesis          36 
mp-wp_genesis          37 /**
mp-wp_genesis          38  * Displays the author of the current comment.
mp-wp_genesis          39  *
mp-wp_genesis          40  * @since 0.71
mp-wp_genesis          41  * @uses apply_filters() Calls 'comment_author' on comment author before displaying
mp-wp_genesis          42  */
mp-wp_genesis          43 function comment_author() {
mp-wp_genesis          44 	$author = apply_filters('comment_author', get_comment_author() );
mp-wp_genesis          45 	echo $author;
mp-wp_genesis          46 }
mp-wp_genesis          47 
mp-wp_genesis          48 /**
mp-wp_genesis          49  * Retrieve the email of the author of the current comment.
mp-wp_genesis          50  *
mp-wp_genesis          51  * @since 1.5.0
mp-wp_genesis          52  * @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email
mp-wp_genesis          53  * @uses $comment
mp-wp_genesis          54  *
mp-wp_genesis          55  * @return string The current comment author's email
mp-wp_genesis          56  */
mp-wp_genesis          57 function get_comment_author_email() {
mp-wp_genesis          58 	global $comment;
mp-wp_genesis          59 	return apply_filters('get_comment_author_email', $comment->comment_author_email);
mp-wp_genesis          60 }
mp-wp_genesis          61 
mp-wp_genesis          62 /**
mp-wp_genesis          63  * Display the email of the author of the current global $comment.
mp-wp_genesis          64  *
mp-wp_genesis          65  * Care should be taken to protect the email address and assure that email
mp-wp_genesis          66  * harvesters do not capture your commentors' email address. Most assume that
mp-wp_genesis          67  * their email address will not appear in raw form on the blog. Doing so will
mp-wp_genesis          68  * enable anyone, including those that people don't want to get the email
mp-wp_genesis          69  * address and use it for their own means good and bad.
mp-wp_genesis          70  *
mp-wp_genesis          71  * @since 0.71
mp-wp_genesis          72  * @uses apply_filters() Calls 'author_email' hook on the author email
mp-wp_genesis          73  */
mp-wp_genesis          74 function comment_author_email() {
mp-wp_genesis          75 	echo apply_filters('author_email', get_comment_author_email() );
mp-wp_genesis          76 }
mp-wp_genesis          77 
mp-wp_genesis          78 /**
mp-wp_genesis          79  * Display the html email link to the author of the current comment.
mp-wp_genesis          80  *
mp-wp_genesis          81  * Care should be taken to protect the email address and assure that email
mp-wp_genesis          82  * harvesters do not capture your commentors' email address. Most assume that
mp-wp_genesis          83  * their email address will not appear in raw form on the blog. Doing so will
mp-wp_genesis          84  * enable anyone, including those that people don't want to get the email
mp-wp_genesis          85  * address and use it for their own means good and bad.
mp-wp_genesis          86  *
mp-wp_genesis          87  * @since 0.71
mp-wp_genesis          88  * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email
mp-wp_genesis          89  * @uses get_comment_author_email_link() For generating the link
mp-wp_genesis          90  * @global object $comment The current Comment row object
mp-wp_genesis          91  *
mp-wp_genesis          92  * @param string $linktext The text to display instead of the comment author's email address
mp-wp_genesis          93  * @param string $before The text or HTML to display before the email link.
mp-wp_genesis          94  * @param string $after The text or HTML to display after the email link.
mp-wp_genesis          95  */
mp-wp_genesis          96 function comment_author_email_link($linktext='', $before='', $after='') {
mp-wp_genesis          97 	if ( $link = get_comment_author_email_link( $linktext, $before, $after ) )
mp-wp_genesis          98 		echo $link;
mp-wp_genesis          99 }
mp-wp_genesis         100 
mp-wp_genesis         101 /**
mp-wp_genesis         102  * Return the html email link to the author of the current comment.
mp-wp_genesis         103  *
mp-wp_genesis         104  * Care should be taken to protect the email address and assure that email
mp-wp_genesis         105  * harvesters do not capture your commentors' email address. Most assume that
mp-wp_genesis         106  * their email address will not appear in raw form on the blog. Doing so will
mp-wp_genesis         107  * enable anyone, including those that people don't want to get the email
mp-wp_genesis         108  * address and use it for their own means good and bad.
mp-wp_genesis         109  *
mp-wp_genesis         110  * @since 2.7
mp-wp_genesis         111  * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email
mp-wp_genesis         112  * @global object $comment The current Comment row object
mp-wp_genesis         113  *
mp-wp_genesis         114  * @param string $linktext The text to display instead of the comment author's email address
mp-wp_genesis         115  * @param string $before The text or HTML to display before the email link.
mp-wp_genesis         116  * @param string $after The text or HTML to display after the email link.
mp-wp_genesis         117  */
mp-wp_genesis         118 function get_comment_author_email_link($linktext='', $before='', $after='') {
mp-wp_genesis         119 	global $comment;
mp-wp_genesis         120 	$email = apply_filters('comment_email', $comment->comment_author_email);
mp-wp_genesis         121 	if ((!empty($email)) && ($email != '@')) {
mp-wp_genesis         122 	$display = ($linktext != '') ? $linktext : $email;
mp-wp_genesis         123 		$return  = $before;
mp-wp_genesis         124 		$return .= "<a href='mailto:$email'>$display</a>";
mp-wp_genesis         125 	 	$return .= $after;
mp-wp_genesis         126 		return $return;
mp-wp_genesis         127 	} else {
mp-wp_genesis         128 		return '';
mp-wp_genesis         129 	}
mp-wp_genesis         130 }
mp-wp_genesis         131 
mp-wp_genesis         132 /**
mp-wp_genesis         133  * Retrieve the html link to the url of the author of the current comment.
mp-wp_genesis         134  *
mp-wp_genesis         135  * @since 1.5.0
mp-wp_genesis         136  * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author
mp-wp_genesis         137  *
mp-wp_genesis         138  * @return string Comment Author name or HTML link for author's URL
mp-wp_genesis         139  */
mp-wp_genesis         140 function get_comment_author_link() {
mp-wp_genesis         141 	/** @todo Only call these functions when they are needed. Include in if... else blocks */
mp-wp_genesis         142 	$url    = get_comment_author_url();
mp-wp_genesis         143 	$author = get_comment_author();
mp-wp_genesis         144 
mp-wp_genesis         145 	if ( empty( $url ) || 'http://' == $url )
mp-wp_genesis         146 		$return = $author;
mp-wp_genesis         147 	else
mp-wp_genesis         148 // Removed rel='external nofollow' from here
mp-wp_genesis         149 		$return = "<a href='$url' class='url'>$author</a>";
mp-wp_genesis         150 	return apply_filters('get_comment_author_link', $return);
mp-wp_genesis         151 }
mp-wp_genesis         152 
mp-wp_genesis         153 /**
mp-wp_genesis         154  * Display the html link to the url of the author of the current comment.
mp-wp_genesis         155  *
mp-wp_genesis         156  * @since 0.71
mp-wp_genesis         157  * @see get_comment_author_link() Echos result
mp-wp_genesis         158  */
mp-wp_genesis         159 function comment_author_link() {
mp-wp_genesis         160 	echo get_comment_author_link();
mp-wp_genesis         161 }
mp-wp_genesis         162 
mp-wp_genesis         163 /**
mp-wp_genesis         164  * Retrieve the IP address of the author of the current comment.
mp-wp_genesis         165  *
mp-wp_genesis         166  * @since 1.5.0
mp-wp_genesis         167  * @uses $comment
mp-wp_genesis         168  * @uses apply_filters()
mp-wp_genesis         169  *
mp-wp_genesis         170  * @return unknown
mp-wp_genesis         171  */
mp-wp_genesis         172 function get_comment_author_IP() {
mp-wp_genesis         173 	global $comment;
mp-wp_genesis         174 	return apply_filters('get_comment_author_IP', $comment->comment_author_IP);
mp-wp_genesis         175 }
mp-wp_genesis         176 
mp-wp_genesis         177 /**
mp-wp_genesis         178  * Display the IP address of the author of the current comment.
mp-wp_genesis         179  *
mp-wp_genesis         180  * @since 0.71
mp-wp_genesis         181  * @see get_comment_author_IP() Echos Result
mp-wp_genesis         182  */
mp-wp_genesis         183 function comment_author_IP() {
mp-wp_genesis         184 	echo get_comment_author_IP();
mp-wp_genesis         185 }
mp-wp_genesis         186 
mp-wp_genesis         187 /**
mp-wp_genesis         188  * Retrieve the url of the author of the current comment.
mp-wp_genesis         189  *
mp-wp_genesis         190  * @since 1.5.0
mp-wp_genesis         191  * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL
mp-wp_genesis         192  *
mp-wp_genesis         193  * @return string
mp-wp_genesis         194  */
mp-wp_genesis         195 function get_comment_author_url() {
mp-wp_genesis         196 	global $comment;
mp-wp_genesis         197 	return apply_filters('get_comment_author_url', $comment->comment_author_url);
mp-wp_genesis         198 }
mp-wp_genesis         199 
mp-wp_genesis         200 /**
mp-wp_genesis         201  * Display the url of the author of the current comment.
mp-wp_genesis         202  *
mp-wp_genesis         203  * @since 0.71
mp-wp_genesis         204  * @uses apply_filters()
mp-wp_genesis         205  * @uses get_comment_author_url() Retrieves the comment author's URL
mp-wp_genesis         206  */
mp-wp_genesis         207 function comment_author_url() {
mp-wp_genesis         208 	echo apply_filters('comment_url', get_comment_author_url());
mp-wp_genesis         209 }
mp-wp_genesis         210 
mp-wp_genesis         211 /**
mp-wp_genesis         212  * Retrieves the HTML link of the url of the author of the current comment.
mp-wp_genesis         213  *
mp-wp_genesis         214  * $linktext parameter is only used if the URL does not exist for the comment
mp-wp_genesis         215  * author. If the URL does exist then the URL will be used and the $linktext
mp-wp_genesis         216  * will be ignored.
mp-wp_genesis         217  *
mp-wp_genesis         218  * Encapsulate the HTML link between the $before and $after. So it will appear
mp-wp_genesis         219  * in the order of $before, link, and finally $after.
mp-wp_genesis         220  *
mp-wp_genesis         221  * @since 1.5.0
mp-wp_genesis         222  * @uses apply_filters() Calls the 'get_comment_author_url_link' on the complete HTML before returning.
mp-wp_genesis         223  *
mp-wp_genesis         224  * @param string $linktext The text to display instead of the comment author's email address
mp-wp_genesis         225  * @param string $before The text or HTML to display before the email link.
mp-wp_genesis         226  * @param string $after The text or HTML to display after the email link.
mp-wp_genesis         227  * @return string The HTML link between the $before and $after parameters
mp-wp_genesis         228  */
mp-wp_genesis         229 function get_comment_author_url_link( $linktext = '', $before = '', $after = '' ) {
mp-wp_genesis         230 	$url = get_comment_author_url();
mp-wp_genesis         231 	$display = ($linktext != '') ? $linktext : $url;
mp-wp_genesis         232 	$display = str_replace( 'http://www.', '', $display );
mp-wp_genesis         233 	$display = str_replace( 'http://', '', $display );
mp-wp_genesis         234 	if ( '/' == substr($display, -1) )
mp-wp_genesis         235 		$display = substr($display, 0, -1);
mp-wp_genesis         236 	$return = "$before<a href='$url' rel='external'>$display</a>$after";
mp-wp_genesis         237 	return apply_filters('get_comment_author_url_link', $return);
mp-wp_genesis         238 }
mp-wp_genesis         239 
mp-wp_genesis         240 /**
mp-wp_genesis         241  * Displays the HTML link of the url of the author of the current comment.
mp-wp_genesis         242  *
mp-wp_genesis         243  * @since 0.71
mp-wp_genesis         244  * @see get_comment_author_url_link() Echos result
mp-wp_genesis         245  *
mp-wp_genesis         246  * @param string $linktext The text to display instead of the comment author's email address
mp-wp_genesis         247  * @param string $before The text or HTML to display before the email link.
mp-wp_genesis         248  * @param string $after The text or HTML to display after the email link.
mp-wp_genesis         249  */
mp-wp_genesis         250 function comment_author_url_link( $linktext = '', $before = '', $after = '' ) {
mp-wp_genesis         251 	echo get_comment_author_url_link( $linktext, $before, $after );
mp-wp_genesis         252 }
mp-wp_genesis         253 
mp-wp_genesis         254 /**
mp-wp_genesis         255  * Generates semantic classes for each comment element
mp-wp_genesis         256  *
mp-wp_genesis         257  * @since 2.7.0
mp-wp_genesis         258  *
mp-wp_genesis         259  * @param string|array $class One or more classes to add to the class list
mp-wp_genesis         260  * @param int $comment_id An optional comment ID
mp-wp_genesis         261  * @param int $post_id An optional post ID
mp-wp_genesis         262  * @param bool $echo Whether comment_class should echo or return
mp-wp_genesis         263  */
mp-wp_genesis         264 function comment_class( $class = '', $comment_id = null, $post_id = null, $echo = true ) {
mp-wp_genesis         265 	// Separates classes with a single space, collates classes for comment DIV
mp-wp_genesis         266 	$class = 'class="' . join( ' ', get_comment_class( $class, $comment_id, $post_id ) ) . '"';
mp-wp_genesis         267 	if ( $echo)
mp-wp_genesis         268 		echo $class;
mp-wp_genesis         269 	else
mp-wp_genesis         270 		return $class;
mp-wp_genesis         271 }
mp-wp_genesis         272 
mp-wp_genesis         273 /**
mp-wp_genesis         274  * Returns the classes for the comment div as an array
mp-wp_genesis         275  *
mp-wp_genesis         276  * @since 2.7.0
mp-wp_genesis         277  *
mp-wp_genesis         278  * @param string|array $class One or more classes to add to the class list
mp-wp_genesis         279  * @param int $comment_id An optional comment ID
mp-wp_genesis         280  * @param int $post_id An optional post ID
mp-wp_genesis         281  * @return array Array of classes
mp-wp_genesis         282  */
mp-wp_genesis         283 function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
mp-wp_genesis         284 	global $comment_alt, $comment_depth, $comment_thread_alt;
mp-wp_genesis         285 
mp-wp_genesis         286 	$comment = get_comment($comment_id);
mp-wp_genesis         287 
mp-wp_genesis         288 	$classes = array();
mp-wp_genesis         289 
mp-wp_genesis         290 	// Get the comment type (comment, trackback),
mp-wp_genesis         291 	$classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
mp-wp_genesis         292 
mp-wp_genesis         293 	// If the comment author has an id (registered), then print the log in name
mp-wp_genesis         294 	if ( $comment->user_id > 0 && $user = get_userdata($comment->user_id) ) {
mp-wp_genesis         295 		// For all registered users, 'byuser'
mp-wp_genesis         296 		$classes[] = 'byuser comment-author-' . $user->user_nicename;
mp-wp_genesis         297 		// For comment authors who are the author of the post
mp-wp_genesis         298 		if ( $post = get_post($post_id) ) {
mp-wp_genesis         299 			if ( $comment->user_id === $post->post_author )
mp-wp_genesis         300 				$classes[] = 'bypostauthor';
mp-wp_genesis         301 		}
mp-wp_genesis         302 	}
mp-wp_genesis         303 
mp-wp_genesis         304 	if ( empty($comment_alt) )
mp-wp_genesis         305 		$comment_alt = 0;
mp-wp_genesis         306 	if ( empty($comment_depth) )
mp-wp_genesis         307 		$comment_depth = 1;
mp-wp_genesis         308 	if ( empty($comment_thread_alt) )
mp-wp_genesis         309 		$comment_thread_alt = 0;
mp-wp_genesis         310 
mp-wp_genesis         311 	if ( $comment_alt % 2 ) {
mp-wp_genesis         312 		$classes[] = 'odd';
mp-wp_genesis         313 		$classes[] = 'alt';
mp-wp_genesis         314 	} else {
mp-wp_genesis         315 		$classes[] = 'even';
mp-wp_genesis         316 	}
mp-wp_genesis         317 
mp-wp_genesis         318 	$comment_alt++;
mp-wp_genesis         319 
mp-wp_genesis         320 	// Alt for top-level comments
mp-wp_genesis         321 	if ( 1 == $comment_depth ) {
mp-wp_genesis         322 		if ( $comment_thread_alt % 2 ) {
mp-wp_genesis         323 			$classes[] = 'thread-odd';
mp-wp_genesis         324 			$classes[] = 'thread-alt';
mp-wp_genesis         325 		} else {
mp-wp_genesis         326 			$classes[] = 'thread-even';
mp-wp_genesis         327 		}
mp-wp_genesis         328 		$comment_thread_alt++;
mp-wp_genesis         329 	}
mp-wp_genesis         330 
mp-wp_genesis         331 	$classes[] = "depth-$comment_depth";
mp-wp_genesis         332 
mp-wp_genesis         333 	if ( !empty($class) ) {
mp-wp_genesis         334 		if ( !is_array( $class ) )
mp-wp_genesis         335 			$class = preg_split('#\s+#', $class);
mp-wp_genesis         336 		$classes = array_merge($classes, $class);
mp-wp_genesis         337 	}
mp-wp_genesis         338 
mp-wp_genesis         339 	return apply_filters('comment_class', $classes, $class, $comment_id, $post_id);
mp-wp_genesis         340 }
mp-wp_genesis         341 
mp-wp_genesis         342 /**
mp-wp_genesis         343  * Retrieve the comment date of the current comment.
mp-wp_genesis         344  *
mp-wp_genesis         345  * @since 1.5.0
mp-wp_genesis         346  * @uses apply_filters() Calls 'get_comment_date' hook with the formated date and the $d parameter respectively
mp-wp_genesis         347  * @uses $comment
mp-wp_genesis         348  *
mp-wp_genesis         349  * @param string $d The format of the date (defaults to user's config)
mp-wp_genesis         350  * @return string The comment's date
mp-wp_genesis         351  */
mp-wp_genesis         352 function get_comment_date( $d = '' ) {
mp-wp_genesis         353 	global $comment;
mp-wp_genesis         354 	if ( '' == $d )
mp-wp_genesis         355 		$date = mysql2date( get_option('date_format'), $comment->comment_date);
mp-wp_genesis         356 	else
mp-wp_genesis         357 		$date = mysql2date($d, $comment->comment_date);
mp-wp_genesis         358 	return apply_filters('get_comment_date', $date, $d);
mp-wp_genesis         359 }
mp-wp_genesis         360 
mp-wp_genesis         361 /**
mp-wp_genesis         362  * Display the comment date of the current comment.
mp-wp_genesis         363  *
mp-wp_genesis         364  * @since 0.71
mp-wp_genesis         365  *
mp-wp_genesis         366  * @param string $d The format of the date (defaults to user's config)
mp-wp_genesis         367  */
mp-wp_genesis         368 function comment_date( $d = '' ) {
mp-wp_genesis         369 	echo get_comment_date( $d );
mp-wp_genesis         370 }
mp-wp_genesis         371 
mp-wp_genesis         372 /**
mp-wp_genesis         373  * Retrieve the excerpt of the current comment.
mp-wp_genesis         374  *
mp-wp_genesis         375  * Will cut each word and only output the first 20 words with '...' at the end.
mp-wp_genesis         376  * If the word count is less than 20, then no truncating is done and no '...'
mp-wp_genesis         377  * will appear.
mp-wp_genesis         378  *
mp-wp_genesis         379  * @since 1.5.0
mp-wp_genesis         380  * @uses $comment
mp-wp_genesis         381  * @uses apply_filters() Calls 'get_comment_excerpt' on truncated comment
mp-wp_genesis         382  *
mp-wp_genesis         383  * @return string The maybe truncated comment with 20 words or less
mp-wp_genesis         384  */
mp-wp_genesis         385 function get_comment_excerpt() {
mp-wp_genesis         386 	global $comment;
mp-wp_genesis         387 	$comment_text = strip_tags($comment->comment_content);
mp-wp_genesis         388 	$blah = explode(' ', $comment_text);
mp-wp_genesis         389 	if (count($blah) > 20) {
mp-wp_genesis         390 		$k = 20;
mp-wp_genesis         391 		$use_dotdotdot = 1;
mp-wp_genesis         392 	} else {
mp-wp_genesis         393 		$k = count($blah);
mp-wp_genesis         394 		$use_dotdotdot = 0;
mp-wp_genesis         395 	}
mp-wp_genesis         396 	$excerpt = '';
mp-wp_genesis         397 	for ($i=0; $i<$k; $i++) {
mp-wp_genesis         398 		$excerpt .= $blah[$i] . ' ';
mp-wp_genesis         399 	}
mp-wp_genesis         400 	$excerpt .= ($use_dotdotdot) ? '...' : '';
mp-wp_genesis         401 	return apply_filters('get_comment_excerpt', $excerpt);
mp-wp_genesis         402 }
mp-wp_genesis         403 
mp-wp_genesis         404 /**
mp-wp_genesis         405  * Display the excerpt of the current comment.
mp-wp_genesis         406  *
mp-wp_genesis         407  * @since 1.2.0
mp-wp_genesis         408  * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt
mp-wp_genesis         409  */
mp-wp_genesis         410 function comment_excerpt() {
mp-wp_genesis         411 	echo apply_filters('comment_excerpt', get_comment_excerpt() );
mp-wp_genesis         412 }
mp-wp_genesis         413 
mp-wp_genesis         414 /**
mp-wp_genesis         415  * Retrieve the comment id of the current comment.
mp-wp_genesis         416  *
mp-wp_genesis         417  * @since 1.5.0
mp-wp_genesis         418  * @uses $comment
mp-wp_genesis         419  * @uses apply_filters() Calls the 'get_comment_ID' hook for the comment ID
mp-wp_genesis         420  *
mp-wp_genesis         421  * @return int The comment ID
mp-wp_genesis         422  */
mp-wp_genesis         423 function get_comment_ID() {
mp-wp_genesis         424 	global $comment;
mp-wp_genesis         425 	return apply_filters('get_comment_ID', $comment->comment_ID);
mp-wp_genesis         426 }
mp-wp_genesis         427 
mp-wp_genesis         428 /**
mp-wp_genesis         429  * Displays the comment id of the current comment.
mp-wp_genesis         430  *
mp-wp_genesis         431  * @since 0.71
mp-wp_genesis         432  * @see get_comment_ID() Echos Result
mp-wp_genesis         433  */
mp-wp_genesis         434 function comment_ID() {
mp-wp_genesis         435 	echo get_comment_ID();
mp-wp_genesis         436 }
mp-wp_genesis         437 
mp-wp_genesis         438 /**
mp-wp_genesis         439  * Retrieve the link to a given comment.
mp-wp_genesis         440  *
mp-wp_genesis         441  * @since 1.5.0
mp-wp_genesis         442  * @uses $comment
mp-wp_genesis         443  *
mp-wp_genesis         444  * @param object|string|int $comment Comment to retrieve.
mp-wp_genesis         445  * @param array $args Optional args.
mp-wp_genesis         446  * @return string The permalink to the current comment
mp-wp_genesis         447  */
mp-wp_genesis         448 function get_comment_link( $comment = null, $args = array() ) {
mp-wp_genesis         449 	global $wp_rewrite, $in_comment_loop;
mp-wp_genesis         450 
mp-wp_genesis         451 	$comment = get_comment($comment);
mp-wp_genesis         452 
mp-wp_genesis         453 	// Backwards compat
mp-wp_genesis         454 	if ( !is_array($args) ) {
mp-wp_genesis         455 		$page = $args;
mp-wp_genesis         456 		$args = array();
mp-wp_genesis         457 		$args['page'] = $page;
mp-wp_genesis         458 	}
mp-wp_genesis         459 
mp-wp_genesis         460 	$defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
mp-wp_genesis         461 	$args = wp_parse_args( $args, $defaults );
mp-wp_genesis         462 
mp-wp_genesis         463 	if ( '' === $args['per_page'] && get_option('page_comments') )
mp-wp_genesis         464 		$args['per_page'] = get_option('comments_per_page');
mp-wp_genesis         465 
mp-wp_genesis         466 	if ( empty($args['per_page']) ) {
mp-wp_genesis         467 		$args['per_page'] = 0;
mp-wp_genesis         468 		$args['page'] = 0;
mp-wp_genesis         469 	}
mp-wp_genesis         470 
mp-wp_genesis         471 	if ( $args['per_page'] ) {
mp-wp_genesis         472 		if ( '' == $args['page'] )
mp-wp_genesis         473 			$args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args );
mp-wp_genesis         474 
mp-wp_genesis         475 		if ( $wp_rewrite->using_permalinks() )
mp-wp_genesis         476 			return user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' ) . '#comment-' . $comment->comment_ID;
mp-wp_genesis         477 		else
mp-wp_genesis         478 			return add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ) . '#comment-' . $comment->comment_ID;
mp-wp_genesis         479 	} else {
mp-wp_genesis         480 		return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
mp-wp_genesis         481 	}
mp-wp_genesis         482 }
mp-wp_genesis         483 
mp-wp_genesis         484 /**
mp-wp_genesis         485  * Retrieves the link to the current post comments.
mp-wp_genesis         486  *
mp-wp_genesis         487  * @since 1.5.0
mp-wp_genesis         488  *
mp-wp_genesis         489  * @return string The link to the comments
mp-wp_genesis         490  */
mp-wp_genesis         491 function get_comments_link() {
mp-wp_genesis         492 	return get_permalink() . '#comments';
mp-wp_genesis         493 }
mp-wp_genesis         494 
mp-wp_genesis         495 /**
mp-wp_genesis         496  * Displays the link to the current post comments.
mp-wp_genesis         497  *
mp-wp_genesis         498  * @since 0.71
mp-wp_genesis         499  *
mp-wp_genesis         500  * @param string $deprecated Not Used
mp-wp_genesis         501  * @param bool $deprecated Not Used
mp-wp_genesis         502  */
mp-wp_genesis         503 function comments_link( $deprecated = '', $deprecated = '' ) {
mp-wp_genesis         504 	echo get_comments_link();
mp-wp_genesis         505 }
mp-wp_genesis         506 
mp-wp_genesis         507 /**
mp-wp_genesis         508  * Retrieve the amount of comments a post has.
mp-wp_genesis         509  *
mp-wp_genesis         510  * @since 1.5.0
mp-wp_genesis         511  * @uses apply_filters() Calls the 'get_comments_number' hook on the number of comments
mp-wp_genesis         512  *
mp-wp_genesis         513  * @param int $post_id The Post ID
mp-wp_genesis         514  * @return int The number of comments a post has
mp-wp_genesis         515  */
mp-wp_genesis         516 function get_comments_number( $post_id = 0 ) {
mp-wp_genesis         517 	global $id;
mp-wp_genesis         518 	$post_id = (int) $post_id;
mp-wp_genesis         519 
mp-wp_genesis         520 	if ( !$post_id )
mp-wp_genesis         521 		$post_id = (int) $id;
mp-wp_genesis         522 
mp-wp_genesis         523 	$post = get_post($post_id);
mp-wp_genesis         524 	if ( ! isset($post->comment_count) )
mp-wp_genesis         525 		$count = 0;
mp-wp_genesis         526 	else
mp-wp_genesis         527 		$count = $post->comment_count;
mp-wp_genesis         528 
mp-wp_genesis         529 	return apply_filters('get_comments_number', $count);
mp-wp_genesis         530 }
mp-wp_genesis         531 
mp-wp_genesis         532 /**
mp-wp_genesis         533  * Display the language string for the number of comments the current post has.
mp-wp_genesis         534  *
mp-wp_genesis         535  * @since 0.71
mp-wp_genesis         536  * @uses $id
mp-wp_genesis         537  * @uses apply_filters() Calls the 'comments_number' hook on the output and number of comments respectively.
mp-wp_genesis         538  *
mp-wp_genesis         539  * @param string $zero Text for no comments
mp-wp_genesis         540  * @param string $one Text for one comment
mp-wp_genesis         541  * @param string $more Text for more than one comment
mp-wp_genesis         542  * @param string $deprecated Not used.
mp-wp_genesis         543  */
mp-wp_genesis         544 function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
mp-wp_genesis         545 	global $id;
mp-wp_genesis         546 	$number = get_comments_number($id);
mp-wp_genesis         547 
mp-wp_genesis         548 	if ( $number > 1 )
mp-wp_genesis         549 		$output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
mp-wp_genesis         550 	elseif ( $number == 0 )
mp-wp_genesis         551 		$output = ( false === $zero ) ? __('No Comments') : $zero;
mp-wp_genesis         552 	else // must be one
mp-wp_genesis         553 		$output = ( false === $one ) ? __('1 Comment') : $one;
mp-wp_genesis         554 
mp-wp_genesis         555 	echo apply_filters('comments_number', $output, $number);
mp-wp_genesis         556 }
mp-wp_genesis         557 
mp-wp_genesis         558 /**
mp-wp_genesis         559  * Retrieve the text of the current comment.
mp-wp_genesis         560  *
mp-wp_genesis         561  * @since 1.5.0
mp-wp_genesis         562  * @uses $comment
mp-wp_genesis         563  *
mp-wp_genesis         564  * @return string The comment content
mp-wp_genesis         565  */
mp-wp_genesis         566 function get_comment_text() {
mp-wp_genesis         567 	global $comment;
mp-wp_genesis         568 	return apply_filters('get_comment_text', $comment->comment_content);
mp-wp_genesis         569 }
mp-wp_genesis         570 
mp-wp_genesis         571 /**
mp-wp_genesis         572  * Displays the text of the current comment.
mp-wp_genesis         573  *
mp-wp_genesis         574  * @since 0.71
mp-wp_genesis         575  * @uses apply_filters() Passes the comment content through the 'comment_text' hook before display
mp-wp_genesis         576  * @uses get_comment_text() Gets the comment content
mp-wp_genesis         577 
mp-wp_genesis         578 hacked for pgp.
mp-wp_genesis         579  */
mp-wp_genesis         580 function comment_text() {
mp-wp_genesis         581 	
mp-wp_genesis         582 	$comment_content = get_comment_text();
mp-wp_genesis         583 
mp-wp_genesis         584 	$dead = array("\n", '  ');
mp-wp_genesis         585 	$live   = array('<br />', '  ');
mp-wp_genesis         586 
mp-wp_genesis         587 	if (strpos($comment_content,"----BEGIN PGP ")>0) 
mp-wp_genesis         588 			echo str_replace($dead, $live, str_replace("\r\n","\n",strip_tags($comment_content)));
mp-wp_genesis         589 		else echo apply_filters('comment_text', $comment_content);
mp-wp_genesis         590 }
mp-wp_genesis         591 
mp-wp_genesis         592 /**
mp-wp_genesis         593  * Retrieve the comment time of the current comment.
mp-wp_genesis         594  *
mp-wp_genesis         595  * @since 1.5.0
mp-wp_genesis         596  * @uses $comment
mp-wp_genesis         597  * @uses apply_filter() Calls 'get_comment_time' hook with the formatted time, the $d parameter, and $gmt parameter passed.
mp-wp_genesis         598  *
mp-wp_genesis         599  * @param string $d Optional. The format of the time (defaults to user's config)
mp-wp_genesis         600  * @param bool $gmt Whether to use the GMT date
mp-wp_genesis         601  * @return string The formatted time
mp-wp_genesis         602  */
mp-wp_genesis         603 function get_comment_time( $d = '', $gmt = false ) {
mp-wp_genesis         604 	global $comment;
mp-wp_genesis         605 	$comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date;
mp-wp_genesis         606 	if ( '' == $d )
mp-wp_genesis         607 		$date = mysql2date(get_option('time_format'), $comment_date);
mp-wp_genesis         608 	else
mp-wp_genesis         609 		$date = mysql2date($d, $comment_date);
mp-wp_genesis         610 	return apply_filters('get_comment_time', $date, $d, $gmt);
mp-wp_genesis         611 }
mp-wp_genesis         612 
mp-wp_genesis         613 /**
mp-wp_genesis         614  * Display the comment time of the current comment.
mp-wp_genesis         615  *
mp-wp_genesis         616  * @since 0.71
mp-wp_genesis         617  *
mp-wp_genesis         618  * @param string $d Optional. The format of the time (defaults to user's config)
mp-wp_genesis         619  */
mp-wp_genesis         620 function comment_time( $d = '' ) {
mp-wp_genesis         621 	echo get_comment_time($d);
mp-wp_genesis         622 }
mp-wp_genesis         623 
mp-wp_genesis         624 /**
mp-wp_genesis         625  * Retrieve the comment type of the current comment.
mp-wp_genesis         626  *
mp-wp_genesis         627  * @since 1.5.0
mp-wp_genesis         628  * @uses $comment
mp-wp_genesis         629  * @uses apply_filters() Calls the 'get_comment_type' hook on the comment type
mp-wp_genesis         630  *
mp-wp_genesis         631  * @return string The comment type
mp-wp_genesis         632  */
mp-wp_genesis         633 function get_comment_type() {
mp-wp_genesis         634 	global $comment;
mp-wp_genesis         635 
mp-wp_genesis         636 	if ( '' == $comment->comment_type )
mp-wp_genesis         637 		$comment->comment_type = 'comment';
mp-wp_genesis         638 
mp-wp_genesis         639 	return apply_filters('get_comment_type', $comment->comment_type);
mp-wp_genesis         640 }
mp-wp_genesis         641 
mp-wp_genesis         642 /**
mp-wp_genesis         643  * Display the comment type of the current comment.
mp-wp_genesis         644  *
mp-wp_genesis         645  * @since 0.71
mp-wp_genesis         646  *
mp-wp_genesis         647  * @param string $commenttxt The string to display for comment type
mp-wp_genesis         648  * @param string $trackbacktxt The string to display for trackback type
mp-wp_genesis         649  * @param string $pingbacktxt The string to display for pingback type
mp-wp_genesis         650  */
mp-wp_genesis         651 function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') {
mp-wp_genesis         652 	$type = get_comment_type();
mp-wp_genesis         653 	switch( $type ) {
mp-wp_genesis         654 		case 'trackback' :
mp-wp_genesis         655 			echo $trackbacktxt;
mp-wp_genesis         656 			break;
mp-wp_genesis         657 		case 'pingback' :
mp-wp_genesis         658 			echo $pingbacktxt;
mp-wp_genesis         659 			break;
mp-wp_genesis         660 		default :
mp-wp_genesis         661 			echo $commenttxt;
mp-wp_genesis         662 	}
mp-wp_genesis         663 }
mp-wp_genesis         664 
mp-wp_genesis         665 /**
mp-wp_genesis         666  * Retrieve The current post's trackback URL.
mp-wp_genesis         667  *
mp-wp_genesis         668  * There is a check to see if permalink's have been enabled and if so, will
mp-wp_genesis         669  * retrieve the pretty path. If permalinks weren't enabled, the ID of the
mp-wp_genesis         670  * current post is used and appended to the correct page to go to.
mp-wp_genesis         671  *
mp-wp_genesis         672  * @since 1.5.0
mp-wp_genesis         673  * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
mp-wp_genesis         674  * @uses $id
mp-wp_genesis         675  *
mp-wp_genesis         676  * @return string The trackback URL after being filtered
mp-wp_genesis         677  */
mp-wp_genesis         678 function get_trackback_url() {
mp-wp_genesis         679 	global $id;
mp-wp_genesis         680 	if ( '' != get_option('permalink_structure') ) {
mp-wp_genesis         681 		$tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback');
mp-wp_genesis         682 	} else {
mp-wp_genesis         683 		$tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id;
mp-wp_genesis         684 	}
mp-wp_genesis         685 	return apply_filters('trackback_url', $tb_url);
mp-wp_genesis         686 }
mp-wp_genesis         687 
mp-wp_genesis         688 /**
mp-wp_genesis         689  * Displays the current post's trackback URL.
mp-wp_genesis         690  *
mp-wp_genesis         691  * @since 0.71
mp-wp_genesis         692  * @uses get_trackback_url() Gets the trackback url for the current post
mp-wp_genesis         693  *
mp-wp_genesis         694  * @param bool $deprecated Remove backwards compat in 2.5
mp-wp_genesis         695  * @return void|string Should only be used to echo the trackback URL, use get_trackback_url() for the result instead.
mp-wp_genesis         696  */
mp-wp_genesis         697 function trackback_url($deprecated = true) {
mp-wp_genesis         698 	if ($deprecated) echo get_trackback_url();
mp-wp_genesis         699 	else return get_trackback_url();
mp-wp_genesis         700 }
mp-wp_genesis         701 
mp-wp_genesis         702 /**
mp-wp_genesis         703  * Generates and displays the RDF for the trackback information of current post.
mp-wp_genesis         704  *
mp-wp_genesis         705  * @since 0.71
mp-wp_genesis         706  *
mp-wp_genesis         707  * @param int $deprecated Not used (Was $timezone = 0)
mp-wp_genesis         708  */
mp-wp_genesis         709 function trackback_rdf($deprecated = '') {
mp-wp_genesis         710 	if (stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') === false) {
mp-wp_genesis         711 		echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
mp-wp_genesis         712 				xmlns:dc="http://purl.org/dc/elements/1.1/"
mp-wp_genesis         713 				xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
mp-wp_genesis         714 			<rdf:Description rdf:about="';
mp-wp_genesis         715 		the_permalink();
mp-wp_genesis         716 		echo '"'."\n";
mp-wp_genesis         717 		echo '    dc:identifier="';
mp-wp_genesis         718 		the_permalink();
mp-wp_genesis         719 		echo '"'."\n";
mp-wp_genesis         720 		echo '    dc:title="'.str_replace('--', '--', wptexturize(strip_tags(get_the_title()))).'"'."\n";
mp-wp_genesis         721 		echo '    trackback:ping="'.get_trackback_url().'"'." />\n";
mp-wp_genesis         722 		echo '</rdf:RDF>';
mp-wp_genesis         723 	}
mp-wp_genesis         724 }
mp-wp_genesis         725 
mp-wp_genesis         726 /**
mp-wp_genesis         727  * Whether the current post is open for comments.
mp-wp_genesis         728  *
mp-wp_genesis         729  * @since 1.5.0
mp-wp_genesis         730  * @uses $post
mp-wp_genesis         731  *
mp-wp_genesis         732  * @param int $post_id An optional post ID to check instead of the current post.
mp-wp_genesis         733  * @return bool True if the comments are open
mp-wp_genesis         734  */
mp-wp_genesis         735 function comments_open( $post_id=NULL ) {
mp-wp_genesis         736 
mp-wp_genesis         737 	$_post = get_post($post_id);
mp-wp_genesis         738 
mp-wp_genesis         739 	$open = ( 'open' == $_post->comment_status );
mp-wp_genesis         740 	return apply_filters( 'comments_open', $open, $post_id );
mp-wp_genesis         741 }
mp-wp_genesis         742 
mp-wp_genesis         743 /**
mp-wp_genesis         744  * Whether the current post is open for pings.
mp-wp_genesis         745  *
mp-wp_genesis         746  * @since 1.5.0
mp-wp_genesis         747  * @uses $post
mp-wp_genesis         748  *
mp-wp_genesis         749  * @param int $post_id An optional post ID to check instead of the current post.
mp-wp_genesis         750  * @return bool True if pings are accepted
mp-wp_genesis         751  */
mp-wp_genesis         752 function pings_open( $post_id = NULL ) {
mp-wp_genesis         753 
mp-wp_genesis         754 	$_post = get_post($post_id);
mp-wp_genesis         755 
mp-wp_genesis         756 	$open = ( 'open' == $_post->ping_status );
mp-wp_genesis         757 	return apply_filters( 'pings_open', $open, $post_id );
mp-wp_genesis         758 }
mp-wp_genesis         759 
mp-wp_genesis         760 /**
mp-wp_genesis         761  * Displays form token for unfiltered comments.
mp-wp_genesis         762  *
mp-wp_genesis         763  * Will only display nonce token if the current user has permissions for
mp-wp_genesis         764  * unfiltered html. Won't display the token for other users.
mp-wp_genesis         765  *
mp-wp_genesis         766  * The function was backported to 2.0.10 and was added to versions 2.1.3 and
mp-wp_genesis         767  * above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in
mp-wp_genesis         768  * the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0.
mp-wp_genesis         769  *
mp-wp_genesis         770  * Backported to 2.0.10.
mp-wp_genesis         771  *
mp-wp_genesis         772  * @since 2.1.3
mp-wp_genesis         773  * @uses $post Gets the ID of the current post for the token
mp-wp_genesis         774  */
mp-wp_genesis         775 function wp_comment_form_unfiltered_html_nonce() {
mp-wp_genesis         776 	global $post;
mp-wp_genesis         777 
mp-wp_genesis         778 	$post_id = 0;
mp-wp_genesis         779 	if ( !empty($post) )
mp-wp_genesis         780 		$post_id = $post->ID;
mp-wp_genesis         781 
mp-wp_genesis         782 	if ( current_user_can('unfiltered_html') )
mp-wp_genesis         783 		wp_nonce_field('unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment', false);
mp-wp_genesis         784 }
mp-wp_genesis         785 
mp-wp_genesis         786 /**
mp-wp_genesis         787  * Loads the comment template specified in $file.
mp-wp_genesis         788  *
mp-wp_genesis         789  * Will not display the comments template if not on single post or page, or if
mp-wp_genesis         790  * the post does not have comments.
mp-wp_genesis         791  *
mp-wp_genesis         792  * Uses the WordPress database object to query for the comments. The comments
mp-wp_genesis         793  * are passed through the 'comments_array' filter hook with the list of comments
mp-wp_genesis         794  * and the post ID respectively.
mp-wp_genesis         795  *
mp-wp_genesis         796  * The $file path is passed through a filter hook called, 'comments_template'
mp-wp_genesis         797  * which includes the TEMPLATEPATH and $file combined. Tries the $filtered path
mp-wp_genesis         798  * first and if it fails it will require the default comment themplate from the
mp-wp_genesis         799  * default theme. If either does not exist, then the WordPress process will be
mp-wp_genesis         800  * halted. It is advised for that reason, that the default theme is not deleted.
mp-wp_genesis         801  *
mp-wp_genesis         802  * @since 1.5.0
mp-wp_genesis         803  * @global array $comment List of comment objects for the current post
mp-wp_genesis         804  * @uses $wpdb
mp-wp_genesis         805  * @uses $id
mp-wp_genesis         806  * @uses $post
mp-wp_genesis         807  * @uses $withcomments Will not try to get the comments if the post has none.
mp-wp_genesis         808  *
mp-wp_genesis         809  * @param string $file Optional, default '/comments.php'. The file to load
mp-wp_genesis         810  * @param bool $separate_comments Optional, whether to separate the comments by comment type. Default is false.
mp-wp_genesis         811  * @return null Returns null if no comments appear
mp-wp_genesis         812  */
mp-wp_genesis         813 function comments_template( $file = '/comments.php', $separate_comments = false ) {
mp-wp_genesis         814 	global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
mp-wp_genesis         815 
mp-wp_genesis         816 	if ( ! (is_single() || is_page() || $withcomments) )
mp-wp_genesis         817 		return;
mp-wp_genesis         818 
mp-wp_genesis         819 	if ( empty($file) )
mp-wp_genesis         820 		$file = '/comments.php';
mp-wp_genesis         821 
mp-wp_genesis         822 	$req = get_option('require_name_email');
mp-wp_genesis         823 	$commenter = wp_get_current_commenter();
mp-wp_genesis         824 	extract($commenter, EXTR_SKIP);
mp-wp_genesis         825 
mp-wp_genesis         826 	/** @todo Use API instead of SELECTs. */
mp-wp_genesis         827 	if ( $user_ID) {
mp-wp_genesis         828 		$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) )  ORDER BY comment_date", $post->ID, $user_ID));
mp-wp_genesis         829 	} else if ( empty($comment_author) ) {
mp-wp_genesis         830 		$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post->ID));
mp-wp_genesis         831 	} else {
mp-wp_genesis         832 		$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date", $post->ID, $comment_author, $comment_author_email));
mp-wp_genesis         833 	}
mp-wp_genesis         834 
mp-wp_genesis         835 	// keep $comments for legacy's sake
mp-wp_genesis         836 	$wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID );
mp-wp_genesis         837 	$comments = &$wp_query->comments;
mp-wp_genesis         838 	$wp_query->comment_count = count($wp_query->comments);
mp-wp_genesis         839 	update_comment_cache($wp_query->comments);
mp-wp_genesis         840 
mp-wp_genesis         841 	if ( $separate_comments ) {
mp-wp_genesis         842 		$wp_query->comments_by_type = &separate_comments($comments);
mp-wp_genesis         843 		$comments_by_type = &$wp_query->comments_by_type;
mp-wp_genesis         844 	}
mp-wp_genesis         845 
mp-wp_genesis         846 	$overridden_cpage = FALSE;
mp-wp_genesis         847 	if ( '' == get_query_var('cpage') && get_option('page_comments') && 'newest' == get_option('default_comments_page') ) {
mp-wp_genesis         848 		set_query_var( 'cpage', get_comment_pages_count() );
mp-wp_genesis         849 		$overridden_cpage = TRUE;
mp-wp_genesis         850 	}
mp-wp_genesis         851 
mp-wp_genesis         852 	define('COMMENTS_TEMPLATE', true);
mp-wp_genesis         853 
mp-wp_genesis         854 	$include = apply_filters('comments_template', STYLESHEETPATH . $file );
mp-wp_genesis         855 	if ( file_exists( $include ) )
mp-wp_genesis         856 		require( $include );
mp-wp_genesis         857 	elseif ( file_exists( TEMPLATEPATH . $file ) )
mp-wp_genesis         858 		require( TEMPLATEPATH .  $file );
mp-wp_genesis         859 	else
mp-wp_genesis         860 		require( get_theme_root() . '/default/comments.php');
mp-wp_genesis         861 }
mp-wp_genesis         862 
mp-wp_genesis         863 /**
mp-wp_genesis         864  * Displays the JS popup script to show a comment.
mp-wp_genesis         865  *
mp-wp_genesis         866  * If the $file parameter is empty, then the home page is assumed. The defaults
mp-wp_genesis         867  * for the window are 400px by 400px.
mp-wp_genesis         868  *
mp-wp_genesis         869  * For the comment link popup to work, this function has to be called or the
mp-wp_genesis         870  * normal comment link will be assumed.
mp-wp_genesis         871  *
mp-wp_genesis         872  * @since 0.71
mp-wp_genesis         873  * @global string $wpcommentspopupfile The URL to use for the popup window
mp-wp_genesis         874  * @global int $wpcommentsjavascript Whether to use JavaScript or not. Set when function is called
mp-wp_genesis         875  *
mp-wp_genesis         876  * @param int $width Optional. The width of the popup window
mp-wp_genesis         877  * @param int $height Optional. The height of the popup window
mp-wp_genesis         878  * @param string $file Optional. Sets the location of the popup window
mp-wp_genesis         879  */
mp-wp_genesis         880 function comments_popup_script($width=400, $height=400, $file='') {
mp-wp_genesis         881 	global $wpcommentspopupfile, $wpcommentsjavascript;
mp-wp_genesis         882 
mp-wp_genesis         883 	if (empty ($file)) {
mp-wp_genesis         884 		$wpcommentspopupfile = '';  // Use the index.
mp-wp_genesis         885 	} else {
mp-wp_genesis         886 		$wpcommentspopupfile = $file;
mp-wp_genesis         887 	}
mp-wp_genesis         888 
mp-wp_genesis         889 	$wpcommentsjavascript = 1;
mp-wp_genesis         890 	$javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n    window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
mp-wp_genesis         891 	echo $javascript;
mp-wp_genesis         892 }
mp-wp_genesis         893 
mp-wp_genesis         894 /**
mp-wp_genesis         895  * Displays the link to the comments popup window for the current post ID.
mp-wp_genesis         896  *
mp-wp_genesis         897  * Is not meant to be displayed on single posts and pages. Should be used on the
mp-wp_genesis         898  * lists of posts
mp-wp_genesis         899  *
mp-wp_genesis         900  * @since 0.71
mp-wp_genesis         901  * @uses $id
mp-wp_genesis         902  * @uses $wpcommentspopupfile
mp-wp_genesis         903  * @uses $wpcommentsjavascript
mp-wp_genesis         904  * @uses $post
mp-wp_genesis         905  *
mp-wp_genesis         906  * @param string $zero The string to display when no comments
mp-wp_genesis         907  * @param string $one The string to display when only one comment is available
mp-wp_genesis         908  * @param string $more The string to display when there are more than one comment
mp-wp_genesis         909  * @param string $css_class The CSS class to use for comments
mp-wp_genesis         910  * @param string $none The string to display when comments have been turned off
mp-wp_genesis         911  * @return null Returns null on single posts and pages.
mp-wp_genesis         912  */
mp-wp_genesis         913 function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $css_class = '', $none = 'Comments Off' ) {
mp-wp_genesis         914 	global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
mp-wp_genesis         915 
mp-wp_genesis         916 	if ( is_single() || is_page() )
mp-wp_genesis         917 		return;
mp-wp_genesis         918 
mp-wp_genesis         919 	$number = get_comments_number( $id );
mp-wp_genesis         920 
mp-wp_genesis         921 	if ( 0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status ) {
mp-wp_genesis         922 		echo '<span' . ((!empty($css_class)) ? ' class="' . $css_class . '"' : '') . '>' . $none . '</span>';
mp-wp_genesis         923 		return;
mp-wp_genesis         924 	}
mp-wp_genesis         925 
mp-wp_genesis         926 	if ( post_password_required() ) {
mp-wp_genesis         927 		echo __('Enter your password to view comments');
mp-wp_genesis         928 		return;
mp-wp_genesis         929 	}
mp-wp_genesis         930 
mp-wp_genesis         931 	echo '<a href="';
mp-wp_genesis         932 	if ( $wpcommentsjavascript ) {
mp-wp_genesis         933 		if ( empty( $wpcommentspopupfile ) )
mp-wp_genesis         934 			$home = get_option('home');
mp-wp_genesis         935 		else
mp-wp_genesis         936 			$home = get_option('siteurl');
mp-wp_genesis         937 		echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
mp-wp_genesis         938 		echo '" onclick="wpopen(this.href); return false"';
mp-wp_genesis         939 	} else { // if comments_popup_script() is not in the template, display simple comment link
mp-wp_genesis         940 		if ( 0 == $number )
mp-wp_genesis         941 			echo get_permalink() . '#respond';
mp-wp_genesis         942 		else
mp-wp_genesis         943 			comments_link();
mp-wp_genesis         944 		echo '"';
mp-wp_genesis         945 	}
mp-wp_genesis         946 
mp-wp_genesis         947 	if ( !empty( $css_class ) ) {
mp-wp_genesis         948 		echo ' class="'.$css_class.'" ';
mp-wp_genesis         949 	}
mp-wp_genesis         950 	$title = attribute_escape( get_the_title() );
mp-wp_genesis         951 
mp-wp_genesis         952 	echo apply_filters( 'comments_popup_link_attributes', '' );
mp-wp_genesis         953 
mp-wp_genesis         954 	echo ' title="' . sprintf( __('Comment on %s'), $title ) . '">';
mp-wp_genesis         955 	comments_number( $zero, $one, $more, $number );
mp-wp_genesis         956 	echo '</a>';
mp-wp_genesis         957 }
mp-wp_genesis         958 
mp-wp_genesis         959 /**
mp-wp_genesis         960  * Retrieve HTML content for reply to comment link.
mp-wp_genesis         961  *
mp-wp_genesis         962  * The default arguments that can be override are 'add_below', 'respond_id',
mp-wp_genesis         963  * 'reply_text', 'login_text', and 'depth'. The 'login_text' argument will be
mp-wp_genesis         964  * used, if the user must log in or register first before posting a comment. The
mp-wp_genesis         965  * 'reply_text' will be used, if they can post a reply. The 'add_below' and
mp-wp_genesis         966  * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function
mp-wp_genesis         967  * parameters.
mp-wp_genesis         968  *
mp-wp_genesis         969  * @since 2.7.0
mp-wp_genesis         970  *
mp-wp_genesis         971  * @param array $args Optional. Override default options.
mp-wp_genesis         972  * @param int $comment Optional. Comment being replied to.
mp-wp_genesis         973  * @param int $post Optional. Post that the comment is going to be displayed on.
mp-wp_genesis         974  * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
mp-wp_genesis         975  */
mp-wp_genesis         976 function get_comment_reply_link($args = array(), $comment = null, $post = null) {
mp-wp_genesis         977 	global $user_ID;
mp-wp_genesis         978 
mp-wp_genesis         979 	$defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),
mp-wp_genesis         980 		'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
mp-wp_genesis         981 
mp-wp_genesis         982 	$args = wp_parse_args($args, $defaults);
mp-wp_genesis         983 
mp-wp_genesis         984 	if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] )
mp-wp_genesis         985 		return;
mp-wp_genesis         986 
mp-wp_genesis         987 	extract($args, EXTR_SKIP);
mp-wp_genesis         988 
mp-wp_genesis         989 	$comment = get_comment($comment);
mp-wp_genesis         990 	$post = get_post($post);
mp-wp_genesis         991 
mp-wp_genesis         992 	if ( 'open' != $post->comment_status )
mp-wp_genesis         993 		return false;
mp-wp_genesis         994 
mp-wp_genesis         995 	$link = '';
mp-wp_genesis         996 
mp-wp_genesis         997 	if ( get_option('comment_registration') && !$user_ID )
mp-wp_genesis         998 // Removed rel="nofollow" from here
mp-wp_genesis         999 		$link = '<a  href="' . site_url('wp-login.php?redirect_to=' . get_permalink()) . '">' . $login_text . '</a>';
mp-wp_genesis        1000 	else
mp-wp_genesis        1001 // Removed rel="nofollow" from here
mp-wp_genesis        1002 		$link = "<a  href='" . wp_specialchars( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
mp-wp_genesis        1003 	return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
mp-wp_genesis        1004 }
mp-wp_genesis        1005 
mp-wp_genesis        1006 /**
mp-wp_genesis        1007  * Displays the HTML content for reply to comment link.
mp-wp_genesis        1008  *
mp-wp_genesis        1009  * @since 2.7.0
mp-wp_genesis        1010  * @see get_comment_reply_link() Echoes result
mp-wp_genesis        1011  *
mp-wp_genesis        1012  * @param array $args Optional. Override default options.
mp-wp_genesis        1013  * @param int $comment Optional. Comment being replied to.
mp-wp_genesis        1014  * @param int $post Optional. Post that the comment is going to be displayed on.
mp-wp_genesis        1015  * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
mp-wp_genesis        1016  */
mp-wp_genesis        1017 function comment_reply_link($args = array(), $comment = null, $post = null) {
mp-wp_genesis        1018 	echo get_comment_reply_link($args, $comment, $post);
mp-wp_genesis        1019 }
mp-wp_genesis        1020 
mp-wp_genesis        1021 /**
mp-wp_genesis        1022  * Retrieve HTML content for reply to post link.
mp-wp_genesis        1023  *
mp-wp_genesis        1024  * The default arguments that can be override are 'add_below', 'respond_id',
mp-wp_genesis        1025  * 'reply_text', 'login_text', and 'depth'. The 'login_text' argument will be
mp-wp_genesis        1026  * used, if the user must log in or register first before posting a comment. The
mp-wp_genesis        1027  * 'reply_text' will be used, if they can post a reply. The 'add_below' and
mp-wp_genesis        1028  * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function
mp-wp_genesis        1029  * parameters.
mp-wp_genesis        1030  *
mp-wp_genesis        1031  * @since 2.7.0
mp-wp_genesis        1032  *
mp-wp_genesis        1033  * @param array $args Optional. Override default options.
mp-wp_genesis        1034  * @param int|object $post Optional. Post that the comment is going to be displayed on.  Defaults to current post.
mp-wp_genesis        1035  * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
mp-wp_genesis        1036  */
mp-wp_genesis        1037 function get_post_reply_link($args = array(), $post = null) {
mp-wp_genesis        1038 	global $user_ID;
mp-wp_genesis        1039 
mp-wp_genesis        1040 	$defaults = array('add_below' => 'post', 'respond_id' => 'respond', 'reply_text' => __('Leave a Comment'),
mp-wp_genesis        1041 		'login_text' => __('Log in to leave a Comment'), 'before' => '', 'after' => '');
mp-wp_genesis        1042 
mp-wp_genesis        1043 	$args = wp_parse_args($args, $defaults);
mp-wp_genesis        1044 	extract($args, EXTR_SKIP);
mp-wp_genesis        1045 	$post = get_post($post);
mp-wp_genesis        1046 	
mp-wp_genesis        1047 	if ( !comments_open($post->ID) )
mp-wp_genesis        1048 		return false;
mp-wp_genesis        1049 
mp-wp_genesis        1050 	if ( get_option('comment_registration') && !$user_ID ) {
mp-wp_genesis        1051 // Removed rel="nofollow" from here
mp-wp_genesis        1052 		$link = '<a  href="' . site_url('wp-login.php?redirect_to=' . get_permalink()) . '">' . $login_text . '</a>';
mp-wp_genesis        1053 	} else {
mp-wp_genesis        1054 // Removed rel="nofollow" from here
mp-wp_genesis        1055 		$link = "<a  href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
mp-wp_genesis        1056 	}
mp-wp_genesis        1057 	return apply_filters('post_comments_link', $before . $link . $after, $post);
mp-wp_genesis        1058 }
mp-wp_genesis        1059 
mp-wp_genesis        1060 /**
mp-wp_genesis        1061  * Displays the HTML content for reply to post link.
mp-wp_genesis        1062  * @since 2.7.0
mp-wp_genesis        1063  * @see get_post_reply_link()
mp-wp_genesis        1064  *
mp-wp_genesis        1065  * @param array $args Optional. Override default options.
mp-wp_genesis        1066  * @param int|object $post Optional. Post that the comment is going to be displayed on.
mp-wp_genesis        1067  * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
mp-wp_genesis        1068  */
mp-wp_genesis        1069 function post_reply_link($args = array(), $post = null) {
mp-wp_genesis        1070 	echo get_post_reply_link($args, $post);
mp-wp_genesis        1071 }
mp-wp_genesis        1072 
mp-wp_genesis        1073 /**
mp-wp_genesis        1074  * Retrieve HTML content for cancel comment reply link.
mp-wp_genesis        1075  *
mp-wp_genesis        1076  * @since 2.7.0
mp-wp_genesis        1077  *
mp-wp_genesis        1078  * @param string $text Optional. Text to display for cancel reply link.
mp-wp_genesis        1079  */
mp-wp_genesis        1080 function get_cancel_comment_reply_link($text = '') {
mp-wp_genesis        1081 	if ( empty($text) )
mp-wp_genesis        1082 		$text = __('Click here to cancel reply.');
mp-wp_genesis        1083 
mp-wp_genesis        1084 	$style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
mp-wp_genesis        1085 	$link = wp_specialchars( remove_query_arg('replytocom') ) . '#respond';
mp-wp_genesis        1086 // Removed rel="nofollow" from here	
mp-wp_genesis        1087 	return apply_filters('cancel_comment_reply_link', '<a  id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>', $link, $text);
mp-wp_genesis        1088 }
mp-wp_genesis        1089 
mp-wp_genesis        1090 /**
mp-wp_genesis        1091  * Display HTML content for cancel comment reply link.
mp-wp_genesis        1092  *
mp-wp_genesis        1093  * @since 2.7.0
mp-wp_genesis        1094  *
mp-wp_genesis        1095  * @param string $text Optional. Text to display for cancel reply link.
mp-wp_genesis        1096  */
mp-wp_genesis        1097 function cancel_comment_reply_link($text = '') {
mp-wp_genesis        1098 	echo get_cancel_comment_reply_link($text);
mp-wp_genesis        1099 }
mp-wp_genesis        1100 
mp-wp_genesis        1101 /**
mp-wp_genesis        1102  * Output hidden input HTML for replying to comments.
mp-wp_genesis        1103  *
mp-wp_genesis        1104  * @since 2.7.0
mp-wp_genesis        1105  */
mp-wp_genesis        1106 function comment_id_fields() {
mp-wp_genesis        1107 	global $id;
mp-wp_genesis        1108 
mp-wp_genesis        1109 	$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
mp-wp_genesis        1110 	echo "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
mp-wp_genesis        1111 	echo "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
mp-wp_genesis        1112 }
mp-wp_genesis        1113 
mp-wp_genesis        1114 /**
mp-wp_genesis        1115  * Display text based on comment reply status. Only affects users with Javascript disabled.
mp-wp_genesis        1116  *
mp-wp_genesis        1117  * @since 2.7.0
mp-wp_genesis        1118  *
mp-wp_genesis        1119  * @param string $noreplytext Optional. Text to display when not replying to a comment.
mp-wp_genesis        1120  * @param string $replytext Optional. Text to display when replying to a comment. Accepts "%s" for the author of the comment being replied to.
mp-wp_genesis        1121  * @param string $linktoparent Optional. Boolean to control making the author's name a link to their comment.
mp-wp_genesis        1122  */
mp-wp_genesis        1123 function comment_form_title( $noreplytext = 'Leave a Reply', $replytext = 'Leave a Reply to %s', $linktoparent = TRUE ) {
mp-wp_genesis        1124 	global $comment;
mp-wp_genesis        1125 
mp-wp_genesis        1126 	$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
mp-wp_genesis        1127 
mp-wp_genesis        1128 	if ( 0 == $replytoid )
mp-wp_genesis        1129 		echo $noreplytext;
mp-wp_genesis        1130 	else {
mp-wp_genesis        1131 		$comment = get_comment($replytoid);
mp-wp_genesis        1132 		$author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author() . '</a>' : get_comment_author();
mp-wp_genesis        1133 		printf( $replytext, $author );
mp-wp_genesis        1134 	}
mp-wp_genesis        1135 }
mp-wp_genesis        1136 
mp-wp_genesis        1137 /**
mp-wp_genesis        1138  * HTML comment list class.
mp-wp_genesis        1139  *
mp-wp_genesis        1140  * @package WordPress
mp-wp_genesis        1141  * @uses Walker
mp-wp_genesis        1142  * @since unknown
mp-wp_genesis        1143  */
mp-wp_genesis        1144 class Walker_Comment extends Walker {
mp-wp_genesis        1145 	/**
mp-wp_genesis        1146 	 * @see Walker::$tree_type
mp-wp_genesis        1147 	 * @since unknown
mp-wp_genesis        1148 	 * @var string
mp-wp_genesis        1149 	 */
mp-wp_genesis        1150 	var $tree_type = 'comment';
mp-wp_genesis        1151 
mp-wp_genesis        1152 	/**
mp-wp_genesis        1153 	 * @see Walker::$db_fields
mp-wp_genesis        1154 	 * @since unknown
mp-wp_genesis        1155 	 * @var array
mp-wp_genesis        1156 	 */
mp-wp_genesis        1157 	var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
mp-wp_genesis        1158 
mp-wp_genesis        1159 	/**
mp-wp_genesis        1160 	 * @see Walker::start_lvl()
mp-wp_genesis        1161 	 * @since unknown
mp-wp_genesis        1162 	 *
mp-wp_genesis        1163 	 * @param string $output Passed by reference. Used to append additional content.
mp-wp_genesis        1164 	 * @param int $depth Depth of comment.
mp-wp_genesis        1165 	 * @param array $args Uses 'style' argument for type of HTML list.
mp-wp_genesis        1166 	 */
mp-wp_genesis        1167 	function start_lvl(&$output, $depth, $args) {
mp-wp_genesis        1168 		$GLOBALS['comment_depth'] = $depth + 1;
mp-wp_genesis        1169 
mp-wp_genesis        1170 		switch ( $args['style'] ) {
mp-wp_genesis        1171 			case 'div':
mp-wp_genesis        1172 				break;
mp-wp_genesis        1173 			case 'ol':
mp-wp_genesis        1174 				echo "<ol class='children'>\n";
mp-wp_genesis        1175 				break;
mp-wp_genesis        1176 			default:
mp-wp_genesis        1177 			case 'ul':
mp-wp_genesis        1178 				echo "<ul class='children'>\n";
mp-wp_genesis        1179 				break;
mp-wp_genesis        1180 		}
mp-wp_genesis        1181 	}
mp-wp_genesis        1182 
mp-wp_genesis        1183 	/**
mp-wp_genesis        1184 	 * @see Walker::end_lvl()
mp-wp_genesis        1185 	 * @since unknown
mp-wp_genesis        1186 	 *
mp-wp_genesis        1187 	 * @param string $output Passed by reference. Used to append additional content.
mp-wp_genesis        1188 	 * @param int $depth Depth of comment.
mp-wp_genesis        1189 	 * @param array $args Will only append content if style argument value is 'ol' or 'ul'.
mp-wp_genesis        1190 	 */
mp-wp_genesis        1191 	function end_lvl(&$output, $depth, $args) {
mp-wp_genesis        1192 		$GLOBALS['comment_depth'] = $depth + 1;
mp-wp_genesis        1193 
mp-wp_genesis        1194 		switch ( $args['style'] ) {
mp-wp_genesis        1195 			case 'div':
mp-wp_genesis        1196 				break;
mp-wp_genesis        1197 			case 'ol':
mp-wp_genesis        1198 				echo "</ol>\n";
mp-wp_genesis        1199 				break;
mp-wp_genesis        1200 			default:
mp-wp_genesis        1201 			case 'ul':
mp-wp_genesis        1202 				echo "</ul>\n";
mp-wp_genesis        1203 				break;
mp-wp_genesis        1204 		}
mp-wp_genesis        1205 	}
mp-wp_genesis        1206 
mp-wp_genesis        1207 	/**
mp-wp_genesis        1208 	 * @see Walker::start_el()
mp-wp_genesis        1209 	 * @since unknown
mp-wp_genesis        1210 	 *
mp-wp_genesis        1211 	 * @param string $output Passed by reference. Used to append additional content.
mp-wp_genesis        1212 	 * @param object $comment Comment data object.
mp-wp_genesis        1213 	 * @param int $depth Depth of comment in reference to parents.
mp-wp_genesis        1214 	 * @param array $args
mp-wp_genesis        1215 	 */
mp-wp_genesis        1216 	function start_el(&$output, $comment, $depth, $args) {
mp-wp_genesis        1217 		$depth++;
mp-wp_genesis        1218 		$GLOBALS['comment_depth'] = $depth;
mp-wp_genesis        1219 
mp-wp_genesis        1220 		if ( !empty($args['callback']) ) {
mp-wp_genesis        1221 			call_user_func($args['callback'], $comment, $args, $depth);
mp-wp_genesis        1222 			return;
mp-wp_genesis        1223 		}
mp-wp_genesis        1224 
mp-wp_genesis        1225 		$GLOBALS['comment'] = $comment;
mp-wp_genesis        1226 		extract($args, EXTR_SKIP);
mp-wp_genesis        1227 
mp-wp_genesis        1228 		if ( 'div' == $args['style'] ) {
mp-wp_genesis        1229 			$tag = 'div';
mp-wp_genesis        1230 			$add_below = 'comment';
mp-wp_genesis        1231 		} else {
mp-wp_genesis        1232 			$tag = 'li';
mp-wp_genesis        1233 			$add_below = 'div-comment';
mp-wp_genesis        1234 		}
mp-wp_genesis        1235 ?>
mp-wp_genesis        1236 		<<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
mp-wp_genesis        1237 		<?php if ( 'ul' == $args['style'] ) : ?>
mp-wp_genesis        1238 		<div id="div-comment-<?php comment_ID() ?>">
mp-wp_genesis        1239 		<?php endif; ?>
mp-wp_genesis        1240 		<div class="comment-author vcard">
mp-wp_genesis        1241 		<?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
mp-wp_genesis        1242 		<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
mp-wp_genesis        1243 		</div>
mp-wp_genesis        1244 <?php if ($comment->comment_approved == '0') : ?>
mp-wp_genesis        1245 		<em><?php _e('Your comment is awaiting moderation.') ?></em>
mp-wp_genesis        1246 		<br />
mp-wp_genesis        1247 <?php endif; ?>
mp-wp_genesis        1248 
mp-wp_genesis        1249 		<div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
mp-wp_genesis        1250 
mp-wp_genesis        1251 		<?php comment_text() ?>
mp-wp_genesis        1252 
mp-wp_genesis        1253 		<div class="reply">
mp-wp_genesis        1254 		<?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
mp-wp_genesis        1255 		</div>
mp-wp_genesis        1256 		<?php if ( 'ul' == $args['style'] ) : ?>
mp-wp_genesis        1257 		</div>
mp-wp_genesis        1258 		<?php endif; ?>
mp-wp_genesis        1259 <?php
mp-wp_genesis        1260 	}
mp-wp_genesis        1261 
mp-wp_genesis        1262 	/**
mp-wp_genesis        1263 	 * @see Walker::end_el()
mp-wp_genesis        1264 	 * @since unknown
mp-wp_genesis        1265 	 *
mp-wp_genesis        1266 	 * @param string $output Passed by reference. Used to append additional content.
mp-wp_genesis        1267 	 * @param object $comment
mp-wp_genesis        1268 	 * @param int $depth Depth of comment.
mp-wp_genesis        1269 	 * @param array $args
mp-wp_genesis        1270 	 */
mp-wp_genesis        1271 	function end_el(&$output, $comment, $depth, $args) {
mp-wp_genesis        1272 		if ( !empty($args['end-callback']) ) {
mp-wp_genesis        1273 			call_user_func($args['end-callback'], $comment, $args, $depth);
mp-wp_genesis        1274 			return;
mp-wp_genesis        1275 		}
mp-wp_genesis        1276 		if ( 'div' == $args['style'] )
mp-wp_genesis        1277 			echo "</div>\n";
mp-wp_genesis        1278 		else
mp-wp_genesis        1279 			echo "</li>\n";
mp-wp_genesis        1280 	}
mp-wp_genesis        1281 
mp-wp_genesis        1282 }
mp-wp_genesis        1283 
mp-wp_genesis        1284 /**
mp-wp_genesis        1285  * List comments
mp-wp_genesis        1286  *
mp-wp_genesis        1287  * Used in the comments.php template to list comments for a particular post
mp-wp_genesis        1288  *
mp-wp_genesis        1289  * @since 2.7.0
mp-wp_genesis        1290  * @uses Walker_Comment
mp-wp_genesis        1291  *
mp-wp_genesis        1292  * @param string|array $args Formatting options
mp-wp_genesis        1293  * @param array $comments Optional array of comment objects.  Defaults to $wp_query->comments
mp-wp_genesis        1294  */
mp-wp_genesis        1295 function wp_list_comments($args = array(), $comments = null ) {
mp-wp_genesis        1296 	global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
mp-wp_genesis        1297 
mp-wp_genesis        1298 	$in_comment_loop = true;
mp-wp_genesis        1299 
mp-wp_genesis        1300 	$comment_alt = $comment_thread_alt = 0;
mp-wp_genesis        1301 	$comment_depth = 1;
mp-wp_genesis        1302 
mp-wp_genesis        1303 	$defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
mp-wp_genesis        1304 		'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '');
mp-wp_genesis        1305 
mp-wp_genesis        1306 	$r = wp_parse_args( $args, $defaults );
mp-wp_genesis        1307 
mp-wp_genesis        1308 	// Figure out what comments we'll be looping through ($_comments)
mp-wp_genesis        1309 	if ( null !== $comments ) {
mp-wp_genesis        1310 		$comments = (array) $comments;
mp-wp_genesis        1311 		if ( empty($comments) )
mp-wp_genesis        1312 			return;
mp-wp_genesis        1313 		if ( 'all' != $r['type'] ) {
mp-wp_genesis        1314 			$comments_by_type = &separate_comments($comments);
mp-wp_genesis        1315 			if ( empty($comments_by_type[$r['type']]) )
mp-wp_genesis        1316 				return;
mp-wp_genesis        1317 			$_comments = $comments_by_type[$r['type']];
mp-wp_genesis        1318 		} else {
mp-wp_genesis        1319 			$_comments = $comments;
mp-wp_genesis        1320 		}
mp-wp_genesis        1321 	} else {
mp-wp_genesis        1322 		if ( empty($wp_query->comments) )
mp-wp_genesis        1323 			return;
mp-wp_genesis        1324 		if ( 'all' != $r['type'] ) {
mp-wp_genesis        1325 			if ( empty($wp_query->comments_by_type) )
mp-wp_genesis        1326 				$wp_query->comments_by_type = &separate_comments($wp_query->comments);
mp-wp_genesis        1327 			if ( empty($wp_query->comments_by_type[$r['type']]) )
mp-wp_genesis        1328 				return;
mp-wp_genesis        1329 			$_comments = $wp_query->comments_by_type[$r['type']];
mp-wp_genesis        1330 		} else {
mp-wp_genesis        1331 			$_comments = $wp_query->comments;
mp-wp_genesis        1332 		}
mp-wp_genesis        1333 	}
mp-wp_genesis        1334 
mp-wp_genesis        1335 	if ( '' === $r['per_page'] && get_option('page_comments') )
mp-wp_genesis        1336 		$r['per_page'] = get_query_var('comments_per_page');
mp-wp_genesis        1337 
mp-wp_genesis        1338 	if ( empty($r['per_page']) ) {
mp-wp_genesis        1339 		$r['per_page'] = 0;
mp-wp_genesis        1340 		$r['page'] = 0;
mp-wp_genesis        1341 	}
mp-wp_genesis        1342 
mp-wp_genesis        1343 	if ( '' === $r['max_depth'] ) {
mp-wp_genesis        1344 		if ( get_option('thread_comments') )
mp-wp_genesis        1345 			$r['max_depth'] = get_option('thread_comments_depth');
mp-wp_genesis        1346 		else
mp-wp_genesis        1347 			$r['max_depth'] = -1;
mp-wp_genesis        1348 	}
mp-wp_genesis        1349 
mp-wp_genesis        1350 	if ( '' === $r['page'] ) {
mp-wp_genesis        1351 		if ( empty($overridden_cpage) ) {
mp-wp_genesis        1352 			$r['page'] = get_query_var('cpage');
mp-wp_genesis        1353 		} else {
mp-wp_genesis        1354 			$threaded = ( -1 == $r['max_depth'] ) ? false : true;
mp-wp_genesis        1355 			$r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1;
mp-wp_genesis        1356 			set_query_var( 'cpage', $r['page'] );
mp-wp_genesis        1357 		}
mp-wp_genesis        1358 	}
mp-wp_genesis        1359 	// Validation check
mp-wp_genesis        1360 	$r['page'] = intval($r['page']);
mp-wp_genesis        1361 	if ( 0 == $r['page'] && 0 != $r['per_page'] )
mp-wp_genesis        1362 		$r['page'] = 1;
mp-wp_genesis        1363 
mp-wp_genesis        1364 	if ( null === $r['reverse_top_level'] )
mp-wp_genesis        1365 		$r['reverse_top_level'] = ( 'desc' == get_option('comment_order') ) ? TRUE : FALSE;
mp-wp_genesis        1366 
mp-wp_genesis        1367 	extract( $r, EXTR_SKIP );
mp-wp_genesis        1368 
mp-wp_genesis        1369 	if ( empty($walker) )
mp-wp_genesis        1370 		$walker = new Walker_Comment;
mp-wp_genesis        1371 
mp-wp_genesis        1372 	$walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
mp-wp_genesis        1373 	$wp_query->max_num_comment_pages = $walker->max_pages;
mp-wp_genesis        1374 
mp-wp_genesis        1375 	$in_comment_loop = false;
mp-wp_genesis        1376 }
mp-wp_genesis        1377 
mp-wp_genesis        1378 ?>