@@ -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,13 +24,13 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
33 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . __( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
32 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
33 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.__('Thanks :)', 'give').'">★★★★★</a>' |
|
34 | 34 | ); |
35 | 35 | |
36 | 36 | return $rate_text; |
@@ -39,4 +39,4 @@ discard block |
||
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
42 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Form Goal', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Form Goal', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Form Goal', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Form Goal', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_goal' ); |
|
24 | + parent::__construct('give_goal'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | public function define_fields() { |
33 | 33 | |
34 | 34 | $create_form_link = sprintf( |
35 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
36 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
35 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
36 | + admin_url('post-new.php?post_type=give_forms') |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | return array( |
@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | 'post_type' => 'give_forms', |
44 | 44 | ), |
45 | 45 | 'name' => 'id', |
46 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
47 | - 'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ), |
|
46 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
47 | + 'placeholder' => sprintf('– %s –', __('Select a Form', 'give')), |
|
48 | 48 | 'required' => array( |
49 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
50 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
49 | + 'alert' => __('You must first select a Form!', 'give'), |
|
50 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
51 | 51 | ), |
52 | 52 | ), |
53 | 53 | array( |
54 | 54 | 'type' => 'container', |
55 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional settings', 'give' ) ), |
|
55 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional settings', 'give')), |
|
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'show_text', |
60 | - 'label' => __( 'Show Text:', 'give' ), |
|
61 | - 'tooltip' => __( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
60 | + 'label' => __('Show Text:', 'give'), |
|
61 | + 'tooltip' => __('This text displays the amount of income raised compared to the goal.', 'give'), |
|
62 | 62 | 'options' => array( |
63 | - 'true' => __( 'Show', 'give' ), |
|
64 | - 'false' => __( 'Hide', 'give' ), |
|
63 | + 'true' => __('Show', 'give'), |
|
64 | + 'false' => __('Hide', 'give'), |
|
65 | 65 | ), |
66 | 66 | ), |
67 | 67 | array( |
68 | 68 | 'type' => 'listbox', |
69 | 69 | 'name' => 'show_bar', |
70 | - 'label' => __( 'Show Progress Bar:', 'give' ), |
|
71 | - 'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
70 | + 'label' => __('Show Progress Bar:', 'give'), |
|
71 | + 'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'), |
|
72 | 72 | 'options' => array( |
73 | - 'true' => __( 'Show', 'give' ), |
|
74 | - 'false' => __( 'Hide', 'give' ), |
|
73 | + 'true' => __('Show', 'give'), |
|
74 | + 'false' => __('Hide', 'give'), |
|
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = __( 'Donation Form', 'give' ); |
|
25 | - $this->shortcode['label'] = __( 'Donation Form', 'give' ); |
|
24 | + $this->shortcode['title'] = __('Donation Form', 'give'); |
|
25 | + $this->shortcode['label'] = __('Donation Form', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_form' ); |
|
27 | + parent::__construct('give_form'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | public function define_fields() { |
36 | 36 | |
37 | 37 | $create_form_link = sprintf( |
38 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
39 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
38 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
39 | + admin_url('post-new.php?post_type=give_forms') |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | return array( |
@@ -46,68 +46,68 @@ discard block |
||
46 | 46 | 'post_type' => 'give_forms', |
47 | 47 | ), |
48 | 48 | 'name' => 'id', |
49 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
50 | - 'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ), |
|
49 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
50 | + 'placeholder' => sprintf('– %s –', __('Select a Form', 'give')), |
|
51 | 51 | 'required' => array( |
52 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
53 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
52 | + 'alert' => __('You must first select a Form!', 'give'), |
|
53 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
54 | 54 | ), |
55 | 55 | ), |
56 | 56 | array( |
57 | 57 | 'type' => 'container', |
58 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional form settings', 'give' ) ), |
|
58 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional form settings', 'give')), |
|
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'listbox', |
62 | 62 | 'name' => 'show_title', |
63 | - 'label' => __( 'Show Title:', 'give' ), |
|
64 | - 'tooltip' => __( 'Do you want to display the form title?', 'give' ), |
|
63 | + 'label' => __('Show Title:', 'give'), |
|
64 | + 'tooltip' => __('Do you want to display the form title?', 'give'), |
|
65 | 65 | 'options' => array( |
66 | - 'true' => __( 'Show', 'give' ), |
|
67 | - 'false' => __( 'Hide', 'give' ), |
|
66 | + 'true' => __('Show', 'give'), |
|
67 | + 'false' => __('Hide', 'give'), |
|
68 | 68 | ), |
69 | 69 | ), |
70 | 70 | array( |
71 | 71 | 'type' => 'listbox', |
72 | 72 | 'name' => 'show_goal', |
73 | - 'label' => __( 'Show Goal:', 'give' ), |
|
74 | - 'tooltip' => __( 'Do you want to display the donation goal?', 'give' ), |
|
73 | + 'label' => __('Show Goal:', 'give'), |
|
74 | + 'tooltip' => __('Do you want to display the donation goal?', 'give'), |
|
75 | 75 | 'options' => array( |
76 | - 'true' => __( 'Show', 'give' ), |
|
77 | - 'false' => __( 'Hide', 'give' ), |
|
76 | + 'true' => __('Show', 'give'), |
|
77 | + 'false' => __('Hide', 'give'), |
|
78 | 78 | ), |
79 | 79 | ), |
80 | 80 | array( |
81 | 81 | 'type' => 'listbox', |
82 | 82 | 'name' => 'show_content', |
83 | 83 | 'minWidth' => 240, |
84 | - 'label' => __( 'Display Content:', 'give' ), |
|
85 | - 'tooltip' => __( 'Do you want to display the form content?', 'give' ), |
|
84 | + 'label' => __('Display Content:', 'give'), |
|
85 | + 'tooltip' => __('Do you want to display the form content?', 'give'), |
|
86 | 86 | 'options' => array( |
87 | - 'none' => __( 'No Content', 'give' ), |
|
88 | - 'above' => __( 'Display above the form fields', 'give' ), |
|
89 | - 'below' => __( 'Display below the form fields', 'give' ), |
|
87 | + 'none' => __('No Content', 'give'), |
|
88 | + 'above' => __('Display above the form fields', 'give'), |
|
89 | + 'below' => __('Display below the form fields', 'give'), |
|
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | array( |
93 | 93 | 'type' => 'listbox', |
94 | 94 | 'name' => 'display_style', |
95 | - 'label' => __( 'Payment Fields:', 'give' ), |
|
96 | - 'tooltip' => __( 'How would you like to display payment information?', 'give' ), |
|
95 | + 'label' => __('Payment Fields:', 'give'), |
|
96 | + 'tooltip' => __('How would you like to display payment information?', 'give'), |
|
97 | 97 | 'options' => array( |
98 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
99 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
100 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
98 | + 'onpage' => __('Show on Page', 'give'), |
|
99 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
100 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
101 | 101 | ), |
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'type' => 'listbox', |
105 | 105 | 'name' => 'float_labels', |
106 | - 'label' => __( 'Floating Labels:', 'give' ), |
|
107 | - 'tooltip' => __( 'Override the default floating labels setting for this form?', 'give' ), |
|
106 | + 'label' => __('Floating Labels:', 'give'), |
|
107 | + 'tooltip' => __('Override the default floating labels setting for this form?', 'give'), |
|
108 | 108 | 'options' => array( |
109 | - 'enabled' => __( 'Enabled', 'give' ), |
|
110 | - 'disabled' => __( 'Disabled', 'give' ), |
|
109 | + 'enabled' => __('Enabled', 'give'), |
|
110 | + 'disabled' => __('Disabled', 'give'), |
|
111 | 111 | ), |
112 | 112 | ), |
113 | 113 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param $_banner_details |
26 | 26 | */ |
27 | - function __construct( $_banner_details ) { |
|
27 | + function __construct($_banner_details) { |
|
28 | 28 | |
29 | 29 | global $current_user; |
30 | 30 | $this->banner_details = $_banner_details; |
31 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
32 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
31 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
32 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
33 | 33 | |
34 | 34 | //Get current user |
35 | 35 | $this->user_id = $current_user->ID; |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | public function init() { |
49 | 49 | |
50 | 50 | //Testing? |
51 | - if ( $this->test_mode ) { |
|
52 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
51 | + if ($this->test_mode) { |
|
52 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | //Get the current page to add the notice to |
56 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
57 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
56 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
57 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | global $pagenow; |
70 | 70 | |
71 | 71 | //Make sure we're on the plugins page. |
72 | - if ( $pagenow !== 'plugins.php' ) { |
|
72 | + if ($pagenow !== 'plugins.php') { |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // If the user hasn't already dismissed our alert, |
77 | 77 | // Output the activation banner |
78 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
78 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
79 | 79 | |
80 | 80 | <!-- * I output inline styles here |
81 | 81 | * because there's no reason to keep these |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | <!-- Your Message --> |
155 | 155 | <h3><?php |
156 | 156 | printf( |
157 | - __( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
158 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
157 | + __("Thank you for installing Give's %s Add-on!", 'give'), |
|
158 | + '<span>'.$this->banner_details['name'].'</span>' |
|
159 | 159 | ); |
160 | 160 | ?></h3> |
161 | 161 | |
162 | 162 | <a href="<?php |
163 | 163 | //The Dismiss Button |
164 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
165 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
164 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
165 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
166 | 166 | |
167 | 167 | <!-- * Now we output a few "actions" |
168 | 168 | * that the user can take from here --> |
@@ -170,24 +170,24 @@ discard block |
||
170 | 170 | <div class="alert-actions"> |
171 | 171 | |
172 | 172 | <?php //Point them to your settings page |
173 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
173 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
174 | 174 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
175 | - <span class="dashicons dashicons-admin-settings"></span><?php _e( 'Go to Settings', 'give' ); ?> |
|
175 | + <span class="dashicons dashicons-admin-settings"></span><?php _e('Go to Settings', 'give'); ?> |
|
176 | 176 | </a> |
177 | 177 | <?php } ?> |
178 | 178 | |
179 | 179 | <?php |
180 | 180 | // Show them how to configure the Addon |
181 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
182 | - <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf( __( 'Documentation: %s Add-on', 'give' ), $this->banner_details['name'] ); ?> |
|
181 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
182 | + <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf(__('Documentation: %s Add-on', 'give'), $this->banner_details['name']); ?> |
|
183 | 183 | </a> |
184 | 184 | <?php } ?> |
185 | 185 | <?php |
186 | 186 | //Let them signup for plugin updates |
187 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
187 | + if (isset($this->banner_details['support_url'])) { ?> |
|
188 | 188 | |
189 | 189 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
190 | - <span class="dashicons dashicons-sos"></span><?php _e( 'Get Support', 'give' ); ?> |
|
190 | + <span class="dashicons dashicons-sos"></span><?php _e('Get Support', 'give'); ?> |
|
191 | 191 | </a> |
192 | 192 | |
193 | 193 | <?php } ?> |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | /* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
209 | 209 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
210 | 210 | */ |
211 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
211 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
212 | 212 | |
213 | 213 | //Get the global user |
214 | 214 | global $current_user; |
215 | 215 | $user_id = $current_user->ID; |
216 | 216 | |
217 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
217 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @since 1.4 |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) or exit; |
|
13 | +defined('ABSPATH') or exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class Give_Email_Access |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | |
32 | 32 | // get it started |
33 | - add_action( 'init', array( $this, 'init' ) ); |
|
33 | + add_action('init', array($this, 'init')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function init() { |
41 | 41 | |
42 | - $is_enabled = give_get_option( 'email_access' ); |
|
42 | + $is_enabled = give_get_option('email_access'); |
|
43 | 43 | |
44 | 44 | //Non-logged in users only |
45 | - if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) { |
|
45 | + if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | 49 | //Are db columns setup? |
50 | - $is_setup = give_get_option( 'email_access_installed' ); |
|
51 | - if ( empty( $is_setup ) ) { |
|
50 | + $is_setup = give_get_option('email_access_installed'); |
|
51 | + if (empty($is_setup)) { |
|
52 | 52 | $this->create_columns(); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Timeouts |
56 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
57 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
56 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
57 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
58 | 58 | |
59 | 59 | // Setup login |
60 | 60 | $this->check_for_token(); |
61 | 61 | |
62 | - if ( $this->token_exists ) { |
|
63 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
64 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
65 | - add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) ); |
|
62 | + if ($this->token_exists) { |
|
63 | + add_filter('give_can_view_receipt', '__return_true'); |
|
64 | + add_filter('give_user_pending_verification', '__return_false'); |
|
65 | + add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args')); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return bool |
75 | 75 | */ |
76 | - function can_send_email( $customer_id ) { |
|
76 | + function can_send_email($customer_id) { |
|
77 | 77 | global $wpdb; |
78 | 78 | |
79 | 79 | // Prevent multiple emails within X minutes |
80 | - $throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle ); |
|
80 | + $throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle); |
|
81 | 81 | |
82 | 82 | // Does a user row exist? |
83 | 83 | $exists = (int) $wpdb->get_var( |
84 | - $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id ) |
|
84 | + $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id) |
|
85 | 85 | ); |
86 | 86 | |
87 | - if ( 0 < $exists ) { |
|
87 | + if (0 < $exists) { |
|
88 | 88 | $row_id = (int) $wpdb->get_var( |
89 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle ) |
|
89 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle) |
|
90 | 90 | ); |
91 | 91 | |
92 | - if ( $row_id < 1 ) { |
|
93 | - give_set_error( 'give_email_access_attempts_exhausted', __( 'Please wait a few minutes before requesting a new email access link.', 'give' ) ); |
|
92 | + if ($row_id < 1) { |
|
93 | + give_set_error('give_email_access_attempts_exhausted', __('Please wait a few minutes before requesting a new email access link.', 'give')); |
|
94 | 94 | |
95 | 95 | return false; |
96 | 96 | } |
@@ -106,38 +106,38 @@ discard block |
||
106 | 106 | * @param $customer_id |
107 | 107 | * @param $email |
108 | 108 | */ |
109 | - function send_email( $customer_id, $email ) { |
|
109 | + function send_email($customer_id, $email) { |
|
110 | 110 | |
111 | - $verify_key = wp_generate_password( 20, false ); |
|
111 | + $verify_key = wp_generate_password(20, false); |
|
112 | 112 | |
113 | 113 | // Generate a new verify key |
114 | - $this->set_verify_key( $customer_id, $email, $verify_key ); |
|
114 | + $this->set_verify_key($customer_id, $email, $verify_key); |
|
115 | 115 | |
116 | 116 | // Get the purchase history URL |
117 | - $page_id = give_get_option( 'history_page' ); |
|
117 | + $page_id = give_get_option('history_page'); |
|
118 | 118 | |
119 | - $access_url = add_query_arg( array( |
|
119 | + $access_url = add_query_arg(array( |
|
120 | 120 | 'give_nl' => $verify_key, |
121 | - ), get_permalink( $page_id ) ); |
|
121 | + ), get_permalink($page_id)); |
|
122 | 122 | |
123 | 123 | //Nice subject and message |
124 | - $subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) ); |
|
124 | + $subject = apply_filters('give_email_access_token_subject', sprintf(__('Your Access Link to %s', 'give'), get_bloginfo('name'))); |
|
125 | 125 | |
126 | - $message = __( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n"; |
|
126 | + $message = __('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n"; |
|
127 | 127 | |
128 | - $message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . __( 'Access My Donation Details', 'give' ) . ' »</a>'; |
|
128 | + $message .= '<a href="'.esc_url($access_url).'" target="_blank">'.__('Access My Donation Details', 'give').' »</a>'; |
|
129 | 129 | |
130 | 130 | $message .= "\n\n"; |
131 | 131 | $message .= "\n\n"; |
132 | - $message .= __( 'Sincerely,', 'give' ); |
|
133 | - $message .= "\n" . get_bloginfo( 'name' ) . "\n"; |
|
132 | + $message .= __('Sincerely,', 'give'); |
|
133 | + $message .= "\n".get_bloginfo('name')."\n"; |
|
134 | 134 | |
135 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
135 | + $message = apply_filters('give_email_access_token_message', $message); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | // Send the email |
139 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Your Access Link', 'give' ) ) ); |
|
140 | - Give()->emails->send( $email, $subject, $message ); |
|
139 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Your Access Link', 'give'))); |
|
140 | + Give()->emails->send($email, $subject, $message); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -147,24 +147,24 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function check_for_token() { |
149 | 149 | |
150 | - $token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : ''; |
|
150 | + $token = isset($_GET['give_nl']) ? $_GET['give_nl'] : ''; |
|
151 | 151 | |
152 | 152 | // Check for cookie |
153 | - if ( empty( $token ) ) { |
|
154 | - $token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : ''; |
|
153 | + if (empty($token)) { |
|
154 | + $token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : ''; |
|
155 | 155 | } |
156 | 156 | |
157 | - if ( ! empty( $token ) ) { |
|
158 | - if ( ! $this->is_valid_token( $token ) ) { |
|
159 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
157 | + if ( ! empty($token)) { |
|
158 | + if ( ! $this->is_valid_token($token)) { |
|
159 | + if ( ! $this->is_valid_verify_key($token)) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | $this->token_exists = true; |
165 | 165 | // Set cookie |
166 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
167 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
166 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
167 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool |
177 | 177 | */ |
178 | - function is_valid_token( $token ) { |
|
178 | + function is_valid_token($token) { |
|
179 | 179 | |
180 | 180 | global $wpdb; |
181 | 181 | |
182 | 182 | // Make sure token isn't expired |
183 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
183 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
184 | 184 | |
185 | 185 | $email = $wpdb->get_var( |
186 | - $wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
186 | + $wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
187 | 187 | ); |
188 | 188 | |
189 | - if ( ! empty( $email ) ) { |
|
189 | + if ( ! empty($email)) { |
|
190 | 190 | $this->token_email = $email; |
191 | 191 | $this->token = $token; |
192 | 192 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | //Set error only if email access form isn't being submitted |
197 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
198 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give' ) ); |
|
197 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
198 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give')); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -210,25 +210,25 @@ discard block |
||
210 | 210 | * @param $email |
211 | 211 | * @param $verify_key |
212 | 212 | */ |
213 | - function set_verify_key( $customer_id, $email, $verify_key ) { |
|
213 | + function set_verify_key($customer_id, $email, $verify_key) { |
|
214 | 214 | global $wpdb; |
215 | 215 | |
216 | - $now = date( 'Y-m-d H:i:s' ); |
|
216 | + $now = date('Y-m-d H:i:s'); |
|
217 | 217 | |
218 | 218 | // Insert or update? |
219 | 219 | $row_id = (int) $wpdb->get_var( |
220 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id ) |
|
220 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id) |
|
221 | 221 | ); |
222 | 222 | |
223 | 223 | // Update |
224 | - if ( ! empty( $row_id ) ) { |
|
224 | + if ( ! empty($row_id)) { |
|
225 | 225 | $wpdb->query( |
226 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
226 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
227 | 227 | ); |
228 | 228 | } // Insert |
229 | 229 | else { |
230 | 230 | $wpdb->query( |
231 | - $wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
231 | + $wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
232 | 232 | ); |
233 | 233 | } |
234 | 234 | } |
@@ -240,20 +240,20 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return bool |
242 | 242 | */ |
243 | - function is_valid_verify_key( $token ) { |
|
243 | + function is_valid_verify_key($token) { |
|
244 | 244 | global $wpdb; |
245 | 245 | |
246 | 246 | // See if the verify_key exists |
247 | 247 | $row = $wpdb->get_row( |
248 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token ) |
|
248 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token) |
|
249 | 249 | ); |
250 | 250 | |
251 | - $now = date( 'Y-m-d H:i:s' ); |
|
251 | + $now = date('Y-m-d H:i:s'); |
|
252 | 252 | |
253 | 253 | // Set token |
254 | - if ( ! empty( $row ) ) { |
|
254 | + if ( ! empty($row)) { |
|
255 | 255 | $wpdb->query( |
256 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
256 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
257 | 257 | ); |
258 | 258 | |
259 | 259 | $this->token_email = $row->email; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return mixed |
274 | 274 | */ |
275 | - function users_purchases_args( $args ) { |
|
275 | + function users_purchases_args($args) { |
|
276 | 276 | $args['user'] = $this->token_email; |
277 | 277 | |
278 | 278 | return $args; |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | global $wpdb; |
290 | 290 | |
291 | 291 | //Create columns in customers table |
292 | - $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
292 | + $query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
293 | 293 | |
294 | 294 | //Columns added properly |
295 | - if ( $query ) { |
|
296 | - give_update_option( 'email_access_installed', 1 ); |
|
295 | + if ($query) { |
|
296 | + give_update_option('email_access_installed', 1); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | } |