@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * Admin View: Exports |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if ( ! defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } ?> |
| 9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @since 1.0 |
| 20 | 20 | */ |
| 21 | - do_action( 'give_tools_tab_export_content_top' ); |
|
| 21 | + do_action('give_tools_tab_export_content_top'); |
|
| 22 | 22 | ?> |
| 23 | 23 | |
| 24 | 24 | <table class="widefat export-options-table give-table"> |
| 25 | 25 | <thead> |
| 26 | 26 | <tr> |
| 27 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
| 28 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
| 27 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
| 28 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
| 29 | 29 | </tr> |
| 30 | 30 | </thead> |
| 31 | 31 | <tbody> |
@@ -38,42 +38,42 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @since 1.0 |
| 40 | 40 | */ |
| 41 | - do_action( 'give_tools_tab_export_table_top' ); |
|
| 41 | + do_action('give_tools_tab_export_table_top'); |
|
| 42 | 42 | ?> |
| 43 | 43 | <tr class="give-export-pdf-sales-earnings"> |
| 44 | 44 | <td scope="row" class="row-title"> |
| 45 | 45 | <h3> |
| 46 | - <span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
| 46 | + <span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
| 47 | 47 | </h3> |
| 48 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
| 48 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
| 49 | 49 | </td> |
| 50 | 50 | <td> |
| 51 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"> |
|
| 52 | - <?php esc_html_e( 'Generate PDF', 'give' ); ?> |
|
| 51 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"> |
|
| 52 | + <?php esc_html_e('Generate PDF', 'give'); ?> |
|
| 53 | 53 | </a> |
| 54 | 54 | </td> |
| 55 | 55 | </tr> |
| 56 | 56 | <tr class="alternate give-export-sales-earnings"> |
| 57 | 57 | <td scope="row" class="row-title"> |
| 58 | 58 | <h3> |
| 59 | - <span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span> |
|
| 59 | + <span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span> |
|
| 60 | 60 | </h3> |
| 61 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
| 61 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
| 62 | 62 | </td> |
| 63 | 63 | <td> |
| 64 | 64 | <form method="post"> |
| 65 | 65 | <?php |
| 66 | 66 | printf( |
| 67 | 67 | /* translators: 1: start date dropdown 2: end date dropdown */ |
| 68 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
| 69 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
| 70 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
| 68 | + esc_html__('%1$s to %2$s', 'give'), |
|
| 69 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
| 70 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
| 71 | 71 | ); |
| 72 | 72 | ?> |
| 73 | 73 | <input type="hidden" name="give-action" |
| 74 | 74 | value="earnings_export"/> |
| 75 | 75 | <input type="submit" |
| 76 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
| 76 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
| 77 | 77 | class="button-secondary"/> |
| 78 | 78 | </form> |
| 79 | 79 | </td> |
@@ -81,37 +81,37 @@ discard block |
||
| 81 | 81 | <tr class="give-export-payment-history"> |
| 82 | 82 | <td scope="row" class="row-title"> |
| 83 | 83 | <h3> |
| 84 | - <span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span> |
|
| 84 | + <span><?php esc_html_e('Export Donation History', 'give'); ?></span> |
|
| 85 | 85 | </h3> |
| 86 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
| 86 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
| 87 | 87 | </td> |
| 88 | 88 | <td> |
| 89 | 89 | <form id="give-export-payments" |
| 90 | 90 | class="give-export-form" method="post"> |
| 91 | 91 | <?php |
| 92 | - echo Give()->html->date_field( array( |
|
| 92 | + echo Give()->html->date_field(array( |
|
| 93 | 93 | 'id' => 'give-payment-export-start', |
| 94 | 94 | 'name' => 'start', |
| 95 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
| 96 | - ) ); |
|
| 95 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
| 96 | + )); |
|
| 97 | 97 | |
| 98 | - echo Give()->html->date_field( array( |
|
| 98 | + echo Give()->html->date_field(array( |
|
| 99 | 99 | 'id' => 'give-payment-export-end', |
| 100 | 100 | 'name' => 'end', |
| 101 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
| 102 | - ) ); |
|
| 101 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
| 102 | + )); |
|
| 103 | 103 | ?> |
| 104 | 104 | <select name="status"> |
| 105 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
| 105 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
| 106 | 106 | <?php |
| 107 | 107 | $statuses = give_get_payment_statuses(); |
| 108 | - foreach ( $statuses as $status => $label ) { |
|
| 109 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
| 108 | + foreach ($statuses as $status => $label) { |
|
| 109 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
| 110 | 110 | } |
| 111 | 111 | ?> |
| 112 | 112 | </select> |
| 113 | 113 | <?php |
| 114 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
| 114 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
| 115 | 115 | echo Give()->html->category_dropdown( |
| 116 | 116 | 'give_forms_categories[]', |
| 117 | 117 | 0, |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | 'multiple' => true, |
| 122 | 122 | 'selected' => array(), |
| 123 | 123 | 'show_option_all' => false, |
| 124 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
| 124 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
| 125 | 125 | ) |
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
| 129 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
| 130 | 130 | echo Give()->html->tags_dropdown( |
| 131 | 131 | 'give_forms_tags[]', |
| 132 | 132 | 0, |
@@ -136,18 +136,18 @@ discard block |
||
| 136 | 136 | 'multiple' => true, |
| 137 | 137 | 'selected' => array(), |
| 138 | 138 | 'show_option_all' => false, |
| 139 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
| 139 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
| 140 | 140 | ) |
| 141 | 141 | ); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
| 144 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
| 145 | 145 | ?> |
| 146 | 146 | <input type="hidden" name="give-export-class" |
| 147 | 147 | value="Give_Batch_Payments_Export"/> |
| 148 | 148 | <span> |
| 149 | 149 | <input type="submit" |
| 150 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
| 150 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
| 151 | 151 | class="button-secondary"/> |
| 152 | 152 | <span class="spinner"></span> |
| 153 | 153 | </span> |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | <tr class="alternate give-export-donors"> |
| 158 | 158 | <td scope="row" class="row-title"> |
| 159 | 159 | <h3> |
| 160 | - <span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span> |
|
| 160 | + <span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span> |
|
| 161 | 161 | </h3> |
| 162 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
| 162 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
| 163 | 163 | </td> |
| 164 | 164 | <td> |
| 165 | 165 | <form method="post" id="give_donor_export" |
@@ -167,99 +167,99 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | <?php |
| 169 | 169 | // Start Date form field for donors |
| 170 | - echo Give()->html->date_field( array( |
|
| 170 | + echo Give()->html->date_field(array( |
|
| 171 | 171 | 'id' => 'give_donor_export_start_date', |
| 172 | 172 | 'name' => 'donor_export_start_date', |
| 173 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
| 174 | - ) ); |
|
| 173 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
| 174 | + )); |
|
| 175 | 175 | |
| 176 | 176 | // End Date form field for donors |
| 177 | - echo Give()->html->date_field( array( |
|
| 177 | + echo Give()->html->date_field(array( |
|
| 178 | 178 | 'id' => 'give_donor_export_end_date', |
| 179 | 179 | 'name' => 'donor_export_end_date', |
| 180 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
| 181 | - ) ); |
|
| 180 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
| 181 | + )); |
|
| 182 | 182 | |
| 183 | 183 | // Donation forms dropdown for donors export |
| 184 | - echo Give()->html->forms_dropdown( array( |
|
| 184 | + echo Give()->html->forms_dropdown(array( |
|
| 185 | 185 | 'name' => 'forms', |
| 186 | 186 | 'id' => 'give_donor_export_form', |
| 187 | 187 | 'chosen' => true, |
| 188 | - ) ); |
|
| 188 | + )); |
|
| 189 | 189 | ?> |
| 190 | 190 | |
| 191 | 191 | <input type="submit" |
| 192 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
| 192 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
| 193 | 193 | class="button-secondary"/> |
| 194 | 194 | |
| 195 | 195 | <div id="export-donor-options-wrap" |
| 196 | 196 | class="give-clearfix"> |
| 197 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
| 197 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
| 198 | 198 | <ul id="give-export-option-ul"> |
| 199 | 199 | <li> |
| 200 | 200 | <label for="give-export-fullname"> |
| 201 | 201 | <input type="checkbox" checked |
| 202 | 202 | name="give_export_option[full_name]" |
| 203 | - id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
| 203 | + id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
| 204 | 204 | </label> |
| 205 | 205 | </li> |
| 206 | 206 | <li> |
| 207 | 207 | <label for="give-export-email"> |
| 208 | 208 | <input type="checkbox" checked |
| 209 | 209 | name="give_export_option[email]" |
| 210 | - id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
| 210 | + id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
| 211 | 211 | </label> |
| 212 | 212 | </li> |
| 213 | 213 | <li> |
| 214 | 214 | <label for="give-export-address"> |
| 215 | 215 | <input type="checkbox" checked |
| 216 | 216 | name="give_export_option[address]" |
| 217 | - id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
| 217 | + id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
| 218 | 218 | </label> |
| 219 | 219 | </li> |
| 220 | 220 | <li> |
| 221 | 221 | <label for="give-export-userid"> |
| 222 | 222 | <input type="checkbox" checked |
| 223 | 223 | name="give_export_option[userid]" |
| 224 | - id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
| 224 | + id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
| 225 | 225 | </label> |
| 226 | 226 | </li> |
| 227 | 227 | <li> |
| 228 | 228 | <label for="give-export-donation-form"> |
| 229 | 229 | <input type="checkbox" checked |
| 230 | 230 | name="give_export_option[donation_form]" |
| 231 | - id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?> |
|
| 231 | + id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?> |
|
| 232 | 232 | </label> |
| 233 | 233 | </li> |
| 234 | 234 | <li> |
| 235 | 235 | <label for="give-export-first-donation-date"> |
| 236 | 236 | <input type="checkbox" checked |
| 237 | 237 | name="give_export_option[date_first_donated]" |
| 238 | - id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
| 238 | + id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
| 239 | 239 | </label> |
| 240 | 240 | </li> |
| 241 | 241 | <li> |
| 242 | 242 | <label for="give-export-donation-number"> |
| 243 | 243 | <input type="checkbox" checked |
| 244 | 244 | name="give_export_option[donations]" |
| 245 | - id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
| 245 | + id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
| 246 | 246 | </label> |
| 247 | 247 | </li> |
| 248 | 248 | <li> |
| 249 | 249 | <label for="give-export-donation-sum"> |
| 250 | 250 | <input type="checkbox" checked |
| 251 | 251 | name="give_export_option[donation_sum]" |
| 252 | - id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
| 252 | + id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
| 253 | 253 | </label> |
| 254 | 254 | </li> |
| 255 | 255 | </ul> |
| 256 | 256 | </div> |
| 257 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 257 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 258 | 258 | <input type="hidden" name="give-export-class" |
| 259 | 259 | value="Give_Batch_Donors_Export"/> |
| 260 | 260 | <input type="hidden" |
| 261 | 261 | name="give_export_option[query_id]" |
| 262 | - value="<?php echo uniqid( 'give_' ); ?>"/> |
|
| 262 | + value="<?php echo uniqid('give_'); ?>"/> |
|
| 263 | 263 | </form> |
| 264 | 264 | </td> |
| 265 | 265 | </tr> |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * @since 1.0 |
| 274 | 274 | */ |
| 275 | - do_action( 'give_tools_tab_export_table_bottom' ); |
|
| 275 | + do_action('give_tools_tab_export_table_bottom'); |
|
| 276 | 276 | ?> |
| 277 | 277 | </tbody> |
| 278 | 278 | </table> |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * @since 1.0 |
| 285 | 285 | */ |
| 286 | - do_action( 'give_tools_tab_export_content_bottom' ); |
|
| 286 | + do_action('give_tools_tab_export_content_bottom'); |
|
| 287 | 287 | ?> |
| 288 | 288 | |
| 289 | 289 | </div> |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | * Admin View: Exports |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if ( ! defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 10 | +if ( ! current_user_can('manage_give_settings')) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -16,27 +16,27 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @since 1.5 |
| 18 | 18 | */ |
| 19 | -do_action( 'give_tools_recount_stats_before' ); |
|
| 19 | +do_action('give_tools_recount_stats_before'); |
|
| 20 | 20 | ?> |
| 21 | 21 | <div id="poststuff"> |
| 22 | 22 | <div class="postbox"> |
| 23 | 23 | |
| 24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
| 24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
| 25 | 25 | |
| 26 | 26 | <div class="inside recount-stats-controls"> |
| 27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
| 27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
| 28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
| 29 | 29 | |
| 30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 31 | 31 | |
| 32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
| 33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
| 34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
| 35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
| 36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
| 37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
| 38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
| 39 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
| 33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
| 34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
| 35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
| 36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
| 37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
| 38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
| 39 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
| 40 | 40 | <?php |
| 41 | 41 | /** |
| 42 | 42 | * Fires in the recount stats selectbox. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @since 1.5 |
| 47 | 47 | */ |
| 48 | - do_action( 'give_recount_tool_options' ); |
|
| 48 | + do_action('give_recount_tool_options'); |
|
| 49 | 49 | ?> |
| 50 | 50 | </select> |
| 51 | 51 | |
@@ -53,22 +53,22 @@ discard block |
||
| 53 | 53 | <?php |
| 54 | 54 | $args = array( |
| 55 | 55 | 'name' => 'form_id', |
| 56 | - 'number' => - 1, |
|
| 56 | + 'number' => -1, |
|
| 57 | 57 | 'chosen' => true, |
| 58 | 58 | ); |
| 59 | - echo Give()->html->forms_dropdown( $args ); |
|
| 59 | + echo Give()->html->forms_dropdown($args); |
|
| 60 | 60 | ?> |
| 61 | 61 | </span> |
| 62 | 62 | |
| 63 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
| 63 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
| 64 | 64 | |
| 65 | 65 | <br/> |
| 66 | 66 | |
| 67 | 67 | <span class="give-recount-stats-descriptions"> |
| 68 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
| 69 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
| 70 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
| 71 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
| 68 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
| 69 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
| 70 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
| 71 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
| 72 | 72 | <?php |
| 73 | 73 | /** |
| 74 | 74 | * Fires in the recount stats description area. |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @since 1.5 |
| 79 | 79 | */ |
| 80 | - do_action( 'give_recount_tool_descriptions' ); |
|
| 80 | + do_action('give_recount_tool_descriptions'); |
|
| 81 | 81 | ?> |
| 82 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
| 83 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
| 82 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
| 83 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
| 84 | 84 | </span> |
| 85 | 85 | |
| 86 | 86 | <span class="spinner"></span> |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @since 1.5 |
| 96 | 96 | */ |
| 97 | - do_action( 'give_tools_recount_forms' ); |
|
| 97 | + do_action('give_tools_recount_forms'); |
|
| 98 | 98 | ?> |
| 99 | 99 | </div><!-- .inside --> |
| 100 | 100 | </div><!-- .postbox --> |
@@ -105,4 +105,4 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @since 1.5 |
| 107 | 107 | */ |
| 108 | -do_action( 'give_tools_recount_stats_after' ); |
|
| 108 | +do_action('give_tools_recount_stats_after'); |
|
@@ -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 | |
@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page; |
| 34 | 34 | |
| 35 | 35 | //Payments |
| 36 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
| 37 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
| 36 | + $give_payment = get_post_type_object('give_payment'); |
|
| 37 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
| 38 | 38 | |
| 39 | 39 | //Donors |
| 40 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_donors_page' ); |
|
| 40 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_donors_page'); |
|
| 41 | 41 | |
| 42 | 42 | //Reports` |
| 43 | 43 | $give_reports_page = add_submenu_page( |
| 44 | 44 | 'edit.php?post_type=give_forms', |
| 45 | - esc_html__( 'Donation Reports', 'give' ), |
|
| 46 | - esc_html__( 'Reports', 'give' ), |
|
| 45 | + esc_html__('Donation Reports', 'give'), |
|
| 46 | + esc_html__('Reports', 'give'), |
|
| 47 | 47 | 'view_give_reports', |
| 48 | 48 | 'give-reports', |
| 49 | 49 | array( |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | //Settings |
| 56 | 56 | $give_settings_page = add_submenu_page( |
| 57 | 57 | 'edit.php?post_type=give_forms', |
| 58 | - esc_html__( 'Give Settings', 'give' ), |
|
| 59 | - esc_html__( 'Settings', 'give' ), |
|
| 58 | + esc_html__('Give Settings', 'give'), |
|
| 59 | + esc_html__('Settings', 'give'), |
|
| 60 | 60 | 'manage_give_settings', |
| 61 | 61 | 'give-settings', |
| 62 | 62 | array( |
@@ -66,21 +66,21 @@ discard block |
||
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | 68 | //Tools. |
| 69 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
| 69 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
| 70 | 70 | Give()->give_settings, |
| 71 | 71 | 'output' |
| 72 | - ) ); |
|
| 72 | + )); |
|
| 73 | 73 | |
| 74 | 74 | //Add-ons |
| 75 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
| 75 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
| 76 | 76 | |
| 77 | 77 | //Upgrades |
| 78 | - $give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
| 78 | + $give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
| 83 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Determines whether the current admin page is a Give admin page. |
@@ -95,224 +95,224 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return bool True if Give admin page. |
| 97 | 97 | */ |
| 98 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
| 98 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
| 99 | 99 | |
| 100 | 100 | global $pagenow, $typenow; |
| 101 | 101 | |
| 102 | 102 | $found = false; |
| 103 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
| 104 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
| 105 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
| 106 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
| 107 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
| 108 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
| 109 | - |
|
| 110 | - switch ( $passed_page ) { |
|
| 103 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
| 104 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
| 105 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
| 106 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
| 107 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
| 108 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
| 109 | + |
|
| 110 | + switch ($passed_page) { |
|
| 111 | 111 | case 'give_forms': |
| 112 | - switch ( $passed_view ) { |
|
| 112 | + switch ($passed_view) { |
|
| 113 | 113 | case 'list-table': |
| 114 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
| 114 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
| 115 | 115 | $found = true; |
| 116 | 116 | } |
| 117 | 117 | break; |
| 118 | 118 | case 'edit': |
| 119 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
| 119 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
| 120 | 120 | $found = true; |
| 121 | 121 | } |
| 122 | 122 | break; |
| 123 | 123 | case 'new': |
| 124 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
| 124 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
| 125 | 125 | $found = true; |
| 126 | 126 | } |
| 127 | 127 | break; |
| 128 | 128 | default: |
| 129 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
| 129 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
| 130 | 130 | $found = true; |
| 131 | 131 | } |
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | break; |
| 135 | 135 | case 'categories': |
| 136 | - switch ( $passed_view ) { |
|
| 136 | + switch ($passed_view) { |
|
| 137 | 137 | case 'list-table': |
| 138 | 138 | case 'new': |
| 139 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
| 139 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
| 140 | 140 | $found = true; |
| 141 | 141 | } |
| 142 | 142 | break; |
| 143 | 143 | case 'edit': |
| 144 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
| 144 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
| 145 | 145 | $found = true; |
| 146 | 146 | } |
| 147 | 147 | break; |
| 148 | 148 | default: |
| 149 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
| 149 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
| 150 | 150 | $found = true; |
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | } |
| 154 | 154 | break; |
| 155 | 155 | case 'tags': |
| 156 | - switch ( $passed_view ) { |
|
| 156 | + switch ($passed_view) { |
|
| 157 | 157 | case 'list-table': |
| 158 | 158 | case 'new': |
| 159 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
| 159 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
| 160 | 160 | $found = true; |
| 161 | 161 | } |
| 162 | 162 | break; |
| 163 | 163 | case 'edit': |
| 164 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
| 164 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
| 165 | 165 | $found = true; |
| 166 | 166 | } |
| 167 | 167 | break; |
| 168 | 168 | default: |
| 169 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
| 169 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
| 170 | 170 | $found = true; |
| 171 | 171 | } |
| 172 | 172 | break; |
| 173 | 173 | } |
| 174 | 174 | break; |
| 175 | 175 | case 'payments': |
| 176 | - switch ( $passed_view ) { |
|
| 176 | + switch ($passed_view) { |
|
| 177 | 177 | case 'list-table': |
| 178 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
| 178 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
| 179 | 179 | $found = true; |
| 180 | 180 | } |
| 181 | 181 | break; |
| 182 | 182 | case 'edit': |
| 183 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
|
| 183 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) { |
|
| 184 | 184 | $found = true; |
| 185 | 185 | } |
| 186 | 186 | break; |
| 187 | 187 | default: |
| 188 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
| 188 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
| 189 | 189 | $found = true; |
| 190 | 190 | } |
| 191 | 191 | break; |
| 192 | 192 | } |
| 193 | 193 | break; |
| 194 | 194 | case 'reports': |
| 195 | - switch ( $passed_view ) { |
|
| 195 | + switch ($passed_view) { |
|
| 196 | 196 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
| 197 | 197 | case 'earnings': |
| 198 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
| 198 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
| 199 | 199 | $found = true; |
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | 202 | case 'donors': |
| 203 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
| 203 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
| 204 | 204 | $found = true; |
| 205 | 205 | } |
| 206 | 206 | break; |
| 207 | 207 | case 'gateways': |
| 208 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
| 208 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
| 209 | 209 | $found = true; |
| 210 | 210 | } |
| 211 | 211 | break; |
| 212 | 212 | case 'export': |
| 213 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
| 213 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
| 214 | 214 | $found = true; |
| 215 | 215 | } |
| 216 | 216 | break; |
| 217 | 217 | case 'logs': |
| 218 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
| 218 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
| 219 | 219 | $found = true; |
| 220 | 220 | } |
| 221 | 221 | break; |
| 222 | 222 | default: |
| 223 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 223 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 224 | 224 | $found = true; |
| 225 | 225 | } |
| 226 | 226 | break; |
| 227 | 227 | } |
| 228 | 228 | break; |
| 229 | 229 | case 'settings': |
| 230 | - switch ( $passed_view ) { |
|
| 230 | + switch ($passed_view) { |
|
| 231 | 231 | case 'general': |
| 232 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
| 232 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
| 233 | 233 | $found = true; |
| 234 | 234 | } |
| 235 | 235 | break; |
| 236 | 236 | case 'gateways': |
| 237 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
| 237 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
| 238 | 238 | $found = true; |
| 239 | 239 | } |
| 240 | 240 | break; |
| 241 | 241 | case 'emails': |
| 242 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
| 242 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
| 243 | 243 | $found = true; |
| 244 | 244 | } |
| 245 | 245 | break; |
| 246 | 246 | case 'display': |
| 247 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
| 247 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
| 248 | 248 | $found = true; |
| 249 | 249 | } |
| 250 | 250 | break; |
| 251 | 251 | case 'licenses': |
| 252 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
| 252 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
| 253 | 253 | $found = true; |
| 254 | 254 | } |
| 255 | 255 | break; |
| 256 | 256 | case 'api': |
| 257 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
| 257 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
| 258 | 258 | $found = true; |
| 259 | 259 | } |
| 260 | 260 | break; |
| 261 | 261 | case 'advanced': |
| 262 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
| 262 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
| 263 | 263 | $found = true; |
| 264 | 264 | } |
| 265 | 265 | break; |
| 266 | 266 | case 'system_info': |
| 267 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
| 267 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
| 268 | 268 | $found = true; |
| 269 | 269 | } |
| 270 | 270 | break; |
| 271 | 271 | default: |
| 272 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
| 272 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
| 273 | 273 | $found = true; |
| 274 | 274 | } |
| 275 | 275 | break; |
| 276 | 276 | } |
| 277 | 277 | break; |
| 278 | 278 | case 'addons': |
| 279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
| 279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
| 280 | 280 | $found = true; |
| 281 | 281 | } |
| 282 | 282 | break; |
| 283 | 283 | case 'donors': |
| 284 | - switch ( $passed_view ) { |
|
| 284 | + switch ($passed_view) { |
|
| 285 | 285 | case 'list-table': |
| 286 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
| 286 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
| 287 | 287 | $found = true; |
| 288 | 288 | } |
| 289 | 289 | break; |
| 290 | 290 | case 'overview': |
| 291 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
| 291 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
| 292 | 292 | $found = true; |
| 293 | 293 | } |
| 294 | 294 | break; |
| 295 | 295 | case 'notes': |
| 296 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
| 296 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
| 297 | 297 | $found = true; |
| 298 | 298 | } |
| 299 | 299 | break; |
| 300 | 300 | default: |
| 301 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
| 301 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
| 302 | 302 | $found = true; |
| 303 | 303 | } |
| 304 | 304 | break; |
| 305 | 305 | } |
| 306 | 306 | break; |
| 307 | 307 | case 'reports': |
| 308 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 308 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 309 | 309 | $found = true; |
| 310 | 310 | } |
| 311 | 311 | break; |
| 312 | 312 | default: |
| 313 | 313 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_donors_page, $give_tools_page; |
| 314 | 314 | |
| 315 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
| 315 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
| 316 | 316 | $give_payments_page, |
| 317 | 317 | $give_settings_page, |
| 318 | 318 | $give_reports_page, |
@@ -323,19 +323,19 @@ discard block |
||
| 323 | 323 | $give_donors_page, |
| 324 | 324 | $give_tools_page, |
| 325 | 325 | 'widgets.php' |
| 326 | - ) ); |
|
| 327 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
| 326 | + )); |
|
| 327 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
| 328 | 328 | $found = true; |
| 329 | - if ( 'give-upgrades' === $page ) { |
|
| 329 | + if ('give-upgrades' === $page) { |
|
| 330 | 330 | $found = false; |
| 331 | 331 | } |
| 332 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
| 332 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
| 333 | 333 | $found = true; |
| 334 | 334 | } |
| 335 | 335 | break; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
| 338 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
| 339 | 339 | |
| 340 | 340 | } |
| 341 | 341 | |
@@ -347,37 +347,37 @@ discard block |
||
| 347 | 347 | * @param array $settings |
| 348 | 348 | * @return array |
| 349 | 349 | */ |
| 350 | -function give_settings_page_pages( $settings ) { |
|
| 351 | - include( 'abstract-admin-settings-page.php' ); |
|
| 352 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
| 350 | +function give_settings_page_pages($settings) { |
|
| 351 | + include('abstract-admin-settings-page.php'); |
|
| 352 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
| 353 | 353 | |
| 354 | 354 | $settings = array( |
| 355 | 355 | // General settings. |
| 356 | - include( 'settings/class-settings-general.php' ), |
|
| 356 | + include('settings/class-settings-general.php'), |
|
| 357 | 357 | |
| 358 | 358 | // Payment Gateways Settings. |
| 359 | - include( 'settings/class-settings-gateways.php' ), |
|
| 359 | + include('settings/class-settings-gateways.php'), |
|
| 360 | 360 | |
| 361 | 361 | // Display settings. |
| 362 | - include( 'settings/class-settings-display.php' ), |
|
| 362 | + include('settings/class-settings-display.php'), |
|
| 363 | 363 | |
| 364 | 364 | // Emails settings. |
| 365 | - include( 'settings/class-settings-email.php' ), |
|
| 365 | + include('settings/class-settings-email.php'), |
|
| 366 | 366 | |
| 367 | 367 | // Addons settings. |
| 368 | - include( 'settings/class-settings-addon.php' ), |
|
| 368 | + include('settings/class-settings-addon.php'), |
|
| 369 | 369 | |
| 370 | 370 | // License settings. |
| 371 | - include( 'settings/class-settings-license.php' ), |
|
| 371 | + include('settings/class-settings-license.php'), |
|
| 372 | 372 | |
| 373 | 373 | // Advanced settinns. |
| 374 | - include( 'settings/class-settings-advanced.php' ) |
|
| 374 | + include('settings/class-settings-advanced.php') |
|
| 375 | 375 | ); |
| 376 | 376 | |
| 377 | 377 | // Output. |
| 378 | 378 | return $settings; |
| 379 | 379 | } |
| 380 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
| 380 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
| 381 | 381 | |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -387,28 +387,28 @@ discard block |
||
| 387 | 387 | * @param array $settings |
| 388 | 388 | * @return array |
| 389 | 389 | */ |
| 390 | -function give_reports_page_pages( $settings ) { |
|
| 391 | - include( 'abstract-admin-settings-page.php' ); |
|
| 390 | +function give_reports_page_pages($settings) { |
|
| 391 | + include('abstract-admin-settings-page.php'); |
|
| 392 | 392 | |
| 393 | 393 | $settings = array( |
| 394 | 394 | // Earnings. |
| 395 | - include( 'reporting/class-settings-earnings.php' ), |
|
| 395 | + include('reporting/class-settings-earnings.php'), |
|
| 396 | 396 | |
| 397 | 397 | // Forms. |
| 398 | - include( 'reporting/class-settings-forms.php' ), |
|
| 398 | + include('reporting/class-settings-forms.php'), |
|
| 399 | 399 | |
| 400 | 400 | // Donors. |
| 401 | - include( 'reporting/class-settings-donors.php' ), |
|
| 401 | + include('reporting/class-settings-donors.php'), |
|
| 402 | 402 | |
| 403 | 403 | // Gateways. |
| 404 | - include( 'reporting/class-settings-gateways.php' ), |
|
| 404 | + include('reporting/class-settings-gateways.php'), |
|
| 405 | 405 | |
| 406 | 406 | ); |
| 407 | 407 | |
| 408 | 408 | // Output. |
| 409 | 409 | return $settings; |
| 410 | 410 | } |
| 411 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
| 411 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
| 412 | 412 | |
| 413 | 413 | /** |
| 414 | 414 | * Add setting tab to give-settings page |
@@ -417,31 +417,31 @@ discard block |
||
| 417 | 417 | * @param array $settings |
| 418 | 418 | * @return array |
| 419 | 419 | */ |
| 420 | -function give_tools_page_pages( $settings ) { |
|
| 421 | - include( 'abstract-admin-settings-page.php' ); |
|
| 420 | +function give_tools_page_pages($settings) { |
|
| 421 | + include('abstract-admin-settings-page.php'); |
|
| 422 | 422 | |
| 423 | 423 | $settings = array( |
| 424 | 424 | // System Info. |
| 425 | - include( 'tools/class-settings-system-info.php' ), |
|
| 425 | + include('tools/class-settings-system-info.php'), |
|
| 426 | 426 | |
| 427 | 427 | // Logs. |
| 428 | - include( 'tools/class-settings-logs.php' ), |
|
| 428 | + include('tools/class-settings-logs.php'), |
|
| 429 | 429 | |
| 430 | 430 | // API. |
| 431 | - include( 'tools/class-settings-api.php' ), |
|
| 431 | + include('tools/class-settings-api.php'), |
|
| 432 | 432 | |
| 433 | 433 | // Data. |
| 434 | - include( 'tools/class-settings-data.php' ), |
|
| 434 | + include('tools/class-settings-data.php'), |
|
| 435 | 435 | |
| 436 | 436 | // Export. |
| 437 | - include( 'tools/class-settings-export.php' ), |
|
| 437 | + include('tools/class-settings-export.php'), |
|
| 438 | 438 | |
| 439 | 439 | ); |
| 440 | 440 | |
| 441 | 441 | // Output. |
| 442 | 442 | return $settings; |
| 443 | 443 | } |
| 444 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
| 444 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | 447 | * Set default tools page tab. |
@@ -450,10 +450,10 @@ discard block |
||
| 450 | 450 | * @param string $default_tab Default tab name. |
| 451 | 451 | * @return string |
| 452 | 452 | */ |
| 453 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
| 453 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
| 454 | 454 | return 'system-info'; |
| 455 | 455 | } |
| 456 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
| 456 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
| 457 | 457 | |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * @param string $default_tab Default tab name. |
| 464 | 464 | * @return string |
| 465 | 465 | */ |
| 466 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
| 466 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
| 467 | 467 | return 'earnings'; |
| 468 | 468 | } |
| 469 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
| 470 | 469 | \ No newline at end of file |
| 470 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
| 471 | 471 | \ 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 | |
@@ -25,52 +25,52 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | -function give_update_payment_details( $data ) { |
|
| 28 | +function give_update_payment_details($data) { |
|
| 29 | 29 | |
| 30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
| 31 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
| 31 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
| 34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
| 35 | 35 | |
| 36 | 36 | // Retrieve the payment ID. |
| 37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
| 37 | + $payment_id = absint($data['give_payment_id']); |
|
| 38 | 38 | |
| 39 | 39 | /* @var Give_Payment $payment */ |
| 40 | - $payment = new Give_Payment( $payment_id ); |
|
| 40 | + $payment = new Give_Payment($payment_id); |
|
| 41 | 41 | |
| 42 | 42 | // Retrieve existing payment meta. |
| 43 | 43 | $meta = $payment->get_meta(); |
| 44 | 44 | $user_info = $payment->user_info; |
| 45 | 45 | |
| 46 | 46 | $status = $data['give-payment-status']; |
| 47 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
| 48 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
| 47 | + $date = sanitize_text_field($data['give-payment-date']); |
|
| 48 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
| 49 | 49 | |
| 50 | 50 | // Restrict to our high and low. |
| 51 | - if ( $hour > 23 ) { |
|
| 51 | + if ($hour > 23) { |
|
| 52 | 52 | $hour = 23; |
| 53 | - } elseif ( $hour < 0 ) { |
|
| 53 | + } elseif ($hour < 0) { |
|
| 54 | 54 | $hour = 00; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
| 57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
| 58 | 58 | |
| 59 | 59 | // Restrict to our high and low. |
| 60 | - if ( $minute > 59 ) { |
|
| 60 | + if ($minute > 59) { |
|
| 61 | 61 | $minute = 59; |
| 62 | - } elseif ( $minute < 0 ) { |
|
| 62 | + } elseif ($minute < 0) { |
|
| 63 | 63 | $minute = 00; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
| 66 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
| 67 | 67 | |
| 68 | - $curr_total = give_sanitize_amount( $payment->total ); |
|
| 69 | - $new_total = give_sanitize_amount( $data['give-payment-total'] ); |
|
| 70 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
| 68 | + $curr_total = give_sanitize_amount($payment->total); |
|
| 69 | + $new_total = give_sanitize_amount($data['give-payment-total']); |
|
| 70 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
| 71 | 71 | |
| 72 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
| 73 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
| 72 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
| 73 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * Fires before updating edited donation. |
@@ -80,98 +80,98 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param int $payment_id The ID of the payment. |
| 82 | 82 | */ |
| 83 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
| 83 | + do_action('give_update_edited_donation', $payment_id); |
|
| 84 | 84 | |
| 85 | 85 | $payment->date = $date; |
| 86 | 86 | $updated = $payment->save(); |
| 87 | 87 | |
| 88 | - if ( 0 === $updated ) { |
|
| 89 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 88 | + if (0 === $updated) { |
|
| 89 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $donor_changed = false; |
| 93 | 93 | |
| 94 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
| 94 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
| 95 | 95 | |
| 96 | - $email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
| 97 | - $names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : ''; |
|
| 96 | + $email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
| 97 | + $names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : ''; |
|
| 98 | 98 | |
| 99 | - if ( empty( $email ) || empty( $names ) ) { |
|
| 100 | - wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 99 | + if (empty($email) || empty($names)) { |
|
| 100 | + wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $donor = new Give_Donor( $email ); |
|
| 104 | - if ( empty( $donor->id ) ) { |
|
| 105 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
| 106 | - $user_id = email_exists( $email ); |
|
| 107 | - if ( false !== $user_id ) { |
|
| 103 | + $donor = new Give_Donor($email); |
|
| 104 | + if (empty($donor->id)) { |
|
| 105 | + $donor_data = array('name' => $names, 'email' => $email); |
|
| 106 | + $user_id = email_exists($email); |
|
| 107 | + if (false !== $user_id) { |
|
| 108 | 108 | $donor_data['user_id'] = $user_id; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if ( ! $donor->create( $donor_data ) ) { |
|
| 111 | + if ( ! $donor->create($donor_data)) { |
|
| 112 | 112 | // Failed to crete the new donor, assume the previous donor. |
| 113 | 113 | $donor_changed = false; |
| 114 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 115 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
| 114 | + $donor = new Give_Donor($curr_donor_id); |
|
| 115 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $new_donor_id = $donor->id; |
| 120 | 120 | |
| 121 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 121 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 122 | 122 | |
| 123 | 123 | $donor_changed = true; |
| 124 | 124 | |
| 125 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
| 125 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
| 126 | 126 | |
| 127 | - $donor = new Give_Donor( $new_donor_id ); |
|
| 127 | + $donor = new Give_Donor($new_donor_id); |
|
| 128 | 128 | $email = $donor->email; |
| 129 | 129 | $names = $donor->name; |
| 130 | 130 | |
| 131 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
| 131 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
| 132 | 132 | |
| 133 | 133 | $donor_changed = true; |
| 134 | 134 | |
| 135 | 135 | } else { |
| 136 | 136 | |
| 137 | - $donor = new Give_Donor( $curr_donor_id ); |
|
| 137 | + $donor = new Give_Donor($curr_donor_id); |
|
| 138 | 138 | $email = $donor->email; |
| 139 | 139 | $names = $donor->name; |
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Setup first and last name from input values. |
| 144 | - $names = explode( ' ', $names ); |
|
| 145 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
| 144 | + $names = explode(' ', $names); |
|
| 145 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
| 146 | 146 | $last_name = ''; |
| 147 | - if ( ! empty( $names[1] ) ) { |
|
| 148 | - unset( $names[0] ); |
|
| 149 | - $last_name = implode( ' ', $names ); |
|
| 147 | + if ( ! empty($names[1])) { |
|
| 148 | + unset($names[0]); |
|
| 149 | + $last_name = implode(' ', $names); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if ( $donor_changed ) { |
|
| 152 | + if ($donor_changed) { |
|
| 153 | 153 | |
| 154 | 154 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
| 155 | - $previous_donor->remove_payment( $payment_id, false ); |
|
| 156 | - $donor->attach_payment( $payment_id, false ); |
|
| 155 | + $previous_donor->remove_payment($payment_id, false); |
|
| 156 | + $donor->attach_payment($payment_id, false); |
|
| 157 | 157 | |
| 158 | - if ( 'publish' == $status ) { |
|
| 158 | + if ('publish' == $status) { |
|
| 159 | 159 | |
| 160 | 160 | // Reduce previous user donation count and amount. |
| 161 | 161 | $previous_donor->decrease_donation_count(); |
| 162 | - $previous_donor->decrease_value( $curr_total ); |
|
| 162 | + $previous_donor->decrease_value($curr_total); |
|
| 163 | 163 | |
| 164 | 164 | // If donation was completed adjust stats of new donors. |
| 165 | 165 | $donor->increase_purchase_count(); |
| 166 | - $donor->increase_value( $new_total ); |
|
| 166 | + $donor->increase_value($new_total); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $payment->customer_id = $donor->id; |
| 170 | 170 | } else { |
| 171 | 171 | |
| 172 | - if ( 'publish' === $status ) { |
|
| 172 | + if ('publish' === $status) { |
|
| 173 | 173 | // Update user donation stat. |
| 174 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
| 174 | + $donor->update_donation_value($curr_total, $new_total); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | $payment->total = $new_total; |
| 185 | 185 | |
| 186 | 186 | // Check for payment notes. |
| 187 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
| 187 | + if ( ! empty($data['give-payment-note'])) { |
|
| 188 | 188 | |
| 189 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
| 190 | - give_insert_payment_note( $payment_id, $note ); |
|
| 189 | + $note = wp_kses($data['give-payment-note'], array()); |
|
| 190 | + give_insert_payment_note($payment_id, $note); |
|
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 | |
@@ -195,17 +195,17 @@ discard block |
||
| 195 | 195 | $payment->status = $status; |
| 196 | 196 | |
| 197 | 197 | // Adjust total store earnings if the payment total has been changed. |
| 198 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
| 198 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
| 199 | 199 | |
| 200 | - if ( $new_total > $curr_total ) { |
|
| 200 | + if ($new_total > $curr_total) { |
|
| 201 | 201 | // Increase if our new total is higher. |
| 202 | 202 | $difference = $new_total - $curr_total; |
| 203 | - give_increase_total_earnings( $difference ); |
|
| 203 | + give_increase_total_earnings($difference); |
|
| 204 | 204 | |
| 205 | - } elseif ( $curr_total > $new_total ) { |
|
| 205 | + } elseif ($curr_total > $new_total) { |
|
| 206 | 206 | // Decrease if our new total is lower. |
| 207 | 207 | $difference = $curr_total - $new_total; |
| 208 | - give_decrease_total_earnings( $difference ); |
|
| 208 | + give_decrease_total_earnings($difference); |
|
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -213,16 +213,16 @@ discard block |
||
| 213 | 213 | $payment->save(); |
| 214 | 214 | |
| 215 | 215 | // Get new give form ID. |
| 216 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
| 217 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
| 216 | + $new_form_id = absint($data['give-payment-form-select']); |
|
| 217 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
| 218 | 218 | |
| 219 | 219 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
| 220 | 220 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
| 221 | 221 | // Check if user want to transfer current payment to new give form id. |
| 222 | - if ( $new_form_id != $current_form_id ) { |
|
| 222 | + if ($new_form_id != $current_form_id) { |
|
| 223 | 223 | |
| 224 | 224 | // Get new give form title. |
| 225 | - $new_form_title = get_the_title( $new_form_id ); |
|
| 225 | + $new_form_title = get_the_title($new_form_id); |
|
| 226 | 226 | |
| 227 | 227 | // Update new give form data in payment data. |
| 228 | 228 | $payment_meta = $payment->get_meta(); |
@@ -230,56 +230,56 @@ discard block |
||
| 230 | 230 | $payment_meta['form_id'] = $new_form_id; |
| 231 | 231 | |
| 232 | 232 | // Update price id post meta data for set donation form. |
| 233 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 233 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 234 | 234 | $payment_meta['price_id'] = ''; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Update payment give form meta data. |
| 238 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
| 239 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
| 240 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 238 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
| 239 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
| 240 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 241 | 241 | |
| 242 | 242 | // Update price id payment metadata. |
| 243 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 244 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
| 243 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 244 | + $payment->update_meta('_give_payment_price_id', ''); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // If donation was completed, adjust stats of forms. |
| 248 | - if ( 'publish' == $status ) { |
|
| 248 | + if ('publish' == $status) { |
|
| 249 | 249 | |
| 250 | 250 | // Decrease sale of old give form. For other payment status. |
| 251 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
| 251 | + $current_form = new Give_Donate_Form($current_form_id); |
|
| 252 | 252 | $current_form->decrease_sales(); |
| 253 | - $current_form->decrease_earnings( $curr_total ); |
|
| 253 | + $current_form->decrease_earnings($curr_total); |
|
| 254 | 254 | |
| 255 | 255 | // Increase sale of new give form. |
| 256 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
| 256 | + $new_form = new Give_Donate_Form($new_form_id); |
|
| 257 | 257 | $new_form->increase_sales(); |
| 258 | - $new_form->increase_earnings( $new_total ); |
|
| 258 | + $new_form->increase_earnings($new_total); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | // Re setup payment to update new meta value in object. |
| 262 | - $payment->update_payment_setup( $payment->ID ); |
|
| 262 | + $payment->update_payment_setup($payment->ID); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Update price id if current form is variable form. |
| 266 | - if ( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
| 266 | + if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) { |
|
| 267 | 267 | |
| 268 | 268 | // Get payment meta data. |
| 269 | 269 | $payment_meta = $payment->get_meta(); |
| 270 | 270 | |
| 271 | 271 | // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
| 272 | - $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
| 272 | + $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : ''; |
|
| 273 | 273 | |
| 274 | 274 | // Update payment meta data. |
| 275 | 275 | $payment_meta['price_id'] = $data['give-variable-price']; |
| 276 | 276 | |
| 277 | 277 | // Update payment give form meta data. |
| 278 | - $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
| 279 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 278 | + $payment->update_meta('_give_payment_price_id', $data['give-variable-price']); |
|
| 279 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 280 | 280 | |
| 281 | 281 | // Re setup payment to update new meta value in object. |
| 282 | - $payment->update_payment_setup( $payment->ID ); |
|
| 282 | + $payment->update_payment_setup($payment->ID); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | * @param int $payment_id The ID of the payment. |
| 292 | 292 | */ |
| 293 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
| 293 | + do_action('give_updated_edited_donation', $payment_id); |
|
| 294 | 294 | |
| 295 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
| 295 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id)); |
|
| 296 | 296 | exit; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
| 299 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * Trigger a Donation Deletion. |
@@ -307,48 +307,48 @@ discard block |
||
| 307 | 307 | * |
| 308 | 308 | * @return void |
| 309 | 309 | */ |
| 310 | -function give_trigger_donation_delete( $data ) { |
|
| 311 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
| 310 | +function give_trigger_donation_delete($data) { |
|
| 311 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
| 312 | 312 | |
| 313 | - $payment_id = absint( $data['purchase_id'] ); |
|
| 313 | + $payment_id = absint($data['purchase_id']); |
|
| 314 | 314 | |
| 315 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 316 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 315 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 316 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - give_delete_donation( $payment_id ); |
|
| 320 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
| 319 | + give_delete_donation($payment_id); |
|
| 320 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
| 321 | 321 | give_die(); |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
| 325 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | 328 | * AJAX Store Donation Note |
| 329 | 329 | */ |
| 330 | 330 | function give_ajax_store_payment_note() { |
| 331 | 331 | |
| 332 | - $payment_id = absint( $_POST['payment_id'] ); |
|
| 333 | - $note = wp_kses( $_POST['note'], array() ); |
|
| 332 | + $payment_id = absint($_POST['payment_id']); |
|
| 333 | + $note = wp_kses($_POST['note'], array()); |
|
| 334 | 334 | |
| 335 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 336 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 335 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 336 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if ( empty( $payment_id ) ) { |
|
| 340 | - die( '-1' ); |
|
| 339 | + if (empty($payment_id)) { |
|
| 340 | + die('-1'); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - if ( empty( $note ) ) { |
|
| 344 | - die( '-1' ); |
|
| 343 | + if (empty($note)) { |
|
| 344 | + die('-1'); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
| 348 | - die( give_get_payment_note_html( $note_id ) ); |
|
| 347 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
| 348 | + die(give_get_payment_note_html($note_id)); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
| 351 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
| 352 | 352 | |
| 353 | 353 | /** |
| 354 | 354 | * Triggers a donation note deletion without ajax |
@@ -359,24 +359,24 @@ discard block |
||
| 359 | 359 | * |
| 360 | 360 | * @return void |
| 361 | 361 | */ |
| 362 | -function give_trigger_payment_note_deletion( $data ) { |
|
| 362 | +function give_trigger_payment_note_deletion($data) { |
|
| 363 | 363 | |
| 364 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
| 364 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
| 365 | 365 | return; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
| 369 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 368 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
| 369 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
| 372 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
| 373 | 373 | |
| 374 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
| 374 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
| 375 | 375 | |
| 376 | - wp_redirect( $edit_order_url ); |
|
| 376 | + wp_redirect($edit_order_url); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
| 379 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
| 380 | 380 | |
| 381 | 381 | /** |
| 382 | 382 | * Delete a payment note deletion with ajax |
@@ -387,16 +387,16 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | function give_ajax_delete_payment_note() { |
| 389 | 389 | |
| 390 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
| 391 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 390 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
| 391 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
| 395 | - die( '1' ); |
|
| 394 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
| 395 | + die('1'); |
|
| 396 | 396 | } else { |
| 397 | - die( '-1' ); |
|
| 397 | + die('-1'); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
| 402 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
@@ -514,16 +514,16 @@ |
||
| 514 | 514 | <p> |
| 515 | 515 | <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
| 516 | 516 | <?php |
| 517 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 518 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 519 | - |
|
| 520 | - // Check whether the donor name and WP_User name is same or not. |
|
| 521 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 522 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
| 523 | - }else{ |
|
| 524 | - echo $donor_name; |
|
| 525 | - } |
|
| 526 | - ?> |
|
| 517 | + $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 518 | + $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 519 | + |
|
| 520 | + // Check whether the donor name and WP_User name is same or not. |
|
| 521 | + if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 522 | + echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
| 523 | + }else{ |
|
| 524 | + echo $donor_name; |
|
| 525 | + } |
|
| 526 | + ?> |
|
| 527 | 527 | </p> |
| 528 | 528 | <p> |
| 529 | 529 | <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
@@ -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 | |
@@ -20,27 +20,27 @@ discard block |
||
| 20 | 20 | * @since 1.0 |
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Setup the variables |
| 28 | -$payment_id = absint( $_GET['id'] ); |
|
| 29 | -$payment = new Give_Payment( $payment_id ); |
|
| 28 | +$payment_id = absint($_GET['id']); |
|
| 29 | +$payment = new Give_Payment($payment_id); |
|
| 30 | 30 | |
| 31 | 31 | // Sanity check... fail if donation ID is invalid |
| 32 | 32 | $payment_exists = $payment->ID; |
| 33 | -if ( empty( $payment_exists ) ) { |
|
| 34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 33 | +if (empty($payment_exists)) { |
|
| 34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $number = $payment->number; |
| 38 | 38 | $payment_meta = $payment->get_meta(); |
| 39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
| 39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
| 40 | 40 | $user_id = $payment->user_id; |
| 41 | 41 | $donor_id = $payment->customer_id; |
| 42 | -$payment_date = strtotime( $payment->date ); |
|
| 43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 42 | +$payment_date = strtotime($payment->date); |
|
| 43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
| 44 | 44 | $address = $payment->address; |
| 45 | 45 | $currency_code = $payment->currency; |
| 46 | 46 | $gateway = $payment->gateway; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | <h1 id="transaction-details-heading"><?php |
| 53 | 53 | printf( |
| 54 | 54 | /* translators: %s: donation number */ |
| 55 | - esc_html__( 'Donation %s', 'give' ), |
|
| 55 | + esc_html__('Donation %s', 'give'), |
|
| 56 | 56 | $number |
| 57 | 57 | ); |
| 58 | - if ( $payment_mode == 'test' ) { |
|
| 59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
| 58 | + if ($payment_mode == 'test') { |
|
| 59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
| 60 | 60 | } |
| 61 | 61 | ?></h1> |
| 62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param int $payment_id Payment id. |
| 70 | 70 | */ |
| 71 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
| 71 | + do_action('give_view_order_details_before', $payment_id); |
|
| 72 | 72 | ?> |
| 73 | 73 | <form id="give-edit-order-form" method="post"> |
| 74 | 74 | <?php |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param int $payment_id Payment id. |
| 81 | 81 | */ |
| 82 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
| 82 | + do_action('give_view_order_details_form_top', $payment_id); |
|
| 83 | 83 | ?> |
| 84 | 84 | <div id="poststuff"> |
| 85 | 85 | <div id="give-dashboard-widgets-wrap"> |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @param int $payment_id Payment id. |
| 97 | 97 | */ |
| 98 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
| 98 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
| 99 | 99 | ?> |
| 100 | 100 | |
| 101 | 101 | <div id="give-order-update" class="postbox give-order-data"> |
| 102 | 102 | |
| 103 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
| 103 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
| 104 | 104 | |
| 105 | 105 | <div class="inside"> |
| 106 | 106 | <div class="give-admin-box"> |
@@ -113,33 +113,33 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @param int $payment_id Payment id. |
| 115 | 115 | */ |
| 116 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
| 116 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
| 117 | 117 | ?> |
| 118 | 118 | |
| 119 | 119 | <div class="give-admin-box-inside"> |
| 120 | 120 | <p> |
| 121 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
| 121 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
| 122 | 122 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
| 123 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
| 124 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
| 123 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
| 124 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
| 125 | 125 | <?php endforeach; ?> |
| 126 | 126 | </select> |
| 127 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 127 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 128 | 128 | </p> |
| 129 | 129 | </div> |
| 130 | 130 | |
| 131 | 131 | <div class="give-admin-box-inside"> |
| 132 | 132 | <p> |
| 133 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
| 134 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
| 133 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
| 134 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
| 135 | 135 | </p> |
| 136 | 136 | </div> |
| 137 | 137 | |
| 138 | 138 | <div class="give-admin-box-inside"> |
| 139 | 139 | <p> |
| 140 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
| 141 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
| 142 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
| 140 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
| 141 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
| 142 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
| 143 | 143 | </p> |
| 144 | 144 | </div> |
| 145 | 145 | |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @param int $payment_id Payment id. |
| 155 | 155 | */ |
| 156 | - do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
| 156 | + do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
| 157 | 157 | |
| 158 | 158 | <div class="give-order-payment give-admin-box-inside"> |
| 159 | 159 | <p> |
| 160 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
| 161 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
| 162 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
| 160 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
| 161 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
| 162 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
| 163 | 163 | </p> |
| 164 | 164 | </div> |
| 165 | 165 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * |
| 172 | 172 | * @param int $payment_id Payment id. |
| 173 | 173 | */ |
| 174 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
| 174 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
| 175 | 175 | ?> |
| 176 | 176 | |
| 177 | 177 | </div> |
@@ -189,17 +189,17 @@ discard block |
||
| 189 | 189 | * |
| 190 | 190 | * @param int $payment_id Payment id. |
| 191 | 191 | */ |
| 192 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
| 192 | + do_action('give_view_order_details_update_before', $payment_id); |
|
| 193 | 193 | ?> |
| 194 | 194 | |
| 195 | 195 | <div id="major-publishing-actions"> |
| 196 | 196 | <div id="publishing-action"> |
| 197 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
| 198 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
| 199 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 197 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
| 198 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
| 199 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 200 | 200 | 'give-action' => 'email_links', |
| 201 | 201 | 'purchase_id' => $payment_id, |
| 202 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
| 202 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
| 203 | 203 | <?php endif; ?> |
| 204 | 204 | </div> |
| 205 | 205 | <div class="clear"></div> |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * |
| 214 | 214 | * @param int $payment_id Payment id. |
| 215 | 215 | */ |
| 216 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
| 216 | + do_action('give_view_order_details_update_after', $payment_id); |
|
| 217 | 217 | ?> |
| 218 | 218 | |
| 219 | 219 | </div> |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | <div id="give-order-details" class="postbox give-order-data"> |
| 226 | 226 | |
| 227 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
| 227 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
| 228 | 228 | |
| 229 | 229 | <div class="inside"> |
| 230 | 230 | <div class="give-admin-box"> |
@@ -237,44 +237,44 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @param int $payment_id Payment id. |
| 239 | 239 | */ |
| 240 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
| 240 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
| 241 | 241 | |
| 242 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 243 | - if ( $gateway ) : ?> |
|
| 242 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 243 | + if ($gateway) : ?> |
|
| 244 | 244 | <div class="give-order-gateway give-admin-box-inside"> |
| 245 | 245 | <p> |
| 246 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
| 247 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 246 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
| 247 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 248 | 248 | </p> |
| 249 | 249 | </div> |
| 250 | 250 | <?php endif; ?> |
| 251 | 251 | |
| 252 | 252 | <div class="give-order-payment-key give-admin-box-inside"> |
| 253 | 253 | <p> |
| 254 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
| 255 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
| 254 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
| 255 | + <?php echo give_get_payment_key($payment_id); ?> |
|
| 256 | 256 | </p> |
| 257 | 257 | </div> |
| 258 | 258 | |
| 259 | 259 | <div class="give-order-ip give-admin-box-inside"> |
| 260 | 260 | <p> |
| 261 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
| 262 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
| 261 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
| 262 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
| 263 | 263 | </p> |
| 264 | 264 | </div> |
| 265 | 265 | |
| 266 | - <?php if ( $transaction_id ) : ?> |
|
| 266 | + <?php if ($transaction_id) : ?> |
|
| 267 | 267 | <div class="give-order-tx-id give-admin-box-inside"> |
| 268 | 268 | <p> |
| 269 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
| 270 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
| 269 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
| 270 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
| 271 | 271 | </p> |
| 272 | 272 | </div> |
| 273 | 273 | <?php endif; ?> |
| 274 | 274 | |
| 275 | 275 | <div class="give-admin-box-inside"> |
| 276 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
| 277 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
| 276 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
| 277 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
| 278 | 278 | </p> |
| 279 | 279 | </div> |
| 280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @param int $payment_id Payment id. |
| 288 | 288 | */ |
| 289 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
| 289 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
| 290 | 290 | ?> |
| 291 | 291 | |
| 292 | 292 | </div> |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * |
| 307 | 307 | * @param int $payment_id Payment id. |
| 308 | 308 | */ |
| 309 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
| 309 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
| 310 | 310 | ?> |
| 311 | 311 | |
| 312 | 312 | </div> |
@@ -326,56 +326,56 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @param int $payment_id Payment id. |
| 328 | 328 | */ |
| 329 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
| 329 | + do_action('give_view_order_details_main_before', $payment_id); |
|
| 330 | 330 | ?> |
| 331 | 331 | |
| 332 | 332 | <?php $column_count = 'columns-3'; ?> |
| 333 | 333 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 334 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
| 334 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
| 335 | 335 | |
| 336 | 336 | <div class="inside"> |
| 337 | 337 | |
| 338 | 338 | <div class="column-container"> |
| 339 | 339 | <div class="column"> |
| 340 | 340 | <p> |
| 341 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
| 341 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
| 342 | 342 | <?php |
| 343 | - if ( $payment_meta['form_id'] ) : |
|
| 343 | + if ($payment_meta['form_id']) : |
|
| 344 | 344 | printf( |
| 345 | 345 | '<a href="%1$s" target="_blank">#%2$s</a>', |
| 346 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
| 346 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
| 347 | 347 | $payment_meta['form_id'] |
| 348 | 348 | ); |
| 349 | 349 | endif; |
| 350 | 350 | ?> |
| 351 | 351 | </p> |
| 352 | 352 | <p> |
| 353 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
| 354 | - <?php echo Give()->html->forms_dropdown( array( |
|
| 353 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
| 354 | + <?php echo Give()->html->forms_dropdown(array( |
|
| 355 | 355 | 'selected' => $payment_meta['form_id'], |
| 356 | 356 | 'name' => 'give-payment-form-select', |
| 357 | 357 | 'id' => 'give-payment-form-select', |
| 358 | 358 | 'chosen' => true, |
| 359 | - ) ); ?> |
|
| 359 | + )); ?> |
|
| 360 | 360 | </p> |
| 361 | 361 | </div> |
| 362 | 362 | <div class="column"> |
| 363 | 363 | <p> |
| 364 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
| 365 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
| 364 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
| 365 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
| 366 | 366 | </p> |
| 367 | 367 | <p> |
| 368 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
| 368 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
| 369 | 369 | <span class="give-donation-level"> |
| 370 | 370 | <?php |
| 371 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 372 | - if ( empty( $var_prices ) ) { |
|
| 373 | - esc_html_e( 'n/a', 'give' ); |
|
| 371 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
| 372 | + if (empty($var_prices)) { |
|
| 373 | + esc_html_e('n/a', 'give'); |
|
| 374 | 374 | } else { |
| 375 | 375 | $prices_atts = ''; |
| 376 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
| 377 | - foreach ( $variable_prices as $variable_price ) { |
|
| 378 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
| 376 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
| 377 | + foreach ($variable_prices as $variable_price) { |
|
| 378 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | // Variable price dropdown options. |
@@ -385,11 +385,11 @@ discard block |
||
| 385 | 385 | 'chosen' => true, |
| 386 | 386 | 'show_option_all' => '', |
| 387 | 387 | 'show_option_none' => '', |
| 388 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
| 388 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
| 389 | 389 | 'selected' => $payment_meta['price_id'], |
| 390 | 390 | ); |
| 391 | 391 | // Render variable prices select tag html. |
| 392 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
| 392 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
| 393 | 393 | } |
| 394 | 394 | ?> |
| 395 | 395 | </span> |
@@ -397,8 +397,8 @@ discard block |
||
| 397 | 397 | </div> |
| 398 | 398 | <div class="column"> |
| 399 | 399 | <p> |
| 400 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
| 401 | - <?php echo give_currency_filter( give_format_amount( $payment->total ), give_get_payment_currency_code( $payment->ID ) ); ?> |
|
| 400 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
| 401 | + <?php echo give_currency_filter(give_format_amount($payment->total), give_get_payment_currency_code($payment->ID)); ?> |
|
| 402 | 402 | </p> |
| 403 | 403 | <p> |
| 404 | 404 | <?php |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * |
| 412 | 412 | * @param int $payment_id Payment id. |
| 413 | 413 | */ |
| 414 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
| 414 | + do_action('give_donation_details_thead_before', $payment_id); |
|
| 415 | 415 | |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @param int $payment_id Payment id. |
| 425 | 425 | */ |
| 426 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
| 426 | + do_action('give_donation_details_thead_after', $payment_id); |
|
| 427 | 427 | |
| 428 | 428 | /** |
| 429 | 429 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * |
| 435 | 435 | * @param int $payment_id Payment id. |
| 436 | 436 | */ |
| 437 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
| 437 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
| 438 | 438 | |
| 439 | 439 | /** |
| 440 | 440 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | * |
| 446 | 446 | * @param int $payment_id Payment id. |
| 447 | 447 | */ |
| 448 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
| 448 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
| 449 | 449 | ?> |
| 450 | 450 | </p> |
| 451 | 451 | </div> |
@@ -465,67 +465,67 @@ discard block |
||
| 465 | 465 | * |
| 466 | 466 | * @param int $payment_id Payment id. |
| 467 | 467 | */ |
| 468 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
| 468 | + do_action('give_view_order_details_files_after', $payment_id); |
|
| 469 | 469 | ?> |
| 470 | 470 | |
| 471 | 471 | <div id="give-donor-details" class="postbox"> |
| 472 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
| 472 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
| 473 | 473 | |
| 474 | 474 | <div class="inside"> |
| 475 | 475 | |
| 476 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
| 476 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
| 477 | 477 | |
| 478 | 478 | <div class="column-container donor-info"> |
| 479 | 479 | <div class="column"> |
| 480 | 480 | <p> |
| 481 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
| 481 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
| 482 | 482 | <?php |
| 483 | - if ( ! empty( $donor->id ) ) { |
|
| 483 | + if ( ! empty($donor->id)) { |
|
| 484 | 484 | printf( |
| 485 | 485 | '<a href="%1$s" target="_blank">#%2$s</a>', |
| 486 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
| 486 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
| 487 | 487 | $donor->id |
| 488 | 488 | ); |
| 489 | 489 | } |
| 490 | 490 | ?> |
| 491 | 491 | </p> |
| 492 | 492 | <p> |
| 493 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
| 494 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
| 493 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
| 494 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
| 495 | 495 | </p> |
| 496 | 496 | </div> |
| 497 | 497 | <div class="column"> |
| 498 | 498 | <p> |
| 499 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
| 499 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
| 500 | 500 | <?php |
| 501 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
| 502 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 501 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
| 502 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 503 | 503 | |
| 504 | 504 | // Check whether the donor name and WP_User name is same or not. |
| 505 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
| 506 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
| 507 | - }else{ |
|
| 505 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 506 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
| 507 | + } else { |
|
| 508 | 508 | echo $donor_name; |
| 509 | 509 | } |
| 510 | 510 | ?> |
| 511 | 511 | </p> |
| 512 | 512 | <p> |
| 513 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
| 513 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
| 514 | 514 | <?php echo $donor->email; ?> |
| 515 | 515 | </p> |
| 516 | 516 | </div> |
| 517 | 517 | <div class="column"> |
| 518 | 518 | <p> |
| 519 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
| 519 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
| 520 | 520 | <?php |
| 521 | - echo Give()->html->donor_dropdown( array( |
|
| 521 | + echo Give()->html->donor_dropdown(array( |
|
| 522 | 522 | 'selected' => $donor->id, |
| 523 | 523 | 'name' => 'donor-id', |
| 524 | - ) ); |
|
| 524 | + )); |
|
| 525 | 525 | ?> |
| 526 | 526 | </p> |
| 527 | 527 | <p> |
| 528 | - <a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
| 528 | + <a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
| 529 | 529 | </p> |
| 530 | 530 | </div> |
| 531 | 531 | </div> |
@@ -533,13 +533,13 @@ discard block |
||
| 533 | 533 | <div class="column-container new-donor" style="display: none"> |
| 534 | 534 | <div class="column"> |
| 535 | 535 | <p> |
| 536 | - <label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
| 536 | + <label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
| 537 | 537 | <input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/> |
| 538 | 538 | </p> |
| 539 | 539 | </div> |
| 540 | 540 | <div class="column"> |
| 541 | 541 | <p> |
| 542 | - <label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
| 542 | + <label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
| 543 | 543 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
| 544 | 544 | </p> |
| 545 | 545 | </div> |
@@ -547,9 +547,9 @@ discard block |
||
| 547 | 547 | <p> |
| 548 | 548 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
| 549 | 549 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
| 550 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 550 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 551 | 551 | <br> |
| 552 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
| 552 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
| 553 | 553 | </p> |
| 554 | 554 | </div> |
| 555 | 555 | </div> |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | * @param array $payment_meta Payment meta. |
| 566 | 566 | * @param array $user_info User information. |
| 567 | 567 | */ |
| 568 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 568 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 569 | 569 | |
| 570 | 570 | /** |
| 571 | 571 | * Fires on the donation details page, in the donor-details metabox. |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | * |
| 575 | 575 | * @param int $payment_id Payment id. |
| 576 | 576 | */ |
| 577 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 577 | + do_action('give_payment_view_details', $payment_id); |
|
| 578 | 578 | ?> |
| 579 | 579 | |
| 580 | 580 | </div> |
@@ -590,11 +590,11 @@ discard block |
||
| 590 | 590 | * |
| 591 | 591 | * @param int $payment_id Payment id. |
| 592 | 592 | */ |
| 593 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
| 593 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
| 594 | 594 | ?> |
| 595 | 595 | |
| 596 | 596 | <div id="give-billing-details" class="postbox"> |
| 597 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
| 597 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
| 598 | 598 | |
| 599 | 599 | <div class="inside"> |
| 600 | 600 | |
@@ -604,59 +604,59 @@ discard block |
||
| 604 | 604 | <div class="data column-container"> |
| 605 | 605 | <div class="column"> |
| 606 | 606 | <div class="give-wrap-address-line1"> |
| 607 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
| 608 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 607 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
| 608 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 609 | 609 | </div> |
| 610 | 610 | <div class="give-wrap-address-line2"> |
| 611 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
| 612 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 611 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
| 612 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 613 | 613 | </div> |
| 614 | 614 | </div> |
| 615 | 615 | <div class="column"> |
| 616 | 616 | <div class="give-wrap-address-city"> |
| 617 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 618 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 617 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 618 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 619 | 619 | </div> |
| 620 | 620 | <div class="give-wrap-address-zip"> |
| 621 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 622 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 621 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
| 622 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 623 | 623 | |
| 624 | 624 | </div> |
| 625 | 625 | </div> |
| 626 | 626 | <div class="column"> |
| 627 | 627 | <div id="give-order-address-country-wrap"> |
| 628 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
| 628 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
| 629 | 629 | <?php |
| 630 | - echo Give()->html->select( array( |
|
| 630 | + echo Give()->html->select(array( |
|
| 631 | 631 | 'options' => give_get_country_list(), |
| 632 | 632 | 'name' => 'give-payment-address[0][country]', |
| 633 | 633 | 'selected' => $address['country'], |
| 634 | 634 | 'show_option_all' => false, |
| 635 | 635 | 'show_option_none' => false, |
| 636 | 636 | 'chosen' => true, |
| 637 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 638 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 639 | - ) ); |
|
| 637 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 638 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 639 | + )); |
|
| 640 | 640 | ?> |
| 641 | 641 | </div> |
| 642 | 642 | <div id="give-order-address-state-wrap"> |
| 643 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
| 643 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
| 644 | 644 | <?php |
| 645 | - $states = give_get_states( $address['country'] ); |
|
| 646 | - if ( ! empty( $states ) ) { |
|
| 647 | - echo Give()->html->select( array( |
|
| 645 | + $states = give_get_states($address['country']); |
|
| 646 | + if ( ! empty($states)) { |
|
| 647 | + echo Give()->html->select(array( |
|
| 648 | 648 | 'options' => $states, |
| 649 | 649 | 'name' => 'give-payment-address[0][state]', |
| 650 | 650 | 'selected' => $address['state'], |
| 651 | 651 | 'show_option_all' => false, |
| 652 | 652 | 'show_option_none' => false, |
| 653 | 653 | 'chosen' => true, |
| 654 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
| 655 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
| 656 | - ) ); |
|
| 654 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
| 655 | + 'data' => array('search-type' => 'no_ajax'), |
|
| 656 | + )); |
|
| 657 | 657 | } else { |
| 658 | 658 | ?> |
| 659 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 659 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 660 | 660 | <?php |
| 661 | 661 | } ?> |
| 662 | 662 | </div> |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | * |
| 677 | 677 | * @param int $payment_id Payment id. |
| 678 | 678 | */ |
| 679 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
| 679 | + do_action('give_payment_billing_details', $payment_id); |
|
| 680 | 680 | ?> |
| 681 | 681 | |
| 682 | 682 | </div> |
@@ -692,32 +692,32 @@ discard block |
||
| 692 | 692 | * |
| 693 | 693 | * @param int $payment_id Payment id. |
| 694 | 694 | */ |
| 695 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
| 695 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
| 696 | 696 | ?> |
| 697 | 697 | |
| 698 | 698 | <div id="give-payment-notes" class="postbox"> |
| 699 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
| 699 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
| 700 | 700 | |
| 701 | 701 | <div class="inside"> |
| 702 | 702 | <div id="give-payment-notes-inner"> |
| 703 | 703 | <?php |
| 704 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 705 | - if ( ! empty( $notes ) ) { |
|
| 704 | + $notes = give_get_payment_notes($payment_id); |
|
| 705 | + if ( ! empty($notes)) { |
|
| 706 | 706 | $no_notes_display = ' style="display:none;"'; |
| 707 | - foreach ( $notes as $note ) : |
|
| 707 | + foreach ($notes as $note) : |
|
| 708 | 708 | |
| 709 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 709 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 710 | 710 | |
| 711 | 711 | endforeach; |
| 712 | 712 | } else { |
| 713 | 713 | $no_notes_display = ''; |
| 714 | 714 | } |
| 715 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
| 715 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
| 716 | 716 | </div> |
| 717 | 717 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 718 | 718 | |
| 719 | 719 | <div class="give-clearfix"> |
| 720 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
| 720 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
| 721 | 721 | </div> |
| 722 | 722 | |
| 723 | 723 | </div> |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | * |
| 734 | 734 | * @param int $payment_id Payment id. |
| 735 | 735 | */ |
| 736 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
| 736 | + do_action('give_view_order_details_main_after', $payment_id); |
|
| 737 | 737 | ?> |
| 738 | 738 | |
| 739 | 739 | </div> |
@@ -755,11 +755,11 @@ discard block |
||
| 755 | 755 | * |
| 756 | 756 | * @param int $payment_id Payment id. |
| 757 | 757 | */ |
| 758 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
| 758 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
| 759 | 759 | |
| 760 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
| 760 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
| 761 | 761 | ?> |
| 762 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 762 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 763 | 763 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 764 | 764 | </form> |
| 765 | 765 | <?php |
@@ -770,6 +770,6 @@ discard block |
||
| 770 | 770 | * |
| 771 | 771 | * @param int $payment_id Payment id. |
| 772 | 772 | */ |
| 773 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
| 773 | + do_action('give_view_order_details_after', $payment_id); |
|
| 774 | 774 | ?> |
| 775 | 775 | </div><!-- /.wrap --> |
@@ -520,7 +520,7 @@ |
||
| 520 | 520 | // Check whether the donor name and WP_User name is same or not. |
| 521 | 521 | if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
| 522 | 522 | echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
| 523 | - }else{ |
|
| 523 | + } else{ |
|
| 524 | 524 | echo $donor_name; |
| 525 | 525 | } |
| 526 | 526 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_payment_history_page() { |
| 27 | 27 | |
| 28 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
| 28 | + $give_payment = get_post_type_object('give_payment'); |
|
| 29 | 29 | |
| 30 | - if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) { |
|
| 31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php'; |
|
| 30 | + if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) { |
|
| 31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php'; |
|
| 32 | 32 | } else { |
| 33 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
| 33 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
| 34 | 34 | $payments_table = new Give_Payment_History_Table(); |
| 35 | 35 | $payments_table->prepare_items(); |
| 36 | 36 | ?> |
@@ -44,17 +44,17 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @since 1.7 |
| 46 | 46 | */ |
| 47 | - do_action( 'give_payments_page_top' ); |
|
| 47 | + do_action('give_payments_page_top'); |
|
| 48 | 48 | ?> |
| 49 | 49 | |
| 50 | - <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
| 50 | + <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
| 51 | 51 | <input type="hidden" name="post_type" value="give_forms" /> |
| 52 | 52 | <input type="hidden" name="page" value="give-payment-history" /> |
| 53 | 53 | <?php $payments_table->views() ?> |
| 54 | 54 | <?php $payments_table->advanced_filters(); ?> |
| 55 | 55 | </form> |
| 56 | 56 | |
| 57 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
| 57 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
| 58 | 58 | <input type="hidden" name="post_type" value="give_forms" /> |
| 59 | 59 | <input type="hidden" name="page" value="give-payment-history" /> |
| 60 | 60 | <?php $payments_table->display() ?> |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @since 1.7 |
| 68 | 68 | */ |
| 69 | - do_action( 'give_payments_page_bottom' ); |
|
| 69 | + do_action('give_payments_page_bottom'); |
|
| 70 | 70 | ?> |
| 71 | 71 | |
| 72 | 72 | </div> |
@@ -83,29 +83,29 @@ discard block |
||
| 83 | 83 | * @param $title |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | -function give_view_order_details_title( $admin_title, $title ) { |
|
| 86 | +function give_view_order_details_title($admin_title, $title) { |
|
| 87 | 87 | |
| 88 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
| 88 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
| 89 | 89 | return $admin_title; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if( ! isset( $_GET['give-action'] ) ) { |
|
| 92 | + if ( ! isset($_GET['give-action'])) { |
|
| 93 | 93 | return $admin_title; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - switch( $_GET['give-action'] ) : |
|
| 96 | + switch ($_GET['give-action']) : |
|
| 97 | 97 | |
| 98 | 98 | case 'view-payment-details' : |
| 99 | 99 | $title = sprintf( |
| 100 | 100 | /* translators: %s: admin title */ |
| 101 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
| 101 | + esc_html__('View Donation Details - %s', 'give'), |
|
| 102 | 102 | $admin_title |
| 103 | 103 | ); |
| 104 | 104 | break; |
| 105 | 105 | case 'edit-payment' : |
| 106 | 106 | $title = sprintf( |
| 107 | 107 | /* translators: %s: admin title */ |
| 108 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
| 108 | + esc_html__('Edit Donation - %s', 'give'), |
|
| 109 | 109 | $admin_title |
| 110 | 110 | ); |
| 111 | 111 | break; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | return $title; |
| 118 | 118 | } |
| 119 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
| 119 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen. |
@@ -128,20 +128,20 @@ discard block |
||
| 128 | 128 | * @param $context |
| 129 | 129 | * @return string |
| 130 | 130 | */ |
| 131 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
| 131 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
| 132 | 132 | |
| 133 | - $post = get_post( $post_id ); |
|
| 133 | + $post = get_post($post_id); |
|
| 134 | 134 | |
| 135 | - if( ! $post ) { |
|
| 135 | + if ( ! $post) { |
|
| 136 | 136 | return $url; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if( 'give_payment' != $post->post_type ) { |
|
| 139 | + if ('give_payment' != $post->post_type) { |
|
| 140 | 140 | return $url; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id ); |
|
| 143 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id); |
|
| 144 | 144 | |
| 145 | 145 | return $url; |
| 146 | 146 | } |
| 147 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
| 147 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
|
@@ -10,13 +10,13 @@ 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 | 17 | // Load WP_List_Table if not loaded. |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | public function __construct() { |
| 127 | 127 | |
| 128 | 128 | // Set parent defaults. |
| 129 | - parent::__construct( array( |
|
| 130 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 131 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 132 | - 'ajax' => false, // Does this table support ajax? |
|
| 133 | - ) ); |
|
| 129 | + parent::__construct(array( |
|
| 130 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 131 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 132 | + 'ajax' => false, // Does this table support ajax? |
|
| 133 | + )); |
|
| 134 | 134 | |
| 135 | 135 | $this->get_payment_counts(); |
| 136 | 136 | $this->process_bulk_action(); |
| 137 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 137 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -143,31 +143,31 @@ discard block |
||
| 143 | 143 | * @return void |
| 144 | 144 | */ |
| 145 | 145 | public function advanced_filters() { |
| 146 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 147 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
| 148 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; |
|
| 149 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; |
|
| 150 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
| 146 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 147 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
| 148 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; |
|
| 149 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; |
|
| 150 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
| 151 | 151 | ?> |
| 152 | 152 | <div id="give-payment-filters"> |
| 153 | 153 | <span id="give-payment-date-filters"> |
| 154 | 154 | <label for="start-date" |
| 155 | - class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
| 155 | + class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
| 156 | 156 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
| 157 | 157 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> |
| 158 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
| 158 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
| 159 | 159 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
| 160 | 160 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> |
| 161 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>" /> |
|
| 161 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>" /> |
|
| 162 | 162 | </span> |
| 163 | - <?php if ( ! empty( $status ) ) : ?> |
|
| 164 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> |
|
| 163 | + <?php if ( ! empty($status)) : ?> |
|
| 164 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> |
|
| 165 | 165 | <?php endif; ?> |
| 166 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor )|| ! empty( $search ) ) : ?> |
|
| 167 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
| 168 | - class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
| 166 | + <?php if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search)) : ?> |
|
| 167 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
| 168 | + class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
| 169 | 169 | <?php endif; ?> |
| 170 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
| 170 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
| 171 | 171 | </div> |
| 172 | 172 | |
| 173 | 173 | <?php |
@@ -184,18 +184,18 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @return void |
| 186 | 186 | */ |
| 187 | - public function search_box( $text, $input_id ) { |
|
| 188 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
| 187 | + public function search_box($text, $input_id) { |
|
| 188 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $input_id = $input_id . '-search-input'; |
|
| 192 | + $input_id = $input_id.'-search-input'; |
|
| 193 | 193 | |
| 194 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 195 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 194 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 195 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 196 | 196 | } |
| 197 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 198 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 197 | + if ( ! empty($_REQUEST['order'])) { |
|
| 198 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 199 | 199 | } |
| 200 | 200 | ?> |
| 201 | 201 | <p class="search-box" role="search"> |
@@ -207,13 +207,13 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @since 1.7 |
| 209 | 209 | */ |
| 210 | - do_action( 'give_payment_history_search' ); |
|
| 210 | + do_action('give_payment_history_search'); |
|
| 211 | 211 | ?> |
| 212 | 212 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 213 | 213 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
| 214 | - <?php submit_button( $text, 'button', false, false, array( |
|
| 214 | + <?php submit_button($text, 'button', false, false, array( |
|
| 215 | 215 | 'ID' => 'search-submit', |
| 216 | - ) ); ?><br /> |
|
| 216 | + )); ?><br /> |
|
| 217 | 217 | </p> |
| 218 | 218 | <?php |
| 219 | 219 | } |
@@ -227,57 +227,57 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function get_views() { |
| 229 | 229 | |
| 230 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 231 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
| 232 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
| 233 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
| 234 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
| 235 | - $processing_count = ' <span class="count">(' . $this->processing_count . ')</span>'; |
|
| 236 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
| 237 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
| 238 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
| 239 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
| 230 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 231 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
| 232 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
| 233 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
| 234 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
| 235 | + $processing_count = ' <span class="count">('.$this->processing_count.')</span>'; |
|
| 236 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
| 237 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
| 238 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
| 239 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
| 240 | 240 | |
| 241 | 241 | $views = array( |
| 242 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
| 242 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
| 243 | 243 | 'status', |
| 244 | 244 | 'paged', |
| 245 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
| 246 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 245 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
| 246 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 247 | 247 | 'status' => 'publish', |
| 248 | 248 | 'paged' => false, |
| 249 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
| 250 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 249 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
| 250 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 251 | 251 | 'status' => 'pending', |
| 252 | 252 | 'paged' => false, |
| 253 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
| 254 | - 'processing' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 253 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
| 254 | + 'processing' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 255 | 255 | 'status' => 'processing', |
| 256 | 256 | 'paged' => false, |
| 257 | - ) ) ), $current === 'processing' ? ' class="current"' : '', esc_html__( 'Processing', 'give' ) . $processing_count ), |
|
| 258 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 257 | + ))), $current === 'processing' ? ' class="current"' : '', esc_html__('Processing', 'give').$processing_count), |
|
| 258 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 259 | 259 | 'status' => 'refunded', |
| 260 | 260 | 'paged' => false, |
| 261 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
| 262 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 261 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
| 262 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 263 | 263 | 'status' => 'revoked', |
| 264 | 264 | 'paged' => false, |
| 265 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
| 266 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 265 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
| 266 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 267 | 267 | 'status' => 'failed', |
| 268 | 268 | 'paged' => false, |
| 269 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
| 270 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 269 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
| 270 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 271 | 271 | 'status' => 'cancelled', |
| 272 | 272 | 'paged' => false, |
| 273 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
| 274 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 273 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
| 274 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 275 | 275 | 'status' => 'abandoned', |
| 276 | 276 | 'paged' => false, |
| 277 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
| 277 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
| 278 | 278 | ); |
| 279 | 279 | |
| 280 | - return apply_filters( 'give_payments_table_views', $views ); |
|
| 280 | + return apply_filters('give_payments_table_views', $views); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -290,15 +290,15 @@ discard block |
||
| 290 | 290 | public function get_columns() { |
| 291 | 291 | $columns = array( |
| 292 | 292 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
| 293 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
| 294 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
| 295 | - 'status' => esc_html__( 'Status', 'give' ), |
|
| 296 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 297 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 298 | - 'details' => esc_html__( 'Details', 'give' ), |
|
| 293 | + 'donation' => esc_html__('Donation', 'give'), |
|
| 294 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
| 295 | + 'status' => esc_html__('Status', 'give'), |
|
| 296 | + 'date' => esc_html__('Date', 'give'), |
|
| 297 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 298 | + 'details' => esc_html__('Details', 'give'), |
|
| 299 | 299 | ); |
| 300 | 300 | |
| 301 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
| 301 | + return apply_filters('give_payments_table_columns', $columns); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -310,14 +310,14 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function get_sortable_columns() { |
| 312 | 312 | $columns = array( |
| 313 | - 'donation' => array( 'ID', true ), |
|
| 314 | - 'donation_form' => array( 'donation_form', false ), |
|
| 315 | - 'status' => array( 'status', false ), |
|
| 316 | - 'amount' => array( 'amount', false ), |
|
| 317 | - 'date' => array( 'date', false ), |
|
| 313 | + 'donation' => array('ID', true), |
|
| 314 | + 'donation_form' => array('donation_form', false), |
|
| 315 | + 'status' => array('status', false), |
|
| 316 | + 'amount' => array('amount', false), |
|
| 317 | + 'date' => array('date', false), |
|
| 318 | 318 | ); |
| 319 | 319 | |
| 320 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
| 320 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -343,55 +343,55 @@ discard block |
||
| 343 | 343 | * |
| 344 | 344 | * @return string Column Name |
| 345 | 345 | */ |
| 346 | - public function column_default( $payment, $column_name ) { |
|
| 346 | + public function column_default($payment, $column_name) { |
|
| 347 | 347 | |
| 348 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ); |
|
| 349 | - $row_actions = $this->get_row_actions( $payment ); |
|
| 348 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))); |
|
| 349 | + $row_actions = $this->get_row_actions($payment); |
|
| 350 | 350 | |
| 351 | - switch ( $column_name ) { |
|
| 351 | + switch ($column_name) { |
|
| 352 | 352 | case 'donation' : |
| 353 | - $value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) ); |
|
| 354 | - $value .= $this->get_donor_email( $payment ); |
|
| 355 | - $value .= $this->row_actions( $row_actions ); |
|
| 353 | + $value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment)); |
|
| 354 | + $value .= $this->get_donor_email($payment); |
|
| 355 | + $value .= $this->row_actions($row_actions); |
|
| 356 | 356 | break; |
| 357 | 357 | |
| 358 | 358 | case 'amount' : |
| 359 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
| 360 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
| 361 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
| 359 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
| 360 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
| 361 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
| 362 | 362 | break; |
| 363 | 363 | |
| 364 | 364 | case 'donation_form' : |
| 365 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
| 366 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
| 367 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
| 365 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
| 366 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
| 367 | + $level = give_get_payment_form_title($payment->meta, true); |
|
| 368 | 368 | |
| 369 | - if ( ! empty( $level ) ) { |
|
| 369 | + if ( ! empty($level)) { |
|
| 370 | 370 | $value .= $level; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | break; |
| 374 | 374 | |
| 375 | 375 | case 'date' : |
| 376 | - $date = strtotime( $payment->date ); |
|
| 377 | - $value = date_i18n( give_date_format(), $date ); |
|
| 376 | + $date = strtotime($payment->date); |
|
| 377 | + $value = date_i18n(give_date_format(), $date); |
|
| 378 | 378 | break; |
| 379 | 379 | |
| 380 | 380 | case 'status' : |
| 381 | - $value = $this->get_payment_status( $payment ); |
|
| 381 | + $value = $this->get_payment_status($payment); |
|
| 382 | 382 | break; |
| 383 | 383 | |
| 384 | 384 | case 'details' : |
| 385 | - $value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) ); |
|
| 385 | + $value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID)); |
|
| 386 | 386 | break; |
| 387 | 387 | |
| 388 | 388 | default: |
| 389 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
| 389 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
| 390 | 390 | break; |
| 391 | 391 | |
| 392 | 392 | }// End switch(). |
| 393 | 393 | |
| 394 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
| 394 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /** |
@@ -404,17 +404,17 @@ discard block |
||
| 404 | 404 | * |
| 405 | 405 | * @return string Data shown in the Email column |
| 406 | 406 | */ |
| 407 | - public function get_donor_email( $payment ) { |
|
| 407 | + public function get_donor_email($payment) { |
|
| 408 | 408 | |
| 409 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 409 | + $email = give_get_payment_user_email($payment->ID); |
|
| 410 | 410 | |
| 411 | - if ( empty( $email ) ) { |
|
| 412 | - $email = esc_html__( '(unknown)', 'give' ); |
|
| 411 | + if (empty($email)) { |
|
| 412 | + $email = esc_html__('(unknown)', 'give'); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
| 415 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
| 416 | 416 | |
| 417 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
| 417 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -426,32 +426,32 @@ discard block |
||
| 426 | 426 | * |
| 427 | 427 | * @return array $actions |
| 428 | 428 | */ |
| 429 | - function get_row_actions( $payment ) { |
|
| 429 | + function get_row_actions($payment) { |
|
| 430 | 430 | |
| 431 | 431 | $actions = array(); |
| 432 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 432 | + $email = give_get_payment_user_email($payment->ID); |
|
| 433 | 433 | |
| 434 | 434 | // Add search term string back to base URL. |
| 435 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
| 436 | - if ( ! empty( $search_terms ) ) { |
|
| 437 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
| 435 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
| 436 | + if ( ! empty($search_terms)) { |
|
| 437 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
| 440 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
| 441 | 441 | |
| 442 | - $actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
| 442 | + $actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
| 443 | 443 | 'give-action' => 'email_links', |
| 444 | 444 | 'purchase_id' => $payment->ID, |
| 445 | - ), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) ); |
|
| 445 | + ), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give')); |
|
| 446 | 446 | |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - $actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
| 449 | + $actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
| 450 | 450 | 'give-action' => 'delete_payment', |
| 451 | 451 | 'purchase_id' => $payment->ID, |
| 452 | - ), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) ); |
|
| 452 | + ), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give')); |
|
| 453 | 453 | |
| 454 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
| 454 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | |
@@ -465,10 +465,10 @@ discard block |
||
| 465 | 465 | * |
| 466 | 466 | * @return string Data shown in the Email column |
| 467 | 467 | */ |
| 468 | - function get_payment_status( $payment ) { |
|
| 469 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
| 470 | - if ( $payment->mode == 'test' ) { |
|
| 471 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
| 468 | + function get_payment_status($payment) { |
|
| 469 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
| 470 | + if ($payment->mode == 'test') { |
|
| 471 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | return $value; |
@@ -484,8 +484,8 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @return string Displays a checkbox. |
| 486 | 486 | */ |
| 487 | - public function column_cb( $payment ) { |
|
| 488 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
| 487 | + public function column_cb($payment) { |
|
| 488 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | /** |
@@ -498,8 +498,8 @@ discard block |
||
| 498 | 498 | * |
| 499 | 499 | * @return string Displays a checkbox. |
| 500 | 500 | */ |
| 501 | - public function get_payment_id( $payment ) { |
|
| 502 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
| 501 | + public function get_payment_id($payment) { |
|
| 502 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
@@ -512,32 +512,32 @@ discard block |
||
| 512 | 512 | * |
| 513 | 513 | * @return string Data shown in the User column |
| 514 | 514 | */ |
| 515 | - public function get_donor( $payment ) { |
|
| 515 | + public function get_donor($payment) { |
|
| 516 | 516 | |
| 517 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
| 518 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
| 519 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
| 517 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
| 518 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
| 519 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
| 520 | 520 | |
| 521 | 521 | $value = ''; |
| 522 | - if ( ! empty( $donor_id ) ) { |
|
| 522 | + if ( ! empty($donor_id)) { |
|
| 523 | 523 | |
| 524 | 524 | // Check whether the donor name and WP_User name is same or not. |
| 525 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
| 526 | - $value .= $donor_billing_name . ' ('; |
|
| 525 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 526 | + $value .= $donor_billing_name.' ('; |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
| 529 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
| 530 | 530 | |
| 531 | 531 | // Check whether the donor name and WP_User name is same or not. |
| 532 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
| 532 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
| 533 | 533 | $value .= ')'; |
| 534 | 534 | } |
| 535 | 535 | } else { |
| 536 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 537 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
| 536 | + $email = give_get_payment_user_email($payment->ID); |
|
| 537 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
| 540 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | /** |
@@ -549,20 +549,20 @@ discard block |
||
| 549 | 549 | */ |
| 550 | 550 | public function get_bulk_actions() { |
| 551 | 551 | $actions = array( |
| 552 | - 'delete' => __( 'Delete', 'give' ), |
|
| 553 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
| 554 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
| 555 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
| 556 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
| 557 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
| 558 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
| 559 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
| 560 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
| 561 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
| 562 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
| 552 | + 'delete' => __('Delete', 'give'), |
|
| 553 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
| 554 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
| 555 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
| 556 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
| 557 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
| 558 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
| 559 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
| 560 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
| 561 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
| 562 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
| 563 | 563 | ); |
| 564 | 564 | |
| 565 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
| 565 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | /** |
@@ -573,63 +573,63 @@ discard block |
||
| 573 | 573 | * @return void |
| 574 | 574 | */ |
| 575 | 575 | public function process_bulk_action() { |
| 576 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
| 576 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
| 577 | 577 | $action = $this->current_action(); |
| 578 | 578 | |
| 579 | - if ( ! is_array( $ids ) ) { |
|
| 580 | - $ids = array( $ids ); |
|
| 579 | + if ( ! is_array($ids)) { |
|
| 580 | + $ids = array($ids); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - if ( empty( $action ) ) { |
|
| 583 | + if (empty($action)) { |
|
| 584 | 584 | return; |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - foreach ( $ids as $id ) { |
|
| 587 | + foreach ($ids as $id) { |
|
| 588 | 588 | |
| 589 | 589 | // Detect when a bulk action is being triggered. |
| 590 | - switch ( $this->current_action() ) { |
|
| 590 | + switch ($this->current_action()) { |
|
| 591 | 591 | |
| 592 | 592 | case'delete': |
| 593 | - give_delete_donation( $id ); |
|
| 593 | + give_delete_donation($id); |
|
| 594 | 594 | break; |
| 595 | 595 | |
| 596 | 596 | case 'set-status-publish': |
| 597 | - give_update_payment_status( $id, 'publish' ); |
|
| 597 | + give_update_payment_status($id, 'publish'); |
|
| 598 | 598 | break; |
| 599 | 599 | |
| 600 | 600 | case 'set-status-pending': |
| 601 | - give_update_payment_status( $id, 'pending' ); |
|
| 601 | + give_update_payment_status($id, 'pending'); |
|
| 602 | 602 | break; |
| 603 | 603 | |
| 604 | 604 | case 'set-status-processing': |
| 605 | - give_update_payment_status( $id, 'processing' ); |
|
| 605 | + give_update_payment_status($id, 'processing'); |
|
| 606 | 606 | break; |
| 607 | 607 | |
| 608 | 608 | case 'set-status-refunded': |
| 609 | - give_update_payment_status( $id, 'refunded' ); |
|
| 609 | + give_update_payment_status($id, 'refunded'); |
|
| 610 | 610 | break; |
| 611 | 611 | case 'set-status-revoked': |
| 612 | - give_update_payment_status( $id, 'revoked' ); |
|
| 612 | + give_update_payment_status($id, 'revoked'); |
|
| 613 | 613 | break; |
| 614 | 614 | |
| 615 | 615 | case 'set-status-failed': |
| 616 | - give_update_payment_status( $id, 'failed' ); |
|
| 616 | + give_update_payment_status($id, 'failed'); |
|
| 617 | 617 | break; |
| 618 | 618 | |
| 619 | 619 | case 'set-status-cancelled': |
| 620 | - give_update_payment_status( $id, 'cancelled' ); |
|
| 620 | + give_update_payment_status($id, 'cancelled'); |
|
| 621 | 621 | break; |
| 622 | 622 | |
| 623 | 623 | case 'set-status-abandoned': |
| 624 | - give_update_payment_status( $id, 'abandoned' ); |
|
| 624 | + give_update_payment_status($id, 'abandoned'); |
|
| 625 | 625 | break; |
| 626 | 626 | |
| 627 | 627 | case 'set-status-preapproval': |
| 628 | - give_update_payment_status( $id, 'preapproval' ); |
|
| 628 | + give_update_payment_status($id, 'preapproval'); |
|
| 629 | 629 | break; |
| 630 | 630 | |
| 631 | 631 | case 'resend-receipt': |
| 632 | - give_email_donation_receipt( $id, false ); |
|
| 632 | + give_email_donation_receipt($id, false); |
|
| 633 | 633 | break; |
| 634 | 634 | }// End switch(). |
| 635 | 635 | |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | * @param int $id The ID of the payment. |
| 642 | 642 | * @param string $current_action The action that is being triggered. |
| 643 | 643 | */ |
| 644 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
| 644 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
| 645 | 645 | }// End foreach(). |
| 646 | 646 | |
| 647 | 647 | } |
@@ -657,29 +657,29 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | $args = array(); |
| 659 | 659 | |
| 660 | - if ( isset( $_GET['user'] ) ) { |
|
| 661 | - $args['user'] = urldecode( $_GET['user'] ); |
|
| 662 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
| 663 | - $args['donor'] = absint( $_GET['donor'] ); |
|
| 664 | - } elseif ( isset( $_GET['s'] ) ) { |
|
| 665 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
| 666 | - if ( $is_user ) { |
|
| 667 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
| 668 | - unset( $args['s'] ); |
|
| 660 | + if (isset($_GET['user'])) { |
|
| 661 | + $args['user'] = urldecode($_GET['user']); |
|
| 662 | + } elseif (isset($_GET['donor'])) { |
|
| 663 | + $args['donor'] = absint($_GET['donor']); |
|
| 664 | + } elseif (isset($_GET['s'])) { |
|
| 665 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
| 666 | + if ($is_user) { |
|
| 667 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
| 668 | + unset($args['s']); |
|
| 669 | 669 | } else { |
| 670 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
| 670 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
| 675 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
| 674 | + if ( ! empty($_GET['start-date'])) { |
|
| 675 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
| 679 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
| 678 | + if ( ! empty($_GET['end-date'])) { |
|
| 679 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - $payment_count = give_count_payments( $args ); |
|
| 682 | + $payment_count = give_count_payments($args); |
|
| 683 | 683 | $this->complete_count = $payment_count->publish; |
| 684 | 684 | $this->pending_count = $payment_count->pending; |
| 685 | 685 | $this->processing_count = $payment_count->processing; |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | $this->cancelled_count = $payment_count->cancelled; |
| 690 | 690 | $this->abandoned_count = $payment_count->abandoned; |
| 691 | 691 | |
| 692 | - foreach ( $payment_count as $count ) { |
|
| 692 | + foreach ($payment_count as $count) { |
|
| 693 | 693 | $this->total_count += $count; |
| 694 | 694 | } |
| 695 | 695 | } |
@@ -704,27 +704,27 @@ discard block |
||
| 704 | 704 | public function payments_data() { |
| 705 | 705 | |
| 706 | 706 | $per_page = $this->per_page; |
| 707 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
| 708 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 709 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
| 710 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
| 711 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 712 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
| 713 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
| 714 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
| 715 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
| 716 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
| 717 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 718 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
| 719 | - |
|
| 720 | - if ( ! empty( $search ) ) { |
|
| 707 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
| 708 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 709 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
| 710 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
| 711 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 712 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
| 713 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
| 714 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
| 715 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
| 716 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
| 717 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 718 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
| 719 | + |
|
| 720 | + if ( ! empty($search)) { |
|
| 721 | 721 | $status = 'any'; // Force all payment statuses when searching. |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | $args = array( |
| 725 | 725 | 'output' => 'payments', |
| 726 | 726 | 'number' => $per_page, |
| 727 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
| 727 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
| 728 | 728 | 'orderby' => $orderby, |
| 729 | 729 | 'order' => $order, |
| 730 | 730 | 'user' => $user, |
@@ -739,12 +739,12 @@ discard block |
||
| 739 | 739 | 'end_date' => $end_date, |
| 740 | 740 | ); |
| 741 | 741 | |
| 742 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
| 742 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
| 743 | 743 | $args['search_in_notes'] = true; |
| 744 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
| 744 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - $p_query = new Give_Payments_Query( $args ); |
|
| 747 | + $p_query = new Give_Payments_Query($args); |
|
| 748 | 748 | |
| 749 | 749 | return $p_query->get_payments(); |
| 750 | 750 | |
@@ -764,17 +764,17 @@ discard block |
||
| 764 | 764 | */ |
| 765 | 765 | public function prepare_items() { |
| 766 | 766 | |
| 767 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
| 767 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
| 768 | 768 | |
| 769 | 769 | $columns = $this->get_columns(); |
| 770 | 770 | $hidden = array(); // No hidden columns. |
| 771 | 771 | $sortable = $this->get_sortable_columns(); |
| 772 | 772 | $data = $this->payments_data(); |
| 773 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
| 773 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
| 774 | 774 | |
| 775 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 775 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 776 | 776 | |
| 777 | - switch ( $status ) { |
|
| 777 | + switch ($status) { |
|
| 778 | 778 | case 'publish': |
| 779 | 779 | $total_items = $this->complete_count; |
| 780 | 780 | break; |
@@ -804,20 +804,20 @@ discard block |
||
| 804 | 804 | break; |
| 805 | 805 | default: |
| 806 | 806 | // Retrieve the count of the non-default-Give status. |
| 807 | - $count = wp_count_posts( 'give_payment' ); |
|
| 808 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
| 807 | + $count = wp_count_posts('give_payment'); |
|
| 808 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
| 809 | 809 | break; |
| 810 | 810 | } |
| 811 | 811 | |
| 812 | 812 | $this->items = $data; |
| 813 | 813 | |
| 814 | - $this->set_pagination_args( array( |
|
| 814 | + $this->set_pagination_args(array( |
|
| 815 | 815 | 'total_items' => $total_items, |
| 816 | 816 | // We have to calculate the total number of items. |
| 817 | 817 | 'per_page' => $this->per_page, |
| 818 | 818 | // We have to determine how many items to show on a page. |
| 819 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 819 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 820 | 820 | // We have to calculate the total number of pages. |
| 821 | - ) ); |
|
| 821 | + )); |
|
| 822 | 822 | } |
| 823 | 823 | } |
@@ -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 | |
@@ -27,34 +27,34 @@ discard block |
||
| 27 | 27 | * @return array $form_columns Updated array of forms columns |
| 28 | 28 | * Post Type List Table |
| 29 | 29 | */ |
| 30 | -function give_form_columns( $give_form_columns ) { |
|
| 30 | +function give_form_columns($give_form_columns) { |
|
| 31 | 31 | |
| 32 | 32 | // Standard columns |
| 33 | 33 | $give_form_columns = array( |
| 34 | 34 | 'cb' => '<input type="checkbox"/>', |
| 35 | - 'title' => __( 'Name', 'give' ), |
|
| 36 | - 'form_category' => __( 'Categories', 'give' ), |
|
| 37 | - 'form_tag' => __( 'Tags', 'give' ), |
|
| 38 | - 'price' => __( 'Amount', 'give' ), |
|
| 39 | - 'goal' => __( 'Goal', 'give' ), |
|
| 40 | - 'donations' => __( 'Donations', 'give' ), |
|
| 41 | - 'earnings' => __( 'Income', 'give' ), |
|
| 42 | - 'shortcode' => __( 'Shortcode', 'give' ), |
|
| 43 | - 'date' => __( 'Date', 'give' ), |
|
| 35 | + 'title' => __('Name', 'give'), |
|
| 36 | + 'form_category' => __('Categories', 'give'), |
|
| 37 | + 'form_tag' => __('Tags', 'give'), |
|
| 38 | + 'price' => __('Amount', 'give'), |
|
| 39 | + 'goal' => __('Goal', 'give'), |
|
| 40 | + 'donations' => __('Donations', 'give'), |
|
| 41 | + 'earnings' => __('Income', 'give'), |
|
| 42 | + 'shortcode' => __('Shortcode', 'give'), |
|
| 43 | + 'date' => __('Date', 'give'), |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | // Does the user want categories / tags? |
| 47 | - if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
| 48 | - unset( $give_form_columns['form_category'] ); |
|
| 47 | + if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
| 48 | + unset($give_form_columns['form_category']); |
|
| 49 | 49 | } |
| 50 | - if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
| 51 | - unset( $give_form_columns['form_tag'] ); |
|
| 50 | + if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
| 51 | + unset($give_form_columns['form_tag']); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
| 54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
| 57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Render Give Form Columns |
@@ -66,59 +66,59 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
| 70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
| 69 | +function give_render_form_columns($column_name, $post_id) { |
|
| 70 | + if (get_post_type($post_id) == 'give_forms') { |
|
| 71 | 71 | |
| 72 | - switch ( $column_name ) { |
|
| 72 | + switch ($column_name) { |
|
| 73 | 73 | case 'form_category': |
| 74 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
| 74 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
| 75 | 75 | break; |
| 76 | 76 | case 'form_tag': |
| 77 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
| 77 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
| 78 | 78 | break; |
| 79 | 79 | case 'price': |
| 80 | - if ( give_has_variable_prices( $post_id ) ) { |
|
| 81 | - echo give_price_range( $post_id ); |
|
| 80 | + if (give_has_variable_prices($post_id)) { |
|
| 81 | + echo give_price_range($post_id); |
|
| 82 | 82 | } else { |
| 83 | - echo give_price( $post_id, false ); |
|
| 84 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
| 83 | + echo give_price($post_id, false); |
|
| 84 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
| 85 | 85 | } |
| 86 | 86 | break; |
| 87 | 87 | case 'goal': |
| 88 | - if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) { |
|
| 89 | - echo give_goal( $post_id, false ); |
|
| 88 | + if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) { |
|
| 89 | + echo give_goal($post_id, false); |
|
| 90 | 90 | } else { |
| 91 | - esc_html_e( 'No Goal Set', 'give' ); |
|
| 91 | + esc_html_e('No Goal Set', 'give'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
| 94 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
| 95 | 95 | break; |
| 96 | 96 | case 'donations': |
| 97 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
| 98 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-tools&tab=logs&form=' . $post_id ) ) . '">'; |
|
| 99 | - echo give_get_form_sales_stats( $post_id ); |
|
| 97 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
| 98 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs&form='.$post_id)).'">'; |
|
| 99 | + echo give_get_form_sales_stats($post_id); |
|
| 100 | 100 | echo '</a>'; |
| 101 | 101 | } else { |
| 102 | 102 | echo '-'; |
| 103 | 103 | } |
| 104 | 104 | break; |
| 105 | 105 | case 'earnings': |
| 106 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
| 107 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ) . '">'; |
|
| 108 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
| 106 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
| 107 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)).'">'; |
|
| 108 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
| 109 | 109 | echo '</a>'; |
| 110 | 110 | } else { |
| 111 | 111 | echo '-'; |
| 112 | 112 | } |
| 113 | 113 | break; |
| 114 | 114 | case 'shortcode': |
| 115 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
| 115 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
| 116 | 116 | break; |
| 117 | 117 | }// End switch(). |
| 118 | 118 | }// End if(). |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
| 121 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * Registers the sortable columns in the list table |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return array $columns Array of sortable columns |
| 131 | 131 | */ |
| 132 | -function give_sortable_form_columns( $columns ) { |
|
| 132 | +function give_sortable_form_columns($columns) { |
|
| 133 | 133 | $columns['price'] = 'amount'; |
| 134 | 134 | $columns['sales'] = 'sales'; |
| 135 | 135 | $columns['earnings'] = 'earnings'; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | return $columns; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
| 142 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Sorts Columns in the Forms List Table |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @return array $vars Array of all the sort variables. |
| 152 | 152 | */ |
| 153 | -function give_sort_forms( $vars ) { |
|
| 153 | +function give_sort_forms($vars) { |
|
| 154 | 154 | // Check if we're viewing the "give_forms" post type. |
| 155 | - if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
|
| 155 | + if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) { |
|
| 156 | 156 | return $vars; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - switch ( $vars['orderby'] ) { |
|
| 159 | + switch ($vars['orderby']) { |
|
| 160 | 160 | // Check if 'orderby' is set to "sales". |
| 161 | 161 | case 'sales': |
| 162 | 162 | $vars = array_merge( |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | // Check if "orderby" is set to "price/amount". |
| 183 | 183 | case 'amount': |
| 184 | - $multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
| 184 | + $multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
| 185 | 185 | |
| 186 | 186 | $vars['orderby'] = 'meta_value_num'; |
| 187 | 187 | $vars['meta_query'] = array( |
@@ -233,17 +233,17 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return array Array of all sort variables. |
| 235 | 235 | */ |
| 236 | -function give_filter_forms( $vars ) { |
|
| 237 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
| 236 | +function give_filter_forms($vars) { |
|
| 237 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
| 238 | 238 | |
| 239 | 239 | // If an author ID was passed, use it |
| 240 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
| 240 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
| 241 | 241 | |
| 242 | 242 | $author_id = $_REQUEST['author']; |
| 243 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
| 244 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 243 | + if ((int) $author_id !== get_current_user_id()) { |
|
| 244 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array( |
|
| 245 | 245 | 'response' => 403, |
| 246 | - ) ); |
|
| 246 | + )); |
|
| 247 | 247 | } |
| 248 | 248 | $vars = array_merge( |
| 249 | 249 | $vars, |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | * @return void |
| 268 | 268 | */ |
| 269 | 269 | function give_forms_load() { |
| 270 | - add_filter( 'request', 'give_sort_forms' ); |
|
| 271 | - add_filter( 'request', 'give_filter_forms' ); |
|
| 270 | + add_filter('request', 'give_sort_forms'); |
|
| 271 | + add_filter('request', 'give_filter_forms'); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
| 274 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
| 275 | 275 | |
| 276 | 276 | /** |
| 277 | 277 | * Remove Forms Month Filter |
@@ -285,17 +285,17 @@ discard block |
||
| 285 | 285 | * @global $typenow The post type we are viewing. |
| 286 | 286 | * @return array Empty array disables the dropdown. |
| 287 | 287 | */ |
| 288 | -function give_remove_month_filter( $dates ) { |
|
| 288 | +function give_remove_month_filter($dates) { |
|
| 289 | 289 | global $typenow; |
| 290 | 290 | |
| 291 | - if ( $typenow == 'give_forms' ) { |
|
| 291 | + if ($typenow == 'give_forms') { |
|
| 292 | 292 | $dates = array(); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | return $dates; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
| 298 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
| 299 | 299 | |
| 300 | 300 | /** |
| 301 | 301 | * Updates price when saving post |
@@ -306,23 +306,23 @@ discard block |
||
| 306 | 306 | * |
| 307 | 307 | * @return int|null |
| 308 | 308 | */ |
| 309 | -function give_price_save_quick_edit( $post_id ) { |
|
| 310 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
| 309 | +function give_price_save_quick_edit($post_id) { |
|
| 310 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
| 311 | 311 | return; |
| 312 | 312 | } |
| 313 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 313 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 314 | 314 | return $post_id; |
| 315 | 315 | } |
| 316 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 316 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
| 317 | 317 | return $post_id; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
| 321 | - give_update_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
| 320 | + if (isset($_REQUEST['_give_regprice'])) { |
|
| 321 | + give_update_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
| 325 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | 328 | * Process bulk edit actions via AJAX |
@@ -332,18 +332,18 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | function give_save_bulk_edit() { |
| 334 | 334 | |
| 335 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
| 335 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
| 336 | 336 | |
| 337 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
| 338 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
| 339 | - foreach ( $post_ids as $post_id ) { |
|
| 337 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
| 338 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
| 339 | + foreach ($post_ids as $post_id) { |
|
| 340 | 340 | |
| 341 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 341 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 342 | 342 | continue; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if ( ! empty( $price ) ) { |
|
| 346 | - give_update_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
| 345 | + if ( ! empty($price)) { |
|
| 346 | + give_update_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | } |
@@ -351,4 +351,4 @@ discard block |
||
| 351 | 351 | die(); |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
| 354 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
|
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | // Exit if accessed directly. |
| 19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 19 | +if ( ! defined('ABSPATH')) { |
|
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | 31 | function give_reports_page() { |
| 32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
| 33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
| 32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
| 33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
| 34 | 34 | $views = give_reports_default_views(); |
| 35 | 35 | ?> |
| 36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
| 39 | 39 | |
| 40 | 40 | <h2 class="nav-tab-wrapper"> |
| 41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
| 42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 41 | + <?php foreach ($views as $tab => $label) { ?> |
|
| 42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 43 | 43 | 'tab' => $tab, |
| 44 | 44 | 'settings-updated' => false, |
| 45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
| 45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
| 46 | 46 | <?php } ?> |
| 47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
| 48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
| 48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 49 | 49 | 'tab' => 'export', |
| 50 | 50 | 'settings-updated' => false, |
| 51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
| 51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
| 52 | 52 | <?php } |
| 53 | 53 | /** |
| 54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @since 1.0 |
| 59 | 59 | */ |
| 60 | - do_action( 'give_reports_tabs' ); |
|
| 60 | + do_action('give_reports_tabs'); |
|
| 61 | 61 | ?> |
| 62 | 62 | </h2> |
| 63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @since 1.0 |
| 69 | 69 | */ |
| 70 | - do_action( 'give_reports_page_top' ); |
|
| 70 | + do_action('give_reports_page_top'); |
|
| 71 | 71 | |
| 72 | 72 | // Set $active_tab prior to hook firing. |
| 73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
| 73 | + if (in_array($active_tab, array_keys($views))) { |
|
| 74 | 74 | $active_tab = 'reports'; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0 |
| 81 | 81 | */ |
| 82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
| 82 | + do_action("give_reports_tab_{$active_tab}"); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Fires after the report page. |
| 86 | 86 | * |
| 87 | 87 | * @since 1.0 |
| 88 | 88 | */ |
| 89 | - do_action( 'give_reports_page_bottom' ); |
|
| 89 | + do_action('give_reports_page_bottom'); |
|
| 90 | 90 | ?> |
| 91 | 91 | </div><!-- .wrap --> |
| 92 | 92 | <?php |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function give_reports_default_views() { |
| 102 | 102 | $views = array( |
| 103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
| 104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
| 105 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
| 106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
| 103 | + 'earnings' => esc_html__('Income', 'give'), |
|
| 104 | + 'forms' => esc_html__('Forms', 'give'), |
|
| 105 | + 'donors' => esc_html__('Donors', 'give'), |
|
| 106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | - $views = apply_filters( 'give_report_views', $views ); |
|
| 109 | + $views = apply_filters('give_report_views', $views); |
|
| 110 | 110 | |
| 111 | 111 | return $views; |
| 112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | * @since 1.0 |
| 122 | 122 | * @return string $view Report View |
| 123 | 123 | */ |
| 124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
| 124 | +function give_get_reporting_view($default = 'earnings') { |
|
| 125 | 125 | |
| 126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
| 126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
| 127 | 127 | $view = $default; |
| 128 | 128 | } else { |
| 129 | 129 | $view = $_GET['view']; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
| 132 | + return apply_filters('give_get_reporting_view', $view); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $current_view = 'earnings'; |
| 143 | 143 | $views = give_reports_default_views(); |
| 144 | 144 | |
| 145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
| 145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
| 146 | 146 | $current_view = $_GET['tab']; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @since 1.0 |
| 153 | 153 | */ |
| 154 | - do_action( "give_reports_view_{$current_view}" ); |
|
| 154 | + do_action("give_reports_view_{$current_view}"); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
| 157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | function give_report_views() { |
| 166 | 166 | $views = give_reports_default_views(); |
| 167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
| 167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
| 168 | 168 | /** |
| 169 | 169 | * Fires before the report page actions form. |
| 170 | 170 | * |
| 171 | 171 | * @since 1.0 |
| 172 | 172 | */ |
| 173 | - do_action( 'give_report_view_actions_before' ); |
|
| 173 | + do_action('give_report_view_actions_before'); |
|
| 174 | 174 | ?> |
| 175 | 175 | <form id="give-reports-filter" method="get"> |
| 176 | 176 | <select id="give-reports-view" name="view"> |
| 177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
| 178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
| 179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
| 178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
| 179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 180 | 180 | <?php endforeach; ?> |
| 181 | 181 | </select> |
| 182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @since 1.0 |
| 190 | 190 | */ |
| 191 | - do_action( 'give_report_view_actions' ); |
|
| 191 | + do_action('give_report_view_actions'); |
|
| 192 | 192 | ?> |
| 193 | 193 | |
| 194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
| 195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
| 196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
| 197 | 197 | </form> |
| 198 | 198 | <?php |
| 199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @since 1.0 |
| 203 | 203 | */ |
| 204 | - do_action( 'give_report_view_actions_after' ); |
|
| 204 | + do_action('give_report_view_actions_after'); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -214,18 +214,18 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | function give_reports_forms_table() { |
| 216 | 216 | |
| 217 | - if ( isset( $_GET['form-id'] ) ) { |
|
| 217 | + if (isset($_GET['form-id'])) { |
|
| 218 | 218 | return; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
| 221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
| 222 | 222 | |
| 223 | 223 | $give_table = new Give_Form_Reports_Table(); |
| 224 | 224 | $give_table->prepare_items(); |
| 225 | 225 | $give_table->display(); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
| 228 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | 231 | * Renders the detailed report for a specific give form. |
@@ -234,20 +234,20 @@ discard block |
||
| 234 | 234 | * @return void |
| 235 | 235 | */ |
| 236 | 236 | function give_reports_form_details() { |
| 237 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
| 237 | + if ( ! isset($_GET['form-id'])) { |
|
| 238 | 238 | return; |
| 239 | 239 | } |
| 240 | 240 | ?> |
| 241 | 241 | <div class="tablenav top reports-forms-details-wrap"> |
| 242 | 242 | <div class="actions bulkactions"> |
| 243 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
| 243 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
| 244 | 244 | </div> |
| 245 | 245 | </div> |
| 246 | 246 | <?php |
| 247 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
| 247 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
| 250 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | 253 | * Renders the Reports Donors Table |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @return void |
| 259 | 259 | */ |
| 260 | 260 | function give_reports_donors_table() { |
| 261 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
| 261 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
| 262 | 262 | |
| 263 | 263 | $give_table = new Give_Donor_Reports_Table(); |
| 264 | 264 | $give_table->prepare_items(); |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @since 1.0 |
| 272 | 272 | */ |
| 273 | - do_action( 'give_logs_donors_table_top' ); |
|
| 273 | + do_action('give_logs_donors_table_top'); |
|
| 274 | 274 | ?> |
| 275 | 275 | <form id="give-donors-filter" method="get"> |
| 276 | 276 | <?php |
| 277 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
| 277 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
| 278 | 278 | $give_table->display(); |
| 279 | 279 | ?> |
| 280 | 280 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @since 1.0 |
| 289 | 289 | */ |
| 290 | - do_action( 'give_logs_donors_table_bottom' ); |
|
| 290 | + do_action('give_logs_donors_table_bottom'); |
|
| 291 | 291 | ?> |
| 292 | 292 | </div> |
| 293 | 293 | <?php |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
| 296 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
| 297 | 297 | |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | * @return void |
| 306 | 306 | */ |
| 307 | 307 | function give_reports_gateways_table() { |
| 308 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
| 308 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
| 309 | 309 | |
| 310 | 310 | $give_table = new Give_Gateway_Reports_Table(); |
| 311 | 311 | $give_table->prepare_items(); |
| 312 | 312 | $give_table->display(); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
| 315 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
| 316 | 316 | |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -324,13 +324,13 @@ discard block |
||
| 324 | 324 | function give_reports_earnings() { |
| 325 | 325 | ?> |
| 326 | 326 | <div class="tablenav top reports-table-nav"> |
| 327 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3> |
|
| 327 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3> |
|
| 328 | 328 | </div> |
| 329 | 329 | <?php |
| 330 | 330 | give_reports_graph(); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
| 333 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
| 334 | 334 | |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -341,9 +341,9 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | function give_estimated_monthly_stats() { |
| 343 | 343 | |
| 344 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
| 344 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
| 345 | 345 | |
| 346 | - if ( false === $estimated ) { |
|
| 346 | + if (false === $estimated) { |
|
| 347 | 347 | |
| 348 | 348 | $estimated = array( |
| 349 | 349 | 'earnings' => 0, |
@@ -352,22 +352,22 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | $stats = new Give_Payment_Stats; |
| 354 | 354 | |
| 355 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
| 356 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
| 355 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
| 356 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
| 357 | 357 | |
| 358 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
| 359 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
| 360 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 361 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
| 358 | + $current_day = date('d', current_time('timestamp')); |
|
| 359 | + $current_month = date('n', current_time('timestamp')); |
|
| 360 | + $current_year = date('Y', current_time('timestamp')); |
|
| 361 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
| 362 | 362 | |
| 363 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
| 364 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
| 363 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
| 364 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
| 365 | 365 | |
| 366 | 366 | // Cache for one day |
| 367 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
| 367 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - return maybe_unserialize( $estimated ); |
|
| 370 | + return maybe_unserialize($estimated); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |