You are here

function media_youtube_unserialize_xml in Media: YouTube 7.2

Recursively converts a SimpleXMLElement object into an array.

Parameters

object $xml: The original XML object.

File

./media_youtube.module, line 395
Provides a stream wrapper and formatters appropriate for accessing and displaying YouTube videos.

Code

function media_youtube_unserialize_xml($xml) {
  if ($xml instanceof SimpleXMLElement) {
    $xml = (array) $xml;
  }
  if (is_array($xml)) {
    foreach ($xml as $key => $item) {
      $xml[$key] = media_youtube_unserialize_xml($item);
    }
  }
  return $xml;
}