| @@ -80,11 +80,20 @@ | ||
| 80 | 80 | * |
| 81 | 81 | * @return string |
| 82 | 82 | */ |
| 83 | 83 | public function render( $attr, $content, $tag ) { |
| 84 | + if ( WINP_Helper::is_safe_mode() ) { | |
| 85 | + return ''; | |
| 86 | + } | |
| 87 | + | |
| 84 | 88 | ob_start(); |
| 85 | - $this->html( $attr, $content ?? '', $tag ); | |
| 86 | - $html = ob_get_clean(); | |
| 89 | + $result = $this->html( $attr, $content ?? '', $tag ); | |
| 90 | + $html = ob_get_clean(); | |
| 91 | + | |
| 92 | + if ( is_string( $result ) ) { | |
| 93 | + $html = ( false !== $html ? $html : '' ) . $result; | |
| 94 | + } | |
| 95 | + | |
| 87 | 96 | return false !== $html ? $html : ''; |
| 88 | 97 | } |
| 89 | 98 | |
| 90 | 99 | /** |
| @@ -226,9 +235,9 @@ | ||
| 226 | 235 | * @param array<string, mixed> $attr Shortcode attributes. |
| 227 | 236 | * @param string $content Shortcode content. |
| 228 | 237 | * @param string $tag Shortcode tag. |
| 229 | 238 | * |
| 230 | - * @return void | |
| 239 | + * @return mixed Rendered content when returned directly, if any. | |
| 231 | 240 | */ |
| 232 | 241 | public function html( $attr, $content, $tag ) { |
| 233 | 242 | } |
| 234 | 243 | } |