Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created January 4, 2012 15:55
Show Gist options
  • Save jeremyboggs/1560662 to your computer and use it in GitHub Desktop.
Save jeremyboggs/1560662 to your computer and use it in GitHub Desktop.
Code to check whether an instance of Omeka is using internal JavaScript libraries, instead of using libraries from a CDN. Useful if you'd like your plugin to do the same thing.
<?php
/**
* Function to return whether to use local or external JavaScript libraries in
* Omeka. Useful if you'd like your plugin or theme to honor this setting.
*
* Checks presence of, and value for, useInternalJavascripts in
* application/config/config.ini. If it is not set, returns false. Otherwise,
* returns boolean value for the setting.
*
* @return boolean
*/
function omeka_use_internal_js() {
// Get Omeka's config file, at application/config/config.ini
$config = Omeka_Context::getInstance()->getConfig('basic');
// Set a flag based on config's theme.useInternalJavascripts.
$useInternalJs = isset($config->theme->useInternalJavascripts)
? (bool) $config->theme->useInternalJavascripts
: false;
return $useInternalJs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment