PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / trunk
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts vtrunk
2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 2.6.1 2.7.0 All 28 releases
← All changes | includes/shortcodes/shortcode-universal.php +13 -2 2.7.0trunk View file →
@@ -22,10 +22,12 @@
22 22 public function html( $attr, $content, $tag ) {
23 23 $id = $this->get_snippet_id( $attr, WINP_SNIPPET_TYPE_UNIVERSAL );
24 24
25 25 if ( ! $id ) {
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>';
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
@@ -61,7 +63,16 @@
61 63
62 64 // Track shortcode execution.
63 65 WINP_Plugin::app()->get_execute_object()->track_shortcode_snippet( $id );
64 66
67 + // Initialize error handler.
68 + WINP_Error_Handler::init();
69 +
70 + // Set current snippet context for error handler.
71 + WINP_Error_Handler::set_current_snippet( $id, $snippet->post_title, $snippet_content );
72 +
65 73 eval( '?>' . $snippet_content . '<?php ' );
74 +
75 + // Clear snippet context after execution.
76 + WINP_Error_Handler::clear_current_snippet();
66 77 }
67 78 }