16 require_once( dirname( __FILE__ ).
'/include/php/settings.php' );
18 require_once( dirname( __FILE__ ).
'/include/php/core_utilities.php' );
20 require_once( dirname( __FILE__ ).
'/include/php/package_manipulation.php' );
26 require_once( dirname( __FILE__ ).
'/include/php/package_paths.php' );
28 require_once( dirname( __FILE__ ).
'/include/php/package_version.php' );
65 if( isset( $FullClassNameCache[
"$Name.$Version.$ROOT_DIR" ] ) )
67 return( $FullClassNameCache[
"$Name.$Version.$ROOT_DIR" ] );
70 $TopVersion = explode(
'::' , $Version );
71 $TopVersion = array_pop( $TopVersion );
75 $PackageClassName = str_replace(
'.' ,
'_' , $Name.
'_'.$RealPackageVersion );
78 $FullClassNameCacheChanged =
true;
80 return( $FullClassNameCache[
"$Name.$Version.$ROOT_DIR" ] = $PackageClassName );
118 if( isset( $TopPackageNameCache[ $PackageName ] ) )
120 return( $TopPackageNameCache[ $PackageName ] );
123 $TopPackageName = explode(
'::' , $PackageName );
126 $TopPackageNameCacheChanged =
true;
128 return( $TopPackageNameCache[ $PackageName ] = array_pop( $TopPackageName ) );
130 catch( Exception $e )
150 return( $RequestedClassName );
188 $ObjectLabel = $theObjectLabel;
190 catch( Exception $e )
196 require_once( dirname( __FILE__ ).
'/include/php/rewrites.php' );
233 $PackageName , $PackageRealVersion , __FILE__
240 catch( Exception $e )
284 $PackageDirectory =
_get_package_path( $PackageName , $PackageVersion , $RootDirectory );
287 $PackageClassName =
'unexisting_class';
290 if( file_exists( $PackageDirectory.
'/'.$TopPackageName.
'.php' ) )
297 array( $PackageDirectory.
'/'.$TopPackageName.
'.php' , $Exists , $PackageClassName , $TopPackageName )
300 catch( Exception $e )
337 $Key =
"$PackageName $PackageVersion $ObjectLabel";
342 $PackageName , $PackageVersion , $PackageScriptPath
346 $RPackageName , $RPackageVersion , $PackageScriptPath
349 $PackagePathsCache[ $Key ] = array(
350 'path' => $ScriptPath ,
'exists' => $Exists ,
351 'class_name' => $PackageClassName ,
'top_package_name' => $TopPackageName
354 catch( Exception $e )
391 $Key =
"$PackageName $PackageVersion $ObjectLabel";
394 if( isset( $PackagePathsCache[ $Key ] ) )
return;
399 $PackagePathsCacheChanged =
true;
401 catch( Exception $e )
442 $Key =
"$PackageName $PackageVersion $ObjectLabel";
445 if( isset( $PackagePathsCache[ $Key ] ) )
448 if( isset( $PackageCache[ $PackagePathsCache[ $Key ][
'path' ] ] ) )
451 $RequestedClassName = $PackagePathsCache[ $Key ][
'class_name' ];
453 return( array(
true , $PackageCache[ $PackagePathsCache[ $Key ][
'path' ] ] ) );
457 return( array(
false ,
false ) );
459 catch( Exception $e )
497 $Key =
"$PackageName $PackageVersion $ObjectLabel";
500 $PackageInfo = $PackagePathsCache[ $Key ];
502 if( $PackageInfo[
'exists' ] )
504 require_once( $PackageInfo[
'path' ] );
508 return(
_get_full_class_name( $PackageInfo[
'top_package_name' ] , $PackageVersion , $RootDirectory ) );
512 return(
'unexisting_class' );
515 catch( Exception $e )
552 $PackageDirectory =
_get_package_path( $PackageName , $PackageVersion , $RootDirectory );
555 return( $PackageDirectory );
557 catch( Exception $e )
590 if( isset( $PackageCache[ $Key ] ) ===
false )
593 $RequestedClassName =
false;
594 $PackageCache[ $Key ] =
false;
595 if( class_exists( $PackageClassName ) )
597 $PackageCache[ $Key ] =
new $PackageClassName();
598 $RequestedClassName = $PackageClassName;
602 catch( Exception $e )
638 if( isset( $PackagePathsCache[ $Key ] ) )
640 $PackageInfo = $PackagePathsCache[ $Key ];
641 if( isset( $PackageCache[ $PackageInfo[
'path' ] ] ) ===
false )
643 $PackageCache[ $PackageInfo[
'path' ] ] = $PackageCache[ $Key ];
648 throw(
new Exception(
"The path for key $Key does not exist" ) );
651 catch( Exception $e )
686 $LoadedPackagesPaths [
"$PackageName.$PackageVersion" ] = array(
687 'directory' => $PackageDirectory ,
'package_name' => $PackageName ,
'package_version' => $PackageVersion
690 catch( Exception $e )
730 catch( Exception $e )
732 $Args = func_get_args();
737 require_once( dirname( __FILE__ ).
'/include/php/core_cache.php' );
738 require_once( dirname( __FILE__ ).
'/include/php/functional_programming.php' );
739 require_once( dirname( __FILE__ ).
'/include/php/array_functions.php' );
740 require_once( dirname( __FILE__ ).
'/include/php/core_public_api.php' );