@@ -240,7 +240,7 @@ protected function convert_boolean_attribute_flags( array $atts, array $boolean_
240240 *
241241 * @return string Evaluated shortcode content.
242242 */
243- protected function evaluate_shortcode_content ( Snippet $ snippet , array $ atts ): string {
243+ protected function evaluate_shortcode_content ( Snippet $ snippet , array $ atts ): string {
244244 if ( empty ( $ atts ['php ' ] ) ) {
245245 return $ snippet ->code ;
246246 }
@@ -332,19 +332,20 @@ public function render_content_shortcode( array $atts ): string {
332332
333333 // Recursion depth is limited to prevent infinite loops.
334334 static $ depth = 0 ;
335- $ max_depth = self ::MAX_SHORTCODE_DEPTH ;
336335
337336 // Find the shortcode in the content and replace it with the evaluated content.
338337 $ content = preg_replace_callback (
339- '/\[ ' . self ::CONTENT_SHORTCODE . '([^\ ]]*)\ ]/ ' ,
340- function ($ matches ) use (&$ depth, $ max_depth ) {
341- if ($ depth >= $ max_depth ) {
338+ '/\[ ' . self ::CONTENT_SHORTCODE . '([^]]*)]/ ' ,
339+ function ( $ matches ) use ( &$ depth ) {
340+ if ( $ depth >= self :: MAX_SHORTCODE_DEPTH ) {
342341 return '<!-- Max shortcode depth reached --> ' ;
343342 }
343+
344344 $ depth ++;
345- $ atts = shortcode_parse_atts ($ matches [1 ]);
346- $ result = $ this ->render_content_shortcode ($ atts );
345+ $ atts = shortcode_parse_atts ( $ matches [1 ] );
346+ $ result = $ this ->render_content_shortcode ( $ atts );
347347 $ depth --;
348+
348349 return $ result ;
349350 },
350351 $ content
0 commit comments