@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export.php'; |
|
19 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-actions.php'; |
|
18 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export.php'; |
|
19 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-actions.php'; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Process batch exports via ajax |
@@ -26,79 +26,79 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function give_do_ajax_export() { |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - parse_str( $_POST['form'], $form ); |
|
31 | + parse_str($_POST['form'], $form); |
|
32 | 32 | |
33 | 33 | $_REQUEST = $form = (array) $form; |
34 | 34 | |
35 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
36 | - die( '-2' ); |
|
35 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
36 | + die('-2'); |
|
37 | 37 | } |
38 | 38 | |
39 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
39 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
40 | 40 | |
41 | - $step = absint( $_POST['step'] ); |
|
42 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
41 | + $step = absint($_POST['step']); |
|
42 | + $class = sanitize_text_field($form['give-export-class']); |
|
43 | 43 | |
44 | - $export = new $class( $step ); |
|
44 | + $export = new $class($step); |
|
45 | 45 | |
46 | - if ( ! $export->can_export() ) { |
|
47 | - die( '-1' ); |
|
46 | + if ( ! $export->can_export()) { |
|
47 | + die('-1'); |
|
48 | 48 | } |
49 | 49 | |
50 | - if ( ! $export->is_writable ) { |
|
50 | + if ( ! $export->is_writable) { |
|
51 | 51 | $json_args = array( |
52 | 52 | 'error' => true, |
53 | - 'message' => esc_html( 'Export location or file not writable.', 'give' ) |
|
53 | + 'message' => esc_html('Export location or file not writable.', 'give') |
|
54 | 54 | ); |
55 | 55 | echo json_encode($json_args); |
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | |
59 | - $export->set_properties( $_REQUEST ); |
|
59 | + $export->set_properties($_REQUEST); |
|
60 | 60 | |
61 | 61 | $export->pre_fetch(); |
62 | 62 | |
63 | - $ret = $export->process_step( $step ); |
|
63 | + $ret = $export->process_step($step); |
|
64 | 64 | |
65 | 65 | $percentage = $export->get_percentage_complete(); |
66 | 66 | |
67 | - if ( $ret ) { |
|
67 | + if ($ret) { |
|
68 | 68 | |
69 | 69 | $step += 1; |
70 | - echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); |
|
70 | + echo json_encode(array('step' => $step, 'percentage' => $percentage)); |
|
71 | 71 | exit; |
72 | 72 | |
73 | - } elseif ( true === $export->is_empty ) { |
|
73 | + } elseif (true === $export->is_empty) { |
|
74 | 74 | |
75 | - echo json_encode( array( |
|
75 | + echo json_encode(array( |
|
76 | 76 | 'error' => true, |
77 | - 'message' => esc_html( 'No data found for export parameters.', 'give' ) |
|
78 | - ) ); |
|
77 | + 'message' => esc_html('No data found for export parameters.', 'give') |
|
78 | + )); |
|
79 | 79 | exit; |
80 | 80 | |
81 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
81 | + } elseif (true === $export->done && true === $export->is_void) { |
|
82 | 82 | |
83 | - $message = ! empty( $export->message ) ? $export->message : esc_html( 'Batch Processing Complete', 'give' ); |
|
84 | - echo json_encode( array( 'success' => true, 'message' => $message ) ); |
|
83 | + $message = ! empty($export->message) ? $export->message : esc_html('Batch Processing Complete', 'give'); |
|
84 | + echo json_encode(array('success' => true, 'message' => $message)); |
|
85 | 85 | exit; |
86 | 86 | |
87 | 87 | } else { |
88 | 88 | |
89 | - $args = array_merge( $_REQUEST, array( |
|
89 | + $args = array_merge($_REQUEST, array( |
|
90 | 90 | 'step' => $step, |
91 | 91 | 'class' => $class, |
92 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
92 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
93 | 93 | 'give_action' => 'form_batch_export', |
94 | - ) ); |
|
94 | + )); |
|
95 | 95 | |
96 | - $download_url = add_query_arg( $args, admin_url() ); |
|
96 | + $download_url = add_query_arg($args, admin_url()); |
|
97 | 97 | |
98 | - echo json_encode( array( 'step' => 'done', 'url' => $download_url ) ); |
|
98 | + echo json_encode(array('step' => 'done', 'url' => $download_url)); |
|
99 | 99 | exit; |
100 | 100 | |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
104 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |
@@ -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 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_system_info_callback() { |
26 | 26 | |
27 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
27 | + if ( ! current_user_can('manage_give_settings')) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | ?> |
31 | - <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" title="<?php esc_attr_e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'give' ); ?>"><?php echo give_tools_sysinfo_get(); ?></textarea> |
|
31 | + <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" title="<?php esc_attr_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'give'); ?>"><?php echo give_tools_sysinfo_get(); ?></textarea> |
|
32 | 32 | <p class="submit"> |
33 | 33 | <input type="hidden" name="give-action" value="download_sysinfo"/> |
34 | - <?php submit_button( esc_html( 'Download System Info File', 'give' ), 'secondary', 'give-download-sysinfo', false ); ?> |
|
34 | + <?php submit_button(esc_html('Download System Info File', 'give'), 'secondary', 'give-download-sysinfo', false); ?> |
|
35 | 35 | </p> |
36 | 36 | <?php |
37 | 37 | } |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | * @return bool |
48 | 48 | */ |
49 | 49 | function give_allow_sessions_for_sysinfo() { |
50 | - if ( is_admin() && ( isset( $_GET['page'] ) && isset( $_GET['tab'] ) ) && ( $_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings' ) ) { |
|
50 | + if (is_admin() && (isset($_GET['page']) && isset($_GET['tab'])) && ($_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings')) { |
|
51 | 51 | return true; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | -add_filter( 'give_start_session', 'give_allow_sessions_for_sysinfo' ); |
|
55 | +add_filter('give_start_session', 'give_allow_sessions_for_sysinfo'); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
@@ -67,63 +67,63 @@ discard block |
||
67 | 67 | function give_tools_sysinfo_get() { |
68 | 68 | global $wpdb, $give_options; |
69 | 69 | |
70 | - if ( ! class_exists( 'Browser' ) ) { |
|
71 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php'; |
|
70 | + if ( ! class_exists('Browser')) { |
|
71 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $browser = new Browser(); |
75 | 75 | |
76 | 76 | // Get theme info |
77 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
78 | - $theme_data = wp_get_theme( get_stylesheet_directory() . '/style.css' ); |
|
79 | - $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; |
|
77 | + if (get_bloginfo('version') < '3.4') { |
|
78 | + $theme_data = wp_get_theme(get_stylesheet_directory().'/style.css'); |
|
79 | + $theme = $theme_data['Name'].' '.$theme_data['Version']; |
|
80 | 80 | } else { |
81 | 81 | $theme_data = wp_get_theme(); |
82 | - $theme = $theme_data->Name . ' ' . $theme_data->Version; |
|
82 | + $theme = $theme_data->Name.' '.$theme_data->Version; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Try to identify the hosting provider |
86 | 86 | $host = give_get_host(); |
87 | 87 | |
88 | - $return = '### Begin System Info ###' . "\n\n"; |
|
88 | + $return = '### Begin System Info ###'."\n\n"; |
|
89 | 89 | |
90 | 90 | // Start with the basics... |
91 | - $return .= '-- Site Info' . "\n\n"; |
|
92 | - $return .= 'Site URL: ' . site_url() . "\n"; |
|
93 | - $return .= 'Home URL: ' . home_url() . "\n"; |
|
94 | - $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; |
|
91 | + $return .= '-- Site Info'."\n\n"; |
|
92 | + $return .= 'Site URL: '.site_url()."\n"; |
|
93 | + $return .= 'Home URL: '.home_url()."\n"; |
|
94 | + $return .= 'Multisite: '.(is_multisite() ? 'Yes' : 'No')."\n"; |
|
95 | 95 | |
96 | - $return = apply_filters( 'give_sysinfo_after_site_info', $return ); |
|
96 | + $return = apply_filters('give_sysinfo_after_site_info', $return); |
|
97 | 97 | |
98 | 98 | // Can we determine the site's host? |
99 | - if ( $host ) { |
|
100 | - $return .= "\n" . '-- Hosting Provider' . "\n\n"; |
|
101 | - $return .= 'Host: ' . $host . "\n"; |
|
99 | + if ($host) { |
|
100 | + $return .= "\n".'-- Hosting Provider'."\n\n"; |
|
101 | + $return .= 'Host: '.$host."\n"; |
|
102 | 102 | |
103 | - $return = apply_filters( 'give_sysinfo_after_host_info', $return ); |
|
103 | + $return = apply_filters('give_sysinfo_after_host_info', $return); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | // The local users' browser information, handled by the Browser class |
107 | - $return .= "\n" . '-- User Browser' . "\n\n"; |
|
107 | + $return .= "\n".'-- User Browser'."\n\n"; |
|
108 | 108 | $return .= $browser; |
109 | 109 | |
110 | - $return = apply_filters( 'give_sysinfo_after_user_browser', $return ); |
|
110 | + $return = apply_filters('give_sysinfo_after_user_browser', $return); |
|
111 | 111 | |
112 | 112 | // WordPress configuration |
113 | - $return .= "\n" . '-- WordPress Configuration' . "\n\n"; |
|
114 | - $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; |
|
115 | - $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; |
|
116 | - $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; |
|
117 | - $return .= 'Active Theme: ' . $theme . "\n"; |
|
118 | - $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; |
|
113 | + $return .= "\n".'-- WordPress Configuration'."\n\n"; |
|
114 | + $return .= 'Version: '.get_bloginfo('version')."\n"; |
|
115 | + $return .= 'Language: '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n"; |
|
116 | + $return .= 'Permalink Structure: '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n"; |
|
117 | + $return .= 'Active Theme: '.$theme."\n"; |
|
118 | + $return .= 'Show On Front: '.get_option('show_on_front')."\n"; |
|
119 | 119 | |
120 | 120 | // Only show page specs if frontpage is set to 'page' |
121 | - if ( get_option( 'show_on_front' ) == 'page' ) { |
|
122 | - $front_page_id = get_option( 'page_on_front' ); |
|
123 | - $blog_page_id = get_option( 'page_for_posts' ); |
|
121 | + if (get_option('show_on_front') == 'page') { |
|
122 | + $front_page_id = get_option('page_on_front'); |
|
123 | + $blog_page_id = get_option('page_for_posts'); |
|
124 | 124 | |
125 | - $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; |
|
126 | - $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; |
|
125 | + $return .= 'Page On Front: '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n"; |
|
126 | + $return .= 'Page For Posts: '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n"; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // Make sure wp_remote_post() is working |
@@ -132,205 +132,205 @@ discard block |
||
132 | 132 | $params = array( |
133 | 133 | 'sslverify' => false, |
134 | 134 | 'timeout' => 60, |
135 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
135 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
136 | 136 | 'body' => $request |
137 | 137 | ); |
138 | 138 | |
139 | - $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); |
|
139 | + $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); |
|
140 | 140 | |
141 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
141 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
142 | 142 | $WP_REMOTE_POST = 'wp_remote_post() works'; |
143 | 143 | } else { |
144 | 144 | $WP_REMOTE_POST = 'wp_remote_post() does not work'; |
145 | 145 | } |
146 | 146 | |
147 | - $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; |
|
148 | - $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; |
|
149 | - $return .= 'Admin AJAX: ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; |
|
150 | - $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; |
|
151 | - $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; |
|
152 | - $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; |
|
147 | + $return .= 'Remote Post: '.$WP_REMOTE_POST."\n"; |
|
148 | + $return .= 'Table Prefix: '.'Length: '.strlen($wpdb->prefix).' Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n"; |
|
149 | + $return .= 'Admin AJAX: '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n"; |
|
150 | + $return .= 'WP_DEBUG: '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n"; |
|
151 | + $return .= 'Memory Limit: '.WP_MEMORY_LIMIT."\n"; |
|
152 | + $return .= 'Registered Post Stati: '.implode(', ', get_post_stati())."\n"; |
|
153 | 153 | |
154 | - $return = apply_filters( 'give_sysinfo_after_wordpress_config', $return ); |
|
154 | + $return = apply_filters('give_sysinfo_after_wordpress_config', $return); |
|
155 | 155 | |
156 | 156 | // GIVE configuration |
157 | - $return .= "\n" . '-- Give Configuration' . "\n\n"; |
|
158 | - $return .= 'Version: ' . GIVE_VERSION . "\n"; |
|
159 | - $return .= 'Upgraded From: ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n"; |
|
160 | - $return .= 'Test Mode: ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" ); |
|
161 | - $return .= 'Currency Code: ' . give_get_currency() . "\n"; |
|
162 | - $return .= 'Currency Position: ' . give_get_option( 'currency_position', 'before' ) . "\n"; |
|
163 | - $return .= 'Decimal Separator: ' . give_get_option( 'decimal_separator', '.' ) . "\n"; |
|
164 | - $return .= 'Thousands Separator: ' . give_get_option( 'thousands_separator', ',' ) . "\n"; |
|
157 | + $return .= "\n".'-- Give Configuration'."\n\n"; |
|
158 | + $return .= 'Version: '.GIVE_VERSION."\n"; |
|
159 | + $return .= 'Upgraded From: '.get_option('give_version_upgraded_from', 'None')."\n"; |
|
160 | + $return .= 'Test Mode: '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n"); |
|
161 | + $return .= 'Currency Code: '.give_get_currency()."\n"; |
|
162 | + $return .= 'Currency Position: '.give_get_option('currency_position', 'before')."\n"; |
|
163 | + $return .= 'Decimal Separator: '.give_get_option('decimal_separator', '.')."\n"; |
|
164 | + $return .= 'Thousands Separator: '.give_get_option('thousands_separator', ',')."\n"; |
|
165 | 165 | |
166 | - $return = apply_filters( 'give_sysinfo_after_give_config', $return ); |
|
166 | + $return = apply_filters('give_sysinfo_after_give_config', $return); |
|
167 | 167 | |
168 | 168 | // GIVE pages |
169 | - $return .= "\n" . '-- Give Page Configuration' . "\n\n"; |
|
170 | - $return .= 'Success Page: ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" ); |
|
171 | - $return .= 'Failure Page: ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" ); |
|
172 | - $return .= 'Give Forms Slug: ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" ); |
|
169 | + $return .= "\n".'-- Give Page Configuration'."\n\n"; |
|
170 | + $return .= 'Success Page: '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n"); |
|
171 | + $return .= 'Failure Page: '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n"); |
|
172 | + $return .= 'Give Forms Slug: '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n"); |
|
173 | 173 | |
174 | - $return = apply_filters( 'give_sysinfo_after_give_pages', $return ); |
|
174 | + $return = apply_filters('give_sysinfo_after_give_pages', $return); |
|
175 | 175 | |
176 | 176 | // GIVE gateways |
177 | - $return .= "\n" . '-- Give Gateway Configuration' . "\n\n"; |
|
177 | + $return .= "\n".'-- Give Gateway Configuration'."\n\n"; |
|
178 | 178 | |
179 | 179 | $active_gateways = give_get_enabled_payment_gateways(); |
180 | - if ( $active_gateways ) { |
|
181 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
182 | - if ( $default_gateway_is_active ) { |
|
183 | - $default_gateway = give_get_default_gateway( null ); |
|
184 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
180 | + if ($active_gateways) { |
|
181 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
182 | + if ($default_gateway_is_active) { |
|
183 | + $default_gateway = give_get_default_gateway(null); |
|
184 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
185 | 185 | } else { |
186 | 186 | $default_gateway = 'Test Payment'; |
187 | 187 | } |
188 | 188 | |
189 | 189 | $gateways = array(); |
190 | - foreach ( $active_gateways as $gateway ) { |
|
190 | + foreach ($active_gateways as $gateway) { |
|
191 | 191 | $gateways[] = $gateway['admin_label']; |
192 | 192 | } |
193 | 193 | |
194 | - $return .= 'Enabled Gateways: ' . implode( ', ', $gateways ) . "\n"; |
|
195 | - $return .= 'Default Gateway: ' . $default_gateway . "\n"; |
|
194 | + $return .= 'Enabled Gateways: '.implode(', ', $gateways)."\n"; |
|
195 | + $return .= 'Default Gateway: '.$default_gateway."\n"; |
|
196 | 196 | } else { |
197 | - $return .= 'Enabled Gateways: None' . "\n"; |
|
197 | + $return .= 'Enabled Gateways: None'."\n"; |
|
198 | 198 | } |
199 | 199 | |
200 | - $return = apply_filters( 'give_sysinfo_after_give_gateways', $return ); |
|
200 | + $return = apply_filters('give_sysinfo_after_give_gateways', $return); |
|
201 | 201 | |
202 | 202 | // GIVE Templates |
203 | - $dir = get_stylesheet_directory() . '/give_templates/*'; |
|
204 | - if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) { |
|
205 | - $return .= "\n" . '-- Give Template Overrides' . "\n\n"; |
|
203 | + $dir = get_stylesheet_directory().'/give_templates/*'; |
|
204 | + if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) { |
|
205 | + $return .= "\n".'-- Give Template Overrides'."\n\n"; |
|
206 | 206 | |
207 | - foreach ( glob( $dir ) as $file ) { |
|
208 | - $return .= 'Filename: ' . basename( $file ) . "\n"; |
|
207 | + foreach (glob($dir) as $file) { |
|
208 | + $return .= 'Filename: '.basename($file)."\n"; |
|
209 | 209 | } |
210 | 210 | |
211 | - $return = apply_filters( 'give_sysinfo_after_give_templates', $return ); |
|
211 | + $return = apply_filters('give_sysinfo_after_give_templates', $return); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | // Must-use plugins |
215 | 215 | $muplugins = get_mu_plugins(); |
216 | - if ( count( $muplugins > 0 ) ) { |
|
217 | - $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; |
|
216 | + if (count($muplugins > 0)) { |
|
217 | + $return .= "\n".'-- Must-Use Plugins'."\n\n"; |
|
218 | 218 | |
219 | - foreach ( $muplugins as $plugin => $plugin_data ) { |
|
220 | - $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; |
|
219 | + foreach ($muplugins as $plugin => $plugin_data) { |
|
220 | + $return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n"; |
|
221 | 221 | } |
222 | 222 | |
223 | - $return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return ); |
|
223 | + $return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // WordPress active plugins |
227 | - $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; |
|
227 | + $return .= "\n".'-- WordPress Active Plugins'."\n\n"; |
|
228 | 228 | |
229 | 229 | $plugins = get_plugins(); |
230 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
230 | + $active_plugins = get_option('active_plugins', array()); |
|
231 | 231 | |
232 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
233 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
232 | + foreach ($plugins as $plugin_path => $plugin) { |
|
233 | + if ( ! in_array($plugin_path, $active_plugins)) { |
|
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | |
237 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
237 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
238 | 238 | } |
239 | 239 | |
240 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return ); |
|
240 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins', $return); |
|
241 | 241 | |
242 | 242 | // WordPress inactive plugins |
243 | - $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; |
|
243 | + $return .= "\n".'-- WordPress Inactive Plugins'."\n\n"; |
|
244 | 244 | |
245 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
246 | - if ( in_array( $plugin_path, $active_plugins ) ) { |
|
245 | + foreach ($plugins as $plugin_path => $plugin) { |
|
246 | + if (in_array($plugin_path, $active_plugins)) { |
|
247 | 247 | continue; |
248 | 248 | } |
249 | 249 | |
250 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
250 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
251 | 251 | } |
252 | 252 | |
253 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return ); |
|
253 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return); |
|
254 | 254 | |
255 | - if ( is_multisite() ) { |
|
255 | + if (is_multisite()) { |
|
256 | 256 | // WordPress Multisite active plugins |
257 | - $return .= "\n" . '-- Network Active Plugins' . "\n\n"; |
|
257 | + $return .= "\n".'-- Network Active Plugins'."\n\n"; |
|
258 | 258 | |
259 | 259 | $plugins = wp_get_active_network_plugins(); |
260 | - $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
|
260 | + $active_plugins = get_site_option('active_sitewide_plugins', array()); |
|
261 | 261 | |
262 | - foreach ( $plugins as $plugin_path ) { |
|
263 | - $plugin_base = plugin_basename( $plugin_path ); |
|
262 | + foreach ($plugins as $plugin_path) { |
|
263 | + $plugin_base = plugin_basename($plugin_path); |
|
264 | 264 | |
265 | - if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { |
|
265 | + if ( ! array_key_exists($plugin_base, $active_plugins)) { |
|
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | - $plugin = get_plugin_data( $plugin_path ); |
|
270 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
269 | + $plugin = get_plugin_data($plugin_path); |
|
270 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
271 | 271 | } |
272 | 272 | |
273 | - $return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return ); |
|
273 | + $return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // Server configuration (really just versioning) |
277 | - $return .= "\n" . '-- Webserver Configuration' . "\n\n"; |
|
278 | - $return .= 'PHP Version: ' . PHP_VERSION . "\n"; |
|
279 | - $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; |
|
280 | - $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; |
|
277 | + $return .= "\n".'-- Webserver Configuration'."\n\n"; |
|
278 | + $return .= 'PHP Version: '.PHP_VERSION."\n"; |
|
279 | + $return .= 'MySQL Version: '.$wpdb->db_version()."\n"; |
|
280 | + $return .= 'Webserver Info: '.$_SERVER['SERVER_SOFTWARE']."\n"; |
|
281 | 281 | |
282 | - $return = apply_filters( 'give_sysinfo_after_webserver_config', $return ); |
|
282 | + $return = apply_filters('give_sysinfo_after_webserver_config', $return); |
|
283 | 283 | |
284 | 284 | // PHP configs... now we're getting to the important stuff |
285 | - $return .= "\n" . '-- PHP Configuration' . "\n\n"; |
|
286 | - $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); |
|
287 | - $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; |
|
288 | - $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
289 | - $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; |
|
290 | - $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
291 | - $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; |
|
292 | - $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; |
|
293 | - $return .= 'URL-aware fopen: ' . ( ini_get( 'allow_url_fopen' ) ? 'On (' . ini_get( 'allow_url_fopen' ) . ')' : 'N/A' ) . "\n"; |
|
294 | - $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; |
|
295 | - |
|
296 | - $return = apply_filters( 'give_sysinfo_after_php_config', $return ); |
|
285 | + $return .= "\n".'-- PHP Configuration'."\n\n"; |
|
286 | + $return .= 'Safe Mode: '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n"); |
|
287 | + $return .= 'Memory Limit: '.ini_get('memory_limit')."\n"; |
|
288 | + $return .= 'Upload Max Size: '.ini_get('upload_max_filesize')."\n"; |
|
289 | + $return .= 'Post Max Size: '.ini_get('post_max_size')."\n"; |
|
290 | + $return .= 'Upload Max Filesize: '.ini_get('upload_max_filesize')."\n"; |
|
291 | + $return .= 'Time Limit: '.ini_get('max_execution_time')."\n"; |
|
292 | + $return .= 'Max Input Vars: '.ini_get('max_input_vars')."\n"; |
|
293 | + $return .= 'URL-aware fopen: '.(ini_get('allow_url_fopen') ? 'On ('.ini_get('allow_url_fopen').')' : 'N/A')."\n"; |
|
294 | + $return .= 'Display Errors: '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n"; |
|
295 | + |
|
296 | + $return = apply_filters('give_sysinfo_after_php_config', $return); |
|
297 | 297 | |
298 | 298 | // PHP extensions and such |
299 | - $return .= "\n" . '-- PHP Extensions' . "\n\n"; |
|
300 | - $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
299 | + $return .= "\n".'-- PHP Extensions'."\n\n"; |
|
300 | + $return .= 'cURL: '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n"; |
|
301 | 301 | |
302 | 302 | //cURL version |
303 | - if ( function_exists( 'curl_init' ) && function_exists( 'curl_version' ) ) { |
|
303 | + if (function_exists('curl_init') && function_exists('curl_version')) { |
|
304 | 304 | $curl_values = curl_version(); |
305 | - $return .= 'cURL Version: ' . $curl_values["version"] . "\n"; |
|
305 | + $return .= 'cURL Version: '.$curl_values["version"]."\n"; |
|
306 | 306 | } |
307 | - $return .= 'zlib: ' . ( function_exists( 'gzcompress' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
308 | - $return .= 'GD: ' . ( ( extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
309 | - $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
310 | - $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
311 | - $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
312 | - $return .= 'DOM: ' . ( extension_loaded( 'dom' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
313 | - $return .= 'MBString: ' . ( extension_loaded( 'mbstring' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
307 | + $return .= 'zlib: '.(function_exists('gzcompress') ? 'Supported' : 'Not Supported')."\n"; |
|
308 | + $return .= 'GD: '.((extension_loaded('gd') && function_exists('gd_info')) ? 'Supported' : 'Not Supported')."\n"; |
|
309 | + $return .= 'fsockopen: '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n"; |
|
310 | + $return .= 'SOAP Client: '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n"; |
|
311 | + $return .= 'Suhosin: '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n"; |
|
312 | + $return .= 'DOM: '.(extension_loaded('dom') ? 'Installed' : 'Not Installed')."\n"; |
|
313 | + $return .= 'MBString: '.(extension_loaded('mbstring') ? 'Installed' : 'Not Installed')."\n"; |
|
314 | 314 | |
315 | - $return = apply_filters( 'give_sysinfo_after_php_ext', $return ); |
|
315 | + $return = apply_filters('give_sysinfo_after_php_ext', $return); |
|
316 | 316 | |
317 | 317 | // Session stuff |
318 | - $return .= "\n" . '-- Session Configuration' . "\n\n"; |
|
319 | - $return .= 'Give Use Sessions: ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n"; |
|
320 | - $return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; |
|
318 | + $return .= "\n".'-- Session Configuration'."\n\n"; |
|
319 | + $return .= 'Give Use Sessions: '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n"; |
|
320 | + $return .= 'Session: '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n"; |
|
321 | 321 | |
322 | 322 | // The rest of this is only relevant is session is enabled |
323 | - if ( isset( $_SESSION ) ) { |
|
324 | - $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; |
|
325 | - $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; |
|
326 | - $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; |
|
327 | - $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
328 | - $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
323 | + if (isset($_SESSION)) { |
|
324 | + $return .= 'Session Name: '.esc_html(ini_get('session.name'))."\n"; |
|
325 | + $return .= 'Cookie Path: '.esc_html(ini_get('session.cookie_path'))."\n"; |
|
326 | + $return .= 'Save Path: '.esc_html(ini_get('session.save_path'))."\n"; |
|
327 | + $return .= 'Use Cookies: '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n"; |
|
328 | + $return .= 'Use Only Cookies: '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n"; |
|
329 | 329 | } |
330 | 330 | |
331 | - $return = apply_filters( 'give_sysinfo_after_session_config', $return ); |
|
331 | + $return = apply_filters('give_sysinfo_after_session_config', $return); |
|
332 | 332 | |
333 | - $return .= "\n" . '### End System Info ###'; |
|
333 | + $return .= "\n".'### End System Info ###'; |
|
334 | 334 | |
335 | 335 | return $return; |
336 | 336 | } |
@@ -344,17 +344,17 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function give_tools_sysinfo_download() { |
346 | 346 | |
347 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
347 | + if ( ! current_user_can('manage_give_settings')) { |
|
348 | 348 | return; |
349 | 349 | } |
350 | 350 | |
351 | 351 | nocache_headers(); |
352 | 352 | |
353 | - header( 'Content-Type: text/plain' ); |
|
354 | - header( 'Content-Disposition: attachment; filename="give-system-info.txt"' ); |
|
353 | + header('Content-Type: text/plain'); |
|
354 | + header('Content-Disposition: attachment; filename="give-system-info.txt"'); |
|
355 | 355 | |
356 | - echo wp_strip_all_tags( $_POST['give-sysinfo'] ); |
|
356 | + echo wp_strip_all_tags($_POST['give-sysinfo']); |
|
357 | 357 | give_die(); |
358 | 358 | } |
359 | 359 | |
360 | -add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' ); |
|
361 | 360 | \ No newline at end of file |
361 | +add_action('give_download_sysinfo', 'give_tools_sysinfo_download'); |
|
362 | 362 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | * @global $wp_version |
25 | 25 | * @return void |
26 | 26 | */ |
27 | -function give_install( $network_wide = false ) { |
|
27 | +function give_install($network_wide = false) { |
|
28 | 28 | |
29 | 29 | global $wpdb; |
30 | 30 | |
31 | - if ( is_multisite() && $network_wide ) { |
|
31 | + if (is_multisite() && $network_wide) { |
|
32 | 32 | |
33 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
33 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
34 | 34 | |
35 | - switch_to_blog( $blog_id ); |
|
35 | + switch_to_blog($blog_id); |
|
36 | 36 | give_run_install(); |
37 | 37 | restore_current_blog(); |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
49 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Run the Give Install process |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | give_setup_post_types(); |
63 | 63 | |
64 | 64 | // Clear the permalinks |
65 | - flush_rewrite_rules( false ); |
|
65 | + flush_rewrite_rules(false); |
|
66 | 66 | |
67 | 67 | // Add Upgraded From Option |
68 | - $current_version = get_option( 'give_version' ); |
|
69 | - if ( $current_version ) { |
|
70 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
68 | + $current_version = get_option('give_version'); |
|
69 | + if ($current_version) { |
|
70 | + update_option('give_version_upgraded_from', $current_version); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Setup some default options |
74 | 74 | $options = array(); |
75 | 75 | |
76 | 76 | // Checks if the Success Page option exists AND that the page exists |
77 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
77 | + if ( ! get_post(give_get_option('success_page'))) { |
|
78 | 78 | |
79 | 79 | // Purchase Confirmation (Success) Page |
80 | 80 | $success = wp_insert_post( |
81 | 81 | array( |
82 | - 'post_title' => esc_html( 'Donation Confirmation', 'give' ), |
|
82 | + 'post_title' => esc_html('Donation Confirmation', 'give'), |
|
83 | 83 | 'post_content' => '[give_receipt]', |
84 | 84 | 'post_status' => 'publish', |
85 | 85 | 'post_author' => 1, |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // Checks if the Failure Page option exists AND that the page exists |
96 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
96 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
97 | 97 | |
98 | 98 | // Failed Purchase Page |
99 | 99 | $failed = wp_insert_post( |
100 | 100 | array( |
101 | - 'post_title' => esc_html( 'Transaction Failed', 'give' ), |
|
102 | - 'post_content' => esc_html( 'We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give' ), |
|
101 | + 'post_title' => esc_html('Transaction Failed', 'give'), |
|
102 | + 'post_content' => esc_html('We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give'), |
|
103 | 103 | 'post_status' => 'publish', |
104 | 104 | 'post_author' => 1, |
105 | 105 | 'post_type' => 'page', |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | // Checks if the History Page option exists AND that the page exists |
114 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
114 | + if ( ! get_post(give_get_option('history_page'))) { |
|
115 | 115 | // Purchase History (History) Page |
116 | 116 | $history = wp_insert_post( |
117 | 117 | array( |
118 | - 'post_title' => esc_html( 'Donation History', 'give' ), |
|
118 | + 'post_title' => esc_html('Donation History', 'give'), |
|
119 | 119 | 'post_content' => '[donation_history]', |
120 | 120 | 'post_status' => 'publish', |
121 | 121 | 'post_author' => 1, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency |
131 | - if ( empty( $current_version ) ) { |
|
131 | + if (empty($current_version)) { |
|
132 | 132 | $options['base_country'] = 'US'; |
133 | 133 | $options['test_mode'] = 1; |
134 | 134 | $options['currency'] = 'USD'; |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | // Populate some default values |
148 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
149 | - update_option( 'give_version', GIVE_VERSION ); |
|
148 | + update_option('give_settings', array_merge($give_options, $options)); |
|
149 | + update_option('give_version', GIVE_VERSION); |
|
150 | 150 | |
151 | 151 | //Update Version Number |
152 | - if ( $current_version ) { |
|
153 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
152 | + if ($current_version) { |
|
153 | + update_option('give_version_upgraded_from', $current_version); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // Create Give roles |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $roles->add_caps(); |
160 | 160 | |
161 | 161 | $api = new Give_API(); |
162 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
162 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
163 | 163 | |
164 | 164 | // Create the customers database |
165 | 165 | @Give()->customers->create_table(); |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | Give()->session->use_php_sessions(); |
169 | 169 | |
170 | 170 | // Add a temporary option to note that Give pages have been created |
171 | - set_transient( '_give_installed', $options, 30 ); |
|
171 | + set_transient('_give_installed', $options, 30); |
|
172 | 172 | |
173 | - if ( ! $current_version ) { |
|
173 | + if ( ! $current_version) { |
|
174 | 174 | |
175 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
175 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
176 | 176 | |
177 | 177 | // When new upgrade routines are added, mark them as complete on fresh install |
178 | 178 | $upgrade_routines = array( |
@@ -181,22 +181,22 @@ discard block |
||
181 | 181 | 'upgrade_give_offline_status' |
182 | 182 | ); |
183 | 183 | |
184 | - foreach ( $upgrade_routines as $upgrade ) { |
|
185 | - give_set_upgrade_complete( $upgrade ); |
|
184 | + foreach ($upgrade_routines as $upgrade) { |
|
185 | + give_set_upgrade_complete($upgrade); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | 189 | // Bail if activating from network, or bulk |
190 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
190 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
194 | 194 | // Add the transient to redirect |
195 | - set_transient( '_give_activation_redirect', true, 30 ); |
|
195 | + set_transient('_give_activation_redirect', true, 30); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
199 | -register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
199 | +register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * Network Activated New Site Setup |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | * @param int $site_id The Site ID |
213 | 213 | * @param array $meta Blog Meta |
214 | 214 | */ |
215 | -function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
215 | +function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
216 | 216 | |
217 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
217 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
218 | 218 | |
219 | - switch_to_blog( $blog_id ); |
|
219 | + switch_to_blog($blog_id); |
|
220 | 220 | give_install(); |
221 | 221 | restore_current_blog(); |
222 | 222 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | } |
226 | 226 | |
227 | -add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 ); |
|
227 | +add_action('wpmu_new_blog', 'on_create_blog', 10, 6); |
|
228 | 228 | |
229 | 229 | |
230 | 230 | /** |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return array The tables to drop |
239 | 239 | */ |
240 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
240 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
241 | 241 | |
242 | - switch_to_blog( $blog_id ); |
|
242 | + switch_to_blog($blog_id); |
|
243 | 243 | $customers_db = new Give_DB_Customers(); |
244 | - if ( $customers_db->installed() ) { |
|
244 | + if ($customers_db->installed()) { |
|
245 | 245 | $tables[] = $customers_db->table_name; |
246 | 246 | } |
247 | 247 | restore_current_blog(); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | } |
252 | 252 | |
253 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
253 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
254 | 254 | |
255 | 255 | /** |
256 | 256 | * Post-installation |
@@ -262,35 +262,35 @@ discard block |
||
262 | 262 | */ |
263 | 263 | function give_after_install() { |
264 | 264 | |
265 | - if ( ! is_admin() ) { |
|
265 | + if ( ! is_admin()) { |
|
266 | 266 | return; |
267 | 267 | } |
268 | 268 | |
269 | - $give_options = get_transient( '_give_installed' ); |
|
270 | - $give_table_check = get_option( '_give_table_check', false ); |
|
269 | + $give_options = get_transient('_give_installed'); |
|
270 | + $give_table_check = get_option('_give_table_check', false); |
|
271 | 271 | |
272 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
272 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
273 | 273 | |
274 | - if ( ! @Give()->customers->installed() ) { |
|
274 | + if ( ! @Give()->customers->installed()) { |
|
275 | 275 | // Create the customers database (this ensures it creates it on multisite instances where it is network activated) |
276 | 276 | @Give()->customers->create_table(); |
277 | 277 | |
278 | - do_action( 'give_after_install', $give_options ); |
|
278 | + do_action('give_after_install', $give_options); |
|
279 | 279 | } |
280 | 280 | |
281 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
281 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
282 | 282 | |
283 | 283 | } |
284 | 284 | |
285 | 285 | // Delete the transient |
286 | - if ( false !== $give_options ) { |
|
287 | - delete_transient( '_give_installed' ); |
|
286 | + if (false !== $give_options) { |
|
287 | + delete_transient('_give_installed'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
291 | 291 | } |
292 | 292 | |
293 | -add_action( 'admin_init', 'give_after_install' ); |
|
293 | +add_action('admin_init', 'give_after_install'); |
|
294 | 294 | |
295 | 295 | |
296 | 296 | /** |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | |
306 | 306 | global $wp_roles; |
307 | 307 | |
308 | - if ( ! is_object( $wp_roles ) ) { |
|
308 | + if ( ! is_object($wp_roles)) { |
|
309 | 309 | return; |
310 | 310 | } |
311 | 311 | |
312 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
312 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
313 | 313 | |
314 | 314 | // Create Give plugin roles |
315 | 315 | $roles = new Give_Roles(); |
@@ -320,4 +320,4 @@ discard block |
||
320 | 320 | |
321 | 321 | } |
322 | 322 | |
323 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
324 | 323 | \ No newline at end of file |
324 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
325 | 325 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @see Give_Cron::weekly_events() |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
33 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
32 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
33 | + add_action('wp', array($this, 'schedule_Events')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return array |
44 | 44 | */ |
45 | - public function add_schedules( $schedules = array() ) { |
|
45 | + public function add_schedules($schedules = array()) { |
|
46 | 46 | // Adds once weekly to the existing schedules. |
47 | 47 | $schedules['weekly'] = array( |
48 | 48 | 'interval' => 604800, |
49 | - 'display' => esc_html( 'Once Weekly', 'easy-digital-downloads' ) |
|
49 | + 'display' => esc_html('Once Weekly', 'easy-digital-downloads') |
|
50 | 50 | ); |
51 | 51 | |
52 | 52 | return $schedules; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | private function weekly_events() { |
75 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
76 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
75 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
76 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | private function daily_events() { |
88 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
89 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
88 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
89 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -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 | |
@@ -28,94 +28,94 @@ discard block |
||
28 | 28 | |
29 | 29 | global $give_options; |
30 | 30 | |
31 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
32 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
33 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
31 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
32 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
33 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
34 | 34 | |
35 | 35 | // Use minified libraries if SCRIPT_DEBUG is turned off |
36 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
36 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
37 | 37 | |
38 | 38 | //Localize / PHP to AJAX vars |
39 | - $localize_give_checkout = apply_filters( 'give_global_script_vars', array( |
|
39 | + $localize_give_checkout = apply_filters('give_global_script_vars', array( |
|
40 | 40 | 'ajaxurl' => give_get_ajax_url(), |
41 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
42 | - 'currency_sign' => give_currency_filter( '' ), |
|
41 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
42 | + 'currency_sign' => give_currency_filter(''), |
|
43 | 43 | 'currency_pos' => give_get_currency_position(), |
44 | - 'thousands_separator' => isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',', |
|
45 | - 'decimal_separator' => isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.', |
|
46 | - 'no_gateway' => esc_html( 'Please select a payment method.', 'give' ), |
|
47 | - 'bad_minimum' => esc_html( 'The minimum donation amount for this form is', 'give' ), |
|
48 | - 'general_loading' => esc_html( 'Loading...', 'give' ), |
|
49 | - 'purchase_loading' => esc_html( 'Please Wait...', 'give' ), |
|
50 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ), |
|
44 | + 'thousands_separator' => isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',', |
|
45 | + 'decimal_separator' => isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.', |
|
46 | + 'no_gateway' => esc_html('Please select a payment method.', 'give'), |
|
47 | + 'bad_minimum' => esc_html('The minimum donation amount for this form is', 'give'), |
|
48 | + 'general_loading' => esc_html('Loading...', 'give'), |
|
49 | + 'purchase_loading' => esc_html('Please Wait...', 'give'), |
|
50 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2), |
|
51 | 51 | 'give_version' => GIVE_VERSION |
52 | - ) ); |
|
53 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
52 | + )); |
|
53 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
54 | 54 | 'ajaxurl' => give_get_ajax_url(), |
55 | - 'loading' => esc_html( 'Loading', 'give' ), |
|
55 | + 'loading' => esc_html('Loading', 'give'), |
|
56 | 56 | // General loading message |
57 | - 'select_option' => esc_html( 'Please select an option', 'give' ), |
|
57 | + 'select_option' => esc_html('Please select an option', 'give'), |
|
58 | 58 | // Variable pricing error with multi-purchase option enabled |
59 | - 'default_gateway' => give_get_default_gateway( null ), |
|
60 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
61 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ) |
|
62 | - ) ); |
|
59 | + 'default_gateway' => give_get_default_gateway(null), |
|
60 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
61 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2) |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | //DEBUG is On |
65 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
65 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
66 | 66 | |
67 | - if ( give_is_cc_verify_enabled() ) { |
|
68 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
69 | - wp_enqueue_script( 'give-cc-validator' ); |
|
67 | + if (give_is_cc_verify_enabled()) { |
|
68 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
69 | + wp_enqueue_script('give-cc-validator'); |
|
70 | 70 | } |
71 | 71 | |
72 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
73 | - wp_enqueue_script( 'give-float-labels' ); |
|
72 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
73 | + wp_enqueue_script('give-float-labels'); |
|
74 | 74 | |
75 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
76 | - wp_enqueue_script( 'give-blockui' ); |
|
75 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
76 | + wp_enqueue_script('give-blockui'); |
|
77 | 77 | |
78 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
79 | - wp_enqueue_script( 'give-qtip' ); |
|
78 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
79 | + wp_enqueue_script('give-qtip'); |
|
80 | 80 | |
81 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
82 | - wp_enqueue_script( 'give-accounting' ); |
|
81 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
82 | + wp_enqueue_script('give-accounting'); |
|
83 | 83 | |
84 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
85 | - wp_enqueue_script( 'give-magnific' ); |
|
84 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
85 | + wp_enqueue_script('give-magnific'); |
|
86 | 86 | |
87 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88 | - wp_enqueue_script( 'give-checkout-global' ); |
|
87 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
88 | + wp_enqueue_script('give-checkout-global'); |
|
89 | 89 | |
90 | 90 | //General scripts |
91 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
92 | - wp_enqueue_script( 'give-scripts' ); |
|
91 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
92 | + wp_enqueue_script('give-scripts'); |
|
93 | 93 | |
94 | 94 | // Load AJAX scripts, if enabled |
95 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
96 | - wp_enqueue_script( 'give-ajax' ); |
|
95 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
96 | + wp_enqueue_script('give-ajax'); |
|
97 | 97 | |
98 | 98 | //Localize / Pass AJAX vars from PHP |
99 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout ); |
|
100 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
99 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout); |
|
100 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | } else { |
104 | 104 | |
105 | 105 | //DEBUG is OFF (one JS file to rule them all!) |
106 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
107 | - wp_enqueue_script( 'give' ); |
|
106 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
107 | + wp_enqueue_script('give'); |
|
108 | 108 | |
109 | 109 | //Localize / Pass AJAX vars from PHP |
110 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout ); |
|
111 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
110 | + wp_localize_script('give', 'give_global_vars', $localize_give_checkout); |
|
111 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
118 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Register Styles |
@@ -127,47 +127,47 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function give_register_styles() { |
129 | 129 | |
130 | - if ( give_get_option( 'disable_css', false ) ) { |
|
130 | + if (give_get_option('disable_css', false)) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Use minified libraries if SCRIPT_DEBUG is turned off |
135 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
135 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
136 | 136 | |
137 | - $file = 'give' . $suffix . '.css'; |
|
137 | + $file = 'give'.$suffix.'.css'; |
|
138 | 138 | $templates_dir = give_get_theme_template_dir_name(); |
139 | 139 | |
140 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
141 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css'; |
|
142 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
143 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css'; |
|
144 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
140 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
141 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css'; |
|
142 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
143 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css'; |
|
144 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
145 | 145 | |
146 | 146 | // Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory |
147 | 147 | // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
148 | 148 | // This allows users to copy just give.css to their theme |
149 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
150 | - if ( ! empty( $nonmin ) ) { |
|
151 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css'; |
|
149 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
150 | + if ( ! empty($nonmin)) { |
|
151 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css'; |
|
152 | 152 | } else { |
153 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
153 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
154 | 154 | } |
155 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
156 | - if ( ! empty( $nonmin ) ) { |
|
157 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css'; |
|
155 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
156 | + if ( ! empty($nonmin)) { |
|
157 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css'; |
|
158 | 158 | } else { |
159 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
159 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
160 | 160 | } |
161 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
162 | - $url = trailingslashit( give_get_templates_url() ) . $file; |
|
161 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
162 | + $url = trailingslashit(give_get_templates_url()).$file; |
|
163 | 163 | } |
164 | 164 | |
165 | - wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' ); |
|
166 | - wp_enqueue_style( 'give-styles' ); |
|
165 | + wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all'); |
|
166 | + wp_enqueue_style('give-styles'); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
170 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Load Admin Scripts |
@@ -181,107 +181,107 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return void |
183 | 183 | */ |
184 | -function give_load_admin_scripts( $hook ) { |
|
184 | +function give_load_admin_scripts($hook) { |
|
185 | 185 | |
186 | 186 | global $wp_version, $post, $post_type; |
187 | 187 | |
188 | 188 | //Directories of assets |
189 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
190 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
191 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
189 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
190 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
191 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
192 | 192 | |
193 | 193 | // Use minified libraries if SCRIPT_DEBUG is turned off |
194 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
194 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
195 | 195 | |
196 | 196 | //Global Admin: |
197 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
198 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
197 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
198 | + wp_enqueue_style('give-admin-bar-notification'); |
|
199 | 199 | |
200 | 200 | //Give Admin Only: |
201 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
201 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
205 | 205 | //CSS |
206 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
207 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
208 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION ); |
|
209 | - wp_enqueue_style( 'give-admin' ); |
|
210 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
211 | - wp_enqueue_style( 'jquery-chosen' ); |
|
212 | - wp_enqueue_style( 'thickbox' ); |
|
206 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
207 | + wp_enqueue_style('jquery-ui-css'); |
|
208 | + wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION); |
|
209 | + wp_enqueue_style('give-admin'); |
|
210 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
211 | + wp_enqueue_style('jquery-chosen'); |
|
212 | + wp_enqueue_style('thickbox'); |
|
213 | 213 | |
214 | 214 | //JS |
215 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
216 | - wp_enqueue_script( 'jquery-chosen' ); |
|
215 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
216 | + wp_enqueue_script('jquery-chosen'); |
|
217 | 217 | |
218 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
219 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
218 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
219 | + wp_enqueue_script('give-admin-scripts'); |
|
220 | 220 | |
221 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
222 | - wp_enqueue_script( 'jquery-flot' ); |
|
221 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
222 | + wp_enqueue_script('jquery-flot'); |
|
223 | 223 | |
224 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
225 | - wp_enqueue_script( 'give-qtip' ); |
|
224 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
225 | + wp_enqueue_script('give-qtip'); |
|
226 | 226 | |
227 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
228 | - wp_enqueue_script( 'thickbox' ); |
|
227 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
228 | + wp_enqueue_script('thickbox'); |
|
229 | 229 | |
230 | 230 | //Forms CPT Script |
231 | - if ( $post_type === 'give_forms' ) { |
|
232 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
233 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
231 | + if ($post_type === 'give_forms') { |
|
232 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
233 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | //Settings Scripts |
237 | - if (isset($_GET['page']) && $_GET['page'] == 'give-settings' ) { |
|
237 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
238 | 238 | wp_enqueue_script('jquery-ui-sortable'); |
239 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
240 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
239 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
240 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //Localize strings & variables for JS |
244 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
245 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
244 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
245 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
246 | 246 | 'give_version' => GIVE_VERSION, |
247 | - 'quick_edit_warning' => esc_html( 'Sorry, not available for variable priced forms.', 'give' ), |
|
248 | - 'delete_payment' => esc_html( 'Are you sure you wish to delete this payment?', 'give' ), |
|
249 | - 'delete_payment_note' => esc_html( 'Are you sure you wish to delete this note?', 'give' ), |
|
250 | - 'revoke_api_key' => esc_html( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
251 | - 'regenerate_api_key' => esc_html( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
252 | - 'resend_receipt' => esc_html( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
253 | - 'copy_download_link_text' => esc_html( 'Copy these links to your clipboard and give them to your donor.', 'give' ), |
|
247 | + 'quick_edit_warning' => esc_html('Sorry, not available for variable priced forms.', 'give'), |
|
248 | + 'delete_payment' => esc_html('Are you sure you wish to delete this payment?', 'give'), |
|
249 | + 'delete_payment_note' => esc_html('Are you sure you wish to delete this note?', 'give'), |
|
250 | + 'revoke_api_key' => esc_html('Are you sure you wish to revoke this API key?', 'give'), |
|
251 | + 'regenerate_api_key' => esc_html('Are you sure you wish to regenerate this API key?', 'give'), |
|
252 | + 'resend_receipt' => esc_html('Are you sure you wish to resend the donation receipt?', 'give'), |
|
253 | + 'copy_download_link_text' => esc_html('Copy these links to your clipboard and give them to your donor.', 'give'), |
|
254 | 254 | /* translators: %s: form singular label */ |
255 | - 'delete_payment_download' => sprintf( esc_html( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ), |
|
256 | - 'one_price_min' => esc_html( 'You must have at least one price.', 'give' ), |
|
257 | - 'one_file_min' => esc_html( 'You must have at least one file.', 'give' ), |
|
258 | - 'one_field_min' => esc_html( 'You must have at least one field.', 'give' ), |
|
255 | + 'delete_payment_download' => sprintf(esc_html('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), |
|
256 | + 'one_price_min' => esc_html('You must have at least one price.', 'give'), |
|
257 | + 'one_file_min' => esc_html('You must have at least one file.', 'give'), |
|
258 | + 'one_field_min' => esc_html('You must have at least one field.', 'give'), |
|
259 | 259 | /* translators: %s: form singular label */ |
260 | - 'one_option' => sprintf( esc_html( 'Choose a %s', 'give' ), give_get_forms_label_singular() ), |
|
260 | + 'one_option' => sprintf(esc_html('Choose a %s', 'give'), give_get_forms_label_singular()), |
|
261 | 261 | /* translators: %s: form plural label */ |
262 | - 'one_or_more_option' => sprintf( esc_html( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ), |
|
263 | - 'numeric_item_price' => esc_html( 'Item price must be numeric.', 'give' ), |
|
264 | - 'numeric_quantity' => esc_html( 'Quantity must be numeric.', 'give' ), |
|
265 | - 'currency_sign' => give_currency_filter( '' ), |
|
266 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
262 | + 'one_or_more_option' => sprintf(esc_html('Choose one or more %s', 'give'), give_get_forms_label_plural()), |
|
263 | + 'numeric_item_price' => esc_html('Item price must be numeric.', 'give'), |
|
264 | + 'numeric_quantity' => esc_html('Quantity must be numeric.', 'give'), |
|
265 | + 'currency_sign' => give_currency_filter(''), |
|
266 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
267 | 267 | 'currency_decimals' => give_currency_decimal_filter(), |
268 | - 'new_media_ui' => apply_filters( 'give_use_35_media_ui', 1 ), |
|
269 | - 'remove_text' => esc_html( 'Remove', 'give' ), |
|
268 | + 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), |
|
269 | + 'remove_text' => esc_html('Remove', 'give'), |
|
270 | 270 | /* translators: %s: form plural label */ |
271 | - 'type_to_search' => sprintf( esc_html( 'Type to search %s', 'give' ), give_get_forms_label_plural() ), |
|
272 | - 'batch_export_no_class' => esc_html( 'You must choose a method.', 'give' ), |
|
273 | - 'batch_export_no_reqs' => esc_html( 'Required fields not completed.', 'give' ), |
|
274 | - 'reset_stats_warn' => esc_html( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
275 | - ) ); |
|
271 | + 'type_to_search' => sprintf(esc_html('Type to search %s', 'give'), give_get_forms_label_plural()), |
|
272 | + 'batch_export_no_class' => esc_html('You must choose a method.', 'give'), |
|
273 | + 'batch_export_no_reqs' => esc_html('Required fields not completed.', 'give'), |
|
274 | + 'reset_stats_warn' => esc_html('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
275 | + )); |
|
276 | 276 | |
277 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) { |
|
277 | + if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) { |
|
278 | 278 | //call for new media manager |
279 | 279 | wp_enqueue_media(); |
280 | 280 | } |
281 | 281 | |
282 | 282 | } |
283 | 283 | |
284 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
284 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
285 | 285 | |
286 | 286 | /** |
287 | 287 | * Admin Give Icon |
@@ -298,14 +298,14 @@ discard block |
||
298 | 298 | ?> |
299 | 299 | <style type="text/css" media="screen"> |
300 | 300 | |
301 | - <?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?> |
|
301 | + <?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?> |
|
302 | 302 | @font-face { |
303 | 303 | font-family: 'give-icomoon'; |
304 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
305 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
306 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
307 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
308 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
304 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
305 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
306 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
307 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
308 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
309 | 309 | font-weight: normal; |
310 | 310 | font-style: normal; |
311 | 311 | } |
@@ -324,4 +324,4 @@ discard block |
||
324 | 324 | <?php |
325 | 325 | } |
326 | 326 | |
327 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
327 | +add_action('admin_head', 'give_admin_icon'); |
@@ -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 | |
@@ -26,39 +26,39 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', esc_html( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', esc_html('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', esc_html( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', esc_html('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | 54 | |
55 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
56 | - $emails->__set( 'headers', $headers ); |
|
55 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
56 | + $emails->__set('headers', $headers); |
|
57 | 57 | |
58 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
58 | + $emails->send($to_email, $subject, $message, $attachments); |
|
59 | 59 | |
60 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
61 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
60 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
61 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -71,29 +71,29 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function give_email_test_donation_receipt() { |
73 | 73 | |
74 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
75 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
74 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
75 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
76 | 76 | |
77 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
78 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
77 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
78 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
79 | 79 | |
80 | - $subject = give_get_option( 'donation_subject', esc_html( 'Donation Receipt', 'give' ) ); |
|
81 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
82 | - $subject = give_do_email_tags( $subject, 0 ); |
|
80 | + $subject = give_get_option('donation_subject', esc_html('Donation Receipt', 'give')); |
|
81 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
82 | + $subject = give_do_email_tags($subject, 0); |
|
83 | 83 | |
84 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
84 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
85 | 85 | |
86 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
86 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
87 | 87 | |
88 | 88 | $emails = Give()->emails; |
89 | - $emails->__set( 'from_name', $from_name ); |
|
90 | - $emails->__set( 'from_email', $from_email ); |
|
91 | - $emails->__set( 'heading', esc_html( 'Donation Receipt', 'give' ) ); |
|
89 | + $emails->__set('from_name', $from_name); |
|
90 | + $emails->__set('from_email', $from_email); |
|
91 | + $emails->__set('heading', esc_html('Donation Receipt', 'give')); |
|
92 | 92 | |
93 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
94 | - $emails->__set( 'headers', $headers ); |
|
93 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
94 | + $emails->__set('headers', $headers); |
|
95 | 95 | |
96 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
96 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,50 +107,50 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return void |
109 | 109 | */ |
110 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
110 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
111 | 111 | |
112 | - $payment_id = absint( $payment_id ); |
|
112 | + $payment_id = absint($payment_id); |
|
113 | 113 | |
114 | - if ( empty( $payment_id ) ) { |
|
114 | + if (empty($payment_id)) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
118 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
123 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
122 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
123 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
124 | 124 | |
125 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
126 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
125 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
126 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
127 | 127 | |
128 | 128 | /* translators: %s: payment id */ |
129 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
130 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
131 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
129 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html('New Donation - Payment #%s', 'give'), $payment_id)); |
|
130 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
131 | + $subject = give_do_email_tags($subject, $payment_id); |
|
132 | 132 | |
133 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
134 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
133 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
134 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
135 | 135 | //$headers .= "MIME-Version: 1.0\r\n"; |
136 | 136 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
137 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
137 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
138 | 138 | |
139 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
139 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
140 | 140 | |
141 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
141 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
142 | 142 | |
143 | 143 | $emails = Give()->emails; |
144 | - $emails->__set( 'from_name', $from_name ); |
|
145 | - $emails->__set( 'from_email', $from_email ); |
|
146 | - $emails->__set( 'headers', $headers ); |
|
147 | - $emails->__set( 'heading', esc_html( 'New Donation!', 'give' ) ); |
|
144 | + $emails->__set('from_name', $from_name); |
|
145 | + $emails->__set('from_email', $from_email); |
|
146 | + $emails->__set('headers', $headers); |
|
147 | + $emails->__set('heading', esc_html('New Donation!', 'give')); |
|
148 | 148 | |
149 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
149 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
153 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
153 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Retrieves the emails for which admin notifications are sent to (these can be |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | function give_get_admin_notice_emails() { |
164 | 164 | global $give_options; |
165 | 165 | |
166 | - $emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' ); |
|
167 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
166 | + $emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email'); |
|
167 | + $emails = array_map('trim', explode("\n", $emails)); |
|
168 | 168 | |
169 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
169 | + return apply_filters('give_admin_notice_emails', $emails); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return mixed |
180 | 180 | */ |
181 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
181 | +function give_admin_notices_disabled($payment_id = 0) { |
|
182 | 182 | |
183 | - $retval = give_get_option( 'disable_admin_notices' ); |
|
183 | + $retval = give_get_option('disable_admin_notices'); |
|
184 | 184 | |
185 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
185 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function give_get_default_donation_notification_email() { |
197 | 197 | |
198 | - $default_email_body = esc_html( 'Hi there,', 'give' ) . "\n\n" . esc_html( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
199 | - $default_email_body .= '<strong>' . esc_html( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n"; |
|
200 | - $default_email_body .= '<strong>' . esc_html( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . esc_html( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n"; |
|
202 | - $default_email_body .= '<strong>' . esc_html( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n"; |
|
203 | - $default_email_body .= esc_html( 'Thank you,', 'give' ) . "\n\n" . '{sitename}'; |
|
198 | + $default_email_body = esc_html('Hi there,', 'give')."\n\n".esc_html('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
199 | + $default_email_body .= '<strong>'.esc_html('Donor: ', 'give').'</strong> '.' {name}'."\n"; |
|
200 | + $default_email_body .= '<strong>'.esc_html('Donation: ', 'give').'</strong> '.' {donation}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.esc_html('Amount: ', 'give').'</strong> '.' {price}'."\n"; |
|
202 | + $default_email_body .= '<strong>'.esc_html('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n"; |
|
203 | + $default_email_body .= esc_html('Thank you,', 'give')."\n\n".'{sitename}'; |
|
204 | 204 | |
205 | - $custom_message = give_get_option( 'donation_notification' ); |
|
206 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
205 | + $custom_message = give_get_option('donation_notification'); |
|
206 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
207 | 207 | |
208 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
208 | + return apply_filters('give_default_donation_notification_email', $message); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -219,26 +219,26 @@ discard block |
||
219 | 219 | */ |
220 | 220 | function give_get_default_donation_receipt_email() { |
221 | 221 | |
222 | - $default_email_body = esc_html( 'Dear', 'give' ) . " {name},\n\n"; |
|
223 | - $default_email_body .= esc_html( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
224 | - $default_email_body .= '<strong>' . esc_html( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n"; |
|
225 | - $default_email_body .= '<strong>' . esc_html( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . esc_html( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . esc_html( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . esc_html( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . esc_html( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n"; |
|
230 | - $default_email_body .= '<strong>' . esc_html( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n"; |
|
231 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
222 | + $default_email_body = esc_html('Dear', 'give')." {name},\n\n"; |
|
223 | + $default_email_body .= esc_html('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
224 | + $default_email_body .= '<strong>'.esc_html('Donor', 'give').':</strong> '.'{fullname}'."\n"; |
|
225 | + $default_email_body .= '<strong>'.esc_html('Donation', 'give').':</strong> '.'{donation}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.esc_html('Donation Date', 'give').':</strong> '.'{date}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.esc_html('Amount', 'give').':</strong> '.'{price}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.esc_html('Payment Method', 'give').':</strong> '.'{payment_method}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.esc_html('Payment ID', 'give').':</strong> '.'{payment_id}'."\n"; |
|
230 | + $default_email_body .= '<strong>'.esc_html('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n"; |
|
231 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
232 | 232 | |
233 | 233 | $default_email_body .= "\n\n"; |
234 | - $default_email_body .= esc_html( 'Sincerely,', 'give' ); |
|
235 | - $default_email_body .= "\n" . '{sitename}' . "\n"; |
|
234 | + $default_email_body .= esc_html('Sincerely,', 'give'); |
|
235 | + $default_email_body .= "\n".'{sitename}'."\n"; |
|
236 | 236 | |
237 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
237 | + $custom_message = give_get_option('donation_receipt'); |
|
238 | 238 | |
239 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
239 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
240 | 240 | |
241 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
241 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -250,19 +250,19 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return array $email_names |
252 | 252 | */ |
253 | -function give_get_email_names( $user_info ) { |
|
253 | +function give_get_email_names($user_info) { |
|
254 | 254 | $email_names = array(); |
255 | - $user_info = maybe_unserialize( $user_info ); |
|
255 | + $user_info = maybe_unserialize($user_info); |
|
256 | 256 | |
257 | 257 | $email_names['fullname'] = ''; |
258 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
259 | - $user_data = get_userdata( $user_info['id'] ); |
|
258 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
259 | + $user_data = get_userdata($user_info['id']); |
|
260 | 260 | $email_names['name'] = $user_info['first_name']; |
261 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
261 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
262 | 262 | $email_names['username'] = $user_data->user_login; |
263 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
263 | + } elseif (isset($user_info['first_name'])) { |
|
264 | 264 | $email_names['name'] = $user_info['first_name']; |
265 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
265 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
266 | 266 | $email_names['username'] = $user_info['first_name']; |
267 | 267 | } else { |
268 | 268 | $email_names['name'] = $user_info['email']; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
26 | +function give_trigger_donation_receipt($payment_id) { |
|
27 | 27 | // Make sure we don't send a purchase receipt while editing a payment |
28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Send email |
33 | - give_email_donation_receipt( $payment_id ); |
|
33 | + give_email_donation_receipt($payment_id); |
|
34 | 34 | } |
35 | 35 | |
36 | -add_action( 'give_complete_purchase', 'give_trigger_donation_receipt', 999, 1 ); |
|
36 | +add_action('give_complete_purchase', 'give_trigger_donation_receipt', 999, 1); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Resend the Email Purchase Receipt. (This can be done from the Payment History page) |
@@ -44,29 +44,29 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return void |
46 | 46 | */ |
47 | -function give_resend_donation_receipt( $data ) { |
|
47 | +function give_resend_donation_receipt($data) { |
|
48 | 48 | |
49 | - $purchase_id = absint( $data['purchase_id'] ); |
|
49 | + $purchase_id = absint($data['purchase_id']); |
|
50 | 50 | |
51 | - if ( empty( $purchase_id ) ) { |
|
51 | + if (empty($purchase_id)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) { |
|
56 | - wp_die( esc_html( 'You do not have permission to edit payment records.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
55 | + if ( ! current_user_can('edit_give_payments', $purchase_id)) { |
|
56 | + wp_die(esc_html('You do not have permission to edit payment records.', 'give'), esc_html('Error', 'give'), array('response' => 403)); |
|
57 | 57 | } |
58 | 58 | |
59 | - give_email_donation_receipt( $purchase_id, false ); |
|
59 | + give_email_donation_receipt($purchase_id, false); |
|
60 | 60 | |
61 | - wp_redirect( add_query_arg( array( |
|
61 | + wp_redirect(add_query_arg(array( |
|
62 | 62 | 'give-message' => 'email_sent', |
63 | 63 | 'give-action' => false, |
64 | 64 | 'purchase_id' => false |
65 | - ) ) ); |
|
65 | + ))); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_email_links', 'give_resend_donation_receipt' ); |
|
69 | +add_action('give_email_links', 'give_resend_donation_receipt'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Trigger the sending of a Test Email |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return void |
79 | 79 | */ |
80 | -function give_send_test_email( $data ) { |
|
81 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) { |
|
80 | +function give_send_test_email($data) { |
|
81 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | give_email_test_donation_receipt(); |
87 | 87 | |
88 | 88 | // Remove the test email query arg |
89 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
89 | + wp_redirect(remove_query_arg('give_action')); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | |
93 | -add_action( 'give_send_test_email', 'give_send_test_email' ); |
|
93 | +add_action('give_send_test_email', 'give_send_test_email'); |
@@ -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 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,40 +54,40 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string $message Fully formatted message |
56 | 56 | */ |
57 | -function give_email_preview_template_tags( $message ) { |
|
57 | +function give_email_preview_template_tags($message) { |
|
58 | 58 | |
59 | - $price = give_currency_filter( give_format_amount( 10.50 ) ); |
|
59 | + $price = give_currency_filter(give_format_amount(10.50)); |
|
60 | 60 | |
61 | 61 | $gateway = 'PayPal'; |
62 | 62 | |
63 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
63 | + $receipt_id = strtolower(md5(uniqid())); |
|
64 | 64 | |
65 | - $notes = esc_html( 'These are some sample notes added to a donation.', 'give' ); |
|
65 | + $notes = esc_html('These are some sample notes added to a donation.', 'give'); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | 69 | $receipt_link = sprintf( |
70 | 70 | '<a href="%1$s">%2$s</a>', |
71 | - esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ), |
|
72 | - esc_html( 'View the receipt in your browser', 'give' ) |
|
71 | + esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())), |
|
72 | + esc_html('View the receipt in your browser', 'give') |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $user = wp_get_current_user(); |
76 | 76 | |
77 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
78 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
80 | - $message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message ); |
|
81 | - $message = str_replace( '{price}', $price, $message ); |
|
82 | - $message = str_replace( '{donation}', 'Sample Donation Form Title', $message ); |
|
83 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
84 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
85 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
86 | - $message = str_replace( '{product_notes}', $notes, $message ); |
|
87 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
88 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
89 | - |
|
90 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
77 | + $message = str_replace('{name}', $user->display_name, $message); |
|
78 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
79 | + $message = str_replace('{username}', $user->user_login, $message); |
|
80 | + $message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message); |
|
81 | + $message = str_replace('{price}', $price, $message); |
|
82 | + $message = str_replace('{donation}', 'Sample Donation Form Title', $message); |
|
83 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
84 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
85 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
86 | + $message = str_replace('{product_notes}', $notes, $message); |
|
87 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
88 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
89 | + |
|
90 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | * @since 1.0 |
101 | 101 | * @return array|bool |
102 | 102 | */ |
103 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
103 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
104 | 104 | |
105 | -function give_email_template_preview( $array ) { |
|
105 | +function give_email_template_preview($array) { |
|
106 | 106 | |
107 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
107 | + if ( ! current_user_can('manage_give_settings')) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | $custom_field = array( |
111 | - 'name' => esc_html( 'Preview Email', 'give' ), |
|
112 | - 'desc' => esc_html( 'Click the buttons to preview emails.', 'give' ), |
|
111 | + 'name' => esc_html('Preview Email', 'give'), |
|
112 | + 'desc' => esc_html('Click the buttons to preview emails.', 'give'), |
|
113 | 113 | 'id' => 'give_email_preview_buttons', |
114 | 114 | 'type' => 'email_preview_buttons' |
115 | 115 | ); |
116 | - array_splice( $array, 5, 0, array( $custom_field ) ); |
|
116 | + array_splice($array, 5, 0, array($custom_field)); |
|
117 | 117 | |
118 | 118 | return $array; // splice in at position 3; |
119 | 119 | } |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | function give_email_preview_buttons_callback() { |
130 | 130 | ob_start(); |
131 | 131 | ?> |
132 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e( 'Donation Receipt Preview', 'give' ); ?> "><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
133 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
132 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e('Donation Receipt Preview', 'give'); ?> "><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
133 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
134 | 134 | 'give_action' => 'send_test_email', |
135 | 135 | 'give-message' => 'sent-test-email' |
136 | - ) ), 'give-test-email' ); ?>" title="<?php esc_attr_e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
136 | + )), 'give-test-email'); ?>" title="<?php esc_attr_e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
137 | 137 | <?php |
138 | 138 | echo ob_get_clean(); |
139 | 139 | } |
@@ -146,27 +146,27 @@ discard block |
||
146 | 146 | */ |
147 | 147 | function give_display_email_template_preview() { |
148 | 148 | |
149 | - if ( empty( $_GET['give_action'] ) ) { |
|
149 | + if (empty($_GET['give_action'])) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
153 | + if ('preview_email' !== $_GET['give_action']) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | |
157 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
157 | + if ( ! current_user_can('manage_give_settings')) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - Give()->emails->heading = esc_html( 'Donation Receipt', 'give' ); |
|
161 | + Give()->emails->heading = esc_html('Donation Receipt', 'give'); |
|
162 | 162 | |
163 | - echo Give()->emails->build_email( give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ) ); |
|
163 | + echo Give()->emails->build_email(give_email_preview_template_tags(give_get_email_body_content(0, array()))); |
|
164 | 164 | |
165 | 165 | exit; |
166 | 166 | |
167 | 167 | } |
168 | 168 | |
169 | -add_action( 'template_redirect', 'give_display_email_template_preview' ); |
|
169 | +add_action('template_redirect', 'give_display_email_template_preview'); |
|
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Email Template Body |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string $email_body Body of the email |
180 | 180 | */ |
181 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
181 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
182 | 182 | |
183 | 183 | global $give_options; |
184 | 184 | |
185 | 185 | $default_email_body = give_get_default_donation_receipt_email(); |
186 | 186 | |
187 | - $email = isset( $give_options['donation_receipt'] ) ? stripslashes( $give_options['donation_receipt'] ) : $default_email_body; |
|
187 | + $email = isset($give_options['donation_receipt']) ? stripslashes($give_options['donation_receipt']) : $default_email_body; |
|
188 | 188 | |
189 | - $email_body = wpautop( $email ); |
|
189 | + $email_body = wpautop($email); |
|
190 | 190 | |
191 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
191 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
192 | 192 | |
193 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
193 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -206,41 +206,41 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return string $email_body Body of the email |
208 | 208 | */ |
209 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
209 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
210 | 210 | global $give_options; |
211 | 211 | |
212 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
213 | - $email = give_get_payment_user_email( $payment_id ); |
|
212 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
213 | + $email = give_get_payment_user_email($payment_id); |
|
214 | 214 | |
215 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
216 | - $user_data = get_userdata( $user_info['id'] ); |
|
215 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
216 | + $user_data = get_userdata($user_info['id']); |
|
217 | 217 | $name = $user_data->display_name; |
218 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
219 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
218 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
219 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
220 | 220 | } else { |
221 | 221 | $name = $email; |
222 | 222 | } |
223 | 223 | |
224 | - $gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
224 | + $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true)); |
|
225 | 225 | |
226 | - $default_email_body = esc_html( 'Hello', 'give' ) . "\n\n" . esc_html( 'A donation has been made', 'give' ) . ".\n\n"; |
|
226 | + $default_email_body = esc_html('Hello', 'give')."\n\n".esc_html('A donation has been made', 'give').".\n\n"; |
|
227 | 227 | $default_email_body .= sprintf( |
228 | 228 | /* translators: %s: form plural label */ |
229 | - esc_html( '%s sold:', 'give' ), |
|
229 | + esc_html('%s sold:', 'give'), |
|
230 | 230 | give_get_forms_label_plural() |
231 | - ) . "\n\n"; |
|
231 | + )."\n\n"; |
|
232 | 232 | |
233 | - $default_email_body .= esc_html( 'Donor: ', 'give' ) . " " . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
234 | - $default_email_body .= esc_html( 'Amount: ', 'give' ) . " " . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
235 | - $default_email_body .= esc_html( 'Payment Method: ', 'give' ) . " " . $gateway . "\n\n"; |
|
233 | + $default_email_body .= esc_html('Donor: ', 'give')." ".html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
234 | + $default_email_body .= esc_html('Amount: ', 'give')." ".html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n"; |
|
235 | + $default_email_body .= esc_html('Payment Method: ', 'give')." ".$gateway."\n\n"; |
|
236 | 236 | |
237 | - $default_email_body .= esc_html( 'Thank you', 'give' ); |
|
237 | + $default_email_body .= esc_html('Thank you', 'give'); |
|
238 | 238 | |
239 | - $email = isset( $give_options['donation_notification'] ) ? stripslashes( $give_options['donation_notification'] ) : $default_email_body; |
|
239 | + $email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body; |
|
240 | 240 | |
241 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
241 | + $email_body = give_do_email_tags($email, $payment_id); |
|
242 | 242 | |
243 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
243 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | * @since 1.0 |
254 | 254 | */ |
255 | 255 | function give_render_receipt_in_browser() { |
256 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
257 | - wp_die( esc_html( 'Missing donation payment key.', 'give' ), esc_html( 'Error', 'give' ) ); |
|
256 | + if ( ! isset($_GET['payment_key'])) { |
|
257 | + wp_die(esc_html('Missing donation payment key.', 'give'), esc_html('Error', 'give')); |
|
258 | 258 | } |
259 | 259 | |
260 | - $key = urlencode( $_GET['payment_key'] ); |
|
260 | + $key = urlencode($_GET['payment_key']); |
|
261 | 261 | |
262 | 262 | ob_start(); |
263 | 263 | //Disallows caching of the page |
264 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
264 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
265 | 265 | header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
266 | 266 | header("Cache-Control: post-check=0, pre-check=0", false); |
267 | 267 | header("Pragma: no-cache"); // HTTP/1.0 |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | <!DOCTYPE html> |
271 | 271 | <html lang="en"> |
272 | 272 | <head> |
273 | - <title><?php esc_html_e( 'Donation Receipt', 'give' ); ?></title> |
|
273 | + <title><?php esc_html_e('Donation Receipt', 'give'); ?></title> |
|
274 | 274 | <meta charset="utf-8" /> |
275 | 275 | |
276 | 276 | <!-- Further disallowing of caching of this page --> |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | |
285 | 285 | <?php wp_head(); ?> |
286 | 286 | </head> |
287 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
287 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
288 | 288 | |
289 | 289 | <div id="give_receipt_wrapper"> |
290 | - <?php do_action( 'give_render_receipt_in_browser_before' ); ?> |
|
291 | - <?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?> |
|
292 | - <?php do_action( 'give_render_receipt_in_browser_after' ); ?> |
|
290 | + <?php do_action('give_render_receipt_in_browser_before'); ?> |
|
291 | + <?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?> |
|
292 | + <?php do_action('give_render_receipt_in_browser_after'); ?> |
|
293 | 293 | </div> |
294 | 294 | |
295 | 295 | <?php wp_footer(); ?> |
@@ -300,4 +300,4 @@ discard block |
||
300 | 300 | die(); |
301 | 301 | } |
302 | 302 | |
303 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
303 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
@@ -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 | |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function __construct() { |
81 | 81 | |
82 | - if ( 'none' === $this->get_template() ) { |
|
82 | + if ('none' === $this->get_template()) { |
|
83 | 83 | $this->html = false; |
84 | 84 | } |
85 | 85 | |
86 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
87 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
86 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
87 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
88 | 88 | |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.0 |
95 | 95 | */ |
96 | - public function __set( $key, $value ) { |
|
96 | + public function __set($key, $value) { |
|
97 | 97 | $this->$key = $value; |
98 | 98 | } |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @since 1.0 |
104 | 104 | */ |
105 | 105 | public function get_from_name() { |
106 | - if ( ! $this->from_name ) { |
|
107 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
106 | + if ( ! $this->from_name) { |
|
107 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
108 | 108 | } |
109 | 109 | |
110 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
110 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | * @since 1.0 |
117 | 117 | */ |
118 | 118 | public function get_from_address() { |
119 | - if ( ! $this->from_address ) { |
|
120 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
119 | + if ( ! $this->from_address) { |
|
120 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
121 | 121 | } |
122 | 122 | |
123 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
123 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | * @since 1.0 |
130 | 130 | */ |
131 | 131 | public function get_content_type() { |
132 | - if ( ! $this->content_type && $this->html ) { |
|
133 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
134 | - } else if ( ! $this->html ) { |
|
132 | + if ( ! $this->content_type && $this->html) { |
|
133 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
134 | + } else if ( ! $this->html) { |
|
135 | 135 | $this->content_type = 'text/plain'; |
136 | 136 | } |
137 | 137 | |
138 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
138 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | * @since 1.0 |
145 | 145 | */ |
146 | 146 | public function get_headers() { |
147 | - if ( ! $this->headers ) { |
|
147 | + if ( ! $this->headers) { |
|
148 | 148 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
149 | 149 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
150 | 150 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
151 | 151 | } |
152 | 152 | |
153 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
153 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function get_templates() { |
162 | 162 | $templates = array( |
163 | - 'default' => esc_html( 'Default Template', 'give' ), |
|
164 | - 'none' => esc_html( 'No template, plain text only', 'give' ) |
|
163 | + 'default' => esc_html('Default Template', 'give'), |
|
164 | + 'none' => esc_html('No template, plain text only', 'give') |
|
165 | 165 | ); |
166 | 166 | |
167 | - return apply_filters( 'give_email_templates', $templates ); |
|
167 | + return apply_filters('give_email_templates', $templates); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @since 1.0 |
174 | 174 | */ |
175 | 175 | public function get_template() { |
176 | - if ( ! $this->template ) { |
|
177 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
176 | + if ( ! $this->template) { |
|
177 | + $this->template = give_get_option('email_template', 'default'); |
|
178 | 178 | } |
179 | 179 | |
180 | - return apply_filters( 'give_email_template', $this->template ); |
|
180 | + return apply_filters('give_email_template', $this->template); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @since 1.0 |
187 | 187 | */ |
188 | 188 | public function get_heading() { |
189 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
189 | + return apply_filters('give_email_heading', $this->heading); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return mixed |
198 | 198 | */ |
199 | - public function parse_tags( $content ) { |
|
199 | + public function parse_tags($content) { |
|
200 | 200 | return $content; |
201 | 201 | } |
202 | 202 | |
@@ -205,36 +205,36 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - public function build_email( $message ) { |
|
208 | + public function build_email($message) { |
|
209 | 209 | |
210 | - if ( false === $this->html ) { |
|
211 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
210 | + if (false === $this->html) { |
|
211 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
212 | 212 | } |
213 | 213 | |
214 | - $message = $this->text_to_html( $message ); |
|
214 | + $message = $this->text_to_html($message); |
|
215 | 215 | |
216 | 216 | ob_start(); |
217 | 217 | |
218 | - give_get_template_part( 'emails/header', $this->get_template(), true ); |
|
218 | + give_get_template_part('emails/header', $this->get_template(), true); |
|
219 | 219 | |
220 | - do_action( 'give_email_header', $this ); |
|
220 | + do_action('give_email_header', $this); |
|
221 | 221 | |
222 | - if ( has_action( 'give_email_template_' . $this->get_template() ) ) { |
|
223 | - do_action( 'give_email_template_' . $this->get_template() ); |
|
222 | + if (has_action('give_email_template_'.$this->get_template())) { |
|
223 | + do_action('give_email_template_'.$this->get_template()); |
|
224 | 224 | } else { |
225 | - give_get_template_part( 'emails/body', $this->get_template(), true ); |
|
225 | + give_get_template_part('emails/body', $this->get_template(), true); |
|
226 | 226 | } |
227 | 227 | |
228 | - do_action( 'give_email_body', $this ); |
|
228 | + do_action('give_email_body', $this); |
|
229 | 229 | |
230 | - give_get_template_part( 'emails/footer', $this->get_template(), true ); |
|
230 | + give_get_template_part('emails/footer', $this->get_template(), true); |
|
231 | 231 | |
232 | - do_action( 'give_email_footer', $this ); |
|
232 | + do_action('give_email_footer', $this); |
|
233 | 233 | |
234 | 234 | $body = ob_get_clean(); |
235 | - $message = str_replace( '{email}', $message, $body ); |
|
235 | + $message = str_replace('{email}', $message, $body); |
|
236 | 236 | |
237 | - return apply_filters( 'give_email_message', $message, $this ); |
|
237 | + return apply_filters('give_email_message', $message, $this); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -247,26 +247,26 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return bool |
249 | 249 | */ |
250 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
250 | + public function send($to, $subject, $message, $attachments = '') { |
|
251 | 251 | |
252 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
253 | - _doing_it_wrong( __FUNCTION__, esc_html( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
252 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
253 | + _doing_it_wrong(__FUNCTION__, esc_html('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
254 | 254 | |
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | |
258 | - do_action( 'give_email_send_before', $this ); |
|
258 | + do_action('give_email_send_before', $this); |
|
259 | 259 | |
260 | - $subject = $this->parse_tags( $subject ); |
|
261 | - $message = $this->parse_tags( $message ); |
|
260 | + $subject = $this->parse_tags($subject); |
|
261 | + $message = $this->parse_tags($message); |
|
262 | 262 | |
263 | - $message = $this->build_email( $message ); |
|
263 | + $message = $this->build_email($message); |
|
264 | 264 | |
265 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
265 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
266 | 266 | |
267 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
267 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
268 | 268 | |
269 | - do_action( 'give_email_send_after', $this ); |
|
269 | + do_action('give_email_send_after', $this); |
|
270 | 270 | |
271 | 271 | return $sent; |
272 | 272 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | * @since 1.0 |
279 | 279 | */ |
280 | 280 | public function send_before() { |
281 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
282 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
283 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
281 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
282 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
283 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | * @since 1.0 |
290 | 290 | */ |
291 | 291 | public function send_after() { |
292 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
293 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
294 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
292 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
293 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
294 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
295 | 295 | |
296 | 296 | // Reset heading to an empty string |
297 | 297 | $this->heading = ''; |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @since 1.0 |
304 | 304 | */ |
305 | - public function text_to_html( $message ) { |
|
305 | + public function text_to_html($message) { |
|
306 | 306 | |
307 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
308 | - $message = wpautop( $message ); |
|
307 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
308 | + $message = wpautop($message); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | return $message; |