| @@ -31,12 +31,12 @@ | ||
| 31 | 31 | public function __construct() { |
| 32 | 32 | |
| 33 | 33 | parent::__construct( |
| 34 | 34 | 'convertkit_form', |
| 35 | - __( 'ConvertKit Form (Legacy Widget)', 'convertkit' ), | |
| 35 | + __( 'Kit Form (Legacy Widget)', 'convertkit' ), | |
| 36 | 36 | array( |
| 37 | 37 | 'classname' => 'convertkit widget_convertkit_form', |
| 38 | - 'description' => __( 'Display a ConvertKit form.', 'convertkit' ), | |
| 38 | + 'description' => __( 'Display a Kit form.', 'convertkit' ), | |
| 39 | 39 | 'customize_selective_refresh' => true, |
| 40 | 40 | ) |
| 41 | 41 | ); |
| 42 | 42 | |
| @@ -57,9 +57,9 @@ | ||
| 57 | 57 | // Bail if no Forms exist. |
| 58 | 58 | if ( ! $forms->exist() ) { |
| 59 | 59 | ?> |
| 60 | 60 | <p> |
| 61 | - <?php esc_html_e( 'To display a ConvertKit Form, at least one form must be defined in your ConvertKit Account.', 'convertkit' ); ?> | |
| 61 | + <?php esc_html_e( 'To display a Kit Form, at least one form must be defined in your Kit Account.', 'convertkit' ); ?> | |
| 62 | 62 | </p> |
| 63 | 63 | <?php |
| 64 | 64 | } |
| 65 | 65 | |
| @@ -76,19 +76,18 @@ | ||
| 76 | 76 | <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" value="<?php esc_attr( $instance['title'] ); ?>" /> |
| 77 | 77 | </p> |
| 78 | 78 | <p> |
| 79 | 79 | <label for="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>"><?php esc_html_e( 'Form', 'convertkit' ); ?></label> |
| 80 | - <select name="<?php echo esc_attr( $this->get_field_name( 'form' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>" size="1"> | |
| 81 | - <?php | |
| 82 | - foreach ( $forms->get() as $form ) { | |
| 83 | - ?> | |
| 84 | - <option value="<?php echo esc_attr( $form['id'] ); ?>"<?php selected( $form['id'], $instance['form'] ); ?>> | |
| 85 | - <?php echo esc_attr( $form['name'] ); ?> | |
| 86 | - </option> | |
| 87 | - <?php | |
| 88 | - } | |
| 89 | - ?> | |
| 90 | - </select> | |
| 80 | + <?php | |
| 81 | + echo $forms->get_select_field_all( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 82 | + esc_attr( $this->get_field_name( 'form' ) ), | |
| 83 | + esc_attr( $this->get_field_id( 'form' ) ), | |
| 84 | + array( | |
| 85 | + 'widefat', | |
| 86 | + ), | |
| 87 | + esc_attr( $instance['form'] ) | |
| 88 | + ); | |
| 89 | + ?> | |
| 91 | 90 | </p> |
| 92 | 91 | <?php |
| 93 | 92 | |
| 94 | 93 | return ''; |
| @@ -120,9 +119,10 @@ | ||
| 120 | 119 | } |
| 121 | 120 | |
| 122 | 121 | // Output Form. |
| 123 | 122 | // $args already escaped as supplied by WordPress, so we don't need to escape them again. |
| 124 | - // phpcs:disable WordPress.Security.EscapeOutput | |
| 123 | + // $form could be a script or legacy form with varying HTML, so we don't want to escape it. | |
| 124 | + // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 125 | 125 | echo $args['before_widget']; |
| 126 | 126 | if ( $instance['title'] ) { |
| 127 | 127 | echo $args['before_title']; |
| 128 | 128 | echo esc_attr( $instance['title'] ); |