2
0

Zend_Service_SlideShare.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.service.slideshare">
  4. <title>Zend_Service_SlideShare</title>
  5. <para>
  6. The <classname>Zend_Service_SlideShare</classname> component is used to interact with the
  7. <ulink url="http://www.slideshare.net/">slideshare.net</ulink> web services for hosting
  8. slide shows online. With this component, you can embed slide shows which are hosted on this
  9. web site within a web site and even upload new slide shows to your account.
  10. </para>
  11. <sect2 id="zend.service.slideshare.basicusage">
  12. <title>Getting Started with Zend_Service_SlideShare</title>
  13. <para>
  14. In order to use the <classname>Zend_Service_SlideShare</classname> component you must
  15. first create an account on the slideshare.net servers (more information can be found
  16. <ulink url="http://www.slideshare.net/developers/">here</ulink>) in order to receive an
  17. <acronym>API</acronym> key, username, password and shared secret value -- all of which
  18. are needed in order to use the <classname>Zend_Service_SlideShare</classname> component.
  19. </para>
  20. <para>
  21. Once you have setup an account, you can begin using the
  22. <classname>Zend_Service_SlideShare</classname> component by creating a new instance of
  23. the <classname>Zend_Service_SlideShare</classname> object and providing these values as
  24. shown below:
  25. </para>
  26. <programlisting language="php"><![CDATA[
  27. // Create a new instance of the component
  28. $ss = new Zend_Service_SlideShare('APIKEY',
  29. 'SHAREDSECRET',
  30. 'USERNAME',
  31. 'PASSWORD');
  32. ]]></programlisting>
  33. </sect2>
  34. <sect2 id="zend.service.slideshare.slideshowobj">
  35. <title>The SlideShow object</title>
  36. <para>
  37. All slide shows in the <classname>Zend_Service_SlideShare</classname> component are
  38. represented using the <classname>Zend_Service_SlideShare_SlideShow</classname> object
  39. (both when retrieving and uploading new slide shows). For your reference a pseudo-code
  40. version of this class is provided below.
  41. </para>
  42. <programlisting language="php"><![CDATA[
  43. class Zend_Service_SlideShare_SlideShow {
  44. /**
  45. * Retrieves the location of the slide show
  46. */
  47. public function getLocation() {
  48. return $this->_location;
  49. }
  50. /**
  51. * Gets the transcript for this slide show
  52. */
  53. public function getTranscript() {
  54. return $this->_transcript;
  55. }
  56. /**
  57. * Adds a tag to the slide show
  58. */
  59. public function addTag($tag) {
  60. $this->_tags[] = (string)$tag;
  61. return $this;
  62. }
  63. /**
  64. * Sets the tags for the slide show
  65. */
  66. public function setTags(Array $tags) {
  67. $this->_tags = $tags;
  68. return $this;
  69. }
  70. /**
  71. * Gets all of the tags associated with the slide show
  72. */
  73. public function getTags() {
  74. return $this->_tags;
  75. }
  76. /**
  77. * Sets the filename on the local filesystem of the slide show
  78. * (for uploading a new slide show)
  79. */
  80. public function setFilename($file) {
  81. $this->_slideShowFilename = (string)$file;
  82. return $this;
  83. }
  84. /**
  85. * Retrieves the filename on the local filesystem of the slide show
  86. * which will be uploaded
  87. */
  88. public function getFilename() {
  89. return $this->_slideShowFilename;
  90. }
  91. /**
  92. * Gets the ID for the slide show
  93. */
  94. public function getId() {
  95. return $this->_slideShowId;
  96. }
  97. /**
  98. * Retrieves the HTML embed code for the slide show
  99. */
  100. public function getEmbedCode() {
  101. return $this->_embedCode;
  102. }
  103. /**
  104. * Retrieves the Thumbnail URi for the slide show
  105. */
  106. public function getThumbnailUrl() {
  107. return $this->_thumbnailUrl;
  108. }
  109. /**
  110. * Sets the title for the Slide show
  111. */
  112. public function setTitle($title) {
  113. $this->_title = (string)$title;
  114. return $this;
  115. }
  116. /**
  117. * Retrieves the Slide show title
  118. */
  119. public function getTitle() {
  120. return $this->_title;
  121. }
  122. /**
  123. * Sets the description for the Slide show
  124. */
  125. public function setDescription($desc) {
  126. $this->_description = (string)$desc;
  127. return $this;
  128. }
  129. /**
  130. * Gets the description of the slide show
  131. */
  132. public function getDescription() {
  133. return $this->_description;
  134. }
  135. /**
  136. * Gets the numeric status of the slide show on the server
  137. */
  138. public function getStatus() {
  139. return $this->_status;
  140. }
  141. /**
  142. * Gets the textual description of the status of the slide show on
  143. * the server
  144. */
  145. public function getStatusDescription() {
  146. return $this->_statusDescription;
  147. }
  148. /**
  149. * Gets the permanent link of the slide show
  150. */
  151. public function getPermaLink() {
  152. return $this->_permalink;
  153. }
  154. /**
  155. * Gets the number of views the slide show has received
  156. */
  157. public function getNumViews() {
  158. return $this->_numViews;
  159. }
  160. }
  161. ]]></programlisting>
  162. <note>
  163. <para>
  164. The above pseudo-class only shows those methods which should be used by end-user
  165. developers. Other available methods are internal to the component.
  166. </para>
  167. </note>
  168. <para>
  169. When using the <classname>Zend_Service_SlideShare</classname> component, this data class
  170. will be used frequently to browse or add new slide shows to or from the web service.
  171. </para>
  172. </sect2>
  173. <sect2 id="zend.service.slideshare.getslideshow">
  174. <title>Retrieving a single slide show</title>
  175. <para>
  176. The simplest usage of the <classname>Zend_Service_SlideShare</classname> component is
  177. the retrieval of a single slide show by slide show ID provided by the slideshare.net
  178. application and is done by calling the <methodname>getSlideShow()</methodname> method of
  179. a <classname>Zend_Service_SlideShare</classname> object and using the resulting
  180. <classname>Zend_Service_SlideShare_SlideShow</classname> object as shown.
  181. </para>
  182. <programlisting language="php"><![CDATA[
  183. // Create a new instance of the component
  184. $ss = new Zend_Service_SlideShare('APIKEY',
  185. 'SHAREDSECRET',
  186. 'USERNAME',
  187. 'PASSWORD');
  188. $slideshow = $ss->getSlideShow(123456);
  189. print "Slide Show Title: {$slideshow->getTitle()}<br/>\n";
  190. print "Number of views: {$slideshow->getNumViews()}<br/>\n";
  191. ]]></programlisting>
  192. </sect2>
  193. <sect2 id="zend.service.slideshare.getslideshowlist">
  194. <title>Retrieving Groups of Slide Shows</title>
  195. <para>
  196. If you do not know the specific ID of a slide show you are interested in retrieving,
  197. you can retrieving groups of slide shows by using one of three methods:
  198. </para>
  199. <itemizedlist mark="opencircle">
  200. <listitem>
  201. <para>
  202. <emphasis>Slide shows from a specific account</emphasis>
  203. </para>
  204. <para>
  205. You can retrieve slide shows from a specific account by using the
  206. <methodname>getSlideShowsByUsername()</methodname> method and providing the
  207. username from which the slide shows should be retrieved
  208. </para>
  209. </listitem>
  210. <listitem>
  211. <para>
  212. <emphasis>Slide shows which contain specific tags</emphasis>
  213. </para>
  214. <para>
  215. You can retrieve slide shows which contain one or more specific tags by using
  216. the <methodname>getSlideShowsByTag()</methodname> method and providing one or
  217. more tags which the slide show must have assigned to it in order to be retrieved
  218. </para>
  219. </listitem>
  220. <listitem>
  221. <para>
  222. <emphasis>Slide shows by group</emphasis>
  223. </para>
  224. <para>
  225. You can retrieve slide shows which are a member of a specific group using the
  226. <methodname>getSlideShowsByGroup()</methodname> method and providing the name of
  227. the group which the slide show must belong to in order to be retrieved
  228. </para>
  229. </listitem>
  230. </itemizedlist>
  231. <para>
  232. Each of the above methods of retrieving multiple slide shows a similar approach is
  233. used. An example of using each method is shown below:
  234. </para>
  235. <programlisting language="php"><![CDATA[
  236. // Create a new instance of the component
  237. $ss = new Zend_Service_SlideShare('APIKEY',
  238. 'SHAREDSECRET',
  239. 'USERNAME',
  240. 'PASSWORD');
  241. $starting_offset = 0;
  242. $limit = 10;
  243. // Retrieve the first 10 of each type
  244. $ss_user = $ss->getSlideShowsByUser('username', $starting_offset, $limit);
  245. $ss_tags = $ss->getSlideShowsByTag('zend', $starting_offset, $limit);
  246. $ss_group = $ss->getSlideShowsByGroup('mygroup', $starting_offset, $limit);
  247. // Iterate over the slide shows
  248. foreach($ss_user as $slideshow) {
  249. print "Slide Show Title: {$slideshow->getTitle}<br/>\n";
  250. }
  251. ]]></programlisting>
  252. </sect2>
  253. <sect2 id="zend.service.slideshare.caching">
  254. <title>Zend_Service_SlideShare Caching policies</title>
  255. <para>
  256. By default, <classname>Zend_Service_SlideShare</classname> will cache any request
  257. against the web service automatically to the filesystem (default path
  258. <filename>/tmp</filename>) for 12 hours. If you desire to change this behavior, you
  259. must provide your own <link linkend="zend.cache">Zend_Cache</link> object using the
  260. <methodname>setCacheObject()</methodname> method as shown:
  261. </para>
  262. <programlisting language="php"><![CDATA[
  263. $frontendOptions = array(
  264. 'lifetime' => 7200,
  265. 'automatic_serialization' => true);
  266. $backendOptions = array(
  267. 'cache_dir' => '/webtmp/');
  268. $cache = Zend_Cache::factory('Core',
  269. 'File',
  270. $frontendOptions,
  271. $backendOptions);
  272. $ss = new Zend_Service_SlideShare('APIKEY',
  273. 'SHAREDSECRET',
  274. 'USERNAME',
  275. 'PASSWORD');
  276. $ss->setCacheObject($cache);
  277. $ss_user = $ss->getSlideShowsByUser('username', $starting_offset, $limit);
  278. ]]></programlisting>
  279. </sect2>
  280. <sect2 id="zend.service.slideshare.httpclient">
  281. <title>Changing the behavior of the HTTP Client</title>
  282. <para>
  283. If for whatever reason you would like to change the behavior of the
  284. <acronym>HTTP</acronym> client when making the web service request, you can do so by
  285. creating your own instance of the <classname>Zend_Http_Client</classname> object (see
  286. <link linkend="zend.http">Zend_Http</link>). This is useful for instance when it is
  287. desirable to set the timeout for the connection to something other then default as
  288. shown:
  289. </para>
  290. <programlisting language="php"><![CDATA[
  291. $client = new Zend_Http_Client();
  292. $client->setConfig(array('timeout' => 5));
  293. $ss = new Zend_Service_SlideShare('APIKEY',
  294. 'SHAREDSECRET',
  295. 'USERNAME',
  296. 'PASSWORD');
  297. $ss->setHttpClient($client);
  298. $ss_user = $ss->getSlideShowsByUser('username', $starting_offset, $limit);
  299. ]]></programlisting>
  300. </sect2>
  301. </sect1>