@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
26 | +function give_trigger_donation_receipt($payment_id) { |
|
27 | 27 | // Make sure we don't send a receipt while editing a donation. |
28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Send email. |
33 | - give_email_donation_receipt( $payment_id ); |
|
33 | + give_email_donation_receipt($payment_id); |
|
34 | 34 | } |
35 | 35 | |
36 | -add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 ); |
|
37 | 36 | \ No newline at end of file |
37 | +add_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1); |
|
38 | 38 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string $message Fully formatted message |
44 | 44 | */ |
45 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
46 | - return give_do_email_tags( $message, $payment_id ); |
|
45 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
46 | + return give_do_email_tags($message, $payment_id); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -57,45 +57,45 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return string $message Fully formatted message |
59 | 59 | */ |
60 | -function give_email_preview_template_tags( $message ) { |
|
60 | +function give_email_preview_template_tags($message) { |
|
61 | 61 | |
62 | - $price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) ); |
|
62 | + $price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false))); |
|
63 | 63 | |
64 | 64 | $gateway = 'PayPal'; |
65 | 65 | |
66 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
66 | + $receipt_id = strtolower(md5(uniqid())); |
|
67 | 67 | |
68 | - $payment_id = rand( 1, 100 ); |
|
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) ); |
|
68 | + $payment_id = rand(1, 100); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri())); |
|
70 | 70 | |
71 | 71 | $receipt_link = sprintf( |
72 | 72 | '<a href="%1$s">%2$s</a>', |
73 | 73 | $receipt_link_url, |
74 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
74 | + esc_html__('View the receipt in your browser »', 'give') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | // Set user. |
78 | 78 | $user = wp_get_current_user(); |
79 | 79 | |
80 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
81 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
82 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
83 | - $message = str_replace( '{user_email}', $user->user_email, $message ); |
|
84 | - $message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message ); |
|
85 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
86 | - $message = str_replace( '{amount}', $price, $message ); |
|
87 | - $message = str_replace( '{price}', $price, $message ); |
|
88 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
89 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
90 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
91 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
92 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
93 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
94 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
95 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
96 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
97 | - |
|
98 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
80 | + $message = str_replace('{name}', $user->display_name, $message); |
|
81 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
82 | + $message = str_replace('{username}', $user->user_login, $message); |
|
83 | + $message = str_replace('{user_email}', $user->user_email, $message); |
|
84 | + $message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message); |
|
85 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
86 | + $message = str_replace('{amount}', $price, $message); |
|
87 | + $message = str_replace('{price}', $price, $message); |
|
88 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
89 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
90 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
91 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
92 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
93 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
94 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
95 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
96 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
97 | + |
|
98 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return array |
113 | 113 | */ |
114 | -function give_email_preview_buttons_callback( $field ) { |
|
115 | - $field_id = str_replace( '_preview_buttons', '', $field['id'] ); |
|
114 | +function give_email_preview_buttons_callback($field) { |
|
115 | + $field_id = str_replace('_preview_buttons', '', $field['id']); |
|
116 | 116 | |
117 | 117 | ob_start(); |
118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | '<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>', |
121 | 121 | wp_nonce_url( |
122 | 122 | add_query_arg( |
123 | - array( 'give_action' => 'preview_email', 'email_type' => $field_id ), |
|
123 | + array('give_action' => 'preview_email', 'email_type' => $field_id), |
|
124 | 124 | home_url() |
125 | 125 | ), 'give-preview-email' |
126 | 126 | ), |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | echo sprintf( |
131 | 131 | ' <a href="%1$s" aria-label="%2$s" class="button-secondary">%3$s</a>', |
132 | 132 | wp_nonce_url( |
133 | - add_query_arg( array( |
|
133 | + add_query_arg(array( |
|
134 | 134 | 'give_action' => 'send_preview_email', |
135 | 135 | 'email_type' => $field_id, |
136 | 136 | 'give-message' => 'sent-test-email', |
137 | - ) ), 'give-send-preview-email' ), |
|
138 | - esc_attr__( 'Send Test Email.', 'give' ), |
|
139 | - esc_html__( 'Send Test Email', 'give' ) |
|
137 | + )), 'give-send-preview-email' ), |
|
138 | + esc_attr__('Send Test Email.', 'give'), |
|
139 | + esc_html__('Send Test Email', 'give') |
|
140 | 140 | ); |
141 | 141 | |
142 | 142 | echo ob_get_clean(); |
@@ -155,28 +155,28 @@ discard block |
||
155 | 155 | |
156 | 156 | //Payment receipt switcher |
157 | 157 | $payment_count = give_count_payments()->publish; |
158 | - $payment_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' ); |
|
158 | + $payment_id = give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id'); |
|
159 | 159 | |
160 | - if ( $payment_count <= 0 ) { |
|
160 | + if ($payment_count <= 0) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
164 | 164 | //Get payments. |
165 | - $payments = new Give_Payments_Query( array( |
|
165 | + $payments = new Give_Payments_Query(array( |
|
166 | 166 | 'number' => 100, |
167 | - ) ); |
|
167 | + )); |
|
168 | 168 | $payments = $payments->get_payments(); |
169 | 169 | $options = array(); |
170 | 170 | |
171 | 171 | // Default option. |
172 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
172 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
173 | 173 | |
174 | 174 | //Provide nice human readable options. |
175 | - if ( $payments ) { |
|
176 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
177 | - foreach ( $payments as $payment ) { |
|
175 | + if ($payments) { |
|
176 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
177 | + foreach ($payments as $payment) { |
|
178 | 178 | |
179 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
179 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | } |
@@ -185,27 +185,27 @@ discard block |
||
185 | 185 | $transaction_header = '<div style="margin:0;padding:10px 0;width:100%;background-color:#FFF;border-bottom:1px solid #eee; text-align:center;">'; |
186 | 186 | |
187 | 187 | // Remove payment id query param if set from request url. |
188 | - $request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] ); |
|
188 | + $request_url_data = wp_parse_url($_SERVER['REQUEST_URI']); |
|
189 | 189 | $query = $request_url_data['query']; |
190 | - $query = remove_query_arg( array( 'preview_id' ), $query ); |
|
190 | + $query = remove_query_arg(array('preview_id'), $query); |
|
191 | 191 | |
192 | - $request_url = home_url( '/?' . str_replace( '', '', $query ) ); |
|
192 | + $request_url = home_url('/?'.str_replace('', '', $query)); |
|
193 | 193 | |
194 | 194 | $transaction_header .= '<script> |
195 | 195 | function change_preview(){ |
196 | 196 | var transactions = document.getElementById("give_preview_email_payment_id"); |
197 | 197 | var selected_trans = transactions.options[transactions.selectedIndex]; |
198 | 198 | if (selected_trans){ |
199 | - var url_string = "' . $request_url . '&preview_id=" + selected_trans.value; |
|
199 | + var url_string = "' . $request_url.'&preview_id=" + selected_trans.value; |
|
200 | 200 | window.location = url_string; |
201 | 201 | } |
202 | 202 | } |
203 | 203 | </script>'; |
204 | 204 | |
205 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
205 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
206 | 206 | |
207 | 207 | //The select field with 100 latest transactions |
208 | - $transaction_header .= Give()->html->select( array( |
|
208 | + $transaction_header .= Give()->html->select(array( |
|
209 | 209 | 'name' => 'preview_email_payment_id', |
210 | 210 | 'selected' => $payment_id, |
211 | 211 | 'id' => 'give_preview_email_payment_id', |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | 'select_atts' => 'onchange="change_preview()"', |
216 | 216 | 'show_option_all' => false, |
217 | 217 | 'show_option_none' => false, |
218 | - ) ); |
|
218 | + )); |
|
219 | 219 | |
220 | 220 | //Closing tag |
221 | 221 | $transaction_header .= '</div>'; |
222 | 222 | |
223 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
223 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @since 1.0 |
21 | 21 | */ |
22 | -class Give_Forms_Widget extends WP_Widget{ |
|
22 | +class Give_Forms_Widget extends WP_Widget { |
|
23 | 23 | /** |
24 | 24 | * The widget class name |
25 | 25 | * |
@@ -30,19 +30,19 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * Instantiate the class |
32 | 32 | */ |
33 | - public function __construct(){ |
|
34 | - $this->self = get_class( $this ); |
|
33 | + public function __construct() { |
|
34 | + $this->self = get_class($this); |
|
35 | 35 | |
36 | 36 | parent::__construct( |
37 | - strtolower( $this->self ), |
|
38 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
37 | + strtolower($this->self), |
|
38 | + esc_html__('Give - Donation Form', 'give'), |
|
39 | 39 | array( |
40 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
40 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
41 | 41 | ) |
42 | 42 | ); |
43 | 43 | |
44 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
45 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
44 | + add_action('widgets_init', array($this, 'widget_init')); |
|
45 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function admin_widget_scripts( $hook ){ |
|
55 | + public function admin_widget_scripts($hook) { |
|
56 | 56 | // Directories of assets |
57 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
58 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
59 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
57 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
58 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
59 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
60 | 60 | |
61 | 61 | // Use minified libraries if SCRIPT_DEBUG is turned off |
62 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
62 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
63 | 63 | |
64 | 64 | // Widget Script |
65 | - if ( $hook == 'widgets.php' ) { |
|
65 | + if ($hook == 'widgets.php') { |
|
66 | 66 | |
67 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
67 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * before_widget, and after_widget. |
76 | 76 | * @param array $instance The settings for the particular instance of the widget. |
77 | 77 | */ |
78 | - public function widget( $args, $instance ){ |
|
79 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
80 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
78 | + public function widget($args, $instance) { |
|
79 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
80 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
81 | 81 | |
82 | 82 | echo $args['before_widget']; |
83 | 83 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_before_forms_widget' ); |
|
89 | + do_action('give_before_forms_widget'); |
|
90 | 90 | |
91 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; |
|
91 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; |
|
92 | 92 | |
93 | - give_get_donation_form( $instance ); |
|
93 | + give_get_donation_form($instance); |
|
94 | 94 | |
95 | 95 | echo $args['after_widget']; |
96 | 96 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @since 1.0 |
101 | 101 | */ |
102 | - do_action( 'give_after_forms_widget' ); |
|
102 | + do_action('give_after_forms_widget'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function form( $instance ){ |
|
112 | + public function form($instance) { |
|
113 | 113 | $defaults = array( |
114 | 114 | 'title' => '', |
115 | 115 | 'id' => '', |
@@ -119,84 +119,84 @@ discard block |
||
119 | 119 | 'continue_button_title' => '', |
120 | 120 | ); |
121 | 121 | |
122 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
122 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
123 | 123 | |
124 | 124 | // Backward compatibility: Set float labels as default if, it was set as empty previous. |
125 | - $instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels']; |
|
125 | + $instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels']; |
|
126 | 126 | |
127 | 127 | // Query Give Forms |
128 | 128 | $args = array( |
129 | 129 | 'post_type' => 'give_forms', |
130 | - 'posts_per_page' => - 1, |
|
130 | + 'posts_per_page' => -1, |
|
131 | 131 | 'post_status' => 'publish', |
132 | 132 | ); |
133 | 133 | |
134 | - $give_forms = get_posts( $args ); |
|
134 | + $give_forms = get_posts($args); |
|
135 | 135 | ?> |
136 | 136 | <div class="give_forms_widget_container"> |
137 | 137 | |
138 | 138 | <?php // Widget: widget Title. ?> |
139 | 139 | <p> |
140 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
141 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br> |
|
142 | - <small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
140 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
141 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br> |
|
142 | + <small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
143 | 143 | </p> |
144 | 144 | |
145 | 145 | <?php // Widget: Give Form?> |
146 | 146 | <p> |
147 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label> |
|
148 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
149 | - <option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
150 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
151 | - <?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?> |
|
152 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option> |
|
147 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label> |
|
148 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
149 | + <option value="current"><?php esc_html_e('- Select -', 'give'); ?></option> |
|
150 | + <?php foreach ($give_forms as $give_form) { ?> |
|
151 | + <?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?> |
|
152 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option> |
|
153 | 153 | <?php } ?> |
154 | 154 | </select><br> |
155 | - <small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
155 | + <small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
156 | 156 | </p> |
157 | 157 | |
158 | 158 | <?php // Widget: Display Style ?> |
159 | 159 | <p class="give_forms_display_style_setting_row"> |
160 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br> |
|
161 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label> |
|
162 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label> |
|
163 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label> |
|
164 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br> |
|
160 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br> |
|
161 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label> |
|
162 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label> |
|
163 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label> |
|
164 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br> |
|
165 | 165 | <small class="give-field-description"> |
166 | - <?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?> |
|
166 | + <?php echo esc_html__('Select a Give Form style.', 'give'); ?> |
|
167 | 167 | </small> |
168 | 168 | </p> |
169 | 169 | |
170 | 170 | <?php // Widget: Continue Button Title. ?> |
171 | 171 | <p class="give_forms_continue_button_title_setting_row"> |
172 | - <label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label> |
|
173 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br> |
|
174 | - <small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small> |
|
172 | + <label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label> |
|
173 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br> |
|
174 | + <small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small> |
|
175 | 175 | </p> |
176 | 176 | |
177 | 177 | <?php // Widget: Floating Labels ?> |
178 | 178 | <p> |
179 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br> |
|
180 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label> |
|
181 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label> |
|
182 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br> |
|
179 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br> |
|
180 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label> |
|
181 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label> |
|
182 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br> |
|
183 | 183 | <small class="give-field-description"> |
184 | 184 | <?php |
185 | 185 | printf( |
186 | 186 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
187 | - __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
188 | - esc_url( 'http://docs.givewp.com/form-floating-labels' ) |
|
187 | + __('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
188 | + esc_url('http://docs.givewp.com/form-floating-labels') |
|
189 | 189 | ); |
190 | 190 | ?></small> |
191 | 191 | </p> |
192 | 192 | |
193 | 193 | <?php // Widget: Display Content ?> |
194 | 194 | <p> |
195 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br> |
|
196 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label> |
|
197 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label> |
|
198 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br> |
|
199 | - <small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small> |
|
195 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br> |
|
196 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label> |
|
197 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label> |
|
198 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br> |
|
199 | + <small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small> |
|
200 | 200 | </div> |
201 | 201 | <?php |
202 | 202 | } |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return void |
208 | 208 | */ |
209 | - function widget_init(){ |
|
210 | - register_widget( $this->self ); |
|
209 | + function widget_init() { |
|
210 | + register_widget($this->self); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return array |
220 | 220 | */ |
221 | - public function update( $new_instance, $old_instance ){ |
|
221 | + public function update($new_instance, $old_instance) { |
|
222 | 222 | $this->flush_widget_cache(); |
223 | 223 | |
224 | 224 | return $new_instance; |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return void |
231 | 231 | */ |
232 | - public function flush_widget_cache(){ |
|
233 | - wp_cache_delete( $this->self, 'widget' ); |
|
232 | + public function flush_widget_cache() { |
|
233 | + wp_cache_delete($this->self, 'widget'); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return array |
22 | 22 | */ |
23 | - private function set_toottip_args( $args ) { |
|
23 | + private function set_toottip_args($args) { |
|
24 | 24 | $args = wp_parse_args( |
25 | 25 | $args, |
26 | 26 | array( |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | |
63 | 63 | // Auto set width of tooltip. |
64 | 64 | if ( |
65 | - ! empty( $args['auto_width'] ) && |
|
66 | - ! empty( $args['label'] ) && |
|
67 | - empty( $args['size'] ) |
|
65 | + ! empty($args['auto_width']) && |
|
66 | + ! empty($args['label']) && |
|
67 | + empty($args['size']) |
|
68 | 68 | ) { |
69 | - if ( 15 < str_word_count( $args['label'] ) ) { |
|
69 | + if (15 < str_word_count($args['label'])) { |
|
70 | 70 | $args['size'] = 'large'; |
71 | - } elseif ( 7 < str_word_count( $args['label'] ) ) { |
|
71 | + } elseif (7 < str_word_count($args['label'])) { |
|
72 | 72 | $args['size'] = 'medium'; |
73 | 73 | } |
74 | 74 | } |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return string |
89 | 89 | */ |
90 | - public function render( $args ) { |
|
91 | - $args = $this->set_toottip_args( $args ); |
|
90 | + public function render($args) { |
|
91 | + $args = $this->set_toottip_args($args); |
|
92 | 92 | |
93 | 93 | $tooltip_pos = array( |
94 | 94 | 'top' => 'hint--top', |
@@ -118,21 +118,21 @@ discard block |
||
118 | 118 | $args['attributes']['aria-label'] = $args['label']; |
119 | 119 | |
120 | 120 | // Set classes. |
121 | - $args['attributes']['class'] = ! empty( $args['attributes']['class'] ) ? $args['attributes']['class'] : ''; |
|
122 | - $args['attributes']['class'] .= " {$tooltip_pos[ $args['position'] ]}"; |
|
123 | - $args['attributes']['class'] .= ! empty( $args['status'] ) ? " {$tooltip_status[ $args['status'] ]}" : ''; |
|
124 | - $args['attributes']['class'] .= ! empty( $args['size'] ) ? " {$tooltip_size[ $args['size'] ]}" : ''; |
|
121 | + $args['attributes']['class'] = ! empty($args['attributes']['class']) ? $args['attributes']['class'] : ''; |
|
122 | + $args['attributes']['class'] .= " {$tooltip_pos[$args['position']]}"; |
|
123 | + $args['attributes']['class'] .= ! empty($args['status']) ? " {$tooltip_status[$args['status']]}" : ''; |
|
124 | + $args['attributes']['class'] .= ! empty($args['size']) ? " {$tooltip_size[$args['size']]}" : ''; |
|
125 | 125 | $args['attributes']['class'] .= $args['show_always'] ? ' hint--always' : ''; |
126 | 126 | $args['attributes']['class'] .= $args['round_edges'] ? ' hint--rounded' : ''; |
127 | 127 | $args['attributes']['class'] .= $args['animate'] ? ' hint--bounce' : ' hint--no-animate'; |
128 | - $args['attributes']['class'] = trim( $args['attributes']['class'] ); |
|
128 | + $args['attributes']['class'] = trim($args['attributes']['class']); |
|
129 | 129 | |
130 | 130 | // Set link attribute in tooltip has anchor tag. |
131 | - if ( 'a' === $args['tag'] && ! empty( $args['link'] ) ) { |
|
132 | - $args['attributes']['href'] = esc_url( $args['link'] ); |
|
131 | + if ('a' === $args['tag'] && ! empty($args['link'])) { |
|
132 | + $args['attributes']['href'] = esc_url($args['link']); |
|
133 | 133 | } |
134 | 134 | |
135 | - return sprintf( '<%1$s %2$s rel="tooltip">%3$s</%1$s>', $args['tag'], give_get_attribute_str( $args['attributes'] ), $args['tag_content'] ); |
|
135 | + return sprintf('<%1$s %2$s rel="tooltip">%3$s</%1$s>', $args['tag'], give_get_attribute_str($args['attributes']), $args['tag_content']); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return string |
148 | 148 | */ |
149 | - function render_link( $args ) { |
|
149 | + function render_link($args) { |
|
150 | 150 | $args['tag'] = 'a'; |
151 | - $tooltip_markup = $this->render( $args ); |
|
151 | + $tooltip_markup = $this->render($args); |
|
152 | 152 | |
153 | 153 | return $tooltip_markup; |
154 | 154 | } |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return string |
165 | 165 | */ |
166 | - function render_span( $args ) { |
|
166 | + function render_span($args) { |
|
167 | 167 | // Set tooltip args from string. |
168 | - if ( is_string( $args ) ) { |
|
169 | - $args = array( 'label' => $args ); |
|
168 | + if (is_string($args)) { |
|
169 | + $args = array('label' => $args); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | $args['tag'] = 'span'; |
173 | - $tooltip_markup = $this->render( $args ); |
|
173 | + $tooltip_markup = $this->render($args); |
|
174 | 174 | |
175 | 175 | return $tooltip_markup; |
176 | 176 | } |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - function render_help( $args ) { |
|
188 | + function render_help($args) { |
|
189 | 189 | // Set tooltip args from string. |
190 | - if ( is_string( $args ) ) { |
|
191 | - $args = array( 'label' => $args ); |
|
190 | + if (is_string($args)) { |
|
191 | + $args = array('label' => $args); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | $args['tag_content'] = '<i class="give-icon give-icon-question"></i>'; |
195 | 195 | $args['attributes']['class'] = 'give-tooltip'; |
196 | - $tooltip_markup = $this->render_span( $args ); |
|
196 | + $tooltip_markup = $this->render_span($args); |
|
197 | 197 | |
198 | 198 | return $tooltip_markup; |
199 | 199 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @return array|bool array if errors are present, false if none found |
26 | 26 | */ |
27 | 27 | function give_get_errors() { |
28 | - return Give()->session->get( 'give_errors' ); |
|
28 | + return Give()->session->get('give_errors'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -42,23 +42,23 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return void |
44 | 44 | */ |
45 | -function give_set_error( $error_id, $error_message, $notice_args = array() ) { |
|
45 | +function give_set_error($error_id, $error_message, $notice_args = array()) { |
|
46 | 46 | $errors = give_get_errors(); |
47 | - if ( ! $errors ) { |
|
47 | + if ( ! $errors) { |
|
48 | 48 | $errors = array(); |
49 | 49 | } |
50 | 50 | |
51 | - if( is_array( $notice_args ) && ! empty( $notice_args ) ) { |
|
52 | - $errors[ $error_id ] = array( |
|
51 | + if (is_array($notice_args) && ! empty($notice_args)) { |
|
52 | + $errors[$error_id] = array( |
|
53 | 53 | 'message' => $error_message, |
54 | 54 | 'notice_args' => $notice_args, |
55 | 55 | ); |
56 | 56 | } else { |
57 | 57 | // Backward compatibility v<1.8.11. |
58 | - $errors[ $error_id ] = $error_message; |
|
58 | + $errors[$error_id] = $error_message; |
|
59 | 59 | } |
60 | 60 | |
61 | - Give()->session->set( 'give_errors', $errors ); |
|
61 | + Give()->session->set('give_errors', $errors); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return void |
70 | 70 | */ |
71 | 71 | function give_clear_errors() { |
72 | - Give()->session->set( 'give_errors', null ); |
|
72 | + Give()->session->set('give_errors', null); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return void |
84 | 84 | */ |
85 | -function give_unset_error( $error_id ) { |
|
85 | +function give_unset_error($error_id) { |
|
86 | 86 | $errors = give_get_errors(); |
87 | - if ( $errors ) { |
|
87 | + if ($errors) { |
|
88 | 88 | /** |
89 | 89 | * Check If $error_id exists in the array. |
90 | 90 | * If exists then unset it. |
91 | 91 | * |
92 | 92 | * @since 1.8.13 |
93 | 93 | */ |
94 | - if ( isset( $errors[ $error_id ] ) ) { |
|
95 | - unset( $errors[ $error_id ] ); |
|
94 | + if (isset($errors[$error_id])) { |
|
95 | + unset($errors[$error_id]); |
|
96 | 96 | } |
97 | - Give()->session->set( 'give_errors', $errors ); |
|
97 | + Give()->session->set('give_errors', $errors); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return string |
106 | 106 | */ |
107 | 107 | function _give_die_handler() { |
108 | - if ( defined( 'GIVE_UNIT_TESTS' ) ) { |
|
108 | + if (defined('GIVE_UNIT_TESTS')) { |
|
109 | 109 | return '_give_die_handler'; |
110 | 110 | } else { |
111 | 111 | die(); |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | -function give_die( $message = '', $title = '', $status = 400 ) { |
|
129 | - add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 ); |
|
130 | - add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 ); |
|
131 | - wp_die( $message, $title, array( 'response' => $status ) ); |
|
128 | +function give_die($message = '', $title = '', $status = 400) { |
|
129 | + add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3); |
|
130 | + add_filter('wp_die_handler', '_give_die_handler', 10, 3); |
|
131 | + wp_die($message, $title, array('response' => $status)); |
|
132 | 132 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @category Class |
12 | 12 | * @author WordImpress |
13 | 13 | */ |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | * ) |
53 | 53 | */ |
54 | 54 | |
55 | - $_post = give_clean( $_POST ); |
|
55 | + $_post = give_clean($_POST); |
|
56 | 56 | |
57 | - if ( empty( $_post ) || empty( $_post['data'] ) || empty( $_post['hook'] ) ) { |
|
57 | + if (empty($_post) || empty($_post['data']) || empty($_post['hook'])) { |
|
58 | 58 | exit(); |
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Fire the hook. |
63 | 63 | */ |
64 | - do_action( $_post['hook'], $_post['data'] ); |
|
64 | + do_action($_post['hook'], $_post['data']); |
|
65 | 65 | |
66 | 66 | exit(); |
67 | 67 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param $data |
23 | 23 | */ |
24 | -function give_process_gateway_select( $data ) { |
|
25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
24 | +function give_process_gateway_select($data) { |
|
25 | + if (isset($_POST['gateway_submit'])) { |
|
26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Loads a payment gateway via AJAX. |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | function give_load_ajax_gateway() { |
41 | - if ( isset( $_POST['give_payment_mode'] ) ) { |
|
41 | + if (isset($_POST['give_payment_mode'])) { |
|
42 | 42 | /** |
43 | 43 | * Fire to render donation form. |
44 | 44 | * |
45 | 45 | * @since 1.7 |
46 | 46 | */ |
47 | - do_action( 'give_donation_form', $_POST['give_form_id'] ); |
|
47 | + do_action('give_donation_form', $_POST['give_form_id']); |
|
48 | 48 | |
49 | 49 | exit(); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
54 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
53 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
54 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Create wp nonce using Ajax call. |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | function give_donation_form_nonce() { |
66 | - if ( isset( $_POST['give_form_id'] ) ) { |
|
66 | + if (isset($_POST['give_form_id'])) { |
|
67 | 67 | |
68 | 68 | // Get donation form id. |
69 | - $form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0; |
|
69 | + $form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0; |
|
70 | 70 | |
71 | 71 | // Send nonce json data. |
72 | - wp_send_json_success( wp_create_nonce( "donation_form_nonce_{$form_id}" ) ); |
|
72 | + wp_send_json_success(wp_create_nonce("donation_form_nonce_{$form_id}")); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
77 | -add_action( 'wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
76 | +add_action('wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
77 | +add_action('wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Sets an error within the donation form if no gateways are enabled. |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | function give_no_gateway_error() { |
87 | 87 | $gateways = give_get_enabled_payment_gateways(); |
88 | 88 | |
89 | - if ( empty( $gateways ) ) { |
|
90 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
89 | + if (empty($gateways)) { |
|
90 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
91 | 91 | } else { |
92 | - give_unset_error( 'no_gateways' ); |
|
92 | + give_unset_error('no_gateways'); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | -add_action( 'init', 'give_no_gateway_error' ); |
|
96 | +add_action('init', 'give_no_gateway_error'); |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | * @version 1.0 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } // Exit if accessed directly. |
12 | 12 | |
13 | 13 | // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something. |
14 | -$body = " |
|
14 | +$body = " |
|
15 | 15 | background-color: #f6f6f6; |
16 | 16 | font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; |
17 | 17 | "; |
18 | -$wrapper = " |
|
18 | +$wrapper = " |
|
19 | 19 | width:100%; |
20 | 20 | -webkit-text-size-adjust:none !important; |
21 | 21 | margin:0; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | border-radius:3px !important; |
30 | 30 | padding: 20px; |
31 | 31 | "; |
32 | -$template_header = " |
|
32 | +$template_header = " |
|
33 | 33 | color: #00000; |
34 | 34 | border-top-left-radius:3px !important; |
35 | 35 | border-top-right-radius:3px !important; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | text-align: center; |
40 | 40 | vertical-align:middle; |
41 | 41 | "; |
42 | -$body_content = " |
|
42 | +$body_content = " |
|
43 | 43 | border-radius:3px !important; |
44 | 44 | font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; |
45 | 45 | "; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | line-height:150%; |
51 | 51 | text-align:left; |
52 | 52 | "; |
53 | -$header_content_h1 = " |
|
53 | +$header_content_h1 = " |
|
54 | 54 | color: #000000; |
55 | 55 | margin:0; |
56 | 56 | padding: 28px 24px; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | <html> |
66 | 66 | <head> |
67 | 67 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
68 | - <title><?php echo get_bloginfo( 'name' ); ?></title> |
|
68 | + <title><?php echo get_bloginfo('name'); ?></title> |
|
69 | 69 | </head> |
70 | 70 | <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="<?php echo $body; ?>"> |
71 | 71 | <div style="<?php echo $wrapper; ?>"> |
@@ -4,17 +4,17 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | |
7 | -if ( ! is_user_logged_in() ) { |
|
7 | +if ( ! is_user_logged_in()) { |
|
8 | 8 | |
9 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
10 | - $give_login_redirect = add_query_arg( 'payment_key', give_clean( $_GET['payment_key'] ) , give_get_history_page_uri() ); |
|
9 | + if ( ! empty($_GET['payment_key'])) { |
|
10 | + $give_login_redirect = add_query_arg('payment_key', give_clean($_GET['payment_key']), give_get_history_page_uri()); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // Show any error messages after form submission |
14 | - Give()->notices->render_frontend_notices( 0 ); ?> |
|
14 | + Give()->notices->render_frontend_notices(0); ?> |
|
15 | 15 | <form id="give-login-form" class="give-form" action="" method="post"> |
16 | 16 | <fieldset> |
17 | - <legend><?php _e( 'Log into Your Account', 'give' ); ?></legend> |
|
17 | + <legend><?php _e('Log into Your Account', 'give'); ?></legend> |
|
18 | 18 | <?php |
19 | 19 | /** |
20 | 20 | * Fires in the login shortcode, before the login fields. |
@@ -23,27 +23,27 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @since 1.0 |
25 | 25 | */ |
26 | - do_action( 'give_login_fields_before' ); |
|
26 | + do_action('give_login_fields_before'); |
|
27 | 27 | ?> |
28 | 28 | <div class="give-login-username give-login"> |
29 | - <label for="give_user_login"><?php _e( 'Username', 'give' ); ?></label> |
|
29 | + <label for="give_user_login"><?php _e('Username', 'give'); ?></label> |
|
30 | 30 | <input name="give_user_login" id="give_user_login" class="give-required give-input" type="text" required aria-required="true" /> |
31 | 31 | </div> |
32 | 32 | |
33 | 33 | <div class="give-login-password give-login"> |
34 | - <label for="give_user_pass"><?php _e( 'Password', 'give' ); ?></label> |
|
34 | + <label for="give_user_pass"><?php _e('Password', 'give'); ?></label> |
|
35 | 35 | <input name="give_user_pass" id="give_user_pass" class="give-password give-required give-input" type="password" required aria-required="true" /> |
36 | 36 | </div> |
37 | 37 | |
38 | 38 | <div class="give-login-submit give-login"> |
39 | - <input type="hidden" name="give_login_redirect" value="<?php echo esc_url( $give_login_redirect ); ?>" /> |
|
40 | - <input type="hidden" name="give_login_nonce" value="<?php echo wp_create_nonce( 'give-login-nonce' ); ?>" /> |
|
39 | + <input type="hidden" name="give_login_redirect" value="<?php echo esc_url($give_login_redirect); ?>" /> |
|
40 | + <input type="hidden" name="give_login_nonce" value="<?php echo wp_create_nonce('give-login-nonce'); ?>" /> |
|
41 | 41 | <input type="hidden" name="give_action" value="user_login" /> |
42 | - <input id="give_login_submit" type="submit" class="give_submit" value="<?php _e( 'Log In', 'give' ); ?>" /> |
|
42 | + <input id="give_login_submit" type="submit" class="give_submit" value="<?php _e('Log In', 'give'); ?>" /> |
|
43 | 43 | </div> |
44 | 44 | |
45 | 45 | <div class="give-lost-password give-login"> |
46 | - <a href="<?php echo wp_lostpassword_url(); ?>"><?php _e( 'Reset Password', 'give' ); ?></a> |
|
46 | + <a href="<?php echo wp_lostpassword_url(); ?>"><?php _e('Reset Password', 'give'); ?></a> |
|
47 | 47 | </div> |
48 | 48 | <?php |
49 | 49 | /** |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @since 1.0 |
55 | 55 | */ |
56 | - do_action( 'give_login_fields_after' ); |
|
56 | + do_action('give_login_fields_after'); |
|
57 | 57 | ?> |
58 | 58 | </fieldset> |
59 | 59 | </form> |
60 | -<?php } elseif( isset( $_GET['give-login-success'] ) && true === (bool) $_GET['give-login-success'] ) { ?> |
|
61 | - <?php Give()->notices->print_frontend_notice( apply_filters('give_successful_login_message', __( 'Login successful. Welcome!', 'give' )), true, 'success' ); ?> |
|
60 | +<?php } elseif (isset($_GET['give-login-success']) && true === (bool) $_GET['give-login-success']) { ?> |
|
61 | + <?php Give()->notices->print_frontend_notice(apply_filters('give_successful_login_message', __('Login successful. Welcome!', 'give')), true, 'success'); ?> |
|
62 | 62 | <?php } else { ?> |
63 | - <?php Give()->notices->print_frontend_notice( apply_filters('give_already_logged_in_message', sprintf( __( 'You are already logged in to the site. <a href="%s">Click here</a> to logout.', 'give' ), esc_url( $give_logout_redirect ) ) ), true, 'warning' ); ?> |
|
63 | + <?php Give()->notices->print_frontend_notice(apply_filters('give_already_logged_in_message', sprintf(__('You are already logged in to the site. <a href="%s">Click here</a> to logout.', 'give'), esc_url($give_logout_redirect))), true, 'warning'); ?> |
|
64 | 64 | <?php } ?> |
65 | 65 | \ No newline at end of file |