@@ -10,11 +10,11 @@ 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 | |
17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $goal = give_get_form_goal( $post_id ); |
|
31 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
32 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $goal = give_get_form_goal($post_id); |
|
31 | + $variable_pricing = give_has_variable_prices($post_id); |
|
32 | + $prices = give_get_variable_prices($post_id); |
|
33 | 33 | |
34 | 34 | //No empty prices - min. 1.00 for new forms |
35 | - if ( empty( $price ) ) { |
|
36 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
35 | + if (empty($price)) { |
|
36 | + $price = esc_attr(give_format_amount('1.00')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Start with an underscore to hide fields from custom fields list |
@@ -42,275 +42,275 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Repeatable Field Groups |
44 | 44 | */ |
45 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
45 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
46 | 46 | 'id' => 'form_field_options', |
47 | - 'title' => __( 'Donation Options', 'give' ), |
|
48 | - 'object_types' => array( 'give_forms' ), |
|
47 | + 'title' => __('Donation Options', 'give'), |
|
48 | + 'object_types' => array('give_forms'), |
|
49 | 49 | 'context' => 'normal', |
50 | 50 | 'priority' => 'high', //Show above Content WYSIWYG |
51 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
51 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
52 | 52 | //Donation Option |
53 | 53 | array( |
54 | - 'name' => __( 'Donation Option', 'give' ), |
|
55 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give' ), |
|
56 | - 'id' => $prefix . 'price_option', |
|
54 | + 'name' => __('Donation Option', 'give'), |
|
55 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give'), |
|
56 | + 'id' => $prefix.'price_option', |
|
57 | 57 | 'type' => 'radio_inline', |
58 | 58 | 'default' => 'set', |
59 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
60 | - 'set' => __( 'Set Donation', 'give' ), |
|
61 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
62 | - ) ), |
|
59 | + 'options' => apply_filters('give_forms_price_options', array( |
|
60 | + 'set' => __('Set Donation', 'give'), |
|
61 | + 'multi' => __('Multi-level Donation', 'give'), |
|
62 | + )), |
|
63 | 63 | ), |
64 | 64 | array( |
65 | - 'name' => __( 'Set Donation', 'give' ), |
|
66 | - 'description' => __( 'This is the set donation amount for this form.', 'give' ), |
|
67 | - 'id' => $prefix . 'set_price', |
|
65 | + 'name' => __('Set Donation', 'give'), |
|
66 | + 'description' => __('This is the set donation amount for this form.', 'give'), |
|
67 | + 'id' => $prefix.'set_price', |
|
68 | 68 | 'type' => 'text_small', |
69 | 69 | 'row_classes' => 'give-subfield', |
70 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
71 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
70 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
71 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
72 | 72 | 'attributes' => array( |
73 | - 'placeholder' => give_format_amount( '1.00' ), |
|
73 | + 'placeholder' => give_format_amount('1.00'), |
|
74 | 74 | 'value' => $price, |
75 | 75 | 'class' => 'cmb-type-text-small give-money-field', |
76 | 76 | ), |
77 | 77 | ), |
78 | 78 | //Donation levels: Header |
79 | 79 | array( |
80 | - 'id' => $prefix . 'levels_header', |
|
80 | + 'id' => $prefix.'levels_header', |
|
81 | 81 | 'type' => 'levels_repeater_header', |
82 | 82 | ), |
83 | 83 | //Donation Levels: Repeatable CMB2 Group |
84 | 84 | array( |
85 | - 'id' => $prefix . 'donation_levels', |
|
85 | + 'id' => $prefix.'donation_levels', |
|
86 | 86 | 'type' => 'group', |
87 | 87 | 'row_classes' => 'give-subfield', |
88 | 88 | 'options' => array( |
89 | - 'add_button' => __( 'Add Level', 'give' ), |
|
90 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
89 | + 'add_button' => __('Add Level', 'give'), |
|
90 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), |
|
91 | 91 | 'sortable' => true, // beta |
92 | 92 | ), |
93 | 93 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
94 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
94 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
95 | 95 | array( |
96 | - 'name' => __( 'ID', 'give' ), |
|
97 | - 'id' => $prefix . 'id', |
|
96 | + 'name' => __('ID', 'give'), |
|
97 | + 'id' => $prefix.'id', |
|
98 | 98 | 'type' => 'levels_id', |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'Amount', 'give' ), |
|
102 | - 'id' => $prefix . 'amount', |
|
101 | + 'name' => __('Amount', 'give'), |
|
102 | + 'id' => $prefix.'amount', |
|
103 | 103 | 'type' => 'text_small', |
104 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
105 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
104 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
105 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
106 | 106 | 'attributes' => array( |
107 | - 'placeholder' => give_format_amount( '1.00' ), |
|
107 | + 'placeholder' => give_format_amount('1.00'), |
|
108 | 108 | 'class' => 'cmb-type-text-small give-money-field', |
109 | 109 | ), |
110 | 110 | 'before' => 'give_format_admin_multilevel_amount', |
111 | 111 | ), |
112 | 112 | array( |
113 | - 'name' => __( 'Text', 'give' ), |
|
114 | - 'id' => $prefix . 'text', |
|
113 | + 'name' => __('Text', 'give'), |
|
114 | + 'id' => $prefix.'text', |
|
115 | 115 | 'type' => 'text', |
116 | 116 | 'attributes' => array( |
117 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
117 | + 'placeholder' => __('Donation Level', 'give'), |
|
118 | 118 | 'rows' => 3, |
119 | 119 | ), |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Default', 'give' ), |
|
123 | - 'id' => $prefix . 'default', |
|
122 | + 'name' => __('Default', 'give'), |
|
123 | + 'id' => $prefix.'default', |
|
124 | 124 | 'type' => 'give_default_radio_inline' |
125 | 125 | ), |
126 | - ) ), |
|
126 | + )), |
|
127 | 127 | ), |
128 | 128 | //Display Style |
129 | 129 | array( |
130 | - 'name' => __( 'Display Style', 'give' ), |
|
131 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
132 | - 'id' => $prefix . 'display_style', |
|
130 | + 'name' => __('Display Style', 'give'), |
|
131 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
132 | + 'id' => $prefix.'display_style', |
|
133 | 133 | 'type' => 'radio_inline', |
134 | 134 | 'default' => 'buttons', |
135 | 135 | 'options' => array( |
136 | - 'buttons' => __( 'Buttons', 'give' ), |
|
137 | - 'radios' => __( 'Radios', 'give' ), |
|
138 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
136 | + 'buttons' => __('Buttons', 'give'), |
|
137 | + 'radios' => __('Radios', 'give'), |
|
138 | + 'dropdown' => __('Dropdown', 'give'), |
|
139 | 139 | ), |
140 | 140 | ), |
141 | 141 | //Custom Amount |
142 | 142 | array( |
143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
145 | - 'id' => $prefix . 'custom_amount', |
|
143 | + 'name' => __('Custom Amount', 'give'), |
|
144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
145 | + 'id' => $prefix.'custom_amount', |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'no', |
148 | 148 | 'options' => array( |
149 | - 'yes' => __( 'Yes', 'give' ), |
|
150 | - 'no' => __( 'No', 'give' ), |
|
149 | + 'yes' => __('Yes', 'give'), |
|
150 | + 'no' => __('No', 'give'), |
|
151 | 151 | ), |
152 | 152 | ), |
153 | 153 | array( |
154 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
155 | - 'description' => __( 'This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give' ), |
|
156 | - 'id' => $prefix . 'custom_amount_text', |
|
154 | + 'name' => __('Custom Amount Text', 'give'), |
|
155 | + 'description' => __('This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give'), |
|
156 | + 'id' => $prefix.'custom_amount_text', |
|
157 | 157 | 'type' => 'text', |
158 | 158 | 'row_classes' => 'give-subfield', |
159 | 159 | 'attributes' => array( |
160 | 160 | 'rows' => 3, |
161 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
161 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
162 | 162 | ), |
163 | 163 | ), |
164 | 164 | //Goals |
165 | 165 | array( |
166 | - 'name' => __( 'Set Goal?', 'give' ), |
|
167 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
168 | - 'id' => $prefix . 'goal_option', |
|
166 | + 'name' => __('Set Goal?', 'give'), |
|
167 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
168 | + 'id' => $prefix.'goal_option', |
|
169 | 169 | 'type' => 'radio_inline', |
170 | 170 | 'default' => 'no', |
171 | 171 | 'options' => array( |
172 | - 'yes' => __( 'Yes', 'give' ), |
|
173 | - 'no' => __( 'No', 'give' ), |
|
172 | + 'yes' => __('Yes', 'give'), |
|
173 | + 'no' => __('No', 'give'), |
|
174 | 174 | ), |
175 | 175 | ), |
176 | 176 | array( |
177 | - 'name' => __( 'Set Goal', 'give' ), |
|
178 | - 'description' => __( 'This is the goal you want to achieve for this form.', 'give' ), |
|
179 | - 'id' => $prefix . 'set_goal', |
|
177 | + 'name' => __('Set Goal', 'give'), |
|
178 | + 'description' => __('This is the goal you want to achieve for this form.', 'give'), |
|
179 | + 'id' => $prefix.'set_goal', |
|
180 | 180 | 'type' => 'text_small', |
181 | 181 | 'row_classes' => 'give-subfield', |
182 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
183 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
182 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
183 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
184 | 184 | 'attributes' => array( |
185 | - 'placeholder' => give_format_amount( '0.00' ), |
|
186 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
185 | + 'placeholder' => give_format_amount('0.00'), |
|
186 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
187 | 187 | 'class' => 'cmb-type-text-small give-money-field', |
188 | 188 | ), |
189 | 189 | ), |
190 | 190 | array( |
191 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
192 | - 'id' => $prefix . 'goal_color', |
|
191 | + 'name' => __('Goal Progress Bar Color', 'give'), |
|
192 | + 'id' => $prefix.'goal_color', |
|
193 | 193 | 'type' => 'colorpicker', |
194 | 194 | 'row_classes' => 'give-subfield', |
195 | 195 | 'default' => '#2bc253', |
196 | 196 | ), |
197 | 197 | ) |
198 | 198 | ) |
199 | - ) ); |
|
199 | + )); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Content Field |
204 | 204 | */ |
205 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
205 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
206 | 206 | 'id' => 'form_content_options', |
207 | - 'title' => __( 'Form Content', 'give' ), |
|
208 | - 'object_types' => array( 'give_forms' ), |
|
207 | + 'title' => __('Form Content', 'give'), |
|
208 | + 'object_types' => array('give_forms'), |
|
209 | 209 | 'context' => 'normal', |
210 | 210 | 'priority' => 'high', //Show above Content WYSIWYG |
211 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
211 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
212 | 212 | //Donation Option |
213 | 213 | array( |
214 | - 'name' => __( 'Display Content', 'give' ), |
|
215 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
216 | - 'id' => $prefix . 'content_option', |
|
214 | + 'name' => __('Display Content', 'give'), |
|
215 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
216 | + 'id' => $prefix.'content_option', |
|
217 | 217 | 'type' => 'select', |
218 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
219 | - 'none' => __( 'No content', 'give' ), |
|
220 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
221 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
218 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
219 | + 'none' => __('No content', 'give'), |
|
220 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), |
|
221 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'), |
|
222 | 222 | ) |
223 | 223 | ), |
224 | 224 | 'default' => 'none', |
225 | 225 | ), |
226 | 226 | array( |
227 | - 'name' => __( 'Content', 'give' ), |
|
228 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
229 | - 'id' => $prefix . 'form_content', |
|
227 | + 'name' => __('Content', 'give'), |
|
228 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
229 | + 'id' => $prefix.'form_content', |
|
230 | 230 | 'row_classes' => 'give-subfield', |
231 | 231 | 'type' => 'wysiwyg' |
232 | 232 | ), |
233 | 233 | ) |
234 | 234 | ) |
235 | - ) ); |
|
235 | + )); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | /** |
239 | 239 | * Display Options |
240 | 240 | */ |
241 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
241 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
242 | 242 | 'id' => 'form_display_options', |
243 | - 'title' => __( 'Form Display Options', 'give' ), |
|
244 | - 'object_types' => array( 'give_forms' ), |
|
243 | + 'title' => __('Form Display Options', 'give'), |
|
244 | + 'object_types' => array('give_forms'), |
|
245 | 245 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
246 | 246 | 'priority' => 'high', //Show above Content WYSIWYG |
247 | 247 | 'show_names' => true, // Show field names on the left |
248 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
248 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
249 | 249 | array( |
250 | - 'name' => __( 'Payment Fields', 'give' ), |
|
251 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
252 | - 'id' => $prefix . 'payment_display', |
|
250 | + 'name' => __('Payment Fields', 'give'), |
|
251 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
252 | + 'id' => $prefix.'payment_display', |
|
253 | 253 | 'type' => 'select', |
254 | 254 | 'options' => array( |
255 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
256 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
257 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
255 | + 'onpage' => __('Show on Page', 'give'), |
|
256 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
257 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
258 | 258 | ), |
259 | 259 | 'default' => 'onpage', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'id' => $prefix . 'reveal_label', |
|
263 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
264 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
262 | + 'id' => $prefix.'reveal_label', |
|
263 | + 'name' => __('Reveal / Modal Open Text', 'give'), |
|
264 | + 'desc' => __('The button label for completing the donation.', 'give'), |
|
265 | 265 | 'type' => 'text_small', |
266 | 266 | 'row_classes' => 'give-subfield', |
267 | 267 | 'attributes' => array( |
268 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
268 | + 'placeholder' => __('Donate Now', 'give'), |
|
269 | 269 | ), |
270 | 270 | ), |
271 | 271 | array( |
272 | - 'id' => $prefix . 'checkout_label', |
|
273 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
274 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
272 | + 'id' => $prefix.'checkout_label', |
|
273 | + 'name' => __('Complete Donation Text', 'give'), |
|
274 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
275 | 275 | 'type' => 'text_small', |
276 | 276 | 'attributes' => array( |
277 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
277 | + 'placeholder' => __('Donate Now', 'give'), |
|
278 | 278 | ), |
279 | 279 | ), |
280 | 280 | array( |
281 | - 'name' => __( 'Default Gateway', 'give' ), |
|
282 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
283 | - 'id' => $prefix . 'default_gateway', |
|
281 | + 'name' => __('Default Gateway', 'give'), |
|
282 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
283 | + 'id' => $prefix.'default_gateway', |
|
284 | 284 | 'type' => 'default_gateway' |
285 | 285 | ), |
286 | 286 | array( |
287 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
288 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
289 | - 'id' => $prefix . 'logged_in_only', |
|
287 | + 'name' => __('Disable Guest Donations', 'give'), |
|
288 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), |
|
289 | + 'id' => $prefix.'logged_in_only', |
|
290 | 290 | 'type' => 'checkbox' |
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
294 | - 'desc' => __( 'Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give' ), |
|
295 | - 'id' => $prefix . 'show_register_form', |
|
293 | + 'name' => __('Register / Login Form', 'give'), |
|
294 | + 'desc' => __('Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give'), |
|
295 | + 'id' => $prefix.'show_register_form', |
|
296 | 296 | 'type' => 'select', |
297 | 297 | 'options' => array( |
298 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
299 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
300 | - 'login' => __( 'Login Form Only', 'give' ), |
|
301 | - 'none' => __( 'None', 'give' ), |
|
298 | + 'both' => __('Registration and Login Forms', 'give'), |
|
299 | + 'registration' => __('Registration Form Only', 'give'), |
|
300 | + 'login' => __('Login Form Only', 'give'), |
|
301 | + 'none' => __('None', 'give'), |
|
302 | 302 | ), |
303 | 303 | 'default' => 'none', |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'name' => __( 'Floating Labels', 'give' ), |
|
307 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
308 | - 'id' => $prefix . 'form_floating_labels', |
|
306 | + 'name' => __('Floating Labels', 'give'), |
|
307 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
308 | + 'id' => $prefix.'form_floating_labels', |
|
309 | 309 | 'type' => 'select', |
310 | 310 | 'options' => array( |
311 | - '' => __( 'Use the global setting', 'give' ), |
|
312 | - 'enabled' => __( 'Enabled', 'give' ), |
|
313 | - 'disabled' => __( 'Disabled', 'give' ), |
|
311 | + '' => __('Use the global setting', 'give'), |
|
312 | + 'enabled' => __('Enabled', 'give'), |
|
313 | + 'disabled' => __('Disabled', 'give'), |
|
314 | 314 | ), |
315 | 315 | 'default' => 'none', |
316 | 316 | ) |
@@ -322,47 +322,47 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * Terms & Conditions |
324 | 324 | */ |
325 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
325 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
326 | 326 | 'id' => 'form_terms_options', |
327 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
328 | - 'object_types' => array( 'give_forms' ), |
|
327 | + 'title' => __('Terms and Conditions', 'give'), |
|
328 | + 'object_types' => array('give_forms'), |
|
329 | 329 | 'context' => 'normal', |
330 | 330 | 'priority' => 'high', //Show above Content WYSIWYG |
331 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
331 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
332 | 332 | //Donation Option |
333 | 333 | array( |
334 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
335 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
336 | - 'id' => $prefix . 'terms_option', |
|
334 | + 'name' => __('Terms and Conditions', 'give'), |
|
335 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
336 | + 'id' => $prefix.'terms_option', |
|
337 | 337 | 'type' => 'select', |
338 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
339 | - 'none' => __( 'No', 'give' ), |
|
340 | - 'yes' => __( 'Yes', 'give' ), |
|
338 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
339 | + 'none' => __('No', 'give'), |
|
340 | + 'yes' => __('Yes', 'give'), |
|
341 | 341 | ) |
342 | 342 | ), |
343 | 343 | 'default' => 'none', |
344 | 344 | ), |
345 | 345 | array( |
346 | - 'id' => $prefix . 'agree_label', |
|
347 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
348 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
346 | + 'id' => $prefix.'agree_label', |
|
347 | + 'name' => __('Agree to Terms Label', 'give'), |
|
348 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
349 | 349 | 'type' => 'text', |
350 | 350 | 'row_classes' => 'give-subfield', |
351 | 351 | 'size' => 'regular', |
352 | 352 | 'attributes' => array( |
353 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
353 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
354 | 354 | ), |
355 | 355 | ), |
356 | 356 | array( |
357 | - 'id' => $prefix . 'agree_text', |
|
357 | + 'id' => $prefix.'agree_text', |
|
358 | 358 | 'row_classes' => 'give-subfield', |
359 | - 'name' => __( 'Agreement Text', 'give' ), |
|
360 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
359 | + 'name' => __('Agreement Text', 'give'), |
|
360 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
361 | 361 | 'type' => 'wysiwyg' |
362 | 362 | ), |
363 | 363 | ) |
364 | 364 | ) |
365 | - ) ); |
|
365 | + )); |
|
366 | 366 | |
367 | 367 | return $meta_boxes; |
368 | 368 | |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | /** |
372 | 372 | * Repeatable Levels Custom Field |
373 | 373 | */ |
374 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
374 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
375 | 375 | function give_cmb_render_levels_repeater_header() { |
376 | 376 | ?> |
377 | 377 | |
378 | 378 | <div class="table-container"> |
379 | 379 | <div class="table-row"> |
380 | - <div class="table-cell col-id"><?php _e( 'ID', 'give' ); ?></div> |
|
381 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
382 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
383 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
384 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
385 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
380 | + <div class="table-cell col-id"><?php _e('ID', 'give'); ?></div> |
|
381 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div> |
|
382 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div> |
|
383 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div> |
|
384 | + <?php do_action('give_donation_levels_table_head'); ?> |
|
385 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div> |
|
386 | 386 | |
387 | 387 | </div> |
388 | 388 | </div> |
@@ -397,22 +397,22 @@ discard block |
||
397 | 397 | * @description: Custom CMB2 incremental Levels ID Field |
398 | 398 | * @since 1.0 |
399 | 399 | */ |
400 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
401 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
400 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
401 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
402 | 402 | |
403 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
403 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
404 | 404 | |
405 | 405 | $field_options_array = array( |
406 | 406 | 'class' => 'give-hidden give-level-id-input', |
407 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
408 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
407 | + 'name' => $field_type_object->_name('[level_id]'), |
|
408 | + 'id' => $field_type_object->_id('_level_id'), |
|
409 | 409 | 'value' => $escaped_value, |
410 | 410 | 'type' => 'number', |
411 | 411 | 'desc' => '', |
412 | 412 | ); |
413 | 413 | |
414 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
415 | - echo $field_type_object->input( $field_options_array ); |
|
414 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
415 | + echo $field_type_object->input($field_options_array); |
|
416 | 416 | |
417 | 417 | } |
418 | 418 | |
@@ -420,10 +420,10 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * CMB2 Repeatable Default ID Field |
422 | 422 | */ |
423 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
424 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
425 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
426 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
423 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
424 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
425 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
426 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
427 | 427 | |
428 | 428 | } |
429 | 429 | |
@@ -435,20 +435,20 @@ discard block |
||
435 | 435 | */ |
436 | 436 | function give_add_shortcode_to_publish_metabox() { |
437 | 437 | |
438 | - if ( 'give_forms' !== get_post_type() ) { |
|
438 | + if ('give_forms' !== get_post_type()) { |
|
439 | 439 | return false; |
440 | 440 | } |
441 | 441 | |
442 | 442 | global $post; |
443 | 443 | |
444 | 444 | //Only enqueue scripts for CPT on post type screen |
445 | - if ( 'give_forms' === $post->post_type ) { |
|
445 | + if ('give_forms' === $post->post_type) { |
|
446 | 446 | //Shortcode column with select all input |
447 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
448 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
447 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
448 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
449 | 449 | |
450 | 450 | } |
451 | 451 | |
452 | 452 | } |
453 | 453 | |
454 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
454 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -51,38 +51,38 @@ discard block |
||
51 | 51 | public function admin_menus() { |
52 | 52 | // About Page |
53 | 53 | add_dashboard_page( |
54 | - __( 'Welcome to Give', 'give' ), |
|
55 | - __( 'Welcome to Give', 'give' ), |
|
54 | + __('Welcome to Give', 'give'), |
|
55 | + __('Welcome to Give', 'give'), |
|
56 | 56 | $this->minimum_capability, |
57 | 57 | 'give-about', |
58 | - array( $this, 'about_screen' ) |
|
58 | + array($this, 'about_screen') |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | // Changelog Page |
62 | 62 | add_dashboard_page( |
63 | - __( 'Give Changelog', 'give' ), |
|
64 | - __( 'Give Changelog', 'give' ), |
|
63 | + __('Give Changelog', 'give'), |
|
64 | + __('Give Changelog', 'give'), |
|
65 | 65 | $this->minimum_capability, |
66 | 66 | 'give-changelog', |
67 | - array( $this, 'changelog_screen' ) |
|
67 | + array($this, 'changelog_screen') |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | // Getting Started Page |
71 | 71 | add_dashboard_page( |
72 | - __( 'Getting started with Give', 'give' ), |
|
73 | - __( 'Getting started with Give', 'give' ), |
|
72 | + __('Getting started with Give', 'give'), |
|
73 | + __('Getting started with Give', 'give'), |
|
74 | 74 | $this->minimum_capability, |
75 | 75 | 'give-getting-started', |
76 | - array( $this, 'getting_started_screen' ) |
|
76 | + array($this, 'getting_started_screen') |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | // Credits Page |
80 | 80 | add_dashboard_page( |
81 | - __( 'The people that build Give', 'give' ), |
|
82 | - __( 'The people that build Give', 'give' ), |
|
81 | + __('The people that build Give', 'give'), |
|
82 | + __('The people that build Give', 'give'), |
|
83 | 83 | $this->minimum_capability, |
84 | 84 | 'give-credits', |
85 | - array( $this, 'credits_screen' ) |
|
85 | + array($this, 'credits_screen') |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 | |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function admin_head() { |
97 | 97 | |
98 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
99 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
100 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
101 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
98 | + remove_submenu_page('index.php', 'give-about'); |
|
99 | + remove_submenu_page('index.php', 'give-changelog'); |
|
100 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
101 | + remove_submenu_page('index.php', 'give-credits'); |
|
102 | 102 | |
103 | 103 | // Badge for welcome page |
104 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
104 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
105 | 105 | |
106 | 106 | ?> |
107 | 107 | <style type="text/css" media="screen"> |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @return void |
216 | 216 | */ |
217 | 217 | public function tabs() { |
218 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
218 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
219 | 219 | ?> |
220 | 220 | <h1 class="nav-tab-wrapper"> |
221 | - <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
222 | - <?php _e( "About Give", 'give' ); ?> |
|
221 | + <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
222 | + <?php _e("About Give", 'give'); ?> |
|
223 | 223 | </a> |
224 | - <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
225 | - <?php _e( 'Getting Started', 'give' ); ?> |
|
224 | + <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
225 | + <?php _e('Getting Started', 'give'); ?> |
|
226 | 226 | </a> |
227 | - <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
228 | - <?php _e( 'Credits', 'give' ); ?> |
|
227 | + <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
228 | + <?php _e('Credits', 'give'); ?> |
|
229 | 229 | </a> |
230 | - <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | - <?php _e( 'Add-ons', 'give' ); ?> |
|
230 | + <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | + <?php _e('Add-ons', 'give'); ?> |
|
232 | 232 | </a> |
233 | 233 | </h1> |
234 | 234 | <?php |
@@ -242,20 +242,20 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | public function about_screen() { |
245 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
245 | + list($display_version) = explode('-', GIVE_VERSION); |
|
246 | 246 | ?> |
247 | 247 | <div class="wrap about-wrap"> |
248 | - <h1 class="welcome-h1"><?php printf( __( 'Welcome to Give %s', 'give' ), $display_version ); ?></h1> |
|
248 | + <h1 class="welcome-h1"><?php printf(__('Welcome to Give %s', 'give'), $display_version); ?></h1> |
|
249 | 249 | |
250 | 250 | <?php give_social_media_elements() ?> |
251 | 251 | |
252 | - <div class="about-text"><?php printf( __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%s" title="View the Give plugin documentation online" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), 'https://givewp.com/documenation/' ); ?></div> |
|
252 | + <div class="about-text"><?php printf(__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%s" title="View the Give plugin documentation online" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), 'https://givewp.com/documenation/'); ?></div> |
|
253 | 253 | |
254 | - <p class="newsletter-intro"><?php _e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
254 | + <p class="newsletter-intro"><?php _e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
255 | 255 | |
256 | 256 | <?php give_get_newsletter() ?> |
257 | 257 | |
258 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
258 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
259 | 259 | |
260 | 260 | |
261 | 261 | |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | <div class="feature-section clearfix introduction"> |
265 | 265 | |
266 | 266 | <div class="video feature-section-item"> |
267 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form"> |
|
267 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form"> |
|
268 | 268 | |
269 | 269 | </div> |
270 | 270 | |
271 | 271 | <div class="content feature-section-item last-feature"> |
272 | 272 | |
273 | - <h3><?php _e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
273 | + <h3><?php _e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
274 | 274 | |
275 | - <p><?php _e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
275 | + <p><?php _e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
276 | 276 | <a href="https://givewp.com" target="_blank" class="button-secondary" title="Visit the Give Website">Learn More |
277 | 277 | <span class="dashicons dashicons-external"></span></a> |
278 | 278 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | |
286 | 286 | <div class="content feature-section-item"> |
287 | 287 | |
288 | - <h3><?php _e( 'Getting to Know Give', 'give' ); ?></h3> |
|
288 | + <h3><?php _e('Getting to Know Give', 'give'); ?></h3> |
|
289 | 289 | |
290 | - <p><?php _e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
290 | + <p><?php _e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
291 | 291 | <a href="https://givewp.com/documentation" target="_blank" class="button-secondary" title="Visit the Give Website">View Documentation |
292 | 292 | <span class="dashicons dashicons-external"></span></a> |
293 | 293 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | <div class="content feature-section-item last-feature"> |
297 | 297 | |
298 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give"> |
|
298 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give"> |
|
299 | 299 | |
300 | 300 | </div> |
301 | 301 | |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | * @return void |
316 | 316 | */ |
317 | 317 | public function changelog_screen() { |
318 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
318 | + list($display_version) = explode('-', GIVE_VERSION); |
|
319 | 319 | ?> |
320 | 320 | <div class="wrap about-wrap"> |
321 | - <h1><?php _e( 'Give Changelog', 'give' ); ?></h1> |
|
321 | + <h1><?php _e('Give Changelog', 'give'); ?></h1> |
|
322 | 322 | |
323 | - <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), $display_version ); ?></div> |
|
324 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
323 | + <div class="about-text"><?php printf(__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), $display_version); ?></div> |
|
324 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
325 | 325 | |
326 | 326 | <?php $this->tabs(); ?> |
327 | 327 | |
328 | 328 | <div class="changelog"> |
329 | - <h3><?php _e( 'Full Changelog', 'give' ); ?></h3> |
|
329 | + <h3><?php _e('Full Changelog', 'give'); ?></h3> |
|
330 | 330 | |
331 | 331 | <div class="feature-section"> |
332 | 332 | <?php echo $this->parse_readme(); ?> |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div class="return-to-dashboard"> |
337 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
337 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
338 | 338 | 'post_type' => 'give_forms', |
339 | 339 | 'page' => 'give-settings' |
340 | - ), 'edit.php' ) ) ); ?>"><?php _e( 'Go to Give Settings', 'give' ); ?></a> |
|
340 | + ), 'edit.php'))); ?>"><?php _e('Go to Give Settings', 'give'); ?></a> |
|
341 | 341 | </div> |
342 | 342 | </div> |
343 | 343 | <?php |
@@ -351,35 +351,35 @@ discard block |
||
351 | 351 | * @return void |
352 | 352 | */ |
353 | 353 | public function getting_started_screen() { |
354 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
354 | + list($display_version) = explode('-', GIVE_VERSION); |
|
355 | 355 | ?> |
356 | 356 | <div class="wrap about-wrap get-started"> |
357 | - <h1 class="welcome-h1"><?php printf( __( 'Give %s - Getting Started Guide', 'give' ), $display_version ); ?></h1> |
|
357 | + <h1 class="welcome-h1"><?php printf(__('Give %s - Getting Started Guide', 'give'), $display_version); ?></h1> |
|
358 | 358 | |
359 | 359 | <?php give_social_media_elements() ?> |
360 | 360 | |
361 | - <div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div> |
|
361 | + <div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div> |
|
362 | 362 | |
363 | - <p class="newsletter-intro"><?php _e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?>.</p> |
|
363 | + <p class="newsletter-intro"><?php _e('Don\'t forget to sign up for the newsletter!', 'give'); ?>.</p> |
|
364 | 364 | |
365 | 365 | <?php give_get_newsletter() ?> |
366 | 366 | |
367 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
367 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
368 | 368 | |
369 | 369 | <?php $this->tabs(); ?> |
370 | 370 | |
371 | 371 | |
372 | - <div class="about-text"><?php printf( __( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></div> |
|
372 | + <div class="about-text"><?php printf(__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></div> |
|
373 | 373 | |
374 | 374 | |
375 | 375 | <div class="feature-section clearfix"> |
376 | 376 | |
377 | 377 | <div class="content feature-section-item"> |
378 | - <h3><?php _e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
378 | + <h3><?php _e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
379 | 379 | |
380 | - <p><?php _e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p> |
|
380 | + <p><?php _e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p> |
|
381 | 381 | |
382 | - <p><?php _e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p> |
|
382 | + <p><?php _e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p> |
|
383 | 383 | </div> |
384 | 384 | |
385 | 385 | <div class="content feature-section-item last-feature"> |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | </div> |
397 | 397 | |
398 | 398 | <div class="content feature-section-item last-feature"> |
399 | - <h3><?php _e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3> |
|
399 | + <h3><?php _e('STEP 2: Choose Your Levels', 'give'); ?></h3> |
|
400 | 400 | |
401 | - <p><?php _e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p> |
|
401 | + <p><?php _e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p> |
|
402 | 402 | </div> |
403 | 403 | |
404 | 404 | </div> |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | <div class="feature-section clearfix"> |
408 | 408 | |
409 | 409 | <div class="content feature-section-item add-content"> |
410 | - <h3><?php _e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3> |
|
410 | + <h3><?php _e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3> |
|
411 | 411 | |
412 | - <p><?php _e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p> |
|
412 | + <p><?php _e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p> |
|
413 | 413 | |
414 | - <p><?php _e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
414 | + <p><?php _e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
415 | 415 | </div> |
416 | 416 | |
417 | 417 | <div class="content feature-section-item last-feature"> |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | </div> |
429 | 429 | |
430 | 430 | <div class="content feature-section-item last-feature"> |
431 | - <h3><?php _e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
431 | + <h3><?php _e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
432 | 432 | |
433 | - <p><?php _e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p> |
|
433 | + <p><?php _e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p> |
|
434 | 434 | </div> |
435 | 435 | |
436 | 436 | |
@@ -450,26 +450,26 @@ discard block |
||
450 | 450 | * @return void |
451 | 451 | */ |
452 | 452 | public function credits_screen() { |
453 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
453 | + list($display_version) = explode('-', GIVE_VERSION); |
|
454 | 454 | ?> |
455 | 455 | <div class="wrap about-wrap"> |
456 | - <h1 class="welcome-h1"><?php printf( __( 'Give %s - Credits', 'give' ), $display_version ); ?></h1> |
|
456 | + <h1 class="welcome-h1"><?php printf(__('Give %s - Credits', 'give'), $display_version); ?></h1> |
|
457 | 457 | |
458 | 458 | <?php give_social_media_elements() ?> |
459 | 459 | |
460 | - <div class="about-text"><?php printf( __( 'Thanks to all those who have contributed code directly or indirectly. ', 'give' ), $display_version ); ?></div> |
|
460 | + <div class="about-text"><?php printf(__('Thanks to all those who have contributed code directly or indirectly. ', 'give'), $display_version); ?></div> |
|
461 | 461 | |
462 | - <div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div> |
|
462 | + <div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div> |
|
463 | 463 | |
464 | 464 | <p class="newsletter-intro">Be sure to sign up for the Give newsletter below to stay informed of important updates and news.</p> |
465 | 465 | |
466 | 466 | <?php give_get_newsletter() ?> |
467 | 467 | |
468 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
468 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
469 | 469 | |
470 | 470 | <?php $this->tabs(); ?> |
471 | 471 | |
472 | - <p class="about-description"><?php _e( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give' ); ?></p> |
|
472 | + <p class="about-description"><?php _e('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give'); ?></p> |
|
473 | 473 | |
474 | 474 | <?php echo $this->contributors(); ?> |
475 | 475 | </div> |
@@ -484,21 +484,21 @@ discard block |
||
484 | 484 | * @return string $readme HTML formatted readme file |
485 | 485 | */ |
486 | 486 | public function parse_readme() { |
487 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
487 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
488 | 488 | |
489 | - if ( ! $file ) { |
|
490 | - $readme = '<p>' . __( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
489 | + if ( ! $file) { |
|
490 | + $readme = '<p>'.__('No valid changlog was found.', 'give').'</p>'; |
|
491 | 491 | } else { |
492 | - $readme = file_get_contents( $file ); |
|
493 | - $readme = nl2br( esc_html( $readme ) ); |
|
494 | - $readme = explode( '== Changelog ==', $readme ); |
|
495 | - $readme = end( $readme ); |
|
496 | - |
|
497 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
498 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
499 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
500 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
501 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
492 | + $readme = file_get_contents($file); |
|
493 | + $readme = nl2br(esc_html($readme)); |
|
494 | + $readme = explode('== Changelog ==', $readme); |
|
495 | + $readme = end($readme); |
|
496 | + |
|
497 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
498 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
499 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
500 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
501 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | return $readme; |
@@ -515,21 +515,21 @@ discard block |
||
515 | 515 | public function contributors() { |
516 | 516 | $contributors = $this->get_contributors(); |
517 | 517 | |
518 | - if ( empty( $contributors ) ) { |
|
518 | + if (empty($contributors)) { |
|
519 | 519 | return ''; |
520 | 520 | } |
521 | 521 | |
522 | 522 | $contributor_list = '<ul class="wp-people-group">'; |
523 | 523 | |
524 | - foreach ( $contributors as $contributor ) { |
|
524 | + foreach ($contributors as $contributor) { |
|
525 | 525 | $contributor_list .= '<li class="wp-person">'; |
526 | - $contributor_list .= sprintf( '<a href="%s" title="%s">', |
|
527 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
528 | - esc_html( sprintf( __( 'View %s', 'give' ), $contributor->login ) ) |
|
526 | + $contributor_list .= sprintf('<a href="%s" title="%s">', |
|
527 | + esc_url('https://github.com/'.$contributor->login), |
|
528 | + esc_html(sprintf(__('View %s', 'give'), $contributor->login)) |
|
529 | 529 | ); |
530 | - $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) ); |
|
530 | + $contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login)); |
|
531 | 531 | $contributor_list .= '</a>'; |
532 | - $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) ); |
|
532 | + $contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login)); |
|
533 | 533 | $contributor_list .= '</a>'; |
534 | 534 | $contributor_list .= '</li>'; |
535 | 535 | } |
@@ -547,25 +547,25 @@ discard block |
||
547 | 547 | * @return array $contributors List of contributors |
548 | 548 | */ |
549 | 549 | public function get_contributors() { |
550 | - $contributors = get_transient( 'give_contributors' ); |
|
550 | + $contributors = get_transient('give_contributors'); |
|
551 | 551 | |
552 | - if ( false !== $contributors ) { |
|
552 | + if (false !== $contributors) { |
|
553 | 553 | return $contributors; |
554 | 554 | } |
555 | 555 | |
556 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
556 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
557 | 557 | |
558 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
558 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
559 | 559 | return array(); |
560 | 560 | } |
561 | 561 | |
562 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
562 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
563 | 563 | |
564 | - if ( ! is_array( $contributors ) ) { |
|
564 | + if ( ! is_array($contributors)) { |
|
565 | 565 | return array(); |
566 | 566 | } |
567 | 567 | |
568 | - set_transient( 'give_contributors', $contributors, 3600 ); |
|
568 | + set_transient('give_contributors', $contributors, 3600); |
|
569 | 569 | |
570 | 570 | return $contributors; |
571 | 571 | } |
@@ -584,24 +584,24 @@ discard block |
||
584 | 584 | |
585 | 585 | |
586 | 586 | // Bail if no activation redirect |
587 | - if ( ! get_transient( '_give_activation_redirect' ) ) { |
|
587 | + if ( ! get_transient('_give_activation_redirect')) { |
|
588 | 588 | return; |
589 | 589 | } |
590 | 590 | |
591 | 591 | // Delete the redirect transient |
592 | - delete_transient( '_give_activation_redirect' ); |
|
592 | + delete_transient('_give_activation_redirect'); |
|
593 | 593 | |
594 | 594 | // Bail if activating from network, or bulk |
595 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
595 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
596 | 596 | return; |
597 | 597 | } |
598 | 598 | |
599 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
599 | + $upgrade = get_option('give_version_upgraded_from'); |
|
600 | 600 | |
601 | - if ( ! $upgrade ) { // First time install |
|
602 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
601 | + if ( ! $upgrade) { // First time install |
|
602 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
603 | 603 | exit; |
604 | - } elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings |
|
604 | + } elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings |
|
605 | 605 | |
606 | 606 | } else { // Welcome is NOT disabled in settings |
607 | 607 | wp_safe_redirect(admin_url('index.php?page=give-about')); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Payment Actions |
|
4 | - * |
|
5 | - * @package Give |
|
6 | - * @subpackage Payments |
|
7 | - * @copyright Copyright (c) 2015, WordImpress |
|
8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | - * @since 1.0 |
|
10 | - */ |
|
3 | + * Payment Actions |
|
4 | + * |
|
5 | + * @package Give |
|
6 | + * @subpackage Payments |
|
7 | + * @copyright Copyright (c) 2015, WordImpress |
|
8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | + * @since 1.0 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -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 | |
@@ -28,66 +28,66 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
32 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
33 | 33 | return; |
34 | 34 | } // Make sure that payments are only completed once |
35 | 35 | |
36 | 36 | // Make sure the payment completion is only processed when new status is complete |
37 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
37 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
41 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
42 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
43 | - $completed_date = give_get_payment_completed_date( $payment_id ); |
|
44 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
45 | - $donor_id = give_get_payment_customer_id( $payment_id ); |
|
46 | - $amount = give_get_payment_amount( $payment_id ); |
|
41 | + $payment_meta = give_get_payment_meta($payment_id); |
|
42 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
43 | + $completed_date = give_get_payment_completed_date($payment_id); |
|
44 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
45 | + $donor_id = give_get_payment_customer_id($payment_id); |
|
46 | + $amount = give_get_payment_amount($payment_id); |
|
47 | 47 | |
48 | - do_action( 'give_pre_complete_purchase', $payment_id ); |
|
48 | + do_action('give_pre_complete_purchase', $payment_id); |
|
49 | 49 | |
50 | - $price_id = isset( $_POST['give-price-id'] ) ? (int) $_POST['give-price-id'] : false; |
|
50 | + $price_id = isset($_POST['give-price-id']) ? (int) $_POST['give-price-id'] : false; |
|
51 | 51 | |
52 | 52 | // Ensure these actions only run once, ever |
53 | - if ( empty( $completed_date ) ) { |
|
53 | + if (empty($completed_date)) { |
|
54 | 54 | |
55 | - if ( ! give_is_test_mode() || apply_filters( 'give_log_test_payment_stats', false ) ) { |
|
55 | + if ( ! give_is_test_mode() || apply_filters('give_log_test_payment_stats', false)) { |
|
56 | 56 | |
57 | - give_record_sale_in_log( $payment_meta['form_id'], $payment_id, $price_id, $creation_date ); |
|
58 | - give_increase_purchase_count( $payment_meta['form_id'] ); |
|
59 | - give_increase_earnings( $payment_meta['form_id'], $amount ); |
|
57 | + give_record_sale_in_log($payment_meta['form_id'], $payment_id, $price_id, $creation_date); |
|
58 | + give_increase_purchase_count($payment_meta['form_id']); |
|
59 | + give_increase_earnings($payment_meta['form_id'], $amount); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - do_action( 'give_complete_form_donation', $payment_meta['form_id'], $payment_id, $payment_meta ); |
|
63 | + do_action('give_complete_form_donation', $payment_meta['form_id'], $payment_id, $payment_meta); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
67 | 67 | // Clear the total earnings cache |
68 | - delete_transient( 'give_earnings_total' ); |
|
68 | + delete_transient('give_earnings_total'); |
|
69 | 69 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
70 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
71 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
70 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
71 | + delete_transient(md5('give_earnings_todaytoday')); |
|
72 | 72 | |
73 | 73 | |
74 | 74 | // Increase the donor's purchase stats |
75 | - Give()->customers->increment_stats( $donor_id, $amount ); |
|
75 | + Give()->customers->increment_stats($donor_id, $amount); |
|
76 | 76 | |
77 | - give_increase_total_earnings( $amount ); |
|
77 | + give_increase_total_earnings($amount); |
|
78 | 78 | |
79 | 79 | // Ensure this action only runs once ever |
80 | - if ( empty( $completed_date ) ) { |
|
80 | + if (empty($completed_date)) { |
|
81 | 81 | |
82 | 82 | // Save the completed date |
83 | - give_update_payment_meta( $payment_id, '_give_completed_date', current_time( 'mysql' ) ); |
|
83 | + give_update_payment_meta($payment_id, '_give_completed_date', current_time('mysql')); |
|
84 | 84 | |
85 | - do_action( 'give_complete_purchase', $payment_id ); |
|
85 | + do_action('give_complete_purchase', $payment_id); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
90 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
91 | 91 | |
92 | 92 | |
93 | 93 | /** |
@@ -101,19 +101,19 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return void |
103 | 103 | */ |
104 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
104 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
105 | 105 | |
106 | 106 | // Get the list of statuses so that status in the payment note can be translated |
107 | 107 | $stati = give_get_payment_statuses(); |
108 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
109 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
108 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
109 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
110 | 110 | |
111 | - $status_change = sprintf( __( 'Status changed from %s to %s', 'give' ), $old_status, $new_status ); |
|
111 | + $status_change = sprintf(__('Status changed from %s to %s', 'give'), $old_status, $new_status); |
|
112 | 112 | |
113 | - give_insert_payment_note( $payment_id, $status_change ); |
|
113 | + give_insert_payment_note($payment_id, $status_change); |
|
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
116 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Reduces earnings and donation stats when a donation is refunded |
@@ -126,40 +126,40 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return void |
128 | 128 | */ |
129 | -function give_undo_donation_on_refund( $payment_id, $new_status, $old_status ) { |
|
129 | +function give_undo_donation_on_refund($payment_id, $new_status, $old_status) { |
|
130 | 130 | |
131 | - if ( 'publish' != $old_status && 'revoked' != $old_status ) { |
|
131 | + if ('publish' != $old_status && 'revoked' != $old_status) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if ( 'refunded' != $new_status ) { |
|
135 | + if ('refunded' != $new_status) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Set necessary vars |
140 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
141 | - $amount = give_get_payment_amount( $payment_id ); |
|
140 | + $payment_meta = give_get_payment_meta($payment_id); |
|
141 | + $amount = give_get_payment_amount($payment_id); |
|
142 | 142 | |
143 | 143 | // Undo this purchase |
144 | - give_undo_purchase( $payment_meta['form_id'], $payment_id ); |
|
144 | + give_undo_purchase($payment_meta['form_id'], $payment_id); |
|
145 | 145 | |
146 | 146 | // Decrease total earnings |
147 | - give_decrease_total_earnings( $amount ); |
|
147 | + give_decrease_total_earnings($amount); |
|
148 | 148 | |
149 | 149 | // Decrement the stats for the donor |
150 | - $donor_id = give_get_payment_customer_id( $payment_id ); |
|
150 | + $donor_id = give_get_payment_customer_id($payment_id); |
|
151 | 151 | |
152 | - if ( $donor_id ) { |
|
152 | + if ($donor_id) { |
|
153 | 153 | |
154 | - Give()->customers->decrement_stats( $donor_id, $amount ); |
|
154 | + Give()->customers->decrement_stats($donor_id, $amount); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
159 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
159 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
160 | 160 | } |
161 | 161 | |
162 | -add_action( 'give_update_payment_status', 'give_undo_donation_on_refund', 100, 3 ); |
|
162 | +add_action('give_update_payment_status', 'give_undo_donation_on_refund', 100, 3); |
|
163 | 163 | |
164 | 164 | |
165 | 165 | /** |
@@ -172,13 +172,13 @@ discard block |
||
172 | 172 | * @param $new_status the status of the payment, probably "publish" |
173 | 173 | * @param $old_status the status of the payment prior to being marked as "complete", probably "pending" |
174 | 174 | */ |
175 | -function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) { |
|
176 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
175 | +function give_clear_user_history_cache($payment_id, $new_status, $old_status) { |
|
176 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
177 | 177 | |
178 | - delete_transient( 'give_user_' . $user_info['id'] . '_purchases' ); |
|
178 | + delete_transient('give_user_'.$user_info['id'].'_purchases'); |
|
179 | 179 | } |
180 | 180 | |
181 | -add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 ); |
|
181 | +add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3); |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Updates all old payments, prior to 1.2, with new |
@@ -192,32 +192,32 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return void |
194 | 194 | */ |
195 | -function give_update_old_payments_with_totals( $data ) { |
|
196 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
195 | +function give_update_old_payments_with_totals($data) { |
|
196 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
197 | 197 | return; |
198 | 198 | } |
199 | 199 | |
200 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
200 | + if (get_option('give_payment_totals_upgraded')) { |
|
201 | 201 | return; |
202 | 202 | } |
203 | 203 | |
204 | - $payments = give_get_payments( array( |
|
204 | + $payments = give_get_payments(array( |
|
205 | 205 | 'offset' => 0, |
206 | - 'number' => - 1, |
|
206 | + 'number' => -1, |
|
207 | 207 | 'mode' => 'all' |
208 | - ) ); |
|
208 | + )); |
|
209 | 209 | |
210 | - if ( $payments ) { |
|
211 | - foreach ( $payments as $payment ) { |
|
212 | - $meta = give_get_payment_meta( $payment->ID ); |
|
213 | - give_update_payment_meta( $payment->ID, '_give_payment_total', $meta['amount'] ); |
|
210 | + if ($payments) { |
|
211 | + foreach ($payments as $payment) { |
|
212 | + $meta = give_get_payment_meta($payment->ID); |
|
213 | + give_update_payment_meta($payment->ID, '_give_payment_total', $meta['amount']); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
217 | + add_option('give_payment_totals_upgraded', 1); |
|
218 | 218 | } |
219 | 219 | |
220 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
220 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
221 | 221 | |
222 | 222 | /** |
223 | 223 | * Updates week-old+ 'pending' orders to 'abandoned' |
@@ -226,29 +226,29 @@ discard block |
||
226 | 226 | * @return void |
227 | 227 | */ |
228 | 228 | function give_mark_abandoned_donations() { |
229 | - $args = array( |
|
229 | + $args = array( |
|
230 | 230 | 'status' => 'pending', |
231 | - 'number' => - 1, |
|
231 | + 'number' => -1, |
|
232 | 232 | 'fields' => 'ids' |
233 | 233 | ); |
234 | 234 | |
235 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
235 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
236 | 236 | |
237 | - $payments = give_get_payments( $args ); |
|
237 | + $payments = give_get_payments($args); |
|
238 | 238 | |
239 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
239 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
240 | 240 | |
241 | - if ( $payments ) { |
|
242 | - foreach ( $payments as $payment ) { |
|
243 | - $gateway = give_get_payment_gateway( $payment ); |
|
241 | + if ($payments) { |
|
242 | + foreach ($payments as $payment) { |
|
243 | + $gateway = give_get_payment_gateway($payment); |
|
244 | 244 | //Skip offline gateway payments |
245 | - if ( $gateway == 'offline' ) { |
|
245 | + if ($gateway == 'offline') { |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | //Non-offline get marked as 'abandoned' |
249 | - give_update_payment_status( $payment, 'abandoned' ); |
|
249 | + give_update_payment_status($payment, 'abandoned'); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
255 | 254 | \ No newline at end of file |
255 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
256 | 256 | \ 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 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @see Give_Cron::weekly_events() |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
33 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
32 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
33 | + add_action('wp', array($this, 'schedule_Events')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return array |
44 | 44 | */ |
45 | - public function add_schedules( $schedules = array() ) { |
|
45 | + public function add_schedules($schedules = array()) { |
|
46 | 46 | // Adds once weekly to the existing schedules. |
47 | 47 | $schedules['weekly'] = array( |
48 | 48 | 'interval' => 604800, |
49 | - 'display' => __( 'Once Weekly', 'easy-digital-downloads' ) |
|
49 | + 'display' => __('Once Weekly', 'easy-digital-downloads') |
|
50 | 50 | ); |
51 | 51 | |
52 | 52 | return $schedules; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | private function weekly_events() { |
75 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
76 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
75 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
76 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | private function daily_events() { |
88 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
89 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
88 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
89 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | 24 | 'admin_label' => 'Offline Donation', |
25 | - 'checkout_label' => __( 'Offline Donation', 'give' ) |
|
25 | + 'checkout_label' => __('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,48 +40,48 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | |
45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
48 | 48 | $offline_instructions = $global_offline_instruction; |
49 | 49 | |
50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
50 | + if ($post_offline_customization_option == 'yes') { |
|
51 | 51 | $offline_instructions = $post_offline_instructions; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | ob_start(); ?> |
56 | - <?php do_action( 'give_before_offline_info_fields', $form_id ); ?> |
|
56 | + <?php do_action('give_before_offline_info_fields', $form_id); ?> |
|
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | 58 | <?php |
59 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
60 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in the %s.', 'give' ), '<a href="' . $settings_url . '">' . __( 'this form\'s settings', 'give' ) . '</a>' ); |
|
61 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
59 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
60 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in the %s.', 'give'), '<a href="'.$settings_url.'">'.__('this form\'s settings', 'give').'</a>'); |
|
61 | + echo wpautop(stripslashes($offline_instructions)); |
|
62 | 62 | ?> |
63 | 63 | </fieldset> |
64 | - <?php do_action( 'give_after_offline_info_fields', $form_id ); ?> |
|
64 | + <?php do_action('give_after_offline_info_fields', $form_id); ?> |
|
65 | 65 | <?php |
66 | 66 | echo ob_get_clean(); |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
69 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | -function give_offline_billing_fields($form_id){ |
|
73 | +function give_offline_billing_fields($form_id) { |
|
74 | 74 | //Enable Default CC fields (billing info) |
75 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
76 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
75 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
76 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
77 | 77 | |
78 | 78 | |
79 | - if ( $global_offline_cc_fields == 'on' || $post_offline_cc_fields == 'on' ) { |
|
80 | - give_default_cc_address_fields( $form_id ); |
|
79 | + if ($global_offline_cc_fields == 'on' || $post_offline_cc_fields == 'on') { |
|
80 | + give_default_cc_address_fields($form_id); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | -add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
84 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Process the payment |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | * @since 1.0 |
90 | 90 | * @return void |
91 | 91 | */ |
92 | -function give_offline_process_payment( $purchase_data ) { |
|
92 | +function give_offline_process_payment($purchase_data) { |
|
93 | 93 | |
94 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
94 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
95 | 95 | |
96 | 96 | // setup the payment details |
97 | 97 | $payment_data = array( |
98 | 98 | 'price' => $purchase_data['price'], |
99 | 99 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
100 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
100 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
101 | 101 | 'date' => $purchase_data['date'], |
102 | 102 | 'user_email' => $purchase_data['user_email'], |
103 | 103 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | |
110 | 110 | |
111 | 111 | // record the pending payment |
112 | - $payment = give_insert_payment( $payment_data ); |
|
112 | + $payment = give_insert_payment($payment_data); |
|
113 | 113 | |
114 | - if ( $payment ) { |
|
115 | - give_offline_send_admin_notice( $payment ); |
|
116 | - give_offline_send_donor_instructions( $payment ); |
|
114 | + if ($payment) { |
|
115 | + give_offline_send_admin_notice($payment); |
|
116 | + give_offline_send_donor_instructions($payment); |
|
117 | 117 | give_send_to_success_page(); |
118 | 118 | } else { |
119 | 119 | // if errors are present, send the user back to the donation form so they can be corrected |
120 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
120 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
125 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
126 | 126 | |
127 | 127 | |
128 | 128 | /** |
@@ -135,47 +135,47 @@ discard block |
||
135 | 135 | * @since 1.0 |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
138 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
139 | 139 | |
140 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
141 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
140 | + $payment_data = give_get_payment_meta($payment_id); |
|
141 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
142 | 142 | |
143 | 143 | //Customize email content depending on whether the single form has been customized |
144 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
144 | + $email_content = give_get_option('global_offline_donation_email'); |
|
145 | 145 | |
146 | - if ( $post_offline_customization_option === 'yes' ) { |
|
147 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
146 | + if ($post_offline_customization_option === 'yes') { |
|
147 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
148 | 148 | } |
149 | 149 | |
150 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
151 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
150 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
151 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
152 | 152 | |
153 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
154 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
153 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
154 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
155 | 155 | |
156 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
156 | + $to_email = give_get_payment_user_email($payment_id); |
|
157 | 157 | |
158 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
159 | - if ( $post_offline_customization_option === 'yes' ) { |
|
160 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
158 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
159 | + if ($post_offline_customization_option === 'yes') { |
|
160 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
161 | 161 | } |
162 | 162 | |
163 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
164 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
163 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
164 | + $subject = give_do_email_tags($subject, $payment_id); |
|
165 | 165 | |
166 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
167 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
166 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
167 | + $message = give_do_email_tags($email_content, $payment_id); |
|
168 | 168 | |
169 | 169 | $emails = Give()->emails; |
170 | 170 | |
171 | - $emails->__set( 'from_name', $from_name ); |
|
172 | - $emails->__set( 'from_email', $from_email ); |
|
173 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
171 | + $emails->__set('from_name', $from_name); |
|
172 | + $emails->__set('from_email', $from_email); |
|
173 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
174 | 174 | |
175 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
176 | - $emails->__set( 'headers', $headers ); |
|
175 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
176 | + $emails->__set('headers', $headers); |
|
177 | 177 | |
178 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
178 | + $emails->send($to_email, $subject, $message, $attachments); |
|
179 | 179 | |
180 | 180 | } |
181 | 181 | |
@@ -192,37 +192,37 @@ discard block |
||
192 | 192 | * @return void |
193 | 193 | * |
194 | 194 | */ |
195 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
195 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
196 | 196 | |
197 | 197 | /* Send an email notification to the admin */ |
198 | 198 | $admin_email = give_get_admin_notice_emails(); |
199 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
199 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
200 | 200 | |
201 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
202 | - $user_data = get_userdata( $user_info['id'] ); |
|
201 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
202 | + $user_data = get_userdata($user_info['id']); |
|
203 | 203 | $name = $user_data->display_name; |
204 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
205 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
204 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
205 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
206 | 206 | } else { |
207 | 207 | $name = $user_info['email']; |
208 | 208 | } |
209 | 209 | |
210 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
210 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
211 | 211 | |
212 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
212 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
213 | 213 | |
214 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n" . __( 'An offline donation has been made', 'give' ) . ".\n\n"; |
|
214 | + $admin_message = __('Dear Admin,', 'give')."\n\n".__('An offline donation has been made', 'give').".\n\n"; |
|
215 | 215 | |
216 | - $order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ); |
|
217 | - $admin_message .= __( 'Donor: ', 'give' ) . " " . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
218 | - $admin_message .= __( 'Amount: ', 'give' ) . " " . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n"; |
|
219 | - $admin_message .= __( 'This is a pending donation awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
220 | - $admin_message .= sprintf( __( 'View Donation Details: %s.', 'give' ), $order_url ) . "\n\n"; |
|
221 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
222 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
223 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
216 | + $order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id); |
|
217 | + $admin_message .= __('Donor: ', 'give')." ".html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
218 | + $admin_message .= __('Amount: ', 'give')." ".html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n"; |
|
219 | + $admin_message .= __('This is a pending donation awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
220 | + $admin_message .= sprintf(__('View Donation Details: %s.', 'give'), $order_url)."\n\n"; |
|
221 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
222 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
223 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
224 | 224 | |
225 | - wp_mail( $admin_email, $admin_subject, $admin_message, $admin_headers, $attachments ); |
|
225 | + wp_mail($admin_email, $admin_subject, $admin_message, $admin_headers, $attachments); |
|
226 | 226 | |
227 | 227 | } |
228 | 228 | |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | * @since 1.0 |
234 | 234 | * @return array |
235 | 235 | */ |
236 | -function give_offline_add_settings( $settings ) { |
|
236 | +function give_offline_add_settings($settings) { |
|
237 | 237 | |
238 | 238 | //Vars |
239 | 239 | $prefix = '_give_'; |
240 | 240 | |
241 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
241 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
242 | 242 | |
243 | 243 | //this gateway isn't active |
244 | - if ( ! $is_gateway_active ) { |
|
244 | + if ( ! $is_gateway_active) { |
|
245 | 245 | //return settings and bounce |
246 | 246 | return $settings; |
247 | 247 | } |
@@ -250,27 +250,27 @@ discard block |
||
250 | 250 | $check_settings = array( |
251 | 251 | |
252 | 252 | array( |
253 | - 'name' => __( 'Customize Offline Donations', 'give' ), |
|
254 | - 'desc' => __( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
255 | - 'id' => $prefix . 'customize_offline_donations', |
|
253 | + 'name' => __('Customize Offline Donations', 'give'), |
|
254 | + 'desc' => __('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
255 | + 'id' => $prefix.'customize_offline_donations', |
|
256 | 256 | 'type' => 'radio_inline', |
257 | 257 | 'default' => 'no', |
258 | 258 | 'options' => array( |
259 | - 'yes' => __( 'Yes', 'give' ), |
|
260 | - 'no' => __( 'No', 'give' ), |
|
259 | + 'yes' => __('Yes', 'give'), |
|
260 | + 'no' => __('No', 'give'), |
|
261 | 261 | ), |
262 | 262 | ), |
263 | 263 | array( |
264 | - 'name' => __( 'Request Billing Information', 'give' ), |
|
265 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
266 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
264 | + 'name' => __('Request Billing Information', 'give'), |
|
265 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
266 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
267 | 267 | 'row_classes' => 'give-subfield', |
268 | 268 | 'type' => 'checkbox' |
269 | 269 | ), |
270 | 270 | array( |
271 | - 'id' => $prefix . 'offline_checkout_notes', |
|
272 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
273 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
271 | + 'id' => $prefix.'offline_checkout_notes', |
|
272 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
273 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
274 | 274 | 'default' => give_get_default_offline_donation_content(), |
275 | 275 | 'type' => 'wysiwyg', |
276 | 276 | 'row_classes' => 'give-subfield', |
@@ -279,17 +279,17 @@ discard block |
||
279 | 279 | ) |
280 | 280 | ), |
281 | 281 | array( |
282 | - 'id' => $prefix . 'offline_donation_subject', |
|
283 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
284 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
285 | - 'default' => __( '{donation} - Offline Donation Instructions', 'give' ), |
|
282 | + 'id' => $prefix.'offline_donation_subject', |
|
283 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
284 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
285 | + 'default' => __('{donation} - Offline Donation Instructions', 'give'), |
|
286 | 286 | 'row_classes' => 'give-subfield', |
287 | 287 | 'type' => 'text' |
288 | 288 | ), |
289 | 289 | array( |
290 | - 'id' => $prefix . 'offline_donation_email', |
|
291 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
292 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
290 | + 'id' => $prefix.'offline_donation_email', |
|
291 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
292 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
293 | 293 | 'default' => give_get_default_offline_donation_email_content(), |
294 | 294 | 'type' => 'wysiwyg', |
295 | 295 | 'row_classes' => 'give-subfield', |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | ) |
300 | 300 | ); |
301 | 301 | |
302 | - return array_merge( $settings, $check_settings ); |
|
302 | + return array_merge($settings, $check_settings); |
|
303 | 303 | } |
304 | 304 | |
305 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
305 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
306 | 306 | |
307 | 307 | |
308 | 308 | /** |
@@ -314,20 +314,20 @@ discard block |
||
314 | 314 | */ |
315 | 315 | function give_get_default_offline_donation_content() { |
316 | 316 | |
317 | - $sitename = get_bloginfo( 'sitename' ); |
|
317 | + $sitename = get_bloginfo('sitename'); |
|
318 | 318 | |
319 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
319 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
320 | 320 | $default_text .= '<ol>'; |
321 | - $default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>'; |
|
322 | - $default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>'; |
|
323 | - $default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>'; |
|
321 | + $default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>'; |
|
322 | + $default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>'; |
|
323 | + $default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>'; |
|
324 | 324 | $default_text .= '</ol>'; |
325 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
325 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
326 | 326 | $default_text .= ' <em>123 G Street </em><br>'; |
327 | 327 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
328 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
328 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
329 | 329 | |
330 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
330 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
331 | 331 | |
332 | 332 | } |
333 | 333 | |
@@ -340,21 +340,21 @@ discard block |
||
340 | 340 | */ |
341 | 341 | function give_get_default_offline_donation_email_content() { |
342 | 342 | |
343 | - $sitename = get_bloginfo( 'sitename' ); |
|
344 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
345 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
343 | + $sitename = get_bloginfo('sitename'); |
|
344 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
345 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
346 | 346 | $default_text .= '<ol>'; |
347 | - $default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>'; |
|
348 | - $default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>'; |
|
349 | - $default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>'; |
|
347 | + $default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>'; |
|
348 | + $default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>'; |
|
349 | + $default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>'; |
|
350 | 350 | $default_text .= '</ol>'; |
351 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
351 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
352 | 352 | $default_text .= ' <em>123 G Street </em><br>'; |
353 | 353 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
354 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
355 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
356 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
354 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
355 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
356 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
357 | 357 | |
358 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
358 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
359 | 359 | |
360 | 360 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_show_upgrade_notices() { |
27 | 27 | |
28 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
28 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
29 | 29 | return; |
30 | 30 | } // Don't show notices on the upgrades page |
31 | 31 | |
32 | - $give_version = get_option( 'give_version' ); |
|
32 | + $give_version = get_option('give_version'); |
|
33 | 33 | |
34 | - if ( ! $give_version ) { |
|
34 | + if ( ! $give_version) { |
|
35 | 35 | // 1.0 is the first version to use this option so we must add it |
36 | 36 | $give_version = '1.0'; |
37 | 37 | } |
38 | 38 | |
39 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
39 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
40 | 40 | |
41 | 41 | /* |
42 | 42 | * NOTICE: |
@@ -47,18 +47,18 @@ discard block |
||
47 | 47 | */ |
48 | 48 | |
49 | 49 | //v1.3.2 Upgrades |
50 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) { |
|
50 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
51 | 51 | printf( |
52 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
53 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
52 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
53 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
54 | 54 | ); |
55 | 55 | } |
56 | 56 | |
57 | 57 | //v1.3.4 Upgrades //ensure the user has gone through 1.3.4 |
58 | - if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) { |
|
58 | + if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) { |
|
59 | 59 | printf( |
60 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
61 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
60 | + '<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
61 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
71 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Triggers all upgrade functions |
@@ -80,26 +80,26 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function give_trigger_upgrades() { |
82 | 82 | |
83 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
84 | - wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
83 | + if ( ! current_user_can('manage_give_settings')) { |
|
84 | + wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403)); |
|
85 | 85 | } |
86 | 86 | |
87 | - $give_version = get_option( 'give_version' ); |
|
87 | + $give_version = get_option('give_version'); |
|
88 | 88 | |
89 | - if ( ! $give_version ) { |
|
89 | + if ( ! $give_version) { |
|
90 | 90 | // 1.0 is the first version to use this option so we must add it |
91 | 91 | $give_version = '1.0'; |
92 | - add_option( 'give_version', $give_version ); |
|
92 | + add_option('give_version', $give_version); |
|
93 | 93 | } |
94 | 94 | |
95 | - update_option( 'give_version', GIVE_VERSION ); |
|
95 | + update_option('give_version', GIVE_VERSION); |
|
96 | 96 | |
97 | - if ( DOING_AJAX ) { |
|
98 | - die( 'complete' ); |
|
97 | + if (DOING_AJAX) { |
|
98 | + die('complete'); |
|
99 | 99 | } // Let AJAX know that the upgrade is complete |
100 | 100 | } |
101 | 101 | |
102 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
102 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Check if the upgrade routine has been run for a specific action |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return bool If the action has been added to the completed actions array |
112 | 112 | */ |
113 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
113 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
114 | 114 | |
115 | - if ( empty( $upgrade_action ) ) { |
|
115 | + if (empty($upgrade_action)) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $completed_upgrades = give_get_completed_upgrades(); |
120 | 120 | |
121 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
121 | + return in_array($upgrade_action, $completed_upgrades); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @return bool If the function was successfully added |
133 | 133 | */ |
134 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
134 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
135 | 135 | |
136 | - if ( empty( $upgrade_action ) ) { |
|
136 | + if (empty($upgrade_action)) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | $completed_upgrades[] = $upgrade_action; |
142 | 142 | |
143 | 143 | // Remove any blanks, and only show uniques |
144 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
144 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
145 | 145 | |
146 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
146 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | */ |
155 | 155 | function give_get_completed_upgrades() { |
156 | 156 | |
157 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
157 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
158 | 158 | |
159 | - if ( false === $completed_upgrades ) { |
|
159 | + if (false === $completed_upgrades) { |
|
160 | 160 | $completed_upgrades = array(); |
161 | 161 | } |
162 | 162 | |
@@ -175,30 +175,30 @@ discard block |
||
175 | 175 | */ |
176 | 176 | function give_v132_upgrade_give_payment_customer_id() { |
177 | 177 | global $wpdb; |
178 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
179 | - wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
178 | + if ( ! current_user_can('manage_give_settings')) { |
|
179 | + wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403)); |
|
180 | 180 | } |
181 | 181 | |
182 | - ignore_user_abort( true ); |
|
182 | + ignore_user_abort(true); |
|
183 | 183 | |
184 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
185 | - @set_time_limit( 0 ); |
|
184 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
185 | + @set_time_limit(0); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | //UPDATE DB METAKEYS |
189 | 189 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
190 | - $query = $wpdb->query( $sql ); |
|
190 | + $query = $wpdb->query($sql); |
|
191 | 191 | |
192 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
193 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
194 | - delete_option( 'give_doing_upgrade' ); |
|
195 | - wp_redirect( admin_url() ); |
|
192 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
193 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
194 | + delete_option('give_doing_upgrade'); |
|
195 | + wp_redirect(admin_url()); |
|
196 | 196 | exit; |
197 | 197 | |
198 | 198 | |
199 | 199 | } |
200 | 200 | |
201 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
201 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Upgrades the Offline Status |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | |
213 | 213 | global $wpdb; |
214 | 214 | |
215 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
216 | - wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
215 | + if ( ! current_user_can('manage_give_settings')) { |
|
216 | + wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403)); |
|
217 | 217 | } |
218 | 218 | |
219 | - ignore_user_abort( true ); |
|
219 | + ignore_user_abort(true); |
|
220 | 220 | |
221 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
222 | - @set_time_limit( 0 ); |
|
221 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
222 | + @set_time_limit(0); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | // Get abandoned offline payments |
@@ -229,32 +229,32 @@ discard block |
||
229 | 229 | $where .= "AND ( p.post_status = 'abandoned' )"; |
230 | 230 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
231 | 231 | |
232 | - $sql = $select . $join . $where; |
|
233 | - $found_payments = $wpdb->get_col( $sql ); |
|
232 | + $sql = $select.$join.$where; |
|
233 | + $found_payments = $wpdb->get_col($sql); |
|
234 | 234 | |
235 | 235 | |
236 | - foreach ( $found_payments as $payment ) { |
|
236 | + foreach ($found_payments as $payment) { |
|
237 | 237 | |
238 | 238 | //Only change ones marked abandoned since our release last week |
239 | 239 | //because the admin may have marked some abandoned themselves |
240 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
240 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
241 | 241 | |
242 | 242 | //1450124863 = 12/10/2015 20:42:25 |
243 | - if ( $modified_time >= 1450124863 ) { |
|
243 | + if ($modified_time >= 1450124863) { |
|
244 | 244 | |
245 | - give_update_payment_status( $payment, 'pending' ); |
|
245 | + give_update_payment_status($payment, 'pending'); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
252 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
253 | - delete_option( 'give_doing_upgrade' ); |
|
254 | - wp_redirect( admin_url() ); |
|
251 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
252 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
253 | + delete_option('give_doing_upgrade'); |
|
254 | + wp_redirect(admin_url()); |
|
255 | 255 | exit; |
256 | 256 | |
257 | 257 | |
258 | 258 | } |
259 | 259 | |
260 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
260 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_system_info_callback() { |
26 | 26 | |
27 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
27 | + if ( ! current_user_can('manage_give_settings')) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo give_tools_sysinfo_get(); ?></textarea> |
33 | 33 | <p class="submit"> |
34 | 34 | <input type="hidden" name="give-action" value="download_sysinfo" /> |
35 | - <?php submit_button( 'Download System Info File', 'secondary', 'give-download-sysinfo', false ); ?> |
|
35 | + <?php submit_button('Download System Info File', 'secondary', 'give-download-sysinfo', false); ?> |
|
36 | 36 | </p> |
37 | 37 | <style> |
38 | 38 | .give_forms_page_give-settings .give-submit-wrap { |
@@ -55,63 +55,63 @@ discard block |
||
55 | 55 | function give_tools_sysinfo_get() { |
56 | 56 | global $wpdb, $give_options; |
57 | 57 | |
58 | - if ( ! class_exists( 'Browser' ) ) { |
|
59 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php'; |
|
58 | + if ( ! class_exists('Browser')) { |
|
59 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php'; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $browser = new Browser(); |
63 | 63 | |
64 | 64 | // Get theme info |
65 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
66 | - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
67 | - $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; |
|
65 | + if (get_bloginfo('version') < '3.4') { |
|
66 | + $theme_data = get_theme_data(get_stylesheet_directory().'/style.css'); |
|
67 | + $theme = $theme_data['Name'].' '.$theme_data['Version']; |
|
68 | 68 | } else { |
69 | 69 | $theme_data = wp_get_theme(); |
70 | - $theme = $theme_data->Name . ' ' . $theme_data->Version; |
|
70 | + $theme = $theme_data->Name.' '.$theme_data->Version; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Try to identify the hosting provider |
74 | 74 | $host = give_get_host(); |
75 | 75 | |
76 | - $return = '### Begin System Info ###' . "\n\n"; |
|
76 | + $return = '### Begin System Info ###'."\n\n"; |
|
77 | 77 | |
78 | 78 | // Start with the basics... |
79 | - $return .= '-- Site Info' . "\n\n"; |
|
80 | - $return .= 'Site URL: ' . site_url() . "\n"; |
|
81 | - $return .= 'Home URL: ' . home_url() . "\n"; |
|
82 | - $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; |
|
79 | + $return .= '-- Site Info'."\n\n"; |
|
80 | + $return .= 'Site URL: '.site_url()."\n"; |
|
81 | + $return .= 'Home URL: '.home_url()."\n"; |
|
82 | + $return .= 'Multisite: '.(is_multisite() ? 'Yes' : 'No')."\n"; |
|
83 | 83 | |
84 | - $return = apply_filters( 'give_sysinfo_after_site_info', $return ); |
|
84 | + $return = apply_filters('give_sysinfo_after_site_info', $return); |
|
85 | 85 | |
86 | 86 | // Can we determine the site's host? |
87 | - if ( $host ) { |
|
88 | - $return .= "\n" . '-- Hosting Provider' . "\n\n"; |
|
89 | - $return .= 'Host: ' . $host . "\n"; |
|
87 | + if ($host) { |
|
88 | + $return .= "\n".'-- Hosting Provider'."\n\n"; |
|
89 | + $return .= 'Host: '.$host."\n"; |
|
90 | 90 | |
91 | - $return = apply_filters( 'give_sysinfo_after_host_info', $return ); |
|
91 | + $return = apply_filters('give_sysinfo_after_host_info', $return); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // The local users' browser information, handled by the Browser class |
95 | - $return .= "\n" . '-- User Browser' . "\n\n"; |
|
95 | + $return .= "\n".'-- User Browser'."\n\n"; |
|
96 | 96 | $return .= $browser; |
97 | 97 | |
98 | - $return = apply_filters( 'give_sysinfo_after_user_browser', $return ); |
|
98 | + $return = apply_filters('give_sysinfo_after_user_browser', $return); |
|
99 | 99 | |
100 | 100 | // WordPress configuration |
101 | - $return .= "\n" . '-- WordPress Configuration' . "\n\n"; |
|
102 | - $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; |
|
103 | - $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; |
|
104 | - $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; |
|
105 | - $return .= 'Active Theme: ' . $theme . "\n"; |
|
106 | - $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; |
|
101 | + $return .= "\n".'-- WordPress Configuration'."\n\n"; |
|
102 | + $return .= 'Version: '.get_bloginfo('version')."\n"; |
|
103 | + $return .= 'Language: '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n"; |
|
104 | + $return .= 'Permalink Structure: '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n"; |
|
105 | + $return .= 'Active Theme: '.$theme."\n"; |
|
106 | + $return .= 'Show On Front: '.get_option('show_on_front')."\n"; |
|
107 | 107 | |
108 | 108 | // Only show page specs if frontpage is set to 'page' |
109 | - if ( get_option( 'show_on_front' ) == 'page' ) { |
|
110 | - $front_page_id = get_option( 'page_on_front' ); |
|
111 | - $blog_page_id = get_option( 'page_for_posts' ); |
|
109 | + if (get_option('show_on_front') == 'page') { |
|
110 | + $front_page_id = get_option('page_on_front'); |
|
111 | + $blog_page_id = get_option('page_for_posts'); |
|
112 | 112 | |
113 | - $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; |
|
114 | - $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; |
|
113 | + $return .= 'Page On Front: '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n"; |
|
114 | + $return .= 'Page For Posts: '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n"; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // Make sure wp_remote_post() is working |
@@ -120,200 +120,200 @@ discard block |
||
120 | 120 | $params = array( |
121 | 121 | 'sslverify' => false, |
122 | 122 | 'timeout' => 60, |
123 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
123 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
124 | 124 | 'body' => $request |
125 | 125 | ); |
126 | 126 | |
127 | - $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); |
|
127 | + $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); |
|
128 | 128 | |
129 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
129 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
130 | 130 | $WP_REMOTE_POST = 'wp_remote_post() works'; |
131 | 131 | } else { |
132 | 132 | $WP_REMOTE_POST = 'wp_remote_post() does not work'; |
133 | 133 | } |
134 | 134 | |
135 | - $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; |
|
136 | - $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; |
|
137 | - $return .= 'Admin AJAX: ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; |
|
138 | - $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; |
|
139 | - $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; |
|
140 | - $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; |
|
135 | + $return .= 'Remote Post: '.$WP_REMOTE_POST."\n"; |
|
136 | + $return .= 'Table Prefix: '.'Length: '.strlen($wpdb->prefix).' Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n"; |
|
137 | + $return .= 'Admin AJAX: '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n"; |
|
138 | + $return .= 'WP_DEBUG: '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n"; |
|
139 | + $return .= 'Memory Limit: '.WP_MEMORY_LIMIT."\n"; |
|
140 | + $return .= 'Registered Post Stati: '.implode(', ', get_post_stati())."\n"; |
|
141 | 141 | |
142 | - $return = apply_filters( 'give_sysinfo_after_wordpress_config', $return ); |
|
142 | + $return = apply_filters('give_sysinfo_after_wordpress_config', $return); |
|
143 | 143 | |
144 | 144 | // GIVE configuration |
145 | - $return .= "\n" . '-- Give Configuration' . "\n\n"; |
|
146 | - $return .= 'Version: ' . GIVE_VERSION . "\n"; |
|
147 | - $return .= 'Upgraded From: ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n"; |
|
148 | - $return .= 'Test Mode: ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" ); |
|
149 | - $return .= 'Currency Code: ' . give_get_currency() . "\n"; |
|
150 | - $return .= 'Currency Position: ' . give_get_option( 'currency_position', 'before' ) . "\n"; |
|
151 | - $return .= 'Decimal Separator: ' . give_get_option( 'decimal_separator', '.' ) . "\n"; |
|
152 | - $return .= 'Thousands Separator: ' . give_get_option( 'thousands_separator', ',' ) . "\n"; |
|
145 | + $return .= "\n".'-- Give Configuration'."\n\n"; |
|
146 | + $return .= 'Version: '.GIVE_VERSION."\n"; |
|
147 | + $return .= 'Upgraded From: '.get_option('give_version_upgraded_from', 'None')."\n"; |
|
148 | + $return .= 'Test Mode: '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n"); |
|
149 | + $return .= 'Currency Code: '.give_get_currency()."\n"; |
|
150 | + $return .= 'Currency Position: '.give_get_option('currency_position', 'before')."\n"; |
|
151 | + $return .= 'Decimal Separator: '.give_get_option('decimal_separator', '.')."\n"; |
|
152 | + $return .= 'Thousands Separator: '.give_get_option('thousands_separator', ',')."\n"; |
|
153 | 153 | |
154 | - $return = apply_filters( 'give_sysinfo_after_give_config', $return ); |
|
154 | + $return = apply_filters('give_sysinfo_after_give_config', $return); |
|
155 | 155 | |
156 | 156 | // GIVE pages |
157 | - $return .= "\n" . '-- Give Page Configuration' . "\n\n"; |
|
158 | - $return .= 'Success Page: ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" ); |
|
159 | - $return .= 'Failure Page: ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" ); |
|
160 | - $return .= 'Give Forms Slug: ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" ); |
|
157 | + $return .= "\n".'-- Give Page Configuration'."\n\n"; |
|
158 | + $return .= 'Success Page: '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n"); |
|
159 | + $return .= 'Failure Page: '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n"); |
|
160 | + $return .= 'Give Forms Slug: '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n"); |
|
161 | 161 | |
162 | - $return = apply_filters( 'give_sysinfo_after_give_pages', $return ); |
|
162 | + $return = apply_filters('give_sysinfo_after_give_pages', $return); |
|
163 | 163 | |
164 | 164 | // GIVE gateways |
165 | - $return .= "\n" . '-- Give Gateway Configuration' . "\n\n"; |
|
165 | + $return .= "\n".'-- Give Gateway Configuration'."\n\n"; |
|
166 | 166 | |
167 | 167 | $active_gateways = give_get_enabled_payment_gateways(); |
168 | - if ( $active_gateways ) { |
|
169 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
170 | - if ( $default_gateway_is_active ) { |
|
171 | - $default_gateway = give_get_default_gateway( null ); |
|
172 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
168 | + if ($active_gateways) { |
|
169 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
170 | + if ($default_gateway_is_active) { |
|
171 | + $default_gateway = give_get_default_gateway(null); |
|
172 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
173 | 173 | } else { |
174 | 174 | $default_gateway = 'Test Payment'; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $gateways = array(); |
178 | - foreach ( $active_gateways as $gateway ) { |
|
178 | + foreach ($active_gateways as $gateway) { |
|
179 | 179 | $gateways[] = $gateway['admin_label']; |
180 | 180 | } |
181 | 181 | |
182 | - $return .= 'Enabled Gateways: ' . implode( ', ', $gateways ) . "\n"; |
|
183 | - $return .= 'Default Gateway: ' . $default_gateway . "\n"; |
|
182 | + $return .= 'Enabled Gateways: '.implode(', ', $gateways)."\n"; |
|
183 | + $return .= 'Default Gateway: '.$default_gateway."\n"; |
|
184 | 184 | } else { |
185 | - $return .= 'Enabled Gateways: None' . "\n"; |
|
185 | + $return .= 'Enabled Gateways: None'."\n"; |
|
186 | 186 | } |
187 | 187 | |
188 | - $return = apply_filters( 'give_sysinfo_after_give_gateways', $return ); |
|
188 | + $return = apply_filters('give_sysinfo_after_give_gateways', $return); |
|
189 | 189 | |
190 | 190 | // GIVE Templates |
191 | - $dir = get_stylesheet_directory() . '/give_templates/*'; |
|
192 | - if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) { |
|
193 | - $return .= "\n" . '-- Give Template Overrides' . "\n\n"; |
|
191 | + $dir = get_stylesheet_directory().'/give_templates/*'; |
|
192 | + if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) { |
|
193 | + $return .= "\n".'-- Give Template Overrides'."\n\n"; |
|
194 | 194 | |
195 | - foreach ( glob( $dir ) as $file ) { |
|
196 | - $return .= 'Filename: ' . basename( $file ) . "\n"; |
|
195 | + foreach (glob($dir) as $file) { |
|
196 | + $return .= 'Filename: '.basename($file)."\n"; |
|
197 | 197 | } |
198 | 198 | |
199 | - $return = apply_filters( 'give_sysinfo_after_give_templates', $return ); |
|
199 | + $return = apply_filters('give_sysinfo_after_give_templates', $return); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Must-use plugins |
203 | 203 | $muplugins = get_mu_plugins(); |
204 | - if ( count( $muplugins > 0 ) ) { |
|
205 | - $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; |
|
204 | + if (count($muplugins > 0)) { |
|
205 | + $return .= "\n".'-- Must-Use Plugins'."\n\n"; |
|
206 | 206 | |
207 | - foreach ( $muplugins as $plugin => $plugin_data ) { |
|
208 | - $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; |
|
207 | + foreach ($muplugins as $plugin => $plugin_data) { |
|
208 | + $return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n"; |
|
209 | 209 | } |
210 | 210 | |
211 | - $return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return ); |
|
211 | + $return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | // WordPress active plugins |
215 | - $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; |
|
215 | + $return .= "\n".'-- WordPress Active Plugins'."\n\n"; |
|
216 | 216 | |
217 | 217 | $plugins = get_plugins(); |
218 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
218 | + $active_plugins = get_option('active_plugins', array()); |
|
219 | 219 | |
220 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
221 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
220 | + foreach ($plugins as $plugin_path => $plugin) { |
|
221 | + if ( ! in_array($plugin_path, $active_plugins)) { |
|
222 | 222 | continue; |
223 | 223 | } |
224 | 224 | |
225 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
225 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
226 | 226 | } |
227 | 227 | |
228 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return ); |
|
228 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins', $return); |
|
229 | 229 | |
230 | 230 | // WordPress inactive plugins |
231 | - $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; |
|
231 | + $return .= "\n".'-- WordPress Inactive Plugins'."\n\n"; |
|
232 | 232 | |
233 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
234 | - if ( in_array( $plugin_path, $active_plugins ) ) { |
|
233 | + foreach ($plugins as $plugin_path => $plugin) { |
|
234 | + if (in_array($plugin_path, $active_plugins)) { |
|
235 | 235 | continue; |
236 | 236 | } |
237 | 237 | |
238 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
238 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
239 | 239 | } |
240 | 240 | |
241 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return ); |
|
241 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return); |
|
242 | 242 | |
243 | - if ( is_multisite() ) { |
|
243 | + if (is_multisite()) { |
|
244 | 244 | // WordPress Multisite active plugins |
245 | - $return .= "\n" . '-- Network Active Plugins' . "\n\n"; |
|
245 | + $return .= "\n".'-- Network Active Plugins'."\n\n"; |
|
246 | 246 | |
247 | 247 | $plugins = wp_get_active_network_plugins(); |
248 | - $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
|
248 | + $active_plugins = get_site_option('active_sitewide_plugins', array()); |
|
249 | 249 | |
250 | - foreach ( $plugins as $plugin_path ) { |
|
251 | - $plugin_base = plugin_basename( $plugin_path ); |
|
250 | + foreach ($plugins as $plugin_path) { |
|
251 | + $plugin_base = plugin_basename($plugin_path); |
|
252 | 252 | |
253 | - if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { |
|
253 | + if ( ! array_key_exists($plugin_base, $active_plugins)) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | |
257 | - $plugin = get_plugin_data( $plugin_path ); |
|
258 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
257 | + $plugin = get_plugin_data($plugin_path); |
|
258 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
259 | 259 | } |
260 | 260 | |
261 | - $return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return ); |
|
261 | + $return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Server configuration (really just versioning) |
265 | - $return .= "\n" . '-- Webserver Configuration' . "\n\n"; |
|
266 | - $return .= 'PHP Version: ' . PHP_VERSION . "\n"; |
|
267 | - $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; |
|
268 | - $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; |
|
265 | + $return .= "\n".'-- Webserver Configuration'."\n\n"; |
|
266 | + $return .= 'PHP Version: '.PHP_VERSION."\n"; |
|
267 | + $return .= 'MySQL Version: '.$wpdb->db_version()."\n"; |
|
268 | + $return .= 'Webserver Info: '.$_SERVER['SERVER_SOFTWARE']."\n"; |
|
269 | 269 | |
270 | - $return = apply_filters( 'give_sysinfo_after_webserver_config', $return ); |
|
270 | + $return = apply_filters('give_sysinfo_after_webserver_config', $return); |
|
271 | 271 | |
272 | 272 | // PHP configs... now we're getting to the important stuff |
273 | - $return .= "\n" . '-- PHP Configuration' . "\n\n"; |
|
274 | - $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); |
|
275 | - $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; |
|
276 | - $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
277 | - $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; |
|
278 | - $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
279 | - $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; |
|
280 | - $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; |
|
281 | - $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; |
|
282 | - |
|
283 | - $return = apply_filters( 'give_sysinfo_after_php_config', $return ); |
|
273 | + $return .= "\n".'-- PHP Configuration'."\n\n"; |
|
274 | + $return .= 'Safe Mode: '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n"); |
|
275 | + $return .= 'Memory Limit: '.ini_get('memory_limit')."\n"; |
|
276 | + $return .= 'Upload Max Size: '.ini_get('upload_max_filesize')."\n"; |
|
277 | + $return .= 'Post Max Size: '.ini_get('post_max_size')."\n"; |
|
278 | + $return .= 'Upload Max Filesize: '.ini_get('upload_max_filesize')."\n"; |
|
279 | + $return .= 'Time Limit: '.ini_get('max_execution_time')."\n"; |
|
280 | + $return .= 'Max Input Vars: '.ini_get('max_input_vars')."\n"; |
|
281 | + $return .= 'Display Errors: '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n"; |
|
282 | + |
|
283 | + $return = apply_filters('give_sysinfo_after_php_config', $return); |
|
284 | 284 | |
285 | 285 | // PHP extensions and such |
286 | - $return .= "\n" . '-- PHP Extensions' . "\n\n"; |
|
287 | - $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
286 | + $return .= "\n".'-- PHP Extensions'."\n\n"; |
|
287 | + $return .= 'cURL: '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n"; |
|
288 | 288 | |
289 | 289 | //cURL version |
290 | - if ( function_exists( 'curl_init' ) && function_exists( 'curl_version' ) ) { |
|
290 | + if (function_exists('curl_init') && function_exists('curl_version')) { |
|
291 | 291 | $curl_values = curl_version(); |
292 | - $return .= 'cURL Version: ' . $curl_values["version"] . "\n"; |
|
292 | + $return .= 'cURL Version: '.$curl_values["version"]."\n"; |
|
293 | 293 | } |
294 | - $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
295 | - $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
296 | - $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
294 | + $return .= 'fsockopen: '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n"; |
|
295 | + $return .= 'SOAP Client: '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n"; |
|
296 | + $return .= 'Suhosin: '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n"; |
|
297 | 297 | |
298 | - $return = apply_filters( 'give_sysinfo_after_php_ext', $return ); |
|
298 | + $return = apply_filters('give_sysinfo_after_php_ext', $return); |
|
299 | 299 | |
300 | 300 | // Session stuff |
301 | - $return .= "\n" . '-- Session Configuration' . "\n\n"; |
|
302 | - $return .= 'Give Use Sessions: ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n"; |
|
303 | - $return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; |
|
301 | + $return .= "\n".'-- Session Configuration'."\n\n"; |
|
302 | + $return .= 'Give Use Sessions: '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n"; |
|
303 | + $return .= 'Session: '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n"; |
|
304 | 304 | |
305 | 305 | // The rest of this is only relevant is session is enabled |
306 | - if ( isset( $_SESSION ) ) { |
|
307 | - $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; |
|
308 | - $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; |
|
309 | - $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; |
|
310 | - $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
311 | - $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
306 | + if (isset($_SESSION)) { |
|
307 | + $return .= 'Session Name: '.esc_html(ini_get('session.name'))."\n"; |
|
308 | + $return .= 'Cookie Path: '.esc_html(ini_get('session.cookie_path'))."\n"; |
|
309 | + $return .= 'Save Path: '.esc_html(ini_get('session.save_path'))."\n"; |
|
310 | + $return .= 'Use Cookies: '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n"; |
|
311 | + $return .= 'Use Only Cookies: '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n"; |
|
312 | 312 | } |
313 | 313 | |
314 | - $return = apply_filters( 'give_sysinfo_after_session_config', $return ); |
|
314 | + $return = apply_filters('give_sysinfo_after_session_config', $return); |
|
315 | 315 | |
316 | - $return .= "\n" . '### End System Info ###'; |
|
316 | + $return .= "\n".'### End System Info ###'; |
|
317 | 317 | |
318 | 318 | return $return; |
319 | 319 | } |
@@ -327,17 +327,17 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function give_tools_sysinfo_download() { |
329 | 329 | |
330 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
330 | + if ( ! current_user_can('manage_give_settings')) { |
|
331 | 331 | return; |
332 | 332 | } |
333 | 333 | |
334 | 334 | nocache_headers(); |
335 | 335 | |
336 | - header( 'Content-Type: text/plain' ); |
|
337 | - header( 'Content-Disposition: attachment; filename="give-system-info.txt"' ); |
|
336 | + header('Content-Type: text/plain'); |
|
337 | + header('Content-Disposition: attachment; filename="give-system-info.txt"'); |
|
338 | 338 | |
339 | - echo wp_strip_all_tags( $_POST['give-sysinfo'] ); |
|
339 | + echo wp_strip_all_tags($_POST['give-sysinfo']); |
|
340 | 340 | give_die(); |
341 | 341 | } |
342 | 342 | |
343 | -add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' ); |
|
344 | 343 | \ No newline at end of file |
344 | +add_action('give_download_sysinfo', 'give_tools_sysinfo_download'); |
|
345 | 345 | \ 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 | |
@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | give_setup_post_types(); |
33 | 33 | |
34 | 34 | // Clear the permalinks |
35 | - flush_rewrite_rules( false ); |
|
35 | + flush_rewrite_rules(false); |
|
36 | 36 | |
37 | 37 | // Add Upgraded From Option |
38 | - $current_version = get_option( 'give_version' ); |
|
39 | - if ( $current_version ) { |
|
40 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
38 | + $current_version = get_option('give_version'); |
|
39 | + if ($current_version) { |
|
40 | + update_option('give_version_upgraded_from', $current_version); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // Setup some default options |
44 | 44 | $options = array(); |
45 | 45 | |
46 | 46 | // Checks if the Success Page option exists AND that the page exists |
47 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
47 | + if ( ! get_post(give_get_option('success_page'))) { |
|
48 | 48 | |
49 | 49 | // Purchase Confirmation (Success) Page |
50 | 50 | $success = wp_insert_post( |
51 | 51 | array( |
52 | - 'post_title' => __( 'Donation Confirmation', 'give' ), |
|
53 | - 'post_content' => __( 'Thank you for your donation! [give_receipt]', 'give' ), |
|
52 | + 'post_title' => __('Donation Confirmation', 'give'), |
|
53 | + 'post_content' => __('Thank you for your donation! [give_receipt]', 'give'), |
|
54 | 54 | 'post_status' => 'publish', |
55 | 55 | 'post_author' => 1, |
56 | 56 | 'post_type' => 'page', |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // Checks if the Failure Page option exists AND that the page exists |
66 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
66 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
67 | 67 | |
68 | 68 | // Failed Purchase Page |
69 | 69 | $failed = wp_insert_post( |
70 | 70 | array( |
71 | - 'post_title' => __( 'Transaction Failed', 'give' ), |
|
72 | - 'post_content' => __( 'Your transaction failed, please try again or contact site support.', 'give' ), |
|
71 | + 'post_title' => __('Transaction Failed', 'give'), |
|
72 | + 'post_content' => __('Your transaction failed, please try again or contact site support.', 'give'), |
|
73 | 73 | 'post_status' => 'publish', |
74 | 74 | 'post_author' => 1, |
75 | 75 | 'post_type' => 'page', |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // Checks if the History Page option exists AND that the page exists |
84 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
84 | + if ( ! get_post(give_get_option('history_page'))) { |
|
85 | 85 | // Purchase History (History) Page |
86 | 86 | $history = wp_insert_post( |
87 | 87 | array( |
88 | - 'post_title' => __( 'Donation History', 'give' ), |
|
88 | + 'post_title' => __('Donation History', 'give'), |
|
89 | 89 | 'post_content' => '[donation_history]', |
90 | 90 | 'post_status' => 'publish', |
91 | 91 | 'post_author' => 1, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency |
101 | - if ( empty( $current_version ) ) { |
|
101 | + if (empty($current_version)) { |
|
102 | 102 | $options['base_country'] = 'US'; |
103 | 103 | $options['test_mode'] = 1; |
104 | 104 | $options['currency'] = 'USD'; |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | // Populate some default values |
118 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
119 | - update_option( 'give_version', GIVE_VERSION ); |
|
118 | + update_option('give_settings', array_merge($give_options, $options)); |
|
119 | + update_option('give_version', GIVE_VERSION); |
|
120 | 120 | |
121 | 121 | //Update Version Number |
122 | - if ( $current_version ) { |
|
123 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
122 | + if ($current_version) { |
|
123 | + update_option('give_version_upgraded_from', $current_version); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // Create Give roles |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $roles->add_caps(); |
130 | 130 | |
131 | 131 | $api = new Give_API(); |
132 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
132 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
133 | 133 | |
134 | 134 | // Create the customers database |
135 | 135 | @Give()->customers->create_table(); |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | Give()->session->use_php_sessions(); |
139 | 139 | |
140 | 140 | // Add a temporary option to note that Give pages have been created |
141 | - set_transient( '_give_installed', $options, 30 ); |
|
141 | + set_transient('_give_installed', $options, 30); |
|
142 | 142 | |
143 | 143 | |
144 | - if ( ! $current_version ) { |
|
145 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
144 | + if ( ! $current_version) { |
|
145 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
146 | 146 | |
147 | 147 | // When new upgrade routines are added, mark them as complete on fresh install |
148 | 148 | $upgrade_routines = array( |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | 'upgrade_give_offline_status' |
151 | 151 | ); |
152 | 152 | |
153 | - foreach ( $upgrade_routines as $upgrade ) { |
|
154 | - give_set_upgrade_complete( $upgrade ); |
|
153 | + foreach ($upgrade_routines as $upgrade) { |
|
154 | + give_set_upgrade_complete($upgrade); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | // Bail if activating from network, or bulk |
158 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
158 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | // Add the transient to redirect |
162 | - set_transient( '_give_activation_redirect', true, 30 ); |
|
162 | + set_transient('_give_activation_redirect', true, 30); |
|
163 | 163 | |
164 | 164 | } |
165 | 165 | |
166 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
166 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Post-installation |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | */ |
176 | 176 | function give_after_install() { |
177 | 177 | |
178 | - if ( ! is_admin() ) { |
|
178 | + if ( ! is_admin()) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - $give_options = get_transient( '_give_installed' ); |
|
182 | + $give_options = get_transient('_give_installed'); |
|
183 | 183 | |
184 | 184 | // Exit if not in admin or the transient doesn't exist |
185 | - if ( false === $give_options ) { |
|
185 | + if (false === $give_options) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | @Give()->customers->create_table(); |
191 | 191 | |
192 | 192 | // Delete the transient |
193 | - delete_transient( '_give_installed' ); |
|
193 | + delete_transient('_give_installed'); |
|
194 | 194 | |
195 | - do_action( 'give_after_install', $give_options ); |
|
195 | + do_action('give_after_install', $give_options); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
199 | -add_action( 'admin_init', 'give_after_install' ); |
|
199 | +add_action('admin_init', 'give_after_install'); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | /** |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | |
212 | 212 | global $wp_roles; |
213 | 213 | |
214 | - if ( ! is_object( $wp_roles ) ) { |
|
214 | + if ( ! is_object($wp_roles)) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
218 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
219 | 219 | |
220 | 220 | // Create Give shop roles |
221 | 221 | $roles = new Give_Roles; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | } |
228 | 228 | |
229 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
229 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
230 | 230 | |
231 | 231 | /** |
232 | 232 | * Network Activated New Site Setup |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * @param $site_id |
243 | 243 | * @param $meta |
244 | 244 | */ |
245 | -function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
246 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
247 | - switch_to_blog( $blog_id ); |
|
245 | +function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
246 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
247 | + switch_to_blog($blog_id); |
|
248 | 248 | give_install(); |
249 | 249 | restore_current_blog(); |
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | -add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 ); |
|
254 | 253 | \ No newline at end of file |
254 | +add_action('wpmu_new_blog', 'on_create_blog', 10, 6); |
|
255 | 255 | \ No newline at end of file |