• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CDataXML类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CDataXML的典型用法代码示例。如果您正苦于以下问题:PHP CDataXML类的具体用法?PHP CDataXML怎么用?PHP CDataXML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CDataXML类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getData

 public function getData()
 {
     $xml_str = file_get_contents($this->file);
     $xml = new \CDataXML();
     $xml->LoadString($xml_str);
     $arXml = $xml->GetArray();
     unset($xml_str);
     return $this->toTmp($arXml);
 }
开发者ID:HannibalLecktor,项目名称:alfa74,代码行数:9,代码来源:parsexml.php


示例2: GetBoardFromSite

 function GetBoardFromSite($queryParameters)
 {
     global $APPLICATION;
     $result = array();
     $ob = new CHTTP();
     $ob->http_timeout = 60;
     $ob->Query("GET", "old.vnukovo.ru", 80, "/rus/for-passengers/board1/data.wbp?" . $queryParameters . '&ts=' . mktime(), false, "", "N");
     $result["ERROR"]["CODE"] = $ob->errno;
     $result["ERROR"]["MESSAGE"] = $ob->errstr;
     if (!intval($result["ERROR"]["CODE"])) {
         $res = $APPLICATION->ConvertCharset($ob->result, "UTF-8", SITE_CHARSET);
         //trace($res);
         $xml = new CDataXML();
         if ($xml->LoadString($res) && ($node = $xml->SelectNodes("/responce/rows"))) {
             $rows = $node->elementsByName("row");
             $akNames = array();
             $akCodes = array();
             $departures = array();
             $arrivals = array();
             $terminals = array();
             foreach ($rows as $row) {
                 $cells = $row->elementsByName("cell");
                 // Определяем код авиакомпании и номер рейса
                 preg_match_all("/([A-Za-zА-Яа-я0-9]{2})[\\s]*([0-9]+)/", $cells[0]->content, $flightNumber, PREG_PATTERN_ORDER);
                 $result["FLIGHTS"][] = array("FLIGHT" => array("AK_CODE" => $flightNumber[1][0], "NUMBER" => $flightNumber[2][0]), "AK_NAME" => htmlspecialcharsEx($cells[1]->content), "DEPARTURE" => htmlspecialcharsEx($cells[2]->content), "ARRIVAL" => htmlspecialcharsEx($cells[3]->content), "STATUS" => CAirportBoard::GetStatusInfo($cells[4]->content), "TIME" => array("PLANNED" => CAirportBoard::GetDateTimeArray($cells[5]->content), "ESTIMATED" => CAirportBoard::GetDateTimeArray($cells[6]->content), "ACTUAL" => CAirportBoard::GetDateTimeArray($cells[7]->content)), "TERMINAL" => htmlspecialcharsEx($cells[8]->content));
                 // Формируем список уникальных авиакомпаний, терминалов и пунктов вылета и прилета для фильтра
                 if (!in_array(htmlspecialcharsEx($cells[1]->content), $akNames)) {
                     $akNames[] = htmlspecialcharsEx($cells[1]->content);
                 }
                 if (!in_array($flightNumber[1][0], $akCodes)) {
                     $akCodes[] = $flightNumber[1][0];
                 }
                 if (!in_array(htmlspecialcharsEx($cells[2]->content), $departures)) {
                     $departures[] = htmlspecialcharsEx($cells[2]->content);
                 }
                 if (!in_array(htmlspecialcharsEx($cells[3]->content), $arrivals)) {
                     $arrivals[] = htmlspecialcharsEx($cells[3]->content);
                 }
                 if (!in_array(htmlspecialcharsEx($cells[8]->content), $terminals)) {
                     $terminals[] = htmlspecialcharsEx($cells[8]->content);
                 }
             }
             sort($akNames);
             sort($akCodes);
             sort($departures);
             sort($arrivals);
             sort($terminals);
             $result["AK_NAMES"] = $akNames;
             $result["AK_CODES"] = $akCodes;
             $result["DEPARTURES"] = $departures;
             $result["ARRIVALS"] = $arrivals;
             $result["TERMINALS"] = $terminals;
         }
     }
     return $result;
 }
开发者ID:slavaskazochnik,项目名称:vnukovo-transagency,代码行数:56,代码来源:vko.php


示例3: action

 /**
  * Returns action response XML
  *
  * @param string $action
  * @return CDataXML
  * @throws CBitrixCloudException
  */
 protected function action($action)
 {
     /* @var CMain $APPLICATION */
     global $APPLICATION;
     $url = $this->getActionURL(array("action" => $action, "debug" => $this->debug ? "y" : "n"));
     $this->server = new CHTTP();
     if ($this->timeout > 0) {
         $this->server->http_timeout = $this->timeout;
     }
     $strXML = $this->server->Get($url);
     if ($strXML === false) {
         $e = $APPLICATION->GetException();
         if (is_object($e)) {
             throw new CBitrixCloudException($e->GetString(), "");
         } else {
             throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => "-1")), "");
         }
     }
     if ($this->server->status != 200) {
         throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => (string) $this->server->status)), "");
     }
     $obXML = new CDataXML();
     if (!$obXML->LoadString($strXML)) {
         throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_XML_PARSE", array("#CODE#" => "1")), "");
     }
     $node = $obXML->SelectNodes("/error/code");
     if (is_object($node)) {
         $error_code = $node->textContent();
         $message_id = "BCL_CDN_WS_" . $error_code;
         /*
         GetMessage("BCL_CDN_WS_LICENSE_EXPIRE");
         GetMessage("BCL_CDN_WS_LICENSE_NOT_FOUND");
         GetMessage("BCL_CDN_WS_QUOTA_EXCEEDED");
         GetMessage("BCL_CDN_WS_CMS_LICENSE_NOT_FOUND");
         GetMessage("BCL_CDN_WS_DOMAIN_NOT_REACHABLE");
         GetMessage("BCL_CDN_WS_LICENSE_DEMO");
         GetMessage("BCL_CDN_WS_LICENSE_NOT_ACTIVE");
         GetMessage("BCL_CDN_WS_NOT_POWERED_BY_BITRIX_CMS");
         GetMessage("BCL_CDN_WS_WRONG_DOMAIN_SPECIFIED");
         */
         $debug_content = "";
         $node = $obXML->SelectNodes("/error/debug");
         if (is_object($node)) {
             $debug_content = $node->textContent();
         }
         if (HasMessage($message_id)) {
             throw new CBitrixCloudException(GetMessage($message_id), $error_code, $debug_content);
         } else {
             throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => $error_code)), $error_code, $debug_content);
         }
     }
     return $obXML;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:60,代码来源:webservice.php


示例4: Request

 function Request($server, $page, $port, $params, $uri = false)
 {
     if ($uri && strlen($uri) > 0) {
         $strURI = $uri;
     } else {
         $strURI = "http://" . $server . (strlen($port) > 0 && intval($port) > 0 ? ":" . intval($port) : "") . (strlen($page) ? $page : "/") . (strlen($params) > 0 ? "?" . $params : "");
     }
     $http = new \Bitrix\Main\Web\HttpClient(array("version" => "1.0", "socketTimeout" => 30, "streamTimeout" => 30, "redirect" => true, "redirectMax" => 5));
     $strData = $http->get($strURI);
     $errors = $http->getError();
     $arRSSResult = array();
     if (!$strData && !empty($errors)) {
         $strError = "";
         foreach ($errors as $errorCode => $errMes) {
             $strError .= $errorCode . ": " . $errMes;
         }
         \CEventLog::Add(array("SEVERITY" => "ERROR", "AUDIT_TYPE_ID" => "XDIMPORT_HTTP", "MODULE_ID" => "xdimport", "ITEM_ID" => "RSS_REQUEST", "DESCRIPTION" => $strError));
     }
     if ($strData) {
         $rss_charset = "windows-1251";
         if (preg_match("/<" . "\\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\\?" . ">/i", $strData, $matches)) {
             $rss_charset = Trim($matches[1]);
         }
         $strData = preg_replace("/<" . "\\?XML.*?\\?" . ">/i", "", $strData);
         $strData = $GLOBALS["APPLICATION"]->ConvertCharset($strData, $rss_charset, SITE_CHARSET);
     }
     if (strlen($strData) > 0) {
         require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/xml.php";
         $objXML = new CDataXML();
         $res = $objXML->LoadString($strData);
         if ($res !== false) {
             $ar = $objXML->GetArray();
             if (is_array($ar) && isset($ar["rss"]) && is_array($ar["rss"]) && isset($ar["rss"]["#"]) && is_array($ar["rss"]["#"]) && isset($ar["rss"]["#"]["channel"]) && is_array($ar["rss"]["#"]["channel"]) && isset($ar["rss"]["#"]["channel"][0]) && is_array($ar["rss"]["#"]["channel"][0]) && isset($ar["rss"]["#"]["channel"][0]["#"])) {
                 $arRSSResult = $ar["rss"]["#"]["channel"][0]["#"];
             } else {
                 $arRSSResult = array();
             }
             $arRSSResult["rss_charset"] = strtolower(SITE_CHARSET);
         }
     }
     if (is_array($arRSSResult) && !empty($arRSSResult)) {
         $arRSSResult = CXDILFSchemeRSS::FormatArray($arRSSResult);
         if (!empty($arRSSResult) && array_key_exists("item", $arRSSResult) && is_array($arRSSResult["item"]) && !empty($arRSSResult["item"])) {
             $arRSSResult["item"] = array_reverse($arRSSResult["item"]);
         }
     }
     return $arRSSResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:48,代码来源:lf_scheme_rss.php


示例5: AddFlightsToResult

 function AddFlightsToResult($html, $result, $terminal)
 {
     $res = '<table>' . $html . '</table>';
     $res = str_replace("&nbsp;", " ", $res);
     $res = str_replace("<br>", " ", $res);
     $res = preg_replace("/<!--.*-->/Uis", "", $res);
     $res = preg_replace("/<colgroup>.*<\\/colgroup>/Uis", "", $res);
     $res = preg_replace("/<param[^>]*>/Uis", "", $res);
     $res = preg_replace("/<a[^>]*>[^<]+<\\/a>/Uis", "", $res);
     //trace($res);
     $xml = new CDataXML();
     if ($xml->LoadString($res)) {
         $node = $xml->SelectNodes("/table");
         $rows = $node->elementsByName("tr");
         $i = 0;
         foreach ($rows as $row) {
             //trace($row->getAttribute("class"));
             if (!strstr($row->getAttribute("class"), "onlineDetailTr")) {
                 $cells = $row->elementsByName("td");
                 if (count($cells) && preg_match("/([A-Za-zА-Яа-я0-9]{2})\\s*([0-9]+)\\s*/", $cells[0]->content)) {
                     // Определяем код авиакомпании и номер рейса
                     preg_match_all("/([A-Za-zА-Яа-я0-9]{2})\\s*([0-9]+)\\s*/", $cells[0]->content, $flightNumber, PREG_PATTERN_ORDER);
                     $result["FLIGHTS"][$i] = array("FLIGHT" => array("AK_CODE" => $flightNumber[1][0], "NUMBER" => $flightNumber[2][0]), "AK_NAME" => htmlspecialcharsEx($cells[5]->content), "DEPARTURE" => htmlspecialcharsEx($cells[1]->content), "ARRIVAL" => htmlspecialcharsEx($cells[1]->content), "STATUS" => CAirportBoard::GetStatusInfo($cells[4]->content), "TIME" => array("PLANNED" => CAirportBoard::GetDateTimeArray($cells[2]->content), "ESTIMATED" => "", "ACTUAL" => CAirportBoard::GetDateTimeArray($cells[3]->content)), "TERMINAL" => $terminal);
                     // Формируем список уникальных терминалов и пунктов вылета и прилета для фильтра
                     if (!in_array($flightNumber[1][0], $result["AK_CODES"])) {
                         $result["AK_CODES"][] = $flightNumber[1][0];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["AK_NAME"], $result["AK_NAMES"]) && strlen($result["FLIGHTS"][$i]["AK_NAME"])) {
                         $result["AK_NAMES"][] = $result["FLIGHTS"][$i]["AK_NAME"];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["DEPARTURE"], $result["DEPARTURES"])) {
                         $result["DEPARTURES"][] = $result["FLIGHTS"][$i]["DEPARTURE"];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["ARRIVAL"], $result["ARRIVALS"])) {
                         $result["ARRIVALS"][] = $result["FLIGHTS"][$i]["ARRIVAL"];
                     }
                     if (!in_array($result["FLIGHTS"][$i]["TERMINAL"], $result["TERMINALS"])) {
                         $result["TERMINALS"][] = $result["FLIGHTS"][$i]["TERMINAL"];
                     }
                     $i++;
                 }
             }
         }
     }
     unset($html, $xml, $res);
     return $result;
 }
开发者ID:slavaskazochnik,项目名称:vnukovo-transagency,代码行数:47,代码来源:led.php


示例6: createTagAttributed

 function createTagAttributed($heavyTag, $value = null)
 {
     $heavyTag = trim($heavyTag);
     $name = $heavyTag;
     $attrs = 0;
     $attrsPos = strpos($heavyTag, " ");
     if ($attrsPos) {
         $name = substr($heavyTag, 0, $attrsPos);
         $attrs = strstr(trim($heavyTag), " ");
     }
     if (!trim($name)) {
         return false;
     }
     $nameSplited = explode(":", $name);
     if ($nameSplited) {
         $name = $nameSplited[count($nameSplited) - 1];
     }
     $name = CDataXML::xmlspecialcharsback($name);
     $node = new CXMLCreator($name);
     if ($attrs and strlen($attrs)) {
         $attrsSplit = explode("\"", $attrs);
         $i = 0;
         while ($validi = strpos(trim($attrsSplit[$i]), "=")) {
             $attrsSplit[$i] = trim($attrsSplit[$i]);
             // attr:ns=
             $attrName = CDataXML::xmlspecialcharsback(substr($attrsSplit[$i], 0, $validi));
             // attrs:ns
             $attrValue = CDataXML::xmlspecialcharsback($attrsSplit[$i + 1]);
             $node->setAttribute($attrName, $attrValue);
             $i = $i + 2;
         }
     }
     if (null !== $value) {
         $node->setData($value);
     }
     return $node;
 }
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:37,代码来源:xmlcreator.php


示例7: HttpClient

     case 'RUB':
     case 'RUR':
         $url = 'http://www.cbr.ru/scripts/XML_daily.asp?date_req=' . $DB->FormatDate($date, CLang::GetDateFormat('SHORT', LANGUAGE_ID), 'D.M.Y');
         break;
 }
 $http = new HttpClient();
 $data = $http->get($url);
 $charset = 'windows-1251';
 $matches = array();
 if (preg_match("/<" . "\\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\\?" . ">/i", $data, $matches)) {
     $charset = trim($matches[1]);
 }
 $data = preg_replace("#<!DOCTYPE[^>]+?>#i", '', $data);
 $data = preg_replace("#<" . "\\?XML[^>]+?\\?" . ">#i", '', $data);
 $data = $APPLICATION->ConvertCharset($data, $charset, SITE_CHARSET);
 $objXML = new CDataXML();
 $res = $objXML->LoadString($data);
 if ($res !== false) {
     $data = $objXML->GetArray();
 } else {
     $data = false;
 }
 switch ($baseCurrency) {
     case 'UAH':
         if (is_array($data) && count($data["exchange"]["#"]['currency']) > 0) {
             $currencyList = $data['exchange']['#']['currency'];
             foreach ($currencyList as &$currencyRate) {
                 if ($currencyRate['#']['cc'][0]['#'] == $currency) {
                     $result['STATUS'] = 'OK';
                     $result['RATE_CNT'] = 1;
                     $result['RATE'] = (double) str_replace(",", ".", $currencyRate['#']['rate'][0]['#']);
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:get_rate.php


示例8: SendRequest

 function SendRequest($access_key, $secret_key, $verb, $bucket, $file_name = '/', $params = '', $content = '', $additional_headers = array())
 {
     global $APPLICATION;
     $this->status = 0;
     if (isset($additional_headers["Content-Type"])) {
         $ContentType = $additional_headers["Content-Type"];
         unset($additional_headers["Content-Type"]);
     } else {
         $ContentType = $content ? 'text/plain' : '';
     }
     if (!array_key_exists("x-goog-api-version", $additional_headers)) {
         $additional_headers["x-goog-api-version"] = "1";
     }
     $RequestMethod = $verb;
     $RequestURI = $file_name;
     $RequestDATE = gmdate('D, d M Y H:i:s', time()) . ' GMT';
     //Prepare Signature
     $CanonicalizedAmzHeaders = "";
     ksort($additional_headers);
     foreach ($additional_headers as $key => $value) {
         if (preg_match("/^x-goog-/", $key)) {
             $CanonicalizedAmzHeaders .= $key . ":" . $value . "\n";
         }
     }
     $CanonicalizedResource = "/" . $bucket . $RequestURI;
     $StringToSign = "{$RequestMethod}\n\n{$ContentType}\n{$RequestDATE}\n{$CanonicalizedAmzHeaders}{$CanonicalizedResource}";
     //$utf = $APPLICATION->ConvertCharset($StringToSign, LANG_CHARSET, "UTF-8");
     $Signature = base64_encode($this->hmacsha1($StringToSign, $secret_key));
     $Authorization = "GOOG1 " . $access_key . ":" . $Signature;
     $obRequest = new CHTTP();
     $obRequest->additional_headers["Date"] = $RequestDATE;
     $obRequest->additional_headers["Authorization"] = $Authorization;
     foreach ($additional_headers as $key => $value) {
         if (!preg_match("/^option-/", $key)) {
             $obRequest->additional_headers[$key] = $value;
         }
     }
     if ($this->new_end_point && preg_match('#^(http|https)://' . preg_quote($bucket, '#') . '(.+)/#', $this->new_end_point, $match)) {
         $host = $match[2];
     } else {
         $host = $bucket . ".commondatastorage.googleapis.com";
     }
     $was_end_point = $this->new_end_point;
     $this->new_end_point = '';
     $obRequest->Query($RequestMethod, $host, 80, $RequestURI . $params, $content, '', $ContentType);
     $this->status = $obRequest->status;
     $this->headers = $obRequest->headers;
     $this->errno = $obRequest->errno;
     $this->errstr = $obRequest->errstr;
     $this->result = $obRequest->result;
     if ($obRequest->status == 200) {
         if (isset($additional_headers["option-raw-result"])) {
             return $obRequest->result;
         } elseif ($obRequest->result) {
             $obXML = new CDataXML();
             $text = preg_replace("/<" . "\\?XML.*?\\?" . ">/i", "", $obRequest->result);
             if ($obXML->LoadString($text)) {
                 $arXML = $obXML->GetArray();
                 if (is_array($arXML)) {
                     return $arXML;
                 }
             }
             //XML parse error
             $APPLICATION->ThrowException(GetMessage('CLO_STORAGE_GOOGLE_XML_PARSE_ERROR', array('#errno#' => 1)));
             return false;
         } else {
             //Empty success result
             return array();
         }
     } elseif ($obRequest->status == 307 && isset($obRequest->headers["Location"]) && !$was_end_point) {
         $this->new_end_point = $obRequest->headers["Location"];
         return $this->SendRequest($access_key, $secret_key, $verb, $bucket, $file_name, $params, $content, $additional_headers);
     } elseif ($obRequest->status > 0) {
         if ($obRequest->result) {
             $obXML = new CDataXML();
             if ($obXML->LoadString($obRequest->result)) {
                 $arXML = $obXML->GetArray();
                 if (is_array($arXML) && is_string($arXML["Error"]["#"]["Message"][0]["#"])) {
                     $APPLICATION->ThrowException(GetMessage('CLO_STORAGE_GOOGLE_XML_ERROR', array('#errmsg#' => trim($arXML["Error"]["#"]["Message"][0]["#"], '.'))));
                     return false;
                 }
             }
         }
         $APPLICATION->ThrowException(GetMessage('CLO_STORAGE_GOOGLE_XML_PARSE_ERROR', array('#errno#' => 2)));
         return false;
     } else {
         $APPLICATION->ThrowException(GetMessage('CLO_STORAGE_GOOGLE_XML_PARSE_ERROR', array('#errno#' => 3)));
         return false;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:90,代码来源:storage_service_google.php


示例9: GetCurrentUserFriends

 public function GetCurrentUserFriends($limit, &$next)
 {
     if ($this->access_token === false) {
         return false;
     }
     $http = new HttpClient();
     $http->setHeader('GData-Version', '3.0');
     $http->setHeader('Authorization', 'Bearer ' . $this->access_token);
     $url = static::FRIENDS_URL . '?';
     $limit = intval($limit);
     $next = intval($next);
     if ($limit > 0) {
         $url .= '&max-results=' . $limit;
     }
     if ($next > 0) {
         $url .= '&start-index=' . $next;
     }
     $result = $http->get($url);
     if (!defined("BX_UTF")) {
         $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
     }
     if ($http->getStatus() == 200) {
         $obXml = new \CDataXML();
         if ($obXml->loadString($result)) {
             $tree = $obXml->getTree();
             $total = $tree->elementsByName("totalResults");
             $total = intval($total[0]->textContent());
             $limitNode = $tree->elementsByName("itemsPerPage");
             $next += intval($limitNode[0]->textContent());
             if ($next >= $total) {
                 $next = '__finish__';
             }
             $arFriends = array();
             $arEntries = $tree->elementsByName('entry');
             foreach ($arEntries as $entry) {
                 $arEntry = array();
                 $entryChildren = $entry->children();
                 foreach ($entryChildren as $child) {
                     $tag = $child->name();
                     switch ($tag) {
                         case 'category':
                         case 'updated':
                         case 'edited':
                             break;
                         case 'name':
                             $arEntry[$tag] = array();
                             foreach ($child->children() as $subChild) {
                                 $arEntry[$tag][$subChild->name()] = $subChild->textContent();
                             }
                             break;
                         case 'email':
                             if ($child->getAttribute('primary') == 'true') {
                                 $arEntry[$tag] = $child->getAttribute('address');
                             }
                             break;
                         default:
                             $tagContent = $tag == 'link' ? $child->getAttribute('href') : $child->textContent();
                             if ($child->getAttribute('rel')) {
                                 if (!isset($arEntry[$tag])) {
                                     $arEntry[$tag] = array();
                                 }
                                 $arEntry[$tag][preg_replace("/^[^#]*#/", "", $child->getAttribute('rel'))] = $tagContent;
                             } elseif (isset($arEntry[$tag])) {
                                 if (!is_array($arEntry[$tag][0]) || !isset($arEntry[$tag][0])) {
                                     $arEntry[$tag] = array($arEntry[$tag], $tagContent);
                                 } else {
                                     $arEntry[$tag][] = $tagContent;
                                 }
                             } else {
                                 $arEntry[$tag] = $tagContent;
                             }
                     }
                 }
                 if ($arEntry['email']) {
                     $arFriends[] = $arEntry;
                 }
             }
             return $arFriends;
         }
     }
     return false;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:82,代码来源:google.php


示例10: fopen

{
	require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/classes/general/xml.php");
	$bIncorrectFormat = false;
	$handle = fopen($abs_path, "r");
	$size = filesize($abs_path);

	if ($size > 20)
	{
		$contents = fread($handle, 20);
		if (strtolower(substr($contents, 0, 5)) != "<?xml")
			$bIncorrectFormat = true;
	}

	if (!$bIncorrectFormat)
	{
		$objXML = new CDataXML();
		$objXML->Load($abs_path);
		$arTree = $objXML->GetTree();
		$arTracks = Array();
		$bIncorrectFormat = true;

		$ch = $arTree->children;
		if (count($ch) > 0 && strtolower($ch[0]->name) == 'playlist')
		{
			$pl = $ch[0];
			$tls = $pl->children;
			for ($i_ = 0, $l_ = count($tls); $i_ < $l_; $i_++)
			{
				if (strtolower($tls[$i_]->name) != 'tracklist')
					continue;
				$tracks = $tls[$i_]->children;
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:player_playlist_edit.php


示例11: UpdateListItems


//.........这里部分代码省略.........
				$arData['Description'] = trim($arData['Description']);

				$arData['Location'] = trim($arData['Location']);

				if (isset($arData['EventDate']))
				{
					$arData['EventDate'] = $this->__makeTS($arData['EventDate']);
					$arData['EndDate'] = $this->__makeTS($arData['EndDate']) + ($arData['fAllDayEvent'] ? -86340 : 0);
					$TZBias = intval(date('Z', $arData['EventDate']));
				}

				$arData['EventType'] = intval($arData['EventType']);

				if ($arData['EventType'] == 2)
					$arData['EventType'] = 0;

				if ($arData['EventType'] > 2 /* || ($arData['EventType'] == 1 && !$arData['RecurrenceData'])*/)
					return new CSoapFault(
						'Unsupported event type',
						'Event type unsupported'
					);

				$arData['fRecurrence'] = intval($arData['fRecurrence']);
				$arData['RRULE'] = '';

				$id = $arData['_command'] == 'New' ? 0 : intVal($arData['ID']);
				if ($arData['RecurrenceData'])
				{
					//$xmlstr = $arData['XMLTZone'];
					//$arData['XMLTZone'] = new CDataXML();
					//$arData['XMLTZone']->LoadString($xmlstr);

					$xmlstr = $arData['RecurrenceData'];
					$obRecurData = new CDataXML();
					$obRecurData->LoadString($xmlstr);

/*
<recurrence>
		<rule>
			<firstDayOfWeek>mo</firstDayOfWeek>
			<repeat>
				<weekly mo='TRUE' tu='TRUE' th='TRUE' sa='TRUE' weekFrequency='1' />
			</repeat>
			<repeatForever>FALSE</repeatForever>
		</rule>
</recurrence>
<deleteExceptions>true</deleteExceptions>
*/

					$obRecurRule = $obRecurData->tree->children[0]->children[0];
					$obRecurRepeat = $obRecurRule->children[1];
					$obNode = $obRecurRepeat->children[0];

					$arData['RRULE'] = array();
					switch($obNode->name)
					{
						case 'daily':
							// hack. we have no "work days" daily recurence
							if ($obNode->getAttribute('weekday') == 'TRUE')
							{
								$arData['RRULE']['FREQ'] = 'WEEKLY';
								$arData['RRULE']['BYDAY'] = 'MO,TU,WE,TH,FR';
								$arData['RRULE']['INTERVAL'] = 1;
							}
							else
							{
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:webservice.php


示例12: query

 private static function query($query, $data)
 {
     $http = new \Bitrix\Main\Web\HttpClient();
     $response = $http->post($query, $data);
     $xml = new CDataXML();
     $xml->loadString($response);
     return $xml;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:8,代码来源:yandex.php


示例13: GetBoardFromSite

 function GetBoardFromSite($queryParameters)
 {
     global $APPLICATION;
     $result = array();
     $ob = new CHTTP();
     $ob->http_timeout = 60;
     $ob->Query("GET", "www.rossiya-airlines.com", 80, "/ru/passenger/about_flight/" . $queryParameters . '?ts=' . mktime(), false, "", "N");
     $result["ERROR"]["CODE"] = $ob->errno;
     $result["ERROR"]["MESSAGE"] = $ob->errstr;
     if (intval($result["ERROR"]["CODE"]) == 0) {
         $res = $ob->result;
         $res = str_replace('<table border="0" cellpadding="0" cellspacing="0" class="table" id="tblData">', "++++<table>", $res);
         $res = str_replace('$(document).ready(function()', "++++", $res);
         $explode = explode("++++", $res);
         $res = $explode[1];
         $res = substr($res, 0, strlen($res) - 22);
         $res = str_replace("<br>", " ", $res);
         $res = str_replace("<nobr>", "", $res);
         $res = str_replace("</nobr>", "", $res);
         //trace($res);
         $xml = new CDataXML();
         if ($xml->LoadString($res)) {
             $node = $xml->SelectNodes("/table");
             $rows = $node->elementsByName("tr");
             $akNames = array();
             $akCodes = array();
             $departures = array();
             $arrivals = array();
             $terminals = array();
             foreach ($rows as $row) {
                 if (strstr($row->getAttribute("class"), "finddata")) {
                     $cells = $row->elementsByName("td");
                     $flightNumber = $cells[0]->elementsByName("div");
                     // Определяем код авиакомпании и номер рейса
                     preg_match_all("/([A-Za-zА-Яа-я0-9]{2})([0-9]+)/", $flightNumber[0]->content, $flightNumber, PREG_PATTERN_ORDER);
                     $terminal = $cells[1]->elementsByName("div");
                     $city = $cells[2]->elementsByName("div");
                     $plannedTime = $cells[3]->elementsByName("div");
                     $actualTime = $cells[4]->elementsByName("div");
                     $status = $cells[5]->elementsByName("span");
                     $result["FLIGHTS"][] = array("FLIGHT" => array("AK_CODE" => $flightNumber[1][0], "NUMBER" => $flightNumber[2][0]), "AK_NAME" => "", "DEPARTURE" => htmlspecialcharsEx($city[0]->content), "ARRIVAL" => htmlspecialcharsEx($city[0]->content), "STATUS" => CAirportBoard::GetStatusInfo($status[0]->content), "TIME" => array("PLANNED" => CAirportBoard::GetDateTimeArray($plannedTime[0]->content), "ESTIMATED" => "", "ACTUAL" => CAirportBoard::GetDateTimeArray($actualTime[0]->content)), "TERMINAL" => htmlspecialchars($terminal[0]->content));
                     // Формируем список уникальных терминалов и пунктов вылета и прилета для фильтра
                     if (!in_array($flightNumber[1][0], $akCodes)) {
                         $akCodes[] = $flightNumber[1][0];
                     }
                     if (!in_array(htmlspecialcharsEx($city[0]->content), $departures)) {
                         $departures[] = htmlspecialcharsEx($city[0]->content);
                     }
                     if (!in_array(htmlspecialcharsEx($city[0]->content), $arrivals)) {
                         $arrivals[] = htmlspecialcharsEx($city[0]->content);
                     }
                     if (!in_array(htmlspecialcharsEx($terminal[0]->content), $terminals)) {
                         $terminals[] = htmlspecialcharsEx($terminal[0]->content);
                     }
                 }
             }
             sort($akNames);
             sort($akCodes);
             sort($departures);
             sort($arrivals);
             sort($terminals);
             $result["AK"] = $akNames;
             $result["AK_CODES"] = $akCodes;
             $result["DEPARTURES"] = $departures;
             $result["ARRIVALS"] = $arrivals;
             $result["TERMINALS"] = $terminals;
         }
     }
     //trace($result);
     return $result;
 }
开发者ID:slavaskazochnik,项目名称:vnukovo-transagency,代码行数:71,代码来源:fv.php


示例14: GetNewsEx

	function GetNewsEx($SITE, $PORT, $PATH, $QUERY_STR, $bOutChannel = False)
	{
		global $APPLICATION;

		$cacheKey = md5($SITE.$PORT.$PATH.$QUERY_STR);

		$bValid = False;
		$bUpdate = False;
		if ($db_res_arr = CIBlockRSS::GetCache($cacheKey))
		{
			$bUpdate = True;
			if (strlen($db_res_arr["CACHE"])>0)
			{
				if ($db_res_arr["VALID"]=="Y")
				{
					$bValid = True;
					$text = $db_res_arr["CACHE"];
				}
			}
		}

		if (!$bValid)
		{
			$FP = fsockopen($SITE, $PORT, $errno, $errstr, 120);

			if ($FP)
			{
				$strVars = $QUERY_STR;
				$strRequest = "GET ".$PATH.(strlen($strVars) > 0? "?".$strVars: "")." HTTP/1.0\r\n";
				$strRequest.= "User-Agent: BitrixSMRSS\r\n";
				$strRequest.= "Accept: */*\r\n";
				$strRequest.= "Host: $SITE\r\n";
				$strRequest.= "Accept-Language: en\r\n";
				$strRequest.= "\r\n";
				fputs($FP, $strRequest);

				$headers = "";
				while(!feof($FP))
				{
					$line = fgets($FP, 4096);
					if($line == "\r\n")
						break;
					$headers .= $line;
				}

				$text = "";
				while(!feof($FP))
					$text .= fread($FP, 4096);

				$rss_charset = "windows-1251";
				if (preg_match("/<"."\?XML[^>]{1,}encoding=[\"']([^>\"']{1,})[\"'][^>]{0,}\?".">/i", $text, $matches))
				{
					$rss_charset = Trim($matches[1]);
				}
				elseif($headers)
				{
					if(preg_match("#^Content-Type:.*?charset=([a-zA-Z0-9-]+)#m", $headers, $match))
						$rss_charset = $match[1];
				}

				$text = preg_replace("/<!DOCTYPE.*?>/i", "", $text);
				$text = preg_replace("/<"."\\?XML.*?\\?".">/i", "", $text);
				$text = $APPLICATION->ConvertCharset($text, $rss_charset, SITE_CHARSET);

				fclose($FP);
			}
			else
			{
				$text = "";
			}
		}

		if (strlen($text) > 0)
		{
			require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/xml.php");
			$objXML = new CDataXML();
			$res = $objXML->LoadString($text);
			if($res !== false)
			{
				$ar = $objXML->GetArray();
				//$ar = xmlize_rss($text1);

				if (!$bOutChannel)
				{
					$arRes = $ar["rss"]["#"]["channel"][0]["#"];
				}
				else
				{
					$arRes = $ar["rss"]["#"];
				}

				$arRes["rss_charset"] = strtolower(SITE_CHARSET);

				if (!$bValid)
				{
					$ttl = (strlen($arRes["ttl"][0]["#"]) > 0)? IntVal($arRes["ttl"][0]["#"]): 60;
					CIBlockRSS::UpdateCache($cacheKey, $text, array("minutes" => $ttl), $bUpdate);
				}
			}
			return $arRes;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:101,代码来源:iblockrss.php


示例15: decodeStream

 function decodeStream($request, $stream)
 {
     global $APPLICATION;
     $stream_cutted = $this->stripHTTPHeader($stream);
     if (!$stream_cutted or !class_exists("CDataXML")) {
         $APPLICATION->ThrowException("Error: BitrixXMLParser. " . "Downloaded page: <br>" . htmlspecialcharsEx($stream));
         return;
     }
     $stream = $stream_cutted;
     $xml = new CDataXML();
     $stream = $APPLICATION->ConvertCharset($stream, "UTF-8", SITE_CHARSET);
     if (!$xml->LoadString($stream)) {
         $APPLICATION->ThrowException("Error: Can't parse request xml data. ");
         return;
     }
     $dom = $xml->GetTree();
     $this->DOMDocument = $dom;
     if (get_class($dom) == "CDataXMLDocument" || get_class($dom) == "cdataxmldocument") {
         // check for fault
         $response = $dom->elementsByName('Fault');
         if (count($response) == 1) {
             $this->IsFault = 1;
             $faultStringArray = $dom->elementsByName("faultstring");
             $this->FaultString = $faultStringArray[0]->textContent();
             $faultCodeArray = $dom->elementsByName("faultcode");
             $this->FaultCode = $faultCodeArray[0]->textContent();
             return;
         }
         // get the response
         $body = $dom->elementsByName("Body");
         $body = $body[0];
         $response = $body->children();
         $response = $response[0];
         if (get_class($response) == "CDataXMLNode" || get_class($response) == "cdataxmlnode") {
             /*Cut from the SOAP spec:
             				The method response is viewed as a single struct containing an accessor
             				for the return value and each [out] or [in/out] parameter.
             				The first accessor is the return value followed by the parameters
             				in the same order as in the method signature.
             
             				Each parameter accessor has a name corresponding to the name
             				of the parameter and type corresponding to the type of the parameter.
             				The name of the return value accessor is not significant.
             				Likewise, the name of the struct is not significant.
             				However, a convention is to name it after the method name
             				with the string "Response" appended.
             				*/
             $responseAccessors = $response->children();
             //echo '<pre>'; print_r($responseAccessors); echo '</pre>';
             if (count($responseAccessors) > 0) {
                 $this->Value = array();
                 foreach ($responseAccessors as $arChild) {
                     $value = $arChild->decodeDataTypes();
                     $this->Value = array_merge($this->Value, $value);
                 }
             }
         } else {
             $APPLICATION->ThrowException("Could not understand type of class decoded");
         }
     } else {
         $APPLICATION->ThrowException("Could not process XML in response");
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:63,代码来源:soapresponse.php


示例16: ProcessRequest

 function ProcessRequest()
 {
     global $HTTP_SERVER_VARS, $APPLICATION;
     if ($HTTP_SERVER_VARS["REQUEST_METHOD"] != "POST" or !class_exists("CDataXML")) {
         $this->ShowSOAPFault("Error: this web page does only understand POST methods. BitrixXMLParser. ");
     }
     for ($i = 0; $i < count($this->OnRequestEvent); $i++) {
         $this->OnRequestEvent[$i]->OnBeforeRequest($this);
     }
     //AddMessage2Log($this->RawPostData);
     $xmlData = $this->stripHTTPHeader($this->RawPostData);
     $xmlData = $APPLICATION->ConvertCharset($xmlData, "UTF-8", SITE_CHARSET);
     $xml = new CDataXML();
     //AddMessage2Log($xmlData);
     if (!$xml->LoadString($xmlData)) {
         $this->ShowSOAPFault("Error: Can't parse request xml data. ");
     }
     $dom = $xml->GetTree();
     // Check for non-parsing XML, to avoid call to non-object error.
     if (!is_object($dom)) {
         $this->ShowSOAPFault("Bad XML");
     }
     // add namespace fetching on body
     // get the SOAP body
     $body = $dom->elementsByName("Body");
     $children = $body[0]->children();
     if (count($children) == 1) {
         $requestNode = $children[0];
         $requestParsed = false;
         // get target namespace for request
         // it often function request message. in wsdl gen. = function+"request"
         $functionName = $requestNode->name();
         $namespaceURI = $requestNode->namespaceURI();
         for ($i = 0; $i < count($this->OnRequestEvent); $i++) {
             if ($this->OnRequestEvent[$i]->ProcessRequestBody($this, $requestNode)) {
                 $requestParsed = true;
                 break;
             }
         }
         for ($i = 0; $i < count($this->OnRequestEvent); $i++) {
             $this->OnRequestEvent[$i]->OnAfterResponse($this);
         }
         if (!$requestParsed) {
             $this->ShowSOAPFault('Unknown operation requested.');
         }
         return $requestParsed;
     } else {
         $this->ShowSOAPFault('"Body" element in the request has wrong number of children');
     }
     return false;
 }
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:51,代码来源:soapserver.php


示例17: substr


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CDatabase类代码示例发布时间:2022-05-23
下一篇:
PHP CDataColumn类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap