import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage SlideShare
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: SlideShare.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: SlideShare.php 13522 2009-01-06 16:35:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -30,11 +30,6 @@ require_once 'Zend/Http/Client.php';
|
||||
*/
|
||||
require_once 'Zend/Cache.php';
|
||||
|
||||
/**
|
||||
* Zend_Service_SlideShare_Exception
|
||||
*/
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
|
||||
/**
|
||||
* Zend_Service_SlideShare_SlideShow
|
||||
*/
|
||||
@ -328,6 +323,7 @@ class Zend_Service_SlideShare
|
||||
$filename = $ss->getFilename();
|
||||
|
||||
if(!file_exists($filename) || !is_readable($filename)) {
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception("Specified Slideshow for upload not found or unreadable");
|
||||
}
|
||||
|
||||
@ -353,9 +349,11 @@ class Zend_Service_SlideShare
|
||||
$client->setParameterPost($params);
|
||||
$client->setFileUpload($filename, "slideshow_srcfile");
|
||||
|
||||
require_once 'Zend/Http/Client/Exception.php';
|
||||
try {
|
||||
$response = $client->request('POST');
|
||||
} catch(Zend_Http_Client_Exception $e) {
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception("Service Request Failed: {$e->getMessage()}");
|
||||
}
|
||||
|
||||
@ -364,10 +362,12 @@ class Zend_Service_SlideShare
|
||||
if($sxe->getName() == "SlideShareServiceError") {
|
||||
$message = (string)$sxe->Message[0];
|
||||
list($code, $error_str) = explode(':', $message);
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception(trim($error_str), $code);
|
||||
}
|
||||
|
||||
if(!$sxe->getName() == "SlideShowUploaded") {
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception("Unknown XML Respons Received");
|
||||
}
|
||||
|
||||
@ -401,9 +401,11 @@ class Zend_Service_SlideShare
|
||||
$client->setUri(self::SERVICE_GET_SHOW_URI);
|
||||
$client->setParameterPost($params);
|
||||
|
||||
require_once 'Zend/Http/Client/Exception.php';
|
||||
try {
|
||||
$response = $client->request('POST');
|
||||
} catch(Zend_Http_Client_Exception $e) {
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception("Service Request Failed: {$e->getMessage()}");
|
||||
}
|
||||
|
||||
@ -412,10 +414,12 @@ class Zend_Service_SlideShare
|
||||
if($sxe->getName() == "SlideShareServiceError") {
|
||||
$message = (string)$sxe->Message[0];
|
||||
list($code, $error_str) = explode(':', $message);
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception(trim($error_str), $code);
|
||||
}
|
||||
|
||||
if(!$sxe->getName() == 'Slideshows') {
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception('Unknown XML Repsonse Received');
|
||||
}
|
||||
|
||||
@ -505,6 +509,7 @@ class Zend_Service_SlideShare
|
||||
$queryUri = self::SERVICE_GET_SHOW_BY_TAG_URI;
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception("Invalid SlideShare Query");
|
||||
}
|
||||
|
||||
@ -515,11 +520,11 @@ class Zend_Service_SlideShare
|
||||
'hash' => sha1($this->getSharedSecret().$timestamp),
|
||||
$key => $value);
|
||||
|
||||
if(!is_null($offset)) {
|
||||
if($offset !== null) {
|
||||
$params['offset'] = (int)$offset;
|
||||
}
|
||||
|
||||
if(!is_null($limit)) {
|
||||
if($limit !== null) {
|
||||
$params['limit'] = (int)$limit;
|
||||
}
|
||||
|
||||
@ -534,9 +539,11 @@ class Zend_Service_SlideShare
|
||||
$client->setUri($queryUri);
|
||||
$client->setParameterPost($params);
|
||||
|
||||
require_once 'Zend/Http/Client/Exception.php';
|
||||
try {
|
||||
$response = $client->request('POST');
|
||||
} catch(Zend_Http_Client_Exception $e) {
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception("Service Request Failed: {$e->getMessage()}");
|
||||
}
|
||||
|
||||
@ -545,10 +552,12 @@ class Zend_Service_SlideShare
|
||||
if($sxe->getName() == "SlideShareServiceError") {
|
||||
$message = (string)$sxe->Message[0];
|
||||
list($code, $error_str) = explode(':', $message);
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception(trim($error_str), $code);
|
||||
}
|
||||
|
||||
if(!$sxe->getName() == $responseTag) {
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception('Unknown or Invalid XML Repsonse Received');
|
||||
}
|
||||
|
||||
@ -604,6 +613,7 @@ class Zend_Service_SlideShare
|
||||
|
||||
}
|
||||
|
||||
require_once 'Zend/Service/SlideShare/Exception.php';
|
||||
throw new Zend_Service_SlideShare_Exception("Was not provided the expected XML Node for processing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user