コード例 #1
0
ファイル: xmlcreator.php プロジェクト: ASDAFF/bxApiDocs
 public function getXML()
 {
     if (!$this->tag) {
         return "";
     }
     $xml = "<" . CDataXML::xmlspecialchars($this->tag) . $this->_getAttributs() . ">";
     $xml .= $this->startCDATA;
     $xml .= $this->data;
     $xml .= $this->endCDATA;
     $xml .= $this->_getChildren();
     $xml .= "</" . CDataXML::xmlspecialchars($this->tag) . ">";
     return $xml;
 }
コード例 #2
0
ファイル: xml.php プロジェクト: k-kalashnikov/geekcon_new
 function &__toString()
 {
     switch ($this->name) {
         case "cdata-section":
             $ret = "<![CDATA[";
             $ret .= $this->content;
             $ret .= "]]>";
             break;
         default:
             $isOneLiner = false;
             if (count($this->children) == 0 && $this->content == '') {
                 $isOneLiner = true;
             }
             $attrStr = "";
             if (is_array($this->attributes)) {
                 foreach ($this->attributes as $attr) {
                     $attrStr .= " " . $attr->name . "=\"" . CDataXML::xmlspecialchars($attr->content) . "\" ";
                 }
             }
             if ($isOneLiner) {
                 $oneLinerEnd = " /";
             } else {
                 $oneLinerEnd = "";
             }
             $ret = "<" . $this->name . $attrStr . $oneLinerEnd . ">";
             if (is_array($this->children)) {
                 foreach ($this->children as $child) {
                     $ret .= $child->__toString();
                 }
             }
             if (!$isOneLiner) {
                 if ($this->content != '') {
                     $ret .= CDataXML::xmlspecialchars($this->content);
                 }
                 $ret .= "</" . $this->name . ">";
             }
             break;
     }
     return $ret;
 }
コード例 #3
0
ファイル: client.php プロジェクト: Satariall/izurit
 public function UpdateListItems($listName, $arChanges)
 {
     $arMethodParams = array('listName' => $listName);
     $updates = CXMLCreator::createTagAttributed('Batch OnError="Continue" DateInUtc="TRUE" Properties="TRUE"');
     $i = 0;
     foreach ($arChanges as $row) {
         $obRow = CXMLCreator::createTagAttributed('Method ID="' . $i++ . '"');
         if ($ID = intval($row['ID'])) {
             $obRow->setAttribute('Cmd', 'Update');
         } else {
             $obRow->setAttribute('Cmd', 'New');
             unset($row['ID']);
             $obRow->addChild(CXMLCreator::createTagAttributed('Field Name="ID"', 'New'));
             $obRow->addChild(CXMLCreator::createTagAttributed('Field Name="MetaInfo" Property="ReplicationID"', $row['ReplicationID']));
             unset($row['ReplicationID']);
         }
         foreach ($row as $fld => $value) {
             if (substr($fld, 0, 9) == 'MetaInfo_') {
                 $obRow->addChild(CXMLCreator::createTagAttributed('Field Name="MetaInfo" Property="' . CDataXML::xmlspecialchars(substr($fld, 9)) . '"', $value));
             } else {
                 if ($fld) {
                     $obRow->addChild(CXMLCreator::createTagAttributed('Field Name="' . CDataXML::xmlspecialchars($fld) . '"', $value));
                 }
             }
         }
         $updates->addChild($obRow);
     }
     $arMethodParams['updates'] = $updates;
     $RESULT = false;
     if ($this->__initialize() && $this->Call('UpdateListItems', $arMethodParams) && ($DOM = $this->RESPONSE->DOMDocument)) {
         $RESULT = array();
         $arResults = $DOM->elementsByName('Result');
         foreach ($arResults as $resultNode) {
             $arRes = array('ErrorCode' => $resultNode->children[0]->textContent(), 'Row' => $this->ConvertRows($resultNode));
             if ($arRes['Row']) {
                 $arRes['Row'] = $arRes['Row'][0];
             }
             $RESULT[] = $arRes;
         }
     }
     $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/sp_client5.log', 'a');
     fwrite($fp, $this->getRawRequest());
     fwrite($fp, $this->getRawResponse());
     fwrite($fp, "\n==========================================\n\n");
     fclose($fp);
     return $RESULT;
 }