function GetDepFilesXML($manifestroot, $fname, &$filenames, &$dcx, $folder) { $nlist = $dcx->nodeList("//img/@src | //attachments/attachment/@href | //link/@href | //script/@src"); $css_obj_array = array(); foreach ($nlist as $nl) { $item = $nl->nodeValue; $path_parts = pathinfo($item); $fname = $path_parts['basename']; $ext = array_key_exists('extension', $path_parts) ? $path_parts['extension'] : ''; if (!is_url($nl->nodeValue)) { //$file = $folder.$nl->nodeValue; // DEPENDERA SI SE QUIERE Q SEA RELATIVO O ABSOLUTO $file = $nl->nodeValue; toNativePath($file); $filenames[] = $file; } } $dcx->registerNS('qti', 'http://www.imsglobal.org/xsd/imscc/ims_qtiasiv1p2.xsd'); $dcx->resetXpath(); $nlist = $dcx->nodeList("//qti:mattext | //text"); $dcx2 = new XMLGenericDocument(); foreach ($nlist as $nl) { if ($dcx2->loadString($nl->nodeValue)) { GetDepFilesHTML($manifestroot, $fname, $filenames, $dcx2, $folder); } } }
function GetDepFiles($manifestroot, $fname, $folder, &$filenames) { static $types = array('xhtml' => true, 'html' => true, 'htm' => true); $extension = strtolower(trim(pathinfo($fname, PATHINFO_EXTENSION))); $filenames = array(); if (isset($types[$extension])) { $dcx = new XMLGenericDocument(); $filename = $manifestroot . $folder . $fname; if (!file_exists($filename)) { $filename = $manifestroot . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $fname; } if (file_exists($filename)) { $res = $dcx->loadHTMLFile($filename); if ($res) { GetDepFilesHTML($manifestroot, $fname, $filenames, $dcx, $folder); } } } }