@@ -16,23 +16,23 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function __construct() { |
18 | 18 | |
19 | - $forms = get_posts( |
|
20 | - array( |
|
21 | - 'post_type' => 'wpi_payment_form', |
|
22 | - 'orderby' => 'title', |
|
23 | - 'order' => 'ASC', |
|
24 | - 'posts_per_page' => -1, |
|
25 | - 'post_status' => array( 'publish' ), |
|
26 | - ) |
|
27 | - ); |
|
28 | - |
|
29 | - $options = array( |
|
30 | - '' => __('Select a Form','invoicing') |
|
31 | - ); |
|
32 | - |
|
33 | - foreach( $forms as $form ) { |
|
34 | - $options[ $form->ID ] = $form->post_title; |
|
35 | - } |
|
19 | + $forms = get_posts( |
|
20 | + array( |
|
21 | + 'post_type' => 'wpi_payment_form', |
|
22 | + 'orderby' => 'title', |
|
23 | + 'order' => 'ASC', |
|
24 | + 'posts_per_page' => -1, |
|
25 | + 'post_status' => array( 'publish' ), |
|
26 | + ) |
|
27 | + ); |
|
28 | + |
|
29 | + $options = array( |
|
30 | + '' => __('Select a Form','invoicing') |
|
31 | + ); |
|
32 | + |
|
33 | + foreach( $forms as $form ) { |
|
34 | + $options[ $form->ID ] = $form->post_title; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | $options = array( |
38 | 38 | 'textdomain' => 'invoicing', |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | 'form' => array( |
51 | 51 | 'title' => __( 'Payment Form', 'invoicing' ), |
52 | 52 | 'desc' => __( 'Select your payment form.', 'invoicing' ), |
53 | - 'type' => 'select', |
|
54 | - 'options' => $options, |
|
53 | + 'type' => 'select', |
|
54 | + 'options' => $options, |
|
55 | 55 | 'desc_tip' => true, |
56 | 56 | 'default' => '', |
57 | 57 | 'advanced' => false |
@@ -64,56 +64,56 @@ discard block |
||
64 | 64 | parent::__construct( $options ); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * The Super block output function. |
|
69 | - * |
|
70 | - * @param array $args |
|
71 | - * @param array $widget_args |
|
72 | - * @param string $content |
|
73 | - * |
|
74 | - * @return string |
|
75 | - */ |
|
67 | + /** |
|
68 | + * The Super block output function. |
|
69 | + * |
|
70 | + * @param array $args |
|
71 | + * @param array $widget_args |
|
72 | + * @param string $content |
|
73 | + * |
|
74 | + * @return string |
|
75 | + */ |
|
76 | 76 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
77 | - global $invoicing; |
|
78 | - |
|
79 | - // Do we have a payment form? |
|
80 | - if ( empty( $args['form'] ) ) { |
|
81 | - return aui()->alert( |
|
82 | - array( |
|
83 | - 'type' => 'warning', |
|
84 | - 'content' => __( 'No payment form selected', 'invoicing' ), |
|
85 | - ) |
|
86 | - ); |
|
87 | - |
|
88 | - } |
|
89 | - |
|
90 | - // If yes, ensure that it is published. |
|
91 | - if ( 'publish' != get_post_status( $args['form'] ) ) { |
|
92 | - return aui()->alert( |
|
93 | - array( |
|
94 | - 'type' => 'warning', |
|
95 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
96 | - ) |
|
97 | - ); |
|
98 | - } |
|
99 | - |
|
100 | - // Get the form elements and items. |
|
101 | - $elements = $invoicing->form_elements->get_form_elements( $args['form'] ); |
|
102 | - $items = $invoicing->form_elements->get_form_items( $args['form'] ); |
|
103 | - |
|
104 | - ob_start(); |
|
105 | - |
|
106 | - echo "<input type='hidden' name='form_id' value='{$args['form']}'/>"; |
|
107 | - echo wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' ); |
|
108 | - |
|
109 | - foreach ( $elements as $element ) { |
|
110 | - do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] ); |
|
111 | - do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] ); |
|
112 | - } |
|
113 | - |
|
114 | - $content = ob_get_clean(); |
|
77 | + global $invoicing; |
|
78 | + |
|
79 | + // Do we have a payment form? |
|
80 | + if ( empty( $args['form'] ) ) { |
|
81 | + return aui()->alert( |
|
82 | + array( |
|
83 | + 'type' => 'warning', |
|
84 | + 'content' => __( 'No payment form selected', 'invoicing' ), |
|
85 | + ) |
|
86 | + ); |
|
87 | + |
|
88 | + } |
|
89 | + |
|
90 | + // If yes, ensure that it is published. |
|
91 | + if ( 'publish' != get_post_status( $args['form'] ) ) { |
|
92 | + return aui()->alert( |
|
93 | + array( |
|
94 | + 'type' => 'warning', |
|
95 | + 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
96 | + ) |
|
97 | + ); |
|
98 | + } |
|
99 | + |
|
100 | + // Get the form elements and items. |
|
101 | + $elements = $invoicing->form_elements->get_form_elements( $args['form'] ); |
|
102 | + $items = $invoicing->form_elements->get_form_items( $args['form'] ); |
|
103 | + |
|
104 | + ob_start(); |
|
105 | + |
|
106 | + echo "<input type='hidden' name='form_id' value='{$args['form']}'/>"; |
|
107 | + echo wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' ); |
|
108 | + |
|
109 | + foreach ( $elements as $element ) { |
|
110 | + do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] ); |
|
111 | + do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] ); |
|
112 | + } |
|
113 | + |
|
114 | + $content = ob_get_clean(); |
|
115 | 115 | |
116 | - return str_replace( 'sr-only', '', $content ); |
|
116 | + return str_replace( 'sr-only', '', $content ); |
|
117 | 117 | |
118 | 118 | } |
119 | 119 |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
171 | 171 | require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
172 | 172 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
173 | - require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
174 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
175 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
176 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
177 | - require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
173 | + require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
174 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
175 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
176 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
177 | + require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
178 | 178 | require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
179 | 179 | require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' ); |
180 | 180 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' ); |
@@ -487,17 +487,17 @@ discard block |
||
487 | 487 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
488 | 488 | } |
489 | 489 | |
490 | - /** |
|
491 | - * Register widgets |
|
492 | - * |
|
493 | - */ |
|
494 | - public function register_widgets() { |
|
495 | - register_widget( "WPInv_Checkout_Widget" ); |
|
496 | - register_widget( "WPInv_History_Widget" ); |
|
497 | - register_widget( "WPInv_Receipt_Widget" ); |
|
498 | - register_widget( "WPInv_Subscriptions_Widget" ); |
|
499 | - register_widget( "WPInv_Buy_Item_Widget" ); |
|
490 | + /** |
|
491 | + * Register widgets |
|
492 | + * |
|
493 | + */ |
|
494 | + public function register_widgets() { |
|
495 | + register_widget( "WPInv_Checkout_Widget" ); |
|
496 | + register_widget( "WPInv_History_Widget" ); |
|
497 | + register_widget( "WPInv_Receipt_Widget" ); |
|
498 | + register_widget( "WPInv_Subscriptions_Widget" ); |
|
499 | + register_widget( "WPInv_Buy_Item_Widget" ); |
|
500 | 500 | register_widget( "WPInv_Messages_Widget" ); |
501 | 501 | register_widget( 'WPInv_Payment_Form_Widget' ); |
502 | - } |
|
502 | + } |
|
503 | 503 | } |
504 | 504 | \ No newline at end of file |