Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
77.78% |
7 / 9 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| CSS_Nudge_Customize_Control | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| render_content | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * CSS_Nudge_Customize_Control file. |
| 4 | * CSS Nudge implementation for Atomic and WPCOM. |
| 5 | * |
| 6 | * @package automattic/jetpack-masterbar |
| 7 | */ |
| 8 | |
| 9 | namespace Automattic\Jetpack\Masterbar; |
| 10 | |
| 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | exit( 0 ); |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Class CSS_Nudge_Customize_Control |
| 17 | */ |
| 18 | class CSS_Nudge_Customize_Control extends \WP_Customize_Control { |
| 19 | |
| 20 | /** |
| 21 | * The type of the nudge. |
| 22 | * |
| 23 | * @var string |
| 24 | */ |
| 25 | public $type = 'cssNudge'; |
| 26 | |
| 27 | /** |
| 28 | * The Call to Action URL. |
| 29 | * |
| 30 | * @var string |
| 31 | */ |
| 32 | public $cta_url; |
| 33 | |
| 34 | /** |
| 35 | * The nudge text displayed. |
| 36 | * |
| 37 | * @var string |
| 38 | */ |
| 39 | public $nudge_copy; |
| 40 | |
| 41 | /** |
| 42 | * Render the nudge on the page. |
| 43 | */ |
| 44 | public function render_content() { |
| 45 | $cta_url = $this->cta_url; |
| 46 | $nudge_copy = $this->nudge_copy; |
| 47 | $nudge_button_copy = __( 'Upgrade now', 'jetpack-masterbar' ); |
| 48 | |
| 49 | echo '<div class="nudge-container"> |
| 50 | <p> |
| 51 | ' . wp_kses( $nudge_copy, array( 'br' => array() ) ) . ' |
| 52 | </p> |
| 53 | <div class="button-container"> |
| 54 | <button type="button" class="button-primary navigate-to" data-navigate-to-page="' . esc_url( $cta_url ) . '">' . esc_html( $nudge_button_copy ) . '</button> |
| 55 | </div> |
| 56 | </div>'; |
| 57 | } |
| 58 | } |