Constants

SWITCH_PAGE

SWITCH_PAGE

END

END

ENTITY

ENTITY

STR_I

STR_I

LITERAL

LITERAL

EXT_I_0

EXT_I_0

EXT_I_1

EXT_I_1

EXT_I_2

EXT_I_2

PI

PI

LITERAL_C

LITERAL_C

EXT_T_0

EXT_T_0

EXT_T_1

EXT_T_1

EXT_T_2

EXT_T_2

STR_T

STR_T

LITERAL_A

LITERAL_A

EXT_0

EXT_0

EXT_1

EXT_1

EXT_2

EXT_2

OPAQUE

OPAQUE

LITERAL_AC

LITERAL_AC

EN_TYPE

EN_TYPE

EN_TAG

EN_TAG

EN_CONTENT

EN_CONTENT

EN_FLAGS

EN_FLAGS

EN_ATTRIBUTES

EN_ATTRIBUTES

EN_TYPE_STARTTAG

EN_TYPE_STARTTAG

EN_TYPE_ENDTAG

EN_TYPE_ENDTAG

EN_TYPE_CONTENT

EN_TYPE_CONTENT

EN_FLAGS_CONTENT

EN_FLAGS_CONTENT

EN_FLAGS_ATTRIBUTES

EN_FLAGS_ATTRIBUTES

WBXML_VERSION

WBXML_VERSION

LOG_DETAILED

LOG_DETAILED

LOG_PROTOCOL

LOG_PROTOCOL

LOG_MAXCONTENT

LOG_MAXCONTENT

Properties

$version

$version : integer

Store the wbxml version value. Used to verify we have a valid wbxml input stream.

Type

integer

$publicid

$publicid : 

Type

$publicstringid

$publicstringid : 

Type

$charsetid

$charsetid : 

Type

$stringtable

$stringtable : 

Type

$_dtd

$_dtd : array

The code page definitions for the wbxml encoder/decoders

Type

array

$_tagcp

$_tagcp : integer

Track the codepage for the currently output tag so we know when to switch codepages.

Type

integer

$_logStack

$_logStack : array

Used to hold log entries for each tag so we can only output the log entries for the tags that are actually sent (@see $_stack).

Type

array

$_logger

$_logger : \Horde_Log_Logger

Logger

Type

\Horde_Log_Logger

$_stream

$_stream : \Horde_Stream

Input or Output stream

Type

\Horde_Stream

$_procid

$_procid : integer

The current procid

Type

integer

$_logLevel

$_logLevel : 

Logging level.

Type

$_buffer

$_buffer : \stream

Temporary string buffer

Type

\stream

$_isWbxml

$_isWbxml : boolean

Flag to indicate we have a valid wbxml input stream

Type

boolean

$_attrcp

$_attrcp : 

Type

$_ungetbuffer

$_ungetbuffer : 

Type

$_readHeader

$_readHeader : 

Type

$_lastStartElement

$_lastStartElement : array

Cache the last successfully fetched start tag array. Used to be able to easily detected emtpy nodes after the element was already fetched.

Type

array

Methods

__construct()

__construct(\stream  $stream,   $log_level = self::LOG_PROTOCOL) 

Parameters

\stream $stream

The [input|output] stream.

$log_level

getStream()

getStream() 

setLogger()

setLogger(\Horde_Log_Logger  $logger) 

Set the logger instance

Parameters

\Horde_Log_Logger $logger

The logger.

readWbxmlHeader()

readWbxmlHeader() 

Start reading the wbxml stream, pulling off the initial header and populate the properties.

isWbxml()

isWbxml() : boolean

Check that the input stream contains wbxml. Basically looks for a valid WBXML_VERSION header. self::readWbxmlHeader MUST have been called already.

Returns

boolean

getFullInputStream()

getFullInputStream() : resource

Return the full, raw, input stream. Used for things like SendMail request where we don't have wbxml to parse. The calling code is responsible for closing the stream.

Returns

resource

getElement()

getElement() : array|boolean

Returns either start, content or end, and auto-concatenates successive content.

Returns

array|boolean —

The element structure or false on failure.

isEmptyElement()

isEmptyElement(array  $el) : boolean

Returns whether or not the passed in element array represents an empty tag.

Parameters

array $el

The element array.

Returns

boolean —

True if $el is an empty start tag, otherwise false.

getLastStartElement()

getLastStartElement() : array|boolean

Returns the last element array fetched using getElementStartTag()

Returns

array|boolean —

The element array, or false if none available.

peek()

peek() : array

Peek at the next element in the stream.

Returns

array —

The next element in the stream.

getElementStartTag()

getElementStartTag(string  $tag) : array|boolean

Get the next tag, which is assumed to be a start tag.

Parameters

string $tag

The element that this should be a start tag for.

Returns

array|boolean —

The start tag array | false on failure.

getElementEndTag()

getElementEndTag() : array|boolean

Get the next tag, which is assumed to be an end tag.

Returns

array|boolean —

The element array | false on failure.

getElementContent()

getElementContent() : mixed

Get the element contents

Returns

mixed —

The content of the current element | false on failure.

getToken()

getToken() : array

Get the next [start | content | end] tag.

Returns

array —

The next, complete, token array.

_ungetElement()

_ungetElement(array  $element) : void

Unget the specified element from the stream. Places the element into the unget buffer.

Parameters

array $element

The element array to unget.

_logToken()

_logToken(  $el) : void

Log the token.

Parameters

$el

_getToken()

_getToken() : array

Get the next start tag, content or end tag

Returns

array —

The element array.

_readVersion()

_readVersion() 

Read the Wbxml version header byte, and buffer the input incase we need the full stream later.

_getAttributes()

_getAttributes() : mixed

Get the element attributes

Returns

mixed —

The value of the element's attributes.

_splitAttribute()

_splitAttribute(string  $attr) : array

Parses an attribute string

Parameters

string $attr

The raw attribute value.

Returns

array —

The attribute hash

_getTermStr()

_getTermStr() : string

Get a null terminated string from the stream.

Returns

string —

The string

_getOpaque()

_getOpaque(integer  $len) : string

Get an opaque value from the stream of the specified length.

Parameters

integer $len

The length of the data to fetch.

Returns

string —

A string of bytes representing the opaque value.

_getByte()

_getByte() : string

Fetch a single byte from the stream.

Returns

string —

The single byte.

_getMBUInt()

_getMBUInt() : integer

Get an MBU integer

Returns

integer

_getStringTable()

_getStringTable() : string

Fetch the string table. Don't think we use the results anywhere though.

Returns

string —

The string table.

_getStringTableEntry()

_getStringTableEntry(integer  $id) : string

Really don't know for sure what this method is supposed to do, it is called from numerous places in this class, but the original zpush code did not contain this method.

..so, either it's completely broken, or normal use-cases do not reach the calling code. Either way, it needs to eventually be fixed.

Parameters

integer $id

The entry to return??

Returns

string

_getMapping()

_getMapping(integer  $cp, integer  $id) : mixed

Get a dtd mapping

Parameters

integer $cp

The codepage to use.

integer $id

The property.

Returns

mixed —

The mapped value.

_getTempStream()

_getTempStream() : \stream

Return the temporary buffer stream.

Returns

\stream