當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。