added ability to "extend" helpers
* modified Loader to check for prefixed helpers in application/helpers folder
* surrounded provided helper functions with if (! function_exists('foo')) conditionals so the user's helper functions take precedent.
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 4a746c6..4d9a1bb 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -34,28 +34,31 @@
* @param string
* @return string
*/
-function nl2br_except_pre($str)
+if (! function_exists('nl2br_except_pre'))
{
- $ex = explode("pre>",$str);
- $ct = count($ex);
-
- $newstr = "";
- for ($i = 0; $i < $ct; $i++)
+ function nl2br_except_pre($str)
{
- if (($i % 2) == 0)
- {
- $newstr .= nl2br($ex[$i]);
- }
- else
- {
- $newstr .= $ex[$i];
- }
-
- if ($ct - 1 != $i)
- $newstr .= "pre>";
- }
+ $ex = explode("pre>",$str);
+ $ct = count($ex);
- return $newstr;
+ $newstr = "";
+ for ($i = 0; $i < $ct; $i++)
+ {
+ if (($i % 2) == 0)
+ {
+ $newstr .= nl2br($ex[$i]);
+ }
+ else
+ {
+ $newstr .= $ex[$i];
+ }
+
+ if ($ct - 1 != $i)
+ $newstr .= "pre>";
+ }
+
+ return $newstr;
+ }
}
// ------------------------------------------------------------------------
@@ -68,10 +71,13 @@
* @param string
* @return string
*/
-function auto_typography($str)
+if (! function_exists('auto_typography'))
{
- $TYPE = new Auto_typography();
- return $TYPE->convert($str);
+ function auto_typography($str)
+ {
+ $TYPE = new Auto_typography();
+ return $TYPE->convert($str);
+ }
}
// ------------------------------------------------------------------------