/** * @access public * @see http://essfeed.org/index.php/ESS_structure * @param Array Array of data that represent the first elements of the feed. * * @return void; */ function __construct($data_ = NULL, $CHARSET = 'UTF-8', $REPLACE_ACCENT = FALSE) { $this->CHARSET = $CHARSET; // Defines the document encoding Charset (Default UTF-8). $this->REPLACE_ACCENT = $REPLACE_ACCENT; // Defines if the ASCI accent have to be remplaced (Default FALSE). $this->rootDTD = EssDTD::getRootDTD(); $this->feedDTD = EssDTD::getFeedDTD(); foreach ($this->feedDTD as $key => $value) { $this->elements[$key] = array(); } if ($data_ != NULL && count($data_) > 0) { foreach ($this->rootDTD as $elementName => $mandatory) { if ($mandatory == TRUE && strlen($data_[$elementName]) <= 0) { throw new Exception("Error: Event element " . $elementName . " is mandatory.", 1); } } foreach ($data_ as $tagTest => $value) { $isFound = FALSE; if (in_array(strtolower($tagTest), $this->rootDTD)) { $isFound = TRUE; } if ($isFound == FALSE) { throw new Exception("Error: Event XML element < " . $tagTest . " > is not specified in ESS Feed DTD."); } } foreach ($data_ as $tag => $value) { if ($tag != 'tag') { $this->roots[$tag] = $value; } else { if (is_array($value)) { $this->roots[$tag] = $value; } else { throw new Exception("Error: Element < tag > must be of 'Array' type."); } } } } }
public static function get_categories_types() { $cat_ = EssDTD::getFeedDTD(); return @count($cat_) > 0 ? $cat_['categories']['types'] : NULL; }