| @@ -19,13 +19,12 @@ | ||
| 19 | 19 | * @param string $content |
| 20 | 20 | * @param string $tag |
| 21 | 21 | */ |
| 22 | 22 | public function html( $attr, $content, $tag ) { |
| 23 | - $id = $this->get_snippet_id( $attr, WINP_SNIPPET_TYPE_CSS ); | |
| 23 | + $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_CSS ); | |
| 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 | + echo '<span style="color:red">' . __( '[' . esc_html( $tag ) . ']: PHP snippets error (not passed the snippet ID)', 'insert-php' ) . '</span>'; | |
| 28 | 27 | |
| 29 | 28 | return; |
| 30 | 29 | } |
| 31 | 30 | |
| @@ -35,25 +34,23 @@ | ||
| 35 | 34 | if ( ! $snippet || empty( $snippet_meta ) ) { |
| 36 | 35 | return; |
| 37 | 36 | } |
| 38 | 37 | |
| 39 | - $attr = $this->filter_attributes( $attr, $id ); | |
| 38 | + $attr = $this->filterAttributes( $attr, $id ); | |
| 40 | 39 | |
| 41 | 40 | // Let users pass arbitrary variables, through shortcode attributes. |
| 42 | 41 | // @since 2.0.5 |
| 43 | 42 | extract( $attr, EXTR_SKIP ); |
| 44 | 43 | |
| 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 ); | |
| 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 ); | |
| 49 | 48 | |
| 50 | 49 | if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || ! $is_condition ) { |
| 51 | 50 | return; |
| 52 | 51 | } |
| 53 | 52 | |
| 54 | - // Track shortcode execution. | |
| 55 | - WINP_Plugin::app()->get_execute_object()->track_shortcode_snippet( $id ); | |
| 56 | - | |
| 57 | 53 | echo WINP_Execute_Snippet::getJsCssSnippetData( $id ); |
| 58 | 54 | } |
| 59 | -} | |
| 55 | + | |
| 56 | +} | |