12 $params = \explode (
",", $parameters );
13 foreach ( $params as $param ) {
14 $param = \trim ( $param );
15 $list = \explode (
"=", $param );
22 if (isset ( $var ) && isset ( $value )) {
23 $value = \trim ( $value );
24 $var = self::checkVar ( $var );
25 $tmpResult [] = $var .
'=' . $value;
27 } elseif (isset ( $var )) {
28 $var = self::checkVar ( $var );
30 $tmpResult [] = $var .
"=''";
35 return \implode (
',', $tmpResult );
40 $params = \explode (
",", $parameters );
41 foreach ( $params as $param ) {
42 $param = \trim ( $param );
43 $list = \explode (
"=", $param );
50 if (isset ( $var ) && isset ( $value )) {
52 } elseif (isset ( $var )) {
53 $var = self::unCheckVar ( $var );
54 $tmpResult [] =
'{' . $var .
'}';
60 public static function checkVar($var, $prefix =
'$') {
63 $var = \trim ( $var );
65 $var = $prefix . $var;
73 $var = \trim ( $var );
75 $var = \substr ( $var, \
sizeof ( $prefix ) );
80 public static function indent($code, $count = 2) {
81 $tab = \str_repeat (
"\t", $count );
82 $lines = \explode (
"\n", $code );
83 return $tab . \implode ( $tab, $lines );
89 $temp_file = tempnam ( sys_get_temp_dir (),
'Tux' );
90 $fp = fopen ( $temp_file,
"w" );
91 fwrite ( $fp, $code );
93 if (file_exists ( $temp_file )) {
94 $phpExe = self::getPHPExecutable ();
95 if (isset ( $phpExe )) {
96 exec ( $phpExe .
' -l ' . $temp_file, $output, $result );
98 $output = implode (
"", $output );
99 \unlink ( $temp_file );
100 if (strpos ( $output,
'No syntax errors detected' ) ===
false && $result !== 1) {
113 if (defined (
'PHP_BINARY' ) && PHP_BINARY && in_array ( PHP_SAPI, array (
'cli',
'cli-server' ) ) && is_file ( PHP_BINARY )) {
115 }
else if (strtoupper ( substr ( PHP_OS, 0, 3 ) ) ===
'WIN') {
116 $paths = explode ( PATH_SEPARATOR, getenv (
'PATH' ) );
117 foreach ( $paths as $path ) {
118 if (substr ( $path, strlen ( $path ) - 1 ) == DIRECTORY_SEPARATOR) {
119 $path = substr ( $path, 0, strlen ( $path ) - 1 );
121 if (substr ( $path, strlen ( $path ) - strlen (
'php' ) ) ==
'php') {
122 $response = $path . DIRECTORY_SEPARATOR .
'php.exe';
123 if (is_file ( $response )) {
126 }
else if (substr ( $path, strlen ( $path ) - strlen (
'php.exe' ) ) ==
'php.exe') {
127 if (is_file ( $response )) {
133 $paths = explode ( PATH_SEPARATOR, getenv (
'PATH' ) );
134 foreach ( $paths as $path ) {
135 if (substr ( $path, strlen ( $path ) - 1 ) == DIRECTORY_SEPARATOR) {
136 $path = substr ( $path, strlen ( $path ) - 1 );
138 if (substr ( $path, strlen ( $path ) - strlen (
'php' ) ) ==
'php') {
139 if (is_file ( $path )) {
142 $response = $path . DIRECTORY_SEPARATOR .
'php';
143 if (is_file ( $response )) {
static unCheckVar($var, $prefix='$')
static indent($code, $count=2)
static isValidCode($code)
static cleanParameters($parameters)
static checkVar($var, $prefix='$')
static getPHPExecutable()
static getParametersForRoute($parameters)
static startswith($hay, $needle)