diff --git a/Classes/Loader.php b/Classes/Loader.php index 65bb532f0b956f1f6dfece29dc83835ca28eab92..528db5186dc3ec05004144b94af27e864715ed6f 100644 --- a/Classes/Loader.php +++ b/Classes/Loader.php @@ -228,10 +228,15 @@ class Loader { $configuration = file_get_contents($configurationFile); } - // split config into first and last javascript parts (applied later again into the config variables) - // additionally the config part is matched to get the options - $pattern = '/(.*)tinymce\.init\s*\(\s*\{(.*?)\}\s*\)\s*;?(.*)/is'; - preg_match($pattern, $configuration, $matches); + // first try to find the configuration via the "subpart" ###TINYMCE_INIT### + $pattern = '/(.*)?tinymce\.init\s*\(\s*\{\s*\/\*\s?###TINYMCE_INIT###.*?\*\/(.*)\/\*\s*###TINYMCE_INIT###.*?\*\/\s*\}\s*\);*(.*)?/is'; + if (@preg_match($pattern, $configuration, $matches)) { + // fine :) + } else { + // if nothing is found, try it the legacy way (note: this may cause problems with a complex setups, since parenthesis-matching is not perfect here) + $pattern = '/(.*)tinymce\.init\s*\(\s*\{(.*?)\}\s*\)\s*;?(.*)/is'; + preg_match($pattern, $configuration, $matches); + } // add preJS and postJS $configurationArray['preJS'] = trim($matches[1]);