original_string: public function get_photo_details($rawxml) {
          $files = array();
  
          try {
              if (strpos($rawxml, '<?xml') !== 0) {
                  throw new moodle_exception('invalidxmlresponse');
              }
              $xml = new SimpleXMLElement($rawxml);
          } 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;
          }
          $this->lastalbumname = (string)$xml->title;
  
          foreach ($xml->entry as $photo) {
              $gphoto = $photo->children('http://schemas.google.com/photos/2007');
  
              $mediainfo = $photo->children('http://search.yahoo.com/mrss/');
              $fullinfo = $mediainfo->group->content->attributes();
              // Hacky...
              $thumbnailinfo = $mediainfo->group->thumbnail[0]->attributes();
  
              // Derive the nicest file name we can.
              if (!empty($mediainfo->group->description)) {
                  $title = shorten_text((string)$mediainfo->group->description, 20, false, '');
                  $title = clean_filename($title).'.jpg';
              } else {
                  $title = (string)$mediainfo->group->title;
              }
  
              $files[] = array(
                  'title' => $title,
                  'date'  => userdate($gphoto->timestamp),
                  'size' => (int) $gphoto->size,
                  'path' => $gphoto->albumid.'/'.$gphoto->id,
                  'thumbnail' => (string) $thumbnailinfo['url'],
                  'thumbnail_width' => 72,  // 72 is the native maximum dimension.
                  'thumbnail_height' => 72,
                  'source' => (string) $fullinfo['url'],
                  'url' => (string) $fullinfo['url']
              );
          }
  
          return $files;
      }
code: public function get_photo_details($rawxml) {
          $files = array();
  
          try {
              if (strpos($rawxml, '<?xml') !== 0) {
                  throw new moodle_exception('invalidxmlresponse');
              }
              $xml = new SimpleXMLElement($rawxml);
          } 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;
          }
          $this->lastalbumname = (string)$xml->title;
  
          foreach ($xml->entry as $photo) {
              $gphoto = $photo->children('http://schemas.google.com/photos/2007');
  
              $mediainfo = $photo->children('http://search.yahoo.com/mrss/');
              $fullinfo = $mediainfo->group->content->attributes();
              // Hacky...
              $thumbnailinfo = $mediainfo->group->thumbnail[0]->attributes();
  
              // Derive the nicest file name we can.
              if (!empty($mediainfo->group->description)) {
                  $title = shorten_text((string)$mediainfo->group->description, 20, false, '');
                  $title = clean_filename($title).'.jpg';
              } else {
                  $title = (string)$mediainfo->group->title;
              }
  
              $files[] = array(
                  'title' => $title,
                  'date'  => userdate($gphoto->timestamp),
                  'size' => (int) $gphoto->size,
                  'path' => $gphoto->albumid.'/'.$gphoto->id,
                  'thumbnail' => (string) $thumbnailinfo['url'],
                  'thumbnail_width' => 72,  // 72 is the native maximum dimension.
                  'thumbnail_height' => 72,
                  'source' => (string) $fullinfo['url'],
                  'url' => (string) $fullinfo['url']
              );
          }
  
          return $files;
      }
code_tokens: public function get_photo_details ( $ rawxml ) { $ files = array ( ) ; try { if ( strpos ( $ rawxml , '<?xml' ) !== 0 ) { throw new moodle_exception ( 'invalidxmlresponse' ) ; } $ xml = new SimpleXMLElement ( $ rawxml ) ; } 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 ; } $ this -> lastalbumname = ( string ) $ xml -> title ; foreach ( $ xml -> entry as $ photo ) { $ gphoto = $ photo -> children ( 'http://schemas.google.com/photos/2007' ) ; $ mediainfo = $ photo -> children ( 'http://search.yahoo.com/mrss/' ) ; $ fullinfo = $ mediainfo -> group -> content -> attributes ( ) ; // Hacky... $ thumbnailinfo = $ mediainfo -> group -> thumbnail [ 0 ] -> attributes ( ) ; // Derive the nicest file name we can. if ( ! empty ( $ mediainfo -> group -> description ) ) { $ title = shorten_text ( ( string ) $ mediainfo -> group -> description , 20 , false , '' ) ; $ title = clean_filename ( $ title ) . '.jpg' ; } else { $ title = ( string ) $ mediainfo -> group -> title ; } $ files [ ] = array ( 'title' => $ title , 'date' => userdate ( $ gphoto -> timestamp ) , 'size' => ( int ) $ gphoto -> size , 'path' => $ gphoto -> albumid . '/' . $ gphoto -> id , 'thumbnail' => ( string ) $ thumbnailinfo [ 'url' ] , 'thumbnail_width' => 72 , // 72 is the native maximum dimension. 'thumbnail_height' => 72 , 'source' => ( string ) $ fullinfo [ 'url' ] , 'url' => ( string ) $ fullinfo [ 'url' ] ) ; } return $ files ; }
docstring: Recieves XML from a picasa list of photos and returns
  array in format for file picker.
  
  @param string $rawxml XML from picasa api
  @return mixed $files A list of files for the file picker
docstring_tokens: Recieves XML from a picasa list of photos and returns array in format for file picker .