Пример #1
0
 /**
  * Converts a SimpleXMLElement object representing a response from the service
  * into a Zend_Service_SlideShare_SlideShow object
  *
  * @param SimpleXMLElement $node The input XML from the slideshare.net service
  * @return Zend_Service_SlideShare_SlideShow The resulting object
  */
 protected function _slideShowNodeToObject(SimpleXMLElement $node)
 {
     if ($node->getName() == 'Slideshow') {
         $ss = new Zend_Service_SlideShare_SlideShow();
         $ss->setId((string) $node->ID);
         $ss->setDescription((string) $node->Description);
         $ss->setEmbedCode((string) $node->EmbedCode);
         $ss->setNumViews((string) $node->Views);
         $ss->setPermaLink((string) $node->Permalink);
         $ss->setStatus((string) $node->Status);
         $ss->setStatusDescription((string) $node->StatusDescription);
         foreach (explode(",", (string) $node->Tags) as $tag) {
             if (!in_array($tag, $ss->getTags())) {
                 $ss->addTag($tag);
             }
         }
         $ss->setThumbnailUrl((string) $node->Thumbnail);
         $ss->setTitle((string) $node->Title);
         $ss->setLocation((string) $node->Location);
         $ss->setTranscript((string) $node->Transcript);
         return $ss;
     }
     require_once 'Zend/Service/SlideShare/Exception.php';
     throw new Zend_Service_SlideShare_Exception("Was not provided the expected XML Node for processing");
 }
Пример #2
0
 public function testSlideShowObj()
 {
     $ss = new Zend_Service_SlideShare_SlideShow();
     $ss->setDescription("Foo");
     $ss->setEmbedCode("Bar");
     $ss->setFilename("Baz");
     $ss->setId(123);
     $ss->setLocation("Somewhere");
     $ss->setNumViews(4432);
     $ss->setPermaLink("nowhere");
     $ss->setStatus(124);
     $ss->setStatusDescription("Boo");
     $ss->setTags(array('bar', 'baz'));
     $ss->addTag('fon');
     $ss->setThumbnailUrl('asdf');
     $ss->setTitle('title');
     $ss->setTranscript('none');
     $this->assertEquals($ss->getDescription(), "Foo");
     $this->assertEquals($ss->getEmbedCode(), "Bar");
     $this->assertEquals($ss->getFilename(), "Baz");
     $this->assertEquals($ss->getId(), 123);
     $this->assertEquals($ss->getLocation(), "Somewhere");
     $this->assertEquals($ss->getNumViews(), 4432);
     $this->assertEquals($ss->getPermaLink(), "nowhere");
     $this->assertEquals($ss->getStatus(), 124);
     $this->assertEquals($ss->getStatusDescription(), "Boo");
     $this->assertEquals($ss->getTags(), array('bar', 'baz', 'fon'));
     $this->assertEquals($ss->getThumbnailUrl(), "asdf");
     $this->assertEquals($ss->getTitle(), "title");
     $this->assertEquals($ss->getTranscript(), "none");
 }