All pastes #66922 Raw Edit

headzoo

public php v1 · immutable
#66922 ·published 2006-06-18 19:34 UTC
rendered paste body
<?php/*Plugin Name: Sean's CommentsPlugin URI: http://www.headzoo.comDescription: Show latest comments and a piece of the comment...Author: Sean HickeyVersion: 1.0Author URI: http://www.headzoo.com*/function scomments1($num = 10, $length = 90, $dateFormat = 'Y m-d') {	global $wpdb;	$comments = $wpdb->get_results("SELECT comment_author, comment_ID, comment_post_ID, comment_content, comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $num");		echo "<div class='seans_comments1'>\r\n";	foreach ($comments as $comment) {			$commentDate = strtotime($comment->comment_date);		$commentDate = date($dateFormat, $commentDate);		$commentLink = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;		$commentTitle = get_the_title($comment->comment_post_ID);		$commentAuthor = $comment->comment_author;		$commentContent = nl2br(chopString($comment->comment_content, $length));				/**		 * This is the start of the mini-loop.  Edit inside here		 */		?>						<div class="seans_comments_entry1">		<p><a href="<?php echo $commentLink; ?>" title="<?php echo $commentTitle; ?>"><?php echo $commentTitle; ?></a></p>		<p>By <em><?php echo $commentAuthor; ?></em> on <?php echo $commentDate; ?></p>		<p><?php echo $commentContent; ?></p>		</div>				<?php		/**		 * This is the end of the mini-loop.  Don't edit past here.		 */	}	echo "</div>\r\n";}function scomments2($num = 10, $length = 90, $dateFormat = 'Y m-d') {	global $wpdb;	$comments = $wpdb->get_results("SELECT comment_author, comment_ID, comment_post_ID, comment_content, comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $num");		echo "<div class='seans_comments2'>\r\n";	foreach ($comments as $comment) {			$commentDate = strtotime($comment->comment_date);		$commentDate = date($dateFormat, $commentDate);		$commentLink = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;		$commentTitle = get_the_title($comment->comment_post_ID);		$commentAuthor = $comment->comment_author;		$commentContent = nl2br(chopString($comment->comment_content, $length));				/**		 * This is the start of the mini-loop.  Edit inside here		 */		?>						<div class="seans_comments_entry2">		<p><a href="<?php echo $commentLink; ?>" title="<?php echo $commentTitle; ?>"><?php echo $commentTitle; ?></a></p>		<p>By <em><?php echo $commentAuthor; ?></em> on <?php echo $commentDate; ?></p>		<p><?php echo $commentContent; ?></p>		</div>				<?php		/**		 * This is the end of the mini-loop.  Don't edit past here.		 */	}	echo "</div>\r\n";}function chopString($string, $length) {	$string = strip_tags($string);	if (strlen($string) > $length) {		$string = substr($string, 0, $length) . '[...]';	}	return $string;}?>