示例#1
0
 public function before()
 {
     // Get all categories
     $this->xml_content_categories = $this->xml_content->appendChild($this->dom->createElement('categories'));
     xml::to_XML(Galleries::get_categories_for_xml(), $this->xml_content_categories, 'category');
     // Get all galleries
     $this->xml_content_galleries = $this->xml_content->appendChild($this->dom->createElement('galleries'));
     xml::to_XML(Galleries::get_for_xml(), $this->xml_content_galleries, 'gallery');
     // We need to put some HTML in from our transformator
     // The reason for all this mess is that we must inject this directly in to the DOM, or else the <> will get destroyed
     $XPath = new DOMXpath($this->dom);
     foreach ($XPath->query('/root/content/galleries/gallery/description') as $raw_content_node) {
         $html_content = call_user_func(Kohana::$config->load('content.content_transformator'), $raw_content_node->nodeValue);
         $html_node = $raw_content_node->parentNode->appendChild($this->dom->createElement('description_html'));
         xml::xml_to_DOM_node($html_content, $html_node);
     }
 }
示例#2
0
 public function action_index()
 {
     $this->xslt_stylesheet = 'generic';
     // Get all categories
     $this->xml_content_categories = $this->xml_content->appendChild($this->dom->createElement('categories'));
     xml::to_XML(Galleries::get_categories_for_xml(), $this->xml_content_categories, 'category');
     // Get all galleries
     $this->xml_content_galleries = $this->xml_content->appendChild($this->dom->createElement('galleries'));
     xml::to_XML(Galleries::get_for_xml(), $this->xml_content_galleries, 'gallery');
     $images = array();
     foreach (Content_image::get_images(NULL, array('frontimage' => TRUE)) as $image_name => $image_data) {
         $images[] = $image_name;
     }
     if (count($images)) {
         xml::to_XML(array('frontimage' => $images[rand(0, count($images) - 1)]), $this->xml_content);
     }
 }