fix strange PHP parse error on subdomain usage

preventing ckeditor to load the resource and itself.

console errors like:
ckeditor.js:77 GET http://sub.domain.org/htmlarea/ckeditor/ckeditor/plugins/procurator/plugin.js?t=F0RD
ckeditor.js:226 Uncaught [CKEDITOR.resourceManager.load] Resource name "procurator" was not found at "http://sub.domain.org/htmlarea/ckeditor/ckeditor/plugins/procurator/plugin.js?t=F0RD".

server error.log like:
[Sun Mar 15 10:34:32 2015] [error] [client 1.2.3.4] PHP Parse error:  syntax error, unexpected '{' in /var/www/domain.org/html/sub/htmlarea/ckeditor/ckeditor/plugins/procurator/plugin.js on line 129, referer: http://sub.domain.org/serendipity_admin.php?serendipity[adminModule]=entries&serendipity[adminAction]=new

Why does PHP read/parse js files?
Why does it not respect // notes, nor /* notes */ in this case?

Might that be because Chrome says to all available loading js resources in Serendipity "Resource interpreted as Script but transferred with MIME type text/html" ???
This commit is contained in:
Ian 2015-03-15 11:23:23 +01:00
parent 27cf643135
commit ffe581225c

@ -3,7 +3,7 @@
*/
/**
* @fileOverview A Serendipity wysiwyg-mode-placeholder plugin: procurator, v. 1.4
* @fileOverview A Serendipity wysiwyg-mode-placeholder plugin: procurator, v. 1.5, 2015-03-15
*/
(function (pluginName) {
@ -126,7 +126,7 @@
// this is case {cke_protected} data
if ( elString.substr( 0, protectedSourceMarker.length ) == protectedSourceMarker ) {
var realData = elString.replace(/\{cke_protected\}([\s\S]+?)/g, "$1"); // cuts the snippet from {cke_protected}(.*) to preserve
// < <? !-- {
// tagStart + shortPHPStart + !-- + openCurlyBracket (named here, while giving a PHP PARSE ERROR ON Subdomain usage here, if using the chars, even enclosed in /**/
var tagName = realData.replace( /([%3C|%3C%3F|\!%2D%2D|%7B]?([a-z]+))%+(.*)$/, "$1"); // get the real tag name to set as real tag name title to object fakeElement.attributes
tagName = tagName.replace( '%3C', '' ).replace( '%3F', '' ); // tweak a little more, since this upper regex drives me crazy
if ( tagName.substr( 0, 3) == '%7B' ) tagName = 'smarty'; // []{