From: cash Date: Sat, 30 Mar 2013 16:50:30 +0000 (-0400) Subject: Fixes #4378 prevent loading same library name twice X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=62ebd8ff12086b6f7aaaba846264e43169ab5c8c;p=lorea%2Felgg.git Fixes #4378 prevent loading same library name twice --- 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; } /**