From 2067d1a727e7eb5e5ffb40e967f3d1fc4c8a41b2 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Thu, 13 Nov 2008 22:59:24 +0000 Subject: Changing EOL style to LF --- user_guide/helpers/text_helper.html | 382 ++++++++++++++++++------------------ 1 file changed, 191 insertions(+), 191 deletions(-) (limited to 'user_guide/helpers/text_helper.html') diff --git a/user_guide/helpers/text_helper.html b/user_guide/helpers/text_helper.html index 71047981a..16d16fc92 100644 --- a/user_guide/helpers/text_helper.html +++ b/user_guide/helpers/text_helper.html @@ -1,192 +1,192 @@ - - - - - -Text Helper : CodeIgniter User Guide - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

CodeIgniter User Guide Version 1.7

-
- - - - - - - - - -
- - -
- - - -
- - -

Text Helper

- -

The Text Helper file contains functions that assist in working with text.

- - -

Loading this Helper

- -

This helper is loaded using the following code:

-$this->load->helper('text'); - -

The following functions are available:

- - -

word_limiter()

- -

Truncates a string to the number of words specified. Example:

- - -$string = "Here is a nice text string consisting of eleven words.";
-
-$string = word_limiter($string, 4);

- -// Returns: Here is a nice… -
- -

The third parameter is an optional suffix added to the string. By default it adds an ellipsis.

- - -

character_limiter()

- -

Truncates a string to the number of characters specified. It maintains the integrity -of words so the character count may be slightly more or less then what you specify. Example:

- - -$string = "Here is a nice text string consisting of eleven words.";
-
-$string = character_limiter($string, 20);

- -// Returns: Here is a nice text string… -
- -

The third parameter is an optional suffix added to the string, if undeclared this helper uses an ellipsis.

- - - -

ascii_to_entities()

- -

Converts ASCII values to character entities, including high ASCII and MS Word characters that can cause problems when used in a web page, -so that they can be shown consistently regardless of browser settings or stored reliably in a database. -There is some dependence on your server's supported character sets, so it may not be 100% reliable in all cases, but for the most -part it should correctly identify characters outside the normal range (like accented characters). Example:

- -$string = ascii_to_entities($string); - - -

entities_to_ascii()

- -

This function does the opposite of the previous one; it turns character entities back into ASCII.

- - -

word_censor()

- -

Enables you to censor words within a text string. The first parameter will contain the original string. The -second will contain an array of words which you disallow. The third (optional) parameter can contain a replacement value -for the words. If not specified they are replaced with pound signs: ####. Example:

- - -$disallowed = array('darn', 'shucks', 'golly', 'phooey');
-
-$string = word_censor($string, $disallowed, 'Beep!');
- - -

highlight_code()

- -

Colorizes a string of code (PHP, HTML, etc.). Example:

- -$string = highlight_code($string); - -

The function uses PHP's highlight_string() function, so the colors used are the ones specified in your php.ini file.

- - -

highlight_phrase()

- -

Will highlight a phrase within a text string. The first parameter will contain the original string, the second will -contain the phrase you wish to highlight. The third and fourth parameters will contain the opening/closing HTML tags -you would like the phrase wrapped in. Example:

- - -$string = "Here is a nice text string about nothing in particular.";
-
-$string = highlight_phrase($string, "nice text", '<span style="color:#990000">', '</span>'); -
- -

The above text returns:

- -

Here is a nice text string about nothing in particular.

- - - -

word_wrap()

- -

Wraps text at the specified character count while maintaining complete words. Example:

- -$string = "Here is a simple string of text that will help us demonstrate this function.";
-
-echo word_wrap($string, 25);
-
-// Would produce:
-
-Here is a simple string
-of text that will help
-us demonstrate this
-function
- - - - -
- - - - - - + + + + + +Text Helper : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

CodeIgniter User Guide Version 1.7

+
+ + + + + + + + + +
+ + +
+ + + +
+ + +

Text Helper

+ +

The Text Helper file contains functions that assist in working with text.

+ + +

Loading this Helper

+ +

This helper is loaded using the following code:

+$this->load->helper('text'); + +

The following functions are available:

+ + +

word_limiter()

+ +

Truncates a string to the number of words specified. Example:

+ + +$string = "Here is a nice text string consisting of eleven words.";
+
+$string = word_limiter($string, 4);

+ +// Returns: Here is a nice… +
+ +

The third parameter is an optional suffix added to the string. By default it adds an ellipsis.

+ + +

character_limiter()

+ +

Truncates a string to the number of characters specified. It maintains the integrity +of words so the character count may be slightly more or less then what you specify. Example:

+ + +$string = "Here is a nice text string consisting of eleven words.";
+
+$string = character_limiter($string, 20);

+ +// Returns: Here is a nice text string… +
+ +

The third parameter is an optional suffix added to the string, if undeclared this helper uses an ellipsis.

+ + + +

ascii_to_entities()

+ +

Converts ASCII values to character entities, including high ASCII and MS Word characters that can cause problems when used in a web page, +so that they can be shown consistently regardless of browser settings or stored reliably in a database. +There is some dependence on your server's supported character sets, so it may not be 100% reliable in all cases, but for the most +part it should correctly identify characters outside the normal range (like accented characters). Example:

+ +$string = ascii_to_entities($string); + + +

entities_to_ascii()

+ +

This function does the opposite of the previous one; it turns character entities back into ASCII.

+ + +

word_censor()

+ +

Enables you to censor words within a text string. The first parameter will contain the original string. The +second will contain an array of words which you disallow. The third (optional) parameter can contain a replacement value +for the words. If not specified they are replaced with pound signs: ####. Example:

+ + +$disallowed = array('darn', 'shucks', 'golly', 'phooey');
+
+$string = word_censor($string, $disallowed, 'Beep!');
+ + +

highlight_code()

+ +

Colorizes a string of code (PHP, HTML, etc.). Example:

+ +$string = highlight_code($string); + +

The function uses PHP's highlight_string() function, so the colors used are the ones specified in your php.ini file.

+ + +

highlight_phrase()

+ +

Will highlight a phrase within a text string. The first parameter will contain the original string, the second will +contain the phrase you wish to highlight. The third and fourth parameters will contain the opening/closing HTML tags +you would like the phrase wrapped in. Example:

+ + +$string = "Here is a nice text string about nothing in particular.";
+
+$string = highlight_phrase($string, "nice text", '<span style="color:#990000">', '</span>'); +
+ +

The above text returns:

+ +

Here is a nice text string about nothing in particular.

+ + + +

word_wrap()

+ +

Wraps text at the specified character count while maintaining complete words. Example:

+ +$string = "Here is a simple string of text that will help us demonstrate this function.";
+
+echo word_wrap($string, 25);
+
+// Would produce:
+
+Here is a simple string
+of text that will help
+us demonstrate this
+function
+ + + + +
+ + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b