1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| function formatWPContent($wpdata, $chars, $stripimages, $stripembed, $stripscript, $striplinks) {
if ($chars > 0) {
$content = stripslashes($this->html_substr($wpdata['post_content'], $chars, 20));
$content = $this->convert_smart_quotes($content);
$content = preg_replace('/(\r\n|\n|\r)/', '', $content);
$content = preg_replace("#\[caption([^\]]*)]([^\[]*)\[/caption\]#", " ", $content);
}
else {
$content = $wpdata['post_content'];
$content = $this->convert_smart_quotes($content);
}
// strip images from posts
if ($stripimages) {
$content = preg_replace('#</?img[^>]*>#is', '<!--img-->', $content);
}
if ($stripembed) {
// strip embeds from posts
$content = preg_replace('#</?embed[^>]*>(.+</embed[^>]*>|)#is', '<!--embed-->', $content);
}
if ($stripscript) {
// strip javascript from posts
$content = preg_replace('#</?script[^>]*>(.+</script[^>]*>|)#is', '<!--script-->', $content);
}
if ($striplinks) {
// strip any links (or other <a> tagged content) from posts
$content = preg_replace('#</?a[^>]*>#is', '<!--link-->', $content);
$content = preg_replace('#</?\/a[^>]*>#is', '<!--endlink-->', $content);
}
?>
<div class="box_latest_posts"><?php
echo '<a href="'.$wpdata['guid'].'"><strong>'.$wpdata['post_title'].'</strong></a></br>
<span class="description_latest_posts">'.nl2br($content).'</span>
<span class="date_latest_posts">Posted on '.date($this->dateformat, strtotime($wpdata['post_date'])).'</span></br>';
if ($this->showauthor)
//echo ' by '.$wpdata['display_name']; // print author name
//echo '.<br />'.$wpdata['comment_count'];
if ($wpdata['comment_count'] > 0) {
$jump = "#comments";
}
else {
$jump = "#respond";
}
if ($wpdata['comment_count'] == 1) {
$comment = "comment";
}
else {
$comment = "comments";
}
//echo ' <a href="'.$wpdata['guid'].$jump.'">'.$comment.'</a>.';
?></div><?php
} // end formatWPContent() |
Partager