Skip to content

Instantly share code, notes, and snippets.

@atilacamurca
Created December 1, 2014 13:46
Show Gist options
  • Save atilacamurca/07cc0a10c7c96fb1fde4 to your computer and use it in GitHub Desktop.
Save atilacamurca/07cc0a10c7c96fb1fde4 to your computer and use it in GitHub Desktop.
zf1 - workaround for slideshare api 2.0 support in zf1 - just replace the method _slideShowNodeToObject
<?php
class Zend_Service_SlideShare
{
/**
* 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
* @throws Zend_Service_SlideShare_Exception
*/
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->Embed);
$ss->setNumViews((string)$node->Views);
$ss->setPermaLink((string)$node->URL);
$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->ThumbnailURL);
$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'
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment