| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | exit; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | class WINP_SnippetShortcodeText extends WINP_SnippetShortcode { |
| 12 | - | |
| 12 | + | |
| 13 | 13 | public $shortcode_name = 'wbcr_text_snippet'; |
| 14 | - | |
| 14 | + | |
| 15 | 15 | /** |
| 16 | 16 | * Content render |
| 17 | 17 | * |
| 18 | 18 | * @param array $attr |
| @@ -21,39 +21,29 @@ | ||
| 21 | 21 | */ |
| 22 | 22 | public function html( $attr, $content, $tag ) { |
| 23 | 23 | $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_TEXT ); |
| 24 | 24 | |
| 25 | - if ( ! $id ) { | |
| 26 | - echo '<span style="color:red">' . __( '[' . esc_html( $tag ) . ']: Text snippets error (not passed the snippet ID)', 'insert-php' ) . '</span>'; | |
| 25 | + if( !$id ) { | |
| 26 | + echo '<span style="color:red">' . __('[' . esc_html( $tag ) . ']: Text snippets error (not passed the snippet ID)', 'insert-php') . '</span>'; | |
| 27 | 27 | |
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | - | |
| 30 | + | |
| 31 | 31 | $snippet = get_post( $id ); |
| 32 | 32 | $snippet_meta = get_post_meta( $id, '' ); |
| 33 | - | |
| 33 | + | |
| 34 | 34 | if ( ! $snippet || empty( $snippet_meta ) ) { |
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | - | |
| 37 | + | |
| 38 | 38 | $is_activate = $this->getSnippetActivate( $snippet_meta ); |
| 39 | 39 | $snippet_scope = $this->getSnippetScope( $snippet_meta ); |
| 40 | 40 | $is_condition = WINP_Plugin::app()->getExecuteObject()->checkCondition( $id ); |
| 41 | - | |
| 41 | + | |
| 42 | 42 | if ( ! $is_activate || $snippet_scope != 'shortcode' || ! $is_condition ) { |
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | - | |
| 46 | - $post_content = $snippet->post_content; | |
| 47 | - if ( WINP_Plugin::app()->getOption( 'execute_shortcode' ) ) { | |
| 48 | - $post_content = do_shortcode( $post_content ); | |
| 49 | - } | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * Shortcode content filter | |
| 53 | - * @since 2.4.4 | |
| 54 | - */ | |
| 55 | - $post_content = apply_filters('wbcr/inp/snippet/shortcode_text/post_content', $post_content, $id); | |
| 56 | - | |
| 57 | - echo str_replace( '{{SNIPPET_CONTENT}}', $content, $post_content ); | |
| 45 | + | |
| 46 | + echo str_replace( '{{SNIPPET_CONTENT}}', $content, do_shortcode( $snippet->post_content ) ); | |
| 58 | 47 | } |
| 48 | + | |
| 59 | 49 | } |