SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class DocImportDOCX

Variables

NameVisibilityDescription
$number_formats 
$relationships 
$res 
$styles 
$symbol_font_map (static)
Mapping between PUA for Symbol font to regular characters

Key - UTF-8 encoded bytes
Value - Widechar bytes
$zip 

Functions

NameVisibilityDescription
EMUtoPXprivateEM units to pixels
blockprivateDraw block element
determineListTagprivateFor a given style tag, return a list tag (either 'ul' or 'ol')
determineParaTagprivateFor a given style tag, return a paragraph tag (either 'p' or 'h1', 'h2', etc)
determineStyleprivateFor a given paragraph element, determine the finalised style in use
drawRunsprivateOutput one or more `w:r` elements
drawTableprivateDraw a w:tbl element
drawingprivateRender a w:drawing object, i.e. an image
flattenBasedOnTreeprivateWalk the chain of styles via the "based on" field to generate a list of names
getHeadingsTreepublic (static)For a given XML document, return a tree of headings
getHtmlpublic (static)For a given XML doc file, return the HTML version.
getResourcespublic (static)For a given XML doc file, return an array of resources, in name => data format.
instancepublic (static)Return a `DocImport` object instance for converting a file with a given original name
isValidBlockElemprivateValidates element as block display
loadpublicThe main load function for a document.
loadFormatsprivateLoad the number formats from numbering.xml
loadRelationshipsprivateRelationships is how the main document.xml links together with various media files etc
loadStylesprivateLoad styles
numbersFromStylesprivateSometimes a numbering format refers to a style, the style itself contains the actual number format
parseCssprivateParse given css
pictprivateRender a w:pict object, i.e. an image
renderBlockRunsprivateRender all the runs (i.e. w:r elements) for a given block element
symbolSanitizeStringpublicConvert 'Symbol' font Private-Use-Area characters into real characters
symbolUnicodeToUtf8EntitypublicRegular expression callback for Symbol font conversion

private EMUtoPX

float $DocImportDOCX->EMUtoPX ( int|float $emu [, int $dpi ] );

EM units to pixels

private block

string $DocImportDOCX->block ( DOMElement $elem );

Draw block element

private determineListTag

string $DocImportDOCX->determineListTag ( array $style );

For a given style tag, return a list tag (either 'ul' or 'ol')

private determineParaTag

string $DocImportDOCX->determineParaTag ( array $style );

For a given style tag, return a paragraph tag (either 'p' or 'h1', 'h2', etc)

private determineStyle

array $DocImportDOCX->determineStyle ( DOMElement $elem );

For a given paragraph element, determine the finalised style in use

private drawRuns

string $DocImportDOCX->drawRuns ( array $runs );

Output one or more `w:r` elements

private drawTable

string $DocImportDOCX->drawTable ( DOMElement $elem );

Draw a w:tbl element

private drawing

string $DocImportDOCX->drawing ( DOMElement $elem );

Render a w:drawing object, i.e. an image

private flattenBasedOnTree

array $DocImportDOCX->flattenBasedOnTree ( array &$styles , array $heading );

Walk the chain of styles via the "based on" field to generate a list of names

public getHeadingsTree (from DocImport)

Treenode DocImport::getHeadingsTree ( string $filename , int $max_depth [, bool $include_body ] );

For a given XML document, return a tree of headings

Any heading level past the max_depth option is treated like body text.

public getHtml (from DocImport)

string DocImport::getHtml ( string $filename , array $images , array $headings );

For a given XML doc file, return the HTML version.

public getResources (from DocImport)

array DocImport::getResources ( string $filename );

For a given XML doc file, return an array of resources, in name => data format.

public instance (from DocImport)

unknown DocImport::instance ( mixed $orig_filename );

Return a `DocImport` object instance for converting a file with a given original name
Throws an exception on error

private isValidBlockElem

bool|bool $DocImportDOCX->isValidBlockElem ( DOMElement $elem );

Validates element as block display

public load

string|DOMDocument $DocImportDOCX->load ( string $filename );

The main load function for a document.
Throw an exception on error.

private loadFormats

array $DocImportDOCX->loadFormats ( );

Load the number formats from numbering.xml

private loadRelationships

array $DocImportDOCX->loadRelationships ( );

Relationships is how the main document.xml links together with various media files etc

private loadStyles

array $DocImportDOCX->loadStyles ( );

Load styles

private numbersFromStyles

void $DocImportDOCX->numbersFromStyles ( );

Sometimes a numbering format refers to a style, the style itself contains the actual number format
This function dereferences the number formats back again

private parseCss

array $DocImportDOCX->parseCss ( string $css );

Parse given css

private pict

string $DocImportDOCX->pict ( DOMElement $elem );

Render a w:pict object, i.e. an image

private renderBlockRuns

string $DocImportDOCX->renderBlockRuns ( DOMElement $block );

Render all the runs (i.e. w:r elements) for a given block element

You would think this would be a simple draw_runs call on the getElementsByTagName,
but we would never actually have it _that_ easy...

public symbolSanitizeString

string $DocImportDOCX->symbolSanitizeString ( string $string );

Convert 'Symbol' font Private-Use-Area characters into real characters

public symbolUnicodeToUtf8Entity

string $DocImportDOCX->symbolUnicodeToUtf8Entity ( string $wchar );

Regular expression callback for Symbol font conversion