diff --git a/index.php b/index.php index 4b21bc0..0077caf 100644 --- a/index.php +++ b/index.php @@ -33,12 +33,12 @@ error_reporting(E_ALL | E_STRICT); $debugOutput = ''; if (isset($_POST['code'])) { - $code = $_POST['code']; - if (get_magic_quotes_gpc()) { $code = stripslashes($code); } + $code = trim(preg_replace('{^\s*<\?(php)?}i', '', $_POST['code'])); + // if there's only one line wrap it into a krumo() call if (preg_match('#^(?!var_dump|echo|print|< )([^\r\n]+?);?\s*$#is', $code, $m) && trim($m[1])) { $code = 'krumo('.$m[1].');'; @@ -88,7 +88,7 @@ if (isset($_POST['code'])) {
- +
Line: 1, Column: 1 diff --git a/php-console.js b/php-console.js index 11f4c79..81d03b8 100644 --- a/php-console.js +++ b/php-console.js @@ -80,9 +80,8 @@ var PhpMode, code; code = $('#' + options.editor).text(); - $('#' + options.editor) - .replaceWith('
') - .text(code); + $('#' + options.editor).replaceWith('
'); + $('#' + options.editor).text(code); editor = ace.edit(options.editor);