Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

(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.

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

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

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

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.

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

_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.

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

_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 '>').

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?
return: string  The stuffed text.

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

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