/sources/xhtml.php

Description
Functions
extract_html_body (line 202)

Turn a full HTML document into an HTML fragment.

  • return: The fragment
string extract_html_body (string $html)
  • string $html: The document
hide_the_evidence (line 27)

Function that tucks-under-the-carpet lumps of XHTML that knowingly won't validate.

  • return: Hidden away version
tempcode hide_the_evidence (tempcode $html)
  • tempcode $html: What to hide away
xhtmlise_html (line 39)

Function that 'fixes' HTML (or bad XHTML) enough for it to pass most basic structural validation.

  • return: The converted string
string xhtmlise_html (string $html, [boolean $definitely_want = false])
  • string $html: The XHTML string to convert to XHTML
  • boolean $definitely_want: Whether to force a repair even if we aren't in XHTML mode
xhtml_substr (line 223)

XHTML-aware substring extraction. Note that it will strip images, linebreaks, rules, etc - it's intended really for inline XHTML.

  • return: The result.
string xhtml_substr (string $html, integer $from, [?integer $length = NULL], [boolean $literal_pos = false], [boolean $ellipses = false], [float $grammar_completeness_tolerance = 0.0])
  • string $html: The text to perform on.
  • integer $from: The start position of the cut (HTML tags will be taken from before this though).
  • ?integer $length: The length you want the concatenated text to be (NULL: go to end).
  • boolean $literal_pos: Whether to do a substr based on literal position in XHTML, rather than based on number of visible characters.
  • boolean $ellipses: Whether to add ellipses.
  • float $grammar_completeness_tolerance: A fraction of the length we may exceed by in order to maintain grammar tolerance (finish sentences, finish paragraphs, finish the whole thing).
_smart_grammar_says_continue (line 549)

XHTML-aware helper function to try and get to a nice grammatical point to call our substring termius.

  • return: Whether to keep continuing.
boolean _smart_grammar_says_continue (integer $nieve_end_pos, float $grammar_completeness_tolerance, integer $real_offset, string $html, integer $desired_length, [boolean $testing_ahead = false])
  • integer $nieve_end_pos: The nieve position where we'd end on.
  • float $grammar_completeness_tolerance: A fraction of the length we may exceed by in order to maintain grammar tolerance (finish sentences, finish paragraphs, finish the whole thing).
  • integer $real_offset: Current offset in the text.
  • string $html: The text to perform on.
  • integer $desired_length: Desired (nieve) substring length.
  • boolean $testing_ahead: Whether this is a cursory look-ahead rather than a byte-by-byte callback (therefore skip fine-grained checks which would interfere with a cursory result).
_smart_grammar_says_futile (line 501)

XHTML-aware helper function to try and get to a nice grammatical point to call our substring termius.

  • return: Whether to keep continuing.
boolean _smart_grammar_says_futile (integer $nieve_end_pos, float $grammar_completeness_tolerance, integer $real_offset, string $html, integer $desired_length)
  • integer $nieve_end_pos: The nieve position where we'd end on.
  • float $grammar_completeness_tolerance: A fraction of the length we may exceed by in order to maintain grammar tolerance (finish sentences, finish paragraphs, finish the whole thing).
  • integer $real_offset: Current offset in the text.
  • string $html: The text to perform on.
  • integer $desired_length: Desired (nieve) substring length.

Documentation generated on Sun, 02 Jan 2011 23:29:27 +0000 by phpDocumentor 1.4.3