Skip to content

Commit

Permalink
Merge pull request #183 from grangeway/17377
Browse files Browse the repository at this point in the history
Fix: 0017377: Reduce unneeded global Variables: g_libraries_included
  • Loading branch information
grangeway committed May 29, 2014
2 parents 35ad2b5 + 44285cf commit d233c9d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions core.php
Expand Up @@ -106,18 +106,15 @@ function require_api( $p_api_name ) {
}
}

# Remember (globally) which library files have already been loaded
$g_libraries_included = array();

/**
* Define an API inclusion function to replace require_once
*
* @param string $p_library_name lib file name
*/
function require_lib( $p_library_name ) {
global $g_libraries_included;
static $s_libraries_included;
global $g_library_path;
if ( !isset( $g_libraries_included[$p_library_name] ) ) {
if ( !isset( $s_libraries_included[$p_library_name] ) ) {
$t_existing_globals = get_defined_vars();

$t_library_file_path = $g_library_path . $p_library_name;
Expand All @@ -132,7 +129,7 @@ function require_lib( $p_library_name ) {
global $$t_global_name;
}
extract( $t_new_globals );
$g_libraries_included[$p_library_name] = 1;
$s_libraries_included[$p_library_name] = 1;
}
}

Expand Down

0 comments on commit d233c9d

Please sign in to comment.