PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.6.1
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.6.1
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 2.7.1 All 27 releases
← All changes | includes/shortcodes/shortcode-php.php +12 -24 trunk2.6.1 View file →
@@ -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_PHP );
23 + $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_PHP );
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,41 +34,30 @@
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_scope = $this->get_snippet_scope( $snippet_meta );
47 - $snippet_content = $this->get_snippet_content( $snippet, $snippet_meta, $id );
44 + $is_activate = $this->getSnippetActivate( $snippet_meta );
45 + $snippet_scope = $this->getSnippetScope( $snippet_meta );
46 + $snippet_content = $this->getSnippetContent( $snippet, $snippet_meta, $id );
48 47
49 48 if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || WINP_Helper::is_safe_mode() ) {
50 49 return;
51 50 }
52 51
53 - if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) {
54 - if ( is_user_logged_in() && WINP_Plugin::app()->current_user_car() ) {
55 - echo esc_html__( 'This Woody snippet cannot run because unfiltered HTML insertion is disabled.', 'insert-php' );
52 + if( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) {
53 + if ( is_user_logged_in() && WINP_Plugin::app()->currentUserCan() ) {
54 + echo __( '[Woody snippet cannot be executed because you have disabled the insertion of unfiltered html!]', 'insert-php' );
56 55 }
57 56
58 57 return;
59 58 }
60 59
61 - // Track shortcode execution.
62 - WINP_Plugin::app()->get_execute_object()->track_shortcode_snippet( $id );
63 -
64 - // Initialize error handler.
65 - WINP_Error_Handler::init();
66 -
67 - // Set current snippet context for error handler.
68 - WINP_Error_Handler::set_current_snippet( $id, $snippet->post_title, $snippet_content );
69 -
70 60 eval( $snippet_content );
61 + }
71 62
72 - // Clear snippet context after execution.
73 - WINP_Error_Handler::clear_current_snippet();
74 - }
75 -}
63 +}