mainwp-child/class/class-mainwp-tools.php
2016-05-09 19:34:51 +02:00

19 lines
No EOL
433 B
PHP

<?php
class MainWP_Tools {
public static function execute_snippet( $code ) {
ob_start();
$result = eval( $code );
$output = ob_get_contents();
ob_end_clean();
$return = array();
if ( ( false === $result ) && ( $error = error_get_last() ) ) {
$return['status'] = 'FAIL';
$return['result'] = $error['message'];
} else {
$return['status'] = 'SUCCESS';
$return['result'] = $output;
}
return $return;
}
}