ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
lang_markup_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| compile_lang_block (&$Settings, $Data)
| compile_lang_file (&$Settings)
| compile_lang_file_js (&$Settings)
| compile_lang (&$Settings)
| compile_iconv (&$Settings, $Data)
| compile_locale (&$Settings)

## Data Fields
| $CachedMultyFS = false
| $Lang = false

## Detailed Description

Class provides language dependent substitutions for strings.

Author
  Dodonov A.A.

Definition at line 26 of file lang_markup.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 55 of file lang_markup.php.

{
try
{
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->Lang = get_package( 'lang' , 'last' , __FILE__ );
$this->Lang->get_locale();
$this->Lang->load_translations();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

compile_iconv | ( | & | $Settings,
|  |  | $Data
| ) |  |

Function processes macro 'iconv'.

Parameters

  $Settings | - Параметры компиляции.
  $Data | - Data.

Returns
  HTML code.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 309 of file lang_markup.php.

{
try
{
$Code = iconv(
$this->Settings->get_setting( 'in_charset' ) ,
$this->Settings->get_setting( 'out_charset' , 'UTF-8' ) , $Data
);
return( $Code );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_lang | ( | & | $Settings | ) |

Function processes macro 'lang'.

Parameters

  $Settings | - Параметры компиляции.

Returns
  HTML code.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 259 of file lang_markup.php.

{
try
{
$RawSettings = $Settings->get_raw_settings();
$StringAlias = array_shift( array_keys( $RawSettings ) );
$Value = $Settings->get_setting( 'value' , 'default' );
$TransformedString = $this->Lang->get_string( $StringAlias , $Value );
if( $TransformedString == $StringAlias )
{
$DefaultTransform = $Settings->get_setting( 'default' , false );
$TransformedString =
$DefaultTransform === false ? $TransformedString : "{lang:$DefaultTransform}";
}
return( $TransformedString );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_lang_block | ( | & | $Settings,
|  |  | $Data
| ) |  |

Function processes 'lang_block'.

Parameters

  $Settings | - Settings.
  $Data | - Data.

Returns
  Processed string.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 96 of file lang_markup.php.

{
try
{
if( $Settings->setting_exists( $this->Lang->get_locale() ) )
{
return( $Data );
}
else
{
return( '' );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_lang_file | ( | & | $Settings | ) |

Function processes macro 'lang_file'.

Parameters

  $Settings | - Settings.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 172 of file lang_markup.php.

{
try
{
list( $PackageName , $PackageVersion ) = $this->get_package_info( $Settings );
foreach( $PackageName as $i => $Name )
{
$Version = isset( $PackageVersion[ $i ] ) ? $PackageVersion[ $i ] : 'last';
$PackagePath = _get_package_path_ex( $Name , $Version );
$TopPackageName = _get_top_package_name( $Name );
$LangFilePath = $PackagePath.'/res/lang/'.$TopPackageName.'.'.$this->Lang->Language;
$RawData = $this->CachedMultyFS->file_get_contents( $LangFilePath , 'cleaned' );
$this->Lang->load_data( $RawData );
}
return( '' );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_lang_file_js | ( | & | $Settings | ) |

Function processes macro 'lang_file_js'.

Parameters

  $Settings | - Настройки.

Returns
  Processed string.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 220 of file lang_markup.php.

{
try
{
$PackageName = $Settings->get_setting( 'package_name' );
$PackageVersion = $Settings->get_setting( 'package_version' , 'last' );
$this->Lang->include_strings_js( $PackageName , $PackageVersion );
return( '' );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_locale | ( | & | $Settings | ) |

Function processes macro 'locale'.

Parameters

  $Str | - String to process.
  $Changed | - true if any of the page's elements was compiled.

Returns
  array( $Str , $Changed ).

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 352 of file lang_markup.php.

{
try
{
return( $this->Lang->Language );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$CachedMultyFS = false

Cached packages.

Author
  Dodonov A.A.

Definition at line 38 of file lang_markup.php.

$Lang = false

Definition at line 39 of file lang_markup.php.

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

- packages/lang/packages/lang_markup/lang_markup.php