コード例 #1
0
 protected function _init()
 {
     parent::_init();
     $this->_objectType = array();
     if (isset($this->_element[ActivityNS::OBJECT_TYPE_ELEMENT])) {
         foreach ($this->_element[ActivityNS::OBJECT_TYPE_ELEMENT] as $objectType) {
             $this->_objectType[] = new SimpleActivityExtension($objectType, ActivityNS::OBJECT_TYPE_ELEMENT);
         }
     }
     if (isset($this->_element[MediaNS::DESCRIPTION_ELEMENT])) {
         $this->_description = new MediaDescriptionExtension($this->_element[MediaNS::DESCRIPTION_ELEMENT][0]);
     }
     $tempLink = $this->_link;
     //unset($this->_link);
     $this->_link = array();
     foreach ($tempLink as $link) {
         $this->_link[] = $link->getExtension(MediaNS::NS);
     }
 }
コード例 #2
0
 /**
  * @param array $data
  * @param AtomEntryAdapter $entry
  * @return AtomEntryAdapter
  */
 protected function _readDefaultEntry($data, AtomEntryAdapter $entry)
 {
     $data['type'] = SourceItem::BLOG_TYPE;
     $data['title'] = $entry->getTitle()->value;
     $data['text'] = $entry->getContent()->value;
     return $data;
 }
コード例 #3
0
    public function testBuildEntry()
    {
        $newEntry = new AtomEntryAdapter(null);
        $newEntry->title = 'New Entry Title';
        $newEntry->title->type = 'New Entry Title Type';
        $newEntry->id = 'New Entry Id';
        $newEntry->updated = 'New Entry Updated';
        $newEntry->published = 'New Entry Published';
        $newEntry->summary = 'New Entry Summary';
        $newEntry->summary->type = 'New Entry Summary Type';
        $newEntry->content = 'New Entry Content';
        $newEntry->content->type = 'New Entry Content Type';
        $newEntry->content->src = 'New Entry Content Src';
        $newEntryAuthor = $newEntry->addAuthor();
        $newEntryAuthor->name = 'New Entry Author Name';
        $newEntryAuthor->uri = 'New Entry Author Uri';
        $newEntryAuthor->email = 'New Entry Author Email';
        $newEntryLink = $newEntry->addLink();
        $newEntryLink->href = 'New Entry Link Href';
        $newEntryLink->type = 'New Entry Link Type';
        $newEntryLink->rel = 'New Entry Link Rel';
        $newEntryLink->title = 'New Entry Link Title';
        $newEntryLink->hreflang = 'New Entry Link Hreflang';
        $newEntryLink->length = 'New Entry Link Length';
        $newEntryCategory = $newEntry->addCategory();
        $newEntryCategory->term = 'New Entry Category Term';
        $newEntryCategory->scheme = 'New Entry Category Scheme';
        $newEntryCategory->label = 'New Entry Category Label';
        $expectedResult = '<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"><title type="New Entry Title Type">New Entry Title</title><id>New Entry Id</id><updated>New Entry Updated</updated><published>New Entry Published</published><summary type="New Entry Summary Type">New Entry Summary</summary><content type="New Entry Content Type" src="New Entry Content Src">New Entry Content</content><author><name>New Entry Author Name</name><uri>New Entry Author Uri</uri><email>New Entry Author Email</email></author><link href="New Entry Link Href" type="New Entry Link Type" rel="New Entry Link Rel" title="New Entry Link Title" hreflang="New Entry Link Hreflang" length="New Entry Link Length"/><category term="New Entry Category Term" scheme="New Entry Category Scheme" label="New Entry Category Label"/></entry>';
        $this->assertEquals(trim($newEntry->getXml()), trim($expectedResult));
    }