Public Member Functions |
| | is_params_valid (&$Params, &$RegExValidators) |
| | handle_macro_start ($TmpStartPos, $TmpEndPos, &$StartPos, &$Counter) |
| | handle_macro_end ($TmpStartPos, $TmpEndPos, &$StartPos, &$Counter, $MacroStartPos) |
| | handle_macro_start_end (&$StringData, &$TmpStartPos, &$TmpEndPos, &$StartPos, &$Counter, $MacroStartPos) |
| | find_macro (&$StringData, &$TmpStartPos, &$TmpEndPos, &$StartPos, &$Counter, $MacroStartPos, $ParamStartPos, $RegExValidators) |
Detailed Description
String utilities.
- Author
- Dodonov A.A.
Definition at line 26 of file macro_parser.php.
Member Function Documentation
| find_macro |
( |
& |
$StringData, |
|
|
& |
$TmpStartPos, |
|
|
& |
$TmpEndPos, |
|
|
& |
$StartPos, |
|
|
& |
$Counter, |
|
|
|
$MacroStartPos, |
|
|
|
$ParamStartPos, |
|
|
|
$RegExValidators |
|
) |
| |
Macro end.
- Parameters
-
| $StringData | - String data. |
| $TmpStartPos | - Macro start. |
| $TmpEndPos | - Macro end. |
| $StartPos | - Macro start. |
| $Counter | - Counter. |
| $MacroStartPos | - Macro start. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 302 of file macro_parser.php.
{
try
{
do
{
$StringData , $TmpStartPos , $TmpEndPos , $StartPos , $Counter , $MacroStartPos
);
if( $Counter == 0 )
{
$Params = substr( $StringData , $ParamStartPos , $TmpEndPos - $ParamStartPos );
{
return( $Params );
}
$TmpStartPos = false;
$StartPos = $MacroStartPos;
}
}
while( $TmpStartPos );
return( false );
}
catch( Exception $e )
{
}
}
| handle_macro_end |
( |
|
$TmpStartPos, |
|
|
|
$TmpEndPos, |
|
|
& |
$StartPos, |
|
|
& |
$Counter, |
|
|
|
$MacroStartPos |
|
) |
| |
Macro end.
- Parameters
-
| $TmpStartPos | - Macro start. |
| $TmpEndPos | - Macro end. |
| $StartPos | - Macro start. |
| $Counter | - Counter. |
| $MacroStartPos | - Macro start. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 177 of file macro_parser.php.
{
try
{
if( $TmpStartPos !== false && $TmpEndPos === false )
{
$Counter++;
$StartPos = $TmpStartPos;
}
if( $TmpStartPos === false && $TmpEndPos !== false )
{
$Counter--;
$StartPos = $TmpEndPos;
}
if( $TmpStartPos === false && $TmpEndPos === false )
{
$StartPos = $MacroStartPos;
}
}
catch( Exception $e )
{
}
}
| handle_macro_start |
( |
|
$TmpStartPos, |
|
|
|
$TmpEndPos, |
|
|
& |
$StartPos, |
|
|
& |
$Counter |
|
) |
| |
Macro start.
- Parameters
-
| $TmpStartPos | - Macro start. |
| $TmpEndPos | - Macro end. |
| $StartPos | - Macro start. |
| $Counter | - Counter. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 116 of file macro_parser.php.
{
try
{
if( $TmpStartPos !== false && $TmpEndPos !== false )
{
if( $TmpStartPos < $TmpEndPos )
{
$StartPos = $TmpEndPos;
}
if( $TmpEndPos < $TmpStartPos )
{
$Counter--;
if( $Counter )
{
$Counter++;
}
$StartPos = $TmpStartPos;
}
}
}
catch( Exception $e )
{
}
}
| handle_macro_start_end |
( |
& |
$StringData, |
|
|
& |
$TmpStartPos, |
|
|
& |
$TmpEndPos, |
|
|
& |
$StartPos, |
|
|
& |
$Counter, |
|
|
|
$MacroStartPos |
|
) |
| |
Macro end.
- Parameters
-
| $StringData | - String data. |
| $TmpStartPos | - Macro start. |
| $TmpEndPos | - Macro end. |
| $StartPos | - Macro start. |
| $Counter | - Counter. |
| $MacroStartPos | - Macro start. |
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 244 of file macro_parser.php.
{
try
{
$TmpStartPos = strpos( $StringData , chr( 123 ) , $StartPos + 1 );
$TmpEndPos = strpos( $StringData , chr( 125 ) , $StartPos + 1 );
$TmpStartPos , $TmpEndPos , $StartPos , $Counter , $MacroStartPos
);
}
catch( Exception $e )
{
}
}
| is_params_valid |
( |
& |
$Params, |
|
|
& |
$RegExValidators |
|
) |
| |
Function validates macro's parameters.
- Parameters
-
| $Params | - Macro's parameters. |
| $RegExValidators | - Regular expressions for parameters validation. |
- Returns
- true/false.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 54 of file macro_parser.php.
{
try
{
$Valid = true;
$Matches = array();
if( count( $RegExValidators ) )
{
$ParamsList = explode( ';' , $Params );
foreach( $ParamsList as $key1 => $p )
{
$p = explode( '=' , $p );
foreach( $RegExValidators as $key2 => $rev )
{
if( $key2 == $p[ 0 ] )
{
$Result = preg_match( $rev , $p[ 1 ] , $Matches );
$Valid = count( $Matches ) == 0 ? false : $Valid;
break;
}
}
}
}
return( $Valid );
}
catch( Exception $e )
{
}
}
The documentation for this class was generated from the following file: