diff options
author | Rick Ellis <rick.ellis@ellislab.com> | 2008-09-12 09:22:21 +0200 |
---|---|---|
committer | Rick Ellis <rick.ellis@ellislab.com> | 2008-09-12 09:22:21 +0200 |
commit | 9907df45d0003dee39480f4ea66004b2922b69c7 (patch) | |
tree | a3ff8a991b2e66113c83dbf11d9b11c3720d253e | |
parent | 08e38123f2b14b146f861c77c04073a3fc88c85d (diff) |
Continued working on typography class and docs
-rw-r--r-- | system/application/config/config.php | 2 | ||||
-rw-r--r-- | system/helpers/typography_helper.php | 21 | ||||
-rw-r--r-- | system/libraries/Typography.php | 34 | ||||
-rw-r--r-- | user_guide/libraries/parser.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/unit_testing.html | 2 | ||||
-rw-r--r-- | user_guide/nav/nav.js | 1 | ||||
-rw-r--r-- | user_guide/toc.html | 1 |
7 files changed, 42 insertions, 21 deletions
diff --git a/system/application/config/config.php b/system/application/config/config.php index 71ebd30d0..7dc6151ee 100644 --- a/system/application/config/config.php +++ b/system/application/config/config.php @@ -11,7 +11,7 @@ | http://example.com/
|
*/
-$config['base_url'] = "";
+$config['base_url'] = "http://127.0.0.1/EllisLab/_Development/CodeIgniter/";
/*
|--------------------------------------------------------------------------
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index 2c5c588bc..11acea1f7 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -38,26 +38,11 @@ if ( ! function_exists('nl2br_except_pre')) {
function nl2br_except_pre($str)
{
- $ex = explode("pre>",$str);
- $ct = count($ex);
+ $CI =& get_instance();
- $newstr = "";
- for ($i = 0; $i < $ct; $i++)
- {
- if (($i % 2) == 0)
- {
- $newstr .= nl2br($ex[$i]);
- }
- else
- {
- $newstr .= $ex[$i];
- }
+ $CI->load->library('typography');
- if ($ct - 1 != $i)
- $newstr .= "pre>";
- }
-
- return $newstr;
+ return $CI->typography->nl2br_except_pre($str);
}
}
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php index b058fdab9..dd5f928d9 100644 --- a/system/libraries/Typography.php +++ b/system/libraries/Typography.php @@ -286,6 +286,40 @@ class CI_Typography { { $this->reduce_empty_lines = ($val === FALSE) ? FALSE : TRUE; } + + // ------------------------------------------------------------------------ + + /** + * Convert newlines to HTML line breaks except within PRE tags + * + * @access public + * @param string + * @return string + */ + function nl2br_except_pre($str) + { + $ex = explode("pre>",$str); + $ct = count($ex); + + $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; + } + } // END Typography Class diff --git a/user_guide/libraries/parser.html b/user_guide/libraries/parser.html index 5743d2dec..7d6b2afa5 100644 --- a/user_guide/libraries/parser.html +++ b/user_guide/libraries/parser.html @@ -199,7 +199,7 @@ Previous Topic: <a href="trackback.html">Trackback Class</a> ·
<a href="#top">Top of Page</a> ·
<a href="../index.html">User Guide Home</a> ·
-Next Topic: <a href="unit_testing.html">Unit Testing Class</a>
+Next Topic: <a href="typography.html">Typography</a>
</p>
<p><a href="http://codeigniter.com">CodeIgniter</a> · Copyright © 2006-2008 · <a href="http://ellislab.com/">Ellislab, Inc.</a></p>
</div>
diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html index ffb3d95c3..376323272 100644 --- a/user_guide/libraries/unit_testing.html +++ b/user_guide/libraries/unit_testing.html @@ -192,7 +192,7 @@ $this->unit->set_template($str); <div id="footer">
<p>
-Previous Topic: <a href="parser.html">Template Parser Class</a>
+Previous Topic: <a href="typography.html">Typography Class</a>
·
<a href="#top">Top of Page</a> ·
<a href="../index.html">User Guide Home</a> ·
diff --git a/user_guide/nav/nav.js b/user_guide/nav/nav.js index cbff6f343..f8320ddd9 100644 --- a/user_guide/nav/nav.js +++ b/user_guide/nav/nav.js @@ -91,6 +91,7 @@ function create_menu(basepath) '<li><a href="'+base+'libraries/sessions.html">Session Class</a></li>' +
'<li><a href="'+base+'libraries/trackback.html">Trackback Class</a></li>' +
'<li><a href="'+base+'libraries/parser.html">Template Parser Class</a></li>' +
+ '<li><a href="'+base+'libraries/typography.html">Typography Class</a></li>' +
'<li><a href="'+base+'libraries/unit_testing.html">Unit Testing Class</a></li>' +
'<li><a href="'+base+'libraries/uri.html">URI Class</a></li>' +
'<li><a href="'+base+'libraries/user_agent.html">User Agent Class</a></li>' +
diff --git a/user_guide/toc.html b/user_guide/toc.html index ba147f6f2..a87139b91 100644 --- a/user_guide/toc.html +++ b/user_guide/toc.html @@ -144,6 +144,7 @@ Table of Contents <li><a href="./libraries/sessions.html">Session Class</a></li>
<li><a href="./libraries/trackback.html">Trackback Class</a></li>
<li><a href="./libraries/parser.html">Template Parser Class</a></li>
+<li><a href="./libraries/typography.html">Typography Class</a></li>
<li><a href="./libraries/unit_testing.html">Unit Testing Class</a></li>
<li><a href="./libraries/uri.html">URI Class</a></li>
<li><a href="./libraries/user_agent.html">User Agent Class</a></li>
|