From 8f60cc3d9091bda2e7e59532c05208d05443433b Mon Sep 17 00:00:00 2001
From: Danang Probo Sayekti
Date: Thu, 9 Jan 2014 05:28:10 +0700
Subject: [PATCH] Improve preg_replace
Improve preg_replace
---
system/includes/functions.php | 8 ++++----
themes/default/post.html.php | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/system/includes/functions.php b/system/includes/functions.php
index dcaf85d..fbaa1ad 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -660,13 +660,13 @@ function has_pagination($total, $perpage, $page = 1){
function get_description($text) {
$string = explode('
', $text);
- $string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($string[0] . ''));
+ $string = preg_replace('/[^,;a-zA-Z0-9_.-]|[,;]$/s', ' ', strip_tags($string[0] . ''));
if (strlen($string) > 1) {
return $string;
}
else {
- $string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($text));
+ $string = preg_replace('/[^,;a-zA-Z0-9_.-]|[,;]$/s', ' ', strip_tags($text));
if (strlen($string) < config('description.char')) {
return $string;
}
@@ -681,12 +681,12 @@ function get_description($text) {
function get_teaser($text, $url) {
if (strlen(strip_tags($text)) < config('teaser.char')) {
- $string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($text));
+ $string = preg_replace('/[^,;a-zA-Z0-9_.-]|[,;]$/s', ' ', strip_tags($text));
$body = $string . '...' . ' more' ;
echo '' . $body . '
';
}
else {
- $string = preg_replace('/[^,;a-zA-Z0-9_-]|[,;]$/s', ' ', strip_tags($text));
+ $string = preg_replace('/[^,;a-zA-Z0-9_.-]|[,;]$/s', ' ', strip_tags($text));
$string = substr($string, 0, strpos($string, ' ', config('teaser.char')));
$body = $string . '...' . ' more' ;
echo '' . $body . '
';
diff --git a/themes/default/post.html.php b/themes/default/post.html.php
index 471e4e4..3ea1b82 100644
--- a/themes/default/post.html.php
+++ b/themes/default/post.html.php
@@ -21,9 +21,9 @@