Comments() as $Comment) { Blog_PrintComment($Comment); } } /** * Print a comment. * @param Message $Comment Comment to print. */ function Blog_PrintComment(Message $Comment) { $Blog = $GLOBALS["G_PluginManager"]->GetPluginForCurrentPage(); $Author = new CWUser(intval($Comment->PosterId())); $CanEditComment = $Blog->UserCanEditComment($GLOBALS["G_User"], $Comment); $CanDeleteComment = $Blog->UserCanDeleteComment($GLOBALS["G_User"], $Comment); $CanEditUsers = $Blog->UserCanEditUsers($GLOBALS["G_User"]); # encode values for HTML output $SafeCommentId = defaulthtmlentities($Comment->MessageId()); $SafeBody = nl2br(defaulthtmlentities($Comment->Body())); $SafeEntryId = defaulthtmlentities($Comment->ParentId()); $SafePosterId = defaulthtmlentities($Author->Id()); $SafePosterName = defaulthtmlentities($Author->GetBestName()); $SafePostedDate = defaulthtmlentities(Blog_FormatTimestampForDisplay($Comment->DatePosted())); $SafePostedDateForParsing = defaulthtmlentities(Blog_FormatTimestampForParsing($Comment->DatePosted())); ?>

Id()); $Data = $GLOBALS["AF"]->SignalEvent("EVENT_APPEND_HTML_TO_FORM", array("PageName" => "AddResourceComment", "FormName"=>"CommentForm", "Labels" => array(), "InputElements" => array(), "Notes" => array())); # Extract the results. $Labels = $Data["Labels"]; $InputElements = $Data["InputElements"]; $Notes = $Data["Notes"]; ?> Add a Comment
GetPluginForCurrentPage(); # get the unadultered body of the entry and its images $Body = $Entry->Get("Body"); $Images = $Entry->Images(); # return the body as-is if there are no images associated with the blog # entry if (count($Images) < 1) { return $Entry->Body(); } # get all of the image insertion points $ImageInsertionPoints = $Entry->GetImageInsertionPoints(); # display all of the images at the top if there are no insertion points if (count($ImageInsertionPoints) < 1) { $ImageInsertionPoints = array(0); } # variables used to determine when and where to insert images $ImagesPerPoint = ceil(count($Images) / count($ImageInsertionPoints)); $ImagesInserted = 0; $InsertionOffset = 0; foreach ($Images as $Image) { $SafeImage = defaulthtmlentities($Image->PreviewUrl()); $SafeImageAlt = defaulthtmlentities($Image->AltText()); $SafeWidth = defaulthtmlentities($Image->PreviewWidth()); $ImageInsert = '
'; $ImageInsert .= ''; # add the caption if not the default value if ($Entry->HasCaption($Image)) { $ImageInsert .= '

'.$SafeImageAlt.'

'; } $ImageInsert .= '
'; # determine at which insertion point to insert this images $InsertionPointIndex = floor($ImagesInserted/$ImagesPerPoint); $ImageInsertionPoint = $ImageInsertionPoints[$InsertionPointIndex]; # insert the image into the body, offsetting by earlier insertions $Body = substr_replace( $Body, $ImageInsert, $ImageInsertionPoint+$InsertionOffset, 0); # increment the variables used to determine where to insert the next # image $InsertionOffset += strlen($ImageInsert); $ImagesInserted += 1; } # remove the image insertion point $Body = preg_replace( '/'.Blog_Entry::BLANK_LINE_REGEX.'{5,}/', "\n\n", $Body); # return the body with the images inserted return $Body; } /** * Print some blog entry metrics. * @param array $Metrics Array of blog entry metrics. */ function Blog_PrintEntryMetrics(array $Metrics) { $SafeNumViews = defaulthtmlentities(count($Metrics["Views"])); $SafeNumEmail = defaulthtmlentities(count($Metrics["Shares/Email"])); $SafeNumFacebook = defaulthtmlentities(count($Metrics["Shares/Facebook"])); $SafeNumTwitter = defaulthtmlentities(count($Metrics["Shares/Twitter"])); $SafeNumLinkedIn = defaulthtmlentities(count($Metrics["Shares/LinkedIn"])); $SafeNumGooglePlus = defaulthtmlentities(count($Metrics["Shares/Google+"])); ?>

Views |
Shared via E-mail |
Shared to Facebook |
Shared to Twitter |
Shared to LinkedIn |
Shared to Google+ |

UserCanPostComment($GLOBALS["G_User"]); $CanViewMetrics = $H_Blog->UserCanViewMetrics($GLOBALS["G_User"]); $IsLoggedIn = $GLOBALS["G_User"]->IsLoggedIn(); if ($H_State == "OK") { $SafeId = defaulthtmlentities($H_Entry->Id()); $SafeUrl = defaulthtmlentities($H_Entry->EntryUrl()); $SafeTitle = $H_Entry->TitleForDisplay(); $SafeAuthor = defaulthtmlentities($H_Entry->AuthorForDisplay()); $SafeEditor = defaulthtmlentities($H_Entry->EditorForDisplay()); $SafeCreationDate = defaulthtmlentities($H_Entry->CreationDateForDisplay()); $SafeModificationDate = defaulthtmlentities($H_Entry->ModificationDateForDisplay()); $SafePublicationDate = defaulthtmlentities($H_Entry->PublicationDateForDisplay()); $SafePublicationDatePrefix = defaulthtmlentities($H_Entry->PublicationDateDisplayPrefix()); $SafePublicationDateForParsing = defaulthtmlentities($H_Entry->PublicationDateForParsing()); $Body = Blog_GetEntryBody($H_Entry); $Categories = $H_Entry->CategoriesForDisplay(); $NotificationsEnabled = $H_Blog->NotificationsCouldBeSent(); $UserIsLoggedIn = $GLOBALS["G_User"]->IsLoggedIn(); $UserIsSubscribed = $H_Blog->UserIsSubscribedToNotifications($GLOBALS["G_User"]); $DisplayNotificationButton = $H_Blog->NotificationsCouldBeSent(NULL, $GLOBALS["G_User"]); $NotificationButtonEnabled = $H_Blog->NotificationsCouldBeSent($H_Entry, $GLOBALS["G_User"]); PageTitle(strip_tags($H_Entry->TitleForDisplay())); } else { PageTitle("Blog Entry Not Found"); } ?>

#

Unsubscribe Subscribe UserCanEditBlogEntries($GLOBALS["G_User"], $H_Entry)) { ?> Notify Subscribers Notify Subscribers Edit

Posted ShowAuthor()) { ?> by .

Categories:

PrintShareButtonsForEntry($H_Entry); ?>

# Metrics

EnableComments()) { ?>

# Comments

NumberOfComments() > 0) { ?> Log in to post a comment.

There are no comments yet for this entry. Please Log In to post one.

# Blog Entry Not Found

The blog entry could not be found. Please contact the administrator if you believe this is an error.