Update example code to pass the http_client and cache object
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 9 Jan 2009 00:31:55 +0000 (19:31 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 9 Jan 2009 00:31:55 +0000 (19:31 -0500)
framework/Service_Vimeo/doc/vimeo_example.php

index d236705..de0be92 100644 (file)
@@ -1,6 +1,14 @@
 <?php
 require_once 'Horde/Autoloader.php';
-$v = Horde_Service_Vimeo::factory('Simple');
+
+// Create a Horde_Service_Vimeo_Simple object
+// 'http_client' is required, a cache and cache_lifetime are optional
+$params = array('http_client' => new Horde_Http_Client(),
+                'cache' => $GLOBALS['cache'],
+                'cache_lifetime' => $GLOBALS['conf']['cache']['default_lifetime']);
+
+$v = Horde_Service_Vimeo::factory('Simple', $params);
+
 
 // Get the list of all user videos
 $results = unserialize($v->user('user1015172')->clips()->run());
@@ -14,9 +22,10 @@ $results = unserialize($v->channel('theedit')->clips()->run());
 // List of clips in an album
 $results = unserialize($v->album('52803')->clips()->run());
 
-// Get first video to embed
+// Get first video to embed - this returns a json encoded array
 $embed = $v->getEmbedJson($latest['url']);
 
-// Decode the data and print out the HTML
+// Decode the data and print out the HTML. You could also just output
+// the json within your page's javascript for use later etc...
 $results = Horde_Serialize::unserialize($embed, SERIALIZE_JSON);
 echo $results->html;