Fluent::domains PHP Method

domains() public static method

Retrieves any configured domains, assuming the site is running in domain mode.
public static domains ( ) : array
return array List of domains and their respective configuration information
    public static function domains()
    {
        // Only return configured domains if domain_mode is active. This is typically disabled
        // if there are no domains configured, or if testing locally
        if (self::is_domain_mode()) {
            return self::config()->domains;
        } else {
            return array();
        }
    }

Usage Example

 /**
  * Determine if the referrer for this request is from a domain within this website's scope
  *
  * @return boolean
  */
 protected function knownReferrer()
 {
     // Extract referrer
     if (empty($_SERVER['HTTP_REFERER'])) {
         return false;
     }
     $hostname = strtolower(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST));
     // Check if internal traffic
     if ($hostname == strtolower($_SERVER['HTTP_HOST'])) {
         return true;
     }
     // Check configured domains
     $domains = Fluent::domains();
     return isset($domains[$hostname]);
 }
All Usage Examples Of Fluent::domains