original_string: public function get_albums() {
          $files = array();
          $content = $this->googleoauth->get(self::LIST_ALBUMS_URL);
  
          try {
              if (strpos($content, '<?xml') !== 0) {
                  throw new moodle_exception('invalidxmlresponse');
              }
              $xml = new SimpleXMLElement($content);
          } catch (Exception $e) {
              // An error occured while trying to parse the XML, let's just return nothing. SimpleXML does not
              // return a more specific Exception, that's why the global Exception class is caught here.
              return $files;
          }
  
          foreach ($xml->entry as $album) {
              $gphoto = $album->children('http://schemas.google.com/photos/2007');
  
              $mediainfo = $album->children('http://search.yahoo.com/mrss/');
              // Hacky...
              $thumbnailinfo = $mediainfo->group->thumbnail[0]->attributes();
  
              $files[] = array( 'title' => (string) $album->title,
                  'date'  => userdate($gphoto->timestamp),
                  'size'  => (int) $gphoto->bytesUsed,
                  'path'  => (string) $gphoto->id,
                  'thumbnail' => (string) $thumbnailinfo['url'],
                  'thumbnail_width' => 160,  // 160 is the native maximum dimension.
                  'thumbnail_height' => 160,
                  'children' => array(),
              );
          }
  
          return $files;
      }
code: public function get_albums() {
          $files = array();
          $content = $this->googleoauth->get(self::LIST_ALBUMS_URL);
  
          try {
              if (strpos($content, '<?xml') !== 0) {
                  throw new moodle_exception('invalidxmlresponse');
              }
              $xml = new SimpleXMLElement($content);
          } catch (Exception $e) {
              // An error occured while trying to parse the XML, let's just return nothing. SimpleXML does not
              // return a more specific Exception, that's why the global Exception class is caught here.
              return $files;
          }
  
          foreach ($xml->entry as $album) {
              $gphoto = $album->children('http://schemas.google.com/photos/2007');
  
              $mediainfo = $album->children('http://search.yahoo.com/mrss/');
              // Hacky...
              $thumbnailinfo = $mediainfo->group->thumbnail[0]->attributes();
  
              $files[] = array( 'title' => (string) $album->title,
                  'date'  => userdate($gphoto->timestamp),
                  'size'  => (int) $gphoto->bytesUsed,
                  'path'  => (string) $gphoto->id,
                  'thumbnail' => (string) $thumbnailinfo['url'],
                  'thumbnail_width' => 160,  // 160 is the native maximum dimension.
                  'thumbnail_height' => 160,
                  'children' => array(),
              );
          }
  
          return $files;
      }
code_tokens: public function get_albums ( ) { $ files = array ( ) ; $ content = $ this -> googleoauth -> get ( self :: LIST_ALBUMS_URL ) ; try { if ( strpos ( $ content , '<?xml' ) !== 0 ) { throw new moodle_exception ( 'invalidxmlresponse' ) ; } $ xml = new SimpleXMLElement ( $ content ) ; } catch ( Exception $ e ) { // An error occured while trying to parse the XML, let's just return nothing. SimpleXML does not // return a more specific Exception, that's why the global Exception class is caught here. return $ files ; } foreach ( $ xml -> entry as $ album ) { $ gphoto = $ album -> children ( 'http://schemas.google.com/photos/2007' ) ; $ mediainfo = $ album -> children ( 'http://search.yahoo.com/mrss/' ) ; // Hacky... $ thumbnailinfo = $ mediainfo -> group -> thumbnail [ 0 ] -> attributes ( ) ; $ files [ ] = array ( 'title' => ( string ) $ album -> title , 'date' => userdate ( $ gphoto -> timestamp ) , 'size' => ( int ) $ gphoto -> bytesUsed , 'path' => ( string ) $ gphoto -> id , 'thumbnail' => ( string ) $ thumbnailinfo [ 'url' ] , 'thumbnail_width' => 160 , // 160 is the native maximum dimension. 'thumbnail_height' => 160 , 'children' => array ( ) , ) ; } return $ files ; }
docstring: Gets all the users albums and returns them as a list of folders
  for the file picker
  
  @return mixes $files Array in the format get_listing uses for folders
docstring_tokens: Gets all the users albums and returns them as a list of folders for the file picker