]> _ Git - cubist_scorm.git/commitdiff
wait #7586 master
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Jun 2025 10:40:43 +0000 (12:40 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Jun 2025 10:40:43 +0000 (12:40 +0200)
src/Manifest.php

index 0a76991806d94c183b13bd2ba6928b0a41e62655..215693a6233d1433ba5191172024796b94b4705b 100644 (file)
@@ -67,6 +67,9 @@ class Manifest
             $this->setOrganization($this->getOrganization() . '_ORG');
         }
 
+        $org = $this->_escapeIdentifier($this->getOrganization());
+        $ref = $this->_escapeIdentifier($this->getReference());
+
         return '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
 <manifest identifier="' . $this->_escape($this->getManifestID()) . '" version="1.3"
           xmlns="http://www.imsglobal.org/xsd/imscp_v1p1"
@@ -84,10 +87,10 @@ class Manifest
         <schema>ADL SCORM</schema>
         <schemaversion>2004 ' . $v . ' Edition</schemaversion>
     </metadata>
-    <organizations default="' . $this->_escapeAttr($this->_escapeOrganization($this->getOrganization())) . '">
-        <organization identifier="' . $this->_escapeAttr($this->_escapeOrganization($this->getOrganization())) . '" adlseq:objectivesGlobalToSystem="false">
+    <organizations default="' . $this->_escapeAttr($org) . '">
+        <organization identifier="' . $this->_escapeAttr($org) . '" adlseq:objectivesGlobalToSystem="false">
             <title>' . $this->_escape($this->getTitle()) . '</title>
-            <item identifier="' . $this->_escapeAttr($this->getReference()) . '" identifierref="' . $this->_escapeAttr($this->getReference()) . '_RES" isvisible="true">
+            <item identifier="' . $this->_escapeAttr($ref) . '" identifierref="' . $this->_escapeAttr($ref) . '_RES" isvisible="true">
                 <title>' . $this->_escape($this->getTitle()) . '</title>
                 <adlnav:presentation>
                     <adlnav:navigationInterface>
@@ -103,7 +106,7 @@ class Manifest
         </organization>
     </organizations>
     <resources>
-        <resource identifier="' . $this->_escapeAttr($this->getReference()) . '_RES" type="webcontent" adlcp:scormType="sco" href="' . $this->getStart() . '">
+        <resource identifier="' . $this->_escapeAttr($ref) . '_RES" type="webcontent" adlcp:scormType="sco" href="' . $this->getStart() . '">
             <file href="' . $this->getStart() . '"/>
         </resource>
     </resources>
@@ -119,6 +122,9 @@ class Manifest
             $this->setOrganization($this->getOrganization() . '_ORG');
         }
 
+        $org = $this->_escapeIdentifier($this->getOrganization());
+        $ref = $this->_escapeIdentifier($this->getReference());
+
         $res = '<?xml version="1.0" encoding="UTF-8"?>
 <manifest 
     xmlns="http://www.imsproject.org/xsd/imscp_rootv1p1p2"
@@ -133,16 +139,16 @@ class Manifest
         <schema>ADL SCORM</schema>
         <schemaversion>1.2</schemaversion>
     </metadata>
-    <organizations default="' . $this->_escapeAttr($this->_escapeOrganization($this->getOrganization())) . '">
-        <organization identifier="' . $this->_escapeAttr($this->_escapeOrganization($this->getOrganization())) . '" structure="hierarchical">
+    <organizations default="' . $this->_escapeAttr($org) . '">
+        <organization identifier="' . $this->_escapeAttr($org) . '" structure="hierarchical">
             <title>' . $this->_escape($this->getTitle()) . '</title>
-            <item identifier="' . $this->_escapeAttr($this->getReference()) . '" identifierref="' . $this->_escapeAttr($this->getReference()) . '_RES" isvisible="true">
+            <item identifier="' . $this->_escapeAttr($ref) . '" identifierref="' . $this->_escapeAttr($ref) . '_RES" isvisible="true">
                 <title>' . $this->_escape($this->getTitle()) . '</title>
             </item>
         </organization>
     </organizations>
     <resources>
-        <resource type="webcontent" adlcp:scormtype="sco" identifier="' . $this->_escapeAttr($this->getReference()) . '_RES" href="' . $this->getStart() . '">
+        <resource type="webcontent" adlcp:scormtype="sco" identifier="' . $this->_escapeAttr($ref) . '_RES" href="' . $this->getStart() . '">
             <file href="' . $this->getStart() . '"/>
         </resource>
     </resources>
@@ -151,7 +157,7 @@ class Manifest
         return $res;
     }
 
-    protected function _escapeOrganization($org)
+    protected function _escapeIdentifier($org)
     {
         return preg_replace('/[^a-z0-9_]/i', '', $org);
     }