aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/elgglib.php
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2013-03-30 12:50:30 -0400
committercash <cash.costello@gmail.com>2013-03-30 12:50:30 -0400
commit62ebd8ff12086b6f7aaaba846264e43169ab5c8c (patch)
tree99854637c4f79bd41b91939bcbc556cef2b57bcd /engine/lib/elgglib.php
parentbc2bc90bd5282d08ed87dc374f4135d8182c931b (diff)
downloadelgg-62ebd8ff12086b6f7aaaba846264e43169ab5c8c.tar.gz
elgg-62ebd8ff12086b6f7aaaba846264e43169ab5c8c.tar.bz2
Fixes #4378 prevent loading same library name twice
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r--engine/lib/elgglib.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index a49b620ac..fb652a141 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -93,10 +93,17 @@ function elgg_register_library($name, $location) {
* @return void
* @throws InvalidParameterException
* @since 1.8.0
+ * @todo return boolean in 1.9 to indicate whether the library has been loaded
*/
function elgg_load_library($name) {
global $CONFIG;
+ static $loaded_libraries = array();
+
+ if (in_array($name, $loaded_libraries)) {
+ return;
+ }
+
if (!isset($CONFIG->libraries)) {
$CONFIG->libraries = array();
}
@@ -113,6 +120,8 @@ function elgg_load_library($name) {
);
throw new InvalidParameterException($error);
}
+
+ $loaded_libraries[] = $name;
}
/**