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 +32 -10 2.4.5trunk View file →
@@ -19,12 +19,15 @@
19 19 * @param string $content
20 20 * @param string $tag
21 21 */
22 22 public function html( $attr, $content, $tag ) {
23 - $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_UNIVERSAL );
23 + $id = $this->get_snippet_id( $attr, WINP_SNIPPET_TYPE_UNIVERSAL );
24 24
25 25 if ( ! $id ) {
26 - echo '<span style="color:red">' . __( '[' . esc_html( $tag ) . ']: PHP snippets error (not passed the snippet ID)', 'insert-php' ) . '</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 + }
27 30
28 31 return;
29 32 }
30 33
@@ -34,23 +37,42 @@
34 37 if ( ! $snippet || empty( $snippet_meta ) ) {
35 38 return;
36 39 }
37 40
38 - $attr = $this->filterAttributes( $attr, $id );
41 + $attr = $this->filter_attributes( $attr, $id );
39 42
40 43 // Let users pass arbitrary variables, through shortcode attributes.
41 44 // @since 2.0.5
42 45 extract( $attr, EXTR_SKIP );
43 46
44 - $is_activate = $this->getSnippetActivate( $snippet_meta );
45 - $snippet_content = $this->getSnippetContent( $snippet, $snippet_meta, $id );
46 - $snippet_scope = $this->getSnippetScope( $snippet_meta );
47 - $is_condition = WINP_Plugin::app()->getExecuteObject()->checkCondition( $id );
47 + $is_activate = $this->get_snippet_activate( $snippet_meta );
48 + $snippet_content = $this->get_snippet_content( $snippet, $snippet_meta, $id );
49 + $snippet_scope = $this->get_snippet_scope( $snippet_meta );
50 + $is_condition = WINP_Plugin::app()->get_execute_object()->checkCondition( $id );
48 51
49 52 if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || ! $is_condition || WINP_Helper::is_safe_mode() ) {
50 53 return;
51 54 }
52 55
53 - eval( "?>" . $snippet_content . "<?php " );
56 + if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) {
57 + if ( is_user_logged_in() && WINP_Plugin::app()->current_user_car() ) {
58 + echo esc_html__( 'This Woody snippet cannot run because unfiltered HTML insertion is disabled.', 'insert-php' );
59 + }
60 +
61 + return;
62 + }
63 +
64 + // Track shortcode execution.
65 + WINP_Plugin::app()->get_execute_object()->track_shortcode_snippet( $id );
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 +
73 + eval( '?>' . $snippet_content . '<?php ' );
74 +
75 + // Clear snippet context after execution.
76 + WINP_Error_Handler::clear_current_snippet();
54 77 }
55 -
56 -}
78 +}