Created
January 4, 2012 15:55
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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