| @@ -19,12 +19,13 @@ | ||
| 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 | + /* 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>'; | |
| 27 | 28 | |
| 28 | 29 | return; |
| 29 | 30 | } |
| 30 | 31 | |
| @@ -34,23 +35,33 @@ | ||
| 34 | 35 | if ( ! $snippet || empty( $snippet_meta ) ) { |
| 35 | 36 | return; |
| 36 | 37 | } |
| 37 | 38 | |
| 38 | - $attr = $this->filterAttributes( $attr, $id ); | |
| 39 | + $attr = $this->filter_attributes( $attr, $id ); | |
| 39 | 40 | |
| 40 | 41 | // Let users pass arbitrary variables, through shortcode attributes. |
| 41 | 42 | // @since 2.0.5 |
| 42 | 43 | extract( $attr, EXTR_SKIP ); |
| 43 | 44 | |
| 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 ); | |
| 45 | + $is_activate = $this->get_snippet_activate( $snippet_meta ); | |
| 46 | + $snippet_content = $this->get_snippet_content( $snippet, $snippet_meta, $id ); | |
| 47 | + $snippet_scope = $this->get_snippet_scope( $snippet_meta ); | |
| 48 | + $is_condition = WINP_Plugin::app()->get_execute_object()->checkCondition( $id ); | |
| 48 | 49 | |
| 49 | 50 | if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || ! $is_condition || WINP_Helper::is_safe_mode() ) { |
| 50 | 51 | return; |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | - eval( "?>" . $snippet_content . "<?php " ); | |
| 54 | + if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) { | |
| 55 | + if ( is_user_logged_in() && WINP_Plugin::app()->current_user_car() ) { | |
| 56 | + echo esc_html__( 'This Woody snippet cannot run because unfiltered HTML insertion is disabled.', 'insert-php' ); | |
| 57 | + } | |
| 58 | + | |
| 59 | + return; | |
| 60 | + } | |
| 61 | + | |
| 62 | + // Track shortcode execution. | |
| 63 | + WINP_Plugin::app()->get_execute_object()->track_shortcode_snippet( $id ); | |
| 64 | + | |
| 65 | + eval( '?>' . $snippet_content . '<?php ' ); | |
| 54 | 66 | } |
| 55 | - | |
| 56 | -} | |
| 67 | +} | |