Пример #1
0
 protected function _ping($method, $parameters)
 {
     list($this->_requestSource, $this->_requestTarget) = $parameters;
     $fault = null;
     // is the source argument really an url?
     if (!$fault && !Pingback_Utility::isURL($this->_requestSource)) {
         $fault = self::RESPONSE_FAULT_SOURCE;
     }
     // is the target argument really an url?
     if (!$fault && !Pingback_Utility::isURL($this->_requestTarget)) {
         $fault = self::RESPONSE_FAULT_TARGET;
     }
     // is the target url pingback enabled?
     if (!$fault && !Pingback_Utility::isPingbackEnabled($this->_requestTarget)) {
         $fault = self::RESPONSE_FAULT_TARGET_INVALID;
     }
     // is the source backlinking to the target?
     if (!$fault && !Pingback_Utility::isBacklinking($this->_requestSource, $this->_requestTarget)) {
         $fault = self::RESPONSE_FAULT_SOURCE_LINK;
     }
     if ($fault !== null) {
         $this->setFault($fault);
         return $this->getFaultAsArray($fault);
     } else {
         $this->setSuccess();
         return $this->getSuccessAsArray();
     }
 }