ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
context_utilities_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| compile_no_permits ($Validation)
| get_section (&$Config, $SectionName, $Default= '_throw_exception')
| section_exists (&$Config, $SectionName)
| compile_success_messages (&$Options)
| compile_get_post_filter (&$Config, &$Options)
| compile_get_post_validation (&$Config, &$Options)
| get_custom_validation_object (&$Config)

## Data Fields
| $Messages = false
| $Security = false
| $SecurityValidator = false
| $Trace = false

## Detailed Description

Class for rapid controllers and viewes development.

Author
  Dodonov A.A.

Definition at line 26 of file context_utilities.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 57 of file context_utilities.php.

{
try
{
$this->Messages = get_package( 'page::messages' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->SecurityValidator = get_package( 'security::security_validator' , 'last' , __FILE__ );
$this->Trace = get_package( 'trace' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

compile_get_post_filter | ( | & | $Config,
|  | & | $Options
| ) |  |

Function validates GET/POST filters.

Parameters

  $Config | - Config.
  $Options | - Execution parameters.

Returns
  false if the filtration was not passed.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 390 of file context_utilities.php.

{
try
{
if( $this->section_exists( $Config , 'get_post_filter' ) == false )
{
return( true );
}
$Filter = $this->get_section( $Config , 'get_post_filter' );
$this->Trace->add_trace_string( "{lang:get_post_filter} : $Filter" , COMMON );
if( $this->SecurityValidator->validate_fields( $Filter ) === false )
{
$this->print_get_post_filter_trace( $Filter );
return( false );
}
return( true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_get_post_validation | ( | & | $Config,
|  | & | $Options
| ) |  |

Function validates GET/POST data.

Parameters

  $Options | - Execution parameters.

Returns
  false if the validation was not passed.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 438 of file context_utilities.php.

{
try
{
if( $this->section_exists( $Config , 'get_post_validation' ) )
{
$GetPostValidation = $this->get_section( $Config , 'get_post_validation' );
return( $this->SecurityValidator->validate_fields( $GetPostValidation ) );
}
return( true );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_no_permits | ( |  | $Validation | ) |

Function validates permits.

Parameters

  $Validation | - Permits validation script.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 90 of file context_utilities.php.

{
try
{
$this->Messages->add_error_message( 'no_permits' );
$this->Trace->add_trace_string(
"{lang:permits_validation_not_passed} : $Validation" , COMMON
);
$this->Trace->add_trace_string( "GET : ".wordwrap( serialize( $_GET ) ) , COMMON );
$this->Trace->add_trace_string( "POST : ".wordwrap( serialize( $_POST ) ) , COMMON );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_success_messages | ( | & | $Options | ) |

Function processes success messages.

Parameters

  $Options | - Execution parameters.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 306 of file context_utilities.php.

{
try
{
$SuccessMessage = $this->get_success_message( $Options );
if( $SuccessMessage !== false )
{
if( $this->Security->get_s( 'direct_controller' , 'integer' , 0 ) === 0 )
{
$PageName = $this->Security->get_gp( 'page_name' , 'command' );
$this->Security->reset_s( "$PageName:success_message" , $SuccessMessage );
}
$this->Messages->add_success_message( $SuccessMessage );
}
$this->compile_global_success_message();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_custom_validation_object | ( | & | $Config | ) |

Provider's custom validations.

Returns
  Object.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 475 of file context_utilities.php.

{
try
{
$Name = $this->get_section( $Config , 'custom_validation_package_name' , false );
if( $Name !== false )
{
$Version = $this->get_section( $Config , 'custom_validation_package_version' , 'last' );
$ValidationObject = get_package( $Name , $Version , __FILE__ );
}
else
{
$ValidationObject = $Owner;
}
return( $ValidationObject );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

get_section | ( | & | $Config,
|  |  | $SectionName,
|  |  | $Default = `'_throw_exception'`
| ) |  |

Function returns config section by it's name.

Parameters

  $Config | - Config.
  $SectionName | - Section's name.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 129 of file context_utilities.php.

{
try
{
if( isset( $Config[ $SectionName ] ) )
{
return( $Config[ $SectionName ] );
}
else
{
if( $Default == '_throw_exception' )
{
throw(
new Exception(
"Section \"$SectionName\" was not found in config ".wordwrap( serialize( $Config ) )
)
);
}
return( $Default );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

section_exists | ( | & | $Config,
|  |  | $SectionName
| ) |  |

Function validates section existance.

Parameters

  $Config | - Config.
  $SectionName | - Section's name.

Returns
  True if the section exists, false otherwise.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 182 of file context_utilities.php.

{
try
{
if( $Config === false )
{
throw( new Exception( 'Config was not set' ) );
}
if( isset( $Config[ $SectionName ] ) )
{
$this->Trace->add_trace_string( "{lang:section_was_found} : $SectionName" , COMMON );
}
else
{
$this->Trace->add_trace_string( "{lang:section_was_not_found} : $SectionName" , COMMON );
}
return( isset( $Config[ $SectionName ] ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$Messages = false

Cached packages.

Author
  Dodonov A.A.

Definition at line 38 of file context_utilities.php.

$Security = false

Definition at line 39 of file context_utilities.php.

$SecurityValidator = false

Definition at line 40 of file context_utilities.php.

$Trace = false

Definition at line 41 of file context_utilities.php.

The documentation for this class was generated from the following file:

- packages/gui/packages/context/packages/context_utilities/context_utilities.php