コード例 #1
0
ファイル: XmlRpcTest.php プロジェクト: MajideB/np-gravatar
 public function testSettingXmlRpcClientSetsUriOfItsHttpClient()
 {
     $this->_gravatarXmlRpc->setXmlRpcClient(new Zend_XmlRpc_Client('http://foo'));
     $uri = $this->_gravatarXmlRpc->getXmlRpcClient()->getHttpClient()->getUri();
     $this->assertContains($uri->getHost(), NP_Service_Gravatar_XmlRpc::SECURE_XMLRPC_SERVER);
     $this->assertEquals('user=' . NP_Service_Gravatar_Utility::emailHash($this->_gravatarXmlRpc->getEmail()), $uri->getQuery());
 }
コード例 #2
0
ファイル: Profile.php プロジェクト: MajideB/np-gravatar
 /**
  * Sets $_thumbnailUrl.
  *
  * @param string|Zend_Uri_Http $thumbnailUrl
  * @return NP_Service_Gravatar_Profiles_Profile
  */
 public function setThumbnailUrl($thumbnailUrl)
 {
     $this->_thumbnailUrl = NP_Service_Gravatar_Utility::normalizeUri($thumbnailUrl);
     return $this;
 }
コード例 #3
0
ファイル: Background.php プロジェクト: MajideB/np-gravatar
 /**
  * Sets $_url.
  *
  * @param string|Zend_Uri_Http $url
  * @return NP_Service_Gravatar_Profiles_Profile_Background
  */
 public function setUrl($url)
 {
     $this->_url = NP_Service_Gravatar_Utility::normalizeUri($url);
     return $this;
 }
コード例 #4
0
ファイル: Url.php プロジェクト: MajideB/np-gravatar
 /**
  * Sets $_value.
  *
  * @param string|Zend_Uri_Http $value
  * @return NP_Service_Gravatar_Profiles_Profile_Url
  */
 public function setValue($value)
 {
     $this->_value = NP_Service_Gravatar_Utility::normalizeUri($value);
     return $this;
 }
コード例 #5
0
ファイル: Photo.php プロジェクト: MajideB/np-gravatar
 /**
  * Defined by NP_Service_Gravatar_Profiles_Profile_TypeValue.
  * 
  * Sets $_value.
  *
  * @param string|Zend_Uri_Http $value
  * @return NP_Service_Gravatar_Profiles_Profile_Photo
  */
 public function setValue($value)
 {
     //Making sure that $_value is Zend_Uri_Http instance.
     $this->_value = NP_Service_Gravatar_Utility::normalizeUri($value);
     return $this;
 }
コード例 #6
0
ファイル: XmlRpc.php プロジェクト: MajideB/np-gravatar
 /**
  * Generates and returns server uri to be used by
  * $_xmlRpcClient.
  * 
  * @return string
  */
 protected function _getServerUri()
 {
     require_once 'NP/Service/Gravatar/Utility.php';
     return self::SECURE_XMLRPC_SERVER . '?user=' . NP_Service_Gravatar_Utility::emailHash($this->getEmail());
 }
コード例 #7
0
ファイル: Email.php プロジェクト: MajideB/np-gravatar
 /**
  * Sets $_primary.
  *
  * @param string|bool $primary
  * @return NP_Service_Gravatar_Profiles_Profile_Email
  */
 public function setPrimary($primary)
 {
     $this->_primary = NP_Service_Gravatar_Utility::normalizeBool($primary);
     return $this;
 }
コード例 #8
0
ファイル: Profiles.php プロジェクト: MajideB/np-gravatar
 /**
  * Gets profile info of some Gravatar's user, based on his/her
  * email address. Return value is NP_Gravatar_Profile instance,
  * in case $_responseFormat implements
  * NP_Service_Gravatar_Profiles_ResponseFormat_ParserInterface
  * interface. Otherwise, or in case $rawResponse flag is set to
  * boolean true, Zend_Http_Response instance is returned.
  *
  * @param string $email
  * @param bool $rawResponse Whether raw response object should be returned.
  * @return NP_Gravatar_Profile|Zend_Http_Response
  */
 public function getProfileInfo($email, $rawResponse = false)
 {
     $email = strtolower(trim((string) $email));
     $hash = NP_Service_Gravatar_Utility::emailHash($email);
     $response = $this->getHttpClient()->setMethod(Zend_Http_Client::GET)->setUri(self::GRAVATAR_SERVER . '/' . $hash . '.' . $this->_responseFormat)->request();
     $reflected = new ReflectionObject($this->_responseFormat);
     if ($reflected->implementsInterface('NP_Service_Gravatar_Profiles_ResponseFormat_ParserInterface') && !$rawResponse) {
         return $this->_responseFormat->profileFromHttpResponse($response);
     } else {
         return $response;
     }
 }
コード例 #9
0
ファイル: Account.php プロジェクト: MajideB/np-gravatar
 /**
  * Sets $_verified.
  *
  * @param string|bool $verified
  * @return NP_Service_Gravatar_Profiles_Profile_Account
  */
 public function setVerified($verified)
 {
     $this->_verified = NP_Service_Gravatar_Utility::normalizeBool($verified);
     return $this;
 }