| applications_cms

# Class: Bs_XAtom Source Location: /applications/cms/Bs_XAtom.class.php
### Class Overview
    Bs_Object
       |
       --Bs_XAtom
XAtom Class (Abstaract Class) #### Author(s): Sam Blum <at blueshoes dot org> #### Version: 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:22:34 $ #### Copyright: blueshoes.org | ### Variables $_APP $_atomContainer $_bsEnv $_failedReason $_parentNode $_tempContainer | ### Methods Bs_XAtom datetimeInRange getFailedReason init isAlive matchBrowser matchFeature matchPlugin normalizeRef normalizeVersion persist reset toXml _basicInit _normalizeContainer
### Child classes: Bs_Block Block Class Bs_Layout Layout Class Bs_Node Node Class Bs_Page Page Class | ### Inherited Variables | ### Inherited Methods #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 66] XAtom Class (Abstaract Class) VERSION (FOR INFO): ------------------- The version of this page. there will be more than one page with this name. The other pages with the same name are versions of this page (older, newer). The page with the highest published number is the one that gets spitted out. This means that, because of the diversity, an english page may be newer than a german one, and an explorer page may be newer than a netspace one. The version string looks like '3.1.27'. It has 3 parts. Every part (number) can be 1-n (not 0). The 1st one is the site version. the 2nd one may be used whenever wanted. The 3rd one is consecutive, increased by one each time the page gets published. There are similarities to cvs. PUBLISH CYCLE (FOR INFO) ------------------------- Tells the mode the page is in. one of: 'new' = the page has just been created. (if it was created using a branch, it will be 'modified'.) 'modified' = there have been changes. 'locked' = the page would be in 'modified' mode, but someone is currently making changes. 'review' = page is waiting for the reviewer(s) to give his/their ok. no modifications can be made at the moment. 'ready' = page is waiting for the publisher to give his ok. no modifications can be made at the moment. 'published' = page is published. no modifications can be made anymore (without saving as new version). #### Tags:
copyright: | blueshoes.org
pattern: | singleton: (pseudostatic)
access: | public
version: | 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:22:34 $
author: | Sam Blum <at blueshoes dot org>
[ Top ] ### Class Variables #### $_APP = [line 122] reference to the global ini settings #### Tags:
var: | (hash)
Type: | array
[ Top ] #### $_atomContainer = array( 'UID' => NULL, 'element' => "", 'parentUni' => NULL, 'lang' => '', 'version' => '', 'mime' => '', 'level' => NULL, 'condition' => 'active', 'pubCycle' => 'new', 'isProtected' => NULL, 'storageMedia' => NULL, 'absPathToXml' => "", 'fileExt' => "", 'alive' => array( 'isDeactivated' => FALSE, 'startDatetime' => '0000-00-00 00:00:00', 'endDatetime' => '0000-00-00 00:00:00' ),'browscap'=>array('browser'=>"",'feature'=>"",'plugin'=>"",),'bsHead'=>array('version'=>'1.0',),) [line 74] This data will be persited when caching is used. See also _tempContainer below.
Type: | mixed
[ Top ] #### $_bsEnv = [line 128] reference to the bs environment var hash #### Tags:
var: | (hash)
Type: | array
[ Top ] #### $_failedReason = [line 135] vector telling why $this is not valid. #### Tags:
see: | Bs_XAtom::getFailedReason()
Type: | vector
[ Top ] #### $_parentNode = NULL [line 141]
Type: | mixed
[ Top ] #### $_tempContainer = array( 'isValid' => NULL , 'isAlive' => NULL, 'isDataLoaded' => FALSE, 'xmlFileFound' => FALSE, ) [line 107] This data will not be persisted
Type: | mixed
[ Top ] ### Class Methods ### constructor Bs_XAtom [line 146]
`Bs_XAtom Bs_XAtom( mixed $__file__)`
Constructor. [ Top ] ### method datetimeInRange [line 492]
`int datetimeInRange( [string $startDatetime = NULL], [string $endDatetime = NULL], [string $now = NULL])`
Tells if this element is ALIVE. That means if 'now-time' is between the start- and end-time of of this object. See $_atomContainer['alive']['startDatetime']; $_atomContainer['alive']['endDatetime']; above. The check may also be done with a time passed as 3rd parameter instead of using current gmt time. Everything in gmt. RETURN : start end ----------------|------------------------|-------------- -1 | 0 ] +1 now < start == -1 | ] end <= now == +1 NOTE I: If you pass at least the 2 first parameters, you may use this function static ($this is then not used). NOTE II: A valid datetime looks like "yyyy-mm-dd hh:mm:ss" and everything else gives wrong results. if for example startDatetime is empty or "0000-00-00 00:00:00" this means "there is none", thus "it is already active". The same applies for endDatetime "never expires". In a stupid situation it would even be possible that the datetime is too young AND too old. But this case is not detected. E.g. start:2005, end:1999, now:2001 you would get a -1 (expired) here. #### Tags:
return: | see above
access: | public
#### Parameters:
string | $startDatetime | (optional, default 'this start time') gmt "yyyy-mm-dd hh:mm:ss"
string | $endDatetime | (optional, default 'this end time') gmt "yyyy-mm-dd hh:mm:ss"
string | $now | (optional, default now) gmt "yyyy-mm-dd hh:mm:ss"
[ Top ] ### method getFailedReason [line 337]
`array getFailedReason( [mixed $verbose = FALSE])`
Tells what went wrong. see error-documents-howto.doc the vector has 3 elements. element 0 is the standard http error code, element 1 is the bs additional code, element 2 is for for additional information, if used at all. it is an array (hash or vector) and it may be empty. example: array(410, 1, array('datetime')); would mean that the page expired on 'datetime' and thus is gone. #### Tags:
return: | (vector)
see: | 2do
access: | public
[ Top ] ### method init [line 173]
`bool init( mixed $UID)`
Init this object using UID (Unified ID). param $UID: The UID is either numeric (ID of Db), a string or an array (hash). for string and array see the codingGuidelinex.txt for details. Overridden in child classes as: Bs_Block::init() Init this object using UID (Unified ID). Bs_Layout::init() Init this object using UID (Unified ID). Bs_Node::init() Init this object using UID (Unified ID). Bs_Page::init() Init this object using UID (Unified ID). #### Parameters:
mixed | $UID | (see above.)
[ Top ] ### method isAlive [line 524]
`bool isAlive( )`
Tells if something (page, node, block, whatever) with the given properties is alive or not. For alive it must be valid and 'now' must be between start- and end-time #### Tags:
see: | Bs_XAtom::datetimeInRange()
[ Top ] ### method matchBrowser [line 562]
`bool matchBrowser( [mixed $browserString = NULL])`
tells if the current user browser (manufacturer and version) matches. param $browserString looks like "ie4+;ns4+;op5+;ie4.5-6" it is a semicolon separated list. examples of junks: +---------+----------------------------+ | EXAMPLE | MEANING | +---------+----------------------------+ | ie4 | exactly ie4 is allowed | | ie4.5+ | ie4.5 and above is allowed | | ie4.5-6 | ie4.5 up to ie6 is allowed | +---------+----------------------------+ on the first match TRUE is returned, so just one junk has to match. instead of passing such a semicolon-separated list, you may aswell pass just one browser as string (eg 'ie4+') or a vector with such strings. if your string or array is empty, TRUE is returned. #### Tags:
throws: | NULL if we can't tell (because the browser info is not available).
access: | public
#### Parameters:
mixed | $browserString | (string or vector, see above)
[ Top ] ### method matchFeature [line 663]
`bool matchFeature( [mixed $featureString = NULL])`
tells if the current user browser features match. param $featureString looks like "javaScriptEnabled;cookiesSession" it is a semicolon separated list. all features have to match to get a TRUE return value. if at least one does not match, you get FALSE. if none fails but 1-n cannot be checked then you get NULL. the following features are detectable: (see Bs_Browscap.class.php) cookiesSession - frames cookiesPermanent - iFrames javaScript - tables javaScriptEnabled - fileUpload javaApplets - png javaAppletsEnabled - tableBgImage metaRefresh - xml instead of passing such a semicolon-separated list, you may aswell pass just one feature as string (eg 'javaScriptEnabled') or a vector with such strings. if your string or array is empty, TRUE is returned. #### Tags:
todo: | add support to check versions like for javascript 1.2+
throws: | NULL if we can't tell (because not all features have been checked).
access: | public
#### Parameters:
mixed | $featureString | (string or vector, see above)
[ Top ] ### method matchPlugin [line 721]
`bool matchPlugin( [mixed $pluginString = NULL])`
tells if the current user browser plugins match. param $pluginString looks like "flash;pdf" it is a semicolon separated list. all plugins have to match to get a TRUE return value. if at least one does not match, you get FALSE. if none fails but 1-n cannot be checked then you get NULL. the following plugins are detectable: 'flash' 'pdf' instead of passing such a semicolon-separated list, you may aswell pass just one feature as string (eg 'flash') or a vector with such strings. if your string or array is empty, TRUE is returned. #### Tags:
todo: | add support to check versions like for pdf5+
throws: | NULL if we can't tell (because not all plugins have been checked).
access: | public
#### Parameters:
mixed | $pluginString | (string or vector, see above)
[ Top ] ### method normalizeRef [line 424]
`hash normalizeRef( mixed $parentUni, string $refString)`
Normalize the references to the varius elements and return an hash This little, but importent function expects a parentUni and an reference string to an an element (such as Page, Layout, ...). The parentUni gives us the absolute node-position (e.g. /node1/node2/) where as the ref-string may point relatively to it position (e.g. ../../aaa/bbb/element_one) into an other node. The information taken together will give us the abs parentUni and core name of the referenced element. We then return hash with the found info. Sampels: node-UID + refstring => coreName + parentUni --------------------+-------------------------++--------------+--------------- /aaa/bbb/ccc/' | ../../xxx/element_one || element_one | /aaa/xxx/ /aaa/bbb/ccc/' | /xxx/element_one || element_one | /xxx/ Return array ( 'parentUni' => '/aaa/xxx/', 'coreName' => 'element_one' ); NOTE: There is a situation where we throw FALSE. That is when no '/' #### Tags:
return: | see above
throws: | FALSE if we have empty result for coreName or parentUni.
static: |
#### Parameters:
mixed | $parentUni | (node path where the refstring was found.)
string | $refString | relative or absolute reference to an element
[ Top ] ### method normalizeVersion [line 382]
`Normalize normalizeVersion( mixed $versionMask)`
Normalize a version string and return it See info in header of this file. Accepts wildcads. NULL or '' -> x.x.x 1.* . 4 -> 1.x.5 1, X -> 1.x.x 2 , . 23 -> 2.x.23 #### Tags:
return: | a version string (see above)
static: |
[ Top ] ### method persist [line 347]
`void persist( )`
Use the XStorage to persist any XAtom huh, no return? no params (new version etc)? :/ --andrej Overrides Bs_Object::persist() (Persists this object by serializing it and saving it to a file with unique name.) [ Top ] ### method reset [line 299]
`void reset( )`
Reset the whole object But keep the UID and prform a basic init [ Top ] ### method toXml [line 777]
`string. toXml( [bool $htmlOut = FALSE])`
Generate a XML output of the element (Node, Page, Layout, Block ...) #### Tags:
return: | A XML representation of the element
#### Parameters:
bool | $htmlOut | (default FALSE). Will make a HTML viewable output; only for debugging or so
[ Top ] ### method _basicInit [line 220]
`void _basicInit( mixed $UID)`
Init some very basic setup stuff that is directly related to the UID Set is parentUni coreName version level <- tree level of the node. E.g. root has level 0, root/foo/bar has level 2 ... USE: After a reset or during an Init. #### Tags:
see: | Bs_XAtom::init(), Bs_XAtom::reset()
#### Parameters:
mixed | $UID | (Unified ID, numeric = db, array = file. see init().)
[ Top ] ### method _normalizeContainer [line 359]
`void _normalizeContainer( )`
This may have to be done if the input is from a soucre that is written by human. [ Top ] Documentation generated on Mon, 29 Dec 2003 21:13:27 +0100 by phpDocumentor 1.2.3