Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…ODLE_23_STABLE
  • Loading branch information...
commit 83ee1d4a43dfcebcb11fab79d3f419da57cc2336 2 parents 40a639f + 1dfcc6e
@danpoltawski danpoltawski authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/googleapi.php
View
14 lib/googleapi.php
@@ -317,11 +317,14 @@ public function do_photo_search($query) {
* @return mixes $files Array in the format get_listing uses for folders
*/
public function get_albums() {
+ $files = array();
$content = $this->googleoauth->get(self::LIST_ALBUMS_URL);
- $xml = new SimpleXMLElement($content);
- $files = array();
+ if (empty($content)) {
+ return $files;
+ }
+ $xml = new SimpleXMLElement($content);
foreach ($xml->entry as $album) {
$gphoto = $album->children('http://schemas.google.com/photos/2007');
@@ -338,7 +341,6 @@ public function get_albums() {
'thumbnail_height' => 160,
'children' => array(),
);
-
}
return $files;
@@ -352,12 +354,14 @@ public function get_albums() {
* @return mixed $files A list of files for the file picker
*/
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) {
$gphoto = $photo->children('http://schemas.google.com/photos/2007');
Please sign in to comment.
Something went wrong with that request. Please try again.