@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_get_actions() { |
27 | 27 | |
28 | - $_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null; |
|
28 | + $_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null; |
|
29 | 29 | |
30 | 30 | // Add backward compatibility to give-action param ( $_GET or $_POST ) |
31 | - if( doing_action( 'admin_init' ) && empty( $_get_action ) ) { |
|
32 | - $_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null; |
|
31 | + if (doing_action('admin_init') && empty($_get_action)) { |
|
32 | + $_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null; |
|
33 | 33 | } |
34 | 34 | |
35 | - if ( isset( $_get_action ) ) { |
|
35 | + if (isset($_get_action)) { |
|
36 | 36 | /** |
37 | 37 | * Fires in WordPress init or admin init, when give_action is present in $_GET. |
38 | 38 | * |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param array $_GET Array of HTTP GET variables. |
42 | 42 | */ |
43 | - do_action( "give_{$_get_action}", $_GET ); |
|
43 | + do_action("give_{$_get_action}", $_GET); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | } |
47 | 47 | |
48 | -add_action( 'init', 'give_get_actions' ); |
|
49 | -add_action( 'admin_init', 'give_get_actions' ); |
|
48 | +add_action('init', 'give_get_actions'); |
|
49 | +add_action('admin_init', 'give_get_actions'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Hooks Give actions, when present in the $_POST superglobal. Every give_action |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function give_post_actions() { |
61 | 61 | |
62 | - $_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null; |
|
62 | + $_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null; |
|
63 | 63 | |
64 | 64 | |
65 | 65 | // Add backward compatibility to give-action param ( $_GET or $_POST ) |
66 | - if( doing_action( 'admin_init' ) && empty( $_post_action ) ) { |
|
67 | - $_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null; |
|
66 | + if (doing_action('admin_init') && empty($_post_action)) { |
|
67 | + $_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null; |
|
68 | 68 | } |
69 | 69 | |
70 | - if ( isset( $_post_action ) ) { |
|
70 | + if (isset($_post_action)) { |
|
71 | 71 | /** |
72 | 72 | * Fires in WordPress init or admin init, when give_action is present in $_POST. |
73 | 73 | * |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @param array $_POST Array of HTTP POST variables. |
77 | 77 | */ |
78 | - do_action( "give_{$_post_action}", $_POST ); |
|
78 | + do_action("give_{$_post_action}", $_POST); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'init', 'give_post_actions' ); |
|
84 | -add_action( 'admin_init', 'give_post_actions' ); |
|
83 | +add_action('init', 'give_post_actions'); |
|
84 | +add_action('admin_init', 'give_post_actions'); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Connect WordPress user with Donor. |
@@ -91,27 +91,27 @@ discard block |
||
91 | 91 | * @param array $user_data User Data |
92 | 92 | * @return void |
93 | 93 | */ |
94 | -function give_connect_donor_to_wpuser( $user_id, $user_data ){ |
|
95 | - $donor = new Give_Customer( $user_data['user_email'] ); |
|
94 | +function give_connect_donor_to_wpuser($user_id, $user_data) { |
|
95 | + $donor = new Give_Customer($user_data['user_email']); |
|
96 | 96 | |
97 | 97 | // Validate donor id and check if do nor is already connect to wp user or not. |
98 | - if( $donor->id && ! $donor->user_id ) { |
|
98 | + if ($donor->id && ! $donor->user_id) { |
|
99 | 99 | |
100 | 100 | // Update donor user_id. |
101 | - if( $donor->update( array( 'user_id' => $user_id ) ) ) { |
|
102 | - $donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id ); |
|
103 | - $donor->add_note( $donor_note ); |
|
101 | + if ($donor->update(array('user_id' => $user_id))) { |
|
102 | + $donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id); |
|
103 | + $donor->add_note($donor_note); |
|
104 | 104 | |
105 | 105 | // Update user_id meta in payments. |
106 | - if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) { |
|
107 | - foreach ( $donations as $donation ) { |
|
108 | - update_post_meta( $donation, '_give_payment_user_id', $user_id ); |
|
106 | + if ( ! empty($donor->payment_ids) && ($donations = explode(',', $donor->payment_ids))) { |
|
107 | + foreach ($donations as $donation) { |
|
108 | + update_post_meta($donation, '_give_payment_user_id', $user_id); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
114 | -add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 ); |
|
114 | +add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | /** |
@@ -125,21 +125,21 @@ discard block |
||
125 | 125 | function give_validate_license_when_site_migrated() { |
126 | 126 | // Store current site address if not already stored. |
127 | 127 | $homeurl = home_url(); |
128 | - if( ! get_option( 'give_site_address_before_migrate' ) ) { |
|
128 | + if ( ! get_option('give_site_address_before_migrate')) { |
|
129 | 129 | // Update site address. |
130 | - update_option( 'give_site_address_before_migrate', $homeurl ); |
|
130 | + update_option('give_site_address_before_migrate', $homeurl); |
|
131 | 131 | |
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if( $homeurl !== get_option( 'give_site_address_before_migrate' ) ) { |
|
135 | + if ($homeurl !== get_option('give_site_address_before_migrate')) { |
|
136 | 136 | // Immediately run cron. |
137 | - wp_schedule_single_event( time() , 'give_validate_license_when_site_migrated' ); |
|
137 | + wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated'); |
|
138 | 138 | |
139 | 139 | // Update site address. |
140 | - update_option( 'give_site_address_before_migrate', home_url() ); |
|
140 | + update_option('give_site_address_before_migrate', home_url()); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | } |
144 | -add_action( 'init', 'give_validate_license_when_site_migrated' ); |
|
145 | -add_action( 'admin_init', 'give_validate_license_when_site_migrated' ); |
|
144 | +add_action('init', 'give_validate_license_when_site_migrated'); |
|
145 | +add_action('admin_init', 'give_validate_license_when_site_migrated'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_register_dashboard_widgets() { |
24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
25 | - wp_add_dashboard_widget( 'give_dashboard_sales', esc_html__( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
25 | + wp_add_dashboard_widget('give_dashboard_sales', esc_html__('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function give_dashboard_sales_widget() { |
40 | 40 | |
41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | $stats = new Give_Payment_Stats; ?> |
@@ -46,27 +46,27 @@ discard block |
||
46 | 46 | <div class="give-dashboard-widget"> |
47 | 47 | |
48 | 48 | <div class="give-dashboard-today give-clearfix"> |
49 | - <h3 class="give-dashboard-date-today"><?php echo date( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3> |
|
49 | + <h3 class="give-dashboard-date-today"><?php echo date(_x('F j, Y', 'dashboard widget', 'give')); ?></h3> |
|
50 | 50 | |
51 | 51 | <p class="give-dashboard-happy-day"><?php |
52 | 52 | printf( |
53 | 53 | /* translators: %s: day of the week */ |
54 | - esc_html__( 'Happy %s!', 'give' ), |
|
55 | - date( 'l', current_time( 'timestamp' ) ) |
|
54 | + esc_html__('Happy %s!', 'give'), |
|
55 | + date('l', current_time('timestamp')) |
|
56 | 56 | ); |
57 | 57 | ?></p> |
58 | 58 | |
59 | 59 | <p class="give-dashboard-today-earnings"><?php |
60 | - $earnings_today = $stats->get_earnings( 0, 'today', false ); |
|
61 | - echo give_currency_filter( give_format_amount( $earnings_today ) ); |
|
60 | + $earnings_today = $stats->get_earnings(0, 'today', false); |
|
61 | + echo give_currency_filter(give_format_amount($earnings_today)); |
|
62 | 62 | ?></p> |
63 | 63 | |
64 | 64 | <p class="give-orders-today"><?php |
65 | - $donations_today = $stats->get_sales( 0, 'today', false ); |
|
65 | + $donations_today = $stats->get_sales(0, 'today', false); |
|
66 | 66 | printf( |
67 | 67 | /* translators: %s: daily donation count */ |
68 | - esc_html__( '%s donations today', 'give' ), |
|
69 | - give_format_amount( $donations_today, false ) |
|
68 | + esc_html__('%s donations today', 'give'), |
|
69 | + give_format_amount($donations_today, false) |
|
70 | 70 | ); |
71 | 71 | ?></p> |
72 | 72 | |
@@ -76,34 +76,34 @@ discard block |
||
76 | 76 | <table class="give-table-stats"> |
77 | 77 | <thead style="display: none;"> |
78 | 78 | <tr> |
79 | - <th><?php esc_html_e( 'This Week', 'give' ); ?></th> |
|
80 | - <th><?php esc_html_e( 'This Month', 'give' ); ?></th> |
|
81 | - <th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th> |
|
79 | + <th><?php esc_html_e('This Week', 'give'); ?></th> |
|
80 | + <th><?php esc_html_e('This Month', 'give'); ?></th> |
|
81 | + <th><?php esc_html_e('Past 30 Days', 'give'); ?></th> |
|
82 | 82 | </tr> |
83 | 83 | </thead> |
84 | 84 | <tbody> |
85 | 85 | <tr id="give-table-stats-tr-1"> |
86 | 86 | <td> |
87 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p> |
|
87 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p> |
|
88 | 88 | |
89 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Week', 'give' ); ?></p> |
|
89 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('This Week', 'give'); ?></p> |
|
90 | 90 | </td> |
91 | 91 | <td> |
92 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p> |
|
92 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p> |
|
93 | 93 | |
94 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Month', 'give' ); ?></p> |
|
94 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('This Month', 'give'); ?></p> |
|
95 | 95 | </td> |
96 | 96 | </tr> |
97 | 97 | <tr id="give-table-stats-tr-2"> |
98 | 98 | <td> |
99 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p> |
|
99 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p> |
|
100 | 100 | |
101 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'Last Month', 'give' ); ?></p> |
|
101 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('Last Month', 'give'); ?></p> |
|
102 | 102 | </td> |
103 | 103 | <td> |
104 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p> |
|
104 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p> |
|
105 | 105 | |
106 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Year', 'give' ); ?></p> |
|
106 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('This Year', 'give'); ?></p> |
|
107 | 107 | </td> |
108 | 108 | </tr> |
109 | 109 | </tbody> |
@@ -123,23 +123,23 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return array |
125 | 125 | */ |
126 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
127 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
126 | +function give_dashboard_at_a_glance_widget($items) { |
|
127 | + $num_posts = wp_count_posts('give_forms'); |
|
128 | 128 | |
129 | - if ( $num_posts && $num_posts->publish ) { |
|
129 | + if ($num_posts && $num_posts->publish) { |
|
130 | 130 | |
131 | 131 | $text = sprintf( |
132 | 132 | /* translators: %s: number of posts published */ |
133 | - _n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ), |
|
133 | + _n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'), |
|
134 | 134 | $num_posts->publish |
135 | 135 | ); |
136 | 136 | |
137 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
137 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
138 | 138 | |
139 | - if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
139 | + if (current_user_can('edit_give_forms', get_current_user_id())) { |
|
140 | 140 | $text = sprintf( |
141 | 141 | '<a class="give-forms-count" href="%1$s">%2$s</a>', |
142 | - admin_url( 'edit.php?post_type=give_forms' ), |
|
142 | + admin_url('edit.php?post_type=give_forms'), |
|
143 | 143 | $text |
144 | 144 | ); |
145 | 145 | } else { |
@@ -155,4 +155,4 @@ discard block |
||
155 | 155 | return $items; |
156 | 156 | } |
157 | 157 | |
158 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 ); |
|
158 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
@@ -66,23 +66,23 @@ discard block |
||
66 | 66 | * @param $args |
67 | 67 | * |
68 | 68 | */ |
69 | - public function __construct( $args ) { |
|
69 | + public function __construct($args) { |
|
70 | 70 | |
71 | 71 | //Only for admins. |
72 | - if ( ! is_admin() ) { |
|
72 | + if ( ! is_admin()) { |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | 76 | //This plugin is en_US native. |
77 | 77 | $this->locale = get_locale(); |
78 | - if ( 'en_US' === $this->locale ) { |
|
78 | + if ('en_US' === $this->locale) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - $this->init( $args ); |
|
82 | + $this->init($args); |
|
83 | 83 | |
84 | - if ( ! $this->hide_promo() ) { |
|
85 | - add_action( $this->hook, array( $this, 'promo' ) ); |
|
84 | + if ( ! $this->hide_promo()) { |
|
85 | + add_action($this->hook, array($this, 'promo')); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @param array $args |
95 | 95 | */ |
96 | - private function init( $args ) { |
|
97 | - foreach ( $args as $key => $arg ) { |
|
96 | + private function init($args) { |
|
97 | + foreach ($args as $key => $arg) { |
|
98 | 98 | $this->$key = $arg; |
99 | 99 | } |
100 | 100 | |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | * @return bool |
109 | 109 | */ |
110 | 110 | private function hide_promo() { |
111 | - $hide_promo = get_transient( 'give_i18n_give_promo_hide' ); |
|
112 | - if ( ! $hide_promo ) { |
|
113 | - if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) { |
|
111 | + $hide_promo = get_transient('give_i18n_give_promo_hide'); |
|
112 | + if ( ! $hide_promo) { |
|
113 | + if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) { |
|
114 | 114 | // No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc. |
115 | - set_transient( 'give_i18n_give_promo_hide', true ); |
|
115 | + set_transient('give_i18n_give_promo_hide', true); |
|
116 | 116 | $hide_promo = true; |
117 | 117 | } |
118 | 118 | } |
@@ -131,20 +131,20 @@ discard block |
||
131 | 131 | $message = false; |
132 | 132 | |
133 | 133 | //Using a translation less than 90% complete. |
134 | - if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) { |
|
135 | - $message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give' ); |
|
136 | - } elseif ( ! $this->translation_loaded && $this->translation_exists ) { |
|
137 | - $message = __( 'You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' ); |
|
138 | - } elseif ( ! $this->translation_exists ) { |
|
139 | - $message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give' ); |
|
134 | + if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) { |
|
135 | + $message = __('As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give'); |
|
136 | + } elseif ( ! $this->translation_loaded && $this->translation_exists) { |
|
137 | + $message = __('You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give'); |
|
138 | + } elseif ( ! $this->translation_exists) { |
|
139 | + $message = __('You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | //Links. |
143 | - $registration_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) ); |
|
144 | - $translations_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__( 'complete the translation', 'give' ) ); |
|
143 | + $registration_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give')); |
|
144 | + $translations_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__('complete the translation', 'give')); |
|
145 | 145 | |
146 | 146 | //Message. |
147 | - $message = sprintf( $message, esc_html( $this->locale_name ), esc_html( 'Give' ), $this->percent_translated, $registration_link, $translations_link ); |
|
147 | + $message = sprintf($message, esc_html($this->locale_name), esc_html('Give'), $this->percent_translated, $registration_link, $translations_link); |
|
148 | 148 | |
149 | 149 | |
150 | 150 | return $message; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $this->translation_details(); |
160 | 160 | $message = $this->promo_message(); |
161 | 161 | |
162 | - if ( $message ) { ?> |
|
162 | + if ($message) { ?> |
|
163 | 163 | |
164 | 164 | <style> |
165 | 165 | /* Banner specific styles */ |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | <a href="https://wordpress.org/support/register.php" class="alignleft give-i18n-icon" style="margin:0" target="_blank"><span class="dashicons dashicons-translation" style="font-size: 110px; text-decoration: none;"></span></a> |
213 | 213 | |
214 | 214 | <div class="give-i18n-notice-content"> |
215 | - <a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
215 | + <a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
216 | 216 | |
217 | - <h2 style="margin: 10px 0;"><?php printf( esc_html__( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2> |
|
217 | + <h2 style="margin: 10px 0;"><?php printf(esc_html__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2> |
|
218 | 218 | <p><?php echo $message; ?></p> |
219 | 219 | <p> |
220 | - <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now »', 'give' ); ?></a> |
|
220 | + <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now »', 'give'); ?></a> |
|
221 | 221 | </p> |
222 | 222 | </div> |
223 | 223 | </div> |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | */ |
235 | 235 | private function find_or_initialize_translation_details() { |
236 | 236 | |
237 | - $set = get_transient( 'give_i18n_give_' . $this->locale ); |
|
237 | + $set = get_transient('give_i18n_give_'.$this->locale); |
|
238 | 238 | |
239 | - if ( ! $set ) { |
|
239 | + if ( ! $set) { |
|
240 | 240 | $set = $this->retrieve_translation_details(); |
241 | - set_transient( 'give_i18n_give_' . $this->locale, $set, DAY_IN_SECONDS ); |
|
241 | + set_transient('give_i18n_give_'.$this->locale, $set, DAY_IN_SECONDS); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | return $set; |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | private function translation_details() { |
253 | 253 | $set = $this->find_or_initialize_translation_details(); |
254 | 254 | |
255 | - $this->translation_exists = ! is_null( $set ); |
|
256 | - $this->translation_loaded = is_textdomain_loaded( 'give' ); |
|
255 | + $this->translation_exists = ! is_null($set); |
|
256 | + $this->translation_loaded = is_textdomain_loaded('give'); |
|
257 | 257 | |
258 | - $this->parse_translation_set( $set ); |
|
258 | + $this->parse_translation_set($set); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -267,26 +267,26 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function retrieve_translation_details() { |
269 | 269 | |
270 | - $api_url = trailingslashit( $this->glotpress_url ); |
|
270 | + $api_url = trailingslashit($this->glotpress_url); |
|
271 | 271 | |
272 | - $resp = wp_remote_get( $api_url ); |
|
272 | + $resp = wp_remote_get($api_url); |
|
273 | 273 | |
274 | - if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) { |
|
274 | + if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') { |
|
275 | 275 | return null; |
276 | 276 | } |
277 | 277 | |
278 | - $body = wp_remote_retrieve_body( $resp ); |
|
279 | - unset( $resp ); |
|
278 | + $body = wp_remote_retrieve_body($resp); |
|
279 | + unset($resp); |
|
280 | 280 | |
281 | - if ( $body ) { |
|
282 | - $body = json_decode( $body ); |
|
281 | + if ($body) { |
|
282 | + $body = json_decode($body); |
|
283 | 283 | |
284 | - foreach ( $body->translation_sets as $set ) { |
|
285 | - if ( ! property_exists( $set, 'wp_locale' ) ) { |
|
284 | + foreach ($body->translation_sets as $set) { |
|
285 | + if ( ! property_exists($set, 'wp_locale')) { |
|
286 | 286 | continue; |
287 | 287 | } |
288 | 288 | |
289 | - if ( $this->locale == $set->wp_locale ) { |
|
289 | + if ($this->locale == $set->wp_locale) { |
|
290 | 290 | return $set; |
291 | 291 | } |
292 | 292 | } |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @access private |
304 | 304 | */ |
305 | - private function parse_translation_set( $set ) { |
|
306 | - if ( $this->translation_exists && is_object( $set ) ) { |
|
305 | + private function parse_translation_set($set) { |
|
306 | + if ($this->translation_exists && is_object($set)) { |
|
307 | 307 | $this->locale_name = $set->name; |
308 | 308 | $this->percent_translated = $set->percent_translated; |
309 | 309 | } else { |
@@ -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 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | public function __construct() { |
62 | 62 | |
63 | 63 | // Set parent defaults |
64 | - parent::__construct( array( |
|
65 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
66 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
64 | + parent::__construct(array( |
|
65 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
66 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
67 | 67 | 'ajax' => false // Does this table support ajax? |
68 | - ) ); |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function search_box( $text, $input_id ) { |
|
84 | - $input_id = $input_id . '-search-input'; |
|
83 | + public function search_box($text, $input_id) { |
|
84 | + $input_id = $input_id.'-search-input'; |
|
85 | 85 | |
86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
87 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
87 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
88 | 88 | } |
89 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
90 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
89 | + if ( ! empty($_REQUEST['order'])) { |
|
90 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
91 | 91 | } |
92 | 92 | ?> |
93 | 93 | <p class="search-box" role="search"> |
94 | 94 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
95 | 95 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
96 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
96 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
97 | 97 | </p> |
98 | 98 | <?php |
99 | 99 | } |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string Column Name. |
111 | 111 | */ |
112 | - public function column_default( $item, $column_name ) { |
|
113 | - switch ( $column_name ) { |
|
112 | + public function column_default($item, $column_name) { |
|
113 | + switch ($column_name) { |
|
114 | 114 | |
115 | 115 | case 'num_purchases' : |
116 | - $value = '<a href="' . |
|
117 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
118 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
116 | + $value = '<a href="'. |
|
117 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
118 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
119 | 119 | break; |
120 | 120 | |
121 | 121 | case 'amount_spent' : |
122 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
122 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
123 | 123 | break; |
124 | 124 | |
125 | 125 | case 'date_created' : |
126 | - $value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) ); |
|
126 | + $value = date_i18n(give_date_format(), strtotime($item['date_created'])); |
|
127 | 127 | break; |
128 | 128 | |
129 | 129 | default: |
130 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
130 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
134 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - public function column_name( $item ) { |
|
146 | - $name = '#' . $item['id'] . ' '; |
|
147 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
148 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
149 | - $actions = $this->get_row_actions( $item ); |
|
145 | + public function column_name($item) { |
|
146 | + $name = '#'.$item['id'].' '; |
|
147 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
148 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
149 | + $actions = $this->get_row_actions($item); |
|
150 | 150 | |
151 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
151 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function get_columns() { |
162 | 162 | $columns = array( |
163 | - 'name' => esc_html__( 'Name', 'give' ), |
|
164 | - 'email' => esc_html__( 'Email', 'give' ), |
|
165 | - 'num_purchases' => esc_html__( 'Donations', 'give' ), |
|
166 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
167 | - 'date_created' => esc_html__( 'Date Created', 'give' ) |
|
163 | + 'name' => esc_html__('Name', 'give'), |
|
164 | + 'email' => esc_html__('Email', 'give'), |
|
165 | + 'num_purchases' => esc_html__('Donations', 'give'), |
|
166 | + 'amount_spent' => esc_html__('Total Donated', 'give'), |
|
167 | + 'date_created' => esc_html__('Date Created', 'give') |
|
168 | 168 | ); |
169 | 169 | |
170 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
170 | + return apply_filters('give_report_customer_columns', $columns); |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function get_sortable_columns() { |
182 | 182 | return array( |
183 | - 'date_created' => array( 'date_created', true ), |
|
184 | - 'name' => array( 'name', true ), |
|
185 | - 'num_purchases' => array( 'purchase_count', false ), |
|
186 | - 'amount_spent' => array( 'purchase_value', false ), |
|
183 | + 'date_created' => array('date_created', true), |
|
184 | + 'name' => array('name', true), |
|
185 | + 'num_purchases' => array('purchase_count', false), |
|
186 | + 'amount_spent' => array('purchase_value', false), |
|
187 | 187 | ); |
188 | 188 | } |
189 | 189 | |
@@ -195,34 +195,34 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return array An array of action links. |
197 | 197 | */ |
198 | - public function get_row_actions( $item ) { |
|
198 | + public function get_row_actions($item) { |
|
199 | 199 | |
200 | 200 | $actions = array( |
201 | 201 | |
202 | 202 | 'view' => sprintf( |
203 | 203 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
204 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ), |
|
205 | - sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ), |
|
206 | - esc_html__( 'View Donor', 'give' ) |
|
204 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']), |
|
205 | + sprintf(esc_attr__('View "%s"', 'give'), $item['name']), |
|
206 | + esc_html__('View Donor', 'give') |
|
207 | 207 | ), |
208 | 208 | |
209 | 209 | 'notes' => sprintf( |
210 | 210 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
211 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ), |
|
212 | - sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ), |
|
213 | - esc_html__( 'Notes', 'give' ) |
|
211 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']), |
|
212 | + sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']), |
|
213 | + esc_html__('Notes', 'give') |
|
214 | 214 | ), |
215 | 215 | |
216 | 216 | 'delete' => sprintf( |
217 | 217 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
218 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), |
|
219 | - sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ), |
|
220 | - esc_html__( 'Delete', 'give' ) |
|
218 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), |
|
219 | + sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']), |
|
220 | + esc_html__('Delete', 'give') |
|
221 | 221 | ) |
222 | 222 | |
223 | 223 | ); |
224 | 224 | |
225 | - return apply_filters( 'give_donor_row_actions', $actions, $item ); |
|
225 | + return apply_filters('give_donor_row_actions', $actions, $item); |
|
226 | 226 | |
227 | 227 | } |
228 | 228 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @since 1.0 |
234 | 234 | * @return void |
235 | 235 | */ |
236 | - public function bulk_actions( $which = '' ) { |
|
236 | + public function bulk_actions($which = '') { |
|
237 | 237 | // These aren't really bulk actions but this outputs the markup in the right place. |
238 | 238 | } |
239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return int Current page number. |
246 | 246 | */ |
247 | 247 | public function get_paged() { |
248 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
248 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return mixed string If search is present, false otherwise. |
257 | 257 | */ |
258 | 258 | public function get_search() { |
259 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
259 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | |
274 | 274 | $data = array(); |
275 | 275 | $paged = $this->get_paged(); |
276 | - $offset = $this->per_page * ( $paged - 1 ); |
|
276 | + $offset = $this->per_page * ($paged - 1); |
|
277 | 277 | $search = $this->get_search(); |
278 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
279 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
278 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
279 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
280 | 280 | |
281 | 281 | $args = array( |
282 | 282 | 'number' => $this->per_page, |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | 'orderby' => $orderby |
286 | 286 | ); |
287 | 287 | |
288 | - if ( is_email( $search ) ) { |
|
288 | + if (is_email($search)) { |
|
289 | 289 | $args['email'] = $search; |
290 | - } elseif ( is_numeric( $search ) ) { |
|
290 | + } elseif (is_numeric($search)) { |
|
291 | 291 | $args['id'] = $search; |
292 | 292 | } else { |
293 | 293 | $args['name'] = $search; |
294 | 294 | } |
295 | 295 | |
296 | - $customers = Give()->customers->get_customers( $args ); |
|
296 | + $customers = Give()->customers->get_customers($args); |
|
297 | 297 | |
298 | - if ( $customers ) { |
|
298 | + if ($customers) { |
|
299 | 299 | |
300 | - foreach ( $customers as $customer ) { |
|
300 | + foreach ($customers as $customer) { |
|
301 | 301 | |
302 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
302 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
303 | 303 | |
304 | 304 | $data[] = array( |
305 | 305 | 'id' => $customer->id, |
@@ -333,16 +333,16 @@ discard block |
||
333 | 333 | $hidden = array(); // No hidden columns |
334 | 334 | $sortable = $this->get_sortable_columns(); |
335 | 335 | |
336 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
336 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
337 | 337 | |
338 | 338 | $this->items = $this->reports_data(); |
339 | 339 | |
340 | 340 | $this->total = give_count_total_customers(); |
341 | 341 | |
342 | - $this->set_pagination_args( array( |
|
342 | + $this->set_pagination_args(array( |
|
343 | 343 | 'total_items' => $this->total, |
344 | 344 | 'per_page' => $this->per_page, |
345 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
346 | - ) ); |
|
345 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
346 | + )); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | \ No newline at end of file |
@@ -173,8 +173,8 @@ |
||
173 | 173 | |
174 | 174 | case 'num_purchases' : |
175 | 175 | $value = '<a href="' . |
176 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
177 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
176 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
177 | + ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case 'amount_spent' : |
@@ -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,7 +67,7 @@ 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(); |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - do_action( 'give_donors_table_top' ); |
|
83 | + do_action('give_donors_table_top'); |
|
84 | 84 | ?> |
85 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
85 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
86 | 86 | <?php |
87 | - $customers_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' ); |
|
87 | + $customers_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors'); |
|
88 | 88 | $customers_table->display(); |
89 | 89 | ?> |
90 | 90 | <input type="hidden" name="post_type" value="give_forms" /> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 1.0 |
99 | 99 | */ |
100 | - do_action( 'give_donors_table_bottom' ); |
|
100 | + do_action('give_donors_table_bottom'); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | <?php |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return void |
115 | 115 | */ |
116 | -function give_render_customer_view( $view, $callbacks ) { |
|
116 | +function give_render_customer_view($view, $callbacks) { |
|
117 | 117 | |
118 | 118 | $render = true; |
119 | 119 | |
120 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
120 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
121 | 121 | |
122 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
123 | - give_set_error( 'give-no-access', esc_html__( 'You are not permitted to view this data.', 'give' ) ); |
|
122 | + if ( ! current_user_can($customer_view_role)) { |
|
123 | + give_set_error('give-no-access', esc_html__('You are not permitted to view this data.', 'give')); |
|
124 | 124 | $render = false; |
125 | 125 | } |
126 | 126 | |
127 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
128 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
127 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
128 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give')); |
|
129 | 129 | $render = false; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $customer_id = (int) $_GET['id']; |
133 | - $customer = new Give_Customer( $customer_id ); |
|
133 | + $customer = new Give_Customer($customer_id); |
|
134 | 134 | |
135 | - if ( empty( $customer->id ) ) { |
|
136 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
135 | + if (empty($customer->id)) { |
|
136 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give')); |
|
137 | 137 | $render = false; |
138 | 138 | } |
139 | 139 | |
@@ -142,34 +142,34 @@ discard block |
||
142 | 142 | |
143 | 143 | <div class='wrap'> |
144 | 144 | |
145 | - <?php if ( give_get_errors() ) : ?> |
|
145 | + <?php if (give_get_errors()) : ?> |
|
146 | 146 | <div class="error settings-error"> |
147 | - <?php give_print_errors( 0 ); ?> |
|
147 | + <?php give_print_errors(0); ?> |
|
148 | 148 | </div> |
149 | 149 | <?php endif; ?> |
150 | 150 | |
151 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Donor', 'give' ); ?></h1> |
|
151 | + <h1 class="screen-reader-text"><?php esc_html_e('Donor', 'give'); ?></h1> |
|
152 | 152 | |
153 | - <?php if ( $customer && $render ) : ?> |
|
153 | + <?php if ($customer && $render) : ?> |
|
154 | 154 | |
155 | 155 | <h2 class="nav-tab-wrapper"> |
156 | 156 | <?php |
157 | - foreach ( $customer_tabs as $key => $tab ) : |
|
157 | + foreach ($customer_tabs as $key => $tab) : |
|
158 | 158 | $active = $key === $view ? true : false; |
159 | 159 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
160 | 160 | printf( |
161 | 161 | '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
162 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ), |
|
163 | - esc_attr( $class ), |
|
164 | - sanitize_html_class( $tab['dashicon'] ), |
|
165 | - esc_html( $tab['title'] ) |
|
162 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)), |
|
163 | + esc_attr($class), |
|
164 | + sanitize_html_class($tab['dashicon']), |
|
165 | + esc_html($tab['title']) |
|
166 | 166 | ); |
167 | 167 | endforeach; |
168 | 168 | ?> |
169 | 169 | </h2> |
170 | 170 | |
171 | 171 | <div id="give-customer-card-wrapper"> |
172 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
172 | + <?php $callbacks[$view]($customer) ?> |
|
173 | 173 | </div> |
174 | 174 | |
175 | 175 | <?php endif; ?> |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return void |
191 | 191 | */ |
192 | -function give_customers_view( $customer ) { |
|
192 | +function give_customers_view($customer) { |
|
193 | 193 | |
194 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
194 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Fires in donor profile screen, above the donor card. |
@@ -200,32 +200,32 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param object $customer The customer object being displayed. |
202 | 202 | */ |
203 | - do_action( 'give_donor_card_top', $customer ); |
|
203 | + do_action('give_donor_card_top', $customer); |
|
204 | 204 | ?> |
205 | 205 | |
206 | 206 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
207 | 207 | |
208 | - <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 ); ?>"> |
|
208 | + <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); ?>"> |
|
209 | 209 | |
210 | 210 | <div class="customer-info"> |
211 | 211 | |
212 | 212 | <div class="donor-bio-header clearfix"> |
213 | 213 | |
214 | 214 | <div class="avatar-wrap left" id="customer-avatar"> |
215 | - <?php echo get_avatar( $customer->email ); ?> |
|
215 | + <?php echo get_avatar($customer->email); ?> |
|
216 | 216 | </div> |
217 | 217 | |
218 | 218 | <div id="customer-name-wrap" class="left"> |
219 | 219 | <span class="customer-id">#<?php echo $customer->id; ?></span> |
220 | - <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 esc_attr_e( 'Donor Name', 'give' ); ?>" /></span> |
|
220 | + <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 esc_attr_e('Donor Name', 'give'); ?>" /></span> |
|
221 | 221 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
222 | 222 | </div> |
223 | 223 | <p class="customer-since info-item"> |
224 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
225 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
224 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
225 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
226 | 226 | </p> |
227 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
228 | - <a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a> |
|
227 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
228 | + <a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a> |
|
229 | 229 | <?php endif; ?> |
230 | 230 | </div> |
231 | 231 | <!-- /donor-bio-header --> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | <table class="widefat"> |
236 | 236 | <tbody> |
237 | 237 | <tr class="alternate"> |
238 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'User ID:', 'give' ); ?></label></th> |
|
238 | + <th scope="col"><label for="tablecell"><?php esc_html_e('User ID:', 'give'); ?></label></th> |
|
239 | 239 | <td class="row-title"> |
240 | 240 | <span class="customer-user-id info-item edit-item"> |
241 | 241 | <?php |
@@ -251,38 +251,38 @@ discard block |
||
251 | 251 | 'data' => $data_atts, |
252 | 252 | ); |
253 | 253 | |
254 | - if ( ! empty( $user_id ) ) { |
|
255 | - $userdata = get_userdata( $user_id ); |
|
254 | + if ( ! empty($user_id)) { |
|
255 | + $userdata = get_userdata($user_id); |
|
256 | 256 | $user_args['value'] = $userdata->user_login; |
257 | 257 | } |
258 | 258 | |
259 | - echo Give()->html->ajax_user_search( $user_args ); |
|
259 | + echo Give()->html->ajax_user_search($user_args); |
|
260 | 260 | ?> |
261 | 261 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
262 | 262 | </span> |
263 | 263 | |
264 | 264 | <span class="customer-user-id info-item editable"> |
265 | - <?php if ( intval( $customer->user_id ) > 0 ) { ?> |
|
265 | + <?php if (intval($customer->user_id) > 0) { ?> |
|
266 | 266 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
267 | 267 | <?php } else { ?> |
268 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
268 | + <span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span> |
|
269 | 269 | <?php } ?> |
270 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) { ?> |
|
271 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e( 'Disconnects the current user ID from this customer record.', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
|
270 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) { ?> |
|
271 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e('Disconnects the current user ID from this customer record.', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span> |
|
272 | 272 | <?php } ?> |
273 | 273 | </span> |
274 | 274 | </td> |
275 | 275 | </tr> |
276 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
276 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
277 | 277 | |
278 | 278 | <tr> |
279 | - <th scope="col"><?php esc_html_e( 'Address:', 'give' ); ?></th> |
|
279 | + <th scope="col"><?php esc_html_e('Address:', 'give'); ?></th> |
|
280 | 280 | <td class="row-title"> |
281 | 281 | |
282 | 282 | <div class="customer-address-wrapper"> |
283 | 283 | |
284 | 284 | <?php |
285 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
285 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
286 | 286 | $defaults = array( |
287 | 287 | 'line1' => '', |
288 | 288 | 'line2' => '', |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | 'zip' => '' |
293 | 293 | ); |
294 | 294 | |
295 | - $address = wp_parse_args( $address, $defaults ); |
|
295 | + $address = wp_parse_args($address, $defaults); |
|
296 | 296 | ?> |
297 | 297 | |
298 | - <?php if ( ! empty( $address ) ) { ?> |
|
298 | + <?php if ( ! empty($address)) { ?> |
|
299 | 299 | <span class="customer-address info-item editable"> |
300 | 300 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
301 | 301 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -306,43 +306,43 @@ discard block |
||
306 | 306 | </span> |
307 | 307 | <?php } ?> |
308 | 308 | <span class="customer-address info-item edit-item"> |
309 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
310 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
311 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
309 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
310 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
311 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
312 | 312 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
313 | 313 | <?php |
314 | 314 | |
315 | 315 | $selected_country = $address['country']; |
316 | 316 | |
317 | 317 | $countries = give_get_country_list(); |
318 | - foreach ( $countries as $country_code => $country ) { |
|
319 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
318 | + foreach ($countries as $country_code => $country) { |
|
319 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
320 | 320 | } |
321 | 321 | ?> |
322 | 322 | </select> |
323 | 323 | <?php |
324 | 324 | $selected_state = give_get_state(); |
325 | - $states = give_get_states( $selected_country ); |
|
325 | + $states = give_get_states($selected_country); |
|
326 | 326 | |
327 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
327 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
328 | 328 | |
329 | - if ( ! empty( $states ) ) { |
|
329 | + if ( ! empty($states)) { |
|
330 | 330 | ?> |
331 | 331 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
332 | 332 | <?php |
333 | - foreach ( $states as $state_code => $state ) { |
|
334 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
333 | + foreach ($states as $state_code => $state) { |
|
334 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
335 | 335 | } |
336 | 336 | ?> |
337 | 337 | </select> |
338 | 338 | <?php |
339 | 339 | } else { |
340 | 340 | ?> |
341 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
341 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" /> |
|
342 | 342 | <?php |
343 | 343 | } |
344 | 344 | ?> |
345 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
345 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
346 | 346 | </span> |
347 | 347 | |
348 | 348 | </div> |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | |
359 | 359 | <span id="customer-edit-actions" class="edit-item"> |
360 | 360 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
361 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
361 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
362 | 362 | <input type="hidden" name="give_action" value="edit-customer" /> |
363 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" /> |
|
364 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
363 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" /> |
|
364 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
365 | 365 | </span> |
366 | 366 | |
367 | 367 | </form> |
@@ -376,24 +376,24 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param object $customer The customer object being displayed. |
378 | 378 | */ |
379 | - do_action( 'give_donor_before_stats', $customer ); |
|
379 | + do_action('give_donor_before_stats', $customer); |
|
380 | 380 | ?> |
381 | 381 | |
382 | 382 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
383 | 383 | <ul> |
384 | 384 | <li> |
385 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
385 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
386 | 386 | <span class="dashicons dashicons-heart"></span> |
387 | 387 | <?php |
388 | 388 | //Completed Donations |
389 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
390 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
389 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
390 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
391 | 391 | ?> |
392 | 392 | </a> |
393 | 393 | </li> |
394 | 394 | <li> |
395 | 395 | <span class="dashicons dashicons-chart-area"></span> |
396 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?> |
|
396 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?> |
|
397 | 397 | </li> |
398 | 398 | <?php |
399 | 399 | /** |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @param object $customer The customer object being displayed. |
407 | 407 | */ |
408 | - do_action( 'give_donor_stats_list', $customer ); |
|
408 | + do_action('give_donor_stats_list', $customer); |
|
409 | 409 | ?> |
410 | 410 | </ul> |
411 | 411 | </div> |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @param object $customer The customer object being displayed. |
420 | 420 | */ |
421 | - do_action( 'give_donor_before_tables_wrapper', $customer ); |
|
421 | + do_action('give_donor_before_tables_wrapper', $customer); |
|
422 | 422 | ?> |
423 | 423 | |
424 | 424 | <div id="customer-tables-wrapper" class="customer-section"> |
@@ -431,40 +431,40 @@ discard block |
||
431 | 431 | * |
432 | 432 | * @param object $customer The customer object being displayed. |
433 | 433 | */ |
434 | - do_action( 'give_donor_before_tables', $customer ); |
|
434 | + do_action('give_donor_before_tables', $customer); |
|
435 | 435 | ?> |
436 | 436 | |
437 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
437 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
438 | 438 | |
439 | 439 | <table class="wp-list-table widefat striped emails"> |
440 | 440 | <thead> |
441 | 441 | <tr> |
442 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
443 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
442 | + <th><?php _e('Email', 'give'); ?></th> |
|
443 | + <th><?php _e('Actions', 'give'); ?></th> |
|
444 | 444 | </tr> |
445 | 445 | </thead> |
446 | 446 | |
447 | 447 | <tbody> |
448 | - <?php if ( ! empty( $customer->emails ) ) { ?> |
|
448 | + <?php if ( ! empty($customer->emails)) { ?> |
|
449 | 449 | |
450 | - <?php foreach ( $customer->emails as $key => $email ) : ?> |
|
450 | + <?php foreach ($customer->emails as $key => $email) : ?> |
|
451 | 451 | <tr data-key="<?php echo $key; ?>"> |
452 | 452 | <td> |
453 | 453 | <?php echo $email; ?> |
454 | - <?php if ( 'primary' === $key ) : ?> |
|
454 | + <?php if ('primary' === $key) : ?> |
|
455 | 455 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
456 | 456 | <?php endif; ?> |
457 | 457 | </td> |
458 | 458 | <td> |
459 | - <?php if ( 'primary' !== $key ) : ?> |
|
459 | + <?php if ('primary' !== $key) : ?> |
|
460 | 460 | <?php |
461 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); |
|
462 | - $promote_url = wp_nonce_url( add_query_arg( array( 'email' => rawurlencode( $email ), 'give_action' => 'set_donor_primary_email'), $base_url ), 'give-set-donor-primary-email' ); |
|
463 | - $remove_url = wp_nonce_url( add_query_arg( array( 'email' => rawurlencode( $email ), 'give_action' => 'remove_donor_email' ), $base_url ), 'give-remove-donor-email' ); |
|
461 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); |
|
462 | + $promote_url = wp_nonce_url(add_query_arg(array('email' => rawurlencode($email), 'give_action' => 'set_donor_primary_email'), $base_url), 'give-set-donor-primary-email'); |
|
463 | + $remove_url = wp_nonce_url(add_query_arg(array('email' => rawurlencode($email), 'give_action' => 'remove_donor_email'), $base_url), 'give-remove-donor-email'); |
|
464 | 464 | ?> |
465 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
465 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
466 | 466 | | |
467 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
467 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
468 | 468 | <?php endif; ?> |
469 | 469 | </td> |
470 | 470 | </tr> |
@@ -474,56 +474,56 @@ discard block |
||
474 | 474 | <td colspan="2" class="add-customer-email-td"> |
475 | 475 | <div class="add-customer-email-wrapper"> |
476 | 476 | <input type="hidden" name="customer-id" value="<?php echo $customer->id; ?>" /> |
477 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
478 | - <input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" /> |
|
479 | - <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
480 | - <button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
477 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
478 | + <input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" /> |
|
479 | + <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
480 | + <button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e('Add Email', 'give'); ?></button> |
|
481 | 481 | <span class="spinner"></span> |
482 | 482 | </div> |
483 | 483 | <div class="notice-wrap"></div> |
484 | 484 | </td> |
485 | 485 | </tr> |
486 | 486 | <?php } else { ?> |
487 | - <tr><td colspan="2"><?php _e( 'No Emails Found', 'easy-digital-downloads' ); ?></td></tr> |
|
487 | + <tr><td colspan="2"><?php _e('No Emails Found', 'easy-digital-downloads'); ?></td></tr> |
|
488 | 488 | <?php } ?> |
489 | 489 | </tbody> |
490 | 490 | </table> |
491 | 491 | |
492 | - <h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3> |
|
492 | + <h3><?php esc_html_e('Recent Donations', 'give'); ?></h3> |
|
493 | 493 | <?php |
494 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
495 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
496 | - $payments = array_slice( $payments, 0, 10 ); |
|
494 | + $payment_ids = explode(',', $customer->payment_ids); |
|
495 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
496 | + $payments = array_slice($payments, 0, 10); |
|
497 | 497 | ?> |
498 | 498 | <table class="wp-list-table widefat striped payments"> |
499 | 499 | <thead> |
500 | 500 | <tr> |
501 | - <th scope="col"><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
502 | - <th scope="col"><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
503 | - <th scope="col"><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
504 | - <th scope="col"><?php esc_html_e( 'Status', 'give' ); ?></th> |
|
505 | - <th scope="col"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
501 | + <th scope="col"><?php esc_html_e('ID', 'give'); ?></th> |
|
502 | + <th scope="col"><?php esc_html_e('Amount', 'give'); ?></th> |
|
503 | + <th scope="col"><?php esc_html_e('Date', 'give'); ?></th> |
|
504 | + <th scope="col"><?php esc_html_e('Status', 'give'); ?></th> |
|
505 | + <th scope="col"><?php esc_html_e('Actions', 'give'); ?></th> |
|
506 | 506 | </tr> |
507 | 507 | </thead> |
508 | 508 | <tbody> |
509 | - <?php if ( ! empty( $payments ) ) { ?> |
|
510 | - <?php foreach ( $payments as $payment ) : ?> |
|
509 | + <?php if ( ! empty($payments)) { ?> |
|
510 | + <?php foreach ($payments as $payment) : ?> |
|
511 | 511 | <tr> |
512 | 512 | <td><?php echo $payment->ID; ?></td> |
513 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
514 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
515 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
513 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
514 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
515 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
516 | 516 | <td> |
517 | 517 | <?php |
518 | 518 | printf( |
519 | 519 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
520 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ), |
|
520 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID), |
|
521 | 521 | sprintf( |
522 | 522 | /* translators: %s: Donation ID */ |
523 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
523 | + esc_attr__('View Donation %s.', 'give'), |
|
524 | 524 | $payment->ID |
525 | 525 | ), |
526 | - esc_html__( 'View Donation', 'give' ) |
|
526 | + esc_html__('View Donation', 'give') |
|
527 | 527 | ); |
528 | 528 | ?> |
529 | 529 | |
@@ -538,46 +538,46 @@ discard block |
||
538 | 538 | * @param object $customer The customer object being displayed. |
539 | 539 | * @param object $payment The payment object being displayed. |
540 | 540 | */ |
541 | - do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); |
|
541 | + do_action('give_donor_recent_purchases_actions', $customer, $payment); |
|
542 | 542 | ?> |
543 | 543 | </td> |
544 | 544 | </tr> |
545 | 545 | <?php endforeach; ?> |
546 | 546 | <?php } else { ?> |
547 | 547 | <tr> |
548 | - <td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td> |
|
548 | + <td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td> |
|
549 | 549 | </tr> |
550 | 550 | <?php } ?> |
551 | 551 | </tbody> |
552 | 552 | </table> |
553 | 553 | |
554 | - <h3><?php esc_html_e( 'Completed Forms', 'give' ); ?></h3> |
|
554 | + <h3><?php esc_html_e('Completed Forms', 'give'); ?></h3> |
|
555 | 555 | <?php |
556 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
556 | + $donations = give_get_users_completed_donations($customer->email); |
|
557 | 557 | ?> |
558 | 558 | <table class="wp-list-table widefat striped donations"> |
559 | 559 | <thead> |
560 | 560 | <tr> |
561 | - <th scope="col"><?php esc_html_e( 'Form', 'give' ); ?></th> |
|
562 | - <th scope="col" width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
561 | + <th scope="col"><?php esc_html_e('Form', 'give'); ?></th> |
|
562 | + <th scope="col" width="120px"><?php esc_html_e('Actions', 'give'); ?></th> |
|
563 | 563 | </tr> |
564 | 564 | </thead> |
565 | 565 | <tbody> |
566 | - <?php if ( ! empty( $donations ) ) { ?> |
|
567 | - <?php foreach ( $donations as $donation ) : ?> |
|
566 | + <?php if ( ! empty($donations)) { ?> |
|
567 | + <?php foreach ($donations as $donation) : ?> |
|
568 | 568 | <tr> |
569 | 569 | <td><?php echo $donation->post_title; ?></td> |
570 | 570 | <td> |
571 | 571 | <?php |
572 | 572 | printf( |
573 | 573 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
574 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
574 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
575 | 575 | sprintf( |
576 | 576 | /* translators: %s: form name */ |
577 | - esc_attr__( 'View Form %s.', 'give' ), |
|
577 | + esc_attr__('View Form %s.', 'give'), |
|
578 | 578 | $donation->post_title |
579 | 579 | ), |
580 | - esc_html__( 'View Form', 'give' ) |
|
580 | + esc_html__('View Form', 'give') |
|
581 | 581 | ); |
582 | 582 | ?> |
583 | 583 | </td> |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | <?php endforeach; ?> |
586 | 586 | <?php } else { ?> |
587 | 587 | <tr> |
588 | - <td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td> |
|
588 | + <td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td> |
|
589 | 589 | </tr> |
590 | 590 | <?php } ?> |
591 | 591 | </tbody> |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | * |
600 | 600 | * @param object $customer The customer object being displayed. |
601 | 601 | */ |
602 | - do_action( 'give_donor_after_tables', $customer ); |
|
602 | + do_action('give_donor_after_tables', $customer); |
|
603 | 603 | ?> |
604 | 604 | |
605 | 605 | </div> |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * |
613 | 613 | * @param object $customer The customer object being displayed. |
614 | 614 | */ |
615 | - do_action( 'give_donor_card_bottom', $customer ); |
|
615 | + do_action('give_donor_card_bottom', $customer); |
|
616 | 616 | |
617 | 617 | } |
618 | 618 | |
@@ -625,30 +625,30 @@ discard block |
||
625 | 625 | * |
626 | 626 | * @return void |
627 | 627 | */ |
628 | -function give_customer_notes_view( $customer ) { |
|
628 | +function give_customer_notes_view($customer) { |
|
629 | 629 | |
630 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
631 | - $paged = absint( $paged ); |
|
630 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
631 | + $paged = absint($paged); |
|
632 | 632 | $note_count = $customer->get_notes_count(); |
633 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
634 | - $total_pages = ceil( $note_count / $per_page ); |
|
635 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
633 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
634 | + $total_pages = ceil($note_count / $per_page); |
|
635 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
636 | 636 | ?> |
637 | 637 | |
638 | 638 | <div id="customer-notes-wrapper"> |
639 | 639 | <div class="customer-notes-header"> |
640 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
640 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
641 | 641 | </div> |
642 | - <h3><?php esc_html_e( 'Notes', 'give' ); ?></h3> |
|
642 | + <h3><?php esc_html_e('Notes', 'give'); ?></h3> |
|
643 | 643 | |
644 | - <?php if ( 1 == $paged ) : ?> |
|
644 | + <?php if (1 == $paged) : ?> |
|
645 | 645 | <div style="display: block; margin-bottom: 55px;"> |
646 | - <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 ); ?>"> |
|
646 | + <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); ?>"> |
|
647 | 647 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
648 | 648 | <br /> |
649 | 649 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
650 | 650 | <input type="hidden" name="give_action" value="add-customer-note" /> |
651 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
651 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
652 | 652 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
653 | 653 | </form> |
654 | 654 | </div> |
@@ -663,26 +663,26 @@ discard block |
||
663 | 663 | 'show_all' => true |
664 | 664 | ); |
665 | 665 | |
666 | - echo paginate_links( $pagination_args ); |
|
666 | + echo paginate_links($pagination_args); |
|
667 | 667 | ?> |
668 | 668 | |
669 | 669 | <div id="give-customer-notes" class="postbox"> |
670 | - <?php if ( count( $customer_notes ) > 0 ) { ?> |
|
671 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
670 | + <?php if (count($customer_notes) > 0) { ?> |
|
671 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
672 | 672 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
673 | 673 | <span class="note-content-wrap"> |
674 | - <?php echo stripslashes( $note ); ?> |
|
674 | + <?php echo stripslashes($note); ?> |
|
675 | 675 | </span> |
676 | 676 | </div> |
677 | 677 | <?php endforeach; ?> |
678 | 678 | <?php } else { ?> |
679 | 679 | <div class="give-no-customer-notes"> |
680 | - <?php esc_html_e( 'No donor notes found.', 'give' ); ?> |
|
680 | + <?php esc_html_e('No donor notes found.', 'give'); ?> |
|
681 | 681 | </div> |
682 | 682 | <?php } ?> |
683 | 683 | </div> |
684 | 684 | |
685 | - <?php echo paginate_links( $pagination_args ); ?> |
|
685 | + <?php echo paginate_links($pagination_args); ?> |
|
686 | 686 | |
687 | 687 | </div> |
688 | 688 | |
@@ -698,9 +698,9 @@ discard block |
||
698 | 698 | * |
699 | 699 | * @return void |
700 | 700 | */ |
701 | -function give_customers_delete_view( $customer ) { |
|
701 | +function give_customers_delete_view($customer) { |
|
702 | 702 | |
703 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
703 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
704 | 704 | |
705 | 705 | /** |
706 | 706 | * Fires in donor delete screen, above the content. |
@@ -709,15 +709,15 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @param object $customer The customer object being displayed. |
711 | 711 | */ |
712 | - do_action( 'give_customer_delete_top', $customer ); |
|
712 | + do_action('give_customer_delete_top', $customer); |
|
713 | 713 | ?> |
714 | 714 | |
715 | 715 | <div class="info-wrapper customer-section"> |
716 | 716 | |
717 | - <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 ); ?>"> |
|
717 | + <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); ?>"> |
|
718 | 718 | |
719 | 719 | <div class="customer-notes-header"> |
720 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
720 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
721 | 721 | </div> |
722 | 722 | |
723 | 723 | |
@@ -725,16 +725,16 @@ discard block |
||
725 | 725 | |
726 | 726 | <span class="delete-customer-options"> |
727 | 727 | <p> |
728 | - <?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?> |
|
729 | - <label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
728 | + <?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?> |
|
729 | + <label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
730 | 730 | </p> |
731 | 731 | |
732 | 732 | <p> |
733 | - <?php echo Give()->html->checkbox( array( |
|
733 | + <?php echo Give()->html->checkbox(array( |
|
734 | 734 | 'name' => 'give-customer-delete-records', |
735 | - 'options' => array( 'disabled' => true ) |
|
736 | - ) ); ?> |
|
737 | - <label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
735 | + 'options' => array('disabled' => true) |
|
736 | + )); ?> |
|
737 | + <label for="give-customer-delete-records"><?php esc_html_e('Delete all associated donations and records?', 'give'); ?></label> |
|
738 | 738 | </p> |
739 | 739 | |
740 | 740 | <?php |
@@ -747,16 +747,16 @@ discard block |
||
747 | 747 | * |
748 | 748 | * @param object $customer The customer object being displayed. |
749 | 749 | */ |
750 | - do_action( 'give_customer_delete_inputs', $customer ); |
|
750 | + do_action('give_customer_delete_inputs', $customer); |
|
751 | 751 | ?> |
752 | 752 | </span> |
753 | 753 | |
754 | 754 | <span id="customer-edit-actions"> |
755 | 755 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
756 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
756 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
757 | 757 | <input type="hidden" name="give_action" value="delete-customer" /> |
758 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" /> |
|
759 | - <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 esc_html_e( 'Cancel', 'give' ); ?></a> |
|
758 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" /> |
|
759 | + <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 esc_html_e('Cancel', 'give'); ?></a> |
|
760 | 760 | </span> |
761 | 761 | |
762 | 762 | </div> |
@@ -772,5 +772,5 @@ discard block |
||
772 | 772 | * |
773 | 773 | * @param object $customer The customer object being displayed. |
774 | 774 | */ |
775 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
775 | + do_action('give_customer_delete_bottom', $customer); |
|
776 | 776 | } |
@@ -173,8 +173,8 @@ |
||
173 | 173 | |
174 | 174 | case 'num_purchases' : |
175 | 175 | $value = '<a href="' . |
176 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
177 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
176 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
177 | + ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case 'amount_spent' : |
@@ -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' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => esc_html__('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 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return false |
85 | 85 | */ |
86 | - public function search_box( $text, $input_id ) { |
|
86 | + public function search_box($text, $input_id) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
@@ -98,20 +98,20 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - public function give_search_box( $text, $input_id ) { |
|
102 | - $input_id = $input_id . '-search-input'; |
|
101 | + public function give_search_box($text, $input_id) { |
|
102 | + $input_id = $input_id.'-search-input'; |
|
103 | 103 | |
104 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
105 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
104 | + if ( ! empty($_REQUEST['orderby'])) { |
|
105 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
106 | 106 | } |
107 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
108 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
107 | + if ( ! empty($_REQUEST['order'])) { |
|
108 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
109 | 109 | } |
110 | 110 | ?> |
111 | 111 | <p class="search-box donor-search" role="search"> |
112 | 112 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
113 | 113 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
114 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
114 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
115 | 115 | </p> |
116 | 116 | <?php |
117 | 117 | } |
@@ -124,29 +124,29 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $which |
126 | 126 | */ |
127 | - protected function display_tablenav( $which ) { |
|
127 | + protected function display_tablenav($which) { |
|
128 | 128 | |
129 | - if ( 'top' == $which ) { |
|
130 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
129 | + if ('top' == $which) { |
|
130 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
131 | 131 | } |
132 | 132 | ?> |
133 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
133 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
134 | 134 | |
135 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donors Report', 'give' ); ?></span></h3> |
|
135 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donors Report', 'give'); ?></span></h3> |
|
136 | 136 | |
137 | 137 | <div class="alignright tablenav-right"> |
138 | 138 | <div class="actions bulkactions"> |
139 | 139 | <?php |
140 | - if ( 'top' == $which ) { |
|
141 | - $this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
|
140 | + if ('top' == $which) { |
|
141 | + $this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search'); |
|
142 | 142 | } |
143 | 143 | |
144 | - $this->bulk_actions( $which ); ?> |
|
144 | + $this->bulk_actions($which); ?> |
|
145 | 145 | |
146 | 146 | </div> |
147 | 147 | <?php |
148 | - $this->extra_tablenav( $which ); |
|
149 | - $this->pagination( $which ); |
|
148 | + $this->extra_tablenav($which); |
|
149 | + $this->pagination($which); |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | |
@@ -168,25 +168,25 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @return string Column Name |
170 | 170 | */ |
171 | - public function column_default( $item, $column_name ) { |
|
172 | - switch ( $column_name ) { |
|
171 | + public function column_default($item, $column_name) { |
|
172 | + switch ($column_name) { |
|
173 | 173 | |
174 | 174 | case 'num_purchases' : |
175 | - $value = '<a href="' . |
|
176 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
177 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
175 | + $value = '<a href="'. |
|
176 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
177 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case 'amount_spent' : |
181 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
181 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
182 | 182 | break; |
183 | 183 | |
184 | 184 | default: |
185 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
185 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
186 | 186 | break; |
187 | 187 | } |
188 | 188 | |
189 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
189 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function get_columns() { |
200 | 200 | $columns = array( |
201 | - 'name' => esc_html__( 'Name', 'give' ), |
|
202 | - 'id' => esc_html__( 'ID', 'give' ), |
|
203 | - 'email' => esc_html__( 'Email', 'give' ), |
|
204 | - 'num_purchases' => esc_html__( 'Purchases', 'give' ), |
|
205 | - 'amount_spent' => esc_html__( 'Total Spent', 'give' ) |
|
201 | + 'name' => esc_html__('Name', 'give'), |
|
202 | + 'id' => esc_html__('ID', 'give'), |
|
203 | + 'email' => esc_html__('Email', 'give'), |
|
204 | + 'num_purchases' => esc_html__('Purchases', 'give'), |
|
205 | + 'amount_spent' => esc_html__('Total Spent', 'give') |
|
206 | 206 | ); |
207 | 207 | |
208 | - return apply_filters( 'give_report_donor_columns', $columns ); |
|
208 | + return apply_filters('give_report_donor_columns', $columns); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function get_sortable_columns() { |
220 | 220 | return array( |
221 | - 'id' => array( 'id', true ), |
|
222 | - 'name' => array( 'name', true ), |
|
223 | - 'num_purchases' => array( 'purchase_count', false ), |
|
224 | - 'amount_spent' => array( 'purchase_value', false ), |
|
221 | + 'id' => array('id', true), |
|
222 | + 'name' => array('name', true), |
|
223 | + 'num_purchases' => array('purchase_count', false), |
|
224 | + 'amount_spent' => array('purchase_value', false), |
|
225 | 225 | ); |
226 | 226 | } |
227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @return void |
234 | 234 | */ |
235 | - public function bulk_actions( $which = '' ) { |
|
235 | + public function bulk_actions($which = '') { |
|
236 | 236 | // These aren't really bulk actions but this outputs the markup in the right place |
237 | 237 | give_report_views(); |
238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return int Current page number |
246 | 246 | */ |
247 | 247 | public function get_paged() { |
248 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
248 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return mixed string If search is present, false otherwise |
257 | 257 | */ |
258 | 258 | public function get_search() { |
259 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
259 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | |
274 | 274 | $data = array(); |
275 | 275 | $paged = $this->get_paged(); |
276 | - $offset = $this->per_page * ( $paged - 1 ); |
|
276 | + $offset = $this->per_page * ($paged - 1); |
|
277 | 277 | $search = $this->get_search(); |
278 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
279 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
278 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
279 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
280 | 280 | |
281 | 281 | $args = array( |
282 | 282 | 'number' => $this->per_page, |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | 'orderby' => $orderby |
286 | 286 | ); |
287 | 287 | |
288 | - if ( is_email( $search ) ) { |
|
288 | + if (is_email($search)) { |
|
289 | 289 | $args['email'] = $search; |
290 | - } elseif ( is_numeric( $search ) ) { |
|
290 | + } elseif (is_numeric($search)) { |
|
291 | 291 | $args['id'] = $search; |
292 | 292 | } |
293 | 293 | |
294 | - $donors = Give()->customers->get_customers( $args ); |
|
294 | + $donors = Give()->customers->get_customers($args); |
|
295 | 295 | |
296 | - if ( $donors ) { |
|
296 | + if ($donors) { |
|
297 | 297 | |
298 | - $this->count = count( $donors ); |
|
298 | + $this->count = count($donors); |
|
299 | 299 | |
300 | - foreach ( $donors as $donor ) { |
|
300 | + foreach ($donors as $donor) { |
|
301 | 301 | |
302 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; |
|
302 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; |
|
303 | 303 | |
304 | 304 | $data[] = array( |
305 | 305 | 'id' => $donor->id, |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | $hidden = array(); // No hidden columns |
333 | 333 | $sortable = $this->get_sortable_columns(); |
334 | 334 | |
335 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
335 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
336 | 336 | |
337 | 337 | $this->items = $this->reports_data(); |
338 | 338 | |
339 | 339 | $this->total = give_count_total_customers(); |
340 | 340 | |
341 | - $this->set_pagination_args( array( |
|
341 | + $this->set_pagination_args(array( |
|
342 | 342 | 'total_items' => $this->total, |
343 | 343 | 'per_page' => $this->per_page, |
344 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
345 | - ) ); |
|
344 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
345 | + )); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | // Badge for welcome page |
109 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
109 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
110 | 110 | |
111 | 111 | ?> |
112 | 112 | <style type="text/css" media="screen"> |
@@ -186,20 +186,20 @@ discard block |
||
186 | 186 | * @return void |
187 | 187 | */ |
188 | 188 | public function tabs() { |
189 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
189 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
190 | 190 | ?> |
191 | 191 | <h2 class="nav-tab-wrapper"> |
192 | - <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
193 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
192 | + <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
193 | + <?php esc_html_e('About Give', 'give'); ?> |
|
194 | 194 | </a> |
195 | - <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
196 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
195 | + <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
196 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
197 | 197 | </a> |
198 | - <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
199 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
198 | + <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
199 | + <?php esc_html_e('Credits', 'give'); ?> |
|
200 | 200 | </a> |
201 | - <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
202 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
201 | + <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
202 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
203 | 203 | </a> |
204 | 204 | </h2> |
205 | 205 | <?php |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @return void |
214 | 214 | */ |
215 | 215 | public function about_screen() { |
216 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
216 | + list($display_version) = explode('-', GIVE_VERSION); |
|
217 | 217 | ?> |
218 | 218 | <div class="wrap about-wrap"> |
219 | 219 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | <p class="about-text"><?php |
224 | 224 | printf( |
225 | 225 | /* translators: %s: https://givewp.com/documenation/ */ |
226 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
227 | - esc_url( 'https://givewp.com/documenation/' ) |
|
226 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
227 | + esc_url('https://givewp.com/documenation/') |
|
228 | 228 | ); |
229 | 229 | ?></p> |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | <div class="give-badge"><?php |
234 | 234 | printf( |
235 | 235 | /* translators: %s: Give version */ |
236 | - esc_html__( 'Version %s', 'give' ), |
|
236 | + esc_html__('Version %s', 'give'), |
|
237 | 237 | $display_version |
238 | 238 | ); |
239 | 239 | ?></div> |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | <div class="feature-section clearfix introduction"> |
244 | 244 | |
245 | 245 | <div class="video feature-section-item"> |
246 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
246 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
247 | 247 | </div> |
248 | 248 | |
249 | 249 | <div class="content feature-section-item last-feature"> |
250 | 250 | |
251 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
251 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
252 | 252 | |
253 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
253 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
254 | 254 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
255 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
255 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
256 | 256 | <span class="dashicons dashicons-external"></span> |
257 | 257 | </a> |
258 | 258 | |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | |
266 | 266 | <div class="content feature-section-item"> |
267 | 267 | |
268 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
268 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
269 | 269 | |
270 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
270 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
271 | 271 | <a href="https://givewp.com/documentation" target="_blank" class="button-secondary"> |
272 | - <?php esc_html_e( 'View Documentation', 'give' ); ?> |
|
272 | + <?php esc_html_e('View Documentation', 'give'); ?> |
|
273 | 273 | <span class="dashicons dashicons-external"></span> |
274 | 274 | </a> |
275 | 275 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | <div class="content feature-section-item last-feature"> |
279 | 279 | |
280 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
280 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
281 | 281 | |
282 | 282 | </div> |
283 | 283 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return void |
298 | 298 | */ |
299 | 299 | public function changelog_screen() { |
300 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
300 | + list($display_version) = explode('-', GIVE_VERSION); |
|
301 | 301 | ?> |
302 | 302 | <div class="wrap about-wrap"> |
303 | 303 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | <p class="about-text"><?php |
306 | 306 | printf( |
307 | 307 | /* translators: %s: Give version */ |
308 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
308 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
309 | 309 | $display_version |
310 | 310 | ); |
311 | 311 | ?></p> |
312 | 312 | <div class="give-badge"><?php |
313 | 313 | printf( |
314 | 314 | /* translators: %s: Give version */ |
315 | - esc_html__( 'Version %s', 'give' ), |
|
315 | + esc_html__('Version %s', 'give'), |
|
316 | 316 | $display_version |
317 | 317 | ); |
318 | 318 | ?></div> |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | <?php $this->tabs(); ?> |
321 | 321 | |
322 | 322 | <div class="changelog"> |
323 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
323 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
324 | 324 | |
325 | 325 | <div class="feature-section"> |
326 | 326 | <?php echo $this->parse_readme(); ?> |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | </div> |
329 | 329 | |
330 | 330 | <div class="return-to-dashboard"> |
331 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
331 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
332 | 332 | 'post_type' => 'give_forms', |
333 | 333 | 'page' => 'give-settings' |
334 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
334 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
335 | 335 | </div> |
336 | 336 | </div> |
337 | 337 | <?php |
@@ -345,37 +345,37 @@ discard block |
||
345 | 345 | * @return void |
346 | 346 | */ |
347 | 347 | public function getting_started_screen() { |
348 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
348 | + list($display_version) = explode('-', GIVE_VERSION); |
|
349 | 349 | ?> |
350 | 350 | <div class="wrap about-wrap get-started"> |
351 | 351 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
352 | 352 | |
353 | 353 | <?php give_social_media_elements() ?> |
354 | 354 | |
355 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
355 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
356 | 356 | |
357 | 357 | <?php give_get_newsletter(); ?> |
358 | 358 | |
359 | 359 | <div class="give-badge"><?php |
360 | 360 | printf( |
361 | 361 | /* translators: %s: Give version */ |
362 | - esc_html__( 'Version %s', 'give' ), |
|
362 | + esc_html__('Version %s', 'give'), |
|
363 | 363 | $display_version |
364 | 364 | ); |
365 | 365 | ?></div> |
366 | 366 | |
367 | 367 | <?php $this->tabs(); ?> |
368 | 368 | |
369 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
369 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
370 | 370 | |
371 | 371 | <div class="feature-section clearfix"> |
372 | 372 | |
373 | 373 | <div class="content feature-section-item"> |
374 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
374 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
375 | 375 | |
376 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p> |
|
376 | + <p><?php esc_html_e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p> |
|
377 | 377 | |
378 | - <p><?php esc_html_e( 'But all of these features begin simply by going to the menu and choosing "Add Form".', 'give' ); ?></p> |
|
378 | + <p><?php esc_html_e('But all of these features begin simply by going to the menu and choosing "Add Form".', 'give'); ?></p> |
|
379 | 379 | </div> |
380 | 380 | |
381 | 381 | <div class="content feature-section-item last-feature"> |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | </div> |
393 | 393 | |
394 | 394 | <div class="content feature-section-item last-feature"> |
395 | - <h3><?php esc_html_e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3> |
|
395 | + <h3><?php esc_html_e('STEP 2: Choose Your Levels', 'give'); ?></h3> |
|
396 | 396 | |
397 | - <p><?php esc_html_e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p> |
|
397 | + <p><?php esc_html_e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p> |
|
398 | 398 | </div> |
399 | 399 | |
400 | 400 | </div> |
@@ -403,11 +403,11 @@ discard block |
||
403 | 403 | <div class="feature-section clearfix"> |
404 | 404 | |
405 | 405 | <div class="content feature-section-item add-content"> |
406 | - <h3><?php esc_html_e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3> |
|
406 | + <h3><?php esc_html_e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3> |
|
407 | 407 | |
408 | - <p><?php esc_html_e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p> |
|
408 | + <p><?php esc_html_e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p> |
|
409 | 409 | |
410 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
410 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
411 | 411 | </div> |
412 | 412 | |
413 | 413 | <div class="content feature-section-item last-feature"> |
@@ -424,9 +424,9 @@ discard block |
||
424 | 424 | </div> |
425 | 425 | |
426 | 426 | <div class="content feature-section-item last-feature"> |
427 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
427 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
428 | 428 | |
429 | - <p><?php esc_html_e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p> |
|
429 | + <p><?php esc_html_e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p> |
|
430 | 430 | </div> |
431 | 431 | |
432 | 432 | |
@@ -446,23 +446,23 @@ discard block |
||
446 | 446 | * @return void |
447 | 447 | */ |
448 | 448 | public function credits_screen() { |
449 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
449 | + list($display_version) = explode('-', GIVE_VERSION); |
|
450 | 450 | ?> |
451 | 451 | <div class="wrap about-wrap"> |
452 | 452 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
453 | 453 | |
454 | 454 | <?php give_social_media_elements() ?> |
455 | 455 | |
456 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
456 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
457 | 457 | |
458 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
458 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
459 | 459 | |
460 | 460 | <?php give_get_newsletter(); ?> |
461 | 461 | |
462 | 462 | <div class="give-badge"><?php |
463 | 463 | printf( |
464 | 464 | /* translators: %s: Give version */ |
465 | - esc_html__( 'Version %s', 'give' ), |
|
465 | + esc_html__('Version %s', 'give'), |
|
466 | 466 | $display_version |
467 | 467 | ); |
468 | 468 | ?></div> |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | <p class="about-description"><?php |
473 | 473 | printf( |
474 | 474 | /* translators: %s: https://github.com/WordImpress/give */ |
475 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
476 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
475 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
476 | + esc_url('https://github.com/WordImpress/give') |
|
477 | 477 | ); |
478 | 478 | ?></p> |
479 | 479 | |
@@ -490,21 +490,21 @@ discard block |
||
490 | 490 | * @return string $readme HTML formatted readme file |
491 | 491 | */ |
492 | 492 | public function parse_readme() { |
493 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
493 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
494 | 494 | |
495 | - if ( ! $file ) { |
|
496 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
495 | + if ( ! $file) { |
|
496 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
497 | 497 | } else { |
498 | - $readme = file_get_contents( $file ); |
|
499 | - $readme = nl2br( esc_html( $readme ) ); |
|
500 | - $readme = explode( '== Changelog ==', $readme ); |
|
501 | - $readme = end( $readme ); |
|
502 | - |
|
503 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
504 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
505 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
506 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
507 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
498 | + $readme = file_get_contents($file); |
|
499 | + $readme = nl2br(esc_html($readme)); |
|
500 | + $readme = explode('== Changelog ==', $readme); |
|
501 | + $readme = end($readme); |
|
502 | + |
|
503 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
504 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
505 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
506 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
507 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | return $readme; |
@@ -521,24 +521,24 @@ discard block |
||
521 | 521 | public function contributors() { |
522 | 522 | $contributors = $this->get_contributors(); |
523 | 523 | |
524 | - if ( empty( $contributors ) ) { |
|
524 | + if (empty($contributors)) { |
|
525 | 525 | return ''; |
526 | 526 | } |
527 | 527 | |
528 | 528 | $contributor_list = '<ul class="wp-people-group">'; |
529 | 529 | |
530 | - foreach ( $contributors as $contributor ) { |
|
530 | + foreach ($contributors as $contributor) { |
|
531 | 531 | $contributor_list .= '<li class="wp-person">'; |
532 | 532 | $contributor_list .= sprintf( |
533 | 533 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
534 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
535 | - esc_url( $contributor->avatar_url ), |
|
536 | - esc_attr( $contributor->login ) |
|
534 | + esc_url('https://github.com/'.$contributor->login), |
|
535 | + esc_url($contributor->avatar_url), |
|
536 | + esc_attr($contributor->login) |
|
537 | 537 | ); |
538 | 538 | $contributor_list .= sprintf( |
539 | 539 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
540 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
541 | - esc_html( $contributor->login ) |
|
540 | + esc_url('https://github.com/'.$contributor->login), |
|
541 | + esc_html($contributor->login) |
|
542 | 542 | ); |
543 | 543 | $contributor_list .= '</li>'; |
544 | 544 | } |
@@ -556,25 +556,25 @@ discard block |
||
556 | 556 | * @return array $contributors List of contributors |
557 | 557 | */ |
558 | 558 | public function get_contributors() { |
559 | - $contributors = get_transient( 'give_contributors' ); |
|
559 | + $contributors = get_transient('give_contributors'); |
|
560 | 560 | |
561 | - if ( false !== $contributors ) { |
|
561 | + if (false !== $contributors) { |
|
562 | 562 | return $contributors; |
563 | 563 | } |
564 | 564 | |
565 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
565 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
566 | 566 | |
567 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
567 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
568 | 568 | return array(); |
569 | 569 | } |
570 | 570 | |
571 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
571 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
572 | 572 | |
573 | - if ( ! is_array( $contributors ) ) { |
|
573 | + if ( ! is_array($contributors)) { |
|
574 | 574 | return array(); |
575 | 575 | } |
576 | 576 | |
577 | - set_transient( 'give_contributors', $contributors, 3600 ); |
|
577 | + set_transient('give_contributors', $contributors, 3600); |
|
578 | 578 | |
579 | 579 | return $contributors; |
580 | 580 | } |
@@ -592,24 +592,24 @@ discard block |
||
592 | 592 | $give_options = give_get_settings(); |
593 | 593 | |
594 | 594 | // Bail if no activation redirect |
595 | - if ( ! get_transient( '_give_activation_redirect' ) ) { |
|
595 | + if ( ! get_transient('_give_activation_redirect')) { |
|
596 | 596 | return; |
597 | 597 | } |
598 | 598 | |
599 | 599 | // Delete the redirect transient |
600 | - delete_transient( '_give_activation_redirect' ); |
|
600 | + delete_transient('_give_activation_redirect'); |
|
601 | 601 | |
602 | 602 | // Bail if activating from network, or bulk |
603 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
603 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
604 | 604 | return; |
605 | 605 | } |
606 | 606 | |
607 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
607 | + $upgrade = get_option('give_version_upgraded_from'); |
|
608 | 608 | |
609 | - if ( ! $upgrade ) { // First time install |
|
610 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
609 | + if ( ! $upgrade) { // First time install |
|
610 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
611 | 611 | exit; |
612 | - } elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings |
|
612 | + } elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings |
|
613 | 613 | |
614 | 614 | } else { // Welcome is NOT disabled in settings |
615 | 615 | wp_safe_redirect(admin_url('index.php?page=give-about')); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,52 +25,52 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | -function give_update_payment_details( $data ) { |
|
28 | +function give_update_payment_details($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
35 | 35 | |
36 | 36 | // Retrieve the payment ID. |
37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
37 | + $payment_id = absint($data['give_payment_id']); |
|
38 | 38 | |
39 | 39 | /* @var Give_Payment $payment */ |
40 | - $payment = new Give_Payment( $payment_id ); |
|
40 | + $payment = new Give_Payment($payment_id); |
|
41 | 41 | |
42 | 42 | // Retrieve existing payment meta. |
43 | 43 | $meta = $payment->get_meta(); |
44 | 44 | $user_info = $payment->user_info; |
45 | 45 | |
46 | 46 | $status = $data['give-payment-status']; |
47 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
48 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
47 | + $date = sanitize_text_field($data['give-payment-date']); |
|
48 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
49 | 49 | |
50 | 50 | // Restrict to our high and low. |
51 | - if ( $hour > 23 ) { |
|
51 | + if ($hour > 23) { |
|
52 | 52 | $hour = 23; |
53 | - } elseif ( $hour < 0 ) { |
|
53 | + } elseif ($hour < 0) { |
|
54 | 54 | $hour = 00; |
55 | 55 | } |
56 | 56 | |
57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
58 | 58 | |
59 | 59 | // Restrict to our high and low. |
60 | - if ( $minute > 59 ) { |
|
60 | + if ($minute > 59) { |
|
61 | 61 | $minute = 59; |
62 | - } elseif ( $minute < 0 ) { |
|
62 | + } elseif ($minute < 0) { |
|
63 | 63 | $minute = 00; |
64 | 64 | } |
65 | 65 | |
66 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
66 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
67 | 67 | |
68 | - $curr_total = give_sanitize_amount( $payment->total ); |
|
69 | - $new_total = give_sanitize_amount( $data['give-payment-total'] ); |
|
70 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
68 | + $curr_total = give_sanitize_amount($payment->total); |
|
69 | + $new_total = give_sanitize_amount($data['give-payment-total']); |
|
70 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
71 | 71 | |
72 | - $curr_customer_id = sanitize_text_field( $data['give-current-customer'] ); |
|
73 | - $new_customer_id = sanitize_text_field( $data['customer-id'] ); |
|
72 | + $curr_customer_id = sanitize_text_field($data['give-current-customer']); |
|
73 | + $new_customer_id = sanitize_text_field($data['customer-id']); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Fires before updating edited donation. |
@@ -79,98 +79,98 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @param int $payment_id The ID of the payment. |
81 | 81 | */ |
82 | - do_action( 'give_update_edited_purchase', $payment_id ); |
|
82 | + do_action('give_update_edited_purchase', $payment_id); |
|
83 | 83 | |
84 | 84 | $payment->date = $date; |
85 | 85 | $updated = $payment->save(); |
86 | 86 | |
87 | - if ( 0 === $updated ) { |
|
88 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
87 | + if (0 === $updated) { |
|
88 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $customer_changed = false; |
92 | 92 | |
93 | - if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) { |
|
93 | + if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') { |
|
94 | 94 | |
95 | - $email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : ''; |
|
96 | - $names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : ''; |
|
95 | + $email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : ''; |
|
96 | + $names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : ''; |
|
97 | 97 | |
98 | - if ( empty( $email ) || empty( $names ) ) { |
|
99 | - wp_die( esc_html__( 'New Customers require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
98 | + if (empty($email) || empty($names)) { |
|
99 | + wp_die(esc_html__('New Customers require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
100 | 100 | } |
101 | 101 | |
102 | - $customer = new Give_Customer( $email ); |
|
103 | - if ( empty( $customer->id ) ) { |
|
104 | - $customer_data = array( 'name' => $names, 'email' => $email ); |
|
105 | - $user_id = email_exists( $email ); |
|
106 | - if ( false !== $user_id ) { |
|
102 | + $customer = new Give_Customer($email); |
|
103 | + if (empty($customer->id)) { |
|
104 | + $customer_data = array('name' => $names, 'email' => $email); |
|
105 | + $user_id = email_exists($email); |
|
106 | + if (false !== $user_id) { |
|
107 | 107 | $customer_data['user_id'] = $user_id; |
108 | 108 | } |
109 | 109 | |
110 | - if ( ! $customer->create( $customer_data ) ) { |
|
110 | + if ( ! $customer->create($customer_data)) { |
|
111 | 111 | // Failed to crete the new donor, assume the previous donor. |
112 | 112 | $customer_changed = false; |
113 | - $customer = new Give_Customer( $curr_customer_id ); |
|
114 | - give_set_error( 'give-payment-new-customer-fail', esc_html__( 'Error creating new donor.', 'give' ) ); |
|
113 | + $customer = new Give_Customer($curr_customer_id); |
|
114 | + give_set_error('give-payment-new-customer-fail', esc_html__('Error creating new donor.', 'give')); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | $new_customer_id = $customer->id; |
119 | 119 | |
120 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
120 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
121 | 121 | |
122 | 122 | $customer_changed = true; |
123 | 123 | |
124 | - } elseif ( $curr_customer_id !== $new_customer_id ) { |
|
124 | + } elseif ($curr_customer_id !== $new_customer_id) { |
|
125 | 125 | |
126 | - $customer = new Give_Customer( $new_customer_id ); |
|
126 | + $customer = new Give_Customer($new_customer_id); |
|
127 | 127 | $email = $customer->email; |
128 | 128 | $names = $customer->name; |
129 | 129 | |
130 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
130 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
131 | 131 | |
132 | 132 | $customer_changed = true; |
133 | 133 | |
134 | 134 | } else { |
135 | 135 | |
136 | - $customer = new Give_Customer( $curr_customer_id ); |
|
136 | + $customer = new Give_Customer($curr_customer_id); |
|
137 | 137 | $email = $customer->email; |
138 | 138 | $names = $customer->name; |
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Setup first and last name from input values. |
143 | - $names = explode( ' ', $names ); |
|
144 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
143 | + $names = explode(' ', $names); |
|
144 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
145 | 145 | $last_name = ''; |
146 | - if ( ! empty( $names[1] ) ) { |
|
147 | - unset( $names[0] ); |
|
148 | - $last_name = implode( ' ', $names ); |
|
146 | + if ( ! empty($names[1])) { |
|
147 | + unset($names[0]); |
|
148 | + $last_name = implode(' ', $names); |
|
149 | 149 | } |
150 | 150 | |
151 | - if ( $customer_changed ) { |
|
151 | + if ($customer_changed) { |
|
152 | 152 | |
153 | 153 | // Remove the stats and payment from the previous customer and attach it to the new customer. |
154 | - $previous_customer->remove_payment( $payment_id, false ); |
|
155 | - $customer->attach_payment( $payment_id, false ); |
|
154 | + $previous_customer->remove_payment($payment_id, false); |
|
155 | + $customer->attach_payment($payment_id, false); |
|
156 | 156 | |
157 | - if ( 'publish' == $status ) { |
|
157 | + if ('publish' == $status) { |
|
158 | 158 | |
159 | 159 | // Reduce previous user donation count and amount. |
160 | 160 | $previous_customer->decrease_purchase_count(); |
161 | - $previous_customer->decrease_value( $curr_total ); |
|
161 | + $previous_customer->decrease_value($curr_total); |
|
162 | 162 | |
163 | 163 | // If donation was completed adjust stats of new customers. |
164 | 164 | $customer->increase_purchase_count(); |
165 | - $customer->increase_value( $new_total ); |
|
165 | + $customer->increase_value($new_total); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $payment->customer_id = $customer->id; |
169 | 169 | } else { |
170 | 170 | |
171 | - if ( 'publish' === $status ) { |
|
171 | + if ('publish' === $status) { |
|
172 | 172 | // Update user donation stat. |
173 | - $customer->update_donation_value( $curr_total, $new_total ); |
|
173 | + $customer->update_donation_value($curr_total, $new_total); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | $payment->total = $new_total; |
184 | 184 | |
185 | 185 | // Check for payment notes. |
186 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
186 | + if ( ! empty($data['give-payment-note'])) { |
|
187 | 187 | |
188 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
189 | - give_insert_payment_note( $payment_id, $note ); |
|
188 | + $note = wp_kses($data['give-payment-note'], array()); |
|
189 | + give_insert_payment_note($payment_id, $note); |
|
190 | 190 | |
191 | 191 | } |
192 | 192 | |
@@ -194,17 +194,17 @@ discard block |
||
194 | 194 | $payment->status = $status; |
195 | 195 | |
196 | 196 | // Adjust total store earnings if the payment total has been changed. |
197 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
197 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
198 | 198 | |
199 | - if ( $new_total > $curr_total ) { |
|
199 | + if ($new_total > $curr_total) { |
|
200 | 200 | // Increase if our new total is higher. |
201 | 201 | $difference = $new_total - $curr_total; |
202 | - give_increase_total_earnings( $difference ); |
|
202 | + give_increase_total_earnings($difference); |
|
203 | 203 | |
204 | - } elseif ( $curr_total > $new_total ) { |
|
204 | + } elseif ($curr_total > $new_total) { |
|
205 | 205 | // Decrease if our new total is lower. |
206 | 206 | $difference = $curr_total - $new_total; |
207 | - give_decrease_total_earnings( $difference ); |
|
207 | + give_decrease_total_earnings($difference); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | } |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | $payment->save(); |
213 | 213 | |
214 | 214 | // Get new give form ID. |
215 | - $new_form_id = absint( $data['forms'] ); |
|
216 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
215 | + $new_form_id = absint($data['forms']); |
|
216 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
217 | 217 | |
218 | 218 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
219 | 219 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
220 | 220 | // Check if user want to transfer current payment to new give form id. |
221 | - if ( $new_form_id != $current_form_id ) { |
|
221 | + if ($new_form_id != $current_form_id) { |
|
222 | 222 | |
223 | 223 | // Get new give form title. |
224 | - $new_form_title = get_the_title( $new_form_id ); |
|
224 | + $new_form_title = get_the_title($new_form_id); |
|
225 | 225 | |
226 | 226 | // Update new give form data in payment data. |
227 | 227 | $payment_meta = $payment->get_meta(); |
@@ -229,56 +229,56 @@ discard block |
||
229 | 229 | $payment_meta['form_id'] = $new_form_id; |
230 | 230 | |
231 | 231 | // Update price id post meta data for set donation form. |
232 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
232 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
233 | 233 | $payment_meta['price_id'] = ''; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Update payment give form meta data. |
237 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
238 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
239 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
237 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
238 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
239 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
240 | 240 | |
241 | 241 | // Update price id payment metadata. |
242 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
243 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
242 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
243 | + $payment->update_meta('_give_payment_price_id', ''); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // If donation was completed, adjust stats of forms. |
247 | - if ( 'publish' == $status ) { |
|
247 | + if ('publish' == $status) { |
|
248 | 248 | |
249 | 249 | // Decrease sale of old give form. For other payment status. |
250 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
250 | + $current_form = new Give_Donate_Form($current_form_id); |
|
251 | 251 | $current_form->decrease_sales(); |
252 | - $current_form->decrease_earnings( $curr_total ); |
|
252 | + $current_form->decrease_earnings($curr_total); |
|
253 | 253 | |
254 | 254 | // Increase sale of new give form. |
255 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
255 | + $new_form = new Give_Donate_Form($new_form_id); |
|
256 | 256 | $new_form->increase_sales(); |
257 | - $new_form->increase_earnings( $new_total ); |
|
257 | + $new_form->increase_earnings($new_total); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | // Re setup payment to update new meta value in object. |
261 | - $payment->update_payment_setup( $payment->ID ); |
|
261 | + $payment->update_payment_setup($payment->ID); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Update price id if current form is variable form. |
265 | - if ( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
265 | + if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) { |
|
266 | 266 | |
267 | 267 | // Get payment meta data. |
268 | 268 | $payment_meta = $payment->get_meta(); |
269 | 269 | |
270 | 270 | // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
271 | - $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
271 | + $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : ''; |
|
272 | 272 | |
273 | 273 | // Update payment meta data. |
274 | 274 | $payment_meta['price_id'] = $data['give-variable-price']; |
275 | 275 | |
276 | 276 | // Update payment give form meta data. |
277 | - $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
278 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
277 | + $payment->update_meta('_give_payment_price_id', $data['give-variable-price']); |
|
278 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
279 | 279 | |
280 | 280 | // Re setup payment to update new meta value in object. |
281 | - $payment->update_payment_setup( $payment->ID ); |
|
281 | + $payment->update_payment_setup($payment->ID); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -288,13 +288,13 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @param int $payment_id The ID of the payment. |
290 | 290 | */ |
291 | - do_action( 'give_updated_edited_purchase', $payment_id ); |
|
291 | + do_action('give_updated_edited_purchase', $payment_id); |
|
292 | 292 | |
293 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
293 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id)); |
|
294 | 294 | exit; |
295 | 295 | } |
296 | 296 | |
297 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
297 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
298 | 298 | |
299 | 299 | /** |
300 | 300 | * Trigger a Donation Deletion |
@@ -305,48 +305,48 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @return void |
307 | 307 | */ |
308 | -function give_trigger_purchase_delete( $data ) { |
|
309 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
308 | +function give_trigger_purchase_delete($data) { |
|
309 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
310 | 310 | |
311 | - $payment_id = absint( $data['purchase_id'] ); |
|
311 | + $payment_id = absint($data['purchase_id']); |
|
312 | 312 | |
313 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
314 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
313 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
314 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
315 | 315 | } |
316 | 316 | |
317 | - give_delete_purchase( $payment_id ); |
|
318 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
317 | + give_delete_purchase($payment_id); |
|
318 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
319 | 319 | give_die(); |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | -add_action( 'give_delete_payment', 'give_trigger_purchase_delete' ); |
|
323 | +add_action('give_delete_payment', 'give_trigger_purchase_delete'); |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * AJAX Store Donation Note |
327 | 327 | */ |
328 | 328 | function give_ajax_store_payment_note() { |
329 | 329 | |
330 | - $payment_id = absint( $_POST['payment_id'] ); |
|
331 | - $note = wp_kses( $_POST['note'], array() ); |
|
330 | + $payment_id = absint($_POST['payment_id']); |
|
331 | + $note = wp_kses($_POST['note'], array()); |
|
332 | 332 | |
333 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
334 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
333 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
334 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
335 | 335 | } |
336 | 336 | |
337 | - if ( empty( $payment_id ) ) { |
|
338 | - die( '-1' ); |
|
337 | + if (empty($payment_id)) { |
|
338 | + die('-1'); |
|
339 | 339 | } |
340 | 340 | |
341 | - if ( empty( $note ) ) { |
|
342 | - die( '-1' ); |
|
341 | + if (empty($note)) { |
|
342 | + die('-1'); |
|
343 | 343 | } |
344 | 344 | |
345 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
346 | - die( give_get_payment_note_html( $note_id ) ); |
|
345 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
346 | + die(give_get_payment_note_html($note_id)); |
|
347 | 347 | } |
348 | 348 | |
349 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
349 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Triggers a donation note deletion without ajax |
@@ -357,24 +357,24 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @return void |
359 | 359 | */ |
360 | -function give_trigger_payment_note_deletion( $data ) { |
|
360 | +function give_trigger_payment_note_deletion($data) { |
|
361 | 361 | |
362 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
362 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
363 | 363 | return; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
367 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
366 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
367 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
368 | 368 | } |
369 | 369 | |
370 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
370 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
371 | 371 | |
372 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
372 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
373 | 373 | |
374 | - wp_redirect( $edit_order_url ); |
|
374 | + wp_redirect($edit_order_url); |
|
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
377 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Delete a payment note deletion with ajax |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | */ |
386 | 386 | function give_ajax_delete_payment_note() { |
387 | 387 | |
388 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
389 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
388 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
389 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
390 | 390 | } |
391 | 391 | |
392 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
393 | - die( '1' ); |
|
392 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
393 | + die('1'); |
|
394 | 394 | } else { |
395 | - die( '-1' ); |
|
395 | + die('-1'); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | } |
399 | 399 | |
400 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
400 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if donation ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $customer_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $gateway = $payment->gateway; |
46 | 46 | $currency_code = $payment->currency; |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | <h1 id="transaction-details-heading"><?php |
54 | 54 | printf( |
55 | 55 | /* translators: %s: donation number */ |
56 | - esc_html__( 'Donation %s', 'give' ), |
|
56 | + esc_html__('Donation %s', 'give'), |
|
57 | 57 | $number |
58 | 58 | ); |
59 | - if ( $payment_mode == 'test' ) { |
|
60 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
59 | + if ($payment_mode == 'test') { |
|
60 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
61 | 61 | } |
62 | 62 | ?></h1> |
63 | 63 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @param int $payment_id Payment id. |
71 | 71 | */ |
72 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
72 | + do_action('give_view_order_details_before', $payment_id); |
|
73 | 73 | ?> |
74 | 74 | <form id="give-edit-order-form" method="post"> |
75 | 75 | <?php |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param int $payment_id Payment id. |
82 | 82 | */ |
83 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
83 | + do_action('give_view_order_details_form_top', $payment_id); |
|
84 | 84 | ?> |
85 | 85 | <div id="poststuff"> |
86 | 86 | <div id="give-dashboard-widgets-wrap"> |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @param int $payment_id Payment id. |
98 | 98 | */ |
99 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
99 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
100 | 100 | ?> |
101 | 101 | |
102 | 102 | <div id="give-order-update" class="postbox give-order-data"> |
103 | 103 | |
104 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
104 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
105 | 105 | |
106 | 106 | <div class="inside"> |
107 | 107 | <div class="give-admin-box"> |
@@ -114,33 +114,33 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param int $payment_id Payment id. |
116 | 116 | */ |
117 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
117 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
118 | 118 | ?> |
119 | 119 | |
120 | 120 | <div class="give-admin-box-inside"> |
121 | 121 | <p> |
122 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
122 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
123 | 123 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
124 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
125 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
124 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
125 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
126 | 126 | <?php endforeach; ?> |
127 | 127 | </select> |
128 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
128 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
129 | 129 | </p> |
130 | 130 | </div> |
131 | 131 | |
132 | 132 | <div class="give-admin-box-inside"> |
133 | 133 | <p> |
134 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
135 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
134 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
135 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
136 | 136 | </p> |
137 | 137 | </div> |
138 | 138 | |
139 | 139 | <div class="give-admin-box-inside"> |
140 | 140 | <p> |
141 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
142 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
143 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
141 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
142 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
143 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
144 | 144 | </p> |
145 | 145 | </div> |
146 | 146 | |
@@ -154,18 +154,18 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @param int $payment_id Payment id. |
156 | 156 | */ |
157 | - do_action( 'give_view_order_details_update_inner', $payment_id ); |
|
157 | + do_action('give_view_order_details_update_inner', $payment_id); |
|
158 | 158 | |
159 | 159 | // @TODO: Fees |
160 | - $fees = give_get_payment_fees( $payment_id ); |
|
161 | - if ( ! empty( $fees ) ) : ?> |
|
160 | + $fees = give_get_payment_fees($payment_id); |
|
161 | + if ( ! empty($fees)) : ?> |
|
162 | 162 | <div class="give-order-fees give-admin-box-inside"> |
163 | - <p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p> |
|
163 | + <p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p> |
|
164 | 164 | <ul class="give-payment-fees"> |
165 | - <?php foreach ( $fees as $fee ) : ?> |
|
165 | + <?php foreach ($fees as $fee) : ?> |
|
166 | 166 | <li> |
167 | 167 | <span class="fee-label"><?php echo $fee['label']; ?>:</span> |
168 | - <span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
168 | + <span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
169 | 169 | </li> |
170 | 170 | <?php endforeach; ?> |
171 | 171 | </ul> |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | |
175 | 175 | <div class="give-order-payment give-admin-box-inside"> |
176 | 176 | <p> |
177 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
178 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
179 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
177 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
178 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
179 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
180 | 180 | </p> |
181 | 181 | </div> |
182 | 182 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param int $payment_id Payment id. |
190 | 190 | */ |
191 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
191 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | </div> |
@@ -206,17 +206,17 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param int $payment_id Payment id. |
208 | 208 | */ |
209 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
209 | + do_action('give_view_order_details_update_before', $payment_id); |
|
210 | 210 | ?> |
211 | 211 | |
212 | 212 | <div id="major-publishing-actions"> |
213 | 213 | <div id="publishing-action"> |
214 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
215 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
216 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
214 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
215 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
216 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
217 | 217 | 'give-action' => 'email_links', |
218 | 218 | 'purchase_id' => $payment_id, |
219 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
219 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
220 | 220 | <?php endif; ?> |
221 | 221 | </div> |
222 | 222 | <div class="clear"></div> |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @param int $payment_id Payment id. |
232 | 232 | */ |
233 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
233 | + do_action('give_view_order_details_update_after', $payment_id); |
|
234 | 234 | ?> |
235 | 235 | |
236 | 236 | </div> |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | <div id="give-order-details" class="postbox give-order-data"> |
243 | 243 | |
244 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
244 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
245 | 245 | |
246 | 246 | <div class="inside"> |
247 | 247 | <div class="give-admin-box"> |
@@ -254,44 +254,44 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @param int $payment_id Payment id. |
256 | 256 | */ |
257 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
257 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
258 | 258 | |
259 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
260 | - if ( $gateway ) : ?> |
|
259 | + $gateway = give_get_payment_gateway($payment_id); |
|
260 | + if ($gateway) : ?> |
|
261 | 261 | <div class="give-order-gateway give-admin-box-inside"> |
262 | 262 | <p> |
263 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
264 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
263 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
264 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
265 | 265 | </p> |
266 | 266 | </div> |
267 | 267 | <?php endif; ?> |
268 | 268 | |
269 | 269 | <div class="give-order-payment-key give-admin-box-inside"> |
270 | 270 | <p> |
271 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
272 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
271 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
272 | + <?php echo give_get_payment_key($payment_id); ?> |
|
273 | 273 | </p> |
274 | 274 | </div> |
275 | 275 | |
276 | 276 | <div class="give-order-ip give-admin-box-inside"> |
277 | 277 | <p> |
278 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
279 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
278 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
279 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
280 | 280 | </p> |
281 | 281 | </div> |
282 | 282 | |
283 | - <?php if ( $transaction_id ) : ?> |
|
283 | + <?php if ($transaction_id) : ?> |
|
284 | 284 | <div class="give-order-tx-id give-admin-box-inside"> |
285 | 285 | <p> |
286 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
287 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
286 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
287 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
288 | 288 | </p> |
289 | 289 | </div> |
290 | 290 | <?php endif; ?> |
291 | 291 | |
292 | 292 | <div class="give-admin-box-inside"> |
293 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
294 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
293 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
294 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
295 | 295 | </p> |
296 | 296 | </div> |
297 | 297 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @param int $payment_id Payment id. |
305 | 305 | */ |
306 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
306 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
307 | 307 | ?> |
308 | 308 | |
309 | 309 | </div> |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param int $payment_id Payment id. |
325 | 325 | */ |
326 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
326 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
327 | 327 | ?> |
328 | 328 | |
329 | 329 | </div> |
@@ -343,50 +343,50 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @param int $payment_id Payment id. |
345 | 345 | */ |
346 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
346 | + do_action('give_view_order_details_main_before', $payment_id); |
|
347 | 347 | ?> |
348 | 348 | |
349 | 349 | <?php $column_count = 'columns-3'; ?> |
350 | 350 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
351 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
351 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
352 | 352 | |
353 | 353 | <div class="inside"> |
354 | 354 | |
355 | 355 | <div class="column-container"> |
356 | 356 | <div class="column"> |
357 | 357 | <p> |
358 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
358 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
359 | 359 | <?php |
360 | - if ( $payment_meta['form_id'] ) : |
|
360 | + if ($payment_meta['form_id']) : |
|
361 | 361 | printf( |
362 | 362 | '<a href="%1$s" target="_blank">#%2$s</a>', |
363 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
363 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
364 | 364 | $payment_meta['form_id'] |
365 | 365 | ); |
366 | 366 | endif; |
367 | 367 | ?> |
368 | 368 | </p> |
369 | 369 | <p> |
370 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
371 | - <?php give_get_form_dropdown( array( |
|
370 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
371 | + <?php give_get_form_dropdown(array( |
|
372 | 372 | 'id' => $payment_meta['form_id'], |
373 | 373 | 'selected' => $payment_meta['form_id'], |
374 | 374 | 'chosen' => true, |
375 | - ), true ); ?> |
|
375 | + ), true); ?> |
|
376 | 376 | </p> |
377 | 377 | </div> |
378 | 378 | <div class="column"> |
379 | 379 | <p> |
380 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
381 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
380 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
381 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
382 | 382 | </p> |
383 | 383 | <p> |
384 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
384 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
385 | 385 | <span class="give-donation-level"> |
386 | 386 | <?php |
387 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
388 | - if ( empty( $var_prices ) ) { |
|
389 | - esc_html_e( 'n/a', 'give' ); |
|
387 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
388 | + if (empty($var_prices)) { |
|
389 | + esc_html_e('n/a', 'give'); |
|
390 | 390 | } else { |
391 | 391 | // Variable price dropdown options. |
392 | 392 | $variable_price_dropdown_option = array( |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | 'selected' => $payment_meta['price_id'], |
398 | 398 | ); |
399 | 399 | // Render variable prices select tag html. |
400 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
400 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
401 | 401 | } |
402 | 402 | ?> |
403 | 403 | </span> |
@@ -405,8 +405,8 @@ discard block |
||
405 | 405 | </div> |
406 | 406 | <div class="column"> |
407 | 407 | <p> |
408 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
409 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?> |
|
408 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
409 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?> |
|
410 | 410 | </p> |
411 | 411 | <p> |
412 | 412 | <?php |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @param int $payment_id Payment id. |
421 | 421 | */ |
422 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
422 | + do_action('give_donation_details_thead_before', $payment_id); |
|
423 | 423 | |
424 | 424 | |
425 | 425 | /** |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * |
432 | 432 | * @param int $payment_id Payment id. |
433 | 433 | */ |
434 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
434 | + do_action('give_donation_details_thead_after', $payment_id); |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @param int $payment_id Payment id. |
444 | 444 | */ |
445 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
445 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @param int $payment_id Payment id. |
455 | 455 | */ |
456 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
456 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
457 | 457 | ?> |
458 | 458 | </p> |
459 | 459 | </div> |
@@ -473,57 +473,57 @@ discard block |
||
473 | 473 | * |
474 | 474 | * @param int $payment_id Payment id. |
475 | 475 | */ |
476 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
476 | + do_action('give_view_order_details_files_after', $payment_id); |
|
477 | 477 | ?> |
478 | 478 | |
479 | 479 | <div id="give-donor-details" class="postbox"> |
480 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
480 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
481 | 481 | |
482 | 482 | <div class="inside"> |
483 | 483 | |
484 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
484 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
485 | 485 | |
486 | 486 | <div class="column-container customer-info"> |
487 | 487 | <div class="column"> |
488 | 488 | <p> |
489 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
489 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
490 | 490 | <?php |
491 | - if ( ! empty( $customer->id ) ) { |
|
491 | + if ( ! empty($customer->id)) { |
|
492 | 492 | printf( |
493 | 493 | '<a href="%1$s" target="_blank">#%2$s</a>', |
494 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ), |
|
494 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id), |
|
495 | 495 | $customer->id |
496 | 496 | ); |
497 | 497 | } |
498 | 498 | ?> |
499 | 499 | </p> |
500 | 500 | <p> |
501 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
502 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
501 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
502 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
503 | 503 | </p> |
504 | 504 | </div> |
505 | 505 | <div class="column"> |
506 | 506 | <p> |
507 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
507 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
508 | 508 | <?php echo $customer->name; ?> |
509 | 509 | </p> |
510 | 510 | <p> |
511 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
511 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
512 | 512 | <?php echo $customer->email; ?> |
513 | 513 | </p> |
514 | 514 | </div> |
515 | 515 | <div class="column"> |
516 | 516 | <p> |
517 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
517 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
518 | 518 | <?php |
519 | - echo Give()->html->donor_dropdown( array( |
|
519 | + echo Give()->html->donor_dropdown(array( |
|
520 | 520 | 'selected' => $customer->id, |
521 | 521 | 'name' => 'customer-id', |
522 | - ) ); |
|
522 | + )); |
|
523 | 523 | ?> |
524 | 524 | </p> |
525 | 525 | <p> |
526 | - <a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
526 | + <a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
527 | 527 | </p> |
528 | 528 | </div> |
529 | 529 | </div> |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | <div class="column-container new-customer" style="display: none"> |
532 | 532 | <div class="column"> |
533 | 533 | <p> |
534 | - <label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
534 | + <label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
535 | 535 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
536 | 536 | </p> |
537 | 537 | </div> |
538 | 538 | <div class="column"> |
539 | 539 | <p> |
540 | - <label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
540 | + <label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
541 | 541 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
542 | 542 | </p> |
543 | 543 | </div> |
@@ -545,9 +545,9 @@ discard block |
||
545 | 545 | <p> |
546 | 546 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
547 | 547 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
548 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
548 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
549 | 549 | <br> |
550 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
550 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
551 | 551 | </p> |
552 | 552 | </div> |
553 | 553 | </div> |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * @param array $payment_meta Payment meta. |
564 | 564 | * @param array $user_info User information. |
565 | 565 | */ |
566 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
566 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
567 | 567 | |
568 | 568 | /** |
569 | 569 | * Fires in order details page, in the donor-details metabox. |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * |
573 | 573 | * @param int $payment_id Payment id. |
574 | 574 | */ |
575 | - do_action( 'give_payment_view_details', $payment_id ); |
|
575 | + do_action('give_payment_view_details', $payment_id); |
|
576 | 576 | ?> |
577 | 577 | |
578 | 578 | </div> |
@@ -588,11 +588,11 @@ discard block |
||
588 | 588 | * |
589 | 589 | * @param int $payment_id Payment id. |
590 | 590 | */ |
591 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
591 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
592 | 592 | ?> |
593 | 593 | |
594 | 594 | <div id="give-billing-details" class="postbox"> |
595 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
595 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
596 | 596 | |
597 | 597 | <div class="inside"> |
598 | 598 | |
@@ -602,57 +602,57 @@ discard block |
||
602 | 602 | <div class="data column-container"> |
603 | 603 | <div class="column"> |
604 | 604 | <div class="give-wrap-address-line1"> |
605 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
606 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
605 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
606 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
607 | 607 | </div> |
608 | 608 | <div class="give-wrap-address-line2"> |
609 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
610 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
609 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
610 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
611 | 611 | </div> |
612 | 612 | </div> |
613 | 613 | <div class="column"> |
614 | 614 | <div class="give-wrap-address-city"> |
615 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
616 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
615 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
616 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
617 | 617 | </div> |
618 | 618 | <div class="give-wrap-address-zip"> |
619 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
620 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
619 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
620 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
621 | 621 | |
622 | 622 | </div> |
623 | 623 | </div> |
624 | 624 | <div class="column"> |
625 | 625 | <div id="give-order-address-country-wrap"> |
626 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
626 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
627 | 627 | <?php |
628 | - echo Give()->html->select( array( |
|
628 | + echo Give()->html->select(array( |
|
629 | 629 | 'options' => give_get_country_list(), |
630 | 630 | 'name' => 'give-payment-address[0][country]', |
631 | 631 | 'selected' => $address['country'], |
632 | 632 | 'show_option_all' => false, |
633 | 633 | 'show_option_none' => false, |
634 | 634 | 'chosen' => true, |
635 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
636 | - ) ); |
|
635 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
636 | + )); |
|
637 | 637 | ?> |
638 | 638 | </div> |
639 | 639 | <div id="give-order-address-state-wrap"> |
640 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
640 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
641 | 641 | <?php |
642 | - $states = give_get_states( $address['country'] ); |
|
643 | - if ( ! empty( $states ) ) { |
|
644 | - echo Give()->html->select( array( |
|
642 | + $states = give_get_states($address['country']); |
|
643 | + if ( ! empty($states)) { |
|
644 | + echo Give()->html->select(array( |
|
645 | 645 | 'options' => $states, |
646 | 646 | 'name' => 'give-payment-address[0][state]', |
647 | 647 | 'selected' => $address['state'], |
648 | 648 | 'show_option_all' => false, |
649 | 649 | 'show_option_none' => false, |
650 | 650 | 'chosen' => true, |
651 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
652 | - ) ); |
|
651 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
652 | + )); |
|
653 | 653 | } else { |
654 | 654 | ?> |
655 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
655 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
656 | 656 | <?php |
657 | 657 | } ?> |
658 | 658 | </div> |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | * |
673 | 673 | * @param int $payment_id Payment id. |
674 | 674 | */ |
675 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
675 | + do_action('give_payment_billing_details', $payment_id); |
|
676 | 676 | ?> |
677 | 677 | |
678 | 678 | </div> |
@@ -688,32 +688,32 @@ discard block |
||
688 | 688 | * |
689 | 689 | * @param int $payment_id Payment id. |
690 | 690 | */ |
691 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
691 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
692 | 692 | ?> |
693 | 693 | |
694 | 694 | <div id="give-payment-notes" class="postbox"> |
695 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
695 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
696 | 696 | |
697 | 697 | <div class="inside"> |
698 | 698 | <div id="give-payment-notes-inner"> |
699 | 699 | <?php |
700 | - $notes = give_get_payment_notes( $payment_id ); |
|
701 | - if ( ! empty( $notes ) ) { |
|
700 | + $notes = give_get_payment_notes($payment_id); |
|
701 | + if ( ! empty($notes)) { |
|
702 | 702 | $no_notes_display = ' style="display:none;"'; |
703 | - foreach ( $notes as $note ) : |
|
703 | + foreach ($notes as $note) : |
|
704 | 704 | |
705 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
705 | + echo give_get_payment_note_html($note, $payment_id); |
|
706 | 706 | |
707 | 707 | endforeach; |
708 | 708 | } else { |
709 | 709 | $no_notes_display = ''; |
710 | 710 | } |
711 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
711 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
712 | 712 | </div> |
713 | 713 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
714 | 714 | |
715 | 715 | <div class="give-clearfix"> |
716 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
716 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
717 | 717 | </div> |
718 | 718 | |
719 | 719 | </div> |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | * |
730 | 730 | * @param int $payment_id Payment id. |
731 | 731 | */ |
732 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
732 | + do_action('give_view_order_details_main_after', $payment_id); |
|
733 | 733 | ?> |
734 | 734 | |
735 | 735 | </div> |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | * |
752 | 752 | * @param int $payment_id Payment id. |
753 | 753 | */ |
754 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
754 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
755 | 755 | |
756 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
756 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
757 | 757 | ?> |
758 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
758 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
759 | 759 | <input type="hidden" name="give_action" value="update_donation_details"/> |
760 | 760 | </form> |
761 | 761 | <?php |
@@ -766,6 +766,6 @@ discard block |
||
766 | 766 | * |
767 | 767 | * @param int $payment_id Payment id. |
768 | 768 | */ |
769 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
769 | + do_action('give_view_order_details_after', $payment_id); |
|
770 | 770 | ?> |
771 | 771 | </div><!-- /.wrap --> |