ultimix
settings_utilities_1_0_0 Class Reference

Public Member Functions

 transform_settings ($Settings, $Separator)
 load_settings ($Settings)

Detailed Description

Working with settings.

Author
Dodonov A.A.

Definition at line 26 of file settings_utilities.php.

Member Function Documentation

load_settings (   $Settings)

Function loads settings.

Parameters
$Settings- Settings.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 86 of file settings_utilities.php.

{
try
{
$SettingsList = array();
foreach( $Settings as $s )
{
$Tmp = explode( '=' , $s );
if( isset( $Tmp[ 1 ] ) === true )
{
$SettingsList[ $Tmp[ 0 ] ] = $Tmp[ 1 ];
}
elseif( isset( $Tmp[ 0 ] ) === true && isset( $Tmp[ 1 ] ) === false )
{
$SettingsList[ $Tmp[ 0 ] ] = true;
}
elseif( isset( $Tmp[ 0 ] ) === false )
{
$Settings = serialize( $Settings );
$s = serialize( $s );
$Tmp = serialize( $Tmp );
throw_exception( "Settings : $Settings s : $s Tmp : $Tmp Illegal settings string" );
}
}
return( $SettingsList );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
transform_settings (   $Settings,
  $Separator 
)

Function transforms settings string.

Parameters
$Settings- Settings.
$Separator- Separator.
Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 50 of file settings_utilities.php.

{
try
{
$Settings = str_replace(
array( "\r" , "\n" , $Separator.$Separator ) ,
array( $Separator , $Separator , $Separator ) ,
$Settings
);
return( explode( $Separator , $Settings ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

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