本文整理汇总了PHP中utility::arr2xml方法的典型用法代码示例。如果您正苦于以下问题:PHP utility::arr2xml方法的具体用法?PHP utility::arr2xml怎么用?PHP utility::arr2xml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility
的用法示例。
在下文中一共展示了utility::arr2xml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _doRegister
/**
* Register the new install with the LC API
*
* @access private
* @return string
*/
private function _doRegister($data)
{
global $lC_Database, $lC_Cache;
if (isset($data['activation_email']) && $data['activation_email'] != NULL) {
$storeEmail = $data['activation_email'];
} else {
$storeEmail = STORE_OWNER_EMAIL_ADDRESS;
}
if (isset($data['activation_serial']) && $data['activation_serial'] != NULL) {
$storeSerial = $data['activation_serial'];
} else {
$storeSerial = '';
}
// register the install with LC API
$registerArr = array('serial' => $storeSerial, 'storeName' => STORE_NAME, 'storeEmail' => $storeEmail, 'storeWWW' => HTTP_SERVER . DIR_WS_HTTP_CATALOG, 'storeSSL' => HTTPS_SERVER . DIR_WS_HTTPS_CATALOG, 'systemMetaData' => base64_encode(json_encode(lc_get_system_information())), 'serverMetaData' => isset($_SERVER) && is_array($_SERVER) ? base64_encode(json_encode($_SERVER)) : NULL, 'envMetaData' => isset($_ENV) && is_array($_ENV) ? base64_encode(json_encode($_ENV)) : NULL);
$checksum = hash('sha256', json_encode($registerArr));
$registerArr['checksum'] = $checksum;
$api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
$registerArr['ver'] = utility::getVersion();
$request_type = getRequestType();
$resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/register/install/', 'method' => 'post', 'parameters' => $registerArr, 'timeout' => 10));
$newInstallationID = preg_match("'<installationID[^>]*?>(.*?)</installationID>'i", $resultXML, $regs) == 1 ? $regs[1] : NULL;
$products = preg_match("'<products[^>]*?>(.*?)</products>'i", $resultXML, $regs) == 1 ? $regs[1] : NULL;
if (lC_Server_info_Admin::updateInstallID($newInstallationID)) {
return utility::arr2xml(array('error' => FALSE, 'installationID' => $newInstallationID, 'products' => $products));
} else {
return utility::arr2xml(array('error' => TRUE, 'message' => 'error processing the request'));
}
}