Detailed Description
This class provides access to the templates.
- Author
- Dodonov A.A.
Definition at line 26 of file template_content_access.php.
Constructor & Destructor Documentation
Constructor.
- Author
- Dodonov A.A.
Definition at line 52 of file template_content_access.php.
{
try
{
$this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
$this->Security =
get_package(
'security' ,
'last' , __FILE__ );
$this->SecurityParser =
get_package(
'security::security_parser' ,
'last' , __FILE__ );
}
catch( Exception $e )
{
}
}
Member Function Documentation
Function returns content.
- Parameters
-
| $Template | - Content's file name. |
- Returns
- Static content.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 313 of file template_content_access.php.
{
try
{
if( $Path !== false && $this->CachedMultyFS->file_exists( $Path ) )
{
return( $this->CachedMultyFS->file_get_contents( $Path ) );
}
else
{
throw( new Exception( "The content \"$Template\" was not found. Path : $Path" ) );
}
}
catch( Exception $e )
{
}
}
| get_content_ex |
( |
|
$Options | ) |
|
Function returns content.
- Parameters
-
| $Options | - Display options. |
- Returns
- Static content.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 442 of file template_content_access.php.
{
try
{
$PackageName = $Options->get_setting( 'package_name' , false );
if( $PackageName === false )
{
return( $this->
get_content( $Options->get_setting(
'template' ) ) );
}
else
{
}
}
catch( Exception $e )
{
}
}
| get_content_path |
( |
|
$Template | ) |
|
Function returns content.
- Parameters
-
| $Template | - Content's file name. |
- Returns
- Path to the content file.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 272 of file template_content_access.php.
{
try
{
$VirtualPath = dirname( __FILE__ )."/res/templates/$Template";
{
return( $Path );
}
return( false );
}
catch( Exception $e )
{
}
}
| get_package_file |
( |
& |
$Options | ) |
|
Function returns content for package.
- Parameters
-
| $Options | - Display options. |
- Returns
- Static content.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 404 of file template_content_access.php.
{
try
{
$PackageName = $Options->get_setting( 'package_name' , false );
$PackageVersion = $Options->get_setting( 'package_version' , 'last' );
$FileName = $Options->get_setting( 'template' , false );
}
catch( Exception $e )
{
}
}
| get_package_template |
( |
|
$PackageName, |
|
|
|
$PackageVersion, |
|
|
|
$Template |
|
) |
| |
Function returns content.
- Parameters
-
| $PackageName | - Package name. |
| $PackageVersion | - Package version. |
| $Template | - Templates's file name. |
- Returns
- Static content.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 364 of file template_content_access.php.
{
try
{
$PackageName = $this->Security->get( $PackageName , 'string' );
$PackageVersion = $this->Security->get( $PackageVersion , 'string' );
$Template = $this->Security->get( $Template , 'string' );
return( $this->CachedMultyFS->file_get_contents( $Path ) );
}
catch( Exception $e )
{
}
}
Function selects list of objects.
- Parameters
-
| $id | - Comma separated list of record's id. |
- Returns
- Array of records.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 137 of file template_content_access.php.
{
try
{
$id = $this->Security->get( $id , 'string' );
$id = explode( ',' , $id );
$Return = array();
foreach( $id as $k => $v )
{
$Return [] = array( 'content' => $this->Security->get( $this->get_content( $v ) , 'string' ) );
}
return( $Return );
}
catch( Exception $e )
{
}
}
| set_add_condition |
( |
|
$theAddCondition | ) |
|
Function sets additional conditions.
- Parameters
-
| $theAddCondition | - Additional conditions. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 96 of file template_content_access.php.
{
try
{
if( $this->AddCondition === false )
{
$this->AddCondition = $theAddCondition;
}
else
{
throw( new Exception( '"AddCondition" was already set' ) );
}
}
catch( Exception $e )
{
}
}
| try_virtual_path |
( |
|
$VirtualPath | ) |
|
Function checks virtual path.
- Parameters
-
| $VirtualPath | - Path to the content's file name. |
- Returns
- Path to the content file.
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 226 of file template_content_access.php.
{
try
{
$Path = false;
if( $this->AddCondition !== false )
{
$Path = $this->CachedMultyFS->get_file_path( $VirtualPath."_$this->AddCondition" , false );
}
if( $Path === false )
{
$Path = $this->CachedMultyFS->get_file_path( $VirtualPath , false );
}
return( $Path );
}
catch( Exception $e )
{
}
}
Updating record.
- Parameters
-
| $id | - Comma separated list of record's id. |
| $Record | - Example for update. |
- Exceptions
-
| Exception | - An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 182 of file template_content_access.php.
{
try
{
$id = $this->Security->get( $id , 'string' );
$id = explode( ',' , $id );
$Record = $this->SecurityParser->parse_parameters( $Record , 'content:string' , 'allow_not_set' );
$Template =
get_field( $Record ,
'content' );
$Template = $this->Security->get( $Template , 'unsafe_string' );
foreach( $id as $k => $v )
{
$this->CachedMultyFS->file_put_contents( $this->
get_content_path( $v ) , $Template );
}
}
catch( Exception $e )
{
}
}
Field Documentation
The documentation for this class was generated from the following file: