Пример #1
0
 /**
  * @return string
  */
 public function getLastUpdated()
 {
     if (($date = $this->channel->getChild("lastBuildDate")) === null) {
         if ($firstItem = $this->itemsElement->item(0)) {
             $date = $firstItem->getChild("pubDate");
         } else {
             return null;
         }
     }
     return date("Y-m-d H:i:s", strtotime($date->getNodeValue()));
 }
Пример #2
0
 /**
  * @return Sabel_ValueObject
  */
 protected function toObject(Sabel_Xml_Element $element)
 {
     $object = new Sabel_ValueObject();
     if ($title = $element->getChild("title")) {
         $object->title = $title->getNodeValue();
     }
     if ($link = $element->getChild("link")) {
         $object->uri = $link->getNodeValue();
     }
     if ($desc = $element->getChild("description")) {
         $object->description = $desc->getNodeValue();
     }
     if ($date = $element->getChild("pubDate")) {
         $object->date = date("Y-m-d H:i:s", strtotime($date->getNodeValue()));
     }
     return $object;
 }
Пример #3
0
 /**
  * @return Sabel_ValueObject
  */
 protected function toObject(Sabel_Xml_Element $element)
 {
     $object = new Sabel_ValueObject();
     if ($title = $element->getChild("title")) {
         $object->title = $title->getNodeValue();
     }
     if ($link = $element->getChild("link")) {
         $object->uri = $link->getAttribute("href");
     }
     if ($summary = $element->getChild("summary")) {
         $object->description = $summary->getNodeValue();
     }
     if ($date = $element->getChild("updated")) {
         $object->date = date("Y-m-d H:i:s", strtotime($date->getNodeValue()));
     }
     if ($content = $element->getChild("content")) {
         $object->content = $content->getNodeValue();
     }
     return $object;
 }
Пример #4
0
 /**
  * @return Sabel_ValueObject
  */
 protected function toObject(Sabel_Xml_Element $element)
 {
     $object = new Sabel_ValueObject();
     if ($title = $element->getChild("title")) {
         $object->title = $title->getNodeValue();
     }
     $links = $element->getChildren("link");
     foreach ($links as $link) {
         if ($link->getAttribute("rel") === "alternate") {
             $object->uri = $link->getAttribute("href");
             break;
         }
     }
     if ($summary = $element->getChild("summary")) {
         $object->description = $summary->getNodeValue();
     }
     if ($date = $element->getChild("modified")) {
         $object->date = date("Y-m-d H:i:s", strtotime($date->getNodeValue()));
     }
     if ($content = $element->getChild("content")) {
         $object->content = $content->getNodeValue();
     }
     return $object;
 }
Пример #5
0
 public function loadHTML($html, $ignoreErrors = false)
 {
     if ($ignoreErrors) {
         @$this->document->loadHTML($html);
     } else {
         $this->document->loadHTML($html);
     }
     $doc = new Sabel_Xml_Element($this->document);
     return $doc->getChild("html");
 }