| @@ -1,12 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | 2 | /** |
| 4 | 3 | * A base shortcode for all lockers |
| 5 | 4 | * |
| 6 | 5 | * @since 1.0.0 |
| 7 | 6 | */ |
| 8 | -class WINP_SnippetShortcode extends Wbcr_FactoryShortcodes325_Shortcode { | |
| 7 | + | |
| 8 | +// Exit if accessed directly | |
| 9 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | + exit; | |
| 11 | +} | |
| 12 | + | |
| 13 | +class WINP_SnippetShortcode extends Wbcr_FactoryShortcodes329_Shortcode { | |
| 9 | 14 | |
| 10 | 15 | public $shortcode_name = 'wbcr_php_snippet'; |
| 11 | 16 | |
| 12 | 17 | /** |
| @@ -105,15 +110,17 @@ | ||
| 105 | 110 | |
| 106 | 111 | /** |
| 107 | 112 | * Get snippet content |
| 108 | 113 | * |
| 109 | - * @param $snippet_meta | |
| 110 | - * @param $id | |
| 114 | + * @param WP_Post $snippet | |
| 115 | + * @param array $snippet_meta | |
| 116 | + * @param int $id | |
| 111 | 117 | * |
| 112 | 118 | * @return null|string |
| 113 | 119 | */ |
| 114 | - public function getSnippetContent( $snippet_meta, $id ) { | |
| 115 | - return isset( $snippet_meta[ $this->plugin->getPrefix() . 'snippet_code' ] ) ? WINP_Plugin::app()->getExecuteObject()->prepareCode( $snippet_meta[ $this->plugin->getPrefix() . 'snippet_code' ][0], $id ) : null; | |
| 120 | + public function getSnippetContent( $snippet, $snippet_meta, $id ) { | |
| 121 | + $snippet_code = WINP_Helper::get_snippet_code($snippet); | |
| 122 | + return WINP_Plugin::app()->getExecuteObject()->prepareCode( $snippet_code, $id ); | |
| 116 | 123 | } |
| 117 | 124 | |
| 118 | 125 | /** |
| 119 | 126 | * Content render |
| @@ -119,10 +126,11 @@ | ||
| 119 | 126 | * Content render |
| 120 | 127 | * |
| 121 | 128 | * @param array $attr |
| 122 | 129 | * @param string $content |
| 130 | + * @param string $tag | |
| 123 | 131 | */ |
| 124 | - public function html( $attr, $content ) { | |
| 132 | + public function html( $attr, $content, $tag ) { | |
| 125 | 133 | |
| 126 | 134 | } |
| 127 | 135 | |
| 128 | 136 | } |