Skip to content

Commit 5b13e5c

Browse files
committed
Also provide an undecorated PHP mode
1 parent d0dfa2f commit 5b13e5c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

mode/php/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ <h1>CodeMirror 2: PHP mode</h1>
4747
the <a href="../clike/">C-like</a> mode. Depends on XML,
4848
JavaScript, CSS, and C-like modes.</p>
4949

50-
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code>.</p>
50+
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
5151
</body>
5252
</html>

mode/php/php.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
"default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends " +
1010
"final for foreach function global goto if implements interface instanceof namespace " +
1111
"new or private protected public static switch throw try use var while xor");
12+
var phpConfig = {name: "clike", keywords: phpKeywords, multiLineStrings: true, $vars: true};
1213

1314
CodeMirror.defineMode("php", function(config, parserConfig) {
1415
var htmlMode = CodeMirror.getMode(config, "text/html");
1516
var jsMode = CodeMirror.getMode(config, "text/javascript");
1617
var cssMode = CodeMirror.getMode(config, "text/css");
17-
var phpMode = CodeMirror.getMode(config, {name: "clike", keywords: phpKeywords, multiLineStrings: true, $vars: true});
18+
var phpMode = CodeMirror.getMode(config, phpConfig);
1819

1920
function dispatch(stream, state) { // TODO open PHP inside text/css
2021
if (state.curMode == htmlMode) {
@@ -78,6 +79,6 @@
7879
electricChars: "/{}:"
7980
}
8081
});
82+
CodeMirror.defineMIME("application/x-httpd-php", "php");
83+
CodeMirror.defineMIME("text/x-php", phpConfig);
8184
})();
82-
83-
CodeMirror.defineMIME("application/x-httpd-php", "php");

0 commit comments

Comments
 (0)