| @@ -67,9 +67,9 @@ | ||
| 67 | 67 | |
| 68 | 68 | foreach ($settings as &$setting) { |
| 69 | 69 | if ($viewOnly && Arr::get($setting, 'type') === 'block' && !empty($setting['content'])) { |
| 70 | 70 | $user = Helper::getCurrentUser(); |
| 71 | - $content = apply_filters('the_content', $setting['content']); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound | |
| 71 | + $content = self::renderBlockContent($setting['content']); | |
| 72 | 72 | $setting['content'] = (new SmartCodeParser())->parse($content, $user); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if (Arr::get($setting, 'type') == 'image' && empty($setting['new_tab'])) { |
| @@ -77,8 +77,26 @@ | ||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return apply_filters('fluent_community/lockscreen_fields', $settings, $space); |
| 81 | + } | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * Renders without the_content: a space admin need not hold unfiltered_html, and | |
| 85 | + * the_content's do_shortcode pass would run their shortcodes for every visitor. | |
| 86 | + */ | |
| 87 | + protected static function renderBlockContent($content) | |
| 88 | + { | |
| 89 | + $rendered = do_blocks(strip_shortcodes($content)); | |
| 90 | + | |
| 91 | + // Core skips wpautop for block content to avoid mangling it. | |
| 92 | + if (!has_blocks($content)) { | |
| 93 | + $rendered = wpautop($rendered); | |
| 94 | + } | |
| 95 | + | |
| 96 | + $rendered = wptexturize($rendered); | |
| 97 | + | |
| 98 | + return wp_filter_content_tags($rendered); | |
| 81 | 99 | } |
| 82 | 100 | |
| 83 | 101 | public static function formatLockscreenFields($settingFields, $space) |
| 84 | 102 | { |