22 define(
'SECURE_OBJECT' , 0 );
23 define(
'SECURE_ARRAY' , 1 );
27 define(
'COOKIE' , 4 );
28 define(
'SESSION' , 8 );
29 define(
'SERVER' , 16 );
30 define(
'PREFIX_NAME' , 32 );
31 define(
'KEYS' , 64 );
84 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
86 $this->init_supported_data_types();
108 private function init_supported_data_types()
112 $this->SupportedData[
'integer' ] = $this;
113 $this->SupportedData[
'digits' ] = $this;
114 $this->SupportedData[
'integer_list' ] = $this;
115 $this->SupportedData[
'float' ] = $this;
116 $this->SupportedData[
'command' ] = $this;
117 $this->SupportedData[
'string' ] = $this;
118 $this->SupportedData[
'script' ] = $this;
119 $this->SupportedData[
'unsafe_string' ] = $this;
120 $this->SupportedData[
'email' ] = $this;
121 $this->SupportedData[
'raw' ] = $this;
123 catch( Exception $e )
156 $Str = preg_replace(
"/\[lang\:([\{\}\[\]]{0}.*)\]/U" ,
"{lang:\\1}" , $Str );
160 catch( Exception $e )
193 $Str = preg_replace(
"/\{lang\:([\{\}\[\]]{0}.*)\}/U" ,
"[lang:\\1]" , $Str );
197 catch( Exception $e )
229 $Types = array(
'integer' ,
'float' ,
'command' ,
'string' ,
'email' ,
'email' ,
'set' ,
'raw' );
231 foreach( $Predicates as $p )
233 $Key = array_search( $p , $Types );
236 return( $Types[ $Key ] );
240 throw(
new Exception(
"Type was not found" ) );
242 catch( Exception $e )
274 return( intval( $Data ) );
276 catch( Exception $e )
313 $s = strlen( $Data =
"$Data" );
315 for( $i = 0 ; $i < $s ; $i++ )
317 if( ( $Data[ $i ] >=
'0' && $Data[ $i ] <=
'9' ) || $Data[ 0 ] ==
'-' )
319 $RetData .= $Data[ $i ];
325 catch( Exception $e )
357 if( is_array( $Data ) )
359 $Data = implode(
',' , $Data );
363 preg_match(
'/^[0-9\,]+$/' , $Data , $Matches );
365 if( count( $Matches ) > 0 )
371 throw(
new Exception(
"Illegal symbols were found '$Data'" ) );
374 catch( Exception $e )
406 return( floatval( $Data ) );
408 catch( Exception $e )
441 $s = strlen( $Data );
442 for( $i = 0 ; $i < $s ; $i++ )
444 if( ( $Data[ $i ] >=
'a' && $Data[ $i ] <=
'z' ) ||
445 ( $Data[ $i ] >=
'A' && $Data[ $i ] <=
'Z' ) ||
446 ( $Data[ $i ] >=
'0' && $Data[ $i ] <=
'9' ) ||
447 $Data[ $i ] ==
'_' || $Data[ $i ] ==
':' || $Data[ $i ] ==
'-' || $Data[ $i ] ==
'.' )
449 $RetData .= $Data[ $i ];
455 catch( Exception $e )
487 if( $this->String ===
false )
489 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
493 $Data = htmlspecialchars( $Data , ENT_QUOTES ,
'UTF-8' );
495 $PlaceHolders = array(
'{' ,
';' ,
'=' ,
'#' ,
'}' ,
"\r" ,
"\n" );
496 $Replacements = array(
'[lfb]' ,
'[dot_comma]' ,
'[eq]' ,
'[sharp]' ,
'[rfb]' ,
'[r]' ,
'[n]' );
497 $Data = str_replace( $PlaceHolders, $Replacements , $Data );
500 $Data = str_replace(
'&' ,
'[amp]' , $Data );
504 catch( Exception $e )
536 if( $this->String ===
false )
538 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
541 $Data = htmlspecialchars( $Data , ENT_QUOTES ,
'UTF-8' );
542 $Data = str_replace(
'{' ,
'[lfb]' , $Data );
543 $Data = str_replace(
';' ,
'[dot_comma]' , $Data );
544 $Data = str_replace(
'=' ,
'[eq]' , $Data );
545 $Data = str_replace(
'#' ,
'[sharp]' , $Data );
546 $Data = str_replace(
'}' ,
'[rfb]' , $Data );
547 $Data = str_replace(
"\r" ,
'[r]' , $Data );
548 $Data = str_replace(
"\n" ,
'[n]' , $Data );
550 $Data = str_replace(
'&' ,
'[amp]' , $Data );
554 catch( Exception $e )
586 if( $this->String ===
false )
588 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
591 $Data = str_replace(
'[lfb]' ,
'{' , $Data );
592 $Data = str_replace(
'[dot_comma]' ,
';' , $Data );
593 $Data = str_replace(
'[eq]' ,
'=' , $Data );
594 $Data = str_replace(
'[sharp]' ,
'#' , $Data );
595 $Data = str_replace(
'[rfb]' ,
'}' , $Data );
596 $Data = str_replace(
'[amp]' ,
'&' , $Data );
598 $Data = htmlspecialchars_decode( $Data , ENT_QUOTES );
602 catch( Exception $e )
635 $c = strlen( $Data );
636 for( $i = 0 ; $i < $c ; $i++ )
638 if( ( $Data[ $i ] >=
'a' && $Data[ $i ] <=
'z' ) ||
639 ( $Data[ $i ] >=
'A' && $Data[ $i ] <=
'Z' ) ||
640 ( $Data[ $i ] >=
'0' && $Data[ $i ] <=
'9' ) ||
641 $Data[ $i ] ==
'_' || $Data[ $i ] ==
':' ||
642 $Data[ $i ] ==
'-' || $Data[ $i ] ==
'.' ||
643 $Data[ $i ] ==
'@' || $Data[ $i ] ==
'=' ||
646 $RetData .= $Data[ $i ];
652 catch( Exception $e )
688 if( isset( $this->SupportedData[ $Type ] ) ===
false )
690 throw(
new Exception(
"Undefined data type \"$Type\"" ) );
696 return( call_user_func( array( $this->SupportedData[ $Type ] ,
"compile_$Type" ) , $Data ) );
698 catch( Exception $e )
741 foreach( $Data as $key => $d )
743 if( is_array( $d ) || is_object( $d ) )
746 if( is_object( $d ) || count( $d ) )
753 if( $Type ==
'string' || $Type ==
'command' || $Type ==
'raw' || strlen( $d ) != 0 )
761 catch( Exception $e )