$v){ if (!isset($ref_strings[$k])) { $file['extra']++; } else if (!isset($strings[$k])) { $file['missing']++; } else if ($v!=$ref_strings[$k]) { $file['changed']++; } else { $file['unchanged']++; } } } // set status if ($file['changed'] == 0) { $file['status'] = 0; } else if ($file['strings'] == $file['changed']) { $file['status'] = 100; } else { $file['status'] = min(100,floor( ($file['changed']/$file['strings'])*100 )); } // return return $file; } /** * Get Meta Info from an XML language file (extends Joomla method to handle mixed/lower cases) * @param string $xmlFile The file to parse including the path. * @return array The Meta Info in an array */ function getXMLMeta( $xmlFile ) { $xmlData = array( 'author' => '', 'authorEmail' => '', 'authorUrl' => '', 'client' => '', 'copyright' => '', 'creationDate' => '', 'date' => date('Y-m-d'), 'description' => '', 'license' => '', 'name' => '', 'tag' => '', 'time' => date('H:m:i'), 'version' => '', ); // load the XML file and run some tests to ensure that it exists and is a metafile $xml = & JFactory::getXMLParser('Simple'); if (is_file($xmlFile)) { if ( $xml->loadFile($xmlFile) ) { if ($xml->document->name() == 'metafile') { // all the nodes in the XML file will come through as lowercase keys // process the $xmlData array against the XML object tree foreach ($xmlData as $k=>$v) { $k_lc = strtolower($k); $element = & $xml->document->{$k}[0]; if ($element) { $xmlData[$k] = $element->data(); } else { $element = & $xml->document->{$k_lc}[0]; if ($element) { $xmlData[$k] = $element->data(); } else { $xmlData[$k] = $v; } } } } } // patch the date if ( (empty($xmlData['date'])) && (!empty($xmlData['creationdate'])) ) $xmlData['date'] = $xmlData['creationdate']; } // return return $xmlData; } /** * Transform a translation phrase. * @param string $s The phrase to transform. * @param array $options The configuration array for the component. * @return string The transformed phrase */ function strtr($s,$options) { // backticks if ($options['backticks']>0) { $s = strtr($s,"'",'`'); } else if ($options['backticks']<0) { $s = strtr($s,'`',"'"); } // return return $s; } } ?>