示例#1
0
 /**
  * build product object with JoomlArt Format from $manifest
  *
  */
 function buildProduct($pname)
 {
     $manifest = $this->manifest;
     $legacy = $manifest->getName() == 'mosinstall' || $manifest->getName() == 'install' ? 1 : 0;
     $type = (string) $manifest->attributes()->type;
     $group = (string) $manifest->attributes()->group;
     $coreVersion = (string) $manifest->attributes()->version;
     $name = (string) $manifest->name;
     $coreVersion = jaGetCoreVersion($coreVersion, $pname);
     $version = (string) $manifest->version;
     $version = JFilterInput::clean($version, 'cmd');
     if (!empty($pname) && !empty($type)) {
         $jaProduct = new stdClass();
         $jaProduct->coreVersion = $coreVersion;
         $jaProduct->extKey = $pname;
         $jaProduct->name = $name;
         $jaProduct->group = $group;
         $jaProduct->version = $version;
         $jaProduct->type = $type;
         return $jaProduct;
     } else {
         return false;
     }
 }
示例#2
0
 /**
  * This function is cloned from function JApplicationHelper::parseXMLInstallFile($xmlfile)
  *
  * @param unknown_type $file
  * @return unknown
  */
 function parseXMLInstallFile($path)
 {
     // Read the file to see if it's a valid component XML file
     if (!($xml = JFactory::getXML($path))) {
         return false;
     }
     /*
      * Check for a valid XML root tag.
      *
      * Should be 'install', but for backward compatability we will accept 'extension'.
      * Languages are annoying and use 'metafile' instead
      */
     if ($xml->getName() != 'install' && $xml->getName() != 'extension' && $xml->getName() != 'metafile') {
         unset($xml);
         return false;
     }
     $data = array();
     $coreVersion = (string) $xml->attributes()->version;
     $data['legacy'] = $xml->getName() == 'mosinstall' || $xml->getName() == 'install';
     $data['name'] = (string) $xml->name;
     $data['coreVersion'] = jaGetCoreVersion($coreVersion, $data['name']);
     // check if we're a language if so use that
     $data['type'] = $xml->getName() == 'metafile' ? 'language' : (string) $xml->attributes()->type;
     $data['creationDate'] = (string) $xml->creationDate ? (string) $xml->creationDate : JText::_('UNKNOWN');
     $data['author'] = (string) $xml->author ? (string) $xml->author : JText::_('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;
 }