function processItems($items, $dttm, $isCargo = false, $parentFlag = 0) { $totalCost = 0; foreach ($items as $item) { $totalCost += processItem($item, $dttm, $isCargo, $parentFlag); if (@is_array($item['items'])) { $itemContainerFlag = $item['flag']; $totalCost += processItems($item['items'], $dttm, true, $itemContainerFlag); } } return $totalCost; }
print $params->getMessage(); exit; } var_dump($params); } exit; $parser->proxyService = $proxyService; $parser->setProxyData($res); var_dump($parser); exit; // Обработка запросов if ($queries == null) { processItems(); } else { foreach ($queries as $query) { processItems($query); } } function processItems($queryData = null) { global $baseUrl; global $parser; global $params; global $db; if ($queryData != null) { print "Processing: " . $queryData["query"] . "\n"; $parser->queryNum = 0; $parser->queryId = $queryData["id"]; $parser->queryDataId = $queryData["data_id"]; $params["text"] = $queryData["query"]; $url = $baseUrl . "?" . UrlUtils::buildQuery($params);
$output .= $slide['imagetextsubtitle'] != '' ? '<p class="subtitle">' . $slide['imagetextsubtitle'] . '</p>' : ''; $output .= '</h2>'; } } else { // No text. $output .= '<img src="' . $slide['image'] . '" />' . NL; } } if (isset($slide['subtitle']) && $slide['subtitle'] != '') { $output .= '<p class="subtitle">' . $slide['subtitle'] . '</p>' . NL; } if (isset($slide['code']) && $slide['code'] != '') { $output .= '<p class="code">' . $slide['code'] . '</p>' . NL; } // Itearate slide lines of text. $output .= '<ul>' . NL; if (isset($slide['items']) && is_array($slide['items'])) { $output .= processItems($slide['items']); } $output .= '</ul>' . NL; $output .= addDisclaimer(); $output .= '</div>' . NL . NL; $i++; } print $output; ?> </div> </body> </html>
function jsonToXML($json) { $sxe = new SimpleXMLElement('<row></row>'); foreach ($json as $name => $value) { switch ($name) { case 'attackers': $row = $sxe->addChild('rowset'); $row->addAttribute('name', 'attackers'); $row->addAttribute('columns', 'characterID,characterName,corporationID,corporationName,allianceID,allianceName,factionID,factionName,securityStatus,damageDone,finalBlow,weaponTypeID,shipTypeID'); foreach ($value as $n => $v) { $row2 = $row->addChild('row'); foreach ($v as $n => $v) { $row2->addAttribute($n, $v); } } break; case 'items': $row = $sxe->addChild('rowset'); $row->addAttribute('name', 'items'); $row->addAttribute('columns', 'typeID,flag,qtyDropped,qtyDestroyed,singleton'); foreach ($value as $n => $v) { $row2 = $row->addChild('row'); processItems($row2, $v); } break; case 'victim': $row = $sxe->addChild('victim'); foreach ($value as $n => $v) { $row->addAttribute($n, $v); } break; case 'v': break; default: $sxe->addAttribute($name, $value); break; } } return html_entity_decode($sxe->asXml(), ENT_NOQUOTES, 'UTF-8'); }