aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/mb_wrapper.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-06-05 17:43:35 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-06-05 17:43:35 +0000
commita4340107482a45d9a1b04dbfda9a6c0578c75e59 (patch)
treee244f172e3440d2a07b0752949c08210aec72770 /engine/lib/mb_wrapper.php
parentc15e8643b1eb0e8821bd3fb254a16d77b50f4bdd (diff)
downloadelgg-a4340107482a45d9a1b04dbfda9a6c0578c75e59.tar.gz
elgg-a4340107482a45d9a1b04dbfda9a6c0578c75e59.tar.bz2
Closes #639:
* Metastrings can be searched either case sensitive or insensitive modes. * Tags now have case lowered in a UTF8 safe way (requires mbstring support). * Introducing mb_wrapper.php containing multibyte wrapper functions. * Version bump. * Introduces #1043 for consideration. git-svn-id: https://code.elgg.org/elgg/trunk@3322 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/mb_wrapper.php')
-rw-r--r--engine/lib/mb_wrapper.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/engine/lib/mb_wrapper.php b/engine/lib/mb_wrapper.php
new file mode 100644
index 000000000..7b3327edc
--- /dev/null
+++ b/engine/lib/mb_wrapper.php
@@ -0,0 +1,46 @@
+<?php
+ /**
+ * Elgg wrapper functions for multibyte string support.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+ /**
+ * Wrapper function: Returns the result of mb_strtolower if mb_support is present, else the
+ * result of strtolower is returned.
+ *
+ * @param string $string The string.
+ * @param string $charset The charset (if multibyte support is present) : default 'UTF8'
+ * @return string
+ */
+ function elgg_strtolower($string, $charset = 'UTF8')
+ {
+ if (is_callable('mb_strtolower'))
+ return mb_strtolower($string, $charset);
+
+ return strtolower($string);
+ }
+
+ /**
+ * Wrapper function: Returns the result of mb_strtoupper if mb_support is present, else the
+ * result of strtoupper is returned.
+ *
+ * @param string $string The string.
+ * @param string $charset The charset (if multibyte support is present) : default 'UTF8'
+ * @return string
+ */
+ function elgg_strtoupper($string, $charset = 'UTF8')
+ {
+ if (is_callable('mb_strtoupper'))
+ return mb_strtoupper($string, $charset);
+
+ return strtoupper($string);
+ }
+
+ // TODO: Other wrapper functions
+?> \ No newline at end of file