Ejemplo n.º 1
0
 public static function parseXMLLangMetaFile($path)
 {
     // Read the file to see if it's a valid component XML file
     $xml = MFactory::getXML($path);
     if (!$xml) {
         return false;
     }
     /*
      * Check for a valid XML root tag.
      *
      * Should be 'langMetaData'.
      */
     if ($xml->getName() != 'metafile') {
         unset($xml);
         return false;
     }
     $data = array();
     $data['name'] = (string) $xml->name;
     $data['type'] = $xml->attributes()->type;
     $data['creationDate'] = (string) $xml->creationDate ? (string) $xml->creationDate : MText::_('MLIB_UNKNOWN');
     $data['author'] = (string) $xml->author ? (string) $xml->author : MText::_('MLIB_UNKNOWN');
     $data['copyright'] = (string) $xml->copyright;
     $data['authorEmail'] = (string) $xml->authorEmail;
     $data['authorUrl'] = (string) $xml->authorUrl;
     $data['version'] = (string) $xml->version;
     $data['description'] = (string) $xml->description;
     $data['group'] = (string) $xml->group;
     return $data;
 }
Ejemplo n.º 2
0
 public function loadFile($file, $reset = true, $xpath = false)
 {
     // Check to see if the path is an absolute path.
     if (!is_file($file)) {
         // Not an absolute path so let's attempt to find one using MPath.
         $file = MPath::find(self::addFormPath(), strtolower($file) . '.xml');
         // If unable to find the file return false.
         if (!$file) {
             return false;
         }
     }
     // Attempt to load the XML file.
     $xml = MFactory::getXML($file, true);
     return $this->load($xml, $reset, $xpath);
 }
Ejemplo n.º 3
0
 public static function parseXMLLanguageFile($path)
 {
     // Try to load the file
     if (!($xml = MFactory::getXML($path))) {
         return null;
     }
     // Check that it's a metadata file
     if ((string) $xml->getName() != 'metafile') {
         return null;
     }
     $metadata = array();
     foreach ($xml->metadata->children() as $child) {
         $metadata[$child->getName()] = (string) $child;
     }
     return $metadata;
 }