ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

Functions | Variables
core_public_api.php File Reference

Go to the source code of this file.

## Functions
| throw_exception ($Message)
| mkdir_ex ($Path)
| get_package_version_s ($ClassName)
| _get_package_from_cache ($Key)
| get_package ($PackageName, $PackageVersion= 'last', $PackageScriptPath=false)
| get_package_object ($PackageName, $PackageVersion= 'last', $PackageScriptPath=false)

## Variables
| $GetPackageObjectCache = array()

## Function Documentation

_get_package_from_cache | ( |  | $Key | ) |

Selecting instance of package.

Parameters

  $Key | - Cache key.

Returns
  Reference on package's object.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 105 of file core_public_api.php.

{
try
{
global $ObjectLabel;
global $PackageCache;
global $PackagePathsCache;
$ObjectLabel = 'default';
return( $PackageCache[ $PackagePathsCache[ $Key ][ 'path' ] ] );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

get_package | ( |  | $PackageName,
|  |  | $PackageVersion = `'last'`,
|  |  | $PackageScriptPath = `false`
| ) |  |

Selecting instance of package.

Parameters

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

Returns
  Reference on package's object.

Note
  Function sets value of the $ObjectLabel to 'default'. If the script file was not found then false will be returned.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 157 of file core_public_api.php.

{
try
{
list( $Fetched , $Object ) = _try_fetch_from_cache( $PackageName , $PackageVersion );
global $ObjectLabel;
if( $Fetched )
{
$ObjectLabel = 'default';
return( $Object );
}
_fill_package_paths_cache( $PackageName , $PackageVersion , $PackageScriptPath );
_store_package_path( $PackageName , $PackageVersion );
$PackageClassName = _package_script_fast_load( $PackageName , $PackageVersion );
$Key = "$PackageName $PackageVersion $ObjectLabel";
_store_package_object( $PackageClassName , $Key );
return( _get_package_from_cache( $Key ) );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

get_package_object | ( |  | $PackageName,
|  |  | $PackageVersion = `'last'`,
|  |  | $PackageScriptPath = `false`
| ) |  |

Selecting copy of package object.

Parameters

  $PackageName | - name of the package.
  $PackageVersion | - package's version. In case string 'last' is passed, then function returns the latest version.
  $PackageScriptPath | - path to the package's script.

Returns
  Reference on package's object.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 218 of file core_public_api.php.

{
try
{
list( $PackageName , $PackageVersion ) = _get_package_info_after_rewrites(
$PackageName , $PackageVersion , $PackageScriptPath
);
global $GetPackageObjectCache;
$Key = "$PackageName $PackageVersion";
if( isset( $GetPackageObjectCache[ $Key ] ) === false )
{
get_package( $PackageName , $PackageVersion , $PackageScriptPath );
$GetPackageObjectCache[ $Key ] = _get_requested_class_name();
}
$ClassName = $GetPackageObjectCache[ $Key ];
return( new $ClassName() );
}
catch( Exception $e )
{
$Args = func_get_args();throw( _get_exception_object( __FUNCTION__ , $Args , $e ) );
}
}

get_package_version_s | ( |  | $ClassName | ) |

Function joins object's/array's fields.

Parameters

  $ClassName | - Class name.

Returns
  - Package version.

Author
  Dodonov A.A.

Definition at line 73 of file core_public_api.php.

{
$ClassVersion = explode( '_' , $ClassName );
$ClassVersionRet = '';
$ClassVersionRet = array_pop( $ClassVersion ).$ClassVersionRet;
$ClassVersionRet = array_pop( $ClassVersion ).'.'.$ClassVersionRet;
$ClassVersionRet = array_pop( $ClassVersion ).'.'.$ClassVersionRet;
return( $ClassVersionRet );
}

mkdir_ex | ( |  | $Path | ) |

This function creates directory (empty index.html is also created).

Parameters

  $Path | - Path to the creating directory.

Author
  Dodonov A.A.

Definition at line 49 of file core_public_api.php.

{
@mkdir( $Path );
file_put_contents( rtrim( $Path , "/\\" ).'/index.html' , '<html><head></head><body></body></html>' );
}

throw_exception | ( |  | $Message | ) |

Function throws exception.

Parameters

  $Message | - Exception's message.

Author
  Dodonov A.A.

Definition at line 30 of file core_public_api.php.

{
throw( new Exception( $Message ) );
}

## Variable Documentation

$GetPackageObjectCache = array()

Definition at line 185 of file core_public_api.php.