Andrew's Web Libraries (AWL)
vComponent Class Reference
Inheritance diagram for vComponent:
Collaboration diagram for vComponent:

Public Member Functions

 __construct ($propstring=null, &$refData=null)
 
 initFromIterator (&$iterator, $begin=-1)
 
 getIterator ()
 
 initFromText (&$plainText)
 
 rewind ()
 
 explode ()
 
 close ()
 
 parseFrom (&$iterator)
 
 ComponentCount ()
 
 propertiesCount ()
 
 getComponentAt ($position)
 
 getPropertyAt ($position)
 
 clearPropertyAt ($position)
 
 GetType ()
 
 SetType ( $type)
 
 CollectParameterValues ( $parameter_name)
 
 GetProperty ( $type)
 
 GetPValue ( $type)
 
 GetProperties ( $type=null)
 
 GetPropertiesByPath ( $path)
 
 ClearProperties ( $type=null)
 
 SetProperties ( $new_properties, $type=null)
 
 AddProperty ( $new_property, $value=null, $parameters=null)
 
 GetComponents ( $type=null, $normal_match=true)
 
 ClearComponents ( $type=null)
 
 SetComponents ( $new_component, $type=null)
 
 AddComponent ( $new_component)
 
 MaskComponents ( $keep, $recursive=true)
 
 MaskProperties ( $keep, $component_list=null)
 
 WrapComponent ( $content)
 
 UnwrapComponent (&$content)
 
 Render ($restricted_properties=null, $force_rendering=false)
 
 isValid ()
 
 TestFilter ( $filters)
 
- Public Member Functions inherited from vObject
 __construct (&$master=null)
 
 isValid ()
 
 setMaster ($master)
 
 getMaster ()
 

Public Attributes

const KEYBEGIN = 'BEGIN:'
 
const KEYBEGINLENGTH = 6
 
const KEYEND = "END:"
 
const KEYENDLENGTH = 4
 
const VEOL = "\r\n"
 

Static Public Attributes

static $PREPARSED = false
 

Protected Member Functions

 RenderWithoutWrap ($restricted_properties=null, $force_rendering=false)
 
 RenderWithoutWrapFromObjects ()
 
 RenderWithoutWrapFromIterator ($unrolledComponents)
 
- Protected Member Functions inherited from vObject
 invalidate ()
 

Private Attributes

 $components
 
 $properties
 
 $type
 
 $iterator
 
 $seekBegin
 
 $seekEnd
 
 $propertyLocation
 

Additional Inherited Members

- Protected Attributes inherited from vObject
 $lineHeap
 
 $valid = true
 
 $master
 

Detailed Description

Definition at line 21 of file vComponent.php.

Member Function Documentation

◆ AddComponent()

vComponent::AddComponent (   $new_component)

Adds a new subcomponent

Parameters
vComponent$new_componentThe new component to append to the set

Definition at line 647 of file vComponent.php.

◆ AddProperty()

vComponent::AddProperty (   $new_property,
  $value = null,
  $parameters = null 
)

Adds a new property

Parameters
vProperty$new_propertyThe new property to append to the set, or a string with the name
string$valueThe value of the new property (default: param 1 is an vProperty with everything
array$parametersThe key/value parameter pairs (default: none, or param 1 is an vProperty with everything)

Definition at line 531 of file vComponent.php.

◆ ClearComponents()

vComponent::ClearComponents (   $type = null)

Clear all components, or the components matching a particular type

Parameters
string$typeThe type of component - omit for all components

Definition at line 590 of file vComponent.php.

◆ ClearProperties()

vComponent::ClearProperties (   $type = null)

Clear all properties, or the properties matching a particular type

Parameters
string | array$typeThe type of property - omit for all properties - or an array associating property names with true values: array( 'PROPERTY' => true, 'PROPERTY2' => true )

Definition at line 490 of file vComponent.php.

◆ CollectParameterValues()

vComponent::CollectParameterValues (   $parameter_name)

Collect an array of all parameters of our properties which are the specified type Mainly used for collecting the full variety of references TZIDs

Definition at line 356 of file vComponent.php.

◆ ComponentCount()

vComponent::ComponentCount ( )

count of component

Returns
int

Definition at line 278 of file vComponent.php.

◆ explode()

vComponent::explode ( )

fill arrays with components and properties if they are empty.

basicaly the object are just pointer to memory with input data (iterator with seek address on start and end) but when you want get information of any components or properties is necessary call this function first

See also
GetComponents(), ComponentsCount(), GetProperties(), PropertiesCount()

Definition at line 163 of file vComponent.php.

◆ getComponentAt()

vComponent::getComponentAt (   $position)
Parameters
$position
Returns
null - whet is position out of range

Definition at line 296 of file vComponent.php.

◆ GetComponents()

vComponent::GetComponents (   $type = null,
  $normal_match = true 
)

Get all sub-components, or at least get those matching a type, or failling to match, should the second parameter be set to false. Component types may be a string or an array associating property names with true values: array( 'TYPE' => true, 'TYPE2' => true )

Parameters
mixed$typeThe type(s) to match (default: All)
boolean$normal_matchSet to false to invert the match (default: true)
Returns
array an array of the sub-components

Definition at line 562 of file vComponent.php.

◆ GetProperties()

vComponent::GetProperties (   $type = null)

Get all properties, or the properties matching a particular type, or matching an array associating property names with true values: array( 'PROPERTY' => true, 'PROPERTY2' => true )

Definition at line 411 of file vComponent.php.

◆ GetPropertiesByPath()

vComponent::GetPropertiesByPath (   $path)

Return an array of properties matching the specified path

Returns
array An array of vProperty within the tree which match the path given, in the form [/]COMPONENT[/...]/PROPERTY in a syntax kind of similar to our poor man's XML queries. We also allow COMPONENT and PROPERTY to be !COMPONENT and !PROPERTY for ++fun.
Note
At some point post PHP4 this could be re-done with an iterator, which should be more efficient for common use cases.

There is more to the path, so we recurse into that sub-part

Our input $path was not rooted, so we recurse further

Definition at line 438 of file vComponent.php.

◆ GetProperty()

vComponent::GetProperty (   $type)

Return the first instance of a property of this name

So we can call methods on the result of this, make sure we always return a vProperty of some kind

Definition at line 382 of file vComponent.php.

◆ GetPValue()

vComponent::GetPValue (   $type)

Return the value of the first instance of a property of this name, or null

Definition at line 399 of file vComponent.php.

◆ GetType()

vComponent::GetType ( )

Return the type of component which this is

Definition at line 335 of file vComponent.php.

◆ MaskComponents()

vComponent::MaskComponents (   $keep,
  $recursive = true 
)

Mask components, removing any that are not of the types in the list

Parameters
array$keepAn array of component types to be kept
boolean$recursive(default true) Whether to recursively MaskComponents on the ones we find

Definition at line 680 of file vComponent.php.

◆ MaskProperties()

vComponent::MaskProperties (   $keep,
  $component_list = null 
)

Mask properties, removing any that are not in the list

Parameters
array$keepAn array of property names to be kept
array$component_listAn array of component types to check within

Definition at line 704 of file vComponent.php.

◆ propertiesCount()

vComponent::propertiesCount ( )

count of component

Returns
int

Definition at line 287 of file vComponent.php.

◆ Render()

vComponent::Render (   $restricted_properties = null,
  $force_rendering = false 
)

render object to string with wraped lines

Parameters
null$restricted_properties
bool$force_rendering
Returns
string - rendered object

Definition at line 880 of file vComponent.php.

◆ RenderWithoutWrap()

vComponent::RenderWithoutWrap (   $restricted_properties = null,
  $force_rendering = false 
)
protected

Render vComponent without wrap lines

Parameters
null$restricted_properties
bool$force_rendering
Returns
string

Definition at line 760 of file vComponent.php.

◆ RenderWithoutWrapFromIterator()

vComponent::RenderWithoutWrapFromIterator (   $unrolledComponents)
protected

take source data in Iterator and recreate to string

Parameters
boolean$unroledComponents- have any components
Returns
string - rendered object

Definition at line 812 of file vComponent.php.

◆ RenderWithoutWrapFromObjects()

vComponent::RenderWithoutWrapFromObjects ( )
protected

Let render property by property

Returns
string

Definition at line 793 of file vComponent.php.

◆ SetComponents()

vComponent::SetComponents (   $new_component,
  $type = null 
)

Sets some or all sub-components of the component to the supplied new components

Parameters
arrayof vComponent $new_components The new components to replace the existing ones
string$typeThe type of components to be replaced. Defaults to null, which means all components will be replaced.

Definition at line 626 of file vComponent.php.

◆ SetProperties()

vComponent::SetProperties (   $new_properties,
  $type = null 
)

Set all properties, or the ones matching a particular type

Definition at line 516 of file vComponent.php.

◆ SetType()

vComponent::SetType (   $type)

Set the type of component which this is

Definition at line 343 of file vComponent.php.

◆ TestFilter()

vComponent::TestFilter (   $filters)

Test a PROP-FILTER or COMP-FILTER and return a true/false COMP-FILTER (is-defined | is-not-defined | (time-range?, prop-filter*, comp-filter*)) PROP-FILTER (is-defined | is-not-defined | ((time-range | text-match)?, param-filter*))

Parameters
array$filterAn array of XMLElement defining the filter
Returns
boolean Whether or not this vComponent passes the test

Definition at line 909 of file vComponent.php.

◆ UnwrapComponent()

vComponent::UnwrapComponent ( $content)

This unescapes the (CRLF + linear space) wrapping specified in RFC2445. According to RFC2445 we should always end with CRLF but the CalDAV spec says that normalising XML parsers often muck with it and may remove the CR. We accept either case.

Definition at line 749 of file vComponent.php.

◆ WrapComponent()

vComponent::WrapComponent (   $content)

This imposes the (CRLF + linear space) wrapping specified in RFC2445. According to RFC2445 we should always end with CRLF but the CalDAV spec says that normalising XML parsers often muck with it and may remove the CR. We output RFC2445 compliance.

In order to preserve pre-existing wrapping in the component, we split the incoming string on line breaks before running wordwrap over each component of that.

Definition at line 732 of file vComponent.php.


The documentation for this class was generated from the following file: