| @@ -21,11 +21,13 @@ | ||
| 21 | 21 | */ |
| 22 | 22 | public function html( $attr, $content, $tag ) { |
| 23 | 23 | $id = $this->get_snippet_id( $attr, WINP_SNIPPET_TYPE_UNIVERSAL ); |
| 24 | 24 | |
| 25 | - if ( ! $id && ( current_user_can( 'manage_options' ) || ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ) ) { | |
| 26 | - /* translators: %s: Shortcode tag name */ | |
| 27 | - echo '<span style="color:red">' . sprintf( esc_html__( '[%s]: PHP snippets error (not passed the snippet ID)', 'insert-php' ), esc_html( $tag ) ) . '</span>'; | |
| 25 | + if ( ! $id ) { | |
| 26 | + if ( current_user_can( 'manage_options' ) || ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ) { | |
| 27 | + /* translators: %s: Shortcode tag name */ | |
| 28 | + echo '<span style="color:red">' . sprintf( esc_html__( '[%s]: PHP snippets error (not passed the snippet ID)', 'insert-php' ), esc_html( $tag ) ) . '</span>'; | |
| 29 | + } | |
| 28 | 30 | |
| 29 | 31 | return; |
| 30 | 32 | } |
| 31 | 33 | |
| @@ -66,8 +68,13 @@ | ||
| 66 | 68 | WINP_Error_Handler::init(); |
| 67 | 69 | |
| 68 | 70 | // Set current snippet context for error handler. |
| 69 | 71 | WINP_Error_Handler::set_current_snippet( $id, $snippet->post_title, $snippet_content ); |
| 72 | + | |
| 73 | + $redeclaration_output = $this->render_redeclaration_error( $snippet_content, WINP_SNIPPET_TYPE_UNIVERSAL ); | |
| 74 | + if ( null !== $redeclaration_output ) { | |
| 75 | + return $redeclaration_output; | |
| 76 | + } | |
| 70 | 77 | |
| 71 | 78 | eval( '?>' . $snippet_content . '<?php ' ); |
| 72 | 79 | |
| 73 | 80 | // Clear snippet context after execution. |