Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'MDL-26660-22' of git://github.com/FMCorz/moodle into MO…

…ODLE_22_STABLE
  • Loading branch information...
commit aab4251842cea85f4ce99cc6f28597af398417a6 2 parents e015e5d + c4bc6e9
Dan Poltawski danpoltawski authored
Showing with 13 additions and 9 deletions.
  1. +13 −9 lib/googleapi.php
22 lib/googleapi.php
View
@@ -485,13 +485,16 @@ public function do_photo_search($query){
*
* @return mixes $files Array in the format get_listing uses for folders
*/
- public function get_albums(){
+ public function get_albums() {
+ $files = array();
$content = $this->google_curl->get(google_picasa::LIST_ALBUMS_URL);
- $xml = new SimpleXMLElement($content);
- $files = array();
+ if (empty($content)) {
+ return $files;
+ }
- foreach($xml->entry as $album){
+ $xml = new SimpleXMLElement($content);
+ foreach ($xml->entry as $album) {
$gphoto = $album->children('http://schemas.google.com/photos/2007');
$mediainfo = $album->children('http://search.yahoo.com/mrss/');
@@ -507,7 +510,6 @@ public function get_albums(){
'thumbnail_height' => 160,
'children' => array(),
);
-
}
return $files;
@@ -520,14 +522,16 @@ public function get_albums(){
* @param string $rawxml XML from picasa api
* @return mixed $files A list of files for the file picker
*/
- public function get_photo_details($rawxml){
+ public function get_photo_details($rawxml) {
+ $files = array();
+ if (empty($rawxml)) {
+ return $files;
+ }
$xml = new SimpleXMLElement($rawxml);
$this->lastalbumname = (string)$xml->title;
- $files = array();
-
- foreach($xml->entry as $photo){
+ foreach ($xml->entry as $photo) {
$gphoto = $photo->children('http://schemas.google.com/photos/2007');
$mediainfo = $photo->children('http://search.yahoo.com/mrss/');
Please sign in to comment.
Something went wrong with that request. Please try again.