ElggSite::getDomain PHP Method

getDomain() public method

Get the domain for this site
Since: 1.9
public getDomain ( ) : string
return string
    public function getDomain()
    {
        $breakdown = parse_url($this->url);
        return $breakdown['host'];
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Returns a formatted site emailaddress
  *
  * @param ElggSite $site the site to get the emailaddress from
  *
  * @return string
  */
 protected function getSiteEmailAddress(ElggSite $site)
 {
     $site_from = '';
     if ($site->email) {
         if ($site->name) {
             $site_from = $site->name . " <" . $site->email . ">";
         } else {
             $site_from = $site->email;
         }
     } else {
         // no site email, so make one up
         if ($site->name) {
             $site_from = $site->name . " <noreply@" . $site->getDomain() . ">";
         } else {
             $site_from = "noreply@" . $site->getDomain();
         }
     }
     return $site_from;
 }