Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

(no description)

File Size: 376 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Horde_Text_Flowed:: (11 methods):
  __construct()
  setMaxLength()
  setOptLength()
  setDelSp()
  toFixed()
  toFixedArray()
  toFlowed()
  _reformat()
  _numquotes()
  _stuff()
  _unstuff()


Class: Horde_Text_Flowed  - X-Ref

The Text_Flowed:: class provides common methods for manipulating text
using the encoding described in RFC 3676 ('flowed' text).

This class is based on the Text::Flowed perl module (Version 0.14) found
in the CPAN perl repository.  This module is released under the Perl
license, which is compatible with the LGPL.

Copyright 2002-2003 Philip Mak
Copyright 2004-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.

__construct($text, $charset = 'UTF-8')   X-Ref
Constructor.

param: string $text     The text to process.
param: string $charset  The character set of $text.

setMaxLength($max)   X-Ref
Set the maximum length of a line of text.

param: integer $max  A new value for $_maxlength.

setOptLength($opt)   X-Ref
Set the optimal length of a line of text.

param: integer $max  A new value for $_optlength.

setDelSp($delsp)   X-Ref
Set whether to format text using DelSp.

param: boolean $delsp  Use DelSp?

toFixed($quote = false)   X-Ref
Reformats the input string, where the string is 'format=flowed' plain
text as described in RFC 2646.

return: string  The text converted to RFC 2646 'fixed' format.
param: boolean $quote  Add level of quoting to each line?

toFixedArray($quote = false)   X-Ref
Reformats the input string, and returns the output in an array format
with quote level information.

return: array  An array of arrays with the following elements:
param: boolean $quote  Add level of quoting to each line?

toFlowed($quote = false, array $opts = array()   X-Ref
Reformats the input string, where the string is 'format=fixed' plain
text as described in RFC 2646.

return: string  The text converted to RFC 2646 'flowed' format.
param: boolean $quote  Add level of quoting to each line?
param: array $opts     Additional options:

_reformat($toflowed, $quote, $wrap = true)   X-Ref
Reformats the input string, where the string is 'format=flowed' plain
text as described in RFC 2646.

param: boolean $toflowed  Convert to flowed?
param: boolean $quote     Add level of quoting to each line?
param: boolean $wrap      Wrap unquoted lines?

_numquotes($text)   X-Ref
Returns the number of leading '>' characters in the text input.
'>' characters are defined by RFC 2646 to indicate a quoted line.

return: integer  The number of leading quote characters.
param: string $text  The text to analyze.

_stuff($text, $num_quotes, $toflowed)   X-Ref
Space-stuffs if it starts with ' ' or '>' or 'From ', or if
quote depth is non-zero (for aesthetic reasons so that there is a
space after the '>').

return: string  The stuffed text.
param: string $text        The text to stuff.
param: string $num_quotes  The quote-level of this line.
param: boolean $toflowed   Are we converting to flowed text?

_unstuff($text)   X-Ref
Unstuffs a space stuffed line.

return: string  The unstuffed text.
param: string $text  The text to unstuff.