| @@ -80,20 +80,11 @@ | ||
| 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 | - | |
| 88 | 84 | ob_start(); |
| 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 | - | |
| 85 | + $this->html( $attr, $content ?? '', $tag ); | |
| 86 | + $html = ob_get_clean(); | |
| 96 | 87 | return false !== $html ? $html : ''; |
| 97 | 88 | } |
| 98 | 89 | |
| 99 | 90 | /** |
| @@ -160,20 +151,10 @@ | ||
| 160 | 151 | */ |
| 161 | 152 | public function get_snippet_id( $attr, $type ) { |
| 162 | 153 | $id = isset( $attr['id'] ) ? (int) $attr['id'] : null; |
| 163 | 154 | |
| 164 | - $snippet_type = null; | |
| 165 | - | |
| 166 | - // Only resolve snippet type when a valid (truthy) ID is provided to avoid | |
| 167 | - // unnecessary request parsing or database lookups for invalid IDs. | |
| 168 | - if ( $id ) { | |
| 169 | - $snippet_type = WINP_Helper::get_snippet_type( $id ); | |
| 170 | - | |
| 171 | - // Security: Reject if get_snippet_type() returned false (invalid post type) | |
| 172 | - // or if the snippet type doesn't match the expected type. | |
| 173 | - if ( false === $snippet_type || $snippet_type !== $type ) { | |
| 174 | - $id = 0; | |
| 175 | - } | |
| 155 | + if ( $id && WINP_Helper::get_snippet_type( $id ) !== $type ) { | |
| 156 | + $id = 0; | |
| 176 | 157 | } |
| 177 | 158 | |
| 178 | 159 | return $id; |
| 179 | 160 | } |
| @@ -235,9 +216,9 @@ | ||
| 235 | 216 | * @param array<string, mixed> $attr Shortcode attributes. |
| 236 | 217 | * @param string $content Shortcode content. |
| 237 | 218 | * @param string $tag Shortcode tag. |
| 238 | 219 | * |
| 239 | - * @return mixed Rendered content when returned directly, if any. | |
| 220 | + * @return void | |
| 240 | 221 | */ |
| 241 | 222 | public function html( $attr, $content, $tag ) { |
| 242 | 223 | } |
| 243 | 224 | } |