Same name and namespace in other branches
  1. 7.x-2.x advagg.module \advagg_get_js_scopes() 1 commentaire

Get all javascript scopes set in the $javascript array.

Paramètres

$javascript: An array with all JavaScript code.

Return value

Array of scopes that are currently being used.

Fichier

./advagg.module, line 391

Code

function advagg_get_js_scopes($javascript) {
    // Return if nothing given to us.
    if (empty($javascript) || !is_array($javascript)) {
        return FALSE;
    }
    // Filter out elements of the given scope.
    $scopes = array();
    foreach ($javascript as $key => $item) {
        // skip if the scope is not set.
        if (!is_array($item) || empty($item['scope'])) {
            continue;
        }
        if (!isset($scopes[$item['scope']])) {
            $scopes[$item['scope']] = TRUE;
        }
    }
    return $scopes;
}