From: marcus Date: Mon, 8 Jun 2009 12:55:21 +0000 (+0000) Subject: * Introducing substr wrapper function X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=4d37741c63325b382bee1d7c43e176ac1e92674e;p=lorea%2Felgg.git * Introducing substr wrapper function * Wire strips tags (Closes #1045) git-svn-id: https://code.elgg.org/elgg/trunk@3323 36083f99-b078-4883-b0ff-0f9b5a30f544 --- diff --git a/engine/lib/mb_wrapper.php b/engine/lib/mb_wrapper.php index 7b3327edc..411a2d5c2 100644 --- a/engine/lib/mb_wrapper.php +++ b/engine/lib/mb_wrapper.php @@ -42,5 +42,23 @@ return strtoupper($string); } + /** + * Wrapper function: Returns the result of mb_substr if mb_support is present, else the + * result of substr is returned. + * + * @param string $string The string. + * @param int $start Start position. + * @param int $length Length. + * @param string $charset The charset (if multibyte support is present) : default 'UTF8' + * @return string + */ + function elgg_substr($string, $start = 0, $length = null, $charset = 'UTF8') + { + if (is_callable('mb_substr')) + return mb_substr($string, $start, $length, $charset); + + return substr($string, $start, $length); + } + // TODO: Other wrapper functions ?> \ No newline at end of file diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 9b313eed8..91618a48d 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -169,10 +169,11 @@ $thewire->access_id = $access_id; // Set its description appropriately - if (is_callable('mb_substr')) - $thewire->description = mb_substr($post, 0, 160); + $thewire->description = elgg_substr(strip_tags($post), 0, 160); + /*if (is_callable('mb_substr')) + $thewire->description = mb_substr(strip_tags($post), 0, 160); else - $thewire->description = substr($post, 0, 160); + $thewire->description = substr(strip_tags($post), 0, 160);*/ // add some metadata $thewire->method = $method; //method, e.g. via site, sms etc