Public Member Functions |
| | __construct () |
| | load_settings ($Settings, $Separator= ';') |
| | delete_setting ($Name) |
| | append_settings ($Settings, $Separator= ';') |
| | load_from_http () |
| | get_raw_settings () |
| | add_settings_from_object (&$Settings) |
| | load_raw_settings (&$Settings) |
| | append_raw_settings (&$Settings) |
| | get_all_settings () |
| | load_file ($FilePath, $Separator= ';') |
| | append_file ($FilePath, $Separator= ';') |
| | load_package_settings ($PackageName, $PackageVersion, $FileName) |
| | define ($Name, $DefaultValue= '_throw_exception') |
| | setting_exists ($Name, $ThrowException=false) |
| | get_setting ($Name, $DefaultValue= '_throw_exception') |
| | get_default_values ($SettingsNames, $DefaultValues) |
| | get_settings ($SettingsNames, $DefaultValues= '_throw_exception') |
| | set_setting ($Name, $Value) |
| | set_undefined ($Name, $Value) |
| | clear () |
| | remove_setting ($Name) |
| | __toString () |
Detailed Description
Working with settings.
- Author
- Dodonov A.A.
Definition at line 26 of file settings.php.
Constructor & Destructor Documentation
Constructor.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 67 of file settings.php.
{
try
{
$this->SettingsUtilities =
get_package(
'settings::settings_utilities' ,
'last' , __FILE__ );
}
catch( Exception $e )
{
}
}
Member Function Documentation
Function converts object to string.
- Returns
- string with the object's description.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 909 of file settings.php.
{
try
{
return( serialize( $this->SettingsList ) );
}
catch( Exception $e )
{
}
}
| add_settings_from_object |
( |
& |
$Settings | ) |
|
Function stores settings.
- Parameters
-
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 277 of file settings.php.
{
try
{
$this->SettingsList = array_merge( $this->SettingsList , $Settings->SettingsList );
}
catch( Exception $e )
{
}
}
| append_file |
( |
|
$FilePath, |
|
|
|
$Separator = ';' |
|
) |
| |
Function loads settings from file.
- Parameters
-
| $FilePath | - File path. |
| $Separator | - Separator for keys. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 479 of file settings.php.
{
try
{
}
catch( Exception $e )
{
}
}
| append_raw_settings |
( |
& |
$Settings | ) |
|
Function stores settings.
- Parameters
-
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 337 of file settings.php.
{
try
{
$this->SettingsList = array_merge( $this->SettingsList , $Settings );
}
catch( Exception $e )
{
}
}
| append_settings |
( |
|
$Settings, |
|
|
|
$Separator = ';' |
|
) |
| |
Function loads additional settings.
- Parameters
-
| $Settings | - Data with settings. |
| $Separator | - Separator for keys. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 179 of file settings.php.
{
try
{
if( $Settings === false || $Settings === '' || $Settings === null )
{
return;
}
if( is_array( $Settings ) === false )
{
$Settings = $this->SettingsUtilities->transform_settings( $Settings , $Separator );
}
$this->SettingsList = array_merge(
$this->SettingsList , $this->SettingsUtilities->load_settings( $Settings )
);
}
catch( Exception $e )
{
}
}
Function clears setings.
- Returns
- string with the object's description.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 849 of file settings.php.
{
try
{
$this->SettingsList = array();
}
catch( Exception $e )
{
}
}
| define |
( |
|
$Name, |
|
|
|
$DefaultValue = '_throw_exception' |
|
) |
| |
Creating dfine by setting.
- Parameters
-
| $Name | - Setting title. |
| $DefaultValue | - Default value for undefined setting. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 553 of file settings.php.
{
try
{
DEFINE( $Name , $this->
get_setting( $Name , $DefaultValue ) );
}
catch( Exception $e )
{
}
}
Function deletes setting.
- Parameters
-
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 132 of file settings.php.
{
try
{
if( isset( $this->SettingsList[ $Name ] ) === false )
{
return;
}
$New = array();
foreach( $this->SettingsList as $Key => $Value )
{
if( $Key !== $Name )
{
$New[ $Key ] = $Value;
}
}
$this->SettingsList = $New;
}
catch( Exception $e )
{
}
}
Function returns compiled settings.
- Returns
- Settings.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 367 of file settings.php.
{
try
{
$Str = array();
foreach( $this->SettingsList as $Key => $Value )
{
$Str [] = "$Key=$Value";
}
$Str = implode( ';' , $Str );
return( $Str );
}
catch( Exception $e )
{
}
}
| get_default_values |
( |
|
$SettingsNames, |
|
|
|
$DefaultValues |
|
) |
| |
Function provides access to the default values.
- Parameters
-
| $SettingsNames | - Settings titles. |
| $DefaultValues | - Default values for undefined setting. |
- Returns
- Settings'es default values.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 686 of file settings.php.
{
try
{
$DefaultValues = explode( ',' , $DefaultValues );
$c1 = count( $DefaultValues );
$c2 = count( $SettingsNames );
if( $c1 < $c2 )
{
for( $i = 0 ; $i < $c2 - $c1 ; $i++ )
{
$DefaultValues [] = '_throw_exception';
}
}
return( $DefaultValues );
}
catch( Exception $e )
{
}
}
Function returns array with settings.
- Returns
- Array with settings.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 247 of file settings.php.
{
try
{
return( $this->SettingsList );
}
catch( Exception $e )
{
}
}
| get_setting |
( |
|
$Name, |
|
|
|
$DefaultValue = '_throw_exception' |
|
) |
| |
Function provides access to the loaded settings.
- Parameters
-
| $Name | - Setting title. |
| $DefaultValue | - Default value for undefined setting. |
- Returns
- Setting's value.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 639 of file settings.php.
{
try
{
if( $this->SettingsList !== false && isset( $this->SettingsList[ $Name ] ) )
{
return( $this->SettingsList[ $Name ] );
}
if( $DefaultValue === '_throw_exception' )
{
throw( new Exception( 'Setting "'.$Name.'" was not found' ) );
}
return( $DefaultValue );
}
catch( Exception $e )
{
}
}
| get_settings |
( |
|
$SettingsNames, |
|
|
|
$DefaultValues = '_throw_exception' |
|
) |
| |
Function provides access to the loaded settings.
- Parameters
-
| $SettingsNames | - Settings titles. |
| $DefaultValues | - Default values for undefined setting. |
- Returns
- Settings'es values.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 737 of file settings.php.
{
try
{
$Values = array();
$SettingsNames = explode( ',' , $SettingsNames );
foreach( $SettingsNames as $i => $Name )
{
$Values [] = $this->
get_setting( $Name , $DefaultValues[ $i ] );
}
return( $Values );
}
catch( Exception $e )
{
}
}
| load_file |
( |
|
$FilePath, |
|
|
|
$Separator = ';' |
|
) |
| |
Function loads settings from file.
- Parameters
-
| $FilePath | - File path. |
| $Separator | - Separator for keys. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 445 of file settings.php.
{
try
{
$this->
load_settings( $this->get_config( $FilePath ) , $Separator );
}
catch( Exception $e )
{
}
}
Function loads settings from $_GET and $_POST.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 217 of file settings.php.
{
try
{
$this->SettingsList = array_merge( $_POST , $_GET );
}
catch( Exception $e )
{
}
}
| load_package_settings |
( |
|
$PackageName, |
|
|
|
$PackageVersion, |
|
|
|
$FileName |
|
) |
| |
Function loads settings for package.
- Parameters
-
| $PackageName | - Package's name. |
| $PackageVersion | - Package's version. |
| $FileName | - File's name from directory 'conf' for the specified package. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 517 of file settings.php.
{
try
{
$this->
load_file( $PackageDirectory.
"/conf/$FileName" );
}
catch( Exception $e )
{
}
}
| load_raw_settings |
( |
& |
$Settings | ) |
|
Function stores settings.
- Parameters
-
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 307 of file settings.php.
{
try
{
$this->SettingsList = $Settings;
}
catch( Exception $e )
{
}
}
| load_settings |
( |
|
$Settings, |
|
|
|
$Separator = ';' |
|
) |
| |
Function loads settings.
- Parameters
-
| $Settings | - Data with settings. |
| $Separator | - Separator for keys. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 101 of file settings.php.
{
try
{
$this->SettingsList = array();
}
catch( Exception $e )
{
}
}
Function removes setting.
- Parameters
-
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 879 of file settings.php.
{
try
{
}
catch( Exception $e )
{
}
}
| set_setting |
( |
|
$Name, |
|
|
|
$Value |
|
) |
| |
Function provides setting values for settings.
- Parameters
-
| $Name | - Setting title. |
| $Value | - Default value for setting. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 781 of file settings.php.
{
try
{
if( $this->SettingsList !== false )
{
$this->SettingsList[ $Name ] = $Value;
}
}
catch( Exception $e )
{
}
}
| set_undefined |
( |
|
$Name, |
|
|
|
$Value |
|
) |
| |
Function provides setting of the undefined settings.
- Parameters
-
| $Name | - Setting title. |
| $Value | - Default value for setting. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 818 of file settings.php.
{
try
{
if( $this->SettingsList !== false && isset( $this->SettingsList[ $Name ] ) === false )
{
$this->SettingsList[ $Name ] = $Value;
}
}
catch( Exception $e )
{
}
}
| setting_exists |
( |
|
$Name, |
|
|
|
$ThrowException = false |
|
) |
| |
Function provides access to the loaded settings.
- Parameters
-
| $Name | - Setting title. |
| $ThrowException | - Throw exception. |
- Returns
- true if the setting exists, false otherwise
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 591 of file settings.php.
{
try
{
if( $this->SettingsList !== false && isset( $this->SettingsList[ $Name ] ) )
{
return( true );
}
if( $ThrowException )
{
throw( new Exception( "Setting \"$Name\" does not exist" ) );
}
return( false );
}
catch( Exception $e )
{
}
}
Field Documentation
Cached objects.
- Author
- Dodonov A.A.
Definition at line 50 of file settings.php.
Array with settings.
- Author
- Dodonov A.A.
Definition at line 38 of file settings.php.
| $SettingsUtilities = false |
The documentation for this class was generated from the following file: