@@ -321,15 +321,7 @@ function render($doc, $template, $removeChunk,$dateSource,$dateFormat,$customPla
321
321
function parseModifiers ($ tpl ,$ ph ,$ contentVars ){
322
322
global $ modx ;
323
323
if ($ modx ->config ['enable_filter ' ]) {
324
- $ content = $ tpl ;
325
- $ i = 0 ;
326
- while ($ i <10 ) {
327
- $ bt = $ content ;
328
- if (strpos ($ content ,'[+ ' )!==false ) $ content = $ modx ->parseText ($ content ,$ ph );
329
- else $ content = $ modx ->parseDocumentSource ($ content );
330
- if ($ bt ===$ content ) break ;
331
- $ i ++;
332
- }
324
+ $ content = $ this ->parseDocumentSource ($ tpl ,$ ph );
333
325
}
334
326
else {
335
327
foreach ($ ph as $ key =>$ content ) {
@@ -342,6 +334,38 @@ function parseModifiers($tpl,$ph,$contentVars){
342
334
return $ content ;
343
335
}
344
336
337
+ function parseDocumentSource ($ content ='' ,$ ph )
338
+ {
339
+ global $ modx ;
340
+
341
+ if (strpos ($ content ,'[ ' )===false && strpos ($ content ,'{ ' )===false ) return $ content ;
342
+
343
+ $ loopLimit = @ $ modx ->maxParserPasses ?: 10 ;
344
+ $ bt ='' ;
345
+ $ i =0 ;
346
+ while ($ bt !==$ content )
347
+ {
348
+ $ bt = $ content ;
349
+ if (strpos ($ content ,'[+ ' )!==false ) $ content = $ modx ->parseText ($ content ,$ ph );
350
+ if (strpos ($ content ,'[+ ' )!==false ) continue ;
351
+
352
+ if (strpos ($ content ,'[* ' )!==false && $ modx ->documentIdentifier )
353
+ $ content = $ modx ->mergeDocumentContent ($ content );
354
+ if (strpos ($ content ,'[+ ' )!==false && $ content !==$ bt ) continue ;
355
+ if (strpos ($ content ,'[( ' )!==false ) $ content = $ modx ->mergeSettingsContent ($ content );
356
+ if (strpos ($ content ,'[+ ' )!==false && $ content !==$ bt ) continue ;
357
+ if (strpos ($ content ,'{{ ' )!==false ) $ content = $ modx ->mergeChunkContent ($ content );
358
+ if (strpos ($ content ,'[+ ' )!==false && $ content !==$ bt ) continue ;
359
+ if (strpos ($ content ,'[! ' )!==false ) $ content = str_replace (array ('[! ' ,'!] ' ),array ('[[ ' ,']] ' ),$ content );
360
+ if (strpos ($ content ,'[[ ' )!==false ) $ content = $ modx ->evalSnippets ($ content );
361
+
362
+ if ($ content ===$ bt ) break ;
363
+ if ($ loopLimit < $ i ) break ;
364
+ $ i ++;
365
+ }
366
+ return $ content ;
367
+ }
368
+
345
369
// ---------------------------------------------------
346
370
// Function: parseFields
347
371
// Find the fields that are contained in the custom placeholders or those that are needed in other functions
0 commit comments