Class HtmlString

Description

A HtmlString data type. This class allows for HTML-safe string shortening.

Located in /harmoni/core/Primitives/Collections-Text/HtmlString.class.php (line 15)

SObject
   |
   --String
      |
      --HtmlString
Variable Summary
mixed $_children
Method Summary
HtmlString HtmlString ([mixed $string = ""])
void clean ()
string ensureNesting (string $tag, ref $tags)
ref fromString (string $aString)
string getTag (string $inputString, integer $tagStart)
string isInvalidLessThan (string $inputString, integer $tagStart)
string isSingleTag (string $inputString, integer $tagStart)
string stripTagsAndTrim (mixed $word_count, string $text, integer $maxLength)
void trim (integer $numWords, [boolean $addElipses = true])
ref withValue (string $value)
Variables
mixed $_children (line 18)

Inherited Variables

Inherited from String

String::$_string
Methods
Constructor HtmlString (line 20)
HtmlString HtmlString ([mixed $string = ""])
clean (line 344)

Clean up the html as much as possible

  • since: 12/14/05
  • access: public
void clean ()
ensureNesting (line 238)

Ensure that td tags are inside of tr's, etc.

  • since: 1/27/06
  • access: public
string ensureNesting (string $tag, ref $tags)
  • string $tag
  • ref $tags: array $tags
fromString (line 45)

Instantiates a new String object with the passed value.

allowing 'fromString' for string values

  • return: object
  • static:
  • access: public
ref fromString (string $aString)
  • string $aString

Redefinition of:
String::fromString()
Instantiates a new String object with the passed value.
getTag (line 357)

Answer the tag that starts at the given index.

  • since: 12/13/05
  • access: private
string getTag (string $inputString, integer $tagStart)
  • string $inputString
  • integer $tagStart: // index of the opening '<'
isInvalidLessThan (line 434)

Answer true if the '<' doesn't seem to be the start of a tag and is instead an invalid 'less-than' character.

This will be the case if:

    • Another '<' is found in the string before a '>'

    • since: 12/14/05
    • access: private
    string isInvalidLessThan (string $inputString, integer $tagStart)
    • string $inputString
    • integer $tagStart: // index of the opening '<'
    isSingleTag (line 393)

    Answer true if the tag begining at $tagStart does not have a close-tag, examples are
    , <hr/>, <img src=''/>

    • since: 12/13/05
    • access: private
    string isSingleTag (string $inputString, integer $tagStart)
    • string $inputString
    • integer $tagStart: // index of the opening '<'
    stripTagsAndTrim (line 310)

    Trim the passed text to a shorter length, stripping the HTML tags

    Originally posted to php.net forums by webmaster at joshstmarie dot com (55-Sep-2005 05:58). Modified by Adam Franco (afranco at middlebury dot edu).

    • since: 11/21/05
    • access: public
    string stripTagsAndTrim (mixed $word_count, string $text, integer $maxLength)
    • string $text
    • integer $maxLength
    trim (line 61)

    Shorten the string to a number of words, preserving HTML tags while enforcing the closing of html tags.

    • since: 12/12/05
    • access: public
    void trim (integer $numWords, [boolean $addElipses = true])
    • integer $numWords
    • boolean $addElipses
    withValue (line 31)

    Instantiates a new String object with the passed value.

    • return: object
    • static:
    • access: public
    ref withValue (string $value)
    • string $value

    Redefinition of:
    String::withValue()
    Instantiates a new String object with the passed value.

    Inherited Methods

    Inherited From String

    String::String()
    String::fromString()
    String::isEqualTo()
    String::printableString()
    String::withValue()

    Inherited From SObject

    SObject::asA()
    SObject::asString()
    SObject::copy()
    SObject::copySameFrom()
    SObject::copyTwoLevel()
    SObject::deepCopy()
    SObject::isEqual()
    SObject::isEqualTo()
    SObject::isNotEqualTo()
    SObject::isNotReferenceTo()
    SObject::isReferenceTo()
    SObject::newFrom()
    SObject::postCopy()
    SObject::printableString()
    SObject::shallowCopy()
    SObject::_deepCopyArray()

    Documentation generated on Wed, 19 Sep 2007 10:24:34 -0400 by phpDocumentor 1.3.0RC3