本文整理汇总了PHP中XML2Array类的典型用法代码示例。如果您正苦于以下问题:PHP XML2Array类的具体用法?PHP XML2Array怎么用?PHP XML2Array使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XML2Array类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $xml - XML de resposta do Webservice
*/
function __construct($xml)
{
$array = XML2Array::createArray($xml);
foreach ($array as $indice => $valor) {
$this->array = $valor;
switch ($indice) {
case 'AUTHORIZATION':
//GetAuthorized
$this->retornoAutorizacao();
break;
case 'CONFIRMATION':
//vários casos
$this->retornoConfirmacao();
break;
case 'COUNCIL':
//CouncilReport
$this->retornoVendas();
break;
case 'REPORT':
//SalesSumm
$this->retornoRelatorio();
break;
case 'ROOT':
//Erro no CouncilReport ou SalesSumm
$this->retornoErro();
break;
default:
throw new \UnexpectedValueException('Retorno inesperado.');
}
}
unset($this->array);
//o atributo não será mais utilizado
}
开发者ID:jonathanweb,项目名称:KomerciAPI,代码行数:36,代码来源:Response.php
示例2: getParamsFromRequest
/**
* Parse params from request.
* @return array
*/
public function getParamsFromRequest()
{
$requestMethod = strtolower($_SERVER['REQUEST_METHOD']);
switch ($requestMethod) {
case 'get':
$params = $_GET;
break;
case 'post':
$params = $_POST;
$xml = @simplexml_load_string($params['data']);
if (false !== $xml && null !== $xml) {
$params = XML2Array::createArray($params['data']);
}
break;
case 'put':
parse_str(file_get_contents('php://input'), $params);
$xml = @simplexml_load_string($params['data']);
if (false !== $xml && null !== $xml) {
$params = XML2Array::createArray($params['data']);
}
$params['id'] = $_GET['id'];
break;
case 'delete':
$params['id'] = $_GET['id'];
break;
}
return $params;
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:32,代码来源:ApiRestRequest.php
示例3: _xml2array
private static function _xml2array($xml)
{
if (!$xml || $xml == "") {
return array();
}
require_once dirname(__FILE__) . "/xml2array.lib.class.php";
return XML2Array::createArray($xml);
}
开发者ID:huqq1987,项目名称:clone-lemon,代码行数:8,代码来源:mqs.sdk.class.php
示例4: transform
/**
* Transforms the API response into a PHP array
*
* @static
* @param $response
* @param $format
* @return array|mixed|DOMDocument
*/
public static function transform($response, $format)
{
if ($format == "json") {
return json_decode($response);
} elseif ($format == "xml") {
return XML2Array::createArray($response);
} else {
throw new \Exception("{$format} transformer is not implemented yet");
}
}
开发者ID:nass600,项目名称:CosmBundle,代码行数:18,代码来源:ResponseToArrayTransformer.php
示例5: login
protected function login($username = 'super', $password = 'super', $type = 'json')
{
$headers = array('Accept: application/' . $type, 'ZURMO_AUTH_USERNAME: ' . $username, 'ZURMO_AUTH_PASSWORD: ' . $password, 'ZURMO_API_REQUEST_TYPE: REST');
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/zurmo/api/login', 'POST', $headers);
if ($type == 'json') {
$response = json_decode($response, true);
} elseif ($type == 'xml') {
$response = XML2Array::createArray($response);
}
if ($response['status'] == ApiResponse::STATUS_SUCCESS) {
return $response['data'];
} else {
return false;
}
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:15,代码来源:ApiRestTest.php
示例6: Exception
/**
* Convert an XML to Array
* @param string $node_name - name of the root node to be converted
* @param array $arr - aray to be converterd
* @return DOMDocument
*/
public static function &createArray($input_xml) {
$xml = self::getXMLRoot();
if(is_string($input_xml)) {
$parsed = $xml->loadXML($input_xml);
if(!$parsed) {
throw new Exception('[XML2Array] Error parsing the XML string.');
}
} else {
if(get_class($input_xml) != 'DOMDocument') {
throw new Exception('[XML2Array] The input XML object should be of type: DOMDocument.');
}
$xml = self::$xml = $input_xml;
}
$array[$xml->documentElement->tagName] = self::convert($xml->documentElement);
self::$xml = null; // clear the xml node in the class for 2nd time use.
return $array;
}
开发者ID:JeffreyMartinezEiso,项目名称:lrv,代码行数:23,代码来源:XML2Array.php
示例7: getBookJSONFromXMLNode2
/**
* Obtiene y limpia el JSON final para insertar el ebook como documento
* Limpia y agrega los campos de _id y lastUpdate
*/
public static function getBookJSONFromXMLNode2($node)
{
//Funcion de procesamiento del XMl a la cadena JSON
$arr = XML2Array::createArray($node);
//Agrega last update y limpia el inicio y fin para simplificar la jerarquia
//De esta forma no funciona al pasar a json se pierde
//$arr['book']['lastUpdate'] = new MongoDate();
$date = new MongoDate();
$arr['book']['lastUpdate'] = array('$date' => $date->sec * 1000 + $date->usec / 1000);
$mongo_id = str_replace('-', '', $arr['book']['@attributes']['id']);
$arr['book']['_id'] = $mongo_id;
//concvert to json
$jsonContents = json_encode($arr);
//Eliminación de datos innecesarios en la cadena JSON
$json_string = Utils::cleanJSON($jsonContents);
return $json_string;
}
开发者ID:carlosmirandadiaz,项目名称:LectoGeeks,代码行数:21,代码来源:Utils.php
示例8: getResponse
/**
* getResponse function
* This will get a detailed description from MedlinePlus Connect
* @param $coding
* @param $code
* @return \Array
*/
function getResponse($coding, $code)
{
if ($coding == 'ICD9') {
$this->codingSystem = 'mainSearchCriteria.v.cs=2.16.840.1.113883.6.103';
}
if ($coding == 'SNOMED') {
$this->codingSystem = 'mainSearchCriteria.v.cs=2.16.840.1.113883.6.96';
}
if ($coding == 'RXCUI') {
$this->codingSystem = 'mainSearchCriteria.v.cs=2.16.840.1.113883.6.88';
}
if ($coding == 'NDC') {
$this->codingSystem = 'mainSearchCriteria.v.cs=2.16.840.1.113883.6.69';
}
if ($coding == 'LOINC') {
$this->codingSystem = 'mainSearchCriteria.v.cs=2.16.840.1.113883.6.1';
}
$urlBuilder = $this->medlineUrl . $this->codingSystem . '&mainSearchCriteria.v.c=' . $code;
$xmlData = simplexml_load_file($urlBuilder);
return \XML2Array::createArray($xmlData);
}
开发者ID:igez,项目名称:gaiaehr,代码行数:28,代码来源:MedlinePlus.php
示例9: preg_replace
/**
* Convert an XML to Array
* @param $input_xml
* @return DOMDocument
* @throws Exception
* @internal param string $node_name - name of the root node to be converted
* @internal param array $arr - aray to be converterd
*/
public static function &createArray($input_xml)
{
// clean xml comments
$input_xml = preg_replace('/<!--[\\s\\S\\W\\D]*?-->/', '', $input_xml);
$input_xml = str_replace(['&', '<br/>', '<br />'], ['&', ' ', ' '], $input_xml);
$xml = self::getXMLRoot();
if (is_string($input_xml)) {
$parsed = $xml->loadXML($input_xml);
if (!$parsed) {
throw new Exception('[XML2Array] Error parsing the XML string.');
}
} else {
if (get_class($input_xml) != 'DOMDocument') {
throw new Exception('[XML2Array] The input XML object should be of type: DOMDocument.');
}
$xml = self::$xml = $input_xml;
}
$array[$xml->documentElement->tagName] = self::convert($xml->documentElement);
self::$xml = null;
// clear the xml node in the class for 2nd time use.
return $array;
}
开发者ID:igez,项目名称:gaiaehr,代码行数:30,代码来源:XML2Array.php
示例10: markers_deployable
function markers_deployable($res, $world)
{
$markers = array();
$xml = file_get_contents('vehicles.xml', true);
require_once 'modules/lib/class.xml2array.php';
$vehicles_xml = XML2Array::createArray($xml);
while ($row = mysql_fetch_array($res)) {
$Worldspace = str_replace("[", "", $row['Worldspace']);
$Worldspace = str_replace("]", "", $Worldspace);
$Worldspace = explode(",", $Worldspace);
$x = 0;
if (array_key_exists(1, $Worldspace)) {
$x = $Worldspace[1];
}
$y = 0;
if (array_key_exists(2, $Worldspace)) {
$y = $Worldspace[2];
}
$type = $row['Classname'];
$ltype = strtolower($type);
if (array_key_exists('s' . $ltype, $vehicles_xml['vehicles'])) {
$class = $vehicles_xml['vehicles']['s' . $ltype]['Type'];
} else {
$class = "Car";
}
require_once 'modules/calc.php';
$description = '<h2><a href="index.php?view=info&show=5&id=' . $row['ObjectID'] . '">' . $type . '</a></h2><table><tr><td><img src="images/vehicles/' . $ltype . '.png" alt="" style="width: 100px;" /></td><td> </td><td style="vertical-align: top;"><h2>Position:</h2>Left: ' . round(world_x($x, $world)) . '<br />Top: ' . round(world_y($y, $world)) . '</td></tr></table>';
$tmp = array();
$tmp["lat"] = world_y($y, $world) / 10;
$tmp["lng"] = world_x($x, $world) / 10;
$tmp["icon"] = $class;
$tmp["title"] = $type . " (" . $row['ObjectID'] . ")";
$tmp["description"] = $description;
$markers[] = $tmp;
}
return $markers;
}
开发者ID:Reema49,项目名称:dayz,代码行数:37,代码来源:markers.php
示例11: Exception
/**
* Convert an XML to Array
* @param string $node_name - name of the root node to be converted
* @param array $arr - aray to be converterd
* @return DOMDocument
*/
public static function &createArray($input_xml)
{
$xml = self::getXMLRoot();
if (is_string($input_xml)) {
$parsed = $xml->loadXML($input_xml);
if (!$parsed) {
echo "XML String = {$input_xml}\n";
throw new Exception('[XML2Array] Error parsing the XML string.');
}
} else {
if (get_class($input_xml) != 'DOMDocument') {
$fhe = fopen("exception.log", "w+");
# throw new Exception('[XML2Array] The input XML object should be of type: DOMDocument.');
$errmsg = "throw new Exception('[XML2Array] The input XML object should be of type: DOMDocument.')\n";
fwrite($fhe, $errmsg);
fclose($fhe);
}
$xml = self::$xml = $input_xml;
}
$array[$xml->documentElement->tagName] = self::convert($xml->documentElement);
self::$xml = null;
// clear the xml node in the class for 2nd time use.
return $array;
}
开发者ID:nightbeacons,项目名称:translate,代码行数:30,代码来源:xml2array.php
示例12: file_get_contents
} else {
// xml file //
$cu3er_pathDir = $baseurl . '/' . $rand;
$dir = $basedir . '/' . $rand;
$xmlName[0] = $testXmlFile;
}
if ($testXmlFile != '') {
$xmlStr = file_get_contents($testXmlFile);
if (!file_exists($dir . '/' . basename($xmlName[0]))) {
touch($dir . '/' . basename($xmlName[0]));
$handle = fopen($dir . '/' . basename($xmlName[0]), 'w+');
fwrite($handle, $xmlStr);
fclose($handle);
}
include_once "xml2array.php";
$xml_debugger = new XML2Array();
if ($xmlStr != '') {
$xmlStr = preg_replace('/\\<transition(.*?)\\>/', '<transition empty="true"$1>', $xmlStr);
}
$arrXml = $xml_debugger->parse($xmlStr);
if (!is_array($arrXml)) {
$xmlStr = cu3er__our_fopen($testXmlFile);
if ($xmlStr == false) {
echo $cu3er_messages['missingXML'];
} else {
$xmlStr = preg_replace('/\\<transition(.*?)\\>/', '<transition empty="true"$1>', $xmlStr);
$arrXml = $xml_debugger->parse($xmlStr);
}
}
if (!is_array($arrXml)) {
echo $cu3er_messages['notXML'];
开发者ID:shieldsdesignstudio,项目名称:forefield,代码行数:31,代码来源:ajaxReq.php
示例13: parse_response
/**
* 转换响应
* @param $response
* @return array
* @throws Exception
*/
public static function parse_response($response, $format = "array")
{
//如果启用响应结果转换,则进行转换,否则原样返回
$body = $response->body;
$headers = $response->header;
switch (strtolower($format)) {
case 'array':
$body = empty($body) ? $body : XML2Array::createArray($body);
break;
case "json":
$body = empty($body) ? $body : json_encode(XML2Array::createArray($body));
break;
default:
break;
}
return array('success' => $response->isOk(), 'status' => $response->status, 'header' => $headers, 'body' => $body);
return $response;
}
开发者ID:283541486,项目名称:kaixinwa2.0,代码行数:24,代码来源:oss_util.class.php
示例14: translateOneNode
function translateOneNode($currentNodeID, $to_languages, $content_type)
{
global $db, $XMLarray, $error_log;
$separator = "7543545165934149";
// Fetch a node from Drupal if a copy does not already exist in sources dir.
// $xml_MASTER is the original English-language version
// $xml is the copy that will be translated
$fn = getcwd() . "/sources/SOURCE_" . $currentNodeID . ".XML";
if (file_exists($fn)) {
$xml_MASTER = file_get_contents($fn);
if ($content_type == "page") {
// Remove <teaser> from "page". The "teaser" is created by truncating the <body>, resulting in invalid XML
$xml_MASTER = preg_replace("|<teaser>.*?</teaser>|us", "<teaser></teaser>", $xml_MASTER);
}
} else {
$xml_MASTER = fetchOneNode($currentNodeID);
if ($content_type == "page") {
$xml_MASTER = preg_replace("|<teaser>.*?</teaser>|us", "<teaser></teaser>", $xml_MASTER);
}
$fh = fopen($fn, "w");
fwrite($fh, $xml_MASTER);
fclose($fh);
}
foreach ($to_languages as $to_language) {
$query = "select drupal_code from sovee.languages where sovee_code = '" . $to_language . "'";
$result = mysql_query($query, $db);
while ($row = mysql_fetch_assoc($result)) {
$drupalLanguageCode = $row['drupal_code'];
}
mysql_free_result($result);
echo "\n=====================================================================================\n========== ==========\n. . . Translating node {$currentNodeID} ({$content_type}) into {$to_language} . . . \n";
$error_IncompleteNodeFlag = 0;
$xml = $xml_MASTER;
// Create a copy of the master, to be translated
// Convert XML to array
$XMLarray = XML2Array::createArray($xml);
// Get info about the node
// Requested info is placed in the $requestedTags array
// and returned in the assoc. array info()
$requestedTags = array("type", "tnid");
$info = getXMLinfo($xml, $requestedTags);
$derivedContentType = $info['type'];
// Build list of containers to parse for the given content_type.
$query = "select DISTINCT sovee.node_fields.name from sovee.content_type \nLEFT JOIN sovee.field_map ON sovee.content_type.id = sovee.field_map.content_id\nLEFT JOIN sovee.node_fields ON sovee.node_fields.id = sovee.field_map.field_id\nWHERE sovee.content_type.name = '" . $derivedContentType . "'";
$result = mysql_query($query, $db);
while ($row = mysql_fetch_assoc($result)) {
$containerArrayTemplate[] = $row['name'];
}
mysql_free_result($result);
// Walk throught the array, extract the specified containers, translate
// and replace in the array
// All array elements are assumed to be in the [node_export][node] array
// $containerArrayTemplate = array("body", "title", "teaser", "field_product_subtitle|n*|value", "field_warranty|n*|value", "field_product_education|n*|value",
// "field_prod_man_docs_link|n*|title",
// "field_did_you_know|n*|value", "field_product_benefits|n*|value", "nodewords|copyright|value", "nodewords|dcterms.contributor|value",
// "nodewords|dcterms.title|value", "nodewords|description|value", "nodewords|keywords|value" );
$containerArray = expandTemplate($containerArrayTemplate);
$allContainers = "<div>{$separator}";
foreach ($containerArray as $oneContainer) {
echo "\nProcessing container {$oneContainer}\n";
$parents = explode("|", $oneContainer);
array_unshift($parents, "node_export", "node");
#echo "Parents: ";
#print_r($parents);
$XMLfragment = drupal_array_get_nested_value($XMLarray, $parents);
if (is_array($XMLfragment)) {
$XMLfragment = "";
}
$translatedFragment = "";
$patterns = array("|^<div>|us", "|</div>\$|us");
// The "|u" flag enables multibyte support
$replacements = array("", "");
if (strlen(trim($XMLfragment)) > 0 and !is_array($XMLfragment)) {
$XMLfragment = "<div>" . $XMLfragment . "</div>";
// Encapsulate in dummy <div> to satisfy Sovee translator
// echo "ORIGINAL Fragment = |$XMLfragment|\n";
} else {
echo "Original Fragment |{$XMLfragment}| is empty -- skipping.\n";
}
$allContainers .= $XMLfragment . $separator;
// Add at the end of each container to faciliate preg_split
}
// ------- End of foreach($containerArray as $oneContainer)
$allContainers .= "</div>";
// Translate the entire node if target language is not English
echo "TO_LANGUAGE = {$to_language}\n";
$xxx = substr($to_language, 0, 2);
echo "SUBSTR = |{$xxx}|\n";
$sovee_to_language = $to_language;
if (substr($to_language, 0, 2) != "en") {
if ($to_language == "es-419") {
$sovee_to_language = "es-es";
}
// Use standard Spanish for Latin America
echo "Sending strings to Sovee . . . \n";
$translatedFragmentAry = translateFrag($allContainers, $currentNodeID, "FULL NODE", $to_language);
// Perform the translation
$translatedFragment = $translatedFragmentAry['content'];
$translatedFragmentError = $translatedFragmentAry['error_count'];
// Count of translation errors. 0 = success
//.........这里部分代码省略.........
开发者ID:nightbeacons,项目名称:translate,代码行数:101,代码来源:content.php
示例15: array_merge
if ($in) {
$prov['cfg_behavior'] = array_merge($prov['cfg_behavior'], XML2Array::createArray($in));
}
$in = '';
if ($in) {
$prov['cfg_base'] = XML2Array::createArray($in);
}
/* if you have more the 1 subselection add this seperatly */
$in = '';
if ($in) {
$prov['cfg_base'] = array_merge($prov['cfg_base'], XML2Array::createArray($in));
}
$in = '';
if ($in) {
$prov['cfg_base'] = array_merge($prov['cfg_base'], XML2Array::createArray($in));
}
$in = '';
if ($in) {
$prov['cfg_tone'] = XML2Array::createArray($in);
}
$in = '';
if ($in) {
$prov['cfg_keys'] = XML2Array::createArray($in);
}
$prov['cfg_key'] = json_decode(plain2json($in, $del));
$prov['pvt_generator'] = 'json2xml';
$prov['pvt_counter'] = 1;
$prov['pvt_type'] = 'provisioner';
echo upload_phone_data($prov);
unset($prov);
}
开发者ID:urueedi,项目名称:kazoo-provision,代码行数:31,代码来源:polycom_template_xml.php
示例16: getProjectConfig
/**
* @param string $prj_id
* @return array
* @throws AException
*/
public function getProjectConfig($prj_id)
{
$file_name = DIR_EXT . 'developer_tools/projects/dev_tools_project_' . $prj_id . '.xml';
$xml = file_get_contents($file_name);
$xml_array = array();
if ($xml) {
$xml_array = XML2Array::createArray($xml);
if (!$xml_array) {
$this->error[] = 'Cannot convert xml-file ' . $file_name . ' into array. Probably wrong xml syntax.';
}
$xml_array = $xml_array['project']['extension'];
foreach ($xml_array as &$node) {
if (is_array($node) && isset($node['@cdata'])) {
$node = $node['@cdata'];
}
}
// remove item tag from arrays
$mvcs = array('models', 'views', 'controllers', 'languages');
foreach ($this->sections as $section) {
foreach ($mvcs as $mvc) {
$item = $xml_array[$mvc][$section]['item'];
if (is_array($item) && is_string(key($item))) {
$item = array($item);
}
$xml_array[$mvc][$section] = $item;
}
}
} else {
$this->error[] = 'Cannot open file ' . $file_name;
}
return $xml_array;
}
开发者ID:hakoobe247,项目名称:developer_tools_extension,代码行数:37,代码来源:developer_tools.php
示例17: importXml
/**
* XML 복원파일을 입력받아 기존 데이터를 비우고 DB에 입력한다.
* @param string $file
*/
public function importXml($file)
{
global $wpdb;
include 'XML2Array.class.php';
$xml = file_get_contents($file);
$array = XML2Array::createArray($xml);
foreach ($array['kboard'] as $table => $rows) {
// 테이블에 입력될 데이터가 한 개인지 여러개 인지 확인한다.
if (isset($rows['data']) && is_array($rows['data'])) {
$keys = array_keys($rows['data']);
if (reset($keys) == '0') {
$data = $rows['data'];
} else {
$data = $rows;
}
} else {
$data = $rows;
}
if ($data) {
// 테이블 이름에 PREFIX를 추가 한다.
$table = $wpdb->prefix . $table;
// 새로 생성될 테이블을 비운다.
$wpdb->query("TRUNCATE TABLE `{$table}`");
// 새로운 content를 입력하기 위해서 posts테이블에 입력된 content를 삭제한다.
if (stristr($table, 'kboard_board_content')) {
$wpdb->query("DELETE FROM `{$wpdb->prefix}posts` WHERE `post_type`='kboard'");
}
foreach ($data as $key => $row) {
$keys = array_keys($row);
$row_count = count($row);
$columns = array();
for ($i = 0; $i < $row_count; $i++) {
$columns[] = "`{$keys[$i]}`";
}
$columns = implode(',', $columns);
$value = array();
for ($i = 0; $i < $row_count; $i++) {
$value[] = "'" . addslashes($row[$keys[$i]]['@cdata']) . "'";
}
$value = implode(',', $value);
$wpdb->query("INSERT INTO `{$table}` ({$columns}) VALUE ({$value})");
/*
* search 값이 있을경우 post 테이블에 내용을 입력한다.
*/
if (isset($row['search']) && ($row['search']['@cdata'] == 1 || $row['search']['@cdata'] == 2)) {
if ($wpdb->insert_id) {
$kboard_post = array('post_author' => $row['member_uid']['@cdata'], 'post_title' => addslashes($row['title']['@cdata']), 'post_content' => addslashes($row['secret']['@cdata'] == 'true' || $row['search']['@cdata'] == 2 ? '' : $row['content']['@cdata']), 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_name' => $wpdb->insert_id, 'post_parent' => $row['board_id']['@cdata'], 'post_type' => 'kboard');
wp_insert_post($kboard_post, true);
}
}
}
// end foreach
}
}
// end foreach
}
开发者ID:kimyj9501,项目名称:SingMyStory,代码行数:60,代码来源:KBBackup.class.php
示例18: json_decode
$RawInventory = $row['Inventory'];
$Inventory = json_decode($RawInventory);
$RawBackpack = $row['Backpack'];
$Backpack = json_decode($RawBackpack);
$model = str_replace('"', '', $row['Model']);
$name = $row['PlayerName'];
if (is_array($Inventory)) {
if (array_key_exists(1, $Inventory)) {
$Inventory = array_merge($Inventory[0], $Inventory[1]);
}
} else {
$Inventory = array();
}
$xml = file_get_contents('/items.xml', true);
require_once 'modules/lib/class.xml2array.php';
$items_xml = XML2Array::createArray($xml);
if (file_exists('banned.txt')) {
$txt = file_get_contents('banned.txt', true);
$txt = str_replace("\"", "", str_replace("\r", "", $txt));
$items_banned = explode("\n", $txt);
} else {
$items_banned = array();
}
$binocular = array();
$rifle = '<img style="max-width: 220px; max-height: 92px;" src="images/gear/rifle.png" title="" alt="" />';
$pistol = '<img style="max-width: 92px; max-height: 92px;" src="images/gear/pistol.png" title="" alt="" />';
$second = '<img style="max-width: 220px; max-height: 92px;" src="images/gear/second.png" title="" alt="" />';
$heavyammo = array();
$heavyammoslots = 0;
$smallammo = array();
$usableitems = array();
开发者ID:Reema49,项目名称:dayz,代码行数:31,代码来源:1.php
示例19: print_r
for ($i = 1; $i <= $pages; $i++) {
print_r("page " . $i . "\n");
$cases = XML2Array::createArray($ebay->getCases(200, $i));
$cases = isset($cases["soapenv:Envelope"]["soapenv:Body"]["getUserCasesResponse"]["cases"]["caseSummary"]) ? $cases["soapenv:Envelope"]["soapenv:Body"]["getUserCasesResponse"]["cases"]["caseSummary"] : array();
if (!empty($cases)) {
print_r("cases: " . count($cases) . "\n");
foreach ($cases as $j => $caseShort) {
if (isset($caseShort['user']) && $caseShort['user']['userId'] == "chandlermotorsportsinc" && $caseShort['user']['role'] == "SELLER") {
$sql = "SELECT * FROM cases where caseId = '" . $caseShort['caseId']['id'] . "'";
$rs = $db->Execute($sql);
$row = $rs->FetchRow();
if (isset($row['caseId'])) {
print_r("case: " . $row['caseId'] . " exists" . "\n");
continue;
}
$case = XML2Array::createArray($ebay->getCaseDetails($caseShort['caseId']['id'], $caseShort['caseId']['type']));
$case = isset($case["soapenv:Envelope"]["soapenv:Body"]["getEBPCaseDetailResponse"]) ? $case["soapenv:Envelope"]["soapenv:Body"]["getEBPCaseDetailResponse"] : array();
if (!isset($case['caseSummary']['caseId']['id'])) {
$caseSummary = $caseShort;
$caseDetail = array();
} else {
$caseSummary = $case['caseSummary'];
$caseDetail = isset($case['caseDetail']) ? $case['caseDetail'] : array();
}
$status = isset($caseSummary['status']) ? array_values($caseSummary['status']) : array();
$tmp = array("caseId" => $caseSummary['caseId']['id'], "type" => isset($caseSummary['caseId']['type']) ? $caseSummary['caseId']['type'] : '', "userId" => isset($caseSummary['otherParty']['userId']) ? $caseSummary['otherParty']['userId'] : '', "status" => isset($status[0]) ? $status[0] : '', "itemId" => isset($caseSummary['item']['itemId']) ? $caseSummary['item']['itemId'] : '', "transactionId" => isset($caseSummary['item']['transactionId']) ? $caseSummary['item']['transactionId'] : '', "respondByDate" => isset($caseSummary["respondByDate"]) ? $caseSummary["respondByDate"] : '', "creationDate" => isset($caseSummary["creationDate"]) ? $caseSummary["creationDate"] : '', "lastModifiedDate" => isset($caseSummary["lastModifiedDate"]) ? $caseSummary["lastModifiedDate"] : '', "openReason" => isset($caseDetail["openReason"]) ? $caseDetail["openReason"] : '', "decision" => isset($caseDetail["decision"]) ? $caseDetail["decision"] : '', "agreedRefundAmount" => isset($caseDetail["agreedRefundAmount"]) ? $caseDetail["agreedRefundAmount"] : '', "detailStatus" => isset($caseDetail["detailStatus"]) ? $caseDetail["detailStatus"] : '', "initialBuyerExpectation" => isset($caseDetail["initialBuyerExpectation"]) ? $caseDetail["initialBuyerExpectation"] : '');
$updateSQL = $db->GetInsertSQL($rs, $tmp);
$db->Execute($updateSQL);
}
}
} else {
开发者ID:speedspeed,项目名称:ebayfeedback,代码行数:31,代码来源:cases_store.php
示例20: testNotAllowedGuestAction
public function testNotAllowedGuestAction()
{
$authenticationData = $this->login('st', 'st');
$headers = array('Accept: application/xml', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$response = ApiRestTestHelper::createXmlApiCall($this->serverUrl . '/test.php/accounts/account/api/read/1', 'GET', $headers);
$response = XML2Array::createArray($response);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('Sign in required.', $response['message']);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:9,代码来源:ApiRestXmlAccountTest.php
注:本文中的XML2Array类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论