Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Jetpack_Testimonial_Textarea_Control | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| render_content | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| sanitize_content | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Helper class for the Jetpack Testimonial Textarea Control. |
| 4 | * |
| 5 | * @package automattic/jetpack-classic-theme-helper |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\Classic_Theme_Helper; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit( 0 ); |
| 12 | } |
| 13 | |
| 14 | if ( ! class_exists( __NAMESPACE__ . '\Jetpack_Testimonial_Textarea_Control' ) ) { |
| 15 | /** |
| 16 | * Extends the WP_Customize_Control class to clean the textarea content. |
| 17 | */ |
| 18 | class Jetpack_Testimonial_Textarea_Control extends \WP_Customize_Control { |
| 19 | /** |
| 20 | * Control type. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | public $type = 'textarea'; |
| 25 | |
| 26 | /** |
| 27 | * Render the control's content. |
| 28 | */ |
| 29 | public function render_content() { |
| 30 | ?> |
| 31 | <label> |
| 32 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 33 | <textarea rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea> |
| 34 | </label> |
| 35 | <?php |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Sanitize content passed to control. |
| 40 | * |
| 41 | * @param string $value Control value. |
| 42 | * @return string Sanitized value. |
| 43 | */ |
| 44 | public static function sanitize_content( $value ) { |
| 45 | if ( ! empty( $value ) ) { |
| 46 | $value = apply_filters( 'the_content', $value ); |
| 47 | } |
| 48 | $value = preg_replace( '@<div id="jp-post-flair"([^>]+)?>(.+)?</div>@is', '', $value ); |
| 49 | return $value; |
| 50 | } |
| 51 | } |
| 52 | } |