@@ -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 | |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Templates |
38 | 38 | */ |
39 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
39 | + add_filter('template_include', array(__CLASS__, 'template_loader')); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Content Wrappers |
43 | 43 | */ |
44 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
45 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
44 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10); |
|
45 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Entry Summary Classes |
49 | 49 | */ |
50 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
50 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes')); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Sidebar |
54 | 54 | */ |
55 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
55 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Single Forms Summary Box |
59 | 59 | */ |
60 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
61 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
60 | + add_action('give_single_form_summary', 'give_template_single_title', 5); |
|
61 | + add_action('give_single_form_summary', 'give_get_donation_form', 10); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string $classes List of space separated class names. |
75 | 75 | */ |
76 | - public function give_set_single_summary_classes( $classes ) { |
|
76 | + public function give_set_single_summary_classes($classes) { |
|
77 | 77 | |
78 | 78 | //Add full width class when feature image is disabled AND no widgets are present |
79 | - if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
79 | + if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
80 | 80 | $classes .= ' give-full-width'; |
81 | 81 | } |
82 | 82 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function give_output_sidebar_option() { |
98 | 98 | |
99 | 99 | //Add full width class when feature image is disabled AND no widgets are present |
100 | - if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
101 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
102 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
103 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
104 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
100 | + if (give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
101 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5); |
|
102 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10); |
|
103 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20); |
|
104 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string $template |
125 | 125 | */ |
126 | - public static function template_loader( $template ) { |
|
127 | - $find = array( 'give.php' ); |
|
126 | + public static function template_loader($template) { |
|
127 | + $find = array('give.php'); |
|
128 | 128 | $file = ''; |
129 | 129 | |
130 | - if ( is_single() && get_post_type() == 'give_forms' ) { |
|
130 | + if (is_single() && get_post_type() == 'give_forms') { |
|
131 | 131 | $file = 'single-give-form.php'; |
132 | 132 | $find[] = $file; |
133 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
133 | + $find[] = apply_filters('give_template_path', 'give/').$file; |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( $file ) { |
|
137 | - $template = locate_template( array_unique( $find ) ); |
|
138 | - if ( ! $template ) { |
|
139 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
136 | + if ($file) { |
|
137 | + $template = locate_template(array_unique($find)); |
|
138 | + if ( ! $template) { |
|
139 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @since 1.5 |
33 | 33 | */ |
34 | - do_action( 'give_tools_recount_stats_before' ); |
|
34 | + do_action('give_tools_recount_stats_before'); |
|
35 | 35 | ?> |
36 | 36 | <div id="poststuff"> |
37 | 37 | <div class="postbox"> |
38 | 38 | |
39 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
39 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
40 | 40 | |
41 | 41 | <div class="inside recount-stats-controls"> |
42 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
42 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
43 | 43 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
44 | 44 | |
45 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
45 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
46 | 46 | |
47 | 47 | <select name="give-export-class" id="recount-stats-type"> |
48 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
49 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
50 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
51 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
52 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
53 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
54 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
48 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
49 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
50 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
51 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
52 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
53 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
54 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
55 | 55 | <?php |
56 | 56 | /** |
57 | 57 | * Fires in the recount stats selectbox. |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @since 1.5 |
62 | 62 | */ |
63 | - do_action( 'give_recount_tool_options' ); |
|
63 | + do_action('give_recount_tool_options'); |
|
64 | 64 | ?> |
65 | 65 | </select> |
66 | 66 | |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | <?php |
69 | 69 | $args = array( |
70 | 70 | 'name' => 'form_id', |
71 | - 'number' => - 1, |
|
71 | + 'number' => -1, |
|
72 | 72 | 'chosen' => true, |
73 | 73 | ); |
74 | - echo Give()->html->forms_dropdown( $args ); |
|
74 | + echo Give()->html->forms_dropdown($args); |
|
75 | 75 | ?> |
76 | 76 | </span> |
77 | 77 | |
78 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
78 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
79 | 79 | |
80 | 80 | <br/> |
81 | 81 | |
82 | 82 | <span class="give-recount-stats-descriptions"> |
83 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
84 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
85 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
86 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
83 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
84 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
85 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
86 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
87 | 87 | <?php |
88 | 88 | /** |
89 | 89 | * Fires in the recount stats description area. |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 1.5 |
94 | 94 | */ |
95 | - do_action( 'give_recount_tool_descriptions' ); |
|
95 | + do_action('give_recount_tool_descriptions'); |
|
96 | 96 | ?> |
97 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
98 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
97 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
98 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
99 | 99 | </span> |
100 | 100 | |
101 | 101 | <span class="spinner"></span> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | - do_action( 'give_tools_recount_forms' ); |
|
112 | + do_action('give_tools_recount_forms'); |
|
113 | 113 | ?> |
114 | 114 | </div><!-- .inside --> |
115 | 115 | </div><!-- .postbox --> |
@@ -120,5 +120,5 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.5 |
122 | 122 | */ |
123 | - do_action( 'give_tools_recount_stats_after' ); |
|
123 | + do_action('give_tools_recount_stats_after'); |
|
124 | 124 | } |
125 | 125 | \ 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 | |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return bool true if has variable prices, false otherwise |
25 | 25 | */ |
26 | -function give_has_variable_prices( $form_id = 0 ) { |
|
26 | +function give_has_variable_prices($form_id = 0) { |
|
27 | 27 | |
28 | - if ( empty( $form_id ) ) { |
|
28 | + if (empty($form_id)) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
32 | - $form = new Give_Donate_Form( $form_id ); |
|
32 | + $form = new Give_Donate_Form($form_id); |
|
33 | 33 | |
34 | 34 | return $form->has_variable_prices(); |
35 | 35 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array Variable prices |
46 | 46 | */ |
47 | -function give_get_variable_prices( $form_id = 0 ) { |
|
47 | +function give_get_variable_prices($form_id = 0) { |
|
48 | 48 | |
49 | - if ( empty( $form_id ) ) { |
|
49 | + if (empty($form_id)) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $form = new Give_Donate_Form( $form_id ); |
|
53 | + $form = new Give_Donate_Form($form_id); |
|
54 | 54 | |
55 | 55 | return $form->prices; |
56 | 56 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return string $default_price |
69 | 69 | */ |
70 | -function give_get_default_multilevel_amount( $form_id ) { |
|
70 | +function give_get_default_multilevel_amount($form_id) { |
|
71 | 71 | $default_price = '1.00'; |
72 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
72 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
73 | 73 | |
74 | - foreach ( $prices as $price ) { |
|
74 | + foreach ($prices as $price) { |
|
75 | 75 | |
76 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
76 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
77 | 77 | $default_price = $price['_give_amount']; |
78 | 78 | } |
79 | 79 | |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | * @return string $default_price |
95 | 95 | * @since 1.0 |
96 | 96 | */ |
97 | -function give_get_default_form_amount( $form_id ) { |
|
97 | +function give_get_default_form_amount($form_id) { |
|
98 | 98 | |
99 | - if ( give_has_variable_prices( $form_id ) ) { |
|
99 | + if (give_has_variable_prices($form_id)) { |
|
100 | 100 | |
101 | - $default_amount = give_get_default_multilevel_amount( $form_id ); |
|
101 | + $default_amount = give_get_default_multilevel_amount($form_id); |
|
102 | 102 | |
103 | 103 | } else { |
104 | 104 | |
105 | - $default_amount = get_post_meta( $form_id, '_give_set_price', true ); |
|
105 | + $default_amount = get_post_meta($form_id, '_give_set_price', true); |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | |
109 | - return apply_filters( 'give_default_form_amount', $default_amount ); |
|
109 | + return apply_filters('give_default_form_amount', $default_amount); |
|
110 | 110 | |
111 | 111 | } |
112 | 112 | |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return bool |
126 | 126 | */ |
127 | -function give_is_custom_price_mode( $form_id = 0 ) { |
|
127 | +function give_is_custom_price_mode($form_id = 0) { |
|
128 | 128 | |
129 | - if ( empty( $form_id ) ) { |
|
129 | + if (empty($form_id)) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | |
133 | - $form = new Give_Donate_Form( $form_id ); |
|
133 | + $form = new Give_Donate_Form($form_id); |
|
134 | 134 | |
135 | 135 | return $form->is_custom_price_mode(); |
136 | 136 | } |
137 | 137 | \ 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 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
38 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function add_roles() { |
52 | - add_role( 'give_manager', esc_html__( 'Give Manager', 'give' ), array( |
|
52 | + add_role('give_manager', esc_html__('Give Manager', 'give'), array( |
|
53 | 53 | 'read' => true, |
54 | 54 | 'edit_posts' => true, |
55 | 55 | 'delete_posts' => true, |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | 'publish_posts' => true, |
79 | 79 | 'read_private_pages' => true, |
80 | 80 | 'read_private_posts' => true |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | - add_role( 'give_accountant', esc_html__( 'Give Accountant', 'give' ), array( |
|
83 | + add_role('give_accountant', esc_html__('Give Accountant', 'give'), array( |
|
84 | 84 | 'read' => true, |
85 | 85 | 'edit_posts' => false, |
86 | 86 | 'delete_posts' => false |
87 | - ) ); |
|
87 | + )); |
|
88 | 88 | |
89 | - add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array( |
|
89 | + add_role('give_worker', esc_html__('Give Worker', 'give'), array( |
|
90 | 90 | 'read' => true, |
91 | 91 | 'edit_posts' => false, |
92 | 92 | 'upload_files' => true, |
93 | 93 | 'delete_posts' => false |
94 | - ) ); |
|
94 | + )); |
|
95 | 95 | |
96 | 96 | } |
97 | 97 | |
@@ -110,38 +110,38 @@ discard block |
||
110 | 110 | public function add_caps() { |
111 | 111 | global $wp_roles; |
112 | 112 | |
113 | - if ( class_exists( 'WP_Roles' ) ) { |
|
114 | - if ( ! isset( $wp_roles ) ) { |
|
113 | + if (class_exists('WP_Roles')) { |
|
114 | + if ( ! isset($wp_roles)) { |
|
115 | 115 | $wp_roles = new WP_Roles(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - if ( is_object( $wp_roles ) ) { |
|
120 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
121 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
122 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
123 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
119 | + if (is_object($wp_roles)) { |
|
120 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
121 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
122 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
123 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
124 | 124 | |
125 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
126 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
127 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
128 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
125 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
126 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
127 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
128 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
129 | 129 | |
130 | 130 | // Add the main post type capabilities. |
131 | 131 | $capabilities = $this->get_core_caps(); |
132 | - foreach ( $capabilities as $cap_group ) { |
|
133 | - foreach ( $cap_group as $cap ) { |
|
134 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
135 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
136 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
132 | + foreach ($capabilities as $cap_group) { |
|
133 | + foreach ($cap_group as $cap) { |
|
134 | + $wp_roles->add_cap('administrator', $cap); |
|
135 | + $wp_roles->add_cap('give_manager', $cap); |
|
136 | + $wp_roles->add_cap('give_worker', $cap); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
141 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
142 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
143 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
144 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
140 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
141 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
142 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
143 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
144 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | } |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | public function get_core_caps() { |
160 | 160 | $capabilities = array(); |
161 | 161 | |
162 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
162 | + $capability_types = array('give_form', 'give_payment'); |
|
163 | 163 | |
164 | - foreach ( $capability_types as $capability_type ) { |
|
165 | - $capabilities[ $capability_type ] = array( |
|
164 | + foreach ($capability_types as $capability_type) { |
|
165 | + $capabilities[$capability_type] = array( |
|
166 | 166 | // Post type. |
167 | 167 | "edit_{$capability_type}", |
168 | 168 | "read_{$capability_type}", |
@@ -208,22 +208,22 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return array $caps Meta capabilities. |
210 | 210 | */ |
211 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
211 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
212 | 212 | |
213 | - switch ( $cap ) { |
|
213 | + switch ($cap) { |
|
214 | 214 | |
215 | 215 | case 'view_give_form_stats' : |
216 | 216 | |
217 | - if ( empty( $args[0] ) ) { |
|
217 | + if (empty($args[0])) { |
|
218 | 218 | break; |
219 | 219 | } |
220 | 220 | |
221 | - $form = get_post( $args[0] ); |
|
222 | - if ( empty( $form ) ) { |
|
221 | + $form = get_post($args[0]); |
|
222 | + if (empty($form)) { |
|
223 | 223 | break; |
224 | 224 | } |
225 | 225 | |
226 | - if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
226 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
227 | 227 | $caps = array(); |
228 | 228 | } |
229 | 229 | |
@@ -250,41 +250,41 @@ discard block |
||
250 | 250 | |
251 | 251 | global $wp_roles; |
252 | 252 | |
253 | - if ( class_exists( 'WP_Roles' ) ) { |
|
254 | - if ( ! isset( $wp_roles ) ) { |
|
253 | + if (class_exists('WP_Roles')) { |
|
254 | + if ( ! isset($wp_roles)) { |
|
255 | 255 | $wp_roles = new WP_Roles(); |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - if ( is_object( $wp_roles ) ) { |
|
259 | + if (is_object($wp_roles)) { |
|
260 | 260 | // Give Manager Capabilities. |
261 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
262 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
263 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
264 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
261 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
262 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
263 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
264 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
265 | 265 | |
266 | 266 | // Site Administrator Capabilities. |
267 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
268 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
269 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
270 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
267 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
268 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
269 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
270 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
271 | 271 | |
272 | 272 | // Remove the Main Post Type Capabilities. |
273 | 273 | $capabilities = $this->get_core_caps(); |
274 | 274 | |
275 | - foreach ( $capabilities as $cap_group ) { |
|
276 | - foreach ( $cap_group as $cap ) { |
|
277 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
278 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
279 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
275 | + foreach ($capabilities as $cap_group) { |
|
276 | + foreach ($cap_group as $cap) { |
|
277 | + $wp_roles->remove_cap('give_manager', $cap); |
|
278 | + $wp_roles->remove_cap('administrator', $cap); |
|
279 | + $wp_roles->remove_cap('give_worker', $cap); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
283 | 283 | /** Give Accountant Capabilities */ |
284 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
285 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
286 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
287 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
284 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
285 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
286 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
287 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
288 | 288 | |
289 | 289 | } |
290 | 290 | } |
@@ -1283,7 +1283,7 @@ |
||
1283 | 1283 | * |
1284 | 1284 | * @param $field |
1285 | 1285 | * |
1286 | - * @return string |
|
1286 | + * @return integer |
|
1287 | 1287 | */ |
1288 | 1288 | function _give_set_field_give_id_default_value( $field ) { |
1289 | 1289 | return 0; |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | type="radio" |
556 | 556 | style="' . esc_attr( $field['style'] ) . '" |
557 | 557 | ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
558 | - . give_get_custom_attributes( $field ) . ' |
|
558 | + . give_get_custom_attributes( $field ) . ' |
|
559 | 559 | /> ' . esc_html( $value ) . '</label> |
560 | 560 | </li>'; |
561 | 561 | } |
@@ -704,9 +704,9 @@ discard block |
||
704 | 704 | $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
705 | 705 | |
706 | 706 | echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
707 | - . '" target="_blank">' |
|
708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $field['title'] ) |
|
709 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
707 | + . '" target="_blank">' |
|
708 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $field['title'] ) |
|
709 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; // Exit if accessed directly |
13 | 13 | } |
14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool|string |
24 | 24 | */ |
25 | -function give_is_field_callback_exist( $field ) { |
|
26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
25 | +function give_is_field_callback_exist($field) { |
|
26 | + return (give_get_field_callback($field) ? true : false); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|string |
37 | 37 | */ |
38 | -function give_get_field_callback( $field ) { |
|
38 | +function give_get_field_callback($field) { |
|
39 | 39 | $func_name_prefix = 'give'; |
40 | 40 | $func_name = ''; |
41 | 41 | |
42 | 42 | // Set callback function on basis of cmb2 field name. |
43 | - switch ( $field['type'] ) { |
|
43 | + switch ($field['type']) { |
|
44 | 44 | case 'radio_inline': |
45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
46 | 46 | break; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | default: |
77 | 77 | |
78 | 78 | if ( |
79 | - array_key_exists( 'callback', $field ) |
|
80 | - && ! empty( $field['callback'] ) |
|
79 | + array_key_exists('callback', $field) |
|
80 | + && ! empty($field['callback']) |
|
81 | 81 | ) { |
82 | 82 | $func_name = $field['callback']; |
83 | 83 | } else { |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.8 |
92 | 92 | */ |
93 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
93 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
94 | 94 | |
95 | 95 | // Exit if not any function exist. |
96 | 96 | // Check if render callback exist or not. |
97 | - if ( empty( $func_name ) ) { |
|
97 | + if (empty($func_name)) { |
|
98 | 98 | return false; |
99 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
99 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
100 | 100 | return false; |
101 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
101 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | |
@@ -114,35 +114,35 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return bool |
116 | 116 | */ |
117 | -function give_render_field( $field ) { |
|
117 | +function give_render_field($field) { |
|
118 | 118 | |
119 | 119 | // Check if render callback exist or not. |
120 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
120 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
124 | 124 | // CMB2 compatibility: Push all classes to attributes's class key |
125 | - if ( empty( $field['class'] ) ) { |
|
125 | + if (empty($field['class'])) { |
|
126 | 126 | $field['class'] = ''; |
127 | 127 | } |
128 | 128 | |
129 | - if ( empty( $field['attributes']['class'] ) ) { |
|
129 | + if (empty($field['attributes']['class'])) { |
|
130 | 130 | $field['attributes']['class'] = ''; |
131 | 131 | } |
132 | 132 | |
133 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
134 | - unset( $field['class'] ); |
|
133 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
134 | + unset($field['class']); |
|
135 | 135 | |
136 | 136 | // CMB2 compatibility: Set wrapper class if any. |
137 | - if ( ! empty( $field['row_classes'] ) ) { |
|
137 | + if ( ! empty($field['row_classes'])) { |
|
138 | 138 | $field['wrapper_class'] = $field['row_classes']; |
139 | - unset( $field['row_classes'] ); |
|
139 | + unset($field['row_classes']); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Set field params on basis of cmb2 field name. |
143 | - switch ( $field['type'] ) { |
|
143 | + switch ($field['type']) { |
|
144 | 144 | case 'radio_inline': |
145 | - if ( empty( $field['wrapper_class'] ) ) { |
|
145 | + if (empty($field['wrapper_class'])) { |
|
146 | 146 | $field['wrapper_class'] = ''; |
147 | 147 | } |
148 | 148 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | case 'text-small' : |
156 | 156 | case 'text_small' : |
157 | 157 | // CMB2 compatibility: Set field type to text. |
158 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
158 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
159 | 159 | |
160 | 160 | // CMB2 compatibility: Set data type to price. |
161 | 161 | if ( |
162 | - empty( $field['data_type'] ) |
|
163 | - && ! empty( $field['attributes']['class'] ) |
|
162 | + empty($field['data_type']) |
|
163 | + && ! empty($field['attributes']['class']) |
|
164 | 164 | && ( |
165 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
166 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
165 | + false !== strpos($field['attributes']['class'], 'money') |
|
166 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
167 | 167 | ) |
168 | 168 | ) { |
169 | 169 | $field['data_type'] = 'decimal'; |
@@ -182,22 +182,22 @@ discard block |
||
182 | 182 | case 'give_default_radio_inline': |
183 | 183 | $field['type'] = 'radio'; |
184 | 184 | $field['options'] = array( |
185 | - 'default' => __( 'Default' ), |
|
185 | + 'default' => __('Default'), |
|
186 | 186 | ); |
187 | 187 | break; |
188 | 188 | } |
189 | 189 | |
190 | 190 | // CMB2 compatibility: Add support to define field description by desc & description param. |
191 | 191 | // We encourage you to use description param. |
192 | - $field['description'] = ( ! empty( $field['description'] ) |
|
192 | + $field['description'] = ( ! empty($field['description']) |
|
193 | 193 | ? $field['description'] |
194 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
194 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
195 | 195 | |
196 | 196 | // Call render function. |
197 | - if ( is_array( $func_name ) ) { |
|
198 | - $func_name[0]->{$func_name[1]}( $field ); |
|
197 | + if (is_array($func_name)) { |
|
198 | + $func_name[0]->{$func_name[1]}($field); |
|
199 | 199 | } else { |
200 | - $func_name( $field ); |
|
200 | + $func_name($field); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return true; |
@@ -227,29 +227,29 @@ discard block |
||
227 | 227 | * } |
228 | 228 | * @return void |
229 | 229 | */ |
230 | -function give_text_input( $field ) { |
|
230 | +function give_text_input($field) { |
|
231 | 231 | global $thepostid, $post; |
232 | 232 | |
233 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
234 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
235 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
236 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
237 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
233 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
234 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
235 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
236 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
237 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
238 | 238 | $field['before_field'] = ''; |
239 | 239 | $field['after_field'] = ''; |
240 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
240 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
241 | 241 | |
242 | - switch ( $data_type ) { |
|
242 | + switch ($data_type) { |
|
243 | 243 | case 'price' : |
244 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] ); |
|
244 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']); |
|
245 | 245 | |
246 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
247 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
246 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
247 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
248 | 248 | break; |
249 | 249 | |
250 | 250 | case 'decimal' : |
251 | 251 | $field['attributes']['class'] .= ' give_input_decimal'; |
252 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] ); |
|
252 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']); |
|
253 | 253 | break; |
254 | 254 | |
255 | 255 | default : |
@@ -257,20 +257,20 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | ?> |
260 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
261 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
260 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
261 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
262 | 262 | <?php echo $field['before_field']; ?> |
263 | 263 | <input |
264 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
265 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
266 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
267 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
268 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
269 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
264 | + type="<?php echo esc_attr($field['type']); ?>" |
|
265 | + style="<?php echo esc_attr($field['style']); ?>" |
|
266 | + name="<?php echo give_get_field_name($field); ?>" |
|
267 | + id="<?php echo esc_attr($field['id']); ?>" |
|
268 | + value="<?php echo esc_attr($field['value']); ?>" |
|
269 | + <?php echo give_get_custom_attributes($field); ?> |
|
270 | 270 | /> |
271 | 271 | <?php echo $field['after_field']; ?> |
272 | 272 | <?php |
273 | - echo give_get_field_description( $field ); |
|
273 | + echo give_get_field_description($field); |
|
274 | 274 | echo '</p>'; |
275 | 275 | } |
276 | 276 | |
@@ -292,29 +292,29 @@ discard block |
||
292 | 292 | * } |
293 | 293 | * @return void |
294 | 294 | */ |
295 | -function give_hidden_input( $field ) { |
|
295 | +function give_hidden_input($field) { |
|
296 | 296 | global $thepostid, $post; |
297 | 297 | |
298 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
299 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
298 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
299 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
300 | 300 | |
301 | 301 | // Custom attribute handling |
302 | 302 | $custom_attributes = array(); |
303 | 303 | |
304 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
304 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
305 | 305 | |
306 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
307 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
306 | + foreach ($field['attributes'] as $attribute => $value) { |
|
307 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | ?> |
311 | 311 | |
312 | 312 | <input |
313 | 313 | type="hidden" |
314 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
315 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
316 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
317 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
314 | + name="<?php echo give_get_field_name($field); ?>" |
|
315 | + id="<?php echo esc_attr($field['id']); ?>" |
|
316 | + value="<?php echo esc_attr($field['value']); ?>" |
|
317 | + <?php echo give_get_custom_attributes($field); ?> |
|
318 | 318 | /> |
319 | 319 | <?php |
320 | 320 | } |
@@ -340,27 +340,27 @@ discard block |
||
340 | 340 | * } |
341 | 341 | * @return void |
342 | 342 | */ |
343 | -function give_textarea_input( $field ) { |
|
343 | +function give_textarea_input($field) { |
|
344 | 344 | global $thepostid, $post; |
345 | 345 | |
346 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
347 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
348 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
349 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
346 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
347 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
348 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
349 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
350 | 350 | |
351 | 351 | ?> |
352 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
353 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
352 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
353 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
354 | 354 | <textarea |
355 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
356 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
357 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
355 | + style="<?php echo esc_attr($field['style']); ?>" |
|
356 | + name="<?php echo give_get_field_name($field); ?>" |
|
357 | + id="<?php echo esc_attr($field['id']); ?>" |
|
358 | 358 | rows="10" |
359 | 359 | cols="20" |
360 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
361 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
360 | + <?php echo give_get_custom_attributes($field); ?> |
|
361 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
362 | 362 | <?php |
363 | - echo give_get_field_description( $field ); |
|
363 | + echo give_get_field_description($field); |
|
364 | 364 | echo '</p>'; |
365 | 365 | } |
366 | 366 | |
@@ -384,29 +384,29 @@ discard block |
||
384 | 384 | * } |
385 | 385 | * @return void |
386 | 386 | */ |
387 | -function give_wysiwyg( $field ) { |
|
387 | +function give_wysiwyg($field) { |
|
388 | 388 | global $thepostid, $post; |
389 | 389 | |
390 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
391 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
392 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
393 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
390 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
391 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
392 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
393 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
394 | 394 | |
395 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
395 | + $field['unique_field_id'] = give_get_field_name($field); |
|
396 | 396 | $editor_attributes = array( |
397 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
397 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
398 | 398 | 'textarea_rows' => '10', |
399 | - 'editor_css' => esc_attr( $field['style'] ), |
|
399 | + 'editor_css' => esc_attr($field['style']), |
|
400 | 400 | 'editor_class' => $field['attributes']['class'], |
401 | 401 | ); |
402 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
402 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
403 | 403 | $field['value'], |
404 | 404 | $field['unique_field_id'], |
405 | 405 | $editor_attributes, |
406 | - ) ) ) . '"'; |
|
407 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
406 | + ))).'"'; |
|
407 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
408 | 408 | |
409 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
409 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
410 | 410 | |
411 | 411 | wp_editor( |
412 | 412 | $field['value'], |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $editor_attributes |
415 | 415 | ); |
416 | 416 | |
417 | - echo give_get_field_description( $field ); |
|
417 | + echo give_get_field_description($field); |
|
418 | 418 | echo '</div>'; |
419 | 419 | } |
420 | 420 | |
@@ -439,29 +439,29 @@ discard block |
||
439 | 439 | * } |
440 | 440 | * @return void |
441 | 441 | */ |
442 | -function give_checkbox( $field ) { |
|
442 | +function give_checkbox($field) { |
|
443 | 443 | global $thepostid, $post; |
444 | 444 | |
445 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
446 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
447 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
448 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
449 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
450 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
445 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
446 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
447 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
448 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
449 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
450 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
451 | 451 | ?> |
452 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
453 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
452 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
453 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
454 | 454 | <input |
455 | 455 | type="checkbox" |
456 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
457 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
458 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
459 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
460 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
461 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
456 | + style="<?php echo esc_attr($field['style']); ?>" |
|
457 | + name="<?php echo give_get_field_name($field); ?>" |
|
458 | + id="<?php echo esc_attr($field['id']); ?>" |
|
459 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
460 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
461 | + <?php echo give_get_custom_attributes($field); ?> |
|
462 | 462 | /> |
463 | 463 | <?php |
464 | - echo give_get_field_description( $field ); |
|
464 | + echo give_get_field_description($field); |
|
465 | 465 | echo '</p>'; |
466 | 466 | } |
467 | 467 | |
@@ -487,29 +487,29 @@ discard block |
||
487 | 487 | * } |
488 | 488 | * @return void |
489 | 489 | */ |
490 | -function give_select( $field ) { |
|
490 | +function give_select($field) { |
|
491 | 491 | global $thepostid, $post; |
492 | 492 | |
493 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
494 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
495 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
496 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
497 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
493 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
494 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
495 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
496 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
497 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
498 | 498 | ?> |
499 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
500 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
499 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
500 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
501 | 501 | <select |
502 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
503 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
504 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
505 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
502 | + id="<?php echo esc_attr($field['id']); ?>" |
|
503 | + name="<?php echo give_get_field_name($field); ?>" |
|
504 | + style="<?php echo esc_attr($field['style']) ?>" |
|
505 | + <?php echo give_get_custom_attributes($field); ?> |
|
506 | 506 | > |
507 | 507 | <?php |
508 | - foreach ( $field['options'] as $key => $value ) { |
|
509 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
508 | + foreach ($field['options'] as $key => $value) { |
|
509 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
510 | 510 | } |
511 | 511 | echo '</select>'; |
512 | - echo give_get_field_description( $field ); |
|
512 | + echo give_get_field_description($field); |
|
513 | 513 | echo '</p>'; |
514 | 514 | } |
515 | 515 | |
@@ -536,32 +536,32 @@ discard block |
||
536 | 536 | * } |
537 | 537 | * @return void |
538 | 538 | */ |
539 | -function give_radio( $field ) { |
|
539 | +function give_radio($field) { |
|
540 | 540 | global $thepostid, $post; |
541 | 541 | |
542 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
543 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
544 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
545 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
546 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
542 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
543 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
544 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
545 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
546 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
547 | 547 | |
548 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
548 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
549 | 549 | |
550 | - foreach ( $field['options'] as $key => $value ) { |
|
550 | + foreach ($field['options'] as $key => $value) { |
|
551 | 551 | |
552 | 552 | echo '<li><label><input |
553 | - name="' . give_get_field_name( $field ) . '" |
|
554 | - value="' . esc_attr( $key ) . '" |
|
553 | + name="' . give_get_field_name($field).'" |
|
554 | + value="' . esc_attr($key).'" |
|
555 | 555 | type="radio" |
556 | - style="' . esc_attr( $field['style'] ) . '" |
|
557 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
558 | - . give_get_custom_attributes( $field ) . ' |
|
559 | - /> ' . esc_html( $value ) . '</label> |
|
556 | + style="' . esc_attr($field['style']).'" |
|
557 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
558 | + . give_get_custom_attributes($field).' |
|
559 | + /> ' . esc_html($value).'</label> |
|
560 | 560 | </li>'; |
561 | 561 | } |
562 | 562 | echo '</ul>'; |
563 | 563 | |
564 | - echo give_get_field_description( $field ); |
|
564 | + echo give_get_field_description($field); |
|
565 | 565 | echo '</fieldset>'; |
566 | 566 | } |
567 | 567 | |
@@ -585,27 +585,27 @@ discard block |
||
585 | 585 | * } |
586 | 586 | * @return void |
587 | 587 | */ |
588 | -function give_colorpicker( $field ) { |
|
588 | +function give_colorpicker($field) { |
|
589 | 589 | global $thepostid, $post; |
590 | 590 | |
591 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
592 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
593 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
594 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
595 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
591 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
592 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
593 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
594 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
595 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
596 | 596 | $field['type'] = 'text'; |
597 | 597 | ?> |
598 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
599 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
598 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
599 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
600 | 600 | <input |
601 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
602 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
603 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
604 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
605 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
601 | + type="<?php echo esc_attr($field['type']); ?>" |
|
602 | + style="<?php echo esc_attr($field['style']); ?>" |
|
603 | + name="<?php echo give_get_field_name($field); ?>" |
|
604 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
605 | + <?php echo give_get_custom_attributes($field); ?> |
|
606 | 606 | /> |
607 | 607 | <?php |
608 | - echo give_get_field_description( $field ); |
|
608 | + echo give_get_field_description($field); |
|
609 | 609 | echo '</p>'; |
610 | 610 | } |
611 | 611 | |
@@ -617,33 +617,33 @@ discard block |
||
617 | 617 | * |
618 | 618 | * @param array $field |
619 | 619 | */ |
620 | -function give_media( $field ) { |
|
620 | +function give_media($field) { |
|
621 | 621 | global $thepostid, $post; |
622 | 622 | |
623 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
624 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
625 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
626 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
627 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
623 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
624 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
625 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
626 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
627 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
628 | 628 | $field['type'] = 'text'; |
629 | 629 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
630 | 630 | |
631 | 631 | // Allow developer to save attachment ID or attachment url as metadata. |
632 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
632 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
633 | 633 | ?> |
634 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
635 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
634 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
635 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
636 | 636 | <input |
637 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
638 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
637 | + name="<?php echo give_get_field_name($field); ?>" |
|
638 | + id="<?php echo esc_attr($field['id']); ?>" |
|
639 | 639 | type="text" |
640 | 640 | value="<?php echo $field['value']; ?>" |
641 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
641 | + style="<?php echo esc_attr($field['style']); ?>" |
|
642 | 642 | data-fvalue="<?php echo $field['fvalue']; ?>" |
643 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
643 | + <?php echo give_get_custom_attributes($field); ?> |
|
644 | 644 | /> <input class="give-media-upload button" type="button" |
645 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
646 | - <?php echo give_get_field_description( $field ); ?> |
|
645 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
646 | + <?php echo give_get_field_description($field); ?> |
|
647 | 647 | </p> |
648 | 648 | <?php |
649 | 649 | } |
@@ -657,27 +657,27 @@ discard block |
||
657 | 657 | * |
658 | 658 | * @return void |
659 | 659 | */ |
660 | -function give_default_gateway( $field ) { |
|
660 | +function give_default_gateway($field) { |
|
661 | 661 | global $thepostid, $post; |
662 | 662 | |
663 | 663 | // get all active payment gateways. |
664 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
664 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
665 | 665 | $field['options'] = array(); |
666 | 666 | |
667 | 667 | // Set field option value. |
668 | - if ( ! empty( $gateways ) ) { |
|
669 | - foreach ( $gateways as $key => $option ) { |
|
670 | - $field['options'][ $key ] = $option['admin_label']; |
|
668 | + if ( ! empty($gateways)) { |
|
669 | + foreach ($gateways as $key => $option) { |
|
670 | + $field['options'][$key] = $option['admin_label']; |
|
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
674 | 674 | // Add a field to the Give Form admin single post view of this field |
675 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
676 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
675 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
676 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | // Render select field. |
680 | - give_select( $field ); |
|
680 | + give_select($field); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | /** |
@@ -699,13 +699,13 @@ discard block |
||
699 | 699 | * @return void |
700 | 700 | */ |
701 | 701 | |
702 | -function give_docs_link( $field ) { |
|
703 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
704 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
702 | +function give_docs_link($field) { |
|
703 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
704 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
705 | 705 | |
706 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
706 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
707 | 707 | . '" target="_blank">' |
708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $field['title'] ) |
|
708 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $field['title']) |
|
709 | 709 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
710 | 710 | } |
711 | 711 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * |
722 | 722 | * @return mixed |
723 | 723 | */ |
724 | -function give_get_field_value( $field, $postid ) { |
|
725 | - if ( isset( $field['attributes']['value'] ) ) { |
|
724 | +function give_get_field_value($field, $postid) { |
|
725 | + if (isset($field['attributes']['value'])) { |
|
726 | 726 | return $field['attributes']['value']; |
727 | 727 | } |
728 | 728 | |
729 | 729 | // Get value from db. |
730 | - $field_value = get_post_meta( $postid, $field['id'], true ); |
|
730 | + $field_value = get_post_meta($postid, $field['id'], true); |
|
731 | 731 | |
732 | 732 | /** |
733 | 733 | * Filter the field value before apply default value. |
@@ -736,10 +736,10 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @param mixed $field_value Field value. |
738 | 738 | */ |
739 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
739 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
740 | 740 | |
741 | 741 | // Set default value if no any data saved to db. |
742 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
742 | + if ( ! $field_value && isset($field['default'])) { |
|
743 | 743 | $field_value = $field['default']; |
744 | 744 | } |
745 | 745 | |
@@ -756,10 +756,10 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @return string |
758 | 758 | */ |
759 | -function give_get_field_description( $field ) { |
|
759 | +function give_get_field_description($field) { |
|
760 | 760 | $field_desc_html = ''; |
761 | - if ( ! empty( $field['description'] ) ) { |
|
762 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
761 | + if ( ! empty($field['description'])) { |
|
762 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | return $field_desc_html; |
@@ -775,18 +775,18 @@ discard block |
||
775 | 775 | * |
776 | 776 | * @return string |
777 | 777 | */ |
778 | -function give_get_custom_attributes( $field ) { |
|
778 | +function give_get_custom_attributes($field) { |
|
779 | 779 | // Custom attribute handling |
780 | 780 | $custom_attributes = array(); |
781 | 781 | |
782 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
782 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
783 | 783 | |
784 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
785 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
784 | + foreach ($field['attributes'] as $attribute => $value) { |
|
785 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
786 | 786 | } |
787 | 787 | } |
788 | 788 | |
789 | - return implode( ' ', $custom_attributes ); |
|
789 | + return implode(' ', $custom_attributes); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | /** |
@@ -802,8 +802,8 @@ discard block |
||
802 | 802 | * |
803 | 803 | * @return string |
804 | 804 | */ |
805 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
806 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
805 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
806 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
807 | 807 | |
808 | 808 | /** |
809 | 809 | * Filter the specific repeater field value |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | * |
813 | 813 | * @param string $field_id |
814 | 814 | */ |
815 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
815 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
816 | 816 | |
817 | 817 | /** |
818 | 818 | * Filter the repeater field value |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | * |
822 | 822 | * @param string $field_id |
823 | 823 | */ |
824 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
824 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
825 | 825 | |
826 | 826 | return $field_value; |
827 | 827 | } |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | * |
840 | 840 | * @return string |
841 | 841 | */ |
842 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
842 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
843 | 843 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
844 | 844 | |
845 | 845 | // Get field id. |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * |
853 | 853 | * @param string $field_id |
854 | 854 | */ |
855 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
855 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
856 | 856 | |
857 | 857 | /** |
858 | 858 | * Filter the repeater field id |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @param string $field_id |
863 | 863 | */ |
864 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
864 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
865 | 865 | |
866 | 866 | return $field_id; |
867 | 867 | } |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @return string |
878 | 878 | */ |
879 | -function give_get_field_name( $field ) { |
|
880 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
879 | +function give_get_field_name($field) { |
|
880 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
881 | 881 | |
882 | 882 | /** |
883 | 883 | * Filter the field name. |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * |
887 | 887 | * @param string $field_name |
888 | 888 | */ |
889 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
889 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
890 | 890 | |
891 | 891 | return $field_name; |
892 | 892 | } |
@@ -903,39 +903,39 @@ discard block |
||
903 | 903 | * |
904 | 904 | * @return void |
905 | 905 | */ |
906 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
906 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
907 | 907 | global $thepostid, $post; |
908 | 908 | |
909 | 909 | // Bailout. |
910 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
910 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
911 | 911 | return; |
912 | 912 | } |
913 | 913 | |
914 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
915 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
914 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
915 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
916 | 916 | ?> |
917 | 917 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" |
918 | 918 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
919 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
919 | + <?php if ( ! empty($fields['name'])) : ?> |
|
920 | 920 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
921 | 921 | <?php endif; ?> |
922 | 922 | |
923 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
923 | + <?php if ( ! empty($fields['description'])) : ?> |
|
924 | 924 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
925 | 925 | <?php endif; ?> |
926 | 926 | |
927 | 927 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
928 | 928 | <?php |
929 | - $repeater_field_values = get_post_meta( $thepostid, $fields['id'], true ); |
|
930 | - $header_title = isset( $fields['options']['header_title'] ) |
|
929 | + $repeater_field_values = get_post_meta($thepostid, $fields['id'], true); |
|
930 | + $header_title = isset($fields['options']['header_title']) |
|
931 | 931 | ? $fields['options']['header_title'] |
932 | - : esc_attr__( 'Group', 'give' ); |
|
932 | + : esc_attr__('Group', 'give'); |
|
933 | 933 | |
934 | 934 | $add_default_donation_field = false; |
935 | 935 | |
936 | 936 | // Check if level is not created or we have to add default level. |
937 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
938 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
937 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
938 | + $repeater_field_values = array_values($repeater_field_values); |
|
939 | 939 | } else { |
940 | 940 | $fields_count = 1; |
941 | 941 | $add_default_donation_field = true; |
@@ -948,59 +948,59 @@ discard block |
||
948 | 948 | <div class="give-row-head give-move"> |
949 | 949 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
950 | 950 | </button> |
951 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
951 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
952 | 952 | <h2> |
953 | 953 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
954 | 954 | </h2> |
955 | 955 | </div> |
956 | 956 | <div class="give-row-body"> |
957 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
958 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
957 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
958 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
959 | 959 | continue; |
960 | 960 | } ?> |
961 | 961 | <?php |
962 | 962 | $field['repeat'] = true; |
963 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
964 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
963 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
964 | + $field['id'] = str_replace(array('[', ']'), array( |
|
965 | 965 | '_', |
966 | 966 | '', |
967 | - ), $field['repeatable_field_id'] ); |
|
967 | + ), $field['repeatable_field_id']); |
|
968 | 968 | ?> |
969 | - <?php give_render_field( $field ); ?> |
|
969 | + <?php give_render_field($field); ?> |
|
970 | 970 | <?php endforeach; ?> |
971 | 971 | </div> |
972 | 972 | </td> |
973 | 973 | </tr> |
974 | 974 | |
975 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
975 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
976 | 976 | <!--Stored repeater field group--> |
977 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
977 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
978 | 978 | <tr class="give-row"> |
979 | 979 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
980 | 980 | <div class="give-row-head give-move"> |
981 | 981 | <button type="button" class="handlediv button-link"> |
982 | 982 | <span class="toggle-indicator"></span></button> |
983 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
983 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
984 | 984 | </sapn> |
985 | 985 | <h2> |
986 | 986 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
987 | 987 | </h2> |
988 | 988 | </div> |
989 | 989 | <div class="give-row-body"> |
990 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
991 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
990 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
991 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
992 | 992 | continue; |
993 | 993 | } ?> |
994 | 994 | <?php |
995 | 995 | $field['repeat'] = true; |
996 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
997 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
998 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
996 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
997 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
998 | + $field['id'] = str_replace(array('[', ']'), array( |
|
999 | 999 | '_', |
1000 | 1000 | '', |
1001 | - ), $field['repeatable_field_id'] ); |
|
1001 | + ), $field['repeatable_field_id']); |
|
1002 | 1002 | ?> |
1003 | - <?php give_render_field( $field ); ?> |
|
1003 | + <?php give_render_field($field); ?> |
|
1004 | 1004 | <?php endforeach; ?> |
1005 | 1005 | </div> |
1006 | 1006 | </td> |
@@ -1008,14 +1008,14 @@ discard block |
||
1008 | 1008 | <?php endforeach; |
1009 | 1009 | ; ?> |
1010 | 1010 | |
1011 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
1011 | + <?php elseif ($add_default_donation_field) : ?> |
|
1012 | 1012 | <!--Default repeater field group--> |
1013 | 1013 | <tr class="give-row"> |
1014 | 1014 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1015 | 1015 | <div class="give-row-head give-move"> |
1016 | 1016 | <button type="button" class="handlediv button-link"> |
1017 | 1017 | <span class="toggle-indicator"></span></button> |
1018 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1018 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1019 | 1019 | </sapn> |
1020 | 1020 | <h2> |
1021 | 1021 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1023,19 +1023,19 @@ discard block |
||
1023 | 1023 | </div> |
1024 | 1024 | <div class="give-row-body"> |
1025 | 1025 | <?php |
1026 | - foreach ( $fields['fields'] as $field ) : |
|
1027 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1026 | + foreach ($fields['fields'] as $field) : |
|
1027 | + if ( ! give_is_field_callback_exist($field)) { |
|
1028 | 1028 | continue; |
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | $field['repeat'] = true; |
1032 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
1033 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
1034 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
1032 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
1033 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
1034 | + $field['id'] = str_replace(array('[', ']'), array( |
|
1035 | 1035 | '_', |
1036 | 1036 | '', |
1037 | - ), $field['repeatable_field_id'] ); |
|
1038 | - give_render_field( $field ); |
|
1037 | + ), $field['repeatable_field_id']); |
|
1038 | + give_render_field($field); |
|
1039 | 1039 | endforeach; |
1040 | 1040 | ?> |
1041 | 1041 | </div> |
@@ -1046,9 +1046,9 @@ discard block |
||
1046 | 1046 | <tfoot> |
1047 | 1047 | <tr> |
1048 | 1048 | <?php |
1049 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
1049 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
1050 | 1050 | ? $add_row_btn_title = $fields['options']['add_button'] |
1051 | - : esc_html__( 'Add Row', 'give' ); |
|
1051 | + : esc_html__('Add Row', 'give'); |
|
1052 | 1052 | ?> |
1053 | 1053 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
1054 | 1054 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1078,10 +1078,10 @@ discard block |
||
1078 | 1078 | * |
1079 | 1079 | * @param string |
1080 | 1080 | */ |
1081 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
1081 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
1082 | 1082 | |
1083 | 1083 | // Get current tab. |
1084 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
1084 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
1085 | 1085 | |
1086 | 1086 | // Output. |
1087 | 1087 | return $current_tab; |
@@ -1105,10 +1105,10 @@ discard block |
||
1105 | 1105 | * |
1106 | 1106 | * @param string |
1107 | 1107 | */ |
1108 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
1108 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
1109 | 1109 | |
1110 | 1110 | // Get current section. |
1111 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
1111 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
1112 | 1112 | |
1113 | 1113 | // Output. |
1114 | 1114 | return $current_section; |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | */ |
1123 | 1123 | function give_get_current_setting_page() { |
1124 | 1124 | // Get current page. |
1125 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
1125 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
1126 | 1126 | |
1127 | 1127 | // Output. |
1128 | 1128 | return $setting_page; |
@@ -1142,13 +1142,13 @@ discard block |
||
1142 | 1142 | * |
1143 | 1143 | * @return string |
1144 | 1144 | */ |
1145 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1146 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
1145 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1146 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
1147 | 1147 | |
1148 | 1148 | if ( |
1149 | - ! get_post_meta( $postid, '_give_display_content', true ) |
|
1149 | + ! get_post_meta($postid, '_give_display_content', true) |
|
1150 | 1150 | && $show_content |
1151 | - && ( 'none' !== $show_content ) |
|
1151 | + && ('none' !== $show_content) |
|
1152 | 1152 | ) { |
1153 | 1153 | $field_value = 'enabled'; |
1154 | 1154 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | return $field_value; |
1157 | 1157 | } |
1158 | 1158 | |
1159 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1159 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1160 | 1160 | |
1161 | 1161 | |
1162 | 1162 | /** |
@@ -1173,12 +1173,12 @@ discard block |
||
1173 | 1173 | * |
1174 | 1174 | * @return string |
1175 | 1175 | */ |
1176 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1177 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
1176 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1177 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
1178 | 1178 | |
1179 | 1179 | if ( |
1180 | - ! get_post_meta( $postid, '_give_content_placement', true ) |
|
1181 | - && ( 'none' !== $show_content ) |
|
1180 | + ! get_post_meta($postid, '_give_content_placement', true) |
|
1181 | + && ('none' !== $show_content) |
|
1182 | 1182 | ) { |
1183 | 1183 | $field_value = $show_content; |
1184 | 1184 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | return $field_value; |
1187 | 1187 | } |
1188 | 1188 | |
1189 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1189 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1190 | 1190 | |
1191 | 1191 | |
1192 | 1192 | /** |
@@ -1202,17 +1202,17 @@ discard block |
||
1202 | 1202 | * |
1203 | 1203 | * @return string |
1204 | 1204 | */ |
1205 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1206 | - $term_option = get_post_meta( $postid, '_give_terms_option', true ); |
|
1205 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1206 | + $term_option = get_post_meta($postid, '_give_terms_option', true); |
|
1207 | 1207 | |
1208 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1209 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1208 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1209 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1210 | 1210 | } |
1211 | 1211 | |
1212 | 1212 | return $field_value; |
1213 | 1213 | } |
1214 | 1214 | |
1215 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1215 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1216 | 1216 | |
1217 | 1217 | |
1218 | 1218 | /** |
@@ -1229,17 +1229,17 @@ discard block |
||
1229 | 1229 | * |
1230 | 1230 | * @return string |
1231 | 1231 | */ |
1232 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1233 | - $offline_donation = get_post_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1232 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1233 | + $offline_donation = get_post_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1234 | 1234 | |
1235 | - if ( 'on' === $offline_donation ) { |
|
1235 | + if ('on' === $offline_donation) { |
|
1236 | 1236 | $field_value = 'enabled'; |
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | return $field_value; |
1240 | 1240 | } |
1241 | 1241 | |
1242 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1242 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1243 | 1243 | |
1244 | 1244 | |
1245 | 1245 | /** |
@@ -1255,17 +1255,17 @@ discard block |
||
1255 | 1255 | * |
1256 | 1256 | * @return string |
1257 | 1257 | */ |
1258 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1259 | - $custom_amount = get_post_meta( $postid, '_give_custom_amount', true ); |
|
1258 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1259 | + $custom_amount = get_post_meta($postid, '_give_custom_amount', true); |
|
1260 | 1260 | |
1261 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1262 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1261 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1262 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | return $field_value; |
1266 | 1266 | } |
1267 | 1267 | |
1268 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1268 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1269 | 1269 | |
1270 | 1270 | |
1271 | 1271 | /** |
@@ -1281,17 +1281,17 @@ discard block |
||
1281 | 1281 | * |
1282 | 1282 | * @return string |
1283 | 1283 | */ |
1284 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1285 | - $goal_option = get_post_meta( $postid, '_give_goal_option', true ); |
|
1284 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1285 | + $goal_option = get_post_meta($postid, '_give_goal_option', true); |
|
1286 | 1286 | |
1287 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1288 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1287 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1288 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | return $field_value; |
1292 | 1292 | } |
1293 | 1293 | |
1294 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1294 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1295 | 1295 | |
1296 | 1296 | /** |
1297 | 1297 | * Set value for Donation Goal --> close Form. |
@@ -1307,17 +1307,17 @@ discard block |
||
1307 | 1307 | * |
1308 | 1308 | * @return string |
1309 | 1309 | */ |
1310 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1311 | - $close_form = get_post_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1310 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1311 | + $close_form = get_post_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1312 | 1312 | |
1313 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1314 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1313 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1314 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | return $field_value; |
1318 | 1318 | } |
1319 | 1319 | |
1320 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1320 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1321 | 1321 | |
1322 | 1322 | |
1323 | 1323 | /** |
@@ -1333,17 +1333,17 @@ discard block |
||
1333 | 1333 | * |
1334 | 1334 | * @return string |
1335 | 1335 | */ |
1336 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1337 | - $guest_donation = get_post_meta( $postid, '_give_logged_in_only', true ); |
|
1336 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1337 | + $guest_donation = get_post_meta($postid, '_give_logged_in_only', true); |
|
1338 | 1338 | |
1339 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1340 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1339 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1340 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1341 | 1341 | } |
1342 | 1342 | |
1343 | 1343 | return $field_value; |
1344 | 1344 | } |
1345 | 1345 | |
1346 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1346 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1347 | 1347 | |
1348 | 1348 | /** |
1349 | 1349 | * Set value for Offline Donations --> Offline Donations. |
@@ -1359,17 +1359,17 @@ discard block |
||
1359 | 1359 | * |
1360 | 1360 | * @return string |
1361 | 1361 | */ |
1362 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1363 | - $customize_offline_text = get_post_meta( $postid, '_give_customize_offline_donations', true ); |
|
1362 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1363 | + $customize_offline_text = get_post_meta($postid, '_give_customize_offline_donations', true); |
|
1364 | 1364 | |
1365 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1366 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1365 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1366 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1367 | 1367 | } |
1368 | 1368 | |
1369 | 1369 | return $field_value; |
1370 | 1370 | } |
1371 | 1371 | |
1372 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1372 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1373 | 1373 | |
1374 | 1374 | |
1375 | 1375 | /** |
@@ -1384,14 +1384,14 @@ discard block |
||
1384 | 1384 | * |
1385 | 1385 | * @return mixed |
1386 | 1386 | */ |
1387 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1387 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1388 | 1388 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1389 | 1389 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1390 | 1390 | |
1391 | 1391 | return $field_id; |
1392 | 1392 | } |
1393 | 1393 | |
1394 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1394 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1395 | 1395 | |
1396 | 1396 | /** |
1397 | 1397 | * Set repeater field value for multi donation form. |
@@ -1405,13 +1405,13 @@ discard block |
||
1405 | 1405 | * |
1406 | 1406 | * @return mixed |
1407 | 1407 | */ |
1408 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1409 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1408 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1409 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1410 | 1410 | |
1411 | 1411 | return $field_value; |
1412 | 1412 | } |
1413 | 1413 | |
1414 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1414 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1415 | 1415 | |
1416 | 1416 | /** |
1417 | 1417 | * Set default value for _give_id field. |
@@ -1422,11 +1422,11 @@ discard block |
||
1422 | 1422 | * |
1423 | 1423 | * @return string |
1424 | 1424 | */ |
1425 | -function _give_set_field_give_id_default_value( $field ) { |
|
1425 | +function _give_set_field_give_id_default_value($field) { |
|
1426 | 1426 | return 0; |
1427 | 1427 | } |
1428 | 1428 | |
1429 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1429 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1430 | 1430 | |
1431 | 1431 | /** |
1432 | 1432 | * Set default value for _give_default field. |
@@ -1437,11 +1437,11 @@ discard block |
||
1437 | 1437 | * |
1438 | 1438 | * @return string |
1439 | 1439 | */ |
1440 | -function _give_set_field_give_default_default_value( $field ) { |
|
1440 | +function _give_set_field_give_default_default_value($field) { |
|
1441 | 1441 | return 'default'; |
1442 | 1442 | } |
1443 | 1443 | |
1444 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1444 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1445 | 1445 | |
1446 | 1446 | /** |
1447 | 1447 | * Set repeater field editor id for field type wysiwyg. |
@@ -1453,12 +1453,12 @@ discard block |
||
1453 | 1453 | * |
1454 | 1454 | * @return string |
1455 | 1455 | */ |
1456 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1457 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1458 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1456 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1457 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1458 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | return $field_name; |
1462 | 1462 | } |
1463 | 1463 | |
1464 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1464 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
@@ -113,7 +113,7 @@ |
||
113 | 113 | /** |
114 | 114 | * Adds the "Donation Form" button above the TinyMCE Editor on add/edit screens. |
115 | 115 | * |
116 | - * @return string|bool |
|
116 | + * @return false|null |
|
117 | 117 | * |
118 | 118 | * @since 1.0 |
119 | 119 | */ |
@@ -138,8 +138,8 @@ |
||
138 | 138 | |
139 | 139 | // Only run in admin post/page creation and edit screens |
140 | 140 | if ( in_array( $screen->parent_file, $shortcode_button_pages ) |
141 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | - && ! empty( self::$shortcodes ) |
|
141 | + && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | + && ! empty( self::$shortcodes ) |
|
143 | 143 | ) { |
144 | 144 | |
145 | 145 | $shortcodes = array(); |
@@ -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 | |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | 35 | |
36 | - if ( is_admin() ) { |
|
37 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
36 | + if (is_admin()) { |
|
37 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
38 | 38 | |
39 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
40 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
41 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
39 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
40 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
41 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
42 | 42 | } |
43 | 43 | |
44 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
45 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
44 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
45 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @since 1.0 |
56 | 56 | */ |
57 | - public function mce_external_plugins( $plugin_array ) { |
|
57 | + public function mce_external_plugins($plugin_array) { |
|
58 | 58 | |
59 | - if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) { |
|
59 | + if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) { |
|
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | |
63 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
63 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
64 | 64 | |
65 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; |
|
65 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; |
|
66 | 66 | |
67 | 67 | return $plugin_array; |
68 | 68 | } |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function admin_enqueue_assets() { |
78 | 78 | |
79 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
79 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
80 | 80 | |
81 | 81 | wp_enqueue_script( |
82 | 82 | 'give_shortcode', |
83 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', |
|
84 | - array( 'jquery' ), |
|
83 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', |
|
84 | + array('jquery'), |
|
85 | 85 | GIVE_VERSION, |
86 | 86 | true |
87 | 87 | ); |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function admin_localize_scripts() { |
98 | 98 | |
99 | - if ( ! empty( self::$shortcodes ) ) { |
|
99 | + if ( ! empty(self::$shortcodes)) { |
|
100 | 100 | |
101 | 101 | $variables = array(); |
102 | 102 | |
103 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
104 | - if ( ! empty( $values['required'] ) ) { |
|
105 | - $variables[ $shortcode ] = $values['required']; |
|
103 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
104 | + if ( ! empty($values['required'])) { |
|
105 | + $variables[$shortcode] = $values['required']; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
109 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -123,37 +123,37 @@ discard block |
||
123 | 123 | |
124 | 124 | // If we load wp editor by ajax then $screen will be empty which generate notice if we treat $screen as WP_Screen object. |
125 | 125 | // For example we are loading wp editor by ajax in repeater field. |
126 | - if ( ! ( $screen instanceof WP_Screen ) ) { |
|
126 | + if ( ! ($screen instanceof WP_Screen)) { |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
130 | - $shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array( |
|
130 | + $shortcode_button_pages = apply_filters('give_shortcode_button_pages', array( |
|
131 | 131 | 'post.php', |
132 | 132 | 'page.php', |
133 | 133 | 'post-new.php', |
134 | 134 | 'post-edit.php', |
135 | 135 | 'edit.php', |
136 | 136 | 'edit.php?post_type=page', |
137 | - ) ); |
|
137 | + )); |
|
138 | 138 | |
139 | 139 | // Only run in admin post/page creation and edit screens |
140 | - if ( in_array( $screen->parent_file, $shortcode_button_pages ) |
|
141 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | - && ! empty( self::$shortcodes ) |
|
140 | + if (in_array($screen->parent_file, $shortcode_button_pages) |
|
141 | + && apply_filters('give_shortcode_button_condition', true) |
|
142 | + && ! empty(self::$shortcodes) |
|
143 | 143 | ) { |
144 | 144 | |
145 | 145 | $shortcodes = array(); |
146 | 146 | |
147 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
147 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * Filters the condition for including the current shortcode |
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
154 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
155 | 155 | |
156 | - $shortcodes[ $shortcode ] = sprintf( |
|
156 | + $shortcodes[$shortcode] = sprintf( |
|
157 | 157 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>', |
158 | 158 | $shortcode, |
159 | 159 | $shortcode, |
@@ -162,37 +162,37 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if ( ! empty( $shortcodes ) ) { |
|
165 | + if ( ! empty($shortcodes)) { |
|
166 | 166 | |
167 | 167 | // check current WP version |
168 | - $img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) ) |
|
169 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' |
|
170 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
168 | + $img = (version_compare(get_bloginfo('version'), '3.5', '<')) |
|
169 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' |
|
170 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
171 | 171 | |
172 | - reset( $shortcodes ); |
|
172 | + reset($shortcodes); |
|
173 | 173 | |
174 | - if ( count( $shortcodes ) == 1 ) { |
|
174 | + if (count($shortcodes) == 1) { |
|
175 | 175 | |
176 | - $shortcode = key( $shortcodes ); |
|
176 | + $shortcode = key($shortcodes); |
|
177 | 177 | |
178 | 178 | printf( |
179 | 179 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', |
180 | 180 | $shortcode, |
181 | - sprintf( '%s %s %s', |
|
181 | + sprintf('%s %s %s', |
|
182 | 182 | $img, |
183 | - esc_html__( 'Insert', 'give' ), |
|
184 | - self::$shortcodes[ $shortcode ]['label'] |
|
183 | + esc_html__('Insert', 'give'), |
|
184 | + self::$shortcodes[$shortcode]['label'] |
|
185 | 185 | ) |
186 | 186 | ); |
187 | 187 | } else { |
188 | 188 | printf( |
189 | - '<div class="sc-wrap">' . |
|
190 | - '<button class="button sc-button">%s %s</button>' . |
|
191 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
189 | + '<div class="sc-wrap">'. |
|
190 | + '<button class="button sc-button">%s %s</button>'. |
|
191 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
192 | 192 | '</div>', |
193 | 193 | $img, |
194 | - esc_html__( 'Give Shortcodes', 'give' ), |
|
195 | - implode( '', array_values( $shortcodes ) ) |
|
194 | + esc_html__('Give Shortcodes', 'give'), |
|
195 | + implode('', array_values($shortcodes)) |
|
196 | 196 | ); |
197 | 197 | } |
198 | 198 | } |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function shortcode_ajax() { |
210 | 210 | |
211 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
211 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
212 | 212 | $response = false; |
213 | 213 | |
214 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
214 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
215 | 215 | |
216 | - $data = self::$shortcodes[ $shortcode ]; |
|
216 | + $data = self::$shortcodes[$shortcode]; |
|
217 | 217 | |
218 | - if ( ! empty( $data['errors'] ) ) { |
|
219 | - $data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) ); |
|
218 | + if ( ! empty($data['errors'])) { |
|
219 | + $data['btn_okay'] = array(esc_html__('Okay', 'give')); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $response = array( |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | ); |
229 | 229 | } else { |
230 | 230 | // todo: handle error |
231 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
231 | + error_log(print_r('AJAX error!', 1)); |
|
232 | 232 | } |
233 | 233 | |
234 | - wp_send_json( $response ); |
|
234 | + wp_send_json($response); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 |
@@ -464,7 +464,7 @@ |
||
464 | 464 | * |
465 | 465 | * @param WP_Post $payment |
466 | 466 | * |
467 | - * @return mixed |
|
467 | + * @return false|null |
|
468 | 468 | */ |
469 | 469 | function give_offline_payment_receipt_after( $payment ) { |
470 | 470 | // Get payment object. |
@@ -249,10 +249,10 @@ |
||
249 | 249 | $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | - '<a href="%1$s">%2$s</a>', |
|
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
252 | + '<a href="%1$s">%2$s</a>', |
|
253 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
254 | + __( 'View Donation Details »', 'give' ) |
|
255 | + ) . "\n\n"; |
|
256 | 256 | |
257 | 257 | $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
258 | 258 | $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | // Get offline payment instruction. |
45 | - $offline_instructions = give_get_offline_payment_instruction( $form_id, true ); |
|
45 | + $offline_instructions = give_get_offline_payment_instruction($form_id, true); |
|
46 | 46 | |
47 | 47 | ob_start(); |
48 | 48 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param int $form_id Give form id. |
55 | 55 | */ |
56 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
56 | + do_action('give_before_offline_info_fields', $form_id); |
|
57 | 57 | ?> |
58 | 58 | <fieldset id="give_offline_payment_info"> |
59 | - <?php echo stripslashes( $offline_instructions ); ?> |
|
59 | + <?php echo stripslashes($offline_instructions); ?> |
|
60 | 60 | </fieldset> |
61 | 61 | <?php |
62 | 62 | /** |
@@ -66,35 +66,35 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $form_id Give form id. |
68 | 68 | */ |
69 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
69 | + do_action('give_after_offline_info_fields', $form_id); |
|
70 | 70 | |
71 | 71 | echo ob_get_clean(); |
72 | 72 | } |
73 | 73 | |
74 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
74 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Give Offline Billing Field |
78 | 78 | * |
79 | 79 | * @param $form_id |
80 | 80 | */ |
81 | -function give_offline_billing_fields( $form_id ) { |
|
81 | +function give_offline_billing_fields($form_id) { |
|
82 | 82 | //Enable Default CC fields (billing info) |
83 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
84 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
83 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
84 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
85 | 85 | |
86 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
86 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
87 | 87 | |
88 | 88 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
89 | 89 | if ( |
90 | - ( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) ) |
|
91 | - || ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) ) |
|
90 | + (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields)) |
|
91 | + || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields)) |
|
92 | 92 | ) { |
93 | - give_default_cc_address_fields( $form_id ); |
|
93 | + give_default_cc_address_fields($form_id); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
97 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Process the payment |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return void |
107 | 107 | */ |
108 | -function give_offline_process_payment( $purchase_data ) { |
|
108 | +function give_offline_process_payment($purchase_data) { |
|
109 | 109 | |
110 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
110 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
111 | 111 | |
112 | 112 | // setup the payment details |
113 | 113 | $payment_data = array( |
114 | 114 | 'price' => $purchase_data['price'], |
115 | 115 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
116 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
117 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
116 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
117 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
118 | 118 | 'date' => $purchase_data['date'], |
119 | 119 | 'user_email' => $purchase_data['user_email'], |
120 | 120 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | // record the pending payment |
129 | - $payment = give_insert_payment( $payment_data ); |
|
129 | + $payment = give_insert_payment($payment_data); |
|
130 | 130 | |
131 | - if ( $payment ) { |
|
132 | - give_offline_send_admin_notice( $payment ); |
|
133 | - give_offline_send_donor_instructions( $payment ); |
|
131 | + if ($payment) { |
|
132 | + give_offline_send_admin_notice($payment); |
|
133 | + give_offline_send_donor_instructions($payment); |
|
134 | 134 | give_send_to_success_page(); |
135 | 135 | } else { |
136 | 136 | // if errors are present, send the user back to the donation form so they can be corrected |
137 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
137 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
142 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | /** |
@@ -152,59 +152,59 @@ discard block |
||
152 | 152 | * @since 1.0 |
153 | 153 | * @return void |
154 | 154 | */ |
155 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
155 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
156 | 156 | |
157 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
158 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
157 | + $payment_data = give_get_payment_meta($payment_id); |
|
158 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
159 | 159 | |
160 | 160 | //Customize email content depending on whether the single form has been customized |
161 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
161 | + $email_content = give_get_option('global_offline_donation_email'); |
|
162 | 162 | |
163 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
164 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
163 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
164 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
165 | 165 | } |
166 | 166 | |
167 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
167 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Filters the from name. |
171 | 171 | * |
172 | 172 | * @since 1.7 |
173 | 173 | */ |
174 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
174 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
175 | 175 | |
176 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
176 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Filters the from email. |
180 | 180 | * |
181 | 181 | * @since 1.7 |
182 | 182 | */ |
183 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
183 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
184 | 184 | |
185 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
185 | + $to_email = give_get_payment_user_email($payment_id); |
|
186 | 186 | |
187 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
188 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
189 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
187 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
188 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
189 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
190 | 190 | } |
191 | 191 | |
192 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
193 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
192 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
193 | + $subject = give_do_email_tags($subject, $payment_id); |
|
194 | 194 | |
195 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
196 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
195 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
196 | + $message = give_do_email_tags($email_content, $payment_id); |
|
197 | 197 | |
198 | 198 | $emails = Give()->emails; |
199 | 199 | |
200 | - $emails->__set( 'from_name', $from_name ); |
|
201 | - $emails->__set( 'from_email', $from_email ); |
|
202 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
200 | + $emails->__set('from_name', $from_name); |
|
201 | + $emails->__set('from_email', $from_email); |
|
202 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
203 | 203 | |
204 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
205 | - $emails->__set( 'headers', $headers ); |
|
204 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
205 | + $emails->__set('headers', $headers); |
|
206 | 206 | |
207 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
207 | + $emails->send($to_email, $subject, $message, $attachments); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,54 +221,54 @@ discard block |
||
221 | 221 | * @return void |
222 | 222 | * |
223 | 223 | */ |
224 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
224 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
225 | 225 | |
226 | 226 | /* Send an email notification to the admin */ |
227 | 227 | $admin_email = give_get_admin_notice_emails(); |
228 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
228 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
229 | 229 | |
230 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
231 | - $user_data = get_userdata( $user_info['id'] ); |
|
230 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
231 | + $user_data = get_userdata($user_info['id']); |
|
232 | 232 | $name = $user_data->display_name; |
233 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
234 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
233 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
234 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
235 | 235 | } else { |
236 | 236 | $name = $user_info['email']; |
237 | 237 | } |
238 | 238 | |
239 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
239 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
240 | 240 | |
241 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
241 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
242 | 242 | |
243 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
244 | - $admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n"; |
|
245 | - $admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
243 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
244 | + $admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n"; |
|
245 | + $admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
246 | 246 | |
247 | 247 | |
248 | - $admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
249 | - $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
248 | + $admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
249 | + $admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | 252 | '<a href="%1$s">%2$s</a>', |
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
253 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
254 | + __('View Donation Details »', 'give') |
|
255 | + )."\n\n"; |
|
256 | 256 | |
257 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
258 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
257 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
258 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
259 | 259 | |
260 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
261 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
260 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
261 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
262 | 262 | |
263 | 263 | //Send Email |
264 | 264 | $emails = Give()->emails; |
265 | - $emails->__set( 'heading', __( 'New Offline Donation', 'give' ) ); |
|
265 | + $emails->__set('heading', __('New Offline Donation', 'give')); |
|
266 | 266 | |
267 | - if ( ! empty( $admin_headers ) ) { |
|
268 | - $emails->__set( 'headers', $admin_headers ); |
|
267 | + if ( ! empty($admin_headers)) { |
|
268 | + $emails->__set('headers', $admin_headers); |
|
269 | 269 | } |
270 | 270 | |
271 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
271 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return array |
282 | 282 | */ |
283 | -function give_offline_add_settings( $settings ) { |
|
283 | +function give_offline_add_settings($settings) { |
|
284 | 284 | |
285 | 285 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
286 | - if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) { |
|
286 | + if (in_array('offline', give_get_option('gateways'))) { |
|
287 | 287 | return $settings; |
288 | 288 | } |
289 | 289 | |
290 | 290 | //Vars |
291 | 291 | $prefix = '_give_'; |
292 | 292 | |
293 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
293 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
294 | 294 | |
295 | 295 | //this gateway isn't active |
296 | - if ( ! $is_gateway_active ) { |
|
296 | + if ( ! $is_gateway_active) { |
|
297 | 297 | //return settings and bounce |
298 | 298 | return $settings; |
299 | 299 | } |
@@ -302,34 +302,34 @@ discard block |
||
302 | 302 | $check_settings = array( |
303 | 303 | |
304 | 304 | array( |
305 | - 'name' => __( 'Offline Donations', 'give' ), |
|
306 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
307 | - 'id' => $prefix . 'customize_offline_donations', |
|
305 | + 'name' => __('Offline Donations', 'give'), |
|
306 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
307 | + 'id' => $prefix.'customize_offline_donations', |
|
308 | 308 | 'type' => 'radio_inline', |
309 | 309 | 'default' => 'global', |
310 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
311 | - 'global' => __( 'Global Option', 'give' ), |
|
312 | - 'enabled' => __( 'Customize', 'give' ), |
|
313 | - 'disabled' => __( 'Disable', 'give' ), |
|
310 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
311 | + 'global' => __('Global Option', 'give'), |
|
312 | + 'enabled' => __('Customize', 'give'), |
|
313 | + 'disabled' => __('Disable', 'give'), |
|
314 | 314 | ) |
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'name' => __( 'Billing Fields', 'give' ), |
|
319 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
320 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
318 | + 'name' => __('Billing Fields', 'give'), |
|
319 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
320 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
321 | 321 | 'row_classes' => 'give-subfield', |
322 | 322 | 'type' => 'radio_inline', |
323 | 323 | 'default' => 'disabled', |
324 | 324 | 'options' => array( |
325 | - 'enabled' => __( 'Enabled', 'give' ), |
|
326 | - 'disabled' => __( 'Disabled', 'give' ), |
|
325 | + 'enabled' => __('Enabled', 'give'), |
|
326 | + 'disabled' => __('Disabled', 'give'), |
|
327 | 327 | ), |
328 | 328 | ), |
329 | 329 | array( |
330 | - 'id' => $prefix . 'offline_checkout_notes', |
|
331 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
332 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
330 | + 'id' => $prefix.'offline_checkout_notes', |
|
331 | + 'name' => __('Donation Instructions', 'give'), |
|
332 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
333 | 333 | 'default' => give_get_default_offline_donation_content(), |
334 | 334 | 'type' => 'wysiwyg', |
335 | 335 | 'row_classes' => 'give-subfield', |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | ) |
339 | 339 | ), |
340 | 340 | array( |
341 | - 'id' => $prefix . 'offline_donation_subject', |
|
342 | - 'name' => __( 'Email Subject', 'give' ), |
|
343 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
344 | - 'default' => __( '{form_title} - Offline Donation Instructions', 'give' ), |
|
341 | + 'id' => $prefix.'offline_donation_subject', |
|
342 | + 'name' => __('Email Subject', 'give'), |
|
343 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
344 | + 'default' => __('{form_title} - Offline Donation Instructions', 'give'), |
|
345 | 345 | 'row_classes' => 'give-subfield', |
346 | 346 | 'type' => 'text' |
347 | 347 | ), |
348 | 348 | array( |
349 | - 'id' => $prefix . 'offline_donation_email', |
|
350 | - 'name' => __( 'Email Instructions', 'give' ), |
|
351 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
349 | + 'id' => $prefix.'offline_donation_email', |
|
350 | + 'name' => __('Email Instructions', 'give'), |
|
351 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
352 | 352 | 'default' => give_get_default_offline_donation_email_content(), |
353 | 353 | 'type' => 'wysiwyg', |
354 | 354 | 'row_classes' => 'give-subfield', |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | 'name' => 'offline_docs', |
361 | 361 | 'type' => 'docs_link', |
362 | 362 | 'url' => 'http://docs.givewp.com/settings-gateway-offline-donations', |
363 | - 'title' => __( 'Offline Donations', 'give' ), |
|
363 | + 'title' => __('Offline Donations', 'give'), |
|
364 | 364 | ), |
365 | 365 | ); |
366 | 366 | |
367 | - return array_merge( $settings, $check_settings ); |
|
367 | + return array_merge($settings, $check_settings); |
|
368 | 368 | } |
369 | 369 | |
370 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
370 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -379,32 +379,32 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | 383 | |
384 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
384 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - __( 'Make a check payable to "%s"', 'give' ), |
|
389 | + __('Make a check payable to "%s"', 'give'), |
|
390 | 390 | $sitename |
391 | 391 | ); |
392 | 392 | $default_text .= '</li>'; |
393 | 393 | $default_text .= '<li>'; |
394 | 394 | $default_text .= sprintf( |
395 | 395 | /* translators: %s: site name */ |
396 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
397 | 397 | $sitename |
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
402 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
403 | 403 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
404 | 404 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
405 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
405 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
406 | 406 | |
407 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
407 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
@@ -417,34 +417,34 @@ discard block |
||
417 | 417 | */ |
418 | 418 | function give_get_default_offline_donation_email_content() { |
419 | 419 | |
420 | - $sitename = get_bloginfo( 'sitename' ); |
|
421 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
422 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
420 | + $sitename = get_bloginfo('sitename'); |
|
421 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
422 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
423 | 423 | $default_text .= '<ol>'; |
424 | 424 | $default_text .= '<li>'; |
425 | 425 | $default_text .= sprintf( |
426 | 426 | /* translators: %s: site name */ |
427 | - __( 'Make a check payable to "%s"', 'give' ), |
|
427 | + __('Make a check payable to "%s"', 'give'), |
|
428 | 428 | $sitename |
429 | 429 | ); |
430 | 430 | $default_text .= '</li>'; |
431 | 431 | $default_text .= '<li>'; |
432 | 432 | $default_text .= sprintf( |
433 | 433 | /* translators: %s: site name */ |
434 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
434 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
435 | 435 | $sitename |
436 | 436 | ); |
437 | 437 | $default_text .= '</li>'; |
438 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
438 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
439 | 439 | $default_text .= '</ol>'; |
440 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
440 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
441 | 441 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
442 | 442 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
443 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
444 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
445 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
443 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
444 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
445 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
446 | 446 | |
447 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
447 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
448 | 448 | |
449 | 449 | } |
450 | 450 | |
@@ -458,17 +458,17 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return string |
460 | 460 | */ |
461 | -function give_offline_donation_receipt_status_notice( $notice, $id ) { |
|
462 | - $payment = new Give_Payment( $id ); |
|
461 | +function give_offline_donation_receipt_status_notice($notice, $id) { |
|
462 | + $payment = new Give_Payment($id); |
|
463 | 463 | |
464 | - if ( 'offline' !== $payment->gateway || $payment->is_completed() ) { |
|
464 | + if ('offline' !== $payment->gateway || $payment->is_completed()) { |
|
465 | 465 | return $notice; |
466 | 466 | } |
467 | 467 | |
468 | - return give_output_error( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' ); |
|
468 | + return give_output_error(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning'); |
|
469 | 469 | } |
470 | 470 | |
471 | -add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 ); |
|
471 | +add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2); |
|
472 | 472 | |
473 | 473 | /** |
474 | 474 | * Add offline payment instruction on payment receipt. |
@@ -479,26 +479,26 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return mixed |
481 | 481 | */ |
482 | -function give_offline_payment_receipt_after( $payment ) { |
|
482 | +function give_offline_payment_receipt_after($payment) { |
|
483 | 483 | // Get payment object. |
484 | - $payment = new Give_Payment( $payment->ID ); |
|
484 | + $payment = new Give_Payment($payment->ID); |
|
485 | 485 | |
486 | 486 | // Bailout. |
487 | - if ( 'offline' !== $payment->gateway ) { |
|
487 | + if ('offline' !== $payment->gateway) { |
|
488 | 488 | return false; |
489 | 489 | } |
490 | 490 | |
491 | 491 | ?> |
492 | 492 | <tr> |
493 | - <td scope="row"><strong><?php esc_html_e( 'Offline Payment Instruction:', 'give' ); ?></strong></td> |
|
493 | + <td scope="row"><strong><?php esc_html_e('Offline Payment Instruction:', 'give'); ?></strong></td> |
|
494 | 494 | <td> |
495 | - <?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?> |
|
495 | + <?php echo give_get_offline_payment_instruction($payment->form_id, true); ?> |
|
496 | 496 | </td> |
497 | 497 | </tr> |
498 | 498 | <?php |
499 | 499 | } |
500 | 500 | |
501 | -add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' ); |
|
501 | +add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after'); |
|
502 | 502 | |
503 | 503 | /** |
504 | 504 | * Get offline payment instructions. |
@@ -510,27 +510,27 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @return string |
512 | 512 | */ |
513 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
513 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
514 | 514 | // Bailout. |
515 | - if ( ! $form_id ) { |
|
515 | + if ( ! $form_id) { |
|
516 | 516 | return ''; |
517 | 517 | } |
518 | 518 | |
519 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
520 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
521 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
519 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
520 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
521 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
522 | 522 | $offline_instructions = $global_offline_instruction; |
523 | 523 | |
524 | - if ( give_is_setting_enabled( $post_offline_customization_option ) ) { |
|
524 | + if (give_is_setting_enabled($post_offline_customization_option)) { |
|
525 | 525 | $offline_instructions = $post_offline_instructions; |
526 | 526 | } |
527 | 527 | |
528 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
528 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
529 | 529 | |
530 | 530 | /* translators: %s: form settings url */ |
531 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
531 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
532 | 532 | |
533 | - return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions ); |
|
533 | + return ($wpautop ? wpautop($offline_instructions) : $offline_instructions); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -544,24 +544,24 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return array |
546 | 546 | */ |
547 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
547 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
548 | 548 | if ( |
549 | 549 | // Show offline payment gateway if enable for new donation form. |
550 | - ( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) |
|
550 | + (false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) |
|
551 | 551 | && $form_id |
552 | - && ! give_is_setting_enabled( get_post_meta( $form_id, '_give_customize_offline_donations', true ), array( |
|
552 | + && ! give_is_setting_enabled(get_post_meta($form_id, '_give_customize_offline_donations', true), array( |
|
553 | 553 | 'enabled', |
554 | 554 | 'global', |
555 | - ) ) |
|
555 | + )) |
|
556 | 556 | ) { |
557 | - unset( $gateway_list['offline'] ); |
|
557 | + unset($gateway_list['offline']); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | // Output. |
561 | 561 | return $gateway_list; |
562 | 562 | } |
563 | 563 | |
564 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
564 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
565 | 565 | |
566 | 566 | /** |
567 | 567 | * Set default gateway to global default payment gateway |
@@ -575,10 +575,10 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return void |
577 | 577 | */ |
578 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
579 | - if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === get_post_meta( $postid, '_give_default_gateway', true ) ) ) { |
|
580 | - update_post_meta( $postid, '_give_default_gateway', 'global' ); |
|
578 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
579 | + if ( ! give_is_setting_enabled($meta_value) && ('offline' === get_post_meta($postid, '_give_default_gateway', true))) { |
|
580 | + update_post_meta($postid, '_give_default_gateway', 'global'); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
584 | +add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3); |
@@ -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,11 +26,11 @@ 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 ) ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Filters the from name. |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
43 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
44 | 44 | |
45 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
45 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Filters the from email. |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @since 1.0 |
54 | 54 | */ |
55 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
55 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
56 | 56 | |
57 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
57 | + $to_email = give_get_payment_user_email($payment_id); |
|
58 | 58 | |
59 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
59 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Filters the donation email receipt subject. |
63 | 63 | * |
64 | 64 | * @since 1.0 |
65 | 65 | */ |
66 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
67 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
66 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
67 | + $subject = give_do_email_tags($subject, $payment_id); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt. |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @since 1.0 |
76 | 76 | */ |
77 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
78 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
77 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
78 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
79 | 79 | |
80 | 80 | $emails = Give()->emails; |
81 | 81 | |
82 | - $emails->__set( 'from_name', $from_name ); |
|
83 | - $emails->__set( 'from_email', $from_email ); |
|
84 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
82 | + $emails->__set('from_name', $from_name); |
|
83 | + $emails->__set('from_email', $from_email); |
|
84 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Filters the donation receipt's email headers. |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @since 1.0 |
93 | 93 | */ |
94 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
95 | - $emails->__set( 'headers', $headers ); |
|
94 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
95 | + $emails->__set('headers', $headers); |
|
96 | 96 | |
97 | 97 | //Send the donation receipt. |
98 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
98 | + $emails->send($to_email, $subject, $message, $attachments); |
|
99 | 99 | |
100 | 100 | //If admin notifications are on, send the admin notice. |
101 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
101 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
102 | 102 | /** |
103 | 103 | * Fires in the donation email receipt. |
104 | 104 | * |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param int $payment_id Payment id. |
110 | 110 | * @param mixed $payment_data Payment meta data. |
111 | 111 | */ |
112 | - do_action( 'give_admin_donation_email', $payment_id, $payment_data ); |
|
112 | + do_action('give_admin_donation_email', $payment_id, $payment_data); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -122,41 +122,41 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function give_email_test_donation_receipt() { |
124 | 124 | |
125 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
125 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Filters the from name. |
129 | 129 | * |
130 | 130 | * @since 1.7 |
131 | 131 | */ |
132 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() ); |
|
132 | + $from_name = apply_filters('give_donation_from_name', $from_name, 0, array()); |
|
133 | 133 | |
134 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
134 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Filters the from email. |
138 | 138 | * |
139 | 139 | * @since 1.7 |
140 | 140 | */ |
141 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() ); |
|
141 | + $from_email = apply_filters('give_donation_from_address', $from_email, 0, array()); |
|
142 | 142 | |
143 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
144 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
145 | - $subject = give_do_email_tags( $subject, 0 ); |
|
143 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
144 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
145 | + $subject = give_do_email_tags($subject, 0); |
|
146 | 146 | |
147 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
147 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
148 | 148 | |
149 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
149 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
150 | 150 | |
151 | 151 | $emails = Give()->emails; |
152 | - $emails->__set( 'from_name', $from_name ); |
|
153 | - $emails->__set( 'from_email', $from_email ); |
|
154 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
152 | + $emails->__set('from_name', $from_name); |
|
153 | + $emails->__set('from_email', $from_email); |
|
154 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
155 | 155 | |
156 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
157 | - $emails->__set( 'headers', $headers ); |
|
156 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
157 | + $emails->__set('headers', $headers); |
|
158 | 158 | |
159 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
159 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | |
@@ -170,49 +170,49 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
173 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
174 | 174 | |
175 | - $payment_id = absint( $payment_id ); |
|
175 | + $payment_id = absint($payment_id); |
|
176 | 176 | |
177 | - if ( empty( $payment_id ) ) { |
|
177 | + if (empty($payment_id)) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
181 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
185 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filters the from name. |
189 | 189 | * |
190 | 190 | * @since 1.0 |
191 | 191 | */ |
192 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
192 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
193 | 193 | |
194 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
194 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Filters the from email. |
198 | 198 | * |
199 | 199 | * @since 1.0 |
200 | 200 | */ |
201 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
201 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
202 | 202 | |
203 | 203 | /* translators: %s: payment id */ |
204 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
204 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Filters the donation notification subject. |
208 | 208 | * |
209 | 209 | * @since 1.0 |
210 | 210 | */ |
211 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
212 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
211 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
212 | + $subject = give_do_email_tags($subject, $payment_id); |
|
213 | 213 | |
214 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
215 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
214 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
215 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
216 | 216 | //$headers .= "MIME-Version: 1.0\r\n"; |
217 | 217 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
218 | 218 | |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @since 1.0 |
223 | 223 | */ |
224 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
224 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple. |
228 | 228 | * |
229 | 229 | * @since 1.0 |
230 | 230 | */ |
231 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
231 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
232 | 232 | |
233 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
233 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
234 | 234 | |
235 | 235 | $emails = Give()->emails; |
236 | - $emails->__set( 'from_name', $from_name ); |
|
237 | - $emails->__set( 'from_email', $from_email ); |
|
238 | - $emails->__set( 'headers', $headers ); |
|
239 | - $emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
236 | + $emails->__set('from_name', $from_name); |
|
237 | + $emails->__set('from_email', $from_email); |
|
238 | + $emails->__set('headers', $headers); |
|
239 | + $emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
240 | 240 | |
241 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
241 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 ); |
|
245 | +add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings). |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function give_get_admin_notice_emails() { |
254 | 254 | |
255 | - $email_option = give_get_option( 'admin_notice_emails' ); |
|
255 | + $email_option = give_get_option('admin_notice_emails'); |
|
256 | 256 | |
257 | - $emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' ); |
|
258 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
257 | + $emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email'); |
|
258 | + $emails = array_map('trim', explode("\n", $emails)); |
|
259 | 259 | |
260 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
260 | + return apply_filters('give_admin_notice_emails', $emails); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
272 | +function give_admin_notices_disabled($payment_id = 0) { |
|
273 | 273 | |
274 | 274 | return apply_filters( |
275 | 275 | 'give_admin_notices_disabled', |
276 | - ! give_is_setting_enabled( give_get_option( 'admin_notices' ) ), |
|
276 | + ! give_is_setting_enabled(give_get_option('admin_notices')), |
|
277 | 277 | $payment_id |
278 | 278 | ); |
279 | 279 | } |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | */ |
289 | 289 | function give_get_default_donation_notification_email() { |
290 | 290 | |
291 | - $default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n"; |
|
292 | - $default_email_body .= 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"; |
|
293 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
294 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
295 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
296 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
297 | - $default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n"; |
|
298 | - $default_email_body .= '{sitename}' . "\n"; |
|
291 | + $default_email_body = esc_html__('Hi there,', 'give')."\n\n"; |
|
292 | + $default_email_body .= 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"; |
|
293 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n"; |
|
294 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
295 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
296 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
297 | + $default_email_body .= esc_html__('Thank you,', 'give')."\n\n"; |
|
298 | + $default_email_body .= '{sitename}'."\n"; |
|
299 | 299 | |
300 | - $custom_message = give_get_option( 'donation_notification' ); |
|
301 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
300 | + $custom_message = give_get_option('donation_notification'); |
|
301 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
302 | 302 | |
303 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
303 | + return apply_filters('give_default_donation_notification_email', $message); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,25 +314,25 @@ discard block |
||
314 | 314 | */ |
315 | 315 | function give_get_default_donation_receipt_email() { |
316 | 316 | |
317 | - $default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n"; |
|
318 | - $default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
319 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
320 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
321 | - $default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
322 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
323 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
324 | - $default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
325 | - $default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
326 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
317 | + $default_email_body = esc_html__('Dear', 'give')." {name},\n\n"; |
|
318 | + $default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
319 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
320 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
321 | + $default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
322 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
323 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
324 | + $default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
325 | + $default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
326 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
327 | 327 | $default_email_body .= "\n\n"; |
328 | - $default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
329 | - $default_email_body .= '{sitename}' . "\n"; |
|
328 | + $default_email_body .= esc_html__('Sincerely,', 'give')."\n"; |
|
329 | + $default_email_body .= '{sitename}'."\n"; |
|
330 | 330 | |
331 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
331 | + $custom_message = give_get_option('donation_receipt'); |
|
332 | 332 | |
333 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
333 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
334 | 334 | |
335 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
335 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,19 +344,19 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @return array $email_names |
346 | 346 | */ |
347 | -function give_get_email_names( $user_info ) { |
|
347 | +function give_get_email_names($user_info) { |
|
348 | 348 | $email_names = array(); |
349 | - $user_info = maybe_unserialize( $user_info ); |
|
349 | + $user_info = maybe_unserialize($user_info); |
|
350 | 350 | |
351 | 351 | $email_names['fullname'] = ''; |
352 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
353 | - $user_data = get_userdata( $user_info['id'] ); |
|
352 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
353 | + $user_data = get_userdata($user_info['id']); |
|
354 | 354 | $email_names['name'] = $user_info['first_name']; |
355 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
355 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
356 | 356 | $email_names['username'] = $user_data->user_login; |
357 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
357 | + } elseif (isset($user_info['first_name'])) { |
|
358 | 358 | $email_names['name'] = $user_info['first_name']; |
359 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
359 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
360 | 360 | $email_names['username'] = $user_info['first_name']; |
361 | 361 | } else { |
362 | 362 | $email_names['name'] = $user_info['email']; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @param string $description Email tag description text |
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | */ |
58 | - public function add( $tag, $description, $func ) { |
|
59 | - if ( is_callable( $func ) ) { |
|
60 | - $this->tags[ $tag ] = array( |
|
58 | + public function add($tag, $description, $func) { |
|
59 | + if (is_callable($func)) { |
|
60 | + $this->tags[$tag] = array( |
|
61 | 61 | 'tag' => $tag, |
62 | 62 | 'description' => $description, |
63 | 63 | 'func' => $func |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param string $tag Email tag to remove hook from |
74 | 74 | */ |
75 | - public function remove( $tag ) { |
|
76 | - unset( $this->tags[ $tag ] ); |
|
75 | + public function remove($tag) { |
|
76 | + unset($this->tags[$tag]); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return bool |
87 | 87 | */ |
88 | - public function email_tag_exists( $tag ) { |
|
89 | - return array_key_exists( $tag, $this->tags ); |
|
88 | + public function email_tag_exists($tag) { |
|
89 | + return array_key_exists($tag, $this->tags); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Content with email tags filtered out. |
112 | 112 | */ |
113 | - public function do_tags( $content, $payment_id ) { |
|
113 | + public function do_tags($content, $payment_id) { |
|
114 | 114 | |
115 | 115 | // Check if there is at least one tag added. |
116 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
116 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
117 | 117 | return $content; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->payment_id = $payment_id; |
121 | 121 | |
122 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
122 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
123 | 123 | |
124 | 124 | $this->payment_id = null; |
125 | 125 | |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return mixed |
137 | 137 | */ |
138 | - public function do_tag( $m ) { |
|
138 | + public function do_tag($m) { |
|
139 | 139 | |
140 | 140 | // Get tag |
141 | 141 | $tag = $m[1]; |
142 | 142 | |
143 | 143 | // Return tag if tag not set |
144 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
144 | + if ( ! $this->email_tag_exists($tag)) { |
|
145 | 145 | return $m[0]; |
146 | 146 | } |
147 | 147 | |
148 | - return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag ); |
|
148 | + return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | * @param string $description Description of the email tag added |
160 | 160 | * @param callable $func Hook to run when email tag is found |
161 | 161 | */ |
162 | -function give_add_email_tag( $tag, $description, $func ) { |
|
163 | - Give()->email_tags->add( $tag, $description, $func ); |
|
162 | +function give_add_email_tag($tag, $description, $func) { |
|
163 | + Give()->email_tags->add($tag, $description, $func); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param string $tag Email tag to remove hook from |
172 | 172 | */ |
173 | -function give_remove_email_tag( $tag ) { |
|
174 | - Give()->email_tags->remove( $tag ); |
|
173 | +function give_remove_email_tag($tag) { |
|
174 | + Give()->email_tags->remove($tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return bool |
185 | 185 | */ |
186 | -function give_email_tag_exists( $tag ) { |
|
187 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
186 | +function give_email_tag_exists($tag) { |
|
187 | + return Give()->email_tags->email_tag_exists($tag); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | $email_tags = give_get_email_tags(); |
212 | 212 | |
213 | 213 | ob_start(); |
214 | - if ( count( $email_tags ) > 0 ) : ?> |
|
214 | + if (count($email_tags) > 0) : ?> |
|
215 | 215 | <div class="give-email-tags-wrap"> |
216 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
216 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
217 | 217 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
218 | 218 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
219 | 219 | </span> |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return string Content with email tags filtered out. |
237 | 237 | */ |
238 | -function give_do_email_tags( $content, $payment_id ) { |
|
238 | +function give_do_email_tags($content, $payment_id) { |
|
239 | 239 | |
240 | 240 | // Replace all tags |
241 | - $content = Give()->email_tags->do_tags( $content, $payment_id ); |
|
241 | + $content = Give()->email_tags->do_tags($content, $payment_id); |
|
242 | 242 | |
243 | - $content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id ); |
|
243 | + $content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id); |
|
244 | 244 | |
245 | 245 | // Return content |
246 | 246 | return $content; |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @since 1.0 |
261 | 261 | */ |
262 | - do_action( 'give_add_email_tags' ); |
|
262 | + do_action('give_add_email_tags'); |
|
263 | 263 | } |
264 | 264 | |
265 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
265 | +add_action('init', 'give_load_email_tags', - 999); |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Add default Give email template tags. |
@@ -275,97 +275,97 @@ discard block |
||
275 | 275 | $email_tags = array( |
276 | 276 | array( |
277 | 277 | 'tag' => 'donation', |
278 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
278 | + 'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
279 | 279 | 'function' => 'give_email_tag_donation' |
280 | 280 | ), |
281 | 281 | array( |
282 | 282 | 'tag' => 'form_title', |
283 | - 'description' => esc_html__( 'The donation form name.', 'give' ), |
|
283 | + 'description' => esc_html__('The donation form name.', 'give'), |
|
284 | 284 | 'function' => 'give_email_tag_form_title' |
285 | 285 | ), |
286 | 286 | array( |
287 | 287 | 'tag' => 'amount', |
288 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
288 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
289 | 289 | 'function' => 'give_email_tag_amount' |
290 | 290 | ), |
291 | 291 | array( |
292 | 292 | 'tag' => 'price', |
293 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
293 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
294 | 294 | 'function' => 'give_email_tag_price' |
295 | 295 | ), |
296 | 296 | array( |
297 | 297 | 'tag' => 'name', |
298 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
298 | + 'description' => esc_html__('The donor\'s first name.', 'give'), |
|
299 | 299 | 'function' => 'give_email_tag_first_name' |
300 | 300 | ), |
301 | 301 | array( |
302 | 302 | 'tag' => 'fullname', |
303 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
303 | + 'description' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
304 | 304 | 'function' => 'give_email_tag_fullname' |
305 | 305 | ), |
306 | 306 | array( |
307 | 307 | 'tag' => 'username', |
308 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
308 | + 'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
309 | 309 | 'function' => 'give_email_tag_username' |
310 | 310 | ), |
311 | 311 | array( |
312 | 312 | 'tag' => 'user_email', |
313 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
313 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
314 | 314 | 'function' => 'give_email_tag_user_email' |
315 | 315 | ), |
316 | 316 | array( |
317 | 317 | 'tag' => 'billing_address', |
318 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
318 | + 'description' => esc_html__('The donor\'s billing address.', 'give'), |
|
319 | 319 | 'function' => 'give_email_tag_billing_address' |
320 | 320 | ), |
321 | 321 | array( |
322 | 322 | 'tag' => 'date', |
323 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), |
|
323 | + 'description' => esc_html__('The date of the donation.', 'give'), |
|
324 | 324 | 'function' => 'give_email_tag_date' |
325 | 325 | ), |
326 | 326 | array( |
327 | 327 | 'tag' => 'payment_id', |
328 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
328 | + 'description' => esc_html__('The unique ID number for this donation.', 'give'), |
|
329 | 329 | 'function' => 'give_email_tag_payment_id' |
330 | 330 | ), |
331 | 331 | array( |
332 | 332 | 'tag' => 'receipt_id', |
333 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
333 | + 'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
334 | 334 | 'function' => 'give_email_tag_receipt_id' |
335 | 335 | ), |
336 | 336 | array( |
337 | 337 | 'tag' => 'payment_method', |
338 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
338 | + 'description' => esc_html__('The method of payment used for this donation.', 'give'), |
|
339 | 339 | 'function' => 'give_email_tag_payment_method' |
340 | 340 | ), |
341 | 341 | array( |
342 | 342 | 'tag' => 'sitename', |
343 | - 'description' => esc_html__( 'The name of your site.', 'give' ), |
|
343 | + 'description' => esc_html__('The name of your site.', 'give'), |
|
344 | 344 | 'function' => 'give_email_tag_sitename' |
345 | 345 | ), |
346 | 346 | array( |
347 | 347 | 'tag' => 'receipt_link', |
348 | - 'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
348 | + 'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
349 | 349 | 'function' => 'give_email_tag_receipt_link' |
350 | 350 | ), |
351 | 351 | array( |
352 | 352 | 'tag' => 'receipt_link_url', |
353 | - 'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
353 | + 'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
354 | 354 | 'function' => 'give_email_tag_receipt_link_url' |
355 | 355 | ), |
356 | 356 | ); |
357 | 357 | |
358 | 358 | // Apply give_email_tags filter |
359 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
359 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
360 | 360 | |
361 | 361 | // Add email tags |
362 | - foreach ( $email_tags as $email_tag ) { |
|
363 | - give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] ); |
|
362 | + foreach ($email_tags as $email_tag) { |
|
363 | + give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | } |
367 | 367 | |
368 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
368 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
369 | 369 | |
370 | 370 | |
371 | 371 | /** |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | * |
378 | 378 | * @return string name |
379 | 379 | */ |
380 | -function give_email_tag_first_name( $payment_id ) { |
|
381 | - $payment = new Give_Payment( $payment_id ); |
|
380 | +function give_email_tag_first_name($payment_id) { |
|
381 | + $payment = new Give_Payment($payment_id); |
|
382 | 382 | $user_info = $payment->user_info; |
383 | 383 | |
384 | - if ( empty( $user_info ) ) { |
|
384 | + if (empty($user_info)) { |
|
385 | 385 | return ''; |
386 | 386 | } |
387 | 387 | |
388 | - $email_name = give_get_email_names( $user_info ); |
|
388 | + $email_name = give_get_email_names($user_info); |
|
389 | 389 | |
390 | 390 | return $email_name['name']; |
391 | 391 | } |
@@ -399,15 +399,15 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return string fullname |
401 | 401 | */ |
402 | -function give_email_tag_fullname( $payment_id ) { |
|
403 | - $payment = new Give_Payment( $payment_id ); |
|
402 | +function give_email_tag_fullname($payment_id) { |
|
403 | + $payment = new Give_Payment($payment_id); |
|
404 | 404 | $user_info = $payment->user_info; |
405 | 405 | |
406 | - if ( empty( $user_info ) ) { |
|
406 | + if (empty($user_info)) { |
|
407 | 407 | return ''; |
408 | 408 | } |
409 | 409 | |
410 | - $email_name = give_get_email_names( $user_info ); |
|
410 | + $email_name = give_get_email_names($user_info); |
|
411 | 411 | |
412 | 412 | return $email_name['fullname']; |
413 | 413 | } |
@@ -421,15 +421,15 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return string username. |
423 | 423 | */ |
424 | -function give_email_tag_username( $payment_id ) { |
|
425 | - $payment = new Give_Payment( $payment_id ); |
|
424 | +function give_email_tag_username($payment_id) { |
|
425 | + $payment = new Give_Payment($payment_id); |
|
426 | 426 | $user_info = $payment->user_info; |
427 | 427 | |
428 | - if ( empty( $user_info ) ) { |
|
428 | + if (empty($user_info)) { |
|
429 | 429 | return ''; |
430 | 430 | } |
431 | 431 | |
432 | - $email_name = give_get_email_names( $user_info ); |
|
432 | + $email_name = give_get_email_names($user_info); |
|
433 | 433 | |
434 | 434 | return $email_name['username']; |
435 | 435 | } |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @return string user_email |
445 | 445 | */ |
446 | -function give_email_tag_user_email( $payment_id ) { |
|
447 | - $payment = new Give_Payment( $payment_id ); |
|
446 | +function give_email_tag_user_email($payment_id) { |
|
447 | + $payment = new Give_Payment($payment_id); |
|
448 | 448 | |
449 | 449 | return $payment->email; |
450 | 450 | } |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return string billing_address |
460 | 460 | */ |
461 | -function give_email_tag_billing_address( $payment_id ) { |
|
462 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
463 | - $user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
461 | +function give_email_tag_billing_address($payment_id) { |
|
462 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
463 | + $user_address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
464 | 464 | 'line1' => '', |
465 | 465 | 'line2' => '', |
466 | 466 | 'city' => '', |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | 'zip' => '' |
470 | 470 | ); |
471 | 471 | |
472 | - $return = $user_address['line1'] . "\n"; |
|
473 | - if ( ! empty( $user_address['line2'] ) ) { |
|
474 | - $return .= $user_address['line2'] . "\n"; |
|
472 | + $return = $user_address['line1']."\n"; |
|
473 | + if ( ! empty($user_address['line2'])) { |
|
474 | + $return .= $user_address['line2']."\n"; |
|
475 | 475 | } |
476 | - $return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n"; |
|
476 | + $return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n"; |
|
477 | 477 | $return .= $user_address['country']; |
478 | 478 | |
479 | 479 | return $return; |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return string date |
490 | 490 | */ |
491 | -function give_email_tag_date( $payment_id ) { |
|
492 | - $payment = new Give_Payment( $payment_id ); |
|
491 | +function give_email_tag_date($payment_id) { |
|
492 | + $payment = new Give_Payment($payment_id); |
|
493 | 493 | |
494 | - return date_i18n( give_date_format(), strtotime( $payment->date ) ); |
|
494 | + return date_i18n(give_date_format(), strtotime($payment->date)); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @return string amount |
505 | 505 | */ |
506 | -function give_email_tag_amount( $payment_id ) { |
|
507 | - $payment = new Give_Payment( $payment_id ); |
|
508 | - $give_amount = give_currency_filter( give_format_amount( $payment->total ), $payment->currency ); |
|
506 | +function give_email_tag_amount($payment_id) { |
|
507 | + $payment = new Give_Payment($payment_id); |
|
508 | + $give_amount = give_currency_filter(give_format_amount($payment->total), $payment->currency); |
|
509 | 509 | |
510 | - return html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
510 | + return html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -519,8 +519,8 @@ discard block |
||
519 | 519 | * |
520 | 520 | * @return string price |
521 | 521 | */ |
522 | -function give_email_tag_price( $payment_id ) { |
|
523 | - return give_email_tag_amount( $payment_id ); |
|
522 | +function give_email_tag_price($payment_id) { |
|
523 | + return give_email_tag_amount($payment_id); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | /** |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @return int payment_id |
534 | 534 | */ |
535 | -function give_email_tag_payment_id( $payment_id ) { |
|
536 | - $payment = new Give_Payment( $payment_id ); |
|
535 | +function give_email_tag_payment_id($payment_id) { |
|
536 | + $payment = new Give_Payment($payment_id); |
|
537 | 537 | |
538 | 538 | return $payment->number; |
539 | 539 | } |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | * |
548 | 548 | * @return string receipt_id |
549 | 549 | */ |
550 | -function give_email_tag_receipt_id( $payment_id ) { |
|
551 | - $payment = new Give_Payment( $payment_id ); |
|
550 | +function give_email_tag_receipt_id($payment_id) { |
|
551 | + $payment = new Give_Payment($payment_id); |
|
552 | 552 | |
553 | 553 | return $payment->key; |
554 | 554 | } |
@@ -562,14 +562,14 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @return string $form_title |
564 | 564 | */ |
565 | -function give_email_tag_donation( $payment_id ) { |
|
566 | - $payment = new Give_Payment( $payment_id ); |
|
565 | +function give_email_tag_donation($payment_id) { |
|
566 | + $payment = new Give_Payment($payment_id); |
|
567 | 567 | $payment_meta = $payment->payment_meta; |
568 | - $level_title = give_has_variable_prices( $payment->form_id ); |
|
568 | + $level_title = give_has_variable_prices($payment->form_id); |
|
569 | 569 | $separator = $level_title ? '-' : ''; |
570 | - $form_title = strip_tags( give_get_payment_form_title( $payment_meta, false, $separator ) ); |
|
570 | + $form_title = strip_tags(give_get_payment_form_title($payment_meta, false, $separator)); |
|
571 | 571 | |
572 | - return ! empty( $form_title ) ? $form_title : ''; |
|
572 | + return ! empty($form_title) ? $form_title : ''; |
|
573 | 573 | |
574 | 574 | } |
575 | 575 | |
@@ -582,11 +582,11 @@ discard block |
||
582 | 582 | * |
583 | 583 | * @return string $form_title |
584 | 584 | */ |
585 | -function give_email_tag_form_title( $payment_id ) { |
|
586 | - $payment = new Give_Payment( $payment_id ); |
|
585 | +function give_email_tag_form_title($payment_id) { |
|
586 | + $payment = new Give_Payment($payment_id); |
|
587 | 587 | $payment_meta = $payment->payment_meta; |
588 | 588 | |
589 | - return isset( $payment_meta['form_title'] ) ? strip_tags( $payment_meta['form_title'] ) : ''; |
|
589 | + return isset($payment_meta['form_title']) ? strip_tags($payment_meta['form_title']) : ''; |
|
590 | 590 | |
591 | 591 | } |
592 | 592 | |
@@ -599,10 +599,10 @@ discard block |
||
599 | 599 | * |
600 | 600 | * @return string gateway |
601 | 601 | */ |
602 | -function give_email_tag_payment_method( $payment_id ) { |
|
603 | - $payment = new Give_Payment( $payment_id ); |
|
602 | +function give_email_tag_payment_method($payment_id) { |
|
603 | + $payment = new Give_Payment($payment_id); |
|
604 | 604 | |
605 | - return give_get_gateway_checkout_label( $payment->gateway ); |
|
605 | + return give_get_gateway_checkout_label($payment->gateway); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | /** |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * |
615 | 615 | * @return string sitename |
616 | 616 | */ |
617 | -function give_email_tag_sitename( $payment_id ) { |
|
618 | - return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
617 | +function give_email_tag_sitename($payment_id) { |
|
618 | + return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
@@ -627,19 +627,19 @@ discard block |
||
627 | 627 | * |
628 | 628 | * @return string receipt_link |
629 | 629 | */ |
630 | -function give_email_tag_receipt_link( $payment_id ) { |
|
630 | +function give_email_tag_receipt_link($payment_id) { |
|
631 | 631 | |
632 | - $receipt_url = esc_url( add_query_arg( array( |
|
633 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
632 | + $receipt_url = esc_url(add_query_arg(array( |
|
633 | + 'payment_key' => give_get_payment_key($payment_id), |
|
634 | 634 | 'give_action' => 'view_receipt' |
635 | - ), home_url() ) ); |
|
636 | - $formatted = sprintf( |
|
635 | + ), home_url())); |
|
636 | + $formatted = sprintf( |
|
637 | 637 | '<a href="%1$s">%2$s</a>', |
638 | 638 | $receipt_url, |
639 | - esc_html__( 'View it in your browser', 'give' ) |
|
639 | + esc_html__('View it in your browser', 'give') |
|
640 | 640 | ); |
641 | 641 | |
642 | - if ( give_get_option( 'email_template' ) !== 'none' ) { |
|
642 | + if (give_get_option('email_template') !== 'none') { |
|
643 | 643 | return $formatted; |
644 | 644 | } else { |
645 | 645 | return $receipt_url; |
@@ -658,12 +658,12 @@ discard block |
||
658 | 658 | * |
659 | 659 | * @return string receipt_url |
660 | 660 | */ |
661 | -function give_email_tag_receipt_link_url( $payment_id ) { |
|
661 | +function give_email_tag_receipt_link_url($payment_id) { |
|
662 | 662 | |
663 | - $receipt_url = esc_url( add_query_arg( array( |
|
664 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
663 | + $receipt_url = esc_url(add_query_arg(array( |
|
664 | + 'payment_key' => give_get_payment_key($payment_id), |
|
665 | 665 | 'give_action' => 'view_receipt' |
666 | - ), home_url() ) ); |
|
666 | + ), home_url())); |
|
667 | 667 | |
668 | 668 | return $receipt_url; |
669 | 669 |
@@ -530,7 +530,7 @@ |
||
530 | 530 | * |
531 | 531 | * @param int $payment_id |
532 | 532 | * |
533 | - * @return int payment_id |
|
533 | + * @return string payment_id |
|
534 | 534 | */ |
535 | 535 | function give_email_tag_payment_id( $payment_id ) { |
536 | 536 | $payment = new Give_Payment( $payment_id ); |