diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-06-08 12:55:21 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-06-08 12:55:21 +0000 |
commit | 4d37741c63325b382bee1d7c43e176ac1e92674e (patch) | |
tree | 5c428a9d8a7cf1e73268bc79b51fc8bc1d927feb /engine/lib | |
parent | a4340107482a45d9a1b04dbfda9a6c0578c75e59 (diff) | |
download | elgg-4d37741c63325b382bee1d7c43e176ac1e92674e.tar.gz elgg-4d37741c63325b382bee1d7c43e176ac1e92674e.tar.bz2 |
* Introducing substr wrapper function
* Wire strips tags (Closes #1045)
git-svn-id: https://code.elgg.org/elgg/trunk@3323 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/mb_wrapper.php | 18 |
1 files changed, 18 insertions, 0 deletions
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 |