@@ -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,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_register' ); |
|
27 | + parent::__construct('give_register'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
47 | 47 | ), |
48 | 48 | ); |
49 | 49 | } |
@@ -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,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'donation_history' ); |
|
26 | + parent::__construct('donation_history'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -10,7 +10,7 @@ |
||
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 |
@@ -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,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_form' ); |
|
30 | + parent::__construct('give_form'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | $create_form_link = sprintf( |
41 | 41 | /* translators: %s: create new form URL */ |
42 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
43 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
42 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
43 | + admin_url('post-new.php?post_type=give_forms') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | return array( |
@@ -50,68 +50,68 @@ discard block |
||
50 | 50 | 'post_type' => 'give_forms', |
51 | 51 | ), |
52 | 52 | 'name' => 'id', |
53 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
54 | - 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', |
|
53 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
54 | + 'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -', |
|
55 | 55 | 'required' => array( |
56 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
57 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ), |
|
56 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
57 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link), |
|
58 | 58 | ), |
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'container', |
62 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
62 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
63 | 63 | ), |
64 | 64 | array( |
65 | 65 | 'type' => 'listbox', |
66 | 66 | 'name' => 'show_title', |
67 | - 'label' => esc_attr__( 'Show Title', 'give' ), |
|
68 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
67 | + 'label' => esc_attr__('Show Title', 'give'), |
|
68 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
69 | 69 | 'options' => array( |
70 | - 'true' => esc_html__( 'Show', 'give' ), |
|
71 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
70 | + 'true' => esc_html__('Show', 'give'), |
|
71 | + 'false' => esc_html__('Hide', 'give'), |
|
72 | 72 | ), |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'type' => 'listbox', |
76 | 76 | 'name' => 'show_goal', |
77 | - 'label' => esc_attr__( 'Show Goal', 'give' ), |
|
78 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
77 | + 'label' => esc_attr__('Show Goal', 'give'), |
|
78 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'show_content', |
87 | 87 | 'minWidth' => 240, |
88 | - 'label' => esc_attr__( 'Display Content', 'give' ), |
|
89 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
88 | + 'label' => esc_attr__('Display Content', 'give'), |
|
89 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
90 | 90 | 'options' => array( |
91 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
92 | - 'above' => esc_html__( 'Display content ABOVE the fields', 'give' ), |
|
93 | - 'below' => esc_html__( 'Display content BELOW the fields', 'give' ), |
|
91 | + 'none' => esc_html__('No Content', 'give'), |
|
92 | + 'above' => esc_html__('Display content ABOVE the fields', 'give'), |
|
93 | + 'below' => esc_html__('Display content BELOW the fields', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'type' => 'listbox', |
98 | 98 | 'name' => 'display_style', |
99 | 99 | 'classes' => 'give-display-style', |
100 | - 'label' => esc_attr__( 'Display Options', 'give' ), |
|
101 | - 'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ), |
|
100 | + 'label' => esc_attr__('Display Options', 'give'), |
|
101 | + 'tooltip' => esc_attr__('How would you like to display donation information?', 'give'), |
|
102 | 102 | 'options' => array( |
103 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
104 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
105 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
106 | - 'button' => esc_html__( 'Button', 'give' ), |
|
103 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
104 | + 'modal' => esc_html__('Modal', 'give'), |
|
105 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
106 | + 'button' => esc_html__('Button', 'give'), |
|
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | array( |
110 | 110 | 'type' => 'textbox', |
111 | 111 | 'classes' => 'give-hidden give-continue-button-title', |
112 | 112 | 'name' => 'continue_button_title', |
113 | - 'label' => esc_attr__( 'Button Text', 'give' ), |
|
114 | - 'tooltip' => esc_attr__( 'The button label for displaying the additional payment fields.', 'give' ), |
|
113 | + 'label' => esc_attr__('Button Text', 'give'), |
|
114 | + 'tooltip' => esc_attr__('The button label for displaying the additional payment fields.', 'give'), |
|
115 | 115 | ), |
116 | 116 | ); |
117 | 117 | } |
@@ -157,7 +157,7 @@ |
||
157 | 157 | * |
158 | 158 | * @access public |
159 | 159 | * @since 1.0 |
160 | - * @return string|bool string If search is present, false otherwise |
|
160 | + * @return string|false string If search is present, false otherwise |
|
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | 163 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | global $status, $page; |
45 | 45 | |
46 | 46 | // Set parent defaults |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | - 'ajax' => false,// Does this table support ajax? |
|
51 | - ) ); |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | + 'ajax' => false, // Does this table support ajax? |
|
51 | + )); |
|
52 | 52 | |
53 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,69 +64,69 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | 68 | |
69 | 69 | /* @var Give_Payment $payment */ |
70 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
70 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
71 | 71 | |
72 | - switch ( $column_name ) { |
|
72 | + switch ($column_name) { |
|
73 | 73 | case 'form' : |
74 | - $form_title = get_the_title( $item[ $column_name ] ); |
|
75 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title; |
|
76 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . esc_html( $form_title ). '</a>'; |
|
74 | + $form_title = get_the_title($item[$column_name]); |
|
75 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title; |
|
76 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.esc_html($form_title).'</a>'; |
|
77 | 77 | |
78 | 78 | case 'amount' : |
79 | - $value = give_currency_filter( give_format_amount( $item['amount'], array( 'sanitize' => false, 'donation_id' => $item['payment_id'] ) ), array( 'currency_code' => give_get_payment_currency_code( $item['payment_id'] ) ) ); |
|
80 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
79 | + $value = give_currency_filter(give_format_amount($item['amount'], array('sanitize' => false, 'donation_id' => $item['payment_id'])), array('currency_code' => give_get_payment_currency_code($item['payment_id']))); |
|
80 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
81 | 81 | |
82 | 82 | return $value; |
83 | 83 | |
84 | 84 | case 'status' : |
85 | 85 | |
86 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
86 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
87 | 87 | |
88 | - if ( $payment->mode == 'test' ) { |
|
89 | - $value .= Give()->tooltips->render_span( array( |
|
90 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
91 | - 'tag_content' => __( 'Test', 'give' ), |
|
88 | + if ($payment->mode == 'test') { |
|
89 | + $value .= Give()->tooltips->render_span(array( |
|
90 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
91 | + 'tag_content' => __('Test', 'give'), |
|
92 | 92 | 'attributes' => array( |
93 | 93 | 'class' => 'give-item-label give-item-label-orange give-test-mode-transactions-label', |
94 | 94 | ), |
95 | - ) ); |
|
95 | + )); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $value; |
99 | 99 | |
100 | 100 | case 'donation' : |
101 | - $serial_code = Give()->seq_donation_number->get_serial_code( $payment ); |
|
102 | - $value = Give()->tooltips->render_link( array( |
|
101 | + $serial_code = Give()->seq_donation_number->get_serial_code($payment); |
|
102 | + $value = Give()->tooltips->render_link(array( |
|
103 | 103 | /* translators: %s Sequential Donation ID. */ |
104 | - 'label' => sprintf( __( 'View Donation %s', 'give' ), $serial_code ), |
|
104 | + 'label' => sprintf(__('View Donation %s', 'give'), $serial_code), |
|
105 | 105 | 'tag_content' => $serial_code, |
106 | - 'link' => esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ), |
|
107 | - ) ); |
|
106 | + 'link' => esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))), |
|
107 | + )); |
|
108 | 108 | |
109 | - if ( ! empty( $item['donor_id'] ) ) { |
|
110 | - $title_prefix = Give()->donor_meta->get_meta( $item['donor_id'], '_give_donor_title_prefix', true ); |
|
109 | + if ( ! empty($item['donor_id'])) { |
|
110 | + $title_prefix = Give()->donor_meta->get_meta($item['donor_id'], '_give_donor_title_prefix', true); |
|
111 | 111 | |
112 | 112 | $value .= sprintf( |
113 | 113 | ' %1$s <a href="%2$s">%3$s</a><br>', |
114 | - esc_html__( 'by', 'give' ), |
|
115 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . $item['donor_id'] ), |
|
116 | - give_get_donor_name_with_title_prefixes( $title_prefix, $item['donor_name'] ) |
|
114 | + esc_html__('by', 'give'), |
|
115 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.$item['donor_id']), |
|
116 | + give_get_donor_name_with_title_prefixes($title_prefix, $item['donor_name']) |
|
117 | 117 | ); |
118 | 118 | } else { |
119 | 119 | $value .= sprintf( |
120 | 120 | ' %1$s %2$s<br>', |
121 | - esc_html__( 'by', 'give' ), |
|
122 | - __( 'No donor attached', 'give' ) |
|
121 | + esc_html__('by', 'give'), |
|
122 | + __('No donor attached', 'give') |
|
123 | 123 | ); |
124 | 124 | } |
125 | 125 | |
126 | 126 | return $value; |
127 | 127 | |
128 | 128 | default: |
129 | - return $item[ $column_name ]; |
|
129 | + return $item[$column_name]; |
|
130 | 130 | } // End switch(). |
131 | 131 | } |
132 | 132 | |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function get_columns() { |
141 | 141 | $columns = array( |
142 | - 'ID' => __( 'Log ID', 'give' ), |
|
143 | - 'donation' => __( 'Donation', 'give' ), |
|
144 | - 'form' => __( 'Form', 'give' ), |
|
145 | - 'status' => __( 'Status', 'give' ), |
|
146 | - 'amount' => __( 'Donation Amount', 'give' ), |
|
147 | - 'date' => __( 'Date', 'give' ), |
|
142 | + 'ID' => __('Log ID', 'give'), |
|
143 | + 'donation' => __('Donation', 'give'), |
|
144 | + 'form' => __('Form', 'give'), |
|
145 | + 'status' => __('Status', 'give'), |
|
146 | + 'amount' => __('Donation Amount', 'give'), |
|
147 | + 'date' => __('Date', 'give'), |
|
148 | 148 | ); |
149 | 149 | |
150 | 150 | return $columns; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @return int Current page number |
159 | 159 | */ |
160 | 160 | public function get_paged() { |
161 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
161 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @return mixed int If User ID, string If Email/Login |
170 | 170 | */ |
171 | 171 | public function get_filtered_user() { |
172 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
172 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @return int Download ID |
181 | 181 | */ |
182 | 182 | public function get_filtered_give_form() { |
183 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
183 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @return string|bool string If search is present, false otherwise |
192 | 192 | */ |
193 | 193 | public function get_search() { |
194 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
194 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -207,19 +207,19 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @param string $which |
209 | 209 | */ |
210 | - protected function display_tablenav( $which ) { |
|
210 | + protected function display_tablenav($which) { |
|
211 | 211 | ?> |
212 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
212 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
213 | 213 | |
214 | - <?php if ( 'top' === $which ) : ?> |
|
214 | + <?php if ('top' === $which) : ?> |
|
215 | 215 | <div class="alignleft actions bulkactions"> |
216 | - <?php $this->bulk_actions( $which ); ?> |
|
216 | + <?php $this->bulk_actions($which); ?> |
|
217 | 217 | </div> |
218 | 218 | <?php endif; ?> |
219 | 219 | |
220 | 220 | <?php |
221 | - $this->extra_tablenav( $which ); |
|
222 | - $this->pagination( $which ); |
|
221 | + $this->extra_tablenav($which); |
|
222 | + $this->pagination($which); |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <br class="clear"/> |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | $meta_query = array(); |
246 | 246 | |
247 | - if ( $user ) { |
|
247 | + if ($user) { |
|
248 | 248 | // Show only logs from a specific user. |
249 | 249 | $meta_query[] = array( |
250 | 250 | 'key' => '_give_log_user_id', |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | ); |
253 | 253 | } |
254 | 254 | |
255 | - if ( $give_form ) { |
|
255 | + if ($give_form) { |
|
256 | 256 | $meta_query[] = array( |
257 | 257 | 'key' => '_give_log_form_id', |
258 | 258 | 'value' => $give_form, |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | $search = $this->get_search(); |
263 | - if ( $search ) { |
|
264 | - if ( is_email( $search ) ) { |
|
263 | + if ($search) { |
|
264 | + if (is_email($search)) { |
|
265 | 265 | // This is an email search. We use this to ensure it works for guest users and logged-in users. |
266 | 266 | $key = '_give_log_user_info'; |
267 | 267 | $compare = 'LIKE'; |
@@ -270,32 +270,32 @@ discard block |
||
270 | 270 | $key = '_give_log_user_id'; |
271 | 271 | $compare = 'LIKE'; |
272 | 272 | |
273 | - if ( ! is_numeric( $search ) ) { |
|
273 | + if ( ! is_numeric($search)) { |
|
274 | 274 | // Searching for user by username |
275 | - $user = get_user_by( 'login', $search ); |
|
275 | + $user = get_user_by('login', $search); |
|
276 | 276 | |
277 | - if ( $user ) { |
|
277 | + if ($user) { |
|
278 | 278 | // Found one, set meta value to user's ID. |
279 | 279 | $search = $user->ID; |
280 | 280 | } else { |
281 | 281 | // No user found so let's do a real search query. |
282 | - $users = new WP_User_Query( array( |
|
282 | + $users = new WP_User_Query(array( |
|
283 | 283 | 'search' => $search, |
284 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
284 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
285 | 285 | 'number' => 1, |
286 | 286 | 'fields' => 'ids', |
287 | - ) ); |
|
287 | + )); |
|
288 | 288 | |
289 | 289 | $found_user = $users->get_results(); |
290 | 290 | |
291 | - if ( $found_user ) { |
|
291 | + if ($found_user) { |
|
292 | 292 | $search = $found_user[0]; |
293 | 293 | } |
294 | 294 | } |
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | - if ( ! $this->file_search ) { |
|
298 | + if ( ! $this->file_search) { |
|
299 | 299 | // Meta query only works for non file name search. |
300 | 300 | $meta_query[] = array( |
301 | 301 | 'key' => $key, |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @param string $which |
318 | 318 | * @return void |
319 | 319 | */ |
320 | - function bulk_actions( $which = '' ) { |
|
320 | + function bulk_actions($which = '') { |
|
321 | 321 | give_log_views(); |
322 | 322 | } |
323 | 323 | |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | * @return void |
330 | 330 | */ |
331 | 331 | public function give_forms_filter() { |
332 | - echo Give()->html->forms_dropdown( array( |
|
332 | + echo Give()->html->forms_dropdown(array( |
|
333 | 333 | 'selected' => $this->get_filtered_give_form(), |
334 | 334 | 'name' => 'form', |
335 | 335 | 'id' => 'give-log-form-filter', |
336 | 336 | 'chosen' => true, |
337 | - ) ); |
|
337 | + )); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -348,22 +348,22 @@ discard block |
||
348 | 348 | public function get_logs() { |
349 | 349 | $logs_data = array(); |
350 | 350 | $log_query = $this->get_query_params(); |
351 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
351 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
352 | 352 | |
353 | - if ( $logs ) { |
|
354 | - foreach ( $logs as $log ) { |
|
353 | + if ($logs) { |
|
354 | + foreach ($logs as $log) { |
|
355 | 355 | /* @var Give_payment $payment */ |
356 | - $payment = new Give_Payment( $log->log_parent ); |
|
356 | + $payment = new Give_Payment($log->log_parent); |
|
357 | 357 | |
358 | 358 | // Make sure this payment hasn't been deleted |
359 | - if ( get_post( $payment->ID ) ) : |
|
359 | + if (get_post($payment->ID)) : |
|
360 | 360 | $logs_data[] = array( |
361 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
361 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
362 | 362 | 'payment_id' => $payment->ID, |
363 | 363 | 'form' => $payment->form_id, |
364 | 364 | 'amount' => $payment->total, |
365 | 365 | 'donor_id' => $payment->customer_id, |
366 | - 'donor_name' => trim( "{$payment->first_name} $payment->last_name" ), |
|
366 | + 'donor_name' => trim("{$payment->first_name} $payment->last_name"), |
|
367 | 367 | 'date' => $payment->date, |
368 | 368 | ); |
369 | 369 | |
@@ -391,15 +391,15 @@ discard block |
||
391 | 391 | $columns = $this->get_columns(); |
392 | 392 | $hidden = array(); |
393 | 393 | $sortable = $this->get_sortable_columns(); |
394 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
394 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
395 | 395 | $current_page = $this->get_pagenum(); |
396 | 396 | $this->items = $this->get_logs(); |
397 | - $total_items = Give()->logs->get_log_count( 0, 'sale', $this->get_meta_query() ); |
|
397 | + $total_items = Give()->logs->get_log_count(0, 'sale', $this->get_meta_query()); |
|
398 | 398 | |
399 | - $this->set_pagination_args( array( |
|
399 | + $this->set_pagination_args(array( |
|
400 | 400 | 'total_items' => $total_items, |
401 | 401 | 'per_page' => $this->per_page, |
402 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
402 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
403 | 403 | ) |
404 | 404 | ); |
405 | 405 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | public function csv_cols() { |
42 | 42 | |
43 | 43 | $cols = array( |
44 | - 'ID' => __( 'ID', 'give' ), |
|
45 | - 'post_name' => __( 'Slug', 'give' ), |
|
46 | - 'post_title' => __( 'Name', 'give' ), |
|
47 | - 'post_date' => __( 'Date Created', 'give' ), |
|
48 | - 'post_author' => __( 'Author', 'give' ), |
|
49 | - 'post_content' => __( 'Description', 'give' ), |
|
50 | - 'post_excerpt' => __( 'Excerpt', 'give' ), |
|
51 | - 'post_status' => __( 'Status', 'give' ), |
|
52 | - 'categories' => __( 'Categories', 'give' ), |
|
53 | - 'tags' => __( 'Tags', 'give' ), |
|
54 | - 'give_price' => __( 'Price', 'give' ), |
|
55 | - '_thumbnail_id' => __( 'Featured Image', 'give' ), |
|
56 | - '_give_form_sales' => __( 'Donations', 'give' ), |
|
57 | - '_give_download_earnings' => __( 'Income', 'give' ), |
|
44 | + 'ID' => __('ID', 'give'), |
|
45 | + 'post_name' => __('Slug', 'give'), |
|
46 | + 'post_title' => __('Name', 'give'), |
|
47 | + 'post_date' => __('Date Created', 'give'), |
|
48 | + 'post_author' => __('Author', 'give'), |
|
49 | + 'post_content' => __('Description', 'give'), |
|
50 | + 'post_excerpt' => __('Excerpt', 'give'), |
|
51 | + 'post_status' => __('Status', 'give'), |
|
52 | + 'categories' => __('Categories', 'give'), |
|
53 | + 'tags' => __('Tags', 'give'), |
|
54 | + 'give_price' => __('Price', 'give'), |
|
55 | + '_thumbnail_id' => __('Featured Image', 'give'), |
|
56 | + '_give_form_sales' => __('Donations', 'give'), |
|
57 | + '_give_download_earnings' => __('Income', 'give'), |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | return $cols; |
@@ -84,43 +84,43 @@ discard block |
||
84 | 84 | 'paged' => $this->step |
85 | 85 | ); |
86 | 86 | |
87 | - $forms = new WP_Query( $args ); |
|
87 | + $forms = new WP_Query($args); |
|
88 | 88 | |
89 | - if ( $forms->posts ) { |
|
90 | - foreach ( $forms->posts as $form ) { |
|
89 | + if ($forms->posts) { |
|
90 | + foreach ($forms->posts as $form) { |
|
91 | 91 | |
92 | 92 | $row = []; |
93 | 93 | |
94 | - foreach ( $this->csv_cols() as $key => $value ) { |
|
94 | + foreach ($this->csv_cols() as $key => $value) { |
|
95 | 95 | |
96 | 96 | // Setup default value/ |
97 | - $row[ $key ] = ''; |
|
97 | + $row[$key] = ''; |
|
98 | 98 | |
99 | - if ( in_array( $key, $meta ) ) { |
|
99 | + if (in_array($key, $meta)) { |
|
100 | 100 | |
101 | - switch ( $key ) { |
|
101 | + switch ($key) { |
|
102 | 102 | |
103 | 103 | case '_thumbnail_id' : |
104 | 104 | |
105 | - $image_id = get_post_thumbnail_id( $form->ID ); |
|
106 | - $row[ $key ] = wp_get_attachment_url( $image_id ); |
|
105 | + $image_id = get_post_thumbnail_id($form->ID); |
|
106 | + $row[$key] = wp_get_attachment_url($image_id); |
|
107 | 107 | |
108 | 108 | break; |
109 | 109 | |
110 | 110 | case 'give_price' : |
111 | 111 | |
112 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
112 | + if (give_has_variable_prices($form->ID)) { |
|
113 | 113 | |
114 | 114 | $prices = []; |
115 | - foreach ( give_get_variable_prices( $form->ID ) as $price ) { |
|
116 | - $prices[] = $price['name'] . ': ' . $price['amount']; |
|
115 | + foreach (give_get_variable_prices($form->ID) as $price) { |
|
116 | + $prices[] = $price['name'].': '.$price['amount']; |
|
117 | 117 | } |
118 | 118 | |
119 | - $row[ $key ] = implode( ' | ', $prices ); |
|
119 | + $row[$key] = implode(' | ', $prices); |
|
120 | 120 | |
121 | 121 | } else { |
122 | 122 | |
123 | - $row[ $key ] = give_get_form_price( $form->ID ); |
|
123 | + $row[$key] = give_get_form_price($form->ID); |
|
124 | 124 | |
125 | 125 | } |
126 | 126 | |
@@ -128,44 +128,44 @@ discard block |
||
128 | 128 | |
129 | 129 | default : |
130 | 130 | |
131 | - $row[ $key ] = give_get_meta( $form->ID, $key, TRUE ); |
|
131 | + $row[$key] = give_get_meta($form->ID, $key, TRUE); |
|
132 | 132 | |
133 | 133 | break; |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | - } elseif ( isset( $form->$key ) ) { |
|
137 | + } elseif (isset($form->$key)) { |
|
138 | 138 | |
139 | - switch ( $key ) { |
|
139 | + switch ($key) { |
|
140 | 140 | |
141 | 141 | case 'post_author' : |
142 | 142 | |
143 | - $row[ $key ] = get_the_author_meta( 'user_login', $form->post_author ); |
|
143 | + $row[$key] = get_the_author_meta('user_login', $form->post_author); |
|
144 | 144 | |
145 | 145 | break; |
146 | 146 | |
147 | 147 | default : |
148 | 148 | |
149 | - $row[ $key ] = $form->$key; |
|
149 | + $row[$key] = $form->$key; |
|
150 | 150 | |
151 | 151 | break; |
152 | 152 | } |
153 | 153 | |
154 | - } elseif ( 'tags' == $key ) { |
|
154 | + } elseif ('tags' == $key) { |
|
155 | 155 | |
156 | - $terms = get_the_terms( $form->ID, 'form_tag' ); |
|
157 | - if ( $terms ) { |
|
158 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
159 | - $row[ $key ] = implode( ' | ', $terms ); |
|
156 | + $terms = get_the_terms($form->ID, 'form_tag'); |
|
157 | + if ($terms) { |
|
158 | + $terms = wp_list_pluck($terms, 'name'); |
|
159 | + $row[$key] = implode(' | ', $terms); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | - } elseif ( 'categories' == $key ) { |
|
163 | + } elseif ('categories' == $key) { |
|
164 | 164 | |
165 | - $terms = get_the_terms( $form->ID, 'form_category' ); |
|
166 | - if ( $terms ) { |
|
167 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
168 | - $row[ $key ] = implode( ' | ', $terms ); |
|
165 | + $terms = get_the_terms($form->ID, 'form_category'); |
|
166 | + if ($terms) { |
|
167 | + $terms = wp_list_pluck($terms, 'name'); |
|
168 | + $row[$key] = implode(' | ', $terms); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | } |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
180 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
179 | + $data = apply_filters('give_export_get_data', $data); |
|
180 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
181 | 181 | |
182 | 182 | return $data; |
183 | 183 | |
@@ -197,20 +197,20 @@ discard block |
||
197 | 197 | |
198 | 198 | $args = array( |
199 | 199 | 'post_type' => 'give_forms', |
200 | - 'posts_per_page' => - 1, |
|
200 | + 'posts_per_page' => -1, |
|
201 | 201 | 'post_status' => 'any', |
202 | 202 | 'fields' => 'ids', |
203 | 203 | ); |
204 | 204 | |
205 | - $forms = new WP_Query( $args ); |
|
205 | + $forms = new WP_Query($args); |
|
206 | 206 | $total = (int) $forms->post_count; |
207 | 207 | $percentage = 100; |
208 | 208 | |
209 | - if ( $total > 0 ) { |
|
210 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
209 | + if ($total > 0) { |
|
210 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
211 | 211 | } |
212 | 212 | |
213 | - if ( $percentage > 100 ) { |
|
213 | + if ($percentage > 100) { |
|
214 | 214 | $percentage = 100; |
215 | 215 | } |
216 | 216 |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | * @access private |
704 | 704 | * @since 1.7 |
705 | 705 | * |
706 | - * @return bool |
|
706 | + * @return false|null |
|
707 | 707 | */ |
708 | 708 | private function __remove_license_key_from_subscriptions() { |
709 | 709 | $subscriptions = get_option( 'give_subscriptions', array() ); |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * @param $plugin_data |
737 | 737 | * @param $status |
738 | 738 | * |
739 | - * @return bool |
|
739 | + * @return false|null |
|
740 | 740 | */ |
741 | 741 | public function plugin_page_notices( $plugin_file, $plugin_data, $status ) { |
742 | 742 | // Bailout. |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @since 1.8.7 |
760 | 760 | * @access public |
761 | - * @return array |
|
761 | + * @return string |
|
762 | 762 | */ |
763 | 763 | public function license_state_message() { |
764 | 764 | $message_data = array(); |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'Give_License' ) ) : |
|
17 | +if ( ! class_exists('Give_License')) : |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Give_License Class |
@@ -177,37 +177,37 @@ discard block |
||
177 | 177 | ) { |
178 | 178 | |
179 | 179 | // Only load in wp-admin. |
180 | - if ( ! is_admin() ) { |
|
180 | + if ( ! is_admin()) { |
|
181 | 181 | return; |
182 | 182 | } |
183 | 183 | |
184 | - if ( is_numeric( $_item_id ) ) { |
|
185 | - $this->item_id = absint( $_item_id ); |
|
184 | + if (is_numeric($_item_id)) { |
|
185 | + $this->item_id = absint($_item_id); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $give_options = give_get_settings(); |
189 | 189 | |
190 | 190 | $this->file = $_file; |
191 | 191 | $this->item_name = $_item_name; |
192 | - $this->item_shortname = self::get_short_name( $this->item_name ); |
|
192 | + $this->item_shortname = self::get_short_name($this->item_name); |
|
193 | 193 | $this->version = $_version; |
194 | - $this->license = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : ''; |
|
195 | - $this->license_data = __give_get_active_license_info( $this->item_shortname ); |
|
194 | + $this->license = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : ''; |
|
195 | + $this->license_data = __give_get_active_license_info($this->item_shortname); |
|
196 | 196 | $this->author = $_author; |
197 | - $this->api_url = is_null( $_api_url ) ? $this->api_url : $_api_url; |
|
198 | - $this->checkout_url = is_null( $_checkout_url ) ? $this->checkout_url : $_checkout_url; |
|
199 | - $this->account_url = is_null( $_account_url ) ? $this->account_url : $_account_url; |
|
197 | + $this->api_url = is_null($_api_url) ? $this->api_url : $_api_url; |
|
198 | + $this->checkout_url = is_null($_checkout_url) ? $this->checkout_url : $_checkout_url; |
|
199 | + $this->account_url = is_null($_account_url) ? $this->account_url : $_account_url; |
|
200 | 200 | $this->auto_updater_obj = null; |
201 | 201 | |
202 | 202 | // Add Setting for Give Add-on activation status. |
203 | - $is_addon_activated = get_option( 'give_is_addon_activated' ); |
|
204 | - if ( ! $is_addon_activated && is_object( $this ) ) { |
|
205 | - update_option( 'give_is_addon_activated', true, false ); |
|
206 | - Give_Cache::set( 'give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS ); |
|
203 | + $is_addon_activated = get_option('give_is_addon_activated'); |
|
204 | + if ( ! $is_addon_activated && is_object($this)) { |
|
205 | + update_option('give_is_addon_activated', true, false); |
|
206 | + Give_Cache::set('give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | // Add plugin to registered licenses list. |
210 | - array_push( self::$licensed_addons, plugin_basename( $this->file ) ); |
|
210 | + array_push(self::$licensed_addons, plugin_basename($this->file)); |
|
211 | 211 | |
212 | 212 | // Setup hooks |
213 | 213 | $this->includes(); |
@@ -226,9 +226,9 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return string |
228 | 228 | */ |
229 | - public static function get_short_name( $plugin_name ) { |
|
230 | - $plugin_name = trim( str_replace( 'Give - ', '', $plugin_name ) ); |
|
231 | - $plugin_name = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ); |
|
229 | + public static function get_short_name($plugin_name) { |
|
230 | + $plugin_name = trim(str_replace('Give - ', '', $plugin_name)); |
|
231 | + $plugin_name = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))); |
|
232 | 232 | |
233 | 233 | return $plugin_name; |
234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | private function includes() { |
247 | 247 | |
248 | - if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
248 | + if ( ! class_exists('EDD_SL_Plugin_Updater')) { |
|
249 | 249 | require_once 'admin/EDD_SL_Plugin_Updater.php'; |
250 | 250 | } |
251 | 251 | } |
@@ -263,28 +263,28 @@ discard block |
||
263 | 263 | private function hooks() { |
264 | 264 | |
265 | 265 | // Register settings. |
266 | - add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 ); |
|
266 | + add_filter('give_settings_licenses', array($this, 'settings'), 1); |
|
267 | 267 | |
268 | 268 | // Activate license key on settings save. |
269 | - add_action( 'admin_init', array( $this, 'activate_license' ), 10 ); |
|
269 | + add_action('admin_init', array($this, 'activate_license'), 10); |
|
270 | 270 | |
271 | 271 | // Deactivate license key. |
272 | - add_action( 'admin_init', array( $this, 'deactivate_license' ), 11 ); |
|
272 | + add_action('admin_init', array($this, 'deactivate_license'), 11); |
|
273 | 273 | |
274 | 274 | // Updater. |
275 | - add_action( 'admin_init', array( $this, 'auto_updater' ), 0 ); |
|
276 | - add_action( 'admin_notices', array( $this, 'notices' ) ); |
|
275 | + add_action('admin_init', array($this, 'auto_updater'), 0); |
|
276 | + add_action('admin_notices', array($this, 'notices')); |
|
277 | 277 | |
278 | 278 | // Check license weekly. |
279 | - Give_Cron::add_weekly_event( array( $this, 'weekly_license_check' ) ); |
|
279 | + Give_Cron::add_weekly_event(array($this, 'weekly_license_check')); |
|
280 | 280 | |
281 | 281 | // Check subscription weekly. |
282 | - Give_Cron::add_weekly_event( array( $this, 'weekly_subscription_check' ) ); |
|
282 | + Give_Cron::add_weekly_event(array($this, 'weekly_subscription_check')); |
|
283 | 283 | |
284 | 284 | // Show addon notice on plugin page. |
285 | - $plugin_name = explode( 'plugins/', $this->file ); |
|
286 | - $plugin_name = end( $plugin_name ); |
|
287 | - add_action( "after_plugin_row_{$plugin_name}", array( $this, 'plugin_page_notices' ), 10, 3 ); |
|
285 | + $plugin_name = explode('plugins/', $this->file); |
|
286 | + $plugin_name = end($plugin_name); |
|
287 | + add_action("after_plugin_row_{$plugin_name}", array($this, 'plugin_page_notices'), 10, 3); |
|
288 | 288 | |
289 | 289 | } |
290 | 290 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function auto_updater() { |
301 | 301 | |
302 | - if ( ! empty( $this->item_id ) ) { |
|
302 | + if ( ! empty($this->item_id)) { |
|
303 | 303 | $args['item_id'] = $this->item_id; |
304 | 304 | } else { |
305 | 305 | $args['item_name'] = $this->item_name; |
@@ -330,16 +330,16 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return array License settings. |
332 | 332 | */ |
333 | - public function settings( $settings ) { |
|
333 | + public function settings($settings) { |
|
334 | 334 | |
335 | 335 | $give_license_settings = array( |
336 | 336 | array( |
337 | 337 | 'name' => $this->item_name, |
338 | - 'id' => $this->item_shortname . '_license_key', |
|
338 | + 'id' => $this->item_shortname.'_license_key', |
|
339 | 339 | 'desc' => '', |
340 | 340 | 'type' => 'license_key', |
341 | 341 | 'options' => array( |
342 | - 'license' => get_option( $this->item_shortname . '_license_active' ), |
|
342 | + 'license' => get_option($this->item_shortname.'_license_active'), |
|
343 | 343 | 'shortname' => $this->item_shortname, |
344 | 344 | 'item_name' => $this->item_name, |
345 | 345 | 'api_url' => $this->api_url, |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | ), |
351 | 351 | ); |
352 | 352 | |
353 | - return array_merge( $settings, $give_license_settings ); |
|
353 | + return array_merge($settings, $give_license_settings); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -365,18 +365,18 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @return array License settings content. |
367 | 367 | */ |
368 | - public function license_settings_content( $settings ) { |
|
368 | + public function license_settings_content($settings) { |
|
369 | 369 | |
370 | 370 | $give_license_settings = array( |
371 | 371 | array( |
372 | - 'name' => __( 'Add-on Licenses', 'give' ), |
|
372 | + 'name' => __('Add-on Licenses', 'give'), |
|
373 | 373 | 'desc' => '<hr>', |
374 | 374 | 'type' => 'give_title', |
375 | 375 | 'id' => 'give_title', |
376 | 376 | ), |
377 | 377 | ); |
378 | 378 | |
379 | - return array_merge( $settings, $give_license_settings ); |
|
379 | + return array_merge($settings, $give_license_settings); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
@@ -391,62 +391,62 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function activate_license() { |
393 | 393 | // Bailout. |
394 | - if ( ! $this->__is_user_can_edit_license() ) { |
|
394 | + if ( ! $this->__is_user_can_edit_license()) { |
|
395 | 395 | return; |
396 | 396 | } |
397 | 397 | |
398 | 398 | // Allow third party addon developers to handle license activation. |
399 | - if ( $this->__is_third_party_addon() ) { |
|
400 | - do_action( 'give_activate_license', $this ); |
|
399 | + if ($this->__is_third_party_addon()) { |
|
400 | + do_action('give_activate_license', $this); |
|
401 | 401 | |
402 | 402 | return; |
403 | 403 | } |
404 | 404 | |
405 | 405 | // Delete previous license setting if a empty license key submitted. |
406 | - if ( empty( $_POST[ "{$this->item_shortname}_license_key" ] ) ) { |
|
406 | + if (empty($_POST["{$this->item_shortname}_license_key"])) { |
|
407 | 407 | $this->unset_license(); |
408 | 408 | |
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
412 | 412 | // Do not simultaneously activate add-ons if the user want to deactivate a specific add-on. |
413 | - if ( $this->is_deactivating_license() ) { |
|
413 | + if ($this->is_deactivating_license()) { |
|
414 | 414 | return; |
415 | 415 | } |
416 | 416 | |
417 | 417 | // Check if plugin previously installed. |
418 | - if ( $this->is_valid_license() ) { |
|
418 | + if ($this->is_valid_license()) { |
|
419 | 419 | return; |
420 | 420 | } |
421 | 421 | |
422 | 422 | // Get license key. |
423 | - $this->license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] ); |
|
423 | + $this->license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']); |
|
424 | 424 | |
425 | 425 | // Delete previous license key from subscription if previously added. |
426 | 426 | $this->__remove_license_key_from_subscriptions(); |
427 | 427 | |
428 | 428 | // Make sure there are no api errors. |
429 | - if ( ! ( $license_data = $this->get_license_info( 'activate_license' ) ) ) { |
|
429 | + if ( ! ($license_data = $this->get_license_info('activate_license'))) { |
|
430 | 430 | return; |
431 | 431 | } |
432 | 432 | |
433 | 433 | // Make sure license is valid. |
434 | 434 | // return because admin will want to activate license again. |
435 | - if ( ! $this->is_license( $license_data ) ) { |
|
435 | + if ( ! $this->is_license($license_data)) { |
|
436 | 436 | // Add license key. |
437 | - give_update_option( "{$this->item_shortname}_license_key", $this->license ); |
|
437 | + give_update_option("{$this->item_shortname}_license_key", $this->license); |
|
438 | 438 | |
439 | 439 | return; |
440 | 440 | } |
441 | 441 | |
442 | 442 | // Tell WordPress to look for updates. |
443 | - set_site_transient( 'update_plugins', null ); |
|
443 | + set_site_transient('update_plugins', null); |
|
444 | 444 | |
445 | 445 | // Add license data. |
446 | - update_option( "{$this->item_shortname}_license_active", $license_data, false ); |
|
446 | + update_option("{$this->item_shortname}_license_active", $license_data, false); |
|
447 | 447 | |
448 | 448 | // Add license key. |
449 | - give_update_option( "{$this->item_shortname}_license_key", $this->license ); |
|
449 | + give_update_option("{$this->item_shortname}_license_key", $this->license); |
|
450 | 450 | |
451 | 451 | // Check subscription for license key and store this to db (if any). |
452 | 452 | $this->__single_subscription_check(); |
@@ -464,19 +464,19 @@ discard block |
||
464 | 464 | */ |
465 | 465 | public function deactivate_license() { |
466 | 466 | // Bailout. |
467 | - if ( ! $this->__is_user_can_edit_license() ) { |
|
467 | + if ( ! $this->__is_user_can_edit_license()) { |
|
468 | 468 | return; |
469 | 469 | } |
470 | 470 | |
471 | 471 | // Allow third party add-on developers to handle license deactivation. |
472 | - if ( $this->__is_third_party_addon() ) { |
|
473 | - do_action( 'give_deactivate_license', $this ); |
|
472 | + if ($this->__is_third_party_addon()) { |
|
473 | + do_action('give_deactivate_license', $this); |
|
474 | 474 | |
475 | 475 | return; |
476 | 476 | } |
477 | 477 | |
478 | 478 | // Run on deactivate button press. |
479 | - if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) { |
|
479 | + if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) { |
|
480 | 480 | $this->unset_license(); |
481 | 481 | } |
482 | 482 | } |
@@ -492,30 +492,30 @@ discard block |
||
492 | 492 | public function weekly_license_check() { |
493 | 493 | |
494 | 494 | if ( |
495 | - ! empty( $_POST['give_settings'] ) || |
|
496 | - empty( $this->license ) |
|
495 | + ! empty($_POST['give_settings']) || |
|
496 | + empty($this->license) |
|
497 | 497 | ) { |
498 | 498 | return; |
499 | 499 | } |
500 | 500 | |
501 | 501 | // Allow third party add-on developers to handle their license check. |
502 | - if ( $this->__is_third_party_addon() ) { |
|
503 | - do_action( 'give_weekly_license_check', $this ); |
|
502 | + if ($this->__is_third_party_addon()) { |
|
503 | + do_action('give_weekly_license_check', $this); |
|
504 | 504 | |
505 | 505 | return; |
506 | 506 | } |
507 | 507 | |
508 | 508 | // Make sure there are no api errors. |
509 | - if ( ! ( $license_data = $this->get_license_info( 'check_license' ) ) ) { |
|
509 | + if ( ! ($license_data = $this->get_license_info('check_license'))) { |
|
510 | 510 | return; |
511 | 511 | } |
512 | 512 | |
513 | 513 | // Bailout. |
514 | - if ( ! $this->is_license( $license_data ) ) { |
|
514 | + if ( ! $this->is_license($license_data)) { |
|
515 | 515 | return; |
516 | 516 | } |
517 | 517 | |
518 | - update_option( $this->item_shortname . '_license_active', $license_data, false ); |
|
518 | + update_option($this->item_shortname.'_license_active', $license_data, false); |
|
519 | 519 | |
520 | 520 | return; |
521 | 521 | } |
@@ -531,21 +531,21 @@ discard block |
||
531 | 531 | public function weekly_subscription_check() { |
532 | 532 | // Bailout. |
533 | 533 | if ( |
534 | - ! empty( $_POST['give_settings'] ) |
|
535 | - || empty( $this->license ) |
|
534 | + ! empty($_POST['give_settings']) |
|
535 | + || empty($this->license) |
|
536 | 536 | ) { |
537 | 537 | return; |
538 | 538 | } |
539 | 539 | |
540 | 540 | // Remove old subscription data. |
541 | - if ( absint( get_option( '_give_subscriptions_edit_last', true ) ) < current_time( 'timestamp', 1 ) ) { |
|
542 | - delete_option( 'give_subscriptions' ); |
|
543 | - update_option( '_give_subscriptions_edit_last', strtotime( '+ 1 day', current_time( 'timestamp', 1 ) ), false ); |
|
541 | + if (absint(get_option('_give_subscriptions_edit_last', true)) < current_time('timestamp', 1)) { |
|
542 | + delete_option('give_subscriptions'); |
|
543 | + update_option('_give_subscriptions_edit_last', strtotime('+ 1 day', current_time('timestamp', 1)), false); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | // Allow third party add-on developers to handle their subscription check. |
547 | - if ( $this->__is_third_party_addon() ) { |
|
548 | - do_action( 'give_weekly_subscription_check', $this ); |
|
547 | + if ($this->__is_third_party_addon()) { |
|
548 | + do_action('give_weekly_subscription_check', $this); |
|
549 | 549 | |
550 | 550 | return; |
551 | 551 | } |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | * @return void |
563 | 563 | */ |
564 | 564 | private function __single_subscription_check() { |
565 | - if ( empty( $this->license ) ) { |
|
565 | + if (empty($this->license)) { |
|
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
@@ -573,26 +573,26 @@ discard block |
||
573 | 573 | * By default edd software licensing api does not have api to check subscription. |
574 | 574 | * This is a custom feature to check subscriptions. |
575 | 575 | */ |
576 | - $subscription_data = $this->get_license_info( 'check_subscription', true ); |
|
576 | + $subscription_data = $this->get_license_info('check_subscription', true); |
|
577 | 577 | |
578 | - if ( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) { |
|
578 | + if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) { |
|
579 | 579 | |
580 | - $subscriptions = get_option( 'give_subscriptions', array() ); |
|
580 | + $subscriptions = get_option('give_subscriptions', array()); |
|
581 | 581 | |
582 | 582 | // Update subscription data only if subscription does not exist already. |
583 | - $subscriptions[ $subscription_data['id'] ] = $subscription_data; |
|
583 | + $subscriptions[$subscription_data['id']] = $subscription_data; |
|
584 | 584 | |
585 | 585 | // Initiate default set of license for subscription. |
586 | - if ( ! isset( $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) { |
|
587 | - $subscriptions[ $subscription_data['id'] ]['licenses'] = array(); |
|
586 | + if ( ! isset($subscriptions[$subscription_data['id']]['licenses'])) { |
|
587 | + $subscriptions[$subscription_data['id']]['licenses'] = array(); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | // Store licenses for subscription. |
591 | - if ( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) { |
|
592 | - $subscriptions[ $subscription_data['id'] ]['licenses'][] = $this->license; |
|
591 | + if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) { |
|
592 | + $subscriptions[$subscription_data['id']]['licenses'][] = $this->license; |
|
593 | 593 | } |
594 | 594 | |
595 | - update_option( 'give_subscriptions', $subscriptions, false ); |
|
595 | + update_option('give_subscriptions', $subscriptions, false); |
|
596 | 596 | } |
597 | 597 | } |
598 | 598 | |
@@ -606,12 +606,12 @@ discard block |
||
606 | 606 | */ |
607 | 607 | public function notices() { |
608 | 608 | |
609 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
609 | + if ( ! current_user_can('manage_give_settings')) { |
|
610 | 610 | return; |
611 | 611 | } |
612 | 612 | |
613 | 613 | // Do not show licenses notices on license tab. |
614 | - if ( 'licenses' === give_get_current_setting_tab() ) { |
|
614 | + if ('licenses' === give_get_current_setting_tab()) { |
|
615 | 615 | return; |
616 | 616 | } |
617 | 617 | |
@@ -620,17 +620,17 @@ discard block |
||
620 | 620 | static $addon_license_key_in_subscriptions; |
621 | 621 | |
622 | 622 | // Set default value. |
623 | - $addon_license_key_in_subscriptions = ! empty( $addon_license_key_in_subscriptions ) ? $addon_license_key_in_subscriptions : array(); |
|
623 | + $addon_license_key_in_subscriptions = ! empty($addon_license_key_in_subscriptions) ? $addon_license_key_in_subscriptions : array(); |
|
624 | 624 | $messages = array(); |
625 | 625 | |
626 | 626 | // Check whether admin has Give Add-on activated since 24 hours? |
627 | - $is_license_notice_hidden = Give_Cache::get( 'give_cache_hide_license_notice_after_activation' ); |
|
627 | + $is_license_notice_hidden = Give_Cache::get('give_cache_hide_license_notice_after_activation'); |
|
628 | 628 | |
629 | 629 | // Display Invalid License notice, if its more than 24 hours since first Give Add-on activation. |
630 | 630 | if ( |
631 | - empty( $this->license ) |
|
632 | - && empty( $showed_invalid_message ) |
|
633 | - && ( false === $is_license_notice_hidden ) |
|
631 | + empty($this->license) |
|
632 | + && empty($showed_invalid_message) |
|
633 | + && (false === $is_license_notice_hidden) |
|
634 | 634 | ) { |
635 | 635 | |
636 | 636 | Give()->notices->register_notice( |
@@ -638,8 +638,8 @@ discard block |
||
638 | 638 | 'id' => 'give-invalid-license', |
639 | 639 | 'type' => 'error', |
640 | 640 | 'description' => sprintf( |
641 | - __( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ), |
|
642 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) |
|
641 | + __('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'), |
|
642 | + admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses') |
|
643 | 643 | ), |
644 | 644 | 'dismissible_type' => 'user', |
645 | 645 | 'dismiss_interval' => 'shortly', |
@@ -651,39 +651,39 @@ discard block |
||
651 | 651 | } |
652 | 652 | |
653 | 653 | // Get subscriptions. |
654 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
654 | + $subscriptions = get_option('give_subscriptions'); |
|
655 | 655 | |
656 | 656 | // Show subscription messages. |
657 | - if ( ! empty( $subscriptions ) && ! $showed_subscriptions_message ) { |
|
657 | + if ( ! empty($subscriptions) && ! $showed_subscriptions_message) { |
|
658 | 658 | |
659 | - foreach ( $subscriptions as $subscription ) { |
|
659 | + foreach ($subscriptions as $subscription) { |
|
660 | 660 | // Subscription expires timestamp. |
661 | - $subscription_expires = strtotime( $subscription['expires'] ); |
|
661 | + $subscription_expires = strtotime($subscription['expires']); |
|
662 | 662 | |
663 | 663 | // Start showing subscriptions message before one week of renewal date. |
664 | - if ( strtotime( '- 7 days', $subscription_expires ) > current_time( 'timestamp', 1 ) ) { |
|
664 | + if (strtotime('- 7 days', $subscription_expires) > current_time('timestamp', 1)) { |
|
665 | 665 | continue; |
666 | 666 | } |
667 | 667 | |
668 | 668 | // Check if subscription message already exist in messages. |
669 | - if ( array_key_exists( $subscription['id'], $messages ) ) { |
|
669 | + if (array_key_exists($subscription['id'], $messages)) { |
|
670 | 670 | continue; |
671 | 671 | } |
672 | 672 | |
673 | 673 | // Check if license already expired. |
674 | - if ( strtotime( $subscription['expires'] ) < current_time( 'timestamp', 1 ) ) { |
|
674 | + if (strtotime($subscription['expires']) < current_time('timestamp', 1)) { |
|
675 | 675 | Give()->notices->register_notice( |
676 | 676 | array( |
677 | 677 | 'id' => "give-expired-subscription-{$subscription['id']}", |
678 | 678 | 'type' => 'error', |
679 | 679 | 'description' => sprintf( |
680 | - __( 'Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give' ), |
|
681 | - urldecode( $subscription['invoice_url'] ), |
|
680 | + __('Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give'), |
|
681 | + urldecode($subscription['invoice_url']), |
|
682 | 682 | $subscription['payment_id'], |
683 | 683 | "{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired", |
684 | 684 | Give()->notices->get_dismiss_link( |
685 | 685 | array( |
686 | - 'title' => __( 'Click here if already renewed', 'give' ), |
|
686 | + 'title' => __('Click here if already renewed', 'give'), |
|
687 | 687 | 'dismissible_type' => 'user', |
688 | 688 | 'dismiss_interval' => 'permanent', |
689 | 689 | ) |
@@ -699,14 +699,14 @@ discard block |
||
699 | 699 | 'id' => "give-expires-subscription-{$subscription['id']}", |
700 | 700 | 'type' => 'error', |
701 | 701 | 'description' => sprintf( |
702 | - __( 'Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give' ), |
|
703 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscription['expires'] ) ), |
|
704 | - urldecode( $subscription['invoice_url'] ), |
|
702 | + __('Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give'), |
|
703 | + human_time_diff(current_time('timestamp', 1), strtotime($subscription['expires'])), |
|
704 | + urldecode($subscription['invoice_url']), |
|
705 | 705 | $subscription['payment_id'], |
706 | 706 | "{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired", |
707 | 707 | Give()->notices->get_dismiss_link( |
708 | 708 | array( |
709 | - 'title' => __( 'Click here if already renewed', 'give' ), |
|
709 | + 'title' => __('Click here if already renewed', 'give'), |
|
710 | 710 | 'dismissible_type' => 'user', |
711 | 711 | 'dismiss_interval' => 'permanent', |
712 | 712 | ) |
@@ -719,16 +719,16 @@ discard block |
||
719 | 719 | } |
720 | 720 | |
721 | 721 | // Stop validation for these license keys. |
722 | - $addon_license_key_in_subscriptions = array_merge( $addon_license_key_in_subscriptions, $subscription['licenses'] ); |
|
722 | + $addon_license_key_in_subscriptions = array_merge($addon_license_key_in_subscriptions, $subscription['licenses']); |
|
723 | 723 | }// End foreach(). |
724 | 724 | $showed_subscriptions_message = true; |
725 | 725 | }// End if(). |
726 | 726 | |
727 | 727 | // Show Non Subscription Give Add-on messages. |
728 | 728 | if ( |
729 | - ! in_array( $this->license, $addon_license_key_in_subscriptions ) |
|
730 | - && ! empty( $this->license ) |
|
731 | - && empty( $showed_invalid_message ) |
|
729 | + ! in_array($this->license, $addon_license_key_in_subscriptions) |
|
730 | + && ! empty($this->license) |
|
731 | + && empty($showed_invalid_message) |
|
732 | 732 | && ! $this->is_valid_license() |
733 | 733 | ) { |
734 | 734 | |
@@ -737,8 +737,8 @@ discard block |
||
737 | 737 | 'id' => 'give-invalid-license', |
738 | 738 | 'type' => 'error', |
739 | 739 | 'description' => sprintf( |
740 | - __( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ), |
|
741 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) |
|
740 | + __('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'), |
|
741 | + admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses') |
|
742 | 742 | ), |
743 | 743 | 'dismissible_type' => 'user', |
744 | 744 | 'dismiss_interval' => 'shortly', |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | * |
761 | 761 | * @return bool |
762 | 762 | */ |
763 | - public function is_valid_license( $licence_data = null ) { |
|
764 | - $license_data = empty( $licence_data ) ? $this->license_data : $licence_data; |
|
763 | + public function is_valid_license($licence_data = null) { |
|
764 | + $license_data = empty($licence_data) ? $this->license_data : $licence_data; |
|
765 | 765 | |
766 | - if ( apply_filters( 'give_is_valid_license', ( $this->is_license( $license_data ) && 'valid' === $license_data->license ) ) ) { |
|
766 | + if (apply_filters('give_is_valid_license', ($this->is_license($license_data) && 'valid' === $license_data->license))) { |
|
767 | 767 | return true; |
768 | 768 | } |
769 | 769 | |
@@ -781,10 +781,10 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return bool |
783 | 783 | */ |
784 | - public function is_license( $licence_data = null ) { |
|
785 | - $license_data = empty( $licence_data ) ? $this->license_data : $licence_data; |
|
784 | + public function is_license($licence_data = null) { |
|
785 | + $license_data = empty($licence_data) ? $this->license_data : $licence_data; |
|
786 | 786 | |
787 | - if ( apply_filters( 'give_is_license', ( is_object( $license_data ) && ! empty( $license_data ) && property_exists( $license_data, 'license' ) ) ) ) { |
|
787 | + if (apply_filters('give_is_license', (is_object($license_data) && ! empty($license_data) && property_exists($license_data, 'license')))) { |
|
788 | 788 | return true; |
789 | 789 | } |
790 | 790 | |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | * @return bool |
801 | 801 | */ |
802 | 802 | private function __is_third_party_addon() { |
803 | - return ( false === strpos( $this->api_url, 'givewp.com/' ) ); |
|
803 | + return (false === strpos($this->api_url, 'givewp.com/')); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
@@ -815,25 +815,25 @@ discard block |
||
815 | 815 | * @return bool |
816 | 816 | */ |
817 | 817 | private function __remove_license_key_from_subscriptions() { |
818 | - $subscriptions = get_option( 'give_subscriptions', array() ); |
|
818 | + $subscriptions = get_option('give_subscriptions', array()); |
|
819 | 819 | |
820 | 820 | // Bailout. |
821 | - if ( empty( $this->license ) ) { |
|
821 | + if (empty($this->license)) { |
|
822 | 822 | return false; |
823 | 823 | } |
824 | 824 | |
825 | - if ( ! empty( $subscriptions ) ) { |
|
826 | - foreach ( $subscriptions as $subscription_id => $subscription ) { |
|
827 | - $license_index = array_search( $this->license, $subscription['licenses'] ); |
|
828 | - if ( false !== $license_index ) { |
|
825 | + if ( ! empty($subscriptions)) { |
|
826 | + foreach ($subscriptions as $subscription_id => $subscription) { |
|
827 | + $license_index = array_search($this->license, $subscription['licenses']); |
|
828 | + if (false !== $license_index) { |
|
829 | 829 | // Remove license key. |
830 | - unset( $subscriptions[ $subscription_id ]['licenses'][ $license_index ] ); |
|
830 | + unset($subscriptions[$subscription_id]['licenses'][$license_index]); |
|
831 | 831 | |
832 | 832 | // Rearrange license keys. |
833 | - $subscriptions[ $subscription_id ]['licenses'] = array_values( $subscriptions[ $subscription_id ]['licenses'] ); |
|
833 | + $subscriptions[$subscription_id]['licenses'] = array_values($subscriptions[$subscription_id]['licenses']); |
|
834 | 834 | |
835 | 835 | // Update subscription information. |
836 | - update_option( 'give_subscriptions', $subscriptions, false ); |
|
836 | + update_option('give_subscriptions', $subscriptions, false); |
|
837 | 837 | break; |
838 | 838 | } |
839 | 839 | } |
@@ -849,17 +849,17 @@ discard block |
||
849 | 849 | * |
850 | 850 | * @return bool |
851 | 851 | */ |
852 | - public function plugin_page_notices( $plugin_file, $plugin_data, $status ) { |
|
852 | + public function plugin_page_notices($plugin_file, $plugin_data, $status) { |
|
853 | 853 | // Bailout. |
854 | - if ( $this->is_valid_license() ) { |
|
854 | + if ($this->is_valid_license()) { |
|
855 | 855 | return false; |
856 | 856 | } |
857 | 857 | |
858 | 858 | $update_notice_wrap = '<tr class="give-addon-notice-tr active"><td colspan="3" class="colspanchange"><div class="notice inline notice-warning notice-alt give-invalid-license"><p><span class="dashicons dashicons-info"></span> %s</p></div></td></tr>'; |
859 | 859 | $message = $this->license_state_message(); |
860 | 860 | |
861 | - if ( ! empty( $message['message'] ) ) { |
|
862 | - echo sprintf( $update_notice_wrap, $message['message'] ); |
|
861 | + if ( ! empty($message['message'])) { |
|
862 | + echo sprintf($update_notice_wrap, $message['message']); |
|
863 | 863 | } |
864 | 864 | } |
865 | 865 | |
@@ -874,11 +874,11 @@ discard block |
||
874 | 874 | public function license_state_message() { |
875 | 875 | $message_data = array(); |
876 | 876 | |
877 | - if ( ! $this->is_valid_license() ) { |
|
877 | + if ( ! $this->is_valid_license()) { |
|
878 | 878 | |
879 | 879 | $message_data['message'] = sprintf( |
880 | 880 | 'Please <a href="%1$s">activate your license</a> to receive updates and support for the %2$s add-on.', |
881 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) ), |
|
881 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')), |
|
882 | 882 | $this->item_name |
883 | 883 | ); |
884 | 884 | } |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | // Bailout. |
899 | 899 | if ( |
900 | 900 | ! Give_Admin_Settings::verify_nonce() |
901 | - || ! current_user_can( 'manage_give_settings' ) |
|
901 | + || ! current_user_can('manage_give_settings') |
|
902 | 902 | || 'licenses' !== give_get_current_setting_tab() |
903 | 903 | ) { |
904 | 904 | return false; |
@@ -906,10 +906,10 @@ discard block |
||
906 | 906 | |
907 | 907 | // Security check. |
908 | 908 | if ( |
909 | - isset( $_POST[ $this->item_shortname . '_license_key-nonce' ] ) |
|
910 | - && ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) |
|
909 | + isset($_POST[$this->item_shortname.'_license_key-nonce']) |
|
910 | + && ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce') |
|
911 | 911 | ) { |
912 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
912 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | return true; |
@@ -927,9 +927,9 @@ discard block |
||
927 | 927 | * |
928 | 928 | * @return mixed |
929 | 929 | */ |
930 | - public function get_license_info( $edd_action = '', $response_in_array = false ) { |
|
930 | + public function get_license_info($edd_action = '', $response_in_array = false) { |
|
931 | 931 | |
932 | - if ( empty( $edd_action ) ) { |
|
932 | + if (empty($edd_action)) { |
|
933 | 933 | return false; |
934 | 934 | } |
935 | 935 | |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | $api_params = array( |
938 | 938 | 'edd_action' => $edd_action, // never change from "edd_" to "give_"! |
939 | 939 | 'license' => $this->license, |
940 | - 'item_name' => urlencode( $this->item_name ), |
|
940 | + 'item_name' => urlencode($this->item_name), |
|
941 | 941 | 'url' => home_url(), |
942 | 942 | ); |
943 | 943 | |
@@ -952,11 +952,11 @@ discard block |
||
952 | 952 | ); |
953 | 953 | |
954 | 954 | // Make sure there are no errors. |
955 | - if ( is_wp_error( $response ) ) { |
|
955 | + if (is_wp_error($response)) { |
|
956 | 956 | return false; |
957 | 957 | } |
958 | 958 | |
959 | - return json_decode( wp_remote_retrieve_body( $response ), $response_in_array ); |
|
959 | + return json_decode(wp_remote_retrieve_body($response), $response_in_array); |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | |
@@ -972,9 +972,9 @@ discard block |
||
972 | 972 | $this->__remove_license_key_from_subscriptions(); |
973 | 973 | |
974 | 974 | // Remove license from database. |
975 | - delete_option( "{$this->item_shortname}_license_active" ); |
|
976 | - give_delete_option( "{$this->item_shortname}_license_key" ); |
|
977 | - unset( $_POST[ "{$this->item_shortname}_license_key" ] ); |
|
975 | + delete_option("{$this->item_shortname}_license_active"); |
|
976 | + give_delete_option("{$this->item_shortname}_license_key"); |
|
977 | + unset($_POST["{$this->item_shortname}_license_key"]); |
|
978 | 978 | |
979 | 979 | // Unset license param. |
980 | 980 | $this->license = ''; |
@@ -992,8 +992,8 @@ discard block |
||
992 | 992 | private function is_deactivating_license() { |
993 | 993 | $status = false; |
994 | 994 | |
995 | - foreach ( $_POST as $key => $value ) { |
|
996 | - if ( false !== strpos( $key, 'license_key_deactivate' ) ) { |
|
995 | + foreach ($_POST as $key => $value) { |
|
996 | + if (false !== strpos($key, 'license_key_deactivate')) { |
|
997 | 997 | $status = true; |
998 | 998 | break; |
999 | 999 | } |
@@ -249,10 +249,10 @@ |
||
249 | 249 | $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | - '<a href="%1$s">%2$s</a>', |
|
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
252 | + '<a href="%1$s">%2$s</a>', |
|
253 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
254 | + __( 'View Donation Details »', 'give' ) |
|
255 | + ) . "\n\n"; |
|
256 | 256 | |
257 | 257 | $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
258 | 258 | $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give'), |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Add our payment instructions to the checkout |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return void |
41 | 41 | */ |
42 | -function give_offline_payment_cc_form( $form_id ) { |
|
42 | +function give_offline_payment_cc_form($form_id) { |
|
43 | 43 | // Get offline payment instruction. |
44 | - $offline_instructions = give_get_offline_payment_instruction( $form_id, true ); |
|
44 | + $offline_instructions = give_get_offline_payment_instruction($form_id, true); |
|
45 | 45 | |
46 | 46 | ob_start(); |
47 | 47 | |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @param int $form_id Give form id. |
54 | 54 | */ |
55 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
55 | + do_action('give_before_offline_info_fields', $form_id); |
|
56 | 56 | ?> |
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | - <?php echo stripslashes( $offline_instructions ); ?> |
|
58 | + <?php echo stripslashes($offline_instructions); ?> |
|
59 | 59 | </fieldset> |
60 | 60 | <?php |
61 | 61 | /** |
@@ -65,35 +65,35 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param int $form_id Give form id. |
67 | 67 | */ |
68 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
68 | + do_action('give_after_offline_info_fields', $form_id); |
|
69 | 69 | |
70 | 70 | echo ob_get_clean(); |
71 | 71 | } |
72 | 72 | |
73 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
73 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Give Offline Billing Field |
77 | 77 | * |
78 | 78 | * @param $form_id |
79 | 79 | */ |
80 | -function give_offline_billing_fields( $form_id ) { |
|
80 | +function give_offline_billing_fields($form_id) { |
|
81 | 81 | //Enable Default CC fields (billing info) |
82 | - $post_offline_cc_fields = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
83 | - $post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
82 | + $post_offline_cc_fields = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
83 | + $post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
84 | 84 | |
85 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
85 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
86 | 86 | |
87 | 87 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
88 | 88 | if ( |
89 | - ( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) ) |
|
90 | - || ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) ) |
|
89 | + (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields)) |
|
90 | + || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields)) |
|
91 | 91 | ) { |
92 | - give_default_cc_address_fields( $form_id ); |
|
92 | + give_default_cc_address_fields($form_id); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
96 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Process the payment |
@@ -104,18 +104,18 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return void |
106 | 106 | */ |
107 | -function give_offline_process_payment( $purchase_data ) { |
|
107 | +function give_offline_process_payment($purchase_data) { |
|
108 | 108 | |
109 | 109 | // Setup the payment details. |
110 | 110 | $payment_data = array( |
111 | 111 | 'price' => $purchase_data['price'], |
112 | 112 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
113 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
114 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
113 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
114 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
115 | 115 | 'date' => $purchase_data['date'], |
116 | 116 | 'user_email' => $purchase_data['user_email'], |
117 | 117 | 'purchase_key' => $purchase_data['purchase_key'], |
118 | - 'currency' => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ), |
|
118 | + 'currency' => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data), |
|
119 | 119 | 'user_info' => $purchase_data['user_info'], |
120 | 120 | 'status' => 'pending', |
121 | 121 | 'gateway' => 'offline', |
@@ -123,18 +123,18 @@ discard block |
||
123 | 123 | |
124 | 124 | |
125 | 125 | // record the pending payment |
126 | - $payment = give_insert_payment( $payment_data ); |
|
126 | + $payment = give_insert_payment($payment_data); |
|
127 | 127 | |
128 | - if ( $payment ) { |
|
128 | + if ($payment) { |
|
129 | 129 | give_send_to_success_page(); |
130 | 130 | } else { |
131 | 131 | // if errors are present, send the user back to the donation form so they can be corrected |
132 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
132 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
137 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -147,59 +147,59 @@ discard block |
||
147 | 147 | * @since 1.0 |
148 | 148 | * @return void |
149 | 149 | */ |
150 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
150 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
151 | 151 | |
152 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
153 | - $post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
152 | + $payment_data = give_get_payment_meta($payment_id); |
|
153 | + $post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
154 | 154 | |
155 | 155 | //Customize email content depending on whether the single form has been customized |
156 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
156 | + $email_content = give_get_option('global_offline_donation_email'); |
|
157 | 157 | |
158 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
159 | - $email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
158 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
159 | + $email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
160 | 160 | } |
161 | 161 | |
162 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
162 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Filters the from name. |
166 | 166 | * |
167 | 167 | * @since 1.7 |
168 | 168 | */ |
169 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
169 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
170 | 170 | |
171 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
171 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
172 | 172 | |
173 | 173 | /** |
174 | 174 | * Filters the from email. |
175 | 175 | * |
176 | 176 | * @since 1.7 |
177 | 177 | */ |
178 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
178 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
179 | 179 | |
180 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
180 | + $to_email = give_get_payment_user_email($payment_id); |
|
181 | 181 | |
182 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
183 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
184 | - $subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
182 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
183 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
184 | + $subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
185 | 185 | } |
186 | 186 | |
187 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
188 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
187 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
188 | + $subject = give_do_email_tags($subject, $payment_id); |
|
189 | 189 | |
190 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
191 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
190 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
191 | + $message = give_do_email_tags($email_content, $payment_id); |
|
192 | 192 | |
193 | 193 | $emails = Give()->emails; |
194 | 194 | |
195 | - $emails->__set( 'from_name', $from_name ); |
|
196 | - $emails->__set( 'from_email', $from_email ); |
|
197 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
195 | + $emails->__set('from_name', $from_name); |
|
196 | + $emails->__set('from_email', $from_email); |
|
197 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
198 | 198 | |
199 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
200 | - $emails->__set( 'headers', $headers ); |
|
199 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
200 | + $emails->__set('headers', $headers); |
|
201 | 201 | |
202 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
202 | + $emails->send($to_email, $subject, $message, $attachments); |
|
203 | 203 | |
204 | 204 | } |
205 | 205 | |
@@ -216,54 +216,54 @@ discard block |
||
216 | 216 | * @return void |
217 | 217 | * |
218 | 218 | */ |
219 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
219 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
220 | 220 | |
221 | 221 | /* Send an email notification to the admin */ |
222 | 222 | $admin_email = give_get_admin_notice_emails(); |
223 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
223 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
224 | 224 | |
225 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
226 | - $user_data = get_userdata( $user_info['id'] ); |
|
225 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
226 | + $user_data = get_userdata($user_info['id']); |
|
227 | 227 | $name = $user_data->display_name; |
228 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
229 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
228 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
229 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
230 | 230 | } else { |
231 | 231 | $name = $user_info['email']; |
232 | 232 | } |
233 | 233 | |
234 | - $amount = give_donation_amount( $payment_id ); |
|
234 | + $amount = give_donation_amount($payment_id); |
|
235 | 235 | |
236 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
236 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
237 | 237 | |
238 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
239 | - $admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n"; |
|
240 | - $admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
238 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
239 | + $admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n"; |
|
240 | + $admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
241 | 241 | |
242 | 242 | |
243 | - $admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
244 | - $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
243 | + $admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
244 | + $admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
245 | 245 | |
246 | 246 | $admin_message .= sprintf( |
247 | 247 | '<a href="%1$s">%2$s</a>', |
248 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
249 | - __( 'View Donation Details »', 'give' ) |
|
250 | - ) . "\n\n"; |
|
248 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id), |
|
249 | + __('View Donation Details »', 'give') |
|
250 | + )."\n\n"; |
|
251 | 251 | |
252 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
253 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
252 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
253 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
254 | 254 | |
255 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
256 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
255 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
256 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
257 | 257 | |
258 | 258 | //Send Email |
259 | 259 | $emails = Give()->emails; |
260 | - $emails->__set( 'heading', __( 'New Offline Donation', 'give' ) ); |
|
260 | + $emails->__set('heading', __('New Offline Donation', 'give')); |
|
261 | 261 | |
262 | - if ( ! empty( $admin_headers ) ) { |
|
263 | - $emails->__set( 'headers', $admin_headers ); |
|
262 | + if ( ! empty($admin_headers)) { |
|
263 | + $emails->__set('headers', $admin_headers); |
|
264 | 264 | } |
265 | 265 | |
266 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
266 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
267 | 267 | |
268 | 268 | } |
269 | 269 | |
@@ -275,20 +275,20 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return array |
277 | 277 | */ |
278 | -function give_offline_add_settings( $settings ) { |
|
278 | +function give_offline_add_settings($settings) { |
|
279 | 279 | |
280 | 280 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
281 | - if ( in_array( 'offline', (array) give_get_option( 'gateways' ) ) ) { |
|
281 | + if (in_array('offline', (array) give_get_option('gateways'))) { |
|
282 | 282 | return $settings; |
283 | 283 | } |
284 | 284 | |
285 | 285 | //Vars |
286 | 286 | $prefix = '_give_'; |
287 | 287 | |
288 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
288 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
289 | 289 | |
290 | 290 | //this gateway isn't active |
291 | - if ( ! $is_gateway_active ) { |
|
291 | + if ( ! $is_gateway_active) { |
|
292 | 292 | //return settings and bounce |
293 | 293 | return $settings; |
294 | 294 | } |
@@ -297,34 +297,34 @@ discard block |
||
297 | 297 | $check_settings = array( |
298 | 298 | |
299 | 299 | array( |
300 | - 'name' => __( 'Offline Donations', 'give' ), |
|
301 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
302 | - 'id' => $prefix . 'customize_offline_donations', |
|
300 | + 'name' => __('Offline Donations', 'give'), |
|
301 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
302 | + 'id' => $prefix.'customize_offline_donations', |
|
303 | 303 | 'type' => 'radio_inline', |
304 | 304 | 'default' => 'global', |
305 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
306 | - 'global' => __( 'Global Option', 'give' ), |
|
307 | - 'enabled' => __( 'Customize', 'give' ), |
|
308 | - 'disabled' => __( 'Disable', 'give' ), |
|
305 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
306 | + 'global' => __('Global Option', 'give'), |
|
307 | + 'enabled' => __('Customize', 'give'), |
|
308 | + 'disabled' => __('Disable', 'give'), |
|
309 | 309 | ) |
310 | 310 | ), |
311 | 311 | ), |
312 | 312 | array( |
313 | - 'name' => __( 'Billing Fields', 'give' ), |
|
314 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
315 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
313 | + 'name' => __('Billing Fields', 'give'), |
|
314 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
315 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
316 | 316 | 'row_classes' => 'give-subfield give-hidden', |
317 | 317 | 'type' => 'radio_inline', |
318 | 318 | 'default' => 'disabled', |
319 | 319 | 'options' => array( |
320 | - 'enabled' => __( 'Enabled', 'give' ), |
|
321 | - 'disabled' => __( 'Disabled', 'give' ), |
|
320 | + 'enabled' => __('Enabled', 'give'), |
|
321 | + 'disabled' => __('Disabled', 'give'), |
|
322 | 322 | ), |
323 | 323 | ), |
324 | 324 | array( |
325 | - 'id' => $prefix . 'offline_checkout_notes', |
|
326 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
327 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
325 | + 'id' => $prefix.'offline_checkout_notes', |
|
326 | + 'name' => __('Donation Instructions', 'give'), |
|
327 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
328 | 328 | 'default' => give_get_default_offline_donation_content(), |
329 | 329 | 'type' => 'wysiwyg', |
330 | 330 | 'row_classes' => 'give-subfield give-hidden', |
@@ -336,14 +336,14 @@ discard block |
||
336 | 336 | 'name' => 'offline_docs', |
337 | 337 | 'type' => 'docs_link', |
338 | 338 | 'url' => 'http://docs.givewp.com/settings-gateway-offline-donations', |
339 | - 'title' => __( 'Offline Donations', 'give' ), |
|
339 | + 'title' => __('Offline Donations', 'give'), |
|
340 | 340 | ), |
341 | 341 | ); |
342 | 342 | |
343 | - return array_merge( $settings, $check_settings ); |
|
343 | + return array_merge($settings, $check_settings); |
|
344 | 344 | } |
345 | 345 | |
346 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
346 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
347 | 347 | |
348 | 348 | |
349 | 349 | /** |
@@ -354,24 +354,24 @@ discard block |
||
354 | 354 | * @return string |
355 | 355 | */ |
356 | 356 | function give_get_default_offline_donation_content() { |
357 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
357 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
358 | 358 | $default_text .= '<ol>'; |
359 | 359 | $default_text .= '<li>'; |
360 | 360 | $default_text .= sprintf( |
361 | 361 | /* translators: %s: site name */ |
362 | - __( 'Make a check payable to "{sitename}"', 'give' ) ); |
|
362 | + __('Make a check payable to "{sitename}"', 'give') ); |
|
363 | 363 | $default_text .= '</li>'; |
364 | 364 | $default_text .= '<li>'; |
365 | 365 | $default_text .= sprintf( |
366 | 366 | /* translators: %s: site name */ |
367 | - __( 'On the memo line of the check, please indicate that the donation is for "{sitename}"', 'give' ) ); |
|
367 | + __('On the memo line of the check, please indicate that the donation is for "{sitename}"', 'give') ); |
|
368 | 368 | $default_text .= '</li>'; |
369 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
369 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
370 | 370 | $default_text .= '</ol>'; |
371 | 371 | $default_text .= '{offline_mailing_address}<br>'; |
372 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
372 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
373 | 373 | |
374 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
374 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
@@ -383,28 +383,28 @@ discard block |
||
383 | 383 | * @return string |
384 | 384 | */ |
385 | 385 | function give_get_default_offline_donation_email_content() { |
386 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
387 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
386 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
387 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
388 | 388 | $default_text .= '<ol>'; |
389 | 389 | $default_text .= '<li>'; |
390 | 390 | $default_text .= sprintf( |
391 | 391 | /* translators: %s: site name */ |
392 | - __( 'Make a check payable to "{sitename}"', 'give' ) |
|
392 | + __('Make a check payable to "{sitename}"', 'give') |
|
393 | 393 | ); |
394 | 394 | $default_text .= '</li>'; |
395 | 395 | $default_text .= '<li>'; |
396 | 396 | $default_text .= sprintf( |
397 | - __( 'On the memo line of the check, please indicate that the donation is for "{sitename}"', 'give' ) |
|
397 | + __('On the memo line of the check, please indicate that the donation is for "{sitename}"', 'give') |
|
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | 402 | $default_text .= '{offline_mailing_address}<br>'; |
403 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
404 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
403 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
404 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
405 | 405 | $default_text .= '<p>{sitename}</p>'; |
406 | 406 | |
407 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
407 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
@@ -418,35 +418,35 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @return string |
420 | 420 | */ |
421 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
421 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
422 | 422 | // Bailout. |
423 | - if ( ! $form_id ) { |
|
423 | + if ( ! $form_id) { |
|
424 | 424 | return ''; |
425 | 425 | } |
426 | 426 | |
427 | - $post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
428 | - $post_offline_instructions = give_get_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
429 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
427 | + $post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
428 | + $post_offline_instructions = give_get_meta($form_id, '_give_offline_checkout_notes', true); |
|
429 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
430 | 430 | $offline_instructions = $global_offline_instruction; |
431 | 431 | |
432 | - if ( give_is_setting_enabled( $post_offline_customization_option ) ) { |
|
432 | + if (give_is_setting_enabled($post_offline_customization_option)) { |
|
433 | 433 | $offline_instructions = $post_offline_instructions; |
434 | 434 | } |
435 | 435 | |
436 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
436 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
437 | 437 | |
438 | 438 | /* translators: %s: form settings url */ |
439 | - $offline_instructions = ! empty( $offline_instructions ) |
|
439 | + $offline_instructions = ! empty($offline_instructions) |
|
440 | 440 | ? $offline_instructions |
441 | 441 | : sprintf( |
442 | - __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), |
|
442 | + __('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), |
|
443 | 443 | $settings_url |
444 | 444 | ); |
445 | 445 | |
446 | - $offline_instructions = give_do_email_tags( $offline_instructions, null ); |
|
446 | + $offline_instructions = give_do_email_tags($offline_instructions, null); |
|
447 | 447 | |
448 | 448 | $formmated_offline_instructions = $wpautop |
449 | - ? wpautop( do_shortcode( $offline_instructions ) ) |
|
449 | + ? wpautop(do_shortcode($offline_instructions)) |
|
450 | 450 | : $offline_instructions; |
451 | 451 | |
452 | 452 | /** |
@@ -477,21 +477,21 @@ discard block |
||
477 | 477 | * |
478 | 478 | * @return array |
479 | 479 | */ |
480 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
480 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
481 | 481 | if ( |
482 | 482 | // Show offline payment gateway if enable for new donation form. |
483 | - ( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) |
|
483 | + (false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) |
|
484 | 484 | && $form_id |
485 | - && ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array( 'enabled', 'global' ) ) |
|
485 | + && ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array('enabled', 'global')) |
|
486 | 486 | ) { |
487 | - unset( $gateway_list['offline'] ); |
|
487 | + unset($gateway_list['offline']); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | // Output. |
491 | 491 | return $gateway_list; |
492 | 492 | } |
493 | 493 | |
494 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
494 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
495 | 495 | |
496 | 496 | /** |
497 | 497 | * Set default gateway to global default payment gateway |
@@ -505,13 +505,13 @@ discard block |
||
505 | 505 | * |
506 | 506 | * @return void |
507 | 507 | */ |
508 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
508 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
509 | 509 | if ( |
510 | - ! give_is_setting_enabled( $meta_value, array( 'global', 'enabled' ) ) |
|
511 | - && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) |
|
510 | + ! give_is_setting_enabled($meta_value, array('global', 'enabled')) |
|
511 | + && ('offline' === give_get_meta($postid, '_give_default_gateway', true)) |
|
512 | 512 | ) { |
513 | - give_update_meta( $postid, '_give_default_gateway', 'global' ); |
|
513 | + give_update_meta($postid, '_give_default_gateway', 'global'); |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
517 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
517 | +add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3); |
@@ -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 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_ajax_export() { |
27 | 27 | |
28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
29 | 29 | |
30 | - parse_str( $_POST['form'], $form ); |
|
30 | + parse_str($_POST['form'], $form); |
|
31 | 31 | |
32 | 32 | $_REQUEST = $form = (array) $form; |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
35 | - die( '-2' ); |
|
34 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
35 | + die('-2'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param string $class Export class. |
44 | 44 | */ |
45 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
45 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
46 | 46 | |
47 | - $step = absint( $_POST['step'] ); |
|
48 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
47 | + $step = absint($_POST['step']); |
|
48 | + $class = sanitize_text_field($form['give-export-class']); |
|
49 | 49 | |
50 | 50 | /* @var Give_Batch_Export $export */ |
51 | - $export = new $class( $step ); |
|
51 | + $export = new $class($step); |
|
52 | 52 | |
53 | - if ( ! $export->can_export() ) { |
|
54 | - die( '-1' ); |
|
53 | + if ( ! $export->can_export()) { |
|
54 | + die('-1'); |
|
55 | 55 | } |
56 | 56 | |
57 | - if ( ! $export->is_writable ) { |
|
57 | + if ( ! $export->is_writable) { |
|
58 | 58 | $json_args = array( |
59 | 59 | 'error' => true, |
60 | - 'message' => esc_html__( 'Export location or file not writable.', 'give' ) |
|
60 | + 'message' => esc_html__('Export location or file not writable.', 'give') |
|
61 | 61 | ); |
62 | 62 | echo json_encode($json_args); |
63 | 63 | exit; |
64 | 64 | } |
65 | 65 | |
66 | - $export->set_properties( give_clean( $_REQUEST ) ); |
|
66 | + $export->set_properties(give_clean($_REQUEST)); |
|
67 | 67 | |
68 | 68 | $export->pre_fetch(); |
69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $percentage = $export->get_percentage_complete(); |
73 | 73 | |
74 | - if ( $ret ) { |
|
74 | + if ($ret) { |
|
75 | 75 | |
76 | 76 | $step += 1; |
77 | 77 | $json_data = array( |
@@ -79,18 +79,17 @@ discard block |
||
79 | 79 | 'percentage' => $percentage |
80 | 80 | ); |
81 | 81 | |
82 | - } elseif ( true === $export->is_empty ) { |
|
82 | + } elseif (true === $export->is_empty) { |
|
83 | 83 | |
84 | 84 | $json_data = array( |
85 | 85 | 'error' => true, |
86 | - 'message' => esc_html__( 'No data found for export parameters.', 'give' ) |
|
86 | + 'message' => esc_html__('No data found for export parameters.', 'give') |
|
87 | 87 | ); |
88 | 88 | |
89 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
89 | + } elseif (true === $export->done && true === $export->is_void) { |
|
90 | 90 | |
91 | - $message = ! empty( $export->message ) ? |
|
92 | - $export->message : |
|
93 | - esc_html__( 'Batch Processing Complete', 'give' ); |
|
91 | + $message = ! empty($export->message) ? |
|
92 | + $export->message : esc_html__('Batch Processing Complete', 'give'); |
|
94 | 93 | |
95 | 94 | $json_data = array( |
96 | 95 | 'success' => true, |
@@ -99,23 +98,23 @@ discard block |
||
99 | 98 | |
100 | 99 | } else { |
101 | 100 | |
102 | - $args = array_merge( $_REQUEST, array( |
|
101 | + $args = array_merge($_REQUEST, array( |
|
103 | 102 | 'step' => $step, |
104 | 103 | 'class' => $class, |
105 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
104 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
106 | 105 | 'give_action' => 'form_batch_export', |
107 | - ) ); |
|
106 | + )); |
|
108 | 107 | |
109 | 108 | $json_data = array( |
110 | 109 | 'step' => 'done', |
111 | - 'url' => add_query_arg( $args, admin_url() ) |
|
110 | + 'url' => add_query_arg($args, admin_url()) |
|
112 | 111 | ); |
113 | 112 | |
114 | 113 | } |
115 | 114 | |
116 | - $export->unset_properties( give_clean( $_REQUEST ), $export ); |
|
117 | - echo json_encode( $json_data ); |
|
115 | + $export->unset_properties(give_clean($_REQUEST), $export); |
|
116 | + echo json_encode($json_data); |
|
118 | 117 | exit; |
119 | 118 | } |
120 | 119 | |
121 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
120 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |