$data) { // Skip inline and setting js. if (!$data || $type == 'setting' || $type == 'inline') { continue; } // Search and replace. foreach ($data as $path => $info) { // jquery.js if ($cdn_jquery) { if ( isset($jquery_update_filepath) && ( $path == $jquery_update_filepath . '/jquery.min.js' || $path == $jquery_update_filepath . '/jquery.js' ) ) { $info['preprocess'] = FALSE; $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jquery/' . $jquery_update_version . '/jquery.min.js'] = $info; unset($javascript[$type][$path]); } elseif ($path == $jquery_filepath) { $info['preprocess'] = FALSE; $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jquery/' . $jquery_version . '/jquery.min.js'] = $info; unset($javascript[$type][$path]); } } // Replace all jquery_ui scripts (jquery.ui.*.js) with a single // Google-hosted minified version containing all of them. if ($cdn_jquery_ui) { if ( isset($jquery_ui_path) && isset($jquery_ui_version) && strpos($path, $jquery_ui_path) === 0 ) { $info['preprocess'] = FALSE; $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jqueryui/' . $jquery_ui_version . '/jquery-ui.min.js'] = $info; unset($javascript[$type][$path]); } } // swfobject.js if ($cdn_swfobject) { if ( isset($swfobject_filepath) && $path == $swfobject_filepath ) { $info['preprocess'] = FALSE; $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/swfobject/' . $swfobject_version . '/swfobject.js'] = $info; unset($javascript[$type][$path]); } } } } } /** * Get the path for the jquery-ui.js file. * * @param string $file * filename. */ function advagg_js_cdn_get_jquery_ui_path() { $jquery_ui_path_const = 'JQUERY_UI_PATH'; if (!defined($jquery_ui_path_const)) { if (!function_exists('jquery_ui_get_path')) { return FALSE; } $jquery_ui_path = jquery_ui_get_path(); if ($jquery_ui_path === FALSE) { return FALSE; } } else { $jquery_ui_path = constant($jquery_ui_path_const); } $jquery_ui_path .= '/ui'; return $jquery_ui_path; } /** * Get the path for the jquery.js file. * * @return * path to jquery.js file. */ function advagg_js_cdn_get_jquery_path() { if (function_exists('jquery_update_jquery_path')) { return dirname(jquery_update_jquery_path()); } else { $jquery_update_filepath = drupal_get_path('module', 'jquery_update'); return $jquery_update_filepath . '/replace/'; } }