/** * Gets all comments that meet the criteria specified in the parameters. * The client can request images specific to * just a user or to a user and an album. To get comments specific to an image, use {@link getImageById()} and call * {@link Picasa_Image::getComments()} on the returned object. * Passing null for any of the parameters will leave it up to Picasa to define the default values. * * @access public * @param string $username The username on the account to get the comments out of. It is not possible to get * comments without specifying the username, so this field is required. * @param string $albumid The id number of the album that the desired comments are in. Optional, the default * is null. * @param int $maxResults The maximum number of results to return. Optional, the default is null. * @param int $startIndex The first element number with the search results to return. Useful for pagination. * Optional, the default is null. * @param string $visibility Restrict the search to comments in images with the access rights specified here. * Options are "public", "private", and "all". Authorization is required for "private" * and "all" options. Optional, default is "public". * @return array An array of {@link Picasa_Comment} objects, one for each comment in the requested feed. * @throws {@link Picasa_Exception} If something was wrong with the requested feed. A specific subclass of * {@link Picasa_Exception} will be thrown based on what kind of problem was * encountered, unless the type of error was unknown, in which case {@link Picasa_Exception} * itself will be thrown. */ public function getCommentsByUsername($username, $albumid = null, $maxResults = null, $startIndex = null, $visibility = "public") { $query = Picasa::$BASE_QUERY_URL . '/user/' . $username; if ($albumid != null) { $query .= '/albumid/' . $albumid; } $query .= '?kind=comment' . Picasa::buildQueryParams($maxResults, $startIndex, null, null, $visibility, null, null); $comments = null; $useCache = false; if (strcmp($visibility, "public") === 0) { $useCache = true; } try { $comments = Picasa_Comment::getCommentArray($query, null, $this->contextArray, $useCache); } catch (Picasa_Exception $e) { throw $e; } return $comments; }