public static function from_email()
 {
     $admin_email = get_option('admin_email');
     $sitename = strtolower($_SERVER['SERVER_NAME']);
     if (wpcf7_is_localhost()) {
         return $admin_email;
     }
     if (substr($sitename, 0, 4) == 'www.') {
         $sitename = substr($sitename, 4);
     }
     if (strpbrk($admin_email, '@') == '@' . $sitename) {
         return $admin_email;
     }
     return 'wordpress@' . $sitename;
 }
Beispiel #2
0
function wpcf7_is_email_in_site_domain($email)
{
    if (wpcf7_is_localhost()) {
        return true;
    }
    $site_domain = strtolower($_SERVER['SERVER_NAME']);
    if (preg_match('/^[0-9.]+$/', $site_domain)) {
        // 123.456.789.012
        return true;
    }
    if (wpcf7_is_email_in_domain($email, $site_domain)) {
        return true;
    }
    if (preg_match('%^https?://([^/]+)%', home_url(), $matches)) {
        $site_domain = strtolower($matches[1]);
        if ($site_domain != strtolower($_SERVER['SERVER_NAME']) && wpcf7_is_email_in_domain($email, $site_domain)) {
            return true;
        }
    }
    return false;
}
 public function test_email_in_site_domain($content)
 {
     if (wpcf7_is_localhost()) {
         return true;
     }
     $site_domain = strtolower($_SERVER['SERVER_NAME']);
     if (substr($site_domain, 0, 4) == 'www.') {
         $site_domain = substr($site_domain, 4);
     }
     $content = trim($content);
     if (preg_match('/<(.+)>$/', $content, $matches)) {
         $email = strtolower($matches[1]);
     } else {
         $email = strtolower($content);
     }
     return substr($email, -strlen($site_domain)) == $site_domain;
 }
function wpcf7_is_email_in_site_domain($email)
{
    if (wpcf7_is_localhost()) {
        return true;
    }
    $site_domain = strtolower($_SERVER['SERVER_NAME']);
    if (preg_match('/^[0-9.]+$/', $site_domain)) {
        // 123.456.789.012
        return true;
    }
    if (wpcf7_is_email_in_domain($email, $site_domain)) {
        return true;
    }
    $home_url = home_url();
    // for interoperability with WordPress MU Domain Mapping plugin
    if (is_multisite() && function_exists('domain_mapping_siteurl')) {
        $domain_mapping_siteurl = domain_mapping_siteurl(false);
        if ($domain_mapping_siteurl) {
            $home_url = $domain_mapping_siteurl;
        }
    }
    if (preg_match('%^https?://([^/]+)%', $home_url, $matches)) {
        $site_domain = strtolower($matches[1]);
        if ($site_domain != strtolower($_SERVER['SERVER_NAME']) && wpcf7_is_email_in_domain($email, $site_domain)) {
            return true;
        }
    }
    return false;
}