Verifies that the external CSS file is from a domain we allow for inlining.

Parameters

string $url: The full URL of the css file.

array $aggregate_settings: Array of settings.

Return value

bool TRUE if the URL can be inlined.

2 calls to advagg_relocate_check_domain_of_font_url()
advagg_relocate_css_alter in advagg_relocate/advagg_relocate.module
Implements hook_css_alter().
_advagg_relocate_callback in advagg_relocate/advagg_relocate.advagg.inc
Gets external CSS files and puts the contents of it in the aggregate.

File

advagg_relocate/advagg_relocate.module, line 1302

Code

function advagg_relocate_check_domain_of_font_url($url, array $aggregate_settings) {
    // Bail if the host or path and query string are empty.
    $parse = @parse_url($url);
    if (empty($parse) || empty($parse['host']) || empty($parse['path']) && empty($parse['query'])) {
        return FALSE;
    }
    // Bail if the host doesn't match one of the listed domains.
    if (!isset($aggregate_settings['variables']['advagg_relocate_css_font_domains'])) {
        $aggregate_settings['variables']['advagg_relocate_css_font_domains'] = variable_get('advagg_relocate_css_font_domains', ADVAGG_RELOCATE_CSS_FONT_DOMAINS);
    }
    if (strpos($aggregate_settings['variables']['advagg_relocate_css_font_domains'], $parse['host']) === FALSE) {
        return FALSE;
    }
    return TRUE;
}