RTF encoding

NB - this produces just the bare minimum of RTF code to work in Word and OO.org

version 1
package wikindx4\core\importexport
author Mark Grimshaw

 Methods

RICHTEXTFORMAT

__construct(string $imgMagickPath) 

Parameters

$imgMagickPath

string

Close the list table and append the listOverrideTable string

closeListTable() 

Create fancy url hyperlinks

createFancyUrl(string $text) : string

Parameters

$text

string

Returns

string

Format text for HTML characters

formatText(string $text) : string

Parameters

$text

string

Returns

string

Set some defaults and create the RTF opening tag

header() : string

Returns

string

Read an image from either file or URL

imageCallback(array $matchArray) : string

Parameters

$matchArray

array

Returns

string

callback for HTML style elements of <P>

paraCallback(array $match) : string
author Mark Grimshaw
version 1

Parameters

$match

array

Returns

string

deal with <P> parameters

paraStyle(string $param, string $text) : string
author Mark Grimshaw
version 1

Parameters

$param

string

$text

string

Returns

string

parse tinyMCE code to RTF tags

parse(string $text) : string
author Mark Grimshaw
version 1

Parameters

$text

string

input text

Returns

stringparsed text

Create lists

parseLists(string $text, string $callbackUnorderedList, string $callbackOrderedList) : string
Inherited
author Mark Grimshaw
version 1
inherited_from \TINYMCETEXTEXPORT::parseLists()

Parameters

$text

string

$callbackUnorderedList

string

$callbackOrderedList

string

Returns

string

parse <span>.

parseSpan(string $text, array $callbackStyle) : string
Inherited

..

author Mark Grimshaw
version 1
inherited_from \TINYMCETEXTEXPORT::parseSpan()

Parameters

$text

string

$callbackStyle

array

Returns

string

UTF-8 to unicode

utf8_2_unicode(string $string) : string
Inherited

returns a string of unicode character codes Code adapted from opensource PHP code by Scott Reynen at: http://www.randomchaos.com/document.php?source=php_and_unicode

inherited_from \TINYMCETEXTEXPORT::utf8_2_unicode()

Parameters

$string

string

UTF-8 encoded string

Returns

stringunicode character codes

Callback for createLists()

callbackOrderedList(array $matchArray) : string

Ordered Lists. NB - IE sometimes closes the

  • tag sometimes doesn't - bravo!

  • Parameters

    $matchArray

    array

    Returns

    string

    Callback for createLists()

    callbackUnorderedList(array $matchArray) : string

    Unordered lists. NB - IE sometimes closes the

  • tag sometimes doesn't - bravo!

  • Parameters

    $matchArray

    array

    Returns

    string

    Initialize the class

    initClass(string $output) 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::initClass()

    Parameters

    $output

    string

    parse <div>.

    parseDiv(string $text) : string
    Inherited

    ..

    author Mark Grimshaw
    version 1
    inherited_from \TINYMCETEXTEXPORT::parseDiv()

    Parameters

    $text

    string

    Returns

    string

    callback for HTML style elements of font and span

    styleCallback(array $match) : string
    author Mark Grimshaw
    version 1

    Parameters

    $match

    array

    Returns

    string

    Callback for adding a footnote to an indented quotation.

    callback_footnoteIndent(array $matches) : string

    Parameters

    $matches

    array

    Returns

    string

    Convert hexadecimal colours to RTF colours

    convertColour(string $colour) : string

    Parameters

    $colour

    string

    Returns

    string

    Create email hyperlinks

    createEmail(string $text) : string

    Parameters

    $text

    string

    Returns

    string

    Set font types and create top level font blocks

    createFontBlocks(string $font) : int

    Parameters

    $font

    string

    Returns

    intFont index

    Create list tables for Arabic numerals

    createListTablesArabic() 

    Find any tables

    createTables(string $text) : string

    Parameters

    $text

    string

    Returns

    string

    callback for parsing [footnote].

    footnotes(array $matchArray) : string

    ..[/footnote]

    author Mark Grimshaw
    version 1

    Parameters

    $matchArray

    array

    Returns

    string

    callback for indent long quotations

    indentQ(array $matchArray) : string
    author Mark Grimshaw
    version 1

    Parameters

    $matchArray

    array

    Returns

    string

    indent long quotations

    indentQuotations(string $text, integer $numWords, boolean $keepQuoteMarks) : string
    author Mark Grimshaw
    version 1

    Parameters

    $text

    string

    $numWords

    integer

    $keepQuoteMarks

    boolean

    Returns

    string

    Initialize RTF values either as defaults or from user-requested settings

    init() 

    For the cases where a list element has style information

    listStyleCallback(array $match) : string

    Parameters

    $match

    array

    Returns

    string

    parse [footnote].

    parseFootnotes(string $text, array $footnoteOffsetIds, int $fontSize) : string

    ..[/footnote]

    author Mark Grimshaw
    version 1

    Parameters

    $text

    string

    $footnoteOffsetIds

    array

    $fontSize

    int

    Returns

    string

    Callback for createEmail() above

    setEmail(array $matchArray) : string

    Parameters

    $matchArray

    array

    Returns

    string

    Callback for createFancyUrl() above

    setFancyUrl(array $matchArray) : string

    Parameters

    $matchArray

    array

    Returns

    string

    Set font blocks

    setFontBlock(string $font) : int

    Parameters

    $font

    string

    Returns

    intFont index

    deal with style elements for DIV and SPAN

    style(string $styleString, string $text) : string
    author Mark Grimshaw
    version 1

    Parameters

    $styleString

    string

    $text

    string

    Returns

    string

    Format Tables

    tableFormat(array $matchArray) : string

    We've no way of knowing the browser window size from PHP so we assume a width of 1000 -- if the resultant tableWidth is higher than $this->tableWidth, we limit it to $this->tableWidth. Must count the number of cells in each row and divide them into $tableWidth to get cell width.

    Parameters

    $matchArray

    array

    Returns

    string

     Properties

     

    $colourArray 

    default black font and blue for hyperlinks

     

    $colourTable 
     

    $fontBlock 
     

    $lineSpacing 
     

    $listTable 
     

    $cite 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$cite
     

    $fontIndex 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$fontIndex
     

    $fontSizes 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$fontSizes
     

    $fonts 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$fonts
     

    $footnoteText 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$footnoteText
     

    $indentL 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$indentL
     

    $indentR 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$indentR
     

    $isIE 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$isIE
     

    $justify 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$justify
     

    $lineSpacingIndentQ 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$lineSpacingIndentQ
     

    $lists 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$lists
     

    $nested 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$nested
     

    $paperSize 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$paperSize
     

    $session 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$session
     

    $spanParse 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$spanParse
     

    $styleArray 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$styleArray
     

    $tableStyle 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$tableStyle
     

    $tableWidth 
    Inherited
    inherited_from \TINYMCETEXTEXPORT::$$tableWidth
     

    $colours 
     

    $defaultFontBlock 
     

    $fontBlocks 
     

    $imConvertPath 
     

    $keepQuoteMarks 
     

    $listId 
     

    $listIndent 
     

    $listIndentExtra 
     

    $listIndex 
     

    $listOverrideTable 
     

    $listType 
     

    $qme 
     

    $qms 
     

    $quoteFontSize 
     

    $quoteNumWords 
     

    $vars 
     

    $wpConfig