libs)){
return;
}
else {
$this->libs[] = $lib;
if ($cdn == 'google'){
$this->loadGoogleApi();
$this->addJSContent('google.load("'.$lib. '","' . $ver . '");');
}
else {
throw new MWException("unsupported content distribution network (CDN): '$cdn'."
." Valid CDN list: " . implode(", ",$this->cdn_list) . ".");
}
}
}
function loadGoogleApi(){
global $wgGoogleApiKey,$wgOut;
if ($this->google_api_loaded == true){
return;
}
if ($wgGoogleApiKey == ''){
throw new MWException("please get Google API Key and set it with "
."\$wgGoogleApiKey variable in LocalSettings.php file");
}
$wgOut->addScript(''."\n");
$this->google_api_loaded = true;
}
function addJSContent($content){
global $wgOut;
$wgOut->addScript(''. "\n");
}
function addScript($url){
global $wgOut;
if (in_array($url,$this->scripts)){
return;
}
else {
$this->scripts[] = $url;
$wgOut->addScript(''."\n");
}
}
function addCSS($url){
global $wgOut;
if (in_array($url,$this->styles)){
return;
}
else {
$this->styles[] = $url;
$wgOut->addScript(''."\n");
}
}
}
global $wgHeader;
$wgHeader = new HeaderScriptInjector();
global $wgGoogleApiKey;
$wgGoogleApiKey = '';
?>