pronamic /
wp-pronamic-ideal
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Forms template. |
||
| 4 | * |
||
| 5 | * @author Pronamic <[email protected]> |
||
| 6 | * @copyright 2005-2019 Pronamic |
||
| 7 | * @license GPL-3.0-or-later |
||
| 8 | * @package Pronamic\WordPress\Pay |
||
| 9 | */ |
||
| 10 | |||
| 11 | global $pronamic_pay_errors; |
||
| 12 | |||
| 13 | use Pronamic\WordPress\Money\Money; |
||
| 14 | use Pronamic\WordPress\Pay\Core\PaymentMethods; |
||
| 15 | use Pronamic\WordPress\Pay\Forms\FormPostType; |
||
| 16 | use Pronamic\WordPress\Pay\Forms\FormsSource; |
||
|
0 ignored issues
–
show
|
|||
| 17 | use Pronamic\WordPress\Pay\Plugin; |
||
| 18 | use Pronamic\WordPress\Pay\Util; |
||
| 19 | |||
| 20 | $methods_with_choices = array( |
||
| 21 | \Pronamic\WordPress\Pay\Forms\FormPostType::AMOUNT_METHOD_CHOICES_ONLY, |
||
| 22 | \Pronamic\WordPress\Pay\Forms\FormPostType::AMOUNT_METHOD_CHOICES_AND_INPUT, |
||
| 23 | ); |
||
| 24 | |||
| 25 | $gateway = Plugin::get_gateway( $settings['config_id'] ); |
||
| 26 | |||
| 27 | $amount_value = ''; |
||
| 28 | |||
| 29 | if ( filter_has_var( INPUT_GET, 'amount' ) ) { |
||
| 30 | $amount_value = filter_input( INPUT_GET, 'amount', FILTER_SANITIZE_STRING ); |
||
| 31 | } |
||
| 32 | |||
| 33 | if ( $gateway ) : ?> |
||
| 34 | |||
| 35 | <div class="pronamic-pay-form-wrap"> |
||
| 36 | |||
| 37 | <?php if ( ! is_singular( 'pronamic_pay_form' ) && ! empty( $settings['title'] ) ) : ?> |
||
| 38 | |||
| 39 | <h2 class="pronamic-pay-form-title"><?php echo esc_html( $settings['title'] ); ?></h2> |
||
| 40 | |||
| 41 | <?php endif; ?> |
||
| 42 | |||
| 43 | <form id="<?php echo esc_attr( $settings['html_id'] ); ?>" class="pronamic-pay-form" method="post"> |
||
| 44 | <?php if ( in_array( $settings['amount_method'], $methods_with_choices, true ) ) : ?> |
||
| 45 | |||
| 46 | <fieldset> |
||
| 47 | <legend><?php esc_html_e( 'Amount', 'pronamic_ideal' ); ?></legend> |
||
| 48 | |||
| 49 | <?php endif; ?> |
||
| 50 | |||
| 51 | <div class="pronamic-pay-amount pronamic-pay-form-row-wide"> |
||
| 52 | <?php if ( in_array( $settings['amount_method'], $methods_with_choices, true ) ) : ?> |
||
| 53 | |||
| 54 | <?php foreach ( $settings['amounts'] as $amount ) : ?> |
||
| 55 | |||
| 56 | <?php |
||
| 57 | |||
| 58 | $input_id = 'pronamic-pay-amount-' . esc_attr( $amount ); |
||
| 59 | |||
| 60 | $money = new Money( $amount / 100 ); |
||
| 61 | |||
| 62 | ?> |
||
| 63 | |||
| 64 | <div> |
||
| 65 | <input class="pronamic-pay-amount-input pronamic-pay-input" id="<?php echo esc_attr( $input_id ); ?>" name="pronamic_pay_amount" type="radio" required="required" value="<?php echo esc_attr( sprintf( '%F', $amount ) ); ?>" /> |
||
| 66 | <label for="<?php echo esc_attr( $input_id ); ?>"> |
||
| 67 | <span class="pronamic-pay-currency-symbol pronamic-pay-currency-position-before">€</span> |
||
| 68 | <span class="pronamic-pay-amount-value"><?php echo esc_html( $money->format_i18n() ); ?></span> |
||
| 69 | </label> |
||
| 70 | </div> |
||
| 71 | |||
| 72 | <?php endforeach; ?> |
||
| 73 | |||
| 74 | <?php if ( \Pronamic\WordPress\Pay\Forms\FormPostType::AMOUNT_METHOD_CHOICES_AND_INPUT === $settings['amount_method'] ) : ?> |
||
| 75 | |||
| 76 | <div> |
||
| 77 | <input class="pronamic-pay-amount-input pronamic-pay-input" id="pronamic-pay-amount-other" name="pronamic_pay_amount" type="radio" required="required" value="other" /> |
||
| 78 | <label for="pronamic-pay-amount-other"> |
||
| 79 | <span class="pronamic-pay-currency-symbol pronamic-pay-currency-position-before">€</span> |
||
| 80 | <input class="pronamic-pay-amount-input pronamic-pay-input" id="pronamic-pay-amount" name="pronamic_pay_amount_other" type="text" placeholder="" autocomplete="off" value="<?php echo esc_attr( $amount_value ); ?>" /> |
||
| 81 | </label> |
||
| 82 | </div> |
||
| 83 | |||
| 84 | <?php endif; ?> |
||
| 85 | |||
| 86 | <?php endif; ?> |
||
| 87 | |||
| 88 | <?php if ( \Pronamic\WordPress\Pay\Forms\FormPostType::AMOUNT_METHOD_INPUT_ONLY === $settings['amount_method'] ) : ?> |
||
| 89 | |||
| 90 | <span class="pronamic-pay-currency-symbol pronamic-pay-currency-position-before">€</span> |
||
| 91 | <input class="pronamic-pay-amount-input pronamic-pay-input" id="pronamic-pay-amount" name="pronamic_pay_amount" type="text" placeholder="" autocomplete="off" value="<?php echo esc_attr( $amount_value ); ?>" /> |
||
| 92 | |||
| 93 | <?php endif; ?> |
||
| 94 | </div> |
||
| 95 | |||
| 96 | <?php if ( in_array( $settings['amount_method'], $methods_with_choices, true ) ) : ?> |
||
| 97 | |||
| 98 | </fieldset> |
||
| 99 | |||
| 100 | <?php endif; ?> |
||
| 101 | |||
| 102 | <fieldset> |
||
| 103 | <legend><?php esc_html_e( 'Personal Info', 'pronamic_ideal' ); ?></legend> |
||
| 104 | |||
| 105 | <p class="pronamic-pay-form-row pronamic-pay-form-row-first"> |
||
| 106 | <label class="pronamic-pay-label" for="pronamic-pay-first-name"> |
||
| 107 | <?php esc_html_e( 'First Name', 'pronamic_ideal' ); ?> <span class="pronamic-pay-required-indicator">*</span> |
||
| 108 | </label> |
||
| 109 | |||
| 110 | <input class="pronamic-pay-input pronamic-pay-required" type="text" name="pronamic_pay_first_name" placeholder="<?php esc_attr_e( 'First Name', 'pronamic_ideal' ); ?>" id="pronamic-pay-first-name" required="required" value="" /> |
||
| 111 | </p> |
||
| 112 | |||
| 113 | <p class="pronamic-pay-form-row pronamic-pay-form-row-last"> |
||
| 114 | <label class="pronamic-pay-label" for="pronamic-pay-last-name"> |
||
| 115 | <?php esc_html_e( 'Last Name', 'pronamic_ideal' ); ?> |
||
| 116 | </label> |
||
| 117 | |||
| 118 | <input class="pronamic-pay-input" type="text" name="pronamic_pay_last_name" id="pronamic-pay-last-name" placeholder="<?php esc_attr_e( 'Last Name', 'pronamic_ideal' ); ?>" value="" /> |
||
| 119 | </p> |
||
| 120 | |||
| 121 | <p class="pronamic-pay-form-row pronamic-pay-form-row-wide"> |
||
| 122 | <label class="pronamic-pay-label" for="pronamic-pay-email"> |
||
| 123 | <?php esc_html_e( 'Email Address', 'pronamic_ideal' ); ?> |
||
| 124 | <span class="pronamic-pay-required-indicator">*</span> |
||
| 125 | </label> |
||
| 126 | |||
| 127 | <input class="pronamic-pay-input required" type="email" name="pronamic_pay_email" placeholder="<?php esc_attr_e( 'Email Address', 'pronamic_ideal' ); ?>" id="pronamic-pay-email" required="required" value="" /> |
||
| 128 | </p> |
||
| 129 | </fieldset> |
||
| 130 | |||
| 131 | <?php |
||
| 132 | |||
| 133 | if ( $gateway->payment_method_is_required() ) { |
||
| 134 | |||
| 135 | $gateway->set_payment_method( PaymentMethods::IDEAL ); |
||
| 136 | |||
| 137 | } |
||
| 138 | |||
| 139 | $fields = $gateway->get_input_fields(); |
||
| 140 | |||
| 141 | ?> |
||
| 142 | |||
| 143 | <?php if ( ! empty( $fields ) ) : ?> |
||
| 144 | |||
| 145 | <fieldset> |
||
| 146 | <legend><?php esc_html_e( 'Payment Info', 'pronamic_ideal' ); ?></legend> |
||
| 147 | |||
| 148 | <?php foreach ( $fields as $i => $field ) : ?> |
||
| 149 | |||
| 150 | <p class="pronamic-pay-form-row pronamic-pay-form-row-wide"> |
||
| 151 | <label class="pronamic-pay-label" for="<?php echo esc_attr( $field['id'] ); ?>"> |
||
| 152 | <?php echo esc_html( $field['label'] ); ?> |
||
| 153 | <span class="pronamic-pay-required-indicator">*</span> |
||
| 154 | </label> |
||
| 155 | |||
| 156 | <?php if ( 'select' === $field['type'] ) : ?> |
||
| 157 | |||
| 158 | <select id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['name'] ); ?>"> |
||
| 159 | <?php |
||
| 160 | |||
| 161 | echo Util::select_options_grouped( $field['choices'] ); // WPCS: XSS ok. |
||
| 162 | |||
| 163 | ?> |
||
| 164 | </select> |
||
| 165 | |||
| 166 | <?php endif; ?> |
||
| 167 | </p> |
||
| 168 | |||
| 169 | <?php endforeach; ?> |
||
| 170 | |||
| 171 | </fieldset> |
||
| 172 | |||
| 173 | <?php endif; ?> |
||
| 174 | |||
| 175 | <?php if ( ! empty( $pronamic_pay_errors ) ) : ?> |
||
| 176 | |||
| 177 | <div class="pronamic-pay-errors"> |
||
| 178 | |||
| 179 | <?php foreach ( $pronamic_pay_errors as $error ) : ?> |
||
| 180 | |||
| 181 | <p class="pronamic-pay-error"> |
||
| 182 | <strong><?php esc_html_e( 'Error', 'pronamic_ideal' ); ?></strong>: <?php echo esc_html( $error ); ?> |
||
| 183 | </p> |
||
| 184 | |||
| 185 | <?php endforeach; ?> |
||
| 186 | |||
| 187 | </div> |
||
| 188 | |||
| 189 | <?php endif; ?> |
||
| 190 | |||
| 191 | <div class="pronamic-pay-submit-button-wrap pronamic-pay-clearfix"> |
||
| 192 | <?php wp_nonce_field( 'pronamic_pay', 'pronamic_pay_nonce' ); ?> |
||
| 193 | |||
| 194 | <?php |
||
| 195 | |||
| 196 | $fields = array( |
||
| 197 | 'pronamic_pay_source' => $settings['source'], |
||
| 198 | 'pronamic_pay_source_id' => $settings['source_id'], |
||
| 199 | ); |
||
| 200 | |||
| 201 | // Add config ID when needed. |
||
| 202 | if ( FormsSource::PAYMENT_FORM !== $settings['source'] ) { |
||
| 203 | $fields['pronamic_pay_config_id'] = $settings['config_id']; |
||
| 204 | } |
||
| 205 | |||
| 206 | /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ |
||
| 207 | echo Util::html_hidden_fields( $fields ); |
||
| 208 | |||
| 209 | ?> |
||
| 210 | |||
| 211 | <?php if ( FormPostType::AMOUNT_METHOD_INPUT_FIXED === $settings['amount_method'] ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 212 | |||
| 213 | <input type="hidden" name="pronamic_pay_amount" value="<?php echo esc_attr( array_shift( $settings['amounts'] ) ); ?>" /> |
||
| 214 | |||
| 215 | <?php endif; ?> |
||
| 216 | |||
| 217 | <input type="submit" class="pronamic-pay-submit pronamic-pay-btn" id="pronamic-pay-purchase-button" name="pronamic_pay" value="<?php echo esc_attr( $settings['button_text'] ); ?>" /> |
||
| 218 | </div> |
||
| 219 | </form> |
||
| 220 | </div> |
||
| 221 | |||
| 222 | <?php endif; ?> |
||
| 223 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths