PageRenderTime 57ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/jetpack/modules/widgets/simple-payments/form.php

https://gitlab.com/chernushov881/charity-fund
PHP | 205 lines | 198 code | 1 blank | 6 comment | 4 complexity | f27316583e3dc43c545f2f905315f0d7 MD5 | raw file
  1. <?php
  2. /**
  3. * Display the Pay with PayPal Form.
  4. *
  5. * @package automattic/jetpack
  6. */
  7. ?>
  8. <p>
  9. <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
  10. <?php esc_html_e( 'Widget Title', 'jetpack' ); ?>
  11. </label>
  12. <input
  13. type="text"
  14. class="widefat jetpack-simple-payments-widget-title"
  15. id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
  16. name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
  17. value="<?php echo esc_attr( $instance['title'] ); ?>" />
  18. </p>
  19. <p class="jetpack-simple-payments-products-fieldset" <?php if ( empty( $product_posts ) ) { echo 'style="display:none;"'; } ?>>
  20. <label for="<?php echo esc_attr( $this->get_field_id( 'product_post_id' ) ); ?>">
  21. <?php esc_html_e( 'Select a Pay with PayPal button:', 'jetpack' ); ?>
  22. </label>
  23. <select
  24. class="widefat jetpack-simple-payments-products"
  25. id="<?php echo esc_attr( $this->get_field_id( 'product_post_id' ) ); ?>"
  26. name="<?php echo esc_attr( $this->get_field_name( 'product_post_id' ) ); ?>">
  27. <?php foreach ( $product_posts as $product_post ) { ?>
  28. <option value="<?php echo esc_attr( $product_post->ID ); ?>" <?php selected( (int) $instance['product_post_id'], $product_post->ID ); ?>>
  29. <?php echo esc_attr( get_the_title( $product_post ) ); ?>
  30. </option>
  31. <?php } ?>
  32. </select>
  33. </p>
  34. <?php if ( is_customize_preview() ) { ?>
  35. <p class="jetpack-simple-payments-products-warning" <?php if ( ! empty( $product_posts ) ) { echo 'style="display:none;"'; } ?>>
  36. <?php esc_html_e( "Looks like you don't have any products. You can create one using the Add New button below.", 'jetpack' ); ?>
  37. </p>
  38. <p>
  39. <div class="alignleft">
  40. <button class="button jetpack-simple-payments-edit-product" <?php disabled( empty( $product_posts ), true ); ?>>
  41. <?php esc_html_e( 'Edit Selected', 'jetpack' ); ?>
  42. </button>
  43. </div>
  44. <div class="alignright">
  45. <button class="button jetpack-simple-payments-add-product"><?php esc_html_e( 'Add New', 'jetpack' ); ?></button>
  46. </div>
  47. <br class="clear">
  48. </p>
  49. <hr />
  50. <div class="jetpack-simple-payments-form" style="display: none;">
  51. <input
  52. type="hidden"
  53. id="<?php echo esc_attr( $this->get_field_id( 'form_action' ) ); ?>"
  54. name="<?php echo esc_attr( $this->get_field_name( 'form_action' ) ); ?>"
  55. value="<?php echo esc_attr( $instance['form_action'] ); ?>"
  56. class="jetpack-simple-payments-form-action" />
  57. <input
  58. type="hidden"
  59. id="<?php echo esc_attr( $this->get_field_id( 'form_product_id' ) ); ?>"
  60. name="<?php echo esc_attr( $this->get_field_name( 'form_product_id' ) ); ?>"
  61. value="<?php echo esc_attr( $instance['form_product_id'] ); ?>"
  62. class="jetpack-simple-payments-form-product-id" />
  63. <input
  64. type="hidden"
  65. id="<?php echo esc_attr( $this->get_field_id( 'form_product_image_id' ) ); ?>"
  66. name="<?php echo esc_attr( $this->get_field_name( 'form_product_image_id' ) ); ?>"
  67. value="<?php echo esc_attr( $instance['form_product_image_id'] ); ?>"
  68. class="jetpack-simple-payments-form-image-id" />
  69. <input
  70. type="hidden"
  71. id="<?php echo esc_attr( $this->get_field_id( 'form_product_image_src' ) ); ?>"
  72. name="<?php echo esc_attr( $this->get_field_name( 'form_product_image_src' ) ); ?>"
  73. value="<?php echo esc_attr( $instance['form_product_image_src'] ); ?>"
  74. class="jetpack-simple-payments-form-image-src" />
  75. <p>
  76. <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_title' ) ); ?>">
  77. <?php esc_html_e( 'What is this payment for?', 'jetpack' ); ?>
  78. </label>
  79. <input
  80. type="text"
  81. class="widefat field-title jetpack-simple-payments-form-product-title"
  82. id="<?php echo esc_attr( $this->get_field_id( 'form_product_title' ) ); ?>"
  83. name="<?php echo esc_attr( $this->get_field_name( 'form_product_title' ) ); ?>"
  84. value="<?php echo esc_attr( $instance['form_product_title'] ); ?>" />
  85. <br />
  86. <small>
  87. <?php esc_html_e( 'For example: event tickets, charitable donations, training courses, coaching fees, etc.', 'jetpack' ); ?>
  88. </small>
  89. </p>
  90. <div class="jetpack-simple-payments-image-fieldset">
  91. <label><?php esc_html_e( 'Product image', 'jetpack' ); ?></label>
  92. <div class="placeholder" <?php if ( ! empty( $instance['form_product_image_id'] ) ) echo 'style="display:none;"'; ?>>
  93. <?php esc_html_e( 'Select an image', 'jetpack' ); ?>
  94. </div>
  95. <div class="jetpack-simple-payments-image" <?php if ( empty( $instance['form_product_image_id'] ) ) echo 'style="display:none;"'; ?>>
  96. <img src="<?php echo esc_url( $instance['form_product_image_src'] ); ?>" />
  97. <button class="button jetpack-simple-payments-remove-image"><?php esc_html_e( 'Remove image', 'jetpack' ); ?></button>
  98. </div>
  99. </div>
  100. <p>
  101. <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_description' ) ); ?>">
  102. <?php esc_html_e( 'Description', 'jetpack' ); ?>
  103. </label>
  104. <textarea
  105. class="field-description widefat jetpack-simple-payments-form-product-description"
  106. rows=5
  107. id="<?php echo esc_attr( $this->get_field_id( 'form_product_description' ) ); ?>"
  108. name="<?php echo esc_attr( $this->get_field_name( 'form_product_description' ) ); ?>"><?php echo esc_textarea( $instance['form_product_description'] ); ?></textarea>
  109. </p>
  110. <p class="cost">
  111. <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_price' ) ); ?>">
  112. <?php esc_html_e( 'Price', 'jetpack' ); ?>
  113. </label>
  114. <select
  115. class="field-currency widefat jetpack-simple-payments-form-product-currency"
  116. id="<?php echo esc_attr( $this->get_field_id( 'form_product_currency' ) ); ?>"
  117. name="<?php echo esc_attr( $this->get_field_name( 'form_product_currency' ) ); ?>">
  118. <?php foreach ( Jetpack_Simple_Payments_Widget::$supported_currency_list as $code => $currency ) { ?>
  119. <option value="<?php echo esc_attr( $code ); ?>"<?php selected( $instance['form_product_currency'], $code ); ?>>
  120. <?php echo esc_html( "$code $currency" ); ?>
  121. </option>
  122. <?php } ?>
  123. </select>
  124. <input
  125. type="text"
  126. class="field-price widefat jetpack-simple-payments-form-product-price"
  127. id="<?php echo esc_attr( $this->get_field_id( 'form_product_price' ) ); ?>"
  128. name="<?php echo esc_attr( $this->get_field_name( 'form_product_price' ) ); ?>"
  129. value="<?php echo esc_attr( $instance['form_product_price'] ); ?>"
  130. placeholder="1.00" />
  131. </p>
  132. <p>
  133. <input
  134. class="field-multiple jetpack-simple-payments-form-product-multiple"
  135. id="<?php echo esc_attr( $this->get_field_id( 'form_product_multiple' ) ); ?>"
  136. name="<?php echo esc_attr( $this->get_field_name( 'form_product_multiple' ) ); ?>"
  137. type="checkbox"
  138. value="1"
  139. <?php checked( $instance['form_product_multiple'], '1' ); ?> />
  140. <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_multiple' ) ); ?>">
  141. <?php esc_html_e( 'Allow people to buy more than one item at a time.', 'jetpack' ); ?>
  142. </label>
  143. </p>
  144. <p>
  145. <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_email' ) ); ?>">
  146. <?php esc_html_e( 'Email', 'jetpack' ); ?>
  147. </label>
  148. <input
  149. class="field-email widefat jetpack-simple-payments-form-product-email"
  150. id="<?php echo esc_attr( $this->get_field_id( 'form_product_email' ) ); ?>"
  151. name="<?php echo esc_attr( $this->get_field_name( 'form_product_email' ) ); ?>"
  152. type="email"
  153. value="<?php echo esc_attr( $instance['form_product_email'] ); ?>" />
  154. <small>
  155. <?php
  156. printf(
  157. wp_kses(
  158. /* Translators: placeholders are a link to Paypal website and a target attribute. */
  159. __( 'This is where PayPal will send your money. To claim a payment, you\'ll need a <a href="%1$s" %2$s>PayPal account</a> connected to a bank account.', 'jetpack' ),
  160. array(
  161. 'a' => array(
  162. 'href' => array(),
  163. 'target' => array(),
  164. ),
  165. )
  166. ),
  167. 'https://paypal.com',
  168. 'target="_blank"'
  169. );
  170. ?>
  171. </small>
  172. </p>
  173. <p>
  174. <div class="alignleft">
  175. <button type="button" class="button-link button-link-delete jetpack-simple-payments-delete-product">
  176. <?php esc_html_e( 'Delete Product', 'jetpack' ); ?>
  177. </button>
  178. </div>
  179. <div class="alignright">
  180. <button name="<?php echo esc_attr( $this->get_field_name( 'save' ) ); ?>" class="button jetpack-simple-payments-save-product"><?php esc_html_e( 'Save', 'jetpack' ); ?></button>
  181. <span> | <button type="button" class="button-link jetpack-simple-payments-cancel-form"><?php esc_html_e( 'Cancel', 'jetpack' ); ?></button></span>
  182. </div>
  183. <br class="clear">
  184. </p>
  185. <hr />
  186. </div>
  187. <?php } else { ?>
  188. <p class="jetpack-simple-payments-products-warning">
  189. <?php
  190. printf(
  191. wp_kses(
  192. /* Translators: placeholder is a link to the customizer. */
  193. __( 'This widget adds a payment button of your choice to your sidebar. To create or edit the payment buttons themselves, <a href="%s">use the Customizer</a>.', 'jetpack' ),
  194. array(
  195. 'a' => array(
  196. 'href' => array(),
  197. ),
  198. )
  199. ),
  200. esc_url( add_query_arg( array( 'autofocus[panel]' => 'widgets' ), admin_url( 'customize.php' ) ) )
  201. );
  202. ?>
  203. </p>
  204. <?php } ?>