summaryrefslogtreecommitdiffstats
path: root/system/helpers/typography_helper.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-01-28 22:00:20 +0100
committerDerek Jones <derek.jones@ellislab.com>2008-01-28 22:00:20 +0100
commit269b942a2bf7b022795e591d9b0ad04526ee7e09 (patch)
treef465bb5a700d4cc5d72ca6e55e251640a46b869b /system/helpers/typography_helper.php
parenta25530f6594c7ba45b3faa9537fda9f807069759 (diff)
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.
Diffstat (limited to 'system/helpers/typography_helper.php')
-rw-r--r--system/helpers/typography_helper.php46
1 files changed, 26 insertions, 20 deletions
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 4a746c6e4..4d9a1bb6b 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
+ $ex = explode("pre>",$str);
+ $ct = count($ex);
+
+ $newstr = "";
+ for ($i = 0; $i < $ct; $i++)
{
- $newstr .= $ex[$i];
- }
+ if (($i % 2) == 0)
+ {
+ $newstr .= nl2br($ex[$i]);
+ }
+ else
+ {
+ $newstr .= $ex[$i];
+ }
- if ($ct - 1 != $i)
- $newstr .= "pre>";
- }
+ if ($ct - 1 != $i)
+ $newstr .= "pre>";
+ }
- return $newstr;
+ return $newstr;
+ }
}
// ------------------------------------------------------------------------
@@ -68,10 +71,13 @@ function nl2br_except_pre($str)
* @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);
+ }
}
// ------------------------------------------------------------------------