PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.2.7
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.2.7
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-html.php +57 -63 2.6.02.2.7 View file →
@@ -1,64 +1,58 @@
1 -<?php
2 -/**
3 - * Universal Shortcode
4 - */
5 -
6 -// Exit if accessed directly
7 -if ( ! defined( 'ABSPATH' ) ) {
8 - exit;
9 -}
10 -
11 -class WINP_SnippetShortcodeHtml extends WINP_SnippetShortcode {
12 -
13 - public $shortcode_name = 'wbcr_html_snippet';
14 -
15 - /**
16 - * Content render
17 - *
18 - * @param array $attr
19 - * @param string $content
20 - * @param string $tag
21 - */
22 - public function html( $attr, $content, $tag ) {
23 - $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_HTML );
24 -
25 - if ( ! $id ) {
26 - echo '<span style="color:red">' . __( '[' . esc_html( $tag ) . ']: PHP snippets error (not passed the snippet ID)', 'insert-php' ) . '</span>';
27 -
28 - return;
29 - }
30 -
31 - $snippet = get_post( $id );
32 - $snippet_meta = get_post_meta( $id, '' );
33 -
34 - if ( ! $snippet || empty( $snippet_meta ) ) {
35 - return;
36 - }
37 -
38 - $attr = $this->filterAttributes( $attr, $id );
39 -
40 - // Let users pass arbitrary variables, through shortcode attributes.
41 - // @since 2.0.5
42 - extract( $attr, EXTR_SKIP );
43 -
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 );
48 -
49 - if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || ! $is_condition ) {
50 - return;
51 - }
52 -
53 - if( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) {
54 - if ( is_user_logged_in() && WINP_Plugin::app()->currentUserCan() ) {
55 - echo __( '[Woody snippet cannot be executed because you have disabled the insertion of unfiltered html!]', 'insert-php' );
56 - }
57 -
58 - return;
59 - }
60 -
61 - echo( $snippet_content );
62 - }
63 -
1 +<?php
2 +/**
3 + * Universal Shortcode
4 + */
5 +
6 +// Exit if accessed directly
7 +if ( ! defined( 'ABSPATH' ) ) {
8 + exit;
9 +}
10 +
11 +class WINP_SnippetShortcodeHtml extends WINP_SnippetShortcode {
12 +
13 + public $shortcode_name = 'wbcr_html_snippet';
14 +
15 + /**
16 + * Content render
17 + *
18 + * @param array $attr
19 + * @param string $content
20 + * @param string $tag
21 + */
22 + public function html( $attr, $content, $tag ) {
23 + $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_HTML );
24 +
25 + if ( ! $id ) {
26 + echo '<span style="color:red">' . __( '[' . esc_html( $tag ) . ']: PHP snippets error (not passed the snippet ID)', 'insert-php' ) . '</span>';
27 +
28 + return;
29 + }
30 +
31 + $snippet = get_post( $id );
32 + $snippet_meta = get_post_meta( $id, '' );
33 +
34 + if ( ! $snippet || empty( $snippet_meta ) ) {
35 + return;
36 + }
37 +
38 + $attr = $this->filterAttributes( $attr, $id );
39 +
40 + // Let users pass arbitrary variables, through shortcode attributes.
41 + // @since 2.0.5
42 + extract( $attr, EXTR_SKIP );
43 +
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 );
48 +
49 + if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || ! $is_condition ) {
50 + return;
51 + }
52 +
53 + $code = do_shortcode( $snippet_content );
54 +
55 + echo( $code );
56 + }
57 +
64 58 }