ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

Functions | Variables
core.php File Reference

Go to the source code of this file.

## Functions
| _get_full_class_name ($Name, $Version, $ROOT_DIR)
| _get_top_package_name ($PackageName)
| _get_requested_class_name ()
| _set_object_label ($theObjectLabel)
| _get_package_path_ex ($PackageName, $PackageRealVersion)
| _get_load_script_data ($PackageName, $PackageVersion, $PackageScriptPath)
| _fill_package_paths_data ($PackageName, $PackageVersion, $PackageScriptPath)
| _fill_package_paths_cache ($PackageName, $PackageVersion, $PackageScriptPath)
| _try_fetch_from_cache ($PackageName, $PackageVersion)
| _package_script_fast_load ($PackageName, $PackageVersion)
| _get_package_directory ($PackageName, $PackageVersion)
| _fill_package_cache ($PackageClassName, $Key)
| _store_package_object ($PackageClassName, $Key)
| _store_package_path ($PackageName, $PackageVersion)
| _get_package_relative_path_ex ($PackageName, $PackageVersion)

## Variables
| $PackageCache = array()
| $RequestedClassName = ''
| $TopPackageNameCacheChanged = false
| $TopPackageNameCache = array()
| $ObjectLabel = 'default'
| $PackagePathsCacheChanged = false
| $PackagePathsCache = array()

## Function Documentation

_fill_package_cache | ( |  | $PackageClassName,
|  |  | $Key
| ) |  |

Filling package cache.

Parameters

  $PackageClassName | - Class name.
  $Key | - Cache key.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 585 of file core.php.

{
try
{
global $PackageCache;
if( isset( $PackageCache[ $Key ] ) === false )
{
global $RequestedClassName;
$RequestedClassName = false;
$PackageCache[ $Key ] = false;
if( class_exists( $PackageClassName ) )
{
$PackageCache[ $Key ] = new $PackageClassName();
$RequestedClassName = $PackageClassName;
}
}
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_fill_package_paths_cache | ( |  | $PackageName,
|  |  | $PackageVersion,
|  |  | $PackageScriptPath
| ) |  |

Additing information about package in the cache.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version.
  $PackageScriptPath | - Path to the package's script.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 386 of file core.php.

{
try
{
global $ObjectLabel;
$Key = "$PackageName $PackageVersion $ObjectLabel";
global $PackagePathsCache;
if( isset( $PackagePathsCache[ $Key ] ) )return;
_fill_package_paths_data( $PackageName , $PackageVersion , $PackageScriptPath );
global $PackagePathsCacheChanged;
$PackagePathsCacheChanged = true;
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_fill_package_paths_data | ( |  | $PackageName,
|  |  | $PackageVersion,
|  |  | $PackageScriptPath
| ) |  |

Additing information about package in the cache.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version.
  $PackageScriptPath | - Path to the package's script.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 332 of file core.php.

{
try
{
global $ObjectLabel;
$Key = "$PackageName $PackageVersion $ObjectLabel";
global $PackagePathsCache;
list( $RPackageName , $RPackageVersion ) = _get_package_info_after_rewrites(
$PackageName , $PackageVersion , $PackageScriptPath
);
list( $ScriptPath , $Exists , $PackageClassName , $TopPackageName ) = _get_load_script_data(
$RPackageName , $RPackageVersion , $PackageScriptPath
);
$PackagePathsCache[ $Key ] = array(
'path' => $ScriptPath , 'exists' => $Exists ,
'class_name' => $PackageClassName , 'top_package_name' => $TopPackageName
);
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_get_full_class_name | ( |  | $Name,
|  |  | $Version,
|  |  | $ROOT_DIR
| ) |  |

Function returns class name for the specified package.

Parameters

  $Name | - Short name of the class.
  $Version | - Version of the package.
  $ROOT_DIR | - Name of the root directory. In this directory all package processing will be run.

Returns
  Name of the class for the specified packkage.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 60 of file core.php.

{
try
{
global $FullClassNameCache;
if( isset( $FullClassNameCache[ "$Name.$Version.$ROOT_DIR" ] ) )
{
return( $FullClassNameCache[ "$Name.$Version.$ROOT_DIR" ] );
}
$TopVersion = explode( '::' , $Version );
$TopVersion = array_pop( $TopVersion );
$RealPackageVersion = _get_package_real_version( $Name , $TopVersion , $ROOT_DIR );
$PackageClassName = str_replace( '.' , '_' , $Name.'_'.$RealPackageVersion );
global $FullClassNameCacheChanged;
$FullClassNameCacheChanged = true;
return( $FullClassNameCache[ "$Name.$Version.$ROOT_DIR" ] = $PackageClassName );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_get_load_script_data | ( |  | $PackageName,
|  |  | $PackageVersion,
|  |  | $PackageScriptPath
| ) |  |

Getting data about loading script.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version.
  $PackageScriptPath | - Path to the package's script.

Returns
  Information about script.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 279 of file core.php.

{
try
{
$RootDirectory = _get_root_dir( $PackageName , $PackageVersion , INSTALL_DIR );
$PackageDirectory = _get_package_path( $PackageName , $PackageVersion , $RootDirectory );
$TopPackageName = _get_top_package_name( $PackageName );
$PackageClassName = 'unexisting_class';
$Exists = false;
if( file_exists( $PackageDirectory.'/'.$TopPackageName.'.php' ) )
{
$PackageClassName = _get_full_class_name( $TopPackageName , $PackageVersion , $RootDirectory );
$Exists = true;
}
return(
array( $PackageDirectory.'/'.$TopPackageName.'.php' , $Exists , $PackageClassName , $TopPackageName )
);
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_get_package_directory | ( |  | $PackageName,
|  |  | $PackageVersion
| ) |  |

Getting package loading paths.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version.

Returns
  Package path.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 547 of file core.php.

{
try
{
$RootDirectory = _get_root_dir( $PackageName , $PackageVersion , INSTALL_DIR );
$PackageDirectory = _get_package_path( $PackageName , $PackageVersion , $RootDirectory );
$TopPackageName = _get_top_package_name( $PackageName );
return( $PackageDirectory );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_get_package_path_ex | ( |  | $PackageName,
|  |  | $PackageRealVersion
| ) |  |

Function returns real path to the requested package directory.

Parameters

  $PackageName | - Package name before rewriting.
  $PackageRealVersion | - Package's real version.

Returns
  Real path to the requested package.

Note
  Real path to the requested package after all rewrites were applied.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 228 of file core.php.

{
try
{
list( $PackageName , $PackageRealVersion ) = _get_package_info_after_rewrites(
$PackageName , $PackageRealVersion , __FILE__
);
$ROOT_DIR = _get_root_dir( $PackageName , $PackageRealVersion , INSTALL_DIR );
return( _get_package_path( $PackageName , $PackageRealVersion , $ROOT_DIR ) );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_get_package_relative_path_ex | ( |  | $PackageName,
|  |  | $PackageVersion
| ) |  |

Function provides information about package's installation path.

Parameters

  $PackageName | - Package name.
  $PackageVersion | - Package version.

Returns
  Relative path from installation directory to the file $File.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 722 of file core.php.

{
try
{
return(
_get_package_relative_path( _get_package_path_ex( $PackageName , $PackageVersion ).'/unexisting_file' )
);
}
catch( Exception $e )
{
$Args = func_get_args();
_throw_exception_object( __FUNCTION__ , $Args , $e );
}
}

_get_requested_class_name | ( |  | ) |

Function returns real name of the requested class.

Author
  Dodonov A.A.

Definition at line 146 of file core.php.

{
global $RequestedClassName;
return( $RequestedClassName );
}

_get_top_package_name | ( |  | $PackageName | ) |

Function returns full package name by it's full package name.

Parameters

  $PackageName | - Full package path.

Returns
  Full package name by it's full package name.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 113 of file core.php.

{
try
{
global $TopPackageNameCache;
if( isset( $TopPackageNameCache[ $PackageName ] ) )
{
return( $TopPackageNameCache[ $PackageName ] );
}
$TopPackageName = explode( '::' , $PackageName );
global $TopPackageNameCacheChanged;
$TopPackageNameCacheChanged = true;
return( $TopPackageNameCache[ $PackageName ] = array_pop( $TopPackageName ) );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_package_script_fast_load | ( |  | $PackageName,
|  |  | $PackageVersion
| ) |  |

Loading script.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version.

Returns
  Package class name.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 491 of file core.php.

{
try
{
/* на этом этапе мы уже знаем где лежит пакет $PackageName.$PackageVersion */
global $ObjectLabel;
$Key = "$PackageName $PackageVersion $ObjectLabel";
global $PackagePathsCache;
$PackageInfo = $PackagePathsCache[ $Key ];
if( $PackageInfo[ 'exists' ] )
{
require_once( $PackageInfo[ 'path' ] );
$RootDirectory = _get_root_dir( $PackageName , $PackageVersion , INSTALL_DIR );
return( _get_full_class_name( $PackageInfo[ 'top_package_name' ] , $PackageVersion , $RootDirectory ) );
}
else
{
return( 'unexisting_class' );
}
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_set_object_label | ( |  | $theObjectLabel | ) |

Function sets the label of the .

Parameters

  $theObjectLabel | - Label of the object.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 183 of file core.php.

{
try
{
global $ObjectLabel;
$ObjectLabel = $theObjectLabel;
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_store_package_object | ( |  | $PackageClassName,
|  |  | $Key
| ) |  |

Getting package loading paths.

Parameters

  $PackageClassName | - Class name.
  $Key | - Cache key.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 630 of file core.php.

{
try
{
_fill_package_cache( $PackageClassName , $Key );
global $PackageCache;
global $PackagePathsCache;
if( isset( $PackagePathsCache[ $Key ] ) )
{
$PackageInfo = $PackagePathsCache[ $Key ];
if( isset( $PackageCache[ $PackageInfo[ 'path' ] ] ) === false )
{
$PackageCache[ $PackageInfo[ 'path' ] ] = $PackageCache[ $Key ];
}
}
else
{
throw( new Exception( "The path for key $Key does not exist" ) );
}
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_store_package_path | ( |  | $PackageName,
|  |  | $PackageVersion
| ) |  |

Saving package path.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 679 of file core.php.

{
try
{
$PackageDirectory = _get_package_directory( $PackageName , $PackageVersion );
global $LoadedPackagesPaths;
$LoadedPackagesPaths [ "$PackageName.$PackageVersion" ] = array(
'directory' => $PackageDirectory , 'package_name' => $PackageName , 'package_version' => $PackageVersion
);
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

_try_fetch_from_cache | ( |  | $PackageName,
|  |  | $PackageVersion
| ) |  |

Fetching package from cache.

Parameters

  $PackageName | - Name of the package.
  $PackageVersion | - Package's version.
  $PackageScriptPath | - Path to the package's script.

Returns
  Information about package.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 437 of file core.php.

{
try
{
global $ObjectLabel;
$Key = "$PackageName $PackageVersion $ObjectLabel";
global $PackagePathsCache;
if( isset( $PackagePathsCache[ $Key ] ) )
{
global $PackageCache;
if( isset( $PackageCache[ $PackagePathsCache[ $Key ][ 'path' ] ] ) )
{
global $RequestedClassName;
$RequestedClassName = $PackagePathsCache[ $Key ][ 'class_name' ];
return( array( true , $PackageCache[ $PackagePathsCache[ $Key ][ 'path' ] ] ) );
}
}
return( array( false , false ) );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

## Variable Documentation

$ObjectLabel = 'default'

Label of the cached object.

Author
  Dodonov A.A.

Definition at line 163 of file core.php.

$PackageCache = array()

Definition at line 22 of file core.php.

$PackagePathsCache = array()

Definition at line 247 of file core.php.

$PackagePathsCacheChanged = false

Definition at line 246 of file core.php.

$RequestedClassName = ''

Definition at line 24 of file core.php.

$TopPackageNameCache = array()

Definition at line 89 of file core.php.

$TopPackageNameCacheChanged = false

Definition at line 88 of file core.php.