<?php // load picasa lightweight library require_once 'wp-esprit-picasa-library-include.php'; $picasa = new Picasa(); Picasa::setPicasaUrl($_REQUEST['server']); $status = True; try { $account = $picasa->getAlbumsByUsername($_REQUEST['username'], 0); } catch (Exception $e) { $status = False; } if ($_REQUEST['type'] == 'rpc') { $xml = "<picasa>"; $xml .= "<status>"; if ($status) { $xml .= "OK"; } else { $xml .= "ERROR"; } $xml .= "</status>\n"; $xml .= "</picasa>"; header('Content-type: text/xml'); echo $xml; }
// load javascript and css files echo "<script type='text/javascript' src='" . WP_PLUGIN_URL . "/" . str_replace(basename(__FILE__), '', plugin_basename(__FILE__)) . "js/wp-esprit-picasa-gallery.js" . "'></script>\n"; echo "<link rel='stylesheet' href='" . WP_PLUGIN_URL . "/" . str_replace(basename(__FILE__), '', plugin_basename(__FILE__)) . "css/style.css" . "' type='text/css' media='all' />\n"; ?> <?php // construct uri parameters which have to be passed with each request $uriParams = WpEspritPicasa::$REQUEST_PARAMETER_POST_ID . "=" . $_REQUEST[WpEspritPicasa::$REQUEST_PARAMETER_POST_ID]; $uriParams .= "&" . WpEspritPicasa::$REQUEST_PARAMETER_TAB . "=" . $_REQUEST[WpEspritPicasa::$REQUEST_PARAMETER_TAB]; $uriParams .= "&" . WpEspritPicasa::$REQUEST_PARAMETER_TYPE . "=" . $_REQUEST[WpEspritPicasa::$REQUEST_PARAMETER_TYPE]; // how many photos we will display on each line $albumsPerRow = 4; // the size of the photo displayed in admin area $albumThumbnailSize = "144"; $picasa = new Picasa(); Picasa::setPicasaUrl(get_option(WpEspritPicasa::$WP_OPTION_SERVER)); // get the album name from the request $albumId = null; if (isset($_REQUEST[WpEspritPicasa::$REQUEST_PARAMETER_ALBUM_ID])) { $albumId = $_REQUEST[WpEspritPicasa::$REQUEST_PARAMETER_ALBUM_ID]; } $tab = $_REQUEST[WpEspritPicasa::$REQUEST_PARAMETER_TAB]; $html = "<div id=\"PicasaWrapper\">"; $i = 0; if (is_null($albumId)) { $account = $picasa->getAlbumsByUsername(get_option(WpEspritPicasa::$WP_OPTION_USERNAME), null, null, null, $albumThumbnailSize . "c"); foreach ($account->getAlbums() as $album) { $html .= $i % $albumsPerRow == 0 ? "<div class=\"row\">\n" : ""; $html .= " <div class=\"PicasaAlbums\">\n"; $html .= " <a href=\"" . $_SERVER["PHP_SELF"] . "?" . $uriParams . "&" . WpEspritPicasa::$REQUEST_PARAMETER_ALBUM_ID . "=" . $album->getIdnum() . "\">\n"; $html .= " <img src=\"" . $album->getIcon() . "\" width=\"" . $albumThumbnailSize . "px\" height=\"" . $albumThumbnailSize . "px\">\n";