public removeHtmlTags ( $string ) |
function removeHtmlTags($string)
{
$string = preg_replace('/<[^>]*>/', ' ', $string);
$string = str_replace("\r", '', $string);
$string = str_replace("\n", ' ', $string);
$string = str_replace("\t", ' ', $string);
$string = trim(preg_replace('/ {2,}/', ' ', $string));
return $string;
}
function pageContent() { $common = new common(); global $posts, $pageLinks, $previewLength; ?> <div class="container"> <h1>Blog Posts</h1> <hr /> <?php foreach ($posts as $post) { ?> <h2><a href="post.php?title=<?php echo urlencode($post['title']); ?> "><?php echo $post['title']; ?> </a></h2> <p>Posted <strong><?php echo date_format(date_create($post['date']), "F jS, Y"); ?> </strong> by <strong><?php echo $post['author']; ?> </strong>.</p> <div><?php echo substr($common->removeHtmlTags($post['contents']), 0, $previewLength); ?> </div> <?php } ?> <ul class="pagination"> <?php $i = 1; while ($i <= $pageLinks) { ?> <li><a href="?page=<?php echo $i; ?> "><?php echo $i; ?> </a></li> <?php $i++; } ?> </ul> </div> <?php }