log_prefix = $log_prefix; $this->interface_mode = $interface_mode; $this->fetch_url = 'apscatalog.com'; $this->aps_version = '1.2'; $this->packages_dir = ISPC_ROOT_PATH.'/aps_packages'; $this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages'; } /** * Converts a given value to it's native representation in 1024 units * * @param $value the size to convert * @return integer and string */ public function convertSize($value) { $unit = array('Bytes', 'KB', 'MB', 'GB', 'TB'); return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i]; } /** * Determine a specific xpath from a given SimpleXMLElement handle. If the * element is found, it's string representation is returned. If not, * the return value will stay empty * * @param $xml_handle the SimpleXMLElement handle * @param $query the XPath query * @param $array define whether to return an array or a string * @return $ret the return string */ protected function getXPathValue($xml_handle, $query, $array = false) { $ret = ''; $xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false; if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result); return $ret; } } ?>