当前位置: 首页>>代码示例>>PHP>>正文


PHP Stat::GetErrorMessage方法代码示例

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


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

示例1: SubmitStats

 /**
  * Submit display statistics to the server
  * @return bool
  * @param string $serverKey
  * @param string $hardwareKey
  * @param string $statXml
  * @throws SoapFault
  */
 function SubmitStats($serverKey, $hardwareKey, $statXml)
 {
     // Sanitize
     $serverKey = Kit::ValidateParam($serverKey, _STRING);
     $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING);
     $statXml = Kit::ValidateParam($statXml, _HTMLSTRING);
     // Check the serverKey matches
     if ($serverKey != Config::GetSetting('SERVER_KEY')) {
         throw new SoapFault('Sender', 'The Server key you entered does not match with the server key at this address');
     }
     // Make sure we are sticking to our bandwidth limit
     if (!$this->CheckBandwidth()) {
         throw new SoapFault('Receiver', "Bandwidth Limit exceeded");
     }
     // Auth this request...
     if (!$this->AuthDisplay($hardwareKey)) {
         throw new SoapFault('Receiver', "This display client is not licensed");
     }
     if ($this->isAuditing == 1) {
         Debug::Audit('Received XML. ' . $statXml, $this->displayId);
     }
     if ($statXml == "") {
         throw new SoapFault('Receiver', "Stat XML is empty.");
     }
     // Log
     $statObject = new Stat();
     // Load the XML into a DOMDocument
     $document = new DOMDocument("1.0");
     $document->loadXML($statXml);
     foreach ($document->documentElement->childNodes as $node) {
         // Make sure we don't consider any text nodes
         if ($node->nodeType == XML_TEXT_NODE) {
             continue;
         }
         // Each element should have these attributes
         $fromdt = $node->getAttribute('fromdt');
         $todt = $node->getAttribute('todt');
         $type = $node->getAttribute('type');
         if ($fromdt == '' || $todt == '' || $type == '') {
             Debug::Error('Stat submitted without the fromdt, todt or type attributes.', $this->displayId);
             continue;
         }
         $scheduleID = $node->getAttribute('scheduleid');
         $layoutID = $node->getAttribute('layoutid');
         $mediaID = $node->getAttribute('mediaid');
         $tag = $node->getAttribute('tag');
         // Write the stat record with the information we have available to us.
         if (!$statObject->Add($type, $fromdt, $todt, $scheduleID, $this->displayId, $layoutID, $mediaID, $tag)) {
             Debug::Error(sprintf('Stat Add failed with error: %s', $statObject->GetErrorMessage()), $this->displayId);
             continue;
         }
     }
     $this->LogBandwidth($this->displayId, Bandwidth::$SUBMITSTATS, strlen($statXml));
     return true;
 }
开发者ID:rovak73,项目名称:xibo-cms,代码行数:63,代码来源:xmdssoap4.class.php

示例2: SubmitStats

 /**
  * Submit display statistics to the server
  * @return
  * @param $version Object
  * @param $serverKey Object
  * @param $hardwareKey Object
  * @param $statXml Object
  */
 function SubmitStats($version, $serverKey, $hardwareKey, $statXml)
 {
     $db =& $this->db;
     // Sanitize
     $serverKey = Kit::ValidateParam($serverKey, _STRING);
     $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING);
     $version = Kit::ValidateParam($version, _STRING);
     $statXml = Kit::ValidateParam($statXml, _HTMLSTRING);
     // Make sure we are talking the same language
     if (!$this->CheckVersion($version)) {
         throw new SoapFault('Receiver', "Your client is not of the correct version for communication with this server.");
     }
     // Make sure we are sticking to our bandwidth limit
     if (!$this->CheckBandwidth()) {
         throw new SoapFault('Receiver', "Bandwidth Limit exceeded");
     }
     // Auth this request...
     if (!$this->AuthDisplay($hardwareKey)) {
         throw new SoapFault('Receiver', "This display client is not licensed");
     }
     if ($this->isAuditing == 1) {
         Debug::LogEntry("audit", "IN", "xmds", "SubmitStats", "", $this->displayId);
     }
     if ($this->isAuditing == 1) {
         Debug::LogEntry("audit", "StatXml: [" . $statXml . "]", "xmds", "SubmitStats", "", $this->displayId);
     }
     if ($statXml == "") {
         throw new SoapFault('Receiver', "Stat XML is empty.");
     }
     // Log
     if ($this->isAuditing == 1) {
         Debug::LogEntry("audit", "About to create Stat Object.", "xmds", "SubmitStats", "", $this->displayId);
     }
     $statObject = new Stat($db);
     // Log
     if ($this->isAuditing == 1) {
         Debug::LogEntry("audit", "About to Create DOMDocument.", "xmds", "SubmitStats", "", $this->displayId);
     }
     // Load the XML into a DOMDocument
     $document = new DOMDocument("1.0");
     $document->loadXML($statXml);
     foreach ($document->documentElement->childNodes as $node) {
         // Make sure we dont consider any text nodes
         if ($node->nodeType == XML_TEXT_NODE) {
             continue;
         }
         //Zero out the common vars
         $fromdt = '';
         $todt = '';
         $type = '';
         $scheduleID = 0;
         $layoutID = 0;
         $mediaID = '';
         $tag = '';
         // Each element should have these attributes
         $fromdt = $node->getAttribute('fromdt');
         $todt = $node->getAttribute('todt');
         $type = $node->getAttribute('type');
         if ($fromdt == '' || $todt == '' || $type == '') {
             trigger_error('Stat submitted without the fromdt, todt or type attributes.');
             continue;
         }
         $scheduleID = $node->getAttribute('scheduleid');
         $layoutID = $node->getAttribute('layoutid');
         $mediaID = $node->getAttribute('mediaid');
         $tag = $node->getAttribute('tag');
         // Write the stat record with the information we have available to us.
         if (!$statObject->Add($type, $fromdt, $todt, $scheduleID, $this->displayId, $layoutID, $mediaID, $tag)) {
             trigger_error(sprintf('Stat Add failed with error: %s', $statObject->GetErrorMessage()));
             continue;
         }
     }
     if ($this->isAuditing == 1) {
         Debug::LogEntry("audit", "OUT", "xmds", "SubmitStats", "", $this->displayId);
     }
     return true;
 }
开发者ID:abbeet,项目名称:server39,代码行数:85,代码来源:xmdssoap.class.php


注:本文中的Stat::GetErrorMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。