[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/includes/patTemplate/patTemplate/ -> Reader.php (sommaire)

Base class for patTemplate readers $Id: Reader.php 49 2005-09-15 02:55:27Z rhuk $

Author: Stephan Schmidt <schst@php.net>
Poids: 1569 lignes (36 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

patTemplate_Reader:: (34 méthodes):
  setTemplateReference()
  readTemplates()
  loadTemplate()
  setOptions()
  addFunctionAlias()
  setRootAttributes()
  parseString()
  _parseAttributes()
  _startElement()
  _endElement()
  _characterData()
  _initLink()
  _closeLink()
  _initTemplate()
  _prepareTmplAttributes()
  _buildTemplateName()
  _closeTemplate()
  _initSubTemplate()
  _closeSubTemplate()
  _handleVariable()
  _handleComment()
  _getCData()
  _addToParentTemplate()
  _getFromParentTemplate()
  _addToParentTag()
  _adjustWhitespace()
  _inheritAttributes()
  _parentTagIs()
  _getCurrentLine()
  _createErrorMessage()
  getCurrentInput()
  shouldMaintainBc()
  isInUse()
  getTemplateRoot()


Classe: patTemplate_Reader  - X-Ref

Base class for patTemplate readers

This class is able to parse patTemplate tags from any string you hand it over
It will emulate some kind of SAX parsing by calling start-, end- and CData-handlers.

setTemplateReference( &$tmpl )   X-Ref
set a reference to the patTemplate object that instantiated the reader

param: object        patTemplate object

readTemplates( $input, $options = array()   X-Ref
read templates from any input

param: mixed    input to read from.
param: array    options, not implemented in current versions, but future versions will allow passing of options
return: array    template structure

loadTemplate( $input, $options = array()   X-Ref
load template from any input

If the a template is loaded, the content will not get
analyzed but the whole content is returned as a string.

param: mixed    input to load from.
param: array    options, not implemented in current versions, but future versions will allow passing of options
return: string  template content

setOptions( $options )   X-Ref
set options

param: array    array containing options

addFunctionAlias($alias, $function)   X-Ref
add an alias for a function

param: string  alias
param: string  function name

setRootAttributes( $attributes )   X-Ref
set the root attributes

param: array    array containing options

parseString( $string )   X-Ref
parse templates from string

param: string        string to parse
return: array        templates

_parseAttributes( $string )   X-Ref
parse an attribute string and build an array

param: string    attribute string
param: array    attribute array

_startElement( $ns, $name, $attributes )   X-Ref
handle start element

param: string        element name
param: array        attributes

_endElement( $ns, $name )   X-Ref
handle end element

param: string        element name

_characterData( $data, $readFromTemplate = true )   X-Ref
handle character data

param: string        data

_initLink( $attributes )   X-Ref
handle a Link

param: array        attributes
return: boolean        true on success

_closeLink( $tmpl )   X-Ref
close a link template

It will be added to the dependecies of the parent template.

param: array    template definition for the link

_initTemplate( $attributes )   X-Ref
create a new template

param: array        attributes
return: boolean        true on success

_prepareTmplAttributes( $attributes, $templatename )   X-Ref
prepare attributes

param: array    attributes
param: string    template name (only used for error messages)
return: array    attributes

_buildTemplateName()   X-Ref
build a template name

return: string    new template name

_closeTemplate( $tmpl, $data )   X-Ref
close the current template

return: boolean    true on success

_initSubTemplate( $attributes )   X-Ref
create a new sub-template

param: array        attributes
return: boolean        true on success

_closeSubTemplate( $subTmpl, $data )   X-Ref
close subtemplate

param: string        data
return: boolean        true on success

_handleVariable( $attributes, $data )   X-Ref
handle a variable

param: array    attributes of the var tag
param: string    cdata between the tags (will be used as default)
return: boolean    true on success

_handleComment( $attributes, $data )   X-Ref
handle a comment

param: array    attributes of the comment tag
param: string    cdata between the tags (will be used as default)
return: boolean    true on success

_getCData()   X-Ref
get the character data of the element

return: string

_addToParentTemplate( $property, $value, $key = null )   X-Ref
add to a property of the parent template

param: string    property to add to
param: mixed    value to add
param: string    key

_getFromParentTemplate( $property )   X-Ref
get a property of the parent template

param: string    property to add to
return: mixed    value to add

_addToParentTag( $property, $value, $key = null )   X-Ref
add to a property of the parent tag

param: string    property to add to
param: mixed    value to add
param: string    key

_adjustWhitespace( $data, $behaviour )   X-Ref
adjust whitespace in a CData block

param: string        data
param: string        behaviour
return: string        data

_inheritAttributes( $attributes )   X-Ref
inherit attributes from the parent template

The following attributes are inherited automatically:
- whitespace
- unusedvars

param: array    attributes
param: array    attributes with inherited attributes
return: array    new attribute collection

_parentTagIs( $type )   X-Ref
checks, whether the parent tag is of a certain type

This is needed to ensure, that subtemplates are only
placed inside a template

param: string    type (tmpl, sub, var, link)
return: boolean

_getCurrentLine()   X-Ref
get the current line number

return: integer        line number

_createErrorMessage( $msg )   X-Ref
create an error message

This method takes an error messages and appends the
current line number as well as a pointer to the input
(filename)

param: string    base error message
return: strin    error message

getCurrentInput()   X-Ref
get the current input

return: string

shouldMaintainBc()   X-Ref
tests whether the reader should maintain backwards compatibility

If enabled, you can still use 'default', 'empty', 'odd' and 'even'
instead of '__default', '__empty', etc.

This will be disabled by default in future versions.

return: boolean

isInUse()   X-Ref
returns, whether the reader currently is in use

return: boolean

getTemplateRoot()   X-Ref
get the template root for this reader

return: string



Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics