isHttps() public static method

Checks to see if the page is being server over SSL or not
public static isHttps ( boolean $trustProxyHeaders = false ) : boolean
$trustProxyHeaders boolean
return boolean
Exemplo n.º 1
0
 /**
  * Get user avatar by email
  *
  * @param int    $avatarSize
  * @param string $defaultPic
  * @return string
  */
 public function getAvatar($avatarSize = 64, $defaultPic = 'identicon')
 {
     $md5 = md5(trim($this->_email));
     $avatarSize = (int) $avatarSize;
     $defaultPic = trim($defaultPic);
     $validList = array('404', 'mm', 'identicon', 'monsterid', 'wavatar', 'retro', 'blank');
     if (strpos($defaultPic, 'http') === 0) {
         $default = urlencode($defaultPic);
     } elseif (Arr::in((string) $defaultPic, $validList)) {
         $default = $defaultPic;
     } else {
         $default = 'identicon';
     }
     if (Url::isHttps()) {
         $avatarUrl = 'https://secure.gravatar.com/avatar/' . $md5 . '.jpg?s=' . $avatarSize . '&d=' . $default;
     } else {
         $avatarUrl = 'http://www.gravatar.com/avatar/' . $md5 . '.jpg?s=' . $avatarSize . '&d=' . $default;
     }
     return $avatarUrl;
 }