new pisilinux web sites
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php namespace ZN\Security;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class PHP
|
||||
{
|
||||
/**
|
||||
* PHP Tag Chars
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $phpTagChars =
|
||||
[
|
||||
'<?' => '<?',
|
||||
'?>' => '?>'
|
||||
];
|
||||
|
||||
/**
|
||||
* Encode PHP Tag
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encode(string $str) : string
|
||||
{
|
||||
return str_replace(array_keys(self::$phpTagChars), array_values(self::$phpTagChars), $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode PHP Tag
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function decode(string $str) : string
|
||||
{
|
||||
return str_replace(array_values(self::$phpTagChars), array_keys(self::$phpTagChars), $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean PHP Tag
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function tagClean(string $str) : string
|
||||
{
|
||||
return str_ireplace(['<?php', '<?', '?>'], '', $str);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user