# insert-php/2.4.4/includes/shortcodes/shortcode-text.php

Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts, version 2.4.4. 54 lines.

- Page: https://pluginprobe.com/plugins/insert-php/2.4.4/code/includes/shortcodes/shortcode-text.php
- Raw: https://pluginprobe.com/plugins/insert-php/2.4.4/raw/includes/shortcodes/shortcode-text.php
- Modified: 2022-05-26T12:45:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/insert-php/2.4.4/code/includes/shortcodes/shortcode-text.php#L10-L20`.

```php
<?php
/**
 * Text Shortcode
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class WINP_SnippetShortcodeText extends WINP_SnippetShortcode {
	
	public $shortcode_name = 'wbcr_text_snippet';
	
	/**
	 * Content render
	 *
	 * @param array $attr
	 * @param string $content
	 * @param string $tag
	 */
	public function html( $attr, $content, $tag ) {
		$id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_TEXT );

		if( !$id ) {
			echo '<span style="color:red">' . __('[' . esc_html( $tag ) . ']: Text snippets error (not passed the snippet ID)', 'insert-php') . '</span>';

			return;
		}
		
		$snippet      = get_post( $id );
		$snippet_meta = get_post_meta( $id, '' );
		
		if ( ! $snippet || empty( $snippet_meta ) ) {
			return;
		}
		
		$is_activate   = $this->getSnippetActivate( $snippet_meta );
		$snippet_scope = $this->getSnippetScope( $snippet_meta );
		$is_condition  = WINP_Plugin::app()->getExecuteObject()->checkCondition( $id );
		
		if ( ! $is_activate || $snippet_scope != 'shortcode' || ! $is_condition ) {
			return;
		}

		$post_content = $snippet->post_content;
		if ( WINP_Plugin::app()->getOption( 'execute_shortcode' ) ) {
			$post_content = do_shortcode( $post_content );
		}

		echo str_replace( '{{SNIPPET_CONTENT}}', $content, $post_content );
	}
	
}
```
