本文整理汇总了PHP中XmlParser::GetRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlParser::GetRoot方法的具体用法?PHP XmlParser::GetRoot怎么用?PHP XmlParser::GetRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlParser
的用法示例。
在下文中一共展示了XmlParser::GetRoot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list
function SendServer2ServerCart($xml_cart, $die = true)
{
list($status, $body) = $this->SendReq($this->merchant_checkout, $this->GetAuthenticationHeaders(), $xml_cart);
if ($status != 200) {
return array($status, $body);
} else {
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '.');
require_once 'xml-processing/xmlparser.php';
$xml_parser = new XmlParser($body);
$root = $xml_parser->GetRoot();
$data = $xml_parser->GetData();
$this->log->logRequest("Redirecting to: " . $data[$root]['redirect-url']['VALUE']);
header('Location: ' . $data[$root]['redirect-url']['VALUE']);
if ($die) {
die($data[$root]['redirect-url']['VALUE']);
} else {
return array(200, $data[$root]['redirect-url']['VALUE']);
}
}
}
示例2: main
/**
* This method is handles the response that will be invoked (from extern/googleNotify) every time
* a notification or request is sent by the Google Server.
*
*/
static function main($xml_response)
{
require_once 'Google/library/googleresponse.php';
require_once 'Google/library/googlemerchantcalculations.php';
require_once 'Google/library/googleresult.php';
require_once 'Google/library/xml-processing/xmlparser.php';
$config = CRM_Core_Config::singleton();
// Retrieve the XML sent in the HTTP POST request to the ResponseHandler
if (get_magic_quotes_gpc()) {
$xml_response = stripslashes($xml_response);
}
require_once 'CRM/Utils/System.php';
$headers = CRM_Utils_System::getAllHeaders();
if (GOOGLE_DEBUG_PP) {
CRM_Core_Error::debug_var('RESPONSE', $xml_response, TRUE, TRUE, 'Google');
}
// Retrieve the root and data from the xml response
$xmlParser = new XmlParser($xml_response);
$root = $xmlParser->GetRoot();
$data = $xmlParser->GetData();
$orderNo = $data[$root]['google-order-number']['VALUE'];
// lets retrieve the private-data
$privateData = $data[$root]['shopping-cart']['merchant-private-data']['VALUE'];
$privateData = $privateData ? self::stringToArray($privateData) : '';
list($mode, $module, $paymentProcessorID) = self::getContext($xml_response, $privateData, $orderNo, $root);
$mode = $mode ? 'test' : 'live';
require_once 'CRM/Financial/BAO/PaymentProcessor.php';
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($paymentProcessorID, $mode);
$ipn =& self::singleton($mode, $module, $paymentProcessor);
// Create new response object
$merchant_id = $paymentProcessor['user_name'];
$merchant_key = $paymentProcessor['password'];
$server_type = $mode == 'test' ? "sandbox" : '';
$response = new GoogleResponse($merchant_id, $merchant_key, $xml_response, $server_type);
if (GOOGLE_DEBUG_PP) {
CRM_Core_Error::debug_var('RESPONSE-ROOT', $response->root, TRUE, TRUE, 'Google');
}
//Check status and take appropriate action
$status = $response->HttpAuthentication($headers);
switch ($root) {
case "request-received":
case "error":
case "diagnosis":
case "checkout-redirect":
case "merchant-calculation-callback":
break;
case "new-order-notification":
$response->SendAck();
$ipn->newOrderNotify($data[$root], $privateData, $module);
break;
case "order-state-change-notification":
$response->SendAck();
$new_financial_state = $data[$root]['new-financial-order-state']['VALUE'];
$new_fulfillment_order = $data[$root]['new-fulfillment-order-state']['VALUE'];
switch ($new_financial_state) {
case 'CHARGEABLE':
$amount = $ipn->getAmount($orderNo);
if ($amount) {
$response->SendChargeOrder($data[$root]['google-order-number']['VALUE'], $amount, $message_log);
$response->SendProcessOrder($data[$root]['google-order-number']['VALUE'], $message_log);
}
break;
case 'CHARGED':
case 'PAYMENT_DECLINED':
case 'CANCELLED':
$ipn->orderStateChange($new_financial_state, $data[$root], $module);
break;
case 'REVIEWING':
case 'CHARGING':
case 'CANCELLED_BY_GOOGLE':
break;
default:
break;
}
case "charge-amount-notification":
case "chargeback-amount-notification":
case "refund-amount-notification":
case "risk-information-notification":
$response->SendAck();
break;
default:
break;
}
}
示例3: getArrayFromXML
/**
* @param $xmlData
*
* @return array
*/
static function getArrayFromXML($xmlData)
{
require_once 'Google/library/xml-processing/xmlparser.php';
$xmlParser = new XmlParser($xmlData);
$root = $xmlParser->GetRoot();
$data = $xmlParser->GetData();
return array($root, $data);
}
示例4: CheckoutHTMLButtonCode
function CheckoutHTMLButtonCode($size = "large", $variant = true, $loc = "en_US", $showtext = true, $style = "trans")
{
switch (strtolower($size)) {
case "medium":
$width = "168";
$height = "44";
break;
case "small":
$width = "160";
$height = "43";
break;
case "large":
default:
$width = "180";
$height = "46";
break;
}
if ($this->variant == false) {
switch ($variant) {
case false:
$this->variant = "disabled";
break;
case true:
default:
$this->variant = "text";
break;
}
}
$data = "<div style=\"width: " . $width . "px\">";
if ($this->variant == "text") {
$data .= "<div align=\"center\"><form method=\"POST\" action=\"" . $this->checkoutForm_url . "\"" . ($this->googleAnalytics_id ? " onsubmit=\"setUrchinInputCode();\"" : "") . ">";
$request = $this->GetXML();
require_once 'xml-processing/xmlparser.php';
$xml_parser = new XmlParser($request);
$root = $xml_parser->GetRoot();
$XMLdata = $xml_parser->GetData();
$this->xml2html($XMLdata[$root], '', $data);
$data .= "<input type=\"image\" name=\"Checkout\" alt=\"Checkout\" " . "src=\"" . $this->server_url . "buttons/checkout.gif?merchant_id=" . $this->merchant_id . "&w=" . $width . "&h=" . $height . "&style=" . $style . "&variant=" . $this->variant . "&loc=" . $loc . "\" \n height=\"" . $height . "\" width=\"" . $width . "\" />";
if ($this->googleAnalytics_id) {
$data .= "<input type=\"hidden\" name=\"analyticsdata\" value=\"\">";
}
$data .= "</form></div>";
if ($this->googleAnalytics_id) {
$data .= "<!-- Start Google analytics -->\n <script src=\"https://ssl.google-analytics.com/urchin.js\" type=\"" . "text/javascript\">\n </script>\n <script type=\"text/javascript\">\n _uacct = \"" . $this->googleAnalytics_id . "\";\n urchinTracker();\n </script>\n <script src=\"https://checkout.google.com/files/digital/urchin_po" . "st.js\" type=\"text/javascript\"></script> \n <!-- End Google analytics -->";
}
} else {
$data .= "<div align=\"center\"><img alt=\"Checkout\" src=\"" . "" . $this->server_url . "buttons/checkout.gif?merchant_id=" . "" . $this->merchant_id . "&w=" . $width . "&h=" . $height . "&style=" . $style . "&variant=" . $this->variant . "&loc=" . $loc . "\" height=\"" . $height . "\"" . " width=\"" . $width . "\" /></div>";
}
if ($showtext) {
$data .= "<div align=\"center\"><a href=\"javascript:void(window.ope" . "n('http://checkout.google.com/seller/what_is_google_checkout.html'" . ",'whatischeckout','scrollbars=0,resizable=1,directories=0,height=2" . "50,width=400'));\" onmouseover=\"return window.status = 'What is G" . "oogle Checkout?'\" onmouseout=\"return window.status = ''\"><font " . "size=\"-2\">What is Google Checkout?</font></a></div>";
}
$data .= "</div>";
return $data;
}
示例5: getParsedXmlResponseBody
/**
* @return array An array representation of the xml data as
* array('xmlroot' => the root element name of the data,
* 'xmldata' => the parsed xml), as returned by {@link XmlParser}
*/
function getParsedXmlResponseBody()
{
$xmlp = new XmlParser($this->_body);
return array('xmlroot' => $xmlp->GetRoot(), 'xmldata' => $xmlp->GetData());
}