@@ -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 | |
@@ -34,31 +34,31 @@ discard block |
||
| 34 | 34 | // $give_campaigns_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_campaigns->labels->menu_name, $give_campaigns->labels->add_new, 'edit_' . $give_campaigns->capability_type . 's', 'post-new.php?post_type=give_campaigns', null ); |
| 35 | 35 | |
| 36 | 36 | //Payments |
| 37 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
| 38 | - $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' ); |
|
| 37 | + $give_payment = get_post_type_object('give_payment'); |
|
| 38 | + $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'); |
|
| 39 | 39 | |
| 40 | 40 | //Donors |
| 41 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donors', 'give' ), __( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' ); |
|
| 41 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', __('Donors', 'give'), __('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page'); |
|
| 42 | 42 | |
| 43 | 43 | //Reports |
| 44 | - $give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donation Reports', 'give' ), __( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' ); |
|
| 44 | + $give_reports_page = add_submenu_page('edit.php?post_type=give_forms', __('Donation Reports', 'give'), __('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page'); |
|
| 45 | 45 | |
| 46 | 46 | //Settings |
| 47 | - $give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Settings', 'give' ), __( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array( |
|
| 47 | + $give_settings_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Settings', 'give'), __('Settings', 'give'), 'manage_give_settings', 'give-settings', array( |
|
| 48 | 48 | Give()->give_settings, |
| 49 | 49 | 'admin_page_display' |
| 50 | - ) ); |
|
| 50 | + )); |
|
| 51 | 51 | |
| 52 | 52 | //Add-ons |
| 53 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Add-ons', 'give' ), __( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
| 53 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Add-ons', 'give'), __('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
| 54 | 54 | |
| 55 | 55 | //Upgrades |
| 56 | - $give_upgrades_screen = add_submenu_page( null, __( 'Give Upgrades', 'give' ), __( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
| 56 | + $give_upgrades_screen = add_submenu_page(null, __('Give Upgrades', 'give'), __('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
| 61 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Determines whether the current admin page is a Give admin page. |
@@ -73,224 +73,224 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return bool True if Give admin page. |
| 75 | 75 | */ |
| 76 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
| 76 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
| 77 | 77 | |
| 78 | 78 | global $pagenow, $typenow; |
| 79 | 79 | |
| 80 | 80 | $found = false; |
| 81 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
| 82 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
| 83 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
| 84 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
| 85 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
| 86 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
| 81 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
| 82 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
| 83 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
| 84 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
| 85 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
| 86 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
| 87 | 87 | |
| 88 | - switch ( $passed_page ) { |
|
| 88 | + switch ($passed_page) { |
|
| 89 | 89 | case 'give_forms': |
| 90 | - switch ( $passed_view ) { |
|
| 90 | + switch ($passed_view) { |
|
| 91 | 91 | case 'list-table': |
| 92 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
| 92 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
| 93 | 93 | $found = true; |
| 94 | 94 | } |
| 95 | 95 | break; |
| 96 | 96 | case 'edit': |
| 97 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
| 97 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
| 98 | 98 | $found = true; |
| 99 | 99 | } |
| 100 | 100 | break; |
| 101 | 101 | case 'new': |
| 102 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
| 102 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
| 103 | 103 | $found = true; |
| 104 | 104 | } |
| 105 | 105 | break; |
| 106 | 106 | default: |
| 107 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
| 107 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
| 108 | 108 | $found = true; |
| 109 | 109 | } |
| 110 | 110 | break; |
| 111 | 111 | } |
| 112 | 112 | break; |
| 113 | 113 | case 'categories': |
| 114 | - switch ( $passed_view ) { |
|
| 114 | + switch ($passed_view) { |
|
| 115 | 115 | case 'list-table': |
| 116 | 116 | case 'new': |
| 117 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
| 117 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
| 118 | 118 | $found = true; |
| 119 | 119 | } |
| 120 | 120 | break; |
| 121 | 121 | case 'edit': |
| 122 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
| 122 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
| 123 | 123 | $found = true; |
| 124 | 124 | } |
| 125 | 125 | break; |
| 126 | 126 | default: |
| 127 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
| 127 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
| 128 | 128 | $found = true; |
| 129 | 129 | } |
| 130 | 130 | break; |
| 131 | 131 | } |
| 132 | 132 | break; |
| 133 | 133 | case 'tags': |
| 134 | - switch ( $passed_view ) { |
|
| 134 | + switch ($passed_view) { |
|
| 135 | 135 | case 'list-table': |
| 136 | 136 | case 'new': |
| 137 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
| 137 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
| 138 | 138 | $found = true; |
| 139 | 139 | } |
| 140 | 140 | break; |
| 141 | 141 | case 'edit': |
| 142 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
| 142 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
| 143 | 143 | $found = true; |
| 144 | 144 | } |
| 145 | 145 | break; |
| 146 | 146 | default: |
| 147 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
| 147 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
| 148 | 148 | $found = true; |
| 149 | 149 | } |
| 150 | 150 | break; |
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | case 'payments': |
| 154 | - switch ( $passed_view ) { |
|
| 154 | + switch ($passed_view) { |
|
| 155 | 155 | case 'list-table': |
| 156 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
| 156 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
| 157 | 157 | $found = true; |
| 158 | 158 | } |
| 159 | 159 | break; |
| 160 | 160 | case 'edit': |
| 161 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) { |
|
| 161 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) { |
|
| 162 | 162 | $found = true; |
| 163 | 163 | } |
| 164 | 164 | break; |
| 165 | 165 | default: |
| 166 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
| 166 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
| 167 | 167 | $found = true; |
| 168 | 168 | } |
| 169 | 169 | break; |
| 170 | 170 | } |
| 171 | 171 | break; |
| 172 | 172 | case 'reports': |
| 173 | - switch ( $passed_view ) { |
|
| 173 | + switch ($passed_view) { |
|
| 174 | 174 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
| 175 | 175 | case 'earnings': |
| 176 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
| 176 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
| 177 | 177 | $found = true; |
| 178 | 178 | } |
| 179 | 179 | break; |
| 180 | 180 | case 'donors': |
| 181 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
| 181 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
| 182 | 182 | $found = true; |
| 183 | 183 | } |
| 184 | 184 | break; |
| 185 | 185 | case 'gateways': |
| 186 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
| 186 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
| 187 | 187 | $found = true; |
| 188 | 188 | } |
| 189 | 189 | break; |
| 190 | 190 | case 'export': |
| 191 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
| 191 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
| 192 | 192 | $found = true; |
| 193 | 193 | } |
| 194 | 194 | break; |
| 195 | 195 | case 'logs': |
| 196 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
| 196 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
| 197 | 197 | $found = true; |
| 198 | 198 | } |
| 199 | 199 | break; |
| 200 | 200 | default: |
| 201 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 201 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 202 | 202 | $found = true; |
| 203 | 203 | } |
| 204 | 204 | break; |
| 205 | 205 | } |
| 206 | 206 | break; |
| 207 | 207 | case 'settings': |
| 208 | - switch ( $passed_view ) { |
|
| 208 | + switch ($passed_view) { |
|
| 209 | 209 | case 'general': |
| 210 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
| 210 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
| 211 | 211 | $found = true; |
| 212 | 212 | } |
| 213 | 213 | break; |
| 214 | 214 | case 'gateways': |
| 215 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
| 215 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
| 216 | 216 | $found = true; |
| 217 | 217 | } |
| 218 | 218 | break; |
| 219 | 219 | case 'emails': |
| 220 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
| 220 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
| 221 | 221 | $found = true; |
| 222 | 222 | } |
| 223 | 223 | break; |
| 224 | 224 | case 'display': |
| 225 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
| 225 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
| 226 | 226 | $found = true; |
| 227 | 227 | } |
| 228 | 228 | break; |
| 229 | 229 | case 'licenses': |
| 230 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
| 230 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
| 231 | 231 | $found = true; |
| 232 | 232 | } |
| 233 | 233 | break; |
| 234 | 234 | case 'api': |
| 235 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
| 235 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
| 236 | 236 | $found = true; |
| 237 | 237 | } |
| 238 | 238 | break; |
| 239 | 239 | case 'advanced': |
| 240 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
| 240 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
| 241 | 241 | $found = true; |
| 242 | 242 | } |
| 243 | 243 | break; |
| 244 | 244 | case 'system_info': |
| 245 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
| 245 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
| 246 | 246 | $found = true; |
| 247 | 247 | } |
| 248 | 248 | break; |
| 249 | 249 | default: |
| 250 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
| 250 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
| 251 | 251 | $found = true; |
| 252 | 252 | } |
| 253 | 253 | break; |
| 254 | 254 | } |
| 255 | 255 | break; |
| 256 | 256 | case 'addons': |
| 257 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
| 257 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
| 258 | 258 | $found = true; |
| 259 | 259 | } |
| 260 | 260 | break; |
| 261 | 261 | case 'donors': |
| 262 | - switch ( $passed_view ) { |
|
| 262 | + switch ($passed_view) { |
|
| 263 | 263 | case 'list-table': |
| 264 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
| 264 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
| 265 | 265 | $found = true; |
| 266 | 266 | } |
| 267 | 267 | break; |
| 268 | 268 | case 'overview': |
| 269 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
| 269 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
| 270 | 270 | $found = true; |
| 271 | 271 | } |
| 272 | 272 | break; |
| 273 | 273 | case 'notes': |
| 274 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
| 274 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
| 275 | 275 | $found = true; |
| 276 | 276 | } |
| 277 | 277 | break; |
| 278 | 278 | default: |
| 279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
| 279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
| 280 | 280 | $found = true; |
| 281 | 281 | } |
| 282 | 282 | break; |
| 283 | 283 | } |
| 284 | 284 | break; |
| 285 | 285 | case 'reports': |
| 286 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 286 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 287 | 287 | $found = true; |
| 288 | 288 | } |
| 289 | 289 | break; |
| 290 | 290 | default: |
| 291 | 291 | 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_customers_page; |
| 292 | 292 | |
| 293 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
| 293 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
| 294 | 294 | $give_payments_page, |
| 295 | 295 | $give_settings_page, |
| 296 | 296 | $give_reports_page, |
@@ -299,18 +299,18 @@ discard block |
||
| 299 | 299 | $give_upgrades_screen, |
| 300 | 300 | $give_settings_export, |
| 301 | 301 | $give_customers_page |
| 302 | - ) ); |
|
| 303 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
| 302 | + )); |
|
| 303 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
| 304 | 304 | $found = true; |
| 305 | - if ( 'give-upgrades' === $page ) { |
|
| 305 | + if ('give-upgrades' === $page) { |
|
| 306 | 306 | $found = false; |
| 307 | 307 | } |
| 308 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
| 308 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
| 309 | 309 | $found = true; |
| 310 | 310 | } |
| 311 | 311 | break; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
| 314 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
| 315 | 315 | |
| 316 | 316 | } |
| 317 | 317 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @param $_banner_details |
| 26 | 26 | */ |
| 27 | - function __construct( $_banner_details ) { |
|
| 27 | + function __construct($_banner_details) { |
|
| 28 | 28 | |
| 29 | 29 | global $current_user; |
| 30 | 30 | $this->banner_details = $_banner_details; |
| 31 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
| 32 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
| 31 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
| 32 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
| 33 | 33 | |
| 34 | 34 | //Get current user |
| 35 | 35 | $this->user_id = $current_user->ID; |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | public function init() { |
| 49 | 49 | |
| 50 | 50 | //Testing? |
| 51 | - if ( $this->test_mode ) { |
|
| 52 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
| 51 | + if ($this->test_mode) { |
|
| 52 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | //Get the current page to add the notice to |
| 56 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
| 57 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
| 56 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
| 57 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | } |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | global $pagenow; |
| 70 | 70 | |
| 71 | 71 | //Make sure we're on the plugins page. |
| 72 | - if ( $pagenow !== 'plugins.php' ) { |
|
| 72 | + if ($pagenow !== 'plugins.php') { |
|
| 73 | 73 | return false; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // If the user hasn't already dismissed our alert, |
| 77 | 77 | // Output the activation banner |
| 78 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
| 78 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
| 79 | 79 | |
| 80 | 80 | <!-- * I output inline styles here |
| 81 | 81 | * because there's no reason to keep these |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | <img src="<?php echo GIVE_PLUGIN_URL; ?>assets/images/svg/give-icon-full-circle.svg" class="give-logo" /> |
| 153 | 153 | |
| 154 | 154 | <!-- Your Message --> |
| 155 | - <h3><?php echo sprintf( __( 'Thank you for installing Give\'s %1$s%2$s%3$s Add-on!', 'give' ), '<span>', $this->banner_details['name'], '</span>' ); ?></h3> |
|
| 155 | + <h3><?php echo sprintf(__('Thank you for installing Give\'s %1$s%2$s%3$s Add-on!', 'give'), '<span>', $this->banner_details['name'], '</span>'); ?></h3> |
|
| 156 | 156 | |
| 157 | 157 | <a href="<?php |
| 158 | 158 | //The Dismiss Button |
| 159 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
| 160 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
| 159 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
| 160 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
| 161 | 161 | |
| 162 | 162 | <!-- * Now we output a few "actions" |
| 163 | 163 | * that the user can take from here --> |
@@ -165,24 +165,24 @@ discard block |
||
| 165 | 165 | <div class="alert-actions"> |
| 166 | 166 | |
| 167 | 167 | <?php //Point them to your settings page |
| 168 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
| 168 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
| 169 | 169 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
| 170 | - <span class="dashicons dashicons-admin-settings"></span><?php _e( 'Go to Settings', 'give' ); ?> |
|
| 170 | + <span class="dashicons dashicons-admin-settings"></span><?php _e('Go to Settings', 'give'); ?> |
|
| 171 | 171 | </a> |
| 172 | 172 | <?php } ?> |
| 173 | 173 | |
| 174 | 174 | <?php |
| 175 | 175 | // Show them how to configure the Addon |
| 176 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
| 177 | - <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf( __( 'Documentation: %1$s Add-on', 'give' ), $this->banner_details['name'] ); ?> |
|
| 176 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
| 177 | + <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf(__('Documentation: %1$s Add-on', 'give'), $this->banner_details['name']); ?> |
|
| 178 | 178 | </a> |
| 179 | 179 | <?php } ?> |
| 180 | 180 | <?php |
| 181 | 181 | //Let them signup for plugin updates |
| 182 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
| 182 | + if (isset($this->banner_details['support_url'])) { ?> |
|
| 183 | 183 | |
| 184 | 184 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
| 185 | - <span class="dashicons dashicons-sos"></span><?php _e( 'Get Support', 'give' ); ?> |
|
| 185 | + <span class="dashicons dashicons-sos"></span><?php _e('Get Support', 'give'); ?> |
|
| 186 | 186 | </a> |
| 187 | 187 | |
| 188 | 188 | <?php } ?> |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | /* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
| 204 | 204 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
| 205 | 205 | */ |
| 206 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
| 206 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
| 207 | 207 | |
| 208 | 208 | //Get the global user |
| 209 | 209 | global $current_user; |
| 210 | 210 | $user_id = $current_user->ID; |
| 211 | 211 | |
| 212 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
| 212 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
@@ -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 | /** |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | global $status, $page; |
| 63 | 63 | |
| 64 | 64 | // Set parent defaults |
| 65 | - parent::__construct( array( |
|
| 66 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records |
|
| 67 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records |
|
| 65 | + parent::__construct(array( |
|
| 66 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records |
|
| 67 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records |
|
| 68 | 68 | 'ajax' => false // Does this table support ajax? |
| 69 | - ) ); |
|
| 69 | + )); |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return void |
| 83 | 83 | */ |
| 84 | - public function search_box( $text, $input_id ) { |
|
| 85 | - $input_id = $input_id . '-search-input'; |
|
| 84 | + public function search_box($text, $input_id) { |
|
| 85 | + $input_id = $input_id.'-search-input'; |
|
| 86 | 86 | |
| 87 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 88 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 87 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 88 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 89 | 89 | } |
| 90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 91 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 90 | + if ( ! empty($_REQUEST['order'])) { |
|
| 91 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 92 | 92 | } |
| 93 | 93 | ?> |
| 94 | 94 | <p class="search-box"> |
| 95 | 95 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 96 | 96 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
| 97 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
| 97 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
| 98 | 98 | </p> |
| 99 | 99 | <?php |
| 100 | 100 | } |
@@ -110,41 +110,41 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return string Column Name |
| 112 | 112 | */ |
| 113 | - public function column_default( $item, $column_name ) { |
|
| 114 | - switch ( $column_name ) { |
|
| 113 | + public function column_default($item, $column_name) { |
|
| 114 | + switch ($column_name) { |
|
| 115 | 115 | |
| 116 | 116 | case 'num_purchases' : |
| 117 | - $value = '<a href="' . |
|
| 118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 119 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
| 117 | + $value = '<a href="'. |
|
| 118 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
| 119 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
| 120 | 120 | break; |
| 121 | 121 | |
| 122 | 122 | case 'amount_spent' : |
| 123 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 123 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
| 124 | 124 | break; |
| 125 | 125 | |
| 126 | 126 | case 'date_created' : |
| 127 | - $value = date_i18n( get_option( 'date_format' ), strtotime( $item['date_created'] ) ); |
|
| 127 | + $value = date_i18n(get_option('date_format'), strtotime($item['date_created'])); |
|
| 128 | 128 | break; |
| 129 | 129 | |
| 130 | 130 | default: |
| 131 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
| 131 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] ); |
|
| 135 | + return apply_filters('give_report_column_'.$column_name, $value, $item['id']); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - public function column_name( $item ) { |
|
| 139 | - $name = '#' . $item['id'] . ' '; |
|
| 140 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>'; |
|
| 141 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
| 138 | + public function column_name($item) { |
|
| 139 | + $name = '#'.$item['id'].' '; |
|
| 140 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>'; |
|
| 141 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
| 142 | 142 | $actions = array( |
| 143 | - 'view' => sprintf( __( '<a href="%s">View Donor</a>', 'give' ), $view_url ), |
|
| 144 | - 'delete' => sprintf( __( '<a href="%s">Delete</a>', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ) ) |
|
| 143 | + 'view' => sprintf(__('<a href="%s">View Donor</a>', 'give'), $view_url), |
|
| 144 | + 'delete' => sprintf(__('<a href="%s">Delete</a>', 'give'), admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id'])) |
|
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
| 147 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function get_columns() { |
| 158 | 158 | $columns = array( |
| 159 | - 'name' => __( 'Name', 'give' ), |
|
| 160 | - 'email' => __( 'Email', 'give' ), |
|
| 161 | - 'num_purchases' => __( 'Donations', 'give' ), |
|
| 162 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
| 163 | - 'date_created' => __( 'Date Created', 'give' ) |
|
| 159 | + 'name' => __('Name', 'give'), |
|
| 160 | + 'email' => __('Email', 'give'), |
|
| 161 | + 'num_purchases' => __('Donations', 'give'), |
|
| 162 | + 'amount_spent' => __('Total Donated', 'give'), |
|
| 163 | + 'date_created' => __('Date Created', 'give') |
|
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
| 166 | + return apply_filters('give_report_customer_columns', $columns); |
|
| 167 | 167 | |
| 168 | 168 | } |
| 169 | 169 | |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function get_sortable_columns() { |
| 178 | 178 | return array( |
| 179 | - 'date_created' => array( 'date_created', true ), |
|
| 180 | - 'name' => array( 'name', true ), |
|
| 181 | - 'num_purchases' => array( 'purchase_count', false ), |
|
| 182 | - 'amount_spent' => array( 'purchase_value', false ), |
|
| 179 | + 'date_created' => array('date_created', true), |
|
| 180 | + 'name' => array('name', true), |
|
| 181 | + 'num_purchases' => array('purchase_count', false), |
|
| 182 | + 'amount_spent' => array('purchase_value', false), |
|
| 183 | 183 | ); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @since 1.0 |
| 191 | 191 | * @return void |
| 192 | 192 | */ |
| 193 | - public function bulk_actions( $which = '' ) { |
|
| 193 | + public function bulk_actions($which = '') { |
|
| 194 | 194 | // These aren't really bulk actions but this outputs the markup in the right place |
| 195 | 195 | } |
| 196 | 196 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @return int Current page number |
| 203 | 203 | */ |
| 204 | 204 | public function get_paged() { |
| 205 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 205 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @return mixed string If search is present, false otherwise |
| 214 | 214 | */ |
| 215 | 215 | public function get_search() { |
| 216 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 216 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $data = array(); |
| 232 | 232 | $paged = $this->get_paged(); |
| 233 | - $offset = $this->per_page * ( $paged - 1 ); |
|
| 233 | + $offset = $this->per_page * ($paged - 1); |
|
| 234 | 234 | $search = $this->get_search(); |
| 235 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
| 236 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
| 235 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
| 236 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
| 237 | 237 | |
| 238 | 238 | $args = array( |
| 239 | 239 | 'number' => $this->per_page, |
@@ -242,21 +242,21 @@ discard block |
||
| 242 | 242 | 'orderby' => $orderby |
| 243 | 243 | ); |
| 244 | 244 | |
| 245 | - if ( is_email( $search ) ) { |
|
| 245 | + if (is_email($search)) { |
|
| 246 | 246 | $args['email'] = $search; |
| 247 | - } elseif ( is_numeric( $search ) ) { |
|
| 247 | + } elseif (is_numeric($search)) { |
|
| 248 | 248 | $args['id'] = $search; |
| 249 | 249 | } else { |
| 250 | 250 | $args['name'] = $search; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - $customers = Give()->customers->get_customers( $args ); |
|
| 253 | + $customers = Give()->customers->get_customers($args); |
|
| 254 | 254 | |
| 255 | - if ( $customers ) { |
|
| 255 | + if ($customers) { |
|
| 256 | 256 | |
| 257 | - foreach ( $customers as $customer ) { |
|
| 257 | + foreach ($customers as $customer) { |
|
| 258 | 258 | |
| 259 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
| 259 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
| 260 | 260 | |
| 261 | 261 | $data[] = array( |
| 262 | 262 | 'id' => $customer->id, |
@@ -290,16 +290,16 @@ discard block |
||
| 290 | 290 | $hidden = array(); // No hidden columns |
| 291 | 291 | $sortable = $this->get_sortable_columns(); |
| 292 | 292 | |
| 293 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 293 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 294 | 294 | |
| 295 | 295 | $this->items = $this->reports_data(); |
| 296 | 296 | |
| 297 | 297 | $this->total = give_count_total_customers(); |
| 298 | 298 | |
| 299 | - $this->set_pagination_args( array( |
|
| 299 | + $this->set_pagination_args(array( |
|
| 300 | 300 | 'total_items' => $this->total, |
| 301 | 301 | 'per_page' => $this->per_page, |
| 302 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
| 303 | - ) ); |
|
| 302 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
| 303 | + )); |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | \ No newline at end of file |
@@ -115,8 +115,8 @@ |
||
| 115 | 115 | |
| 116 | 116 | case 'num_purchases' : |
| 117 | 117 | $value = '<a href="' . |
| 118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 119 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
| 118 | + admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 119 | + ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
| 120 | 120 | break; |
| 121 | 121 | |
| 122 | 122 | case 'amount_spent' : |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | * |
| 144 | 144 | * @access public |
| 145 | 145 | * @since 1.0 |
| 146 | - * @return mixed string If search is present, false otherwise |
|
| 146 | + * @return string|false string If search is present, false otherwise |
|
| 147 | 147 | */ |
| 148 | 148 | public function get_search() { |
| 149 | 149 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array $output Response messages |
| 25 | 25 | */ |
| 26 | -function give_edit_customer( $args ) { |
|
| 27 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
| 26 | +function give_edit_customer($args) { |
|
| 27 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
| 28 | 28 | |
| 29 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
| 30 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
| 29 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
| 30 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if ( empty( $args ) ) { |
|
| 33 | + if (empty($args)) { |
|
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | $customer_id = (int) $args['customerinfo']['id']; |
| 39 | 39 | $nonce = $args['_wpnonce']; |
| 40 | 40 | |
| 41 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
| 42 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
| 41 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
| 42 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $customer = new Give_Customer( $customer_id ); |
|
| 46 | - if ( empty( $customer->id ) ) { |
|
| 45 | + $customer = new Give_Customer($customer_id); |
|
| 46 | + if (empty($customer->id)) { |
|
| 47 | 47 | return false; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | 'user_id' => 0 |
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | - $customer_info = wp_parse_args( $customer_info, $defaults ); |
|
| 56 | + $customer_info = wp_parse_args($customer_info, $defaults); |
|
| 57 | 57 | |
| 58 | - if ( ! is_email( $customer_info['email'] ) ) { |
|
| 59 | - give_set_error( 'give-invalid-email', __( 'Please enter a valid email address.', 'give' ) ); |
|
| 58 | + if ( ! is_email($customer_info['email'])) { |
|
| 59 | + give_set_error('give-invalid-email', __('Please enter a valid email address.', 'give')); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) { |
|
| 62 | + if ((int) $customer_info['user_id'] != (int) $customer->user_id) { |
|
| 63 | 63 | |
| 64 | 64 | // Make sure we don't already have this user attached to a customer |
| 65 | - if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) { |
|
| 66 | - give_set_error( 'give-invalid-customer-user_id', sprintf( __( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) ); |
|
| 65 | + if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) { |
|
| 66 | + give_set_error('give-invalid-customer-user_id', sprintf(__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id'])); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Make sure it's actually a user |
| 70 | - $user = get_user_by( 'id', $customer_info['user_id'] ); |
|
| 71 | - if ( ! empty( $customer_info['user_id'] ) && false === $user ) { |
|
| 72 | - give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) ); |
|
| 70 | + $user = get_user_by('id', $customer_info['user_id']); |
|
| 71 | + if ( ! empty($customer_info['user_id']) && false === $user) { |
|
| 72 | + give_set_error('give-invalid-user_id', sprintf(__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id'])); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | } |
@@ -77,82 +77,82 @@ discard block |
||
| 77 | 77 | // Record this for later |
| 78 | 78 | $previous_user_id = $customer->user_id; |
| 79 | 79 | |
| 80 | - if ( give_get_errors() ) { |
|
| 80 | + if (give_get_errors()) { |
|
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Setup the customer address, if present |
| 85 | 85 | $address = array(); |
| 86 | - if ( intval( $customer_info['user_id'] ) > 0 ) { |
|
| 86 | + if (intval($customer_info['user_id']) > 0) { |
|
| 87 | 87 | |
| 88 | - $current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true ); |
|
| 88 | + $current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true); |
|
| 89 | 89 | |
| 90 | - if ( false === $current_address ) { |
|
| 91 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : ''; |
|
| 92 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : ''; |
|
| 93 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : ''; |
|
| 94 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : ''; |
|
| 95 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : ''; |
|
| 96 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : ''; |
|
| 90 | + if (false === $current_address) { |
|
| 91 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : ''; |
|
| 92 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : ''; |
|
| 93 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : ''; |
|
| 94 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : ''; |
|
| 95 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : ''; |
|
| 96 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : ''; |
|
| 97 | 97 | } else { |
| 98 | - $current_address = wp_parse_args( $current_address, array( |
|
| 98 | + $current_address = wp_parse_args($current_address, array( |
|
| 99 | 99 | 'line1', |
| 100 | 100 | 'line2', |
| 101 | 101 | 'city', |
| 102 | 102 | 'zip', |
| 103 | 103 | 'state', |
| 104 | 104 | 'country' |
| 105 | - ) ); |
|
| 106 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1']; |
|
| 107 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2']; |
|
| 108 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city']; |
|
| 109 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country']; |
|
| 110 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip']; |
|
| 111 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state']; |
|
| 105 | + )); |
|
| 106 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1']; |
|
| 107 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2']; |
|
| 108 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city']; |
|
| 109 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country']; |
|
| 110 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip']; |
|
| 111 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state']; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Sanitize the inputs |
| 117 | 117 | $customer_data = array(); |
| 118 | - $customer_data['name'] = strip_tags( stripslashes( $customer_info['name'] ) ); |
|
| 118 | + $customer_data['name'] = strip_tags(stripslashes($customer_info['name'])); |
|
| 119 | 119 | $customer_data['email'] = $customer_info['email']; |
| 120 | 120 | $customer_data['user_id'] = $customer_info['user_id']; |
| 121 | 121 | |
| 122 | - $customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id ); |
|
| 123 | - $address = apply_filters( 'give_edit_customer_address', $address, $customer_id ); |
|
| 122 | + $customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id); |
|
| 123 | + $address = apply_filters('give_edit_customer_address', $address, $customer_id); |
|
| 124 | 124 | |
| 125 | - $customer_data = array_map( 'sanitize_text_field', $customer_data ); |
|
| 126 | - $address = array_map( 'sanitize_text_field', $address ); |
|
| 125 | + $customer_data = array_map('sanitize_text_field', $customer_data); |
|
| 126 | + $address = array_map('sanitize_text_field', $address); |
|
| 127 | 127 | |
| 128 | - do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address ); |
|
| 128 | + do_action('give_pre_edit_customer', $customer_id, $customer_data, $address); |
|
| 129 | 129 | |
| 130 | 130 | $output = array(); |
| 131 | 131 | $previous_email = $customer->email; |
| 132 | 132 | |
| 133 | - if ( $customer->update( $customer_data ) ) { |
|
| 133 | + if ($customer->update($customer_data)) { |
|
| 134 | 134 | |
| 135 | - if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) { |
|
| 136 | - update_user_meta( $customer->user_id, '_give_user_address', $address ); |
|
| 135 | + if ( ! empty($customer->user_id) && $customer->user_id > 0) { |
|
| 136 | + update_user_meta($customer->user_id, '_give_user_address', $address); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Update some payment meta if we need to |
| 140 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
| 140 | + $payments_array = explode(',', $customer->payment_ids); |
|
| 141 | 141 | |
| 142 | - if ( $customer->email != $previous_email ) { |
|
| 143 | - foreach ( $payments_array as $payment_id ) { |
|
| 144 | - give_update_payment_meta( $payment_id, 'email', $customer->email ); |
|
| 142 | + if ($customer->email != $previous_email) { |
|
| 143 | + foreach ($payments_array as $payment_id) { |
|
| 144 | + give_update_payment_meta($payment_id, 'email', $customer->email); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( $customer->user_id != $previous_user_id ) { |
|
| 149 | - foreach ( $payments_array as $payment_id ) { |
|
| 150 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id ); |
|
| 148 | + if ($customer->user_id != $previous_user_id) { |
|
| 149 | + foreach ($payments_array as $payment_id) { |
|
| 150 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id); |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $output['success'] = true; |
| 155 | - $customer_data = array_merge( $customer_data, $address ); |
|
| 155 | + $customer_data = array_merge($customer_data, $address); |
|
| 156 | 156 | $output['customer_info'] = $customer_data; |
| 157 | 157 | |
| 158 | 158 | } else { |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - do_action( 'give_post_edit_customer', $customer_id, $customer_data ); |
|
| 164 | + do_action('give_post_edit_customer', $customer_id, $customer_data); |
|
| 165 | 165 | |
| 166 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
| 167 | - header( 'Content-Type: application/json' ); |
|
| 168 | - echo json_encode( $output ); |
|
| 166 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
| 167 | + header('Content-Type: application/json'); |
|
| 168 | + echo json_encode($output); |
|
| 169 | 169 | wp_die(); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | -add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 ); |
|
| 176 | +add_action('give_edit-customer', 'give_edit_customer', 10, 1); |
|
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * Save a customer note being added |
@@ -184,53 +184,53 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @return int The Note ID that was saved, or 0 if nothing was saved |
| 186 | 186 | */ |
| 187 | -function give_customer_save_note( $args ) { |
|
| 187 | +function give_customer_save_note($args) { |
|
| 188 | 188 | |
| 189 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
| 189 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
| 190 | 190 | |
| 191 | - if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) { |
|
| 192 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
| 191 | + if ( ! is_admin() || ! current_user_can($customer_view_role)) { |
|
| 192 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ( empty( $args ) ) { |
|
| 195 | + if (empty($args)) { |
|
| 196 | 196 | return; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $customer_note = trim( sanitize_text_field( $args['customer_note'] ) ); |
|
| 199 | + $customer_note = trim(sanitize_text_field($args['customer_note'])); |
|
| 200 | 200 | $customer_id = (int) $args['customer_id']; |
| 201 | 201 | $nonce = $args['add_customer_note_nonce']; |
| 202 | 202 | |
| 203 | - if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) { |
|
| 204 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
| 203 | + if ( ! wp_verify_nonce($nonce, 'add-customer-note')) { |
|
| 204 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if ( empty( $customer_note ) ) { |
|
| 208 | - give_set_error( 'empty-customer-note', __( 'A note is required', 'give' ) ); |
|
| 207 | + if (empty($customer_note)) { |
|
| 208 | + give_set_error('empty-customer-note', __('A note is required', 'give')); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if ( give_get_errors() ) { |
|
| 211 | + if (give_get_errors()) { |
|
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $customer = new Give_Customer( $customer_id ); |
|
| 216 | - $new_note = $customer->add_note( $customer_note ); |
|
| 215 | + $customer = new Give_Customer($customer_id); |
|
| 216 | + $new_note = $customer->add_note($customer_note); |
|
| 217 | 217 | |
| 218 | - do_action( 'give_pre_insert_customer_note', $customer_id, $new_note ); |
|
| 218 | + do_action('give_pre_insert_customer_note', $customer_id, $new_note); |
|
| 219 | 219 | |
| 220 | - if ( ! empty( $new_note ) && ! empty( $customer->id ) ) { |
|
| 220 | + if ( ! empty($new_note) && ! empty($customer->id)) { |
|
| 221 | 221 | |
| 222 | 222 | ob_start(); |
| 223 | 223 | ?> |
| 224 | 224 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
| 225 | 225 | <span class="note-content-wrap"> |
| 226 | - <?php echo stripslashes( $new_note ); ?> |
|
| 226 | + <?php echo stripslashes($new_note); ?> |
|
| 227 | 227 | </span> |
| 228 | 228 | </div> |
| 229 | 229 | <?php |
| 230 | 230 | $output = ob_get_contents(); |
| 231 | 231 | ob_end_clean(); |
| 232 | 232 | |
| 233 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
| 233 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
| 234 | 234 | echo $output; |
| 235 | 235 | exit; |
| 236 | 236 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | -add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 ); |
|
| 246 | +add_action('give_add-customer-note', 'give_customer_save_note', 10, 1); |
|
| 247 | 247 | |
| 248 | 248 | /** |
| 249 | 249 | * Delete a customer |
@@ -254,87 +254,87 @@ discard block |
||
| 254 | 254 | * |
| 255 | 255 | * @return int Whether it was a successful deletion |
| 256 | 256 | */ |
| 257 | -function give_customer_delete( $args ) { |
|
| 257 | +function give_customer_delete($args) { |
|
| 258 | 258 | |
| 259 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
| 259 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
| 260 | 260 | |
| 261 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
| 262 | - wp_die( __( 'You do not have permission to delete this donor.', 'give' ) ); |
|
| 261 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
| 262 | + wp_die(__('You do not have permission to delete this donor.', 'give')); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if ( empty( $args ) ) { |
|
| 265 | + if (empty($args)) { |
|
| 266 | 266 | return; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $customer_id = (int) $args['customer_id']; |
| 270 | - $confirm = ! empty( $args['give-customer-delete-confirm'] ) ? true : false; |
|
| 271 | - $remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false; |
|
| 270 | + $confirm = ! empty($args['give-customer-delete-confirm']) ? true : false; |
|
| 271 | + $remove_data = ! empty($args['give-customer-delete-records']) ? true : false; |
|
| 272 | 272 | $nonce = $args['_wpnonce']; |
| 273 | 273 | |
| 274 | - if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) { |
|
| 275 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
| 274 | + if ( ! wp_verify_nonce($nonce, 'delete-customer')) { |
|
| 275 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if ( ! $confirm ) { |
|
| 279 | - give_set_error( 'customer-delete-no-confirm', __( 'Please confirm you want to delete this donor', 'give' ) ); |
|
| 278 | + if ( ! $confirm) { |
|
| 279 | + give_set_error('customer-delete-no-confirm', __('Please confirm you want to delete this donor', 'give')); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if ( give_get_errors() ) { |
|
| 283 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) ); |
|
| 282 | + if (give_get_errors()) { |
|
| 283 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id)); |
|
| 284 | 284 | exit; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - $customer = new Give_Customer( $customer_id ); |
|
| 287 | + $customer = new Give_Customer($customer_id); |
|
| 288 | 288 | |
| 289 | - do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data ); |
|
| 289 | + do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data); |
|
| 290 | 290 | |
| 291 | 291 | $success = false; |
| 292 | 292 | |
| 293 | - if ( $customer->id > 0 ) { |
|
| 293 | + if ($customer->id > 0) { |
|
| 294 | 294 | |
| 295 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
| 296 | - $success = Give()->customers->delete( $customer->id ); |
|
| 295 | + $payments_array = explode(',', $customer->payment_ids); |
|
| 296 | + $success = Give()->customers->delete($customer->id); |
|
| 297 | 297 | |
| 298 | - if ( $success ) { |
|
| 298 | + if ($success) { |
|
| 299 | 299 | |
| 300 | - if ( $remove_data ) { |
|
| 300 | + if ($remove_data) { |
|
| 301 | 301 | |
| 302 | 302 | // Remove all payments, logs, etc |
| 303 | - foreach ( $payments_array as $payment_id ) { |
|
| 304 | - give_delete_purchase( $payment_id ); |
|
| 303 | + foreach ($payments_array as $payment_id) { |
|
| 304 | + give_delete_purchase($payment_id); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | } else { |
| 308 | 308 | |
| 309 | 309 | // Just set the payments to customer_id of 0 |
| 310 | - foreach ( $payments_array as $payment_id ) { |
|
| 311 | - give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 ); |
|
| 310 | + foreach ($payments_array as $payment_id) { |
|
| 311 | + give_update_payment_meta($payment_id, '_give_payment_customer_id', 0); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' ); |
|
| 316 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted'); |
|
| 317 | 317 | |
| 318 | 318 | } else { |
| 319 | 319 | |
| 320 | - give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor', 'give' ) ); |
|
| 321 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id ); |
|
| 320 | + give_set_error('give-donor-delete-failed', __('Error deleting donor', 'give')); |
|
| 321 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id); |
|
| 322 | 322 | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | } else { |
| 326 | 326 | |
| 327 | - give_set_error( 'give-customer-delete-invalid-id', __( 'Invalid Donor ID', 'give' ) ); |
|
| 328 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); |
|
| 327 | + give_set_error('give-customer-delete-invalid-id', __('Invalid Donor ID', 'give')); |
|
| 328 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors'); |
|
| 329 | 329 | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - wp_redirect( $redirect ); |
|
| 332 | + wp_redirect($redirect); |
|
| 333 | 333 | exit; |
| 334 | 334 | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | -add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 ); |
|
| 337 | +add_action('give_delete-customer', 'give_customer_delete', 10, 1); |
|
| 338 | 338 | |
| 339 | 339 | /** |
| 340 | 340 | * Disconnect a user ID from a donor |
@@ -345,39 +345,39 @@ discard block |
||
| 345 | 345 | * |
| 346 | 346 | * @return bool If the disconnect was sucessful |
| 347 | 347 | */ |
| 348 | -function give_disconnect_customer_user_id( $args ) { |
|
| 348 | +function give_disconnect_customer_user_id($args) { |
|
| 349 | 349 | |
| 350 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
| 350 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
| 351 | 351 | |
| 352 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
| 353 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
| 352 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
| 353 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if ( empty( $args ) ) { |
|
| 356 | + if (empty($args)) { |
|
| 357 | 357 | return; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $customer_id = (int) $args['customer_id']; |
| 361 | 361 | $nonce = $args['_wpnonce']; |
| 362 | 362 | |
| 363 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
| 364 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
| 363 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
| 364 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $customer = new Give_Customer( $customer_id ); |
|
| 368 | - if ( empty( $customer->id ) ) { |
|
| 367 | + $customer = new Give_Customer($customer_id); |
|
| 368 | + if (empty($customer->id)) { |
|
| 369 | 369 | return false; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id ); |
|
| 372 | + do_action('give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id); |
|
| 373 | 373 | |
| 374 | - $customer_args = array( 'user_id' => 0 ); |
|
| 374 | + $customer_args = array('user_id' => 0); |
|
| 375 | 375 | |
| 376 | - if ( $customer->update( $customer_args ) ) { |
|
| 376 | + if ($customer->update($customer_args)) { |
|
| 377 | 377 | global $wpdb; |
| 378 | 378 | |
| 379 | - if ( ! empty( $customer->payment_ids ) ) { |
|
| 380 | - $wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" ); |
|
| 379 | + if ( ! empty($customer->payment_ids)) { |
|
| 380 | + $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )"); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | $output['success'] = true; |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | } else { |
| 386 | 386 | |
| 387 | 387 | $output['success'] = false; |
| 388 | - give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor', 'give' ) ); |
|
| 388 | + give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor', 'give')); |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - do_action( 'give_post_customer_disconnect_user_id', $customer_id ); |
|
| 391 | + do_action('give_post_customer_disconnect_user_id', $customer_id); |
|
| 392 | 392 | |
| 393 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
| 394 | - header( 'Content-Type: application/json' ); |
|
| 395 | - echo json_encode( $output ); |
|
| 393 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
| 394 | + header('Content-Type: application/json'); |
|
| 395 | + echo json_encode($output); |
|
| 396 | 396 | wp_die(); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -400,4 +400,4 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | -add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 ); |
|
| 403 | +add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1); |
|
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Customer (Donors) |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Admin/Customers |
|
| 7 | - * @copyright Copyright (c) 2016, WordImpress |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - * @since 1.0 |
|
| 10 | - */ |
|
| 3 | + * Customer (Donors) |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Admin/Customers |
|
| 7 | + * @copyright Copyright (c) 2016, WordImpress |
|
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | + * @since 1.0 |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array The altered list of views |
| 25 | 25 | */ |
| 26 | -function give_register_default_customer_views( $views ) { |
|
| 26 | +function give_register_default_customer_views($views) { |
|
| 27 | 27 | |
| 28 | 28 | $default_views = array( |
| 29 | 29 | 'overview' => 'give_customers_view', |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | 'notes' => 'give_customer_notes_view' |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - return array_merge( $views, $default_views ); |
|
| 34 | + return array_merge($views, $default_views); |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 ); |
|
| 38 | +add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Register a tab for the single customer view |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return array The altered list of tabs |
| 48 | 48 | */ |
| 49 | -function give_register_default_customer_tabs( $tabs ) { |
|
| 49 | +function give_register_default_customer_tabs($tabs) { |
|
| 50 | 50 | |
| 51 | 51 | $default_tabs = array( |
| 52 | - 'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => __( 'Donor Profile', 'give' ) ), |
|
| 53 | - 'notes' => array( 'dashicon' => 'dashicons-admin-comments', 'title' => __( 'Donor Notes', 'give' ) ) |
|
| 52 | + 'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => __('Donor Profile', 'give')), |
|
| 53 | + 'notes' => array('dashicon' => 'dashicons-admin-comments', 'title' => __('Donor Notes', 'give')) |
|
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | - return array_merge( $tabs, $default_tabs ); |
|
| 56 | + return array_merge($tabs, $default_tabs); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | -add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 ); |
|
| 59 | +add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1); |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Register the Delete icon as late as possible so it's at the bottom |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return array The altered list of tabs, with 'delete' at the bottom |
| 69 | 69 | */ |
| 70 | -function give_register_delete_customer_tab( $tabs ) { |
|
| 70 | +function give_register_delete_customer_tab($tabs) { |
|
| 71 | 71 | |
| 72 | - $tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => __( 'Delete Donor', 'give' ) ); |
|
| 72 | + $tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => __('Delete Donor', 'give')); |
|
| 73 | 73 | |
| 74 | 74 | return $tabs; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | -add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 ); |
|
| 77 | +add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1); |
|
@@ -259,8 +259,11 @@ discard block |
||
| 259 | 259 | <span class="customer-user-id info-item editable"> |
| 260 | 260 | <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
| 261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
| 262 | - <?php else : ?> |
|
| 263 | - <span data-key="user_id"><?php _e( 'none', 'give' ); ?></span> |
|
| 262 | + <?php else { |
|
| 263 | + : ?> |
|
| 264 | + <span data-key="user_id"><?php _e( 'none', 'give' ); |
|
| 265 | +} |
|
| 266 | +?></span> |
|
| 264 | 267 | <?php endif; ?> |
| 265 | 268 | <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
| 266 | 269 | <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span> |
@@ -329,8 +332,11 @@ discard block |
||
| 329 | 332 | } |
| 330 | 333 | ?> |
| 331 | 334 | </select> |
| 332 | - <?php else : ?> |
|
| 333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" /> |
|
| 335 | + <?php else { |
|
| 336 | + : ?> |
|
| 337 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); |
|
| 338 | +} |
|
| 339 | +?>" /> |
|
| 334 | 340 | <?php endif; ?> |
| 335 | 341 | <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
| 336 | 342 | </span> |
@@ -416,9 +422,12 @@ discard block |
||
| 416 | 422 | </td> |
| 417 | 423 | </tr> |
| 418 | 424 | <?php endforeach; ?> |
| 419 | - <?php else: ?> |
|
| 425 | + <?php else { |
|
| 426 | + : ?> |
|
| 420 | 427 | <tr> |
| 421 | - <td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td> |
|
| 428 | + <td colspan="5"><?php _e( 'No Donations Found', 'give' ); |
|
| 429 | +} |
|
| 430 | +?></td> |
|
| 422 | 431 | </tr> |
| 423 | 432 | <?php endif; ?> |
| 424 | 433 | </tbody> |
@@ -447,9 +456,12 @@ discard block |
||
| 447 | 456 | </td> |
| 448 | 457 | </tr> |
| 449 | 458 | <?php endforeach; ?> |
| 450 | - <?php else: ?> |
|
| 459 | + <?php else { |
|
| 460 | + : ?> |
|
| 451 | 461 | <tr> |
| 452 | - <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td> |
|
| 462 | + <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); |
|
| 463 | +} |
|
| 464 | +?></td> |
|
| 453 | 465 | </tr> |
| 454 | 466 | <?php endif; ?> |
| 455 | 467 | </tbody> |
@@ -523,9 +535,12 @@ discard block |
||
| 523 | 535 | </span> |
| 524 | 536 | </div> |
| 525 | 537 | <?php endforeach; ?> |
| 526 | - <?php else: ?> |
|
| 538 | + <?php else { |
|
| 539 | + : ?> |
|
| 527 | 540 | <div class="give-no-customer-notes"> |
| 528 | - <?php _e( 'No Donor Notes', 'give' ); ?> |
|
| 541 | + <?php _e( 'No Donor Notes', 'give' ); |
|
| 542 | +} |
|
| 543 | +?> |
|
| 529 | 544 | </div> |
| 530 | 545 | <?php endif; ?> |
| 531 | 546 | </div> |
@@ -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 | |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function give_customers_page() { |
| 26 | 26 | $default_views = give_customer_views(); |
| 27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers'; |
|
| 28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
| 29 | - give_render_customer_view( $requested_view, $default_views ); |
|
| 27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers'; |
|
| 28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
| 29 | + give_render_customer_view($requested_view, $default_views); |
|
| 30 | 30 | } else { |
| 31 | 31 | give_customers_list(); |
| 32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $views = array(); |
| 44 | 44 | |
| 45 | - return apply_filters( 'give_customer_views', $views ); |
|
| 45 | + return apply_filters('give_customer_views', $views); |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $tabs = array(); |
| 58 | 58 | |
| 59 | - return apply_filters( 'give_customer_tabs', $tabs ); |
|
| 59 | + return apply_filters('give_customer_tabs', $tabs); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -67,24 +67,24 @@ discard block |
||
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | 69 | function give_customers_list() { |
| 70 | - include( dirname( __FILE__ ) . '/class-customer-table.php' ); |
|
| 70 | + include(dirname(__FILE__).'/class-customer-table.php'); |
|
| 71 | 71 | |
| 72 | 72 | $customers_table = new Give_Customer_Reports_Table(); |
| 73 | 73 | $customers_table->prepare_items(); |
| 74 | 74 | ?> |
| 75 | 75 | <div class="wrap"> |
| 76 | - <h2><?php _e( 'Donors', 'give' ); ?></h2> |
|
| 77 | - <?php do_action( 'give_donors_table_top' ); ?> |
|
| 78 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
| 76 | + <h2><?php _e('Donors', 'give'); ?></h2> |
|
| 77 | + <?php do_action('give_donors_table_top'); ?> |
|
| 78 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
| 79 | 79 | <?php |
| 80 | - $customers_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); |
|
| 80 | + $customers_table->search_box(__('Search Donors', 'give'), 'give-donors'); |
|
| 81 | 81 | $customers_table->display(); |
| 82 | 82 | ?> |
| 83 | 83 | <input type="hidden" name="post_type" value="give_forms" /> |
| 84 | 84 | <input type="hidden" name="page" value="give-donors" /> |
| 85 | 85 | <input type="hidden" name="view" value="customers" /> |
| 86 | 86 | </form> |
| 87 | - <?php do_action( 'give_donors_table_bottom' ); ?> |
|
| 87 | + <?php do_action('give_donors_table_bottom'); ?> |
|
| 88 | 88 | </div> |
| 89 | 89 | <?php |
| 90 | 90 | } |
@@ -99,27 +99,27 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return void |
| 101 | 101 | */ |
| 102 | -function give_render_customer_view( $view, $callbacks ) { |
|
| 102 | +function give_render_customer_view($view, $callbacks) { |
|
| 103 | 103 | |
| 104 | 104 | $render = true; |
| 105 | 105 | |
| 106 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
| 106 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
| 107 | 107 | |
| 108 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
| 109 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
| 108 | + if ( ! current_user_can($customer_view_role)) { |
|
| 109 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
| 110 | 110 | $render = false; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 114 | - give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) ); |
|
| 113 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 114 | + give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give')); |
|
| 115 | 115 | $render = false; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $customer_id = (int) $_GET['id']; |
| 119 | - $customer = new Give_Customer( $customer_id ); |
|
| 119 | + $customer = new Give_Customer($customer_id); |
|
| 120 | 120 | |
| 121 | - if ( empty( $customer->id ) ) { |
|
| 122 | - give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) ); |
|
| 121 | + if (empty($customer->id)) { |
|
| 122 | + give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give')); |
|
| 123 | 123 | $render = false; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -128,27 +128,27 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | <div class='wrap'> |
| 130 | 130 | |
| 131 | - <?php if ( give_get_errors() ) : ?> |
|
| 131 | + <?php if (give_get_errors()) : ?> |
|
| 132 | 132 | <div class="error settings-error"> |
| 133 | - <?php give_print_errors( 0 ); ?> |
|
| 133 | + <?php give_print_errors(0); ?> |
|
| 134 | 134 | </div> |
| 135 | 135 | <?php endif; ?> |
| 136 | 136 | |
| 137 | - <?php if ( $customer && $render ) : ?> |
|
| 137 | + <?php if ($customer && $render) : ?> |
|
| 138 | 138 | |
| 139 | 139 | <div id="customer-tab-wrapper"> |
| 140 | 140 | <ul id="customer-tab-wrapper-list" class="nav-tab-wrapper"> |
| 141 | - <?php foreach ( $customer_tabs as $key => $tab ) : ?> |
|
| 141 | + <?php foreach ($customer_tabs as $key => $tab) : ?> |
|
| 142 | 142 | <?php $active = $key === $view ? true : false; ?> |
| 143 | 143 | <?php $class = $active ? 'active' : 'inactive'; ?> |
| 144 | 144 | |
| 145 | - <li class="<?php echo sanitize_html_class( $class ); ?>"> |
|
| 146 | - <?php if ( ! $active ) : ?> |
|
| 147 | - <a title="<?php echo esc_attr( $tab['title'] ); ?>" aria-label="<?php echo esc_attr( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>"> |
|
| 145 | + <li class="<?php echo sanitize_html_class($class); ?>"> |
|
| 146 | + <?php if ( ! $active) : ?> |
|
| 147 | + <a title="<?php echo esc_attr($tab['title']); ?>" aria-label="<?php echo esc_attr($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>"> |
|
| 148 | 148 | <?php endif; ?> |
| 149 | 149 | |
| 150 | - <span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php echo esc_attr( $tab['title'] ); ?> |
|
| 151 | - <?php if ( ! $active ) : ?> |
|
| 150 | + <span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php echo esc_attr($tab['title']); ?> |
|
| 151 | + <?php if ( ! $active) : ?> |
|
| 152 | 152 | </a> |
| 153 | 153 | <?php endif; ?> |
| 154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | </div> |
| 161 | 161 | |
| 162 | 162 | <div id="give-customer-card-wrapper"> |
| 163 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
| 163 | + <?php $callbacks[$view]($customer) ?> |
|
| 164 | 164 | </div> |
| 165 | 165 | |
| 166 | 166 | <?php endif; ?> |
@@ -180,17 +180,17 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return void |
| 182 | 182 | */ |
| 183 | -function give_customers_view( $customer ) { |
|
| 183 | +function give_customers_view($customer) { |
|
| 184 | 184 | |
| 185 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
| 185 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
| 186 | 186 | |
| 187 | 187 | ?> |
| 188 | 188 | |
| 189 | - <?php do_action( 'give_donor_card_top', $customer ); ?> |
|
| 189 | + <?php do_action('give_donor_card_top', $customer); ?> |
|
| 190 | 190 | |
| 191 | 191 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
| 192 | 192 | |
| 193 | - <form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>"> |
|
| 193 | + <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>"> |
|
| 194 | 194 | |
| 195 | 195 | <div class="customer-info"> |
| 196 | 196 | |
@@ -198,22 +198,22 @@ discard block |
||
| 198 | 198 | <div class="donor-bio-header clearfix"> |
| 199 | 199 | |
| 200 | 200 | <div class="avatar-wrap left" id="customer-avatar"> |
| 201 | - <?php echo get_avatar( $customer->email ); ?> |
|
| 201 | + <?php echo get_avatar($customer->email); ?> |
|
| 202 | 202 | </div> |
| 203 | 203 | |
| 204 | 204 | <div class="customer-id" class="left"> |
| 205 | 205 | #<?php echo $customer->id; ?> |
| 206 | 206 | </div> |
| 207 | 207 | <div id="customer-name-wrap" class="left"> |
| 208 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span> |
|
| 208 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span> |
|
| 209 | 209 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
| 210 | 210 | </div> |
| 211 | 211 | <p class="customer-since info-item"> |
| 212 | - <?php _e( 'Donor since', 'give' ); ?> |
|
| 213 | - <?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?> |
|
| 212 | + <?php _e('Donor since', 'give'); ?> |
|
| 213 | + <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?> |
|
| 214 | 214 | </p> |
| 215 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
| 216 | - <a title="<?php _e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
| 215 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
| 216 | + <a title="<?php _e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
| 217 | 217 | <?php endif; ?> |
| 218 | 218 | </div> |
| 219 | 219 | <!-- /donor-bio-header --> |
@@ -223,14 +223,14 @@ discard block |
||
| 223 | 223 | <table class="widefat"> |
| 224 | 224 | <tbody> |
| 225 | 225 | <tr> |
| 226 | - <td><label for="tablecell"><?php esc_attr_e( 'Email', 'give' ); ?></label>:</td> |
|
| 226 | + <td><label for="tablecell"><?php esc_attr_e('Email', 'give'); ?></label>:</td> |
|
| 227 | 227 | <td class="row-title"> |
| 228 | - <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e( 'Donor Email', 'give' ); ?>" /></span> |
|
| 228 | + <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e('Donor Email', 'give'); ?>" /></span> |
|
| 229 | 229 | <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span> |
| 230 | 230 | </td> |
| 231 | 231 | </tr> |
| 232 | 232 | <tr class="alternate"> |
| 233 | - <td><label for="tablecell"><?php esc_attr_e( 'User ID', 'give' ); ?></label>:</td> |
|
| 233 | + <td><label for="tablecell"><?php esc_attr_e('User ID', 'give'); ?></label>:</td> |
|
| 234 | 234 | <td class="row-title"> |
| 235 | 235 | <span class="customer-user-id info-item edit-item"> |
| 236 | 236 | <?php |
@@ -246,38 +246,38 @@ discard block |
||
| 246 | 246 | 'data' => $data_atts, |
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | - if ( ! empty( $user_id ) ) { |
|
| 250 | - $userdata = get_userdata( $user_id ); |
|
| 249 | + if ( ! empty($user_id)) { |
|
| 250 | + $userdata = get_userdata($user_id); |
|
| 251 | 251 | $user_args['value'] = $userdata->user_login; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - echo Give()->html->ajax_user_search( $user_args ); |
|
| 254 | + echo Give()->html->ajax_user_search($user_args); |
|
| 255 | 255 | ?> |
| 256 | 256 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
| 257 | 257 | </span> |
| 258 | 258 | |
| 259 | 259 | <span class="customer-user-id info-item editable"> |
| 260 | - <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
|
| 260 | + <?php if (intval($customer->user_id) > 0) : ?> |
|
| 261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
| 262 | 262 | <?php else : ?> |
| 263 | - <span data-key="user_id"><?php _e( 'none', 'give' ); ?></span> |
|
| 263 | + <span data-key="user_id"><?php _e('none', 'give'); ?></span> |
|
| 264 | 264 | <?php endif; ?> |
| 265 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
|
| 266 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span> |
|
| 265 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?> |
|
| 266 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php _e('Disconnect User', 'give'); ?></a></span> |
|
| 267 | 267 | <?php endif; ?> |
| 268 | 268 | </span> |
| 269 | 269 | </td> |
| 270 | 270 | </tr> |
| 271 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
| 271 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
| 272 | 272 | |
| 273 | 273 | <tr> |
| 274 | - <td><?php esc_attr_e( 'Address', 'give' ); ?>:</td> |
|
| 274 | + <td><?php esc_attr_e('Address', 'give'); ?>:</td> |
|
| 275 | 275 | <td class="row-title"> |
| 276 | 276 | |
| 277 | 277 | <div class="customer-address-wrapper"> |
| 278 | 278 | |
| 279 | 279 | <?php |
| 280 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
| 280 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
| 281 | 281 | $defaults = array( |
| 282 | 282 | 'line1' => '', |
| 283 | 283 | 'line2' => '', |
@@ -287,10 +287,10 @@ discard block |
||
| 287 | 287 | 'zip' => '' |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | - $address = wp_parse_args( $address, $defaults ); |
|
| 290 | + $address = wp_parse_args($address, $defaults); |
|
| 291 | 291 | ?> |
| 292 | 292 | |
| 293 | - <?php if ( ! empty( $address ) ) { ?> |
|
| 293 | + <?php if ( ! empty($address)) { ?> |
|
| 294 | 294 | <span class="customer-address info-item editable"> |
| 295 | 295 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
| 296 | 296 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -301,38 +301,38 @@ discard block |
||
| 301 | 301 | </span> |
| 302 | 302 | <?php } ?> |
| 303 | 303 | <span class="customer-address info-item edit-item"> |
| 304 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
| 305 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
| 306 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
| 304 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
| 305 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
| 306 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
| 307 | 307 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
| 308 | 308 | <?php |
| 309 | 309 | |
| 310 | 310 | $selected_country = $address['country']; |
| 311 | 311 | |
| 312 | 312 | $countries = give_get_country_list(); |
| 313 | - foreach ( $countries as $country_code => $country ) { |
|
| 314 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 313 | + foreach ($countries as $country_code => $country) { |
|
| 314 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 315 | 315 | } |
| 316 | 316 | ?> |
| 317 | 317 | </select> |
| 318 | 318 | <?php |
| 319 | 319 | $selected_state = give_get_state(); |
| 320 | - $states = give_get_states( $selected_country ); |
|
| 320 | + $states = give_get_states($selected_country); |
|
| 321 | 321 | |
| 322 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
| 322 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
| 323 | 323 | |
| 324 | - if ( ! empty( $states ) ) : ?> |
|
| 324 | + if ( ! empty($states)) : ?> |
|
| 325 | 325 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
| 326 | 326 | <?php |
| 327 | - foreach ( $states as $state_code => $state ) { |
|
| 328 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 327 | + foreach ($states as $state_code => $state) { |
|
| 328 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 329 | 329 | } |
| 330 | 330 | ?> |
| 331 | 331 | </select> |
| 332 | 332 | <?php else : ?> |
| 333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" /> |
|
| 333 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province', 'give'); ?>" /> |
|
| 334 | 334 | <?php endif; ?> |
| 335 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
| 335 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
| 336 | 336 | </span> |
| 337 | 337 | |
| 338 | 338 | </div> |
@@ -350,120 +350,120 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | <span id="customer-edit-actions" class="edit-item"> |
| 352 | 352 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
| 353 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
| 353 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
| 354 | 354 | <input type="hidden" name="give_action" value="edit-customer" /> |
| 355 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" /> |
|
| 356 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
| 355 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" /> |
|
| 356 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
| 357 | 357 | </span> |
| 358 | 358 | |
| 359 | 359 | </form> |
| 360 | 360 | </div> |
| 361 | 361 | |
| 362 | - <?php do_action( 'give_donor_before_stats', $customer ); ?> |
|
| 362 | + <?php do_action('give_donor_before_stats', $customer); ?> |
|
| 363 | 363 | |
| 364 | 364 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
| 365 | 365 | <ul> |
| 366 | 366 | <li> |
| 367 | - <a title="<?php _e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
| 367 | + <a title="<?php _e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
| 368 | 368 | <span class="dashicons dashicons-heart"></span> |
| 369 | 369 | <?php |
| 370 | 370 | //Completed Donations |
| 371 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
| 372 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
| 371 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
| 372 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
| 373 | 373 | ?> |
| 374 | 374 | </a> |
| 375 | 375 | </li> |
| 376 | 376 | <li> |
| 377 | 377 | <span class="dashicons dashicons-chart-area"></span> |
| 378 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
| 378 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
| 379 | 379 | </li> |
| 380 | - <?php do_action( 'give_donor_stats_list', $customer ); ?> |
|
| 380 | + <?php do_action('give_donor_stats_list', $customer); ?> |
|
| 381 | 381 | </ul> |
| 382 | 382 | </div> |
| 383 | 383 | |
| 384 | - <?php do_action( 'give_donor_before_tables_wrapper', $customer ); ?> |
|
| 384 | + <?php do_action('give_donor_before_tables_wrapper', $customer); ?> |
|
| 385 | 385 | |
| 386 | 386 | <div id="customer-tables-wrapper" class="customer-section"> |
| 387 | 387 | |
| 388 | - <?php do_action( 'give_donor_before_tables', $customer ); ?> |
|
| 388 | + <?php do_action('give_donor_before_tables', $customer); ?> |
|
| 389 | 389 | |
| 390 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
| 390 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
| 391 | 391 | <?php |
| 392 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
| 393 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
| 394 | - $payments = array_slice( $payments, 0, 10 ); |
|
| 392 | + $payment_ids = explode(',', $customer->payment_ids); |
|
| 393 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
| 394 | + $payments = array_slice($payments, 0, 10); |
|
| 395 | 395 | ?> |
| 396 | 396 | <table class="wp-list-table widefat striped payments"> |
| 397 | 397 | <thead> |
| 398 | 398 | <tr> |
| 399 | - <th><?php _e( 'ID', 'give' ); ?></th> |
|
| 400 | - <th><?php _e( 'Amount', 'give' ); ?></th> |
|
| 401 | - <th><?php _e( 'Date', 'give' ); ?></th> |
|
| 402 | - <th><?php _e( 'Status', 'give' ); ?></th> |
|
| 403 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
| 399 | + <th><?php _e('ID', 'give'); ?></th> |
|
| 400 | + <th><?php _e('Amount', 'give'); ?></th> |
|
| 401 | + <th><?php _e('Date', 'give'); ?></th> |
|
| 402 | + <th><?php _e('Status', 'give'); ?></th> |
|
| 403 | + <th><?php _e('Actions', 'give'); ?></th> |
|
| 404 | 404 | </tr> |
| 405 | 405 | </thead> |
| 406 | 406 | <tbody> |
| 407 | - <?php if ( ! empty( $payments ) ) : ?> |
|
| 408 | - <?php foreach ( $payments as $payment ) : ?> |
|
| 407 | + <?php if ( ! empty($payments)) : ?> |
|
| 408 | + <?php foreach ($payments as $payment) : ?> |
|
| 409 | 409 | <tr> |
| 410 | 410 | <td><?php echo $payment->ID; ?></td> |
| 411 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
| 412 | - <td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td> |
|
| 413 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
| 411 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
| 412 | + <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td> |
|
| 413 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
| 414 | 414 | <td> |
| 415 | - <a title="<?php _e( 'View Details for Donation', 'give' ); |
|
| 416 | - echo ' ' . $payment->ID; ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>"> |
|
| 417 | - <?php _e( 'View Details', 'give' ); ?> |
|
| 415 | + <a title="<?php _e('View Details for Donation', 'give'); |
|
| 416 | + echo ' '.$payment->ID; ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>"> |
|
| 417 | + <?php _e('View Details', 'give'); ?> |
|
| 418 | 418 | </a> |
| 419 | - <?php do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); ?> |
|
| 419 | + <?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?> |
|
| 420 | 420 | </td> |
| 421 | 421 | </tr> |
| 422 | 422 | <?php endforeach; ?> |
| 423 | 423 | <?php else: ?> |
| 424 | 424 | <tr> |
| 425 | - <td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td> |
|
| 425 | + <td colspan="5"><?php _e('No Donations Found', 'give'); ?></td> |
|
| 426 | 426 | </tr> |
| 427 | 427 | <?php endif; ?> |
| 428 | 428 | </tbody> |
| 429 | 429 | </table> |
| 430 | 430 | |
| 431 | - <h3><?php _e( 'Completed Donations', 'give' ); ?></h3> |
|
| 431 | + <h3><?php _e('Completed Donations', 'give'); ?></h3> |
|
| 432 | 432 | <?php |
| 433 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
| 433 | + $donations = give_get_users_completed_donations($customer->email); |
|
| 434 | 434 | ?> |
| 435 | 435 | <table class="wp-list-table widefat striped downloads"> |
| 436 | 436 | <thead> |
| 437 | 437 | <tr> |
| 438 | 438 | <th><?php echo give_get_forms_label_singular(); ?></th> |
| 439 | - <th width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
| 439 | + <th width="120px"><?php _e('Actions', 'give'); ?></th> |
|
| 440 | 440 | </tr> |
| 441 | 441 | </thead> |
| 442 | 442 | <tbody> |
| 443 | - <?php if ( ! empty( $donations ) ) : ?> |
|
| 444 | - <?php foreach ( $donations as $donation ) : ?> |
|
| 443 | + <?php if ( ! empty($donations)) : ?> |
|
| 444 | + <?php foreach ($donations as $donation) : ?> |
|
| 445 | 445 | <tr> |
| 446 | 446 | <td><?php echo $donation->post_title; ?></td> |
| 447 | 447 | <td> |
| 448 | - <a title="<?php echo esc_attr( sprintf( __( 'View %s', 'give' ), $donation->post_title ) ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ); ?>"> |
|
| 449 | - <?php printf( __( 'View %s', 'give' ), give_get_forms_label_singular() ); ?> |
|
| 448 | + <a title="<?php echo esc_attr(sprintf(__('View %s', 'give'), $donation->post_title)); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID)); ?>"> |
|
| 449 | + <?php printf(__('View %s', 'give'), give_get_forms_label_singular()); ?> |
|
| 450 | 450 | </a> |
| 451 | 451 | </td> |
| 452 | 452 | </tr> |
| 453 | 453 | <?php endforeach; ?> |
| 454 | 454 | <?php else: ?> |
| 455 | 455 | <tr> |
| 456 | - <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td> |
|
| 456 | + <td colspan="2"><?php _e('No Completed Donations Found', 'give'); ?></td> |
|
| 457 | 457 | </tr> |
| 458 | 458 | <?php endif; ?> |
| 459 | 459 | </tbody> |
| 460 | 460 | </table> |
| 461 | 461 | |
| 462 | - <?php do_action( 'give_donor_after_tables', $customer ); ?> |
|
| 462 | + <?php do_action('give_donor_after_tables', $customer); ?> |
|
| 463 | 463 | |
| 464 | 464 | </div> |
| 465 | 465 | |
| 466 | - <?php do_action( 'give_donor_card_bottom', $customer ); ?> |
|
| 466 | + <?php do_action('give_donor_card_bottom', $customer); ?> |
|
| 467 | 467 | |
| 468 | 468 | <?php |
| 469 | 469 | } |
@@ -477,30 +477,30 @@ discard block |
||
| 477 | 477 | * |
| 478 | 478 | * @return void |
| 479 | 479 | */ |
| 480 | -function give_customer_notes_view( $customer ) { |
|
| 480 | +function give_customer_notes_view($customer) { |
|
| 481 | 481 | |
| 482 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
| 483 | - $paged = absint( $paged ); |
|
| 482 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
| 483 | + $paged = absint($paged); |
|
| 484 | 484 | $note_count = $customer->get_notes_count(); |
| 485 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
| 486 | - $total_pages = ceil( $note_count / $per_page ); |
|
| 487 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
| 485 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
| 486 | + $total_pages = ceil($note_count / $per_page); |
|
| 487 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
| 488 | 488 | ?> |
| 489 | 489 | |
| 490 | 490 | <div id="customer-notes-wrapper"> |
| 491 | 491 | <div class="customer-notes-header"> |
| 492 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
| 492 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
| 493 | 493 | </div> |
| 494 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
| 494 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
| 495 | 495 | |
| 496 | - <?php if ( 1 == $paged ) : ?> |
|
| 496 | + <?php if (1 == $paged) : ?> |
|
| 497 | 497 | <div style="display: block; margin-bottom: 55px;"> |
| 498 | - <form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>"> |
|
| 498 | + <form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>"> |
|
| 499 | 499 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
| 500 | 500 | <br /> |
| 501 | 501 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
| 502 | 502 | <input type="hidden" name="give_action" value="add-customer-note" /> |
| 503 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
| 503 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
| 504 | 504 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
| 505 | 505 | </form> |
| 506 | 506 | </div> |
@@ -515,46 +515,46 @@ discard block |
||
| 515 | 515 | 'show_all' => true |
| 516 | 516 | ); |
| 517 | 517 | |
| 518 | - echo paginate_links( $pagination_args ); |
|
| 518 | + echo paginate_links($pagination_args); |
|
| 519 | 519 | ?> |
| 520 | 520 | |
| 521 | 521 | <div id="give-customer-notes" class="postbox"> |
| 522 | - <?php if ( count( $customer_notes ) > 0 ) : ?> |
|
| 523 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
| 522 | + <?php if (count($customer_notes) > 0) : ?> |
|
| 523 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
| 524 | 524 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
| 525 | 525 | <span class="note-content-wrap"> |
| 526 | - <?php echo stripslashes( $note ); ?> |
|
| 526 | + <?php echo stripslashes($note); ?> |
|
| 527 | 527 | </span> |
| 528 | 528 | </div> |
| 529 | 529 | <?php endforeach; ?> |
| 530 | 530 | <?php else: ?> |
| 531 | 531 | <div class="give-no-customer-notes"> |
| 532 | - <?php _e( 'No Donor Notes', 'give' ); ?> |
|
| 532 | + <?php _e('No Donor Notes', 'give'); ?> |
|
| 533 | 533 | </div> |
| 534 | 534 | <?php endif; ?> |
| 535 | 535 | </div> |
| 536 | 536 | |
| 537 | - <?php echo paginate_links( $pagination_args ); ?> |
|
| 537 | + <?php echo paginate_links($pagination_args); ?> |
|
| 538 | 538 | |
| 539 | 539 | </div> |
| 540 | 540 | |
| 541 | 541 | <?php |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | -function give_customers_delete_view( $customer ) { |
|
| 544 | +function give_customers_delete_view($customer) { |
|
| 545 | 545 | |
| 546 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
| 546 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
| 547 | 547 | |
| 548 | 548 | ?> |
| 549 | 549 | |
| 550 | - <?php do_action( 'give_customer_delete_top', $customer ); ?> |
|
| 550 | + <?php do_action('give_customer_delete_top', $customer); ?> |
|
| 551 | 551 | |
| 552 | 552 | <div class="info-wrapper customer-section"> |
| 553 | 553 | |
| 554 | - <form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>"> |
|
| 554 | + <form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>"> |
|
| 555 | 555 | |
| 556 | 556 | <div class="customer-notes-header"> |
| 557 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
| 557 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
| 558 | 558 | </div> |
| 559 | 559 | |
| 560 | 560 | |
@@ -562,27 +562,27 @@ discard block |
||
| 562 | 562 | |
| 563 | 563 | <span class="delete-customer-options"> |
| 564 | 564 | <p> |
| 565 | - <?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?> |
|
| 566 | - <label for="give-customer-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
| 565 | + <?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?> |
|
| 566 | + <label for="give-customer-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
| 567 | 567 | </p> |
| 568 | 568 | |
| 569 | 569 | <p> |
| 570 | - <?php echo Give()->html->checkbox( array( |
|
| 570 | + <?php echo Give()->html->checkbox(array( |
|
| 571 | 571 | 'name' => 'give-customer-delete-records', |
| 572 | - 'options' => array( 'disabled' => true ) |
|
| 573 | - ) ); ?> |
|
| 574 | - <label for="give-customer-delete-records"><?php _e( 'Delete all associated payments and records?', 'give' ); ?></label> |
|
| 572 | + 'options' => array('disabled' => true) |
|
| 573 | + )); ?> |
|
| 574 | + <label for="give-customer-delete-records"><?php _e('Delete all associated payments and records?', 'give'); ?></label> |
|
| 575 | 575 | </p> |
| 576 | 576 | |
| 577 | - <?php do_action( 'give_customer_delete_inputs', $customer ); ?> |
|
| 577 | + <?php do_action('give_customer_delete_inputs', $customer); ?> |
|
| 578 | 578 | </span> |
| 579 | 579 | |
| 580 | 580 | <span id="customer-edit-actions"> |
| 581 | 581 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
| 582 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
| 582 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
| 583 | 583 | <input type="hidden" name="give_action" value="delete-customer" /> |
| 584 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" /> |
|
| 585 | - <a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
| 584 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" /> |
|
| 585 | + <a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
| 586 | 586 | </span> |
| 587 | 587 | |
| 588 | 588 | </div> |
@@ -592,5 +592,5 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | <?php |
| 594 | 594 | |
| 595 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
| 595 | + do_action('give_customer_delete_bottom', $customer); |
|
| 596 | 596 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export.php'; |
|
| 18 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export.php'; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Exports earnings for a specified time period |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | 27 | function give_export_earnings() { |
| 28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
| 28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
| 29 | 29 | |
| 30 | 30 | $earnings_export = new Give_Earnings_Export(); |
| 31 | 31 | |
| 32 | 32 | $earnings_export->export(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
| 35 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Exports all the payments stored in Payment History to a CSV file using the |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | * @return void |
| 43 | 43 | */ |
| 44 | 44 | function give_export_payment_history() { |
| 45 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-payments.php'; |
|
| 45 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-payments.php'; |
|
| 46 | 46 | |
| 47 | 47 | $payments_export = new Give_Payments_Export(); |
| 48 | 48 | |
| 49 | 49 | $payments_export->export(); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -add_action( 'give_payment_export', 'give_export_payment_history' ); |
|
| 52 | +add_action('give_payment_export', 'give_export_payment_history'); |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * Export all the donors to a CSV file. |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | * @return void |
| 62 | 62 | */ |
| 63 | 63 | function give_export_all_donors() { |
| 64 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php'; |
|
| 64 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php'; |
|
| 65 | 65 | |
| 66 | 66 | $donor_export = new Give_Donors_Export(); |
| 67 | 67 | |
| 68 | 68 | $donor_export->export(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -add_action( 'give_email_export', 'give_export_all_donors' ); |
|
| 72 | 71 | \ No newline at end of file |
| 72 | +add_action('give_email_export', 'give_export_all_donors'); |
|
| 73 | 73 | \ 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' ) ) exit; |
|
| 13 | +if ( ! defined('ABSPATH')) exit; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Payment History Page |
@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | function give_payment_history_page() { |
| 25 | 25 | global $give_options; |
| 26 | 26 | |
| 27 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
| 27 | + $give_payment = get_post_type_object('give_payment'); |
|
| 28 | 28 | |
| 29 | - if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) { |
|
| 30 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php'; |
|
| 29 | + if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) { |
|
| 30 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php'; |
|
| 31 | 31 | } else { |
| 32 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
| 32 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
| 33 | 33 | $payments_table = new Give_Payment_History_Table(); |
| 34 | 34 | $payments_table->prepare_items(); |
| 35 | 35 | ?> |
| 36 | 36 | <div class="wrap"> |
| 37 | 37 | <h2><?php echo $give_payment->labels->menu_name ?></h2> |
| 38 | - <?php do_action( 'give_payments_page_top' ); ?> |
|
| 39 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
| 38 | + <?php do_action('give_payments_page_top'); ?> |
|
| 39 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
| 40 | 40 | <input type="hidden" name="post_type" value="give_forms" /> |
| 41 | 41 | <input type="hidden" name="page" value="give-payment-history" /> |
| 42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | <?php $payments_table->display() ?> |
| 48 | 48 | </form> |
| 49 | - <?php do_action( 'give_payments_page_bottom' ); ?> |
|
| 49 | + <?php do_action('give_payments_page_bottom'); ?> |
|
| 50 | 50 | </div> |
| 51 | 51 | <?php |
| 52 | 52 | } |
@@ -61,21 +61,21 @@ discard block |
||
| 61 | 61 | * @param $title |
| 62 | 62 | * @return string |
| 63 | 63 | */ |
| 64 | -function give_view_order_details_title( $admin_title, $title ) { |
|
| 64 | +function give_view_order_details_title($admin_title, $title) { |
|
| 65 | 65 | |
| 66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
| 66 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) |
|
| 67 | 67 | return $admin_title; |
| 68 | 68 | |
| 69 | - if( ! isset( $_GET['give-action'] ) ) |
|
| 69 | + if ( ! isset($_GET['give-action'])) |
|
| 70 | 70 | return $admin_title; |
| 71 | 71 | |
| 72 | - switch( $_GET['give-action'] ) : |
|
| 72 | + switch ($_GET['give-action']) : |
|
| 73 | 73 | |
| 74 | 74 | case 'view-order-details' : |
| 75 | - $title = __( 'View Donation Details', 'give' ) . ' - ' . $admin_title; |
|
| 75 | + $title = __('View Donation Details', 'give').' - '.$admin_title; |
|
| 76 | 76 | break; |
| 77 | 77 | case 'edit-payment' : |
| 78 | - $title = __( 'Edit Payment', 'give' ) . ' - ' . $admin_title; |
|
| 78 | + $title = __('Edit Payment', 'give').' - '.$admin_title; |
|
| 79 | 79 | break; |
| 80 | 80 | default: |
| 81 | 81 | $title = $admin_title; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | return $title; |
| 86 | 86 | } |
| 87 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
| 87 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen |
@@ -96,17 +96,17 @@ discard block |
||
| 96 | 96 | * @param $context |
| 97 | 97 | * @return string |
| 98 | 98 | */ |
| 99 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
| 99 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
| 100 | 100 | |
| 101 | - $post = get_post( $post_id ); |
|
| 102 | - if( ! $post ) |
|
| 101 | + $post = get_post($post_id); |
|
| 102 | + if ( ! $post) |
|
| 103 | 103 | return $url; |
| 104 | 104 | |
| 105 | - if( 'give_payment' != $post->post_type ) |
|
| 105 | + if ('give_payment' != $post->post_type) |
|
| 106 | 106 | return $url; |
| 107 | 107 | |
| 108 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
|
| 108 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id); |
|
| 109 | 109 | |
| 110 | 110 | return $url; |
| 111 | 111 | } |
| 112 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
| 112 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
|
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | + exit; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Payment History Page |
@@ -63,11 +65,13 @@ discard block |
||
| 63 | 65 | */ |
| 64 | 66 | function give_view_order_details_title( $admin_title, $title ) { |
| 65 | 67 | |
| 66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
| 67 | - return $admin_title; |
|
| 68 | + if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
| 69 | + return $admin_title; |
|
| 70 | + } |
|
| 68 | 71 | |
| 69 | - if( ! isset( $_GET['give-action'] ) ) |
|
| 70 | - return $admin_title; |
|
| 72 | + if( ! isset( $_GET['give-action'] ) ) { |
|
| 73 | + return $admin_title; |
|
| 74 | + } |
|
| 71 | 75 | |
| 72 | 76 | switch( $_GET['give-action'] ) : |
| 73 | 77 | |
@@ -99,11 +103,13 @@ discard block |
||
| 99 | 103 | function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
| 100 | 104 | |
| 101 | 105 | $post = get_post( $post_id ); |
| 102 | - if( ! $post ) |
|
| 103 | - return $url; |
|
| 106 | + if( ! $post ) { |
|
| 107 | + return $url; |
|
| 108 | + } |
|
| 104 | 109 | |
| 105 | - if( 'give_payment' != $post->post_type ) |
|
| 106 | - return $url; |
|
| 110 | + if( 'give_payment' != $post->post_type ) { |
|
| 111 | + return $url; |
|
| 112 | + } |
|
| 107 | 113 | |
| 108 | 114 | $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
| 109 | 115 | |
@@ -440,8 +440,10 @@ |
||
| 440 | 440 | echo give_get_payment_note_html( $note, $payment_id ); |
| 441 | 441 | |
| 442 | 442 | endforeach; |
| 443 | - else : |
|
| 443 | + else { |
|
| 444 | + : |
|
| 444 | 445 | $no_notes_display = ''; |
| 446 | + } |
|
| 445 | 447 | endif; |
| 446 | 448 | echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
| 447 | 449 | ?> |
@@ -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( __( 'Donation ID not supplied. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
| 23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 24 | + wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give')); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Setup the variables |
| 28 | -$payment_id = absint( $_GET['id'] ); |
|
| 29 | -$number = give_get_payment_number( $payment_id ); |
|
| 30 | -$item = get_post( $payment_id ); |
|
| 28 | +$payment_id = absint($_GET['id']); |
|
| 29 | +$number = give_get_payment_number($payment_id); |
|
| 30 | +$item = get_post($payment_id); |
|
| 31 | 31 | |
| 32 | 32 | // Sanity check... fail if purchase ID is invalid |
| 33 | -if ( ! is_object( $item ) || $item->post_type != 'give_payment' ) { |
|
| 34 | - wp_die( __( 'The specified ID does not belong to a payment. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
| 33 | +if ( ! is_object($item) || $item->post_type != 'give_payment') { |
|
| 34 | + wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give')); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -$payment_meta = give_get_payment_meta( $payment_id ); |
|
| 38 | -$transaction_id = esc_attr( give_get_payment_transaction_id( $payment_id ) ); |
|
| 39 | -$user_id = give_get_payment_user_id( $payment_id ); |
|
| 40 | -$donor_id = give_get_payment_customer_id( $payment_id ); |
|
| 41 | -$payment_date = strtotime( $item->post_date ); |
|
| 42 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 43 | -$address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
| 37 | +$payment_meta = give_get_payment_meta($payment_id); |
|
| 38 | +$transaction_id = esc_attr(give_get_payment_transaction_id($payment_id)); |
|
| 39 | +$user_id = give_get_payment_user_id($payment_id); |
|
| 40 | +$donor_id = give_get_payment_customer_id($payment_id); |
|
| 41 | +$payment_date = strtotime($item->post_date); |
|
| 42 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
| 43 | +$address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
| 44 | 44 | 'line1' => '', |
| 45 | 45 | 'line2' => '', |
| 46 | 46 | 'city' => '', |
@@ -48,72 +48,72 @@ discard block |
||
| 48 | 48 | 'state' => '', |
| 49 | 49 | 'zip' => '' |
| 50 | 50 | ); |
| 51 | -$gateway = give_get_payment_gateway( $payment_id ); |
|
| 52 | -$currency_code = give_get_payment_currency_code( $payment_id ); |
|
| 51 | +$gateway = give_get_payment_gateway($payment_id); |
|
| 52 | +$currency_code = give_get_payment_currency_code($payment_id); |
|
| 53 | 53 | ?> |
| 54 | 54 | <div class="wrap give-wrap"> |
| 55 | - <h2><?php printf( __( 'Payment %s', 'give' ), $number ); ?></h2> |
|
| 56 | - <?php do_action( 'give_view_order_details_before', $payment_id ); ?> |
|
| 55 | + <h2><?php printf(__('Payment %s', 'give'), $number); ?></h2> |
|
| 56 | + <?php do_action('give_view_order_details_before', $payment_id); ?> |
|
| 57 | 57 | <form id="give-edit-order-form" method="post"> |
| 58 | - <?php do_action( 'give_view_order_details_form_top', $payment_id ); ?> |
|
| 58 | + <?php do_action('give_view_order_details_form_top', $payment_id); ?> |
|
| 59 | 59 | <div id="poststuff"> |
| 60 | 60 | <div id="give-dashboard-widgets-wrap"> |
| 61 | 61 | <div id="post-body" class="metabox-holder columns-2"> |
| 62 | 62 | <div id="postbox-container-1" class="postbox-container"> |
| 63 | 63 | <div id="side-sortables" class="meta-box-sortables ui-sortable"> |
| 64 | 64 | |
| 65 | - <?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?> |
|
| 65 | + <?php do_action('give_view_order_details_sidebar_before', $payment_id); ?> |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | <div id="give-order-update" class="postbox give-order-data"> |
| 69 | 69 | |
| 70 | 70 | <h3 class="hndle"> |
| 71 | - <span><?php _e( 'Update Payment', 'give' ); ?></span> |
|
| 71 | + <span><?php _e('Update Payment', 'give'); ?></span> |
|
| 72 | 72 | </h3> |
| 73 | 73 | |
| 74 | 74 | <div class="inside"> |
| 75 | 75 | <div class="give-admin-box"> |
| 76 | 76 | |
| 77 | - <?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?> |
|
| 77 | + <?php do_action('give_view_order_details_totals_before', $payment_id); ?> |
|
| 78 | 78 | |
| 79 | 79 | <div class="give-admin-box-inside"> |
| 80 | 80 | <p> |
| 81 | - <span class="label"><?php _e( 'Status:', 'give' ); ?></span> |
|
| 81 | + <span class="label"><?php _e('Status:', 'give'); ?></span> |
|
| 82 | 82 | <select name="give-payment-status" class="medium-text"> |
| 83 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
| 84 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( give_get_payment_status( $item, true ), $status ); ?>><?php echo esc_html( $status ); ?></option> |
|
| 83 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
| 84 | + <option value="<?php echo esc_attr($key); ?>"<?php selected(give_get_payment_status($item, true), $status); ?>><?php echo esc_html($status); ?></option> |
|
| 85 | 85 | <?php endforeach; ?> |
| 86 | 86 | </select> |
| 87 | - <span class="give-donation-status status-<?php echo sanitize_title( give_get_payment_status( $item, true ) ); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 87 | + <span class="give-donation-status status-<?php echo sanitize_title(give_get_payment_status($item, true)); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 88 | 88 | </p> |
| 89 | 89 | </div> |
| 90 | 90 | |
| 91 | 91 | <div class="give-admin-box-inside"> |
| 92 | 92 | <p> |
| 93 | - <span class="label"><?php _e( 'Date:', 'give' ); ?></span> |
|
| 94 | - <input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker" /> |
|
| 93 | + <span class="label"><?php _e('Date:', 'give'); ?></span> |
|
| 94 | + <input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker" /> |
|
| 95 | 95 | </p> |
| 96 | 96 | </div> |
| 97 | 97 | |
| 98 | 98 | <div class="give-admin-box-inside"> |
| 99 | 99 | <p> |
| 100 | - <span class="label"><?php _e( 'Time:', 'give' ); ?></span> |
|
| 101 | - <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour" /> : |
|
| 102 | - <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min" /> |
|
| 100 | + <span class="label"><?php _e('Time:', 'give'); ?></span> |
|
| 101 | + <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour" /> : |
|
| 102 | + <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min" /> |
|
| 103 | 103 | </p> |
| 104 | 104 | </div> |
| 105 | 105 | |
| 106 | - <?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
| 106 | + <?php do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
| 107 | 107 | |
| 108 | 108 | <?php |
| 109 | - $fees = give_get_payment_fees( $payment_id ); |
|
| 110 | - if ( ! empty( $fees ) ) : ?> |
|
| 109 | + $fees = give_get_payment_fees($payment_id); |
|
| 110 | + if ( ! empty($fees)) : ?> |
|
| 111 | 111 | <div class="give-order-fees give-admin-box-inside"> |
| 112 | - <p class="strong"><?php _e( 'Fees', 'give' ); ?>:</p> |
|
| 112 | + <p class="strong"><?php _e('Fees', 'give'); ?>:</p> |
|
| 113 | 113 | <ul class="give-payment-fees"> |
| 114 | - <?php foreach ( $fees as $fee ) : ?> |
|
| 114 | + <?php foreach ($fees as $fee) : ?> |
|
| 115 | 115 | <li> |
| 116 | - <span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
| 116 | + <span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
| 117 | 117 | </li> |
| 118 | 118 | <?php endforeach; ?> |
| 119 | 119 | </ul> |
@@ -123,12 +123,12 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | <div class="give-order-payment give-admin-box-inside"> |
| 125 | 125 | <p> |
| 126 | - <span class="label"><?php _e( 'Total Donation', 'give' ); ?>:</span> |
|
| 127 | - <?php echo give_currency_symbol( $payment_meta['currency'] ); ?> <input name="give-payment-total" type="text" class="small-text" value="<?php echo esc_attr( give_format_amount( give_get_payment_amount( $payment_id ) ) ); ?>" /> |
|
| 126 | + <span class="label"><?php _e('Total Donation', 'give'); ?>:</span> |
|
| 127 | + <?php echo give_currency_symbol($payment_meta['currency']); ?> <input name="give-payment-total" type="text" class="small-text" value="<?php echo esc_attr(give_format_amount(give_get_payment_amount($payment_id))); ?>" /> |
|
| 128 | 128 | </p> |
| 129 | 129 | </div> |
| 130 | 130 | |
| 131 | - <?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?> |
|
| 131 | + <?php do_action('give_view_order_details_totals_after', $payment_id); ?> |
|
| 132 | 132 | |
| 133 | 133 | </div> |
| 134 | 134 | <!-- /.give-admin-box --> |
@@ -137,20 +137,20 @@ discard block |
||
| 137 | 137 | <!-- /.inside --> |
| 138 | 138 | |
| 139 | 139 | <div class="give-order-update-box give-admin-box"> |
| 140 | - <?php do_action( 'give_view_order_details_update_before', $payment_id ); ?> |
|
| 140 | + <?php do_action('give_view_order_details_update_before', $payment_id); ?> |
|
| 141 | 141 | <div id="major-publishing-actions"> |
| 142 | 142 | <div id="publishing-action"> |
| 143 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>" /> |
|
| 144 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
| 145 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 143 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>" /> |
|
| 144 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
| 145 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 146 | 146 | 'give-action' => 'email_links', |
| 147 | 147 | 'purchase_id' => $payment_id |
| 148 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e( 'Resend Receipt', 'give' ); ?></a> |
|
| 148 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e('Resend Receipt', 'give'); ?></a> |
|
| 149 | 149 | <?php endif; ?> |
| 150 | 150 | </div> |
| 151 | 151 | <div class="clear"></div> |
| 152 | 152 | </div> |
| 153 | - <?php do_action( 'give_view_order_details_update_after', $payment_id ); ?> |
|
| 153 | + <?php do_action('give_view_order_details_update_after', $payment_id); ?> |
|
| 154 | 154 | </div> |
| 155 | 155 | <!-- /.give-order-update-box --> |
| 156 | 156 | |
@@ -160,55 +160,55 @@ discard block |
||
| 160 | 160 | <div id="give-order-details" class="postbox give-order-data"> |
| 161 | 161 | |
| 162 | 162 | <h3 class="hndle"> |
| 163 | - <span><?php _e( 'Payment Meta', 'give' ); ?></span> |
|
| 163 | + <span><?php _e('Payment Meta', 'give'); ?></span> |
|
| 164 | 164 | </h3> |
| 165 | 165 | |
| 166 | 166 | <div class="inside"> |
| 167 | 167 | <div class="give-admin-box"> |
| 168 | 168 | |
| 169 | - <?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?> |
|
| 169 | + <?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?> |
|
| 170 | 170 | |
| 171 | 171 | <?php |
| 172 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 173 | - if ( $gateway ) : ?> |
|
| 172 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 173 | + if ($gateway) : ?> |
|
| 174 | 174 | <div class="give-order-gateway give-admin-box-inside"> |
| 175 | 175 | <p> |
| 176 | - <span class="label"><?php _e( 'Gateway:', 'give' ); ?></span> |
|
| 177 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 176 | + <span class="label"><?php _e('Gateway:', 'give'); ?></span> |
|
| 177 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 178 | 178 | </p> |
| 179 | 179 | </div> |
| 180 | 180 | <?php endif; ?> |
| 181 | 181 | |
| 182 | 182 | <div class="give-order-payment-key give-admin-box-inside"> |
| 183 | 183 | <p> |
| 184 | - <span class="label"><?php _e( 'Key:', 'give' ); ?></span> |
|
| 185 | - <span><?php echo give_get_payment_key( $payment_id ); ?></span> |
|
| 184 | + <span class="label"><?php _e('Key:', 'give'); ?></span> |
|
| 185 | + <span><?php echo give_get_payment_key($payment_id); ?></span> |
|
| 186 | 186 | </p> |
| 187 | 187 | </div> |
| 188 | 188 | |
| 189 | 189 | <div class="give-order-ip give-admin-box-inside"> |
| 190 | 190 | <p> |
| 191 | - <span class="label"><?php _e( 'IP:', 'give' ); ?></span> |
|
| 192 | - <span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span> |
|
| 191 | + <span class="label"><?php _e('IP:', 'give'); ?></span> |
|
| 192 | + <span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span> |
|
| 193 | 193 | </p> |
| 194 | 194 | </div> |
| 195 | 195 | |
| 196 | - <?php if ( $transaction_id ) : ?> |
|
| 196 | + <?php if ($transaction_id) : ?> |
|
| 197 | 197 | <div class="give-order-tx-id give-admin-box-inside"> |
| 198 | 198 | <p> |
| 199 | - <span class="label"><?php _e( 'Transaction ID:', 'give' ); ?></span> |
|
| 200 | - <span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span> |
|
| 199 | + <span class="label"><?php _e('Transaction ID:', 'give'); ?></span> |
|
| 200 | + <span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span> |
|
| 201 | 201 | </p> |
| 202 | 202 | </div> |
| 203 | 203 | <?php endif; ?> |
| 204 | 204 | |
| 205 | 205 | <div class="give-admin-box-inside"> |
| 206 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . esc_attr( give_get_payment_user_email( $payment_id ) ) ); ?> |
|
| 207 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor', 'give' ); ?> »</a> |
|
| 206 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.esc_attr(give_get_payment_user_email($payment_id))); ?> |
|
| 207 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor', 'give'); ?> »</a> |
|
| 208 | 208 | </p> |
| 209 | 209 | </div> |
| 210 | 210 | |
| 211 | - <?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?> |
|
| 211 | + <?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?> |
|
| 212 | 212 | |
| 213 | 213 | </div> |
| 214 | 214 | <!-- /.column-container --> |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | </div> |
| 220 | 220 | <!-- /#give-order-data --> |
| 221 | 221 | |
| 222 | - <?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?> |
|
| 222 | + <?php do_action('give_view_order_details_sidebar_after', $payment_id); ?> |
|
| 223 | 223 | |
| 224 | 224 | </div> |
| 225 | 225 | <!-- /#side-sortables --> |
@@ -230,12 +230,12 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | <div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
| 232 | 232 | |
| 233 | - <?php do_action( 'give_view_order_details_main_before', $payment_id ); ?> |
|
| 233 | + <?php do_action('give_view_order_details_main_before', $payment_id); ?> |
|
| 234 | 234 | |
| 235 | 235 | <?php $column_count = 'columns-3'; ?> |
| 236 | 236 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 237 | 237 | <h3 class="hndle"> |
| 238 | - <span><?php _e( 'Donation Information', 'give' ); ?></span> |
|
| 238 | + <span><?php _e('Donation Information', 'give'); ?></span> |
|
| 239 | 239 | </h3> |
| 240 | 240 | |
| 241 | 241 | <div class="inside"> |
@@ -243,25 +243,25 @@ discard block |
||
| 243 | 243 | <table style="width:100%;text-align:left;"> |
| 244 | 244 | <thead> |
| 245 | 245 | <tr> |
| 246 | - <?php do_action( 'give_donation_details_thead_before', $payment_id ); ?> |
|
| 247 | - <th><?php _e( 'Form ID', 'give' ) ?></th> |
|
| 248 | - <th><?php _e( 'Form Title', 'give' ) ?></th> |
|
| 249 | - <th><?php _e( 'Date and Time', 'give' ) ?></th> |
|
| 250 | - <th><?php _e( 'Total Donation', 'give' ) ?></th> |
|
| 251 | - <?php do_action( 'give_donation_details_thead_after', $payment_id ); ?> |
|
| 246 | + <?php do_action('give_donation_details_thead_before', $payment_id); ?> |
|
| 247 | + <th><?php _e('Form ID', 'give') ?></th> |
|
| 248 | + <th><?php _e('Form Title', 'give') ?></th> |
|
| 249 | + <th><?php _e('Date and Time', 'give') ?></th> |
|
| 250 | + <th><?php _e('Total Donation', 'give') ?></th> |
|
| 251 | + <?php do_action('give_donation_details_thead_after', $payment_id); ?> |
|
| 252 | 252 | </tr> |
| 253 | 253 | </thead> |
| 254 | 254 | <tr> |
| 255 | - <?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?> |
|
| 255 | + <?php do_action('give_donation_details_tbody_before', $payment_id); ?> |
|
| 256 | 256 | <td> |
| 257 | 257 | <?php echo $payment_meta['form_id']; ?> |
| 258 | 258 | </td> |
| 259 | 259 | <td> |
| 260 | - <a href="<?php echo get_permalink( $payment_meta['form_id'] ); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
| 260 | + <a href="<?php echo get_permalink($payment_meta['form_id']); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
| 261 | 261 | </td> |
| 262 | - <td><?php echo date( 'm/d/Y', $payment_date ) . ' ' . date_i18n( 'H:i', $payment_date ); ?></td> |
|
| 263 | - <td><?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td> |
|
| 264 | - <?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?> |
|
| 262 | + <td><?php echo date('m/d/Y', $payment_date).' '.date_i18n('H:i', $payment_date); ?></td> |
|
| 263 | + <td><?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td> |
|
| 264 | + <?php do_action('give_donation_details_tbody_after', $payment_id); ?> |
|
| 265 | 265 | |
| 266 | 266 | </tr> |
| 267 | 267 | </table> |
@@ -273,64 +273,64 @@ discard block |
||
| 273 | 273 | </div> |
| 274 | 274 | <!-- /#give-donation-overview --> |
| 275 | 275 | |
| 276 | - <?php do_action( 'give_view_order_details_files_after', $payment_id ); ?> |
|
| 276 | + <?php do_action('give_view_order_details_files_after', $payment_id); ?> |
|
| 277 | 277 | |
| 278 | - <?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?> |
|
| 278 | + <?php do_action('give_view_order_details_billing_before', $payment_id); ?> |
|
| 279 | 279 | |
| 280 | 280 | |
| 281 | 281 | <div id="give-customer-details" class="postbox"> |
| 282 | 282 | <h3 class="hndle"> |
| 283 | - <span><?php _e( 'Donor Details', 'give' ); ?></span> |
|
| 283 | + <span><?php _e('Donor Details', 'give'); ?></span> |
|
| 284 | 284 | </h3> |
| 285 | 285 | |
| 286 | 286 | <div class="inside give-clearfix"> |
| 287 | 287 | |
| 288 | - <?php $customer = new Give_Customer( give_get_payment_customer_id( $payment_id ) ); ?> |
|
| 288 | + <?php $customer = new Give_Customer(give_get_payment_customer_id($payment_id)); ?> |
|
| 289 | 289 | |
| 290 | 290 | <div class="column-container customer-info"> |
| 291 | 291 | <div class="column"> |
| 292 | - <?php echo Give()->html->donor_dropdown( array( |
|
| 292 | + <?php echo Give()->html->donor_dropdown(array( |
|
| 293 | 293 | 'selected' => $customer->id, |
| 294 | 294 | 'name' => 'customer-id' |
| 295 | - ) ); ?> |
|
| 295 | + )); ?> |
|
| 296 | 296 | </div> |
| 297 | 297 | <div class="column"> |
| 298 | 298 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>" /> |
| 299 | 299 | </div> |
| 300 | 300 | <div class="column"> |
| 301 | - <?php if ( ! empty( $customer->id ) ) : ?> |
|
| 302 | - <?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?> |
|
| 303 | - <a href="<?php echo $customer_url; ?>" title="<?php _e( 'View Donor Details', 'give' ); ?>"><?php _e( 'View Donor Details', 'give' ); ?></a> |
|
| 301 | + <?php if ( ! empty($customer->id)) : ?> |
|
| 302 | + <?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?> |
|
| 303 | + <a href="<?php echo $customer_url; ?>" title="<?php _e('View Donor Details', 'give'); ?>"><?php _e('View Donor Details', 'give'); ?></a> |
|
| 304 | 304 | | |
| 305 | 305 | <?php endif; ?> |
| 306 | - <a href="#new" class="give-payment-new-customer" title="<?php _e( 'New Donor', 'give' ); ?>"><?php _e( 'New Donor', 'give' ); ?></a> |
|
| 306 | + <a href="#new" class="give-payment-new-customer" title="<?php _e('New Donor', 'give'); ?>"><?php _e('New Donor', 'give'); ?></a> |
|
| 307 | 307 | </div> |
| 308 | 308 | </div> |
| 309 | 309 | |
| 310 | 310 | <div class="column-container new-customer" style="display: none"> |
| 311 | 311 | <div class="column"> |
| 312 | - <strong><?php _e( 'Name:', 'give' ); ?></strong> |
|
| 312 | + <strong><?php _e('Name:', 'give'); ?></strong> |
|
| 313 | 313 | <input type="text" name="give-new-customer-name" value="" class="medium-text" /> |
| 314 | 314 | </div> |
| 315 | 315 | <div class="column"> |
| 316 | - <strong><?php _e( 'Email:', 'give' ); ?></strong> |
|
| 316 | + <strong><?php _e('Email:', 'give'); ?></strong> |
|
| 317 | 317 | <input type="email" name="give-new-customer-email" value="" class="medium-text" /> |
| 318 | 318 | </div> |
| 319 | 319 | <div class="column"> |
| 320 | 320 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0" /> |
| 321 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
| 321 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
| 322 | 322 | </div> |
| 323 | 323 | <div class="column"> |
| 324 | 324 | <small> |
| 325 | - <em>*<?php _e( 'Click "Save Payment" to create new donor', 'give' ); ?></em> |
|
| 325 | + <em>*<?php _e('Click "Save Payment" to create new donor', 'give'); ?></em> |
|
| 326 | 326 | </small> |
| 327 | 327 | </div> |
| 328 | 328 | </div> |
| 329 | 329 | |
| 330 | 330 | <?php |
| 331 | 331 | // The give_payment_personal_details_list hook is left here for backwards compatibility |
| 332 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 333 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 332 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 333 | + do_action('give_payment_view_details', $payment_id); |
|
| 334 | 334 | ?> |
| 335 | 335 | |
| 336 | 336 | </div> |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | <div id="give-billing-details" class="postbox"> |
| 343 | 343 | <h3 class="hndle"> |
| 344 | - <span><?php _e( 'Billing Address', 'give' ); ?></span> |
|
| 344 | + <span><?php _e('Billing Address', 'give'); ?></span> |
|
| 345 | 345 | </h3> |
| 346 | 346 | |
| 347 | 347 | <div class="inside give-clearfix"> |
@@ -352,62 +352,62 @@ discard block |
||
| 352 | 352 | <div class="data column-container"> |
| 353 | 353 | <div class="column"> |
| 354 | 354 | <p> |
| 355 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 1:', 'give' ); ?></strong><br /> |
|
| 356 | - <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text" /> |
|
| 355 | + <strong class="order-data-address-line"><?php _e('Street Address Line 1:', 'give'); ?></strong><br /> |
|
| 356 | + <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text" /> |
|
| 357 | 357 | </p> |
| 358 | 358 | |
| 359 | 359 | <p> |
| 360 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 2:', 'give' ); ?></strong><br /> |
|
| 361 | - <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text" /> |
|
| 360 | + <strong class="order-data-address-line"><?php _e('Street Address Line 2:', 'give'); ?></strong><br /> |
|
| 361 | + <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text" /> |
|
| 362 | 362 | </p> |
| 363 | 363 | |
| 364 | 364 | </div> |
| 365 | 365 | <div class="column"> |
| 366 | 366 | <p> |
| 367 | - <strong class="order-data-address-line"><?php echo _x( 'City:', 'Address City', 'give' ); ?></strong><br /> |
|
| 368 | - <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text" /> |
|
| 367 | + <strong class="order-data-address-line"><?php echo _x('City:', 'Address City', 'give'); ?></strong><br /> |
|
| 368 | + <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text" /> |
|
| 369 | 369 | |
| 370 | 370 | </p> |
| 371 | 371 | |
| 372 | 372 | <p> |
| 373 | - <strong class="order-data-address-line"><?php echo _x( 'Zip / Postal Code:', 'Zip / Postal code of address', 'give' ); ?></strong><br /> |
|
| 374 | - <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text" /> |
|
| 373 | + <strong class="order-data-address-line"><?php echo _x('Zip / Postal Code:', 'Zip / Postal code of address', 'give'); ?></strong><br /> |
|
| 374 | + <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text" /> |
|
| 375 | 375 | |
| 376 | 376 | </p> |
| 377 | 377 | </div> |
| 378 | 378 | <div class="column"> |
| 379 | 379 | <p id="give-order-address-country-wrap"> |
| 380 | - <strong class="order-data-address-line"><?php echo _x( 'Country:', 'Address country', 'give' ); ?></strong><br /> |
|
| 380 | + <strong class="order-data-address-line"><?php echo _x('Country:', 'Address country', 'give'); ?></strong><br /> |
|
| 381 | 381 | <?php |
| 382 | - echo Give()->html->select( array( |
|
| 382 | + echo Give()->html->select(array( |
|
| 383 | 383 | 'options' => give_get_country_list(), |
| 384 | 384 | 'name' => 'give-payment-address[0][country]', |
| 385 | 385 | 'selected' => $address['country'], |
| 386 | 386 | 'show_option_all' => false, |
| 387 | 387 | 'show_option_none' => false, |
| 388 | 388 | 'chosen' => true, |
| 389 | - 'placeholder' => __( 'Select a country', 'give' ) |
|
| 390 | - ) ); |
|
| 389 | + 'placeholder' => __('Select a country', 'give') |
|
| 390 | + )); |
|
| 391 | 391 | ?> |
| 392 | 392 | </p> |
| 393 | 393 | |
| 394 | 394 | <p id="give-order-address-state-wrap"> |
| 395 | - <strong class="order-data-address-line"><?php echo _x( 'State / Province:', 'State / province of address', 'give' ); ?></strong><br /> |
|
| 395 | + <strong class="order-data-address-line"><?php echo _x('State / Province:', 'State / province of address', 'give'); ?></strong><br /> |
|
| 396 | 396 | <?php |
| 397 | - $states = give_get_states( $address['country'] ); |
|
| 398 | - if ( ! empty( $states ) ) { |
|
| 399 | - echo Give()->html->select( array( |
|
| 397 | + $states = give_get_states($address['country']); |
|
| 398 | + if ( ! empty($states)) { |
|
| 399 | + echo Give()->html->select(array( |
|
| 400 | 400 | 'options' => $states, |
| 401 | 401 | 'name' => 'give-payment-address[0][state]', |
| 402 | 402 | 'selected' => $address['state'], |
| 403 | 403 | 'show_option_all' => false, |
| 404 | 404 | 'show_option_none' => false, |
| 405 | 405 | 'chosen' => true, |
| 406 | - 'placeholder' => __( 'Select a state', 'give' ) |
|
| 407 | - ) ); |
|
| 406 | + 'placeholder' => __('Select a state', 'give') |
|
| 407 | + )); |
|
| 408 | 408 | } else { |
| 409 | 409 | ?> |
| 410 | - <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text" /> |
|
| 410 | + <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text" /> |
|
| 411 | 411 | <?php |
| 412 | 412 | } ?> |
| 413 | 413 | </p> |
@@ -417,39 +417,39 @@ discard block |
||
| 417 | 417 | </div> |
| 418 | 418 | <!-- /#give-order-address --> |
| 419 | 419 | |
| 420 | - <?php do_action( 'give_payment_billing_details', $payment_id ); ?> |
|
| 420 | + <?php do_action('give_payment_billing_details', $payment_id); ?> |
|
| 421 | 421 | |
| 422 | 422 | </div> |
| 423 | 423 | <!-- /.inside --> |
| 424 | 424 | </div> |
| 425 | 425 | <!-- /#give-billing-details --> |
| 426 | 426 | |
| 427 | - <?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?> |
|
| 427 | + <?php do_action('give_view_order_details_billing_after', $payment_id); ?> |
|
| 428 | 428 | |
| 429 | 429 | <div id="give-payment-notes" class="postbox"> |
| 430 | - <h3 class="hndle"><span><?php _e( 'Payment Notes', 'give' ); ?></span></h3> |
|
| 430 | + <h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?></span></h3> |
|
| 431 | 431 | |
| 432 | 432 | <div class="inside"> |
| 433 | 433 | <div id="give-payment-notes-inner"> |
| 434 | 434 | <?php |
| 435 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 436 | - if ( ! empty( $notes ) ) : |
|
| 435 | + $notes = give_get_payment_notes($payment_id); |
|
| 436 | + if ( ! empty($notes)) : |
|
| 437 | 437 | $no_notes_display = ' style="display:none;"'; |
| 438 | - foreach ( $notes as $note ) : |
|
| 438 | + foreach ($notes as $note) : |
|
| 439 | 439 | |
| 440 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 440 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 441 | 441 | |
| 442 | 442 | endforeach; |
| 443 | 443 | else : |
| 444 | 444 | $no_notes_display = ''; |
| 445 | 445 | endif; |
| 446 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
|
| 446 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.__('No payment notes', 'give').'</p>'; |
|
| 447 | 447 | ?> |
| 448 | 448 | </div> |
| 449 | 449 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 450 | 450 | |
| 451 | 451 | <p class="give-clearfix"> |
| 452 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
| 452 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
| 453 | 453 | </p> |
| 454 | 454 | |
| 455 | 455 | <div class="clear"></div> |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | </div> |
| 459 | 459 | <!-- /#give-payment-notes --> |
| 460 | 460 | |
| 461 | - <?php do_action( 'give_view_order_details_main_after', $payment_id ); ?> |
|
| 461 | + <?php do_action('give_view_order_details_main_after', $payment_id); ?> |
|
| 462 | 462 | </div> |
| 463 | 463 | <!-- /#normal-sortables --> |
| 464 | 464 | </div> |
@@ -469,10 +469,10 @@ discard block |
||
| 469 | 469 | <!-- #give-dashboard-widgets-wrap --> |
| 470 | 470 | </div> |
| 471 | 471 | <!-- /#post-stuff --> |
| 472 | - <?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?> |
|
| 473 | - <?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?> |
|
| 474 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>" /> |
|
| 472 | + <?php do_action('give_view_order_details_form_bottom', $payment_id); ?> |
|
| 473 | + <?php wp_nonce_field('give_update_payment_details_nonce'); ?> |
|
| 474 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>" /> |
|
| 475 | 475 | <input type="hidden" name="give_action" value="update_payment_details" /> |
| 476 | 476 | </form> |
| 477 | - <?php do_action( 'give_view_order_details_after', $payment_id ); ?> |
|
| 477 | + <?php do_action('give_view_order_details_after', $payment_id); ?> |
|
| 478 | 478 | </div><!-- /.wrap --> |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * View Donation Details |
|
| 4 | - * |
|
| 5 | - * @package Give |
|
| 6 | - * @subpackage Admin/Payments |
|
| 7 | - * @copyright Copyright (c) 2016, WordImpress |
|
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | - * @since 1.0 |
|
| 10 | - */ |
|
| 3 | + * View Donation Details |
|
| 4 | + * |
|
| 5 | + * @package Give |
|
| 6 | + * @subpackage Admin/Payments |
|
| 7 | + * @copyright Copyright (c) 2016, WordImpress |
|
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
| 9 | + * @since 1.0 |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |