| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly. |
| 2 |
// phpcs:ignoreFile WordPress.Security.EscapeOutput.OutputNotEscaped |
| 3 |
/** |
| 4 |
* |
| 5 |
* Field: textarea |
| 6 |
* |
| 7 |
* @since 1.0.0 |
| 8 |
* @version 1.0.0 |
| 9 |
* |
| 10 |
*/ |
| 11 |
if ( ! class_exists( 'CSF_Field_textarea' ) ) { |
| 12 |
class CSF_Field_textarea extends CSF_Fields { |
| 13 |
|
| 14 |
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) { |
| 15 |
parent::__construct( $field, $value, $unique, $where, $parent ); |
| 16 |
} |
| 17 |
|
| 18 |
public function render() { |
| 19 |
|
| 20 |
echo $this->field_before(); |
| 21 |
echo $this->shortcoder(); |
| 22 |
echo '<textarea name="'. esc_attr( $this->field_name() ) .'"'. $this->field_attributes() .'>'. $this->value .'</textarea>'; |
| 23 |
echo $this->field_after(); |
| 24 |
|
| 25 |
} |
| 26 |
|
| 27 |
public function shortcoder() { |
| 28 |
|
| 29 |
if ( ! empty( $this->field['shortcoder'] ) ) { |
| 30 |
|
| 31 |
$instances = ( is_array( $this->field['shortcoder'] ) ) ? $this->field['shortcoder'] : array_filter( (array) $this->field['shortcoder'] ); |
| 32 |
|
| 33 |
foreach ( $instances as $instance_key ) { |
| 34 |
|
| 35 |
if ( isset( CSF::$shortcode_instances[$instance_key] ) ) { |
| 36 |
|
| 37 |
$button_title = CSF::$shortcode_instances[$instance_key]['button_title']; |
| 38 |
|
| 39 |
echo '<a href="#" class="button button-primary csf-shortcode-button" data-modal-id="'. esc_attr( $instance_key ) .'">'. $button_title .'</a>'; |
| 40 |
|
| 41 |
} |
| 42 |
|
| 43 |
} |
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
} |
| 48 |
} |
| 49 |
} |
| 50 |
|