@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 13 | +if ( ! defined('ABSPATH')) {
|
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
| 17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
|
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array |
| 25 | 25 | */ |
| 26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
|
|
| 26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
|
|
| 27 | 27 | |
| 28 | 28 | $post_id = give_get_admin_post_id(); |
| 29 | - $price = give_get_form_price( $post_id ); |
|
| 30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
| 31 | - $goal = give_get_form_goal( $post_id ); |
|
| 32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
| 33 | - $prices = give_get_variable_prices( $post_id ); |
|
| 29 | + $price = give_get_form_price($post_id); |
|
| 30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
| 31 | + $goal = give_get_form_goal($post_id); |
|
| 32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
| 33 | + $prices = give_get_variable_prices($post_id); |
|
| 34 | 34 | |
| 35 | 35 | //No empty prices - min. 1.00 for new forms |
| 36 | - if ( empty( $price ) && is_null( $post_id ) ) {
|
|
| 37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
| 36 | + if (empty($price) && is_null($post_id)) {
|
|
| 37 | + $price = esc_attr(give_format_amount('1.00'));
|
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | //Min. $1.00 for new forms |
| 41 | - if ( empty( $custom_amount_minimum ) ) {
|
|
| 42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
| 41 | + if (empty($custom_amount_minimum)) {
|
|
| 42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00'));
|
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,302 +48,302 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * Repeatable Field Groups |
| 50 | 50 | */ |
| 51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
| 51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
|
|
| 52 | 52 | 'id' => 'form_field_options', |
| 53 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 54 | - 'object_types' => array( 'give_forms' ), |
|
| 53 | + 'title' => __('Donation Options', 'give'),
|
|
| 54 | + 'object_types' => array('give_forms'),
|
|
| 55 | 55 | 'context' => 'normal', |
| 56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
| 57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(
|
|
| 58 | 58 | //Donation Option |
| 59 | 59 | array( |
| 60 | - 'name' => __( 'Donation Option', 'give' ), |
|
| 61 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give' ), |
|
| 62 | - 'id' => $prefix . 'price_option', |
|
| 60 | + 'name' => __('Donation Option', 'give'),
|
|
| 61 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give'),
|
|
| 62 | + 'id' => $prefix.'price_option', |
|
| 63 | 63 | 'type' => 'radio_inline', |
| 64 | 64 | 'default' => 'set', |
| 65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 66 | - 'set' => __( 'Set Donation', 'give' ), |
|
| 67 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
| 68 | - ) ), |
|
| 65 | + 'options' => apply_filters('give_forms_price_options', array(
|
|
| 66 | + 'set' => __('Set Donation', 'give'),
|
|
| 67 | + 'multi' => __('Multi-level Donation', 'give'),
|
|
| 68 | + )), |
|
| 69 | 69 | ), |
| 70 | 70 | array( |
| 71 | - 'name' => __( 'Set Donation', 'give' ), |
|
| 72 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
| 73 | - 'id' => $prefix . 'set_price', |
|
| 71 | + 'name' => __('Set Donation', 'give'),
|
|
| 72 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
|
|
| 73 | + 'id' => $prefix.'set_price', |
|
| 74 | 74 | 'type' => 'text_small', |
| 75 | 75 | 'row_classes' => 'give-subfield', |
| 76 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 77 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 76 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 77 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 78 | 78 | 'attributes' => array( |
| 79 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 80 | - 'value' => give_format_amount( $price ), |
|
| 79 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 80 | + 'value' => give_format_amount($price), |
|
| 81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
| 82 | 82 | ), |
| 83 | 83 | ), |
| 84 | 84 | //Donation levels: Header |
| 85 | 85 | array( |
| 86 | - 'id' => $prefix . 'levels_header', |
|
| 86 | + 'id' => $prefix.'levels_header', |
|
| 87 | 87 | 'type' => 'levels_repeater_header', |
| 88 | 88 | ), |
| 89 | 89 | //Donation Levels: Repeatable CMB2 Group |
| 90 | 90 | array( |
| 91 | - 'id' => $prefix . 'donation_levels', |
|
| 91 | + 'id' => $prefix.'donation_levels', |
|
| 92 | 92 | 'type' => 'group', |
| 93 | 93 | 'row_classes' => 'give-subfield', |
| 94 | 94 | 'options' => array( |
| 95 | - 'add_button' => __( 'Add Level', 'give' ), |
|
| 96 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
| 95 | + 'add_button' => __('Add Level', 'give'),
|
|
| 96 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'),
|
|
| 97 | 97 | 'sortable' => true, // beta |
| 98 | 98 | ), |
| 99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
| 100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 100 | + 'fields' => apply_filters('give_donation_levels_table_row', array(
|
|
| 101 | 101 | array( |
| 102 | - 'name' => __( 'ID', 'give' ), |
|
| 103 | - 'id' => $prefix . 'id', |
|
| 102 | + 'name' => __('ID', 'give'),
|
|
| 103 | + 'id' => $prefix.'id', |
|
| 104 | 104 | 'type' => 'levels_id', |
| 105 | 105 | ), |
| 106 | 106 | array( |
| 107 | - 'name' => __( 'Amount', 'give' ), |
|
| 108 | - 'id' => $prefix . 'amount', |
|
| 107 | + 'name' => __('Amount', 'give'),
|
|
| 108 | + 'id' => $prefix.'amount', |
|
| 109 | 109 | 'type' => 'text_small', |
| 110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 112 | 112 | 'attributes' => array( |
| 113 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 113 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 114 | 114 | 'class' => 'cmb-type-text-small give-money-field', |
| 115 | 115 | ), |
| 116 | 116 | 'before' => 'give_format_admin_multilevel_amount', |
| 117 | 117 | ), |
| 118 | 118 | array( |
| 119 | - 'name' => __( 'Text', 'give' ), |
|
| 120 | - 'id' => $prefix . 'text', |
|
| 119 | + 'name' => __('Text', 'give'),
|
|
| 120 | + 'id' => $prefix.'text', |
|
| 121 | 121 | 'type' => 'text', |
| 122 | 122 | 'attributes' => array( |
| 123 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
| 123 | + 'placeholder' => __('Donation Level', 'give'),
|
|
| 124 | 124 | 'class' => 'give-multilevel-text-field', |
| 125 | 125 | ), |
| 126 | 126 | ), |
| 127 | 127 | array( |
| 128 | - 'name' => __( 'Default', 'give' ), |
|
| 129 | - 'id' => $prefix . 'default', |
|
| 128 | + 'name' => __('Default', 'give'),
|
|
| 129 | + 'id' => $prefix.'default', |
|
| 130 | 130 | 'type' => 'give_default_radio_inline' |
| 131 | 131 | ), |
| 132 | - ) ), |
|
| 132 | + )), |
|
| 133 | 133 | ), |
| 134 | 134 | //Display Style |
| 135 | 135 | array( |
| 136 | - 'name' => __( 'Display Style', 'give' ), |
|
| 137 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 138 | - 'id' => $prefix . 'display_style', |
|
| 136 | + 'name' => __('Display Style', 'give'),
|
|
| 137 | + 'description' => __('Set how the donations levels will display on the form.', 'give'),
|
|
| 138 | + 'id' => $prefix.'display_style', |
|
| 139 | 139 | 'type' => 'radio_inline', |
| 140 | 140 | 'default' => 'buttons', |
| 141 | 141 | 'options' => array( |
| 142 | - 'buttons' => __( 'Buttons', 'give' ), |
|
| 143 | - 'radios' => __( 'Radios', 'give' ), |
|
| 144 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
| 142 | + 'buttons' => __('Buttons', 'give'),
|
|
| 143 | + 'radios' => __('Radios', 'give'),
|
|
| 144 | + 'dropdown' => __('Dropdown', 'give'),
|
|
| 145 | 145 | ), |
| 146 | 146 | ), |
| 147 | 147 | //Custom Amount |
| 148 | 148 | array( |
| 149 | - 'name' => __( 'Custom Amount', 'give' ), |
|
| 150 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 151 | - 'id' => $prefix . 'custom_amount', |
|
| 149 | + 'name' => __('Custom Amount', 'give'),
|
|
| 150 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
|
|
| 151 | + 'id' => $prefix.'custom_amount', |
|
| 152 | 152 | 'type' => 'radio_inline', |
| 153 | 153 | 'default' => 'no', |
| 154 | 154 | 'options' => array( |
| 155 | - 'yes' => __( 'Yes', 'give' ), |
|
| 156 | - 'no' => __( 'No', 'give' ), |
|
| 155 | + 'yes' => __('Yes', 'give'),
|
|
| 156 | + 'no' => __('No', 'give'),
|
|
| 157 | 157 | ), |
| 158 | 158 | ), |
| 159 | 159 | array( |
| 160 | - 'name' => __( 'Custom Amount Minimum', 'give' ), |
|
| 161 | - 'description' => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
| 162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 160 | + 'name' => __('Custom Amount Minimum', 'give'),
|
|
| 161 | + 'description' => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
|
|
| 162 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 163 | 163 | 'type' => 'text_small', |
| 164 | 164 | 'row_classes' => 'give-subfield', |
| 165 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 166 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 165 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 166 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 167 | 167 | 'attributes' => array( |
| 168 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 169 | - 'value' => give_format_amount( $custom_amount_minimum ), |
|
| 168 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 169 | + 'value' => give_format_amount($custom_amount_minimum), |
|
| 170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
| 171 | 171 | ), |
| 172 | 172 | ), |
| 173 | 173 | array( |
| 174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
| 175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
| 176 | - 'id' => $prefix . 'custom_amount_text', |
|
| 174 | + 'name' => __('Custom Amount Text', 'give'),
|
|
| 175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
|
|
| 176 | + 'id' => $prefix.'custom_amount_text', |
|
| 177 | 177 | 'type' => 'text', |
| 178 | 178 | 'row_classes' => 'give-subfield', |
| 179 | 179 | 'attributes' => array( |
| 180 | 180 | 'rows' => 3, |
| 181 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
| 181 | + 'placeholder' => __('Give a Custom Amount', 'give'),
|
|
| 182 | 182 | ), |
| 183 | 183 | ), |
| 184 | 184 | //Goals |
| 185 | 185 | array( |
| 186 | - 'name' => __( 'Set Goal?', 'give' ), |
|
| 187 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 188 | - 'id' => $prefix . 'goal_option', |
|
| 186 | + 'name' => __('Set Goal?', 'give'),
|
|
| 187 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'),
|
|
| 188 | + 'id' => $prefix.'goal_option', |
|
| 189 | 189 | 'type' => 'radio_inline', |
| 190 | 190 | 'default' => 'no', |
| 191 | 191 | 'options' => array( |
| 192 | - 'yes' => __( 'Yes', 'give' ), |
|
| 193 | - 'no' => __( 'No', 'give' ), |
|
| 192 | + 'yes' => __('Yes', 'give'),
|
|
| 193 | + 'no' => __('No', 'give'),
|
|
| 194 | 194 | ), |
| 195 | 195 | ), |
| 196 | 196 | array( |
| 197 | - 'name' => __( 'Set Goal', 'give' ), |
|
| 198 | - 'description' => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
| 199 | - 'id' => $prefix . 'set_goal', |
|
| 197 | + 'name' => __('Set Goal', 'give'),
|
|
| 198 | + 'description' => __('This is the monetary goal amount you want to reach for this donation form.', 'give'),
|
|
| 199 | + 'id' => $prefix.'set_goal', |
|
| 200 | 200 | 'type' => 'text_small', |
| 201 | 201 | 'row_classes' => 'give-subfield', |
| 202 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 203 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 202 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 203 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 204 | 204 | 'attributes' => array( |
| 205 | - 'placeholder' => give_format_amount( '0.00' ), |
|
| 206 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
| 205 | + 'placeholder' => give_format_amount('0.00'),
|
|
| 206 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
| 207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
| 208 | 208 | ), |
| 209 | 209 | ), |
| 210 | 210 | |
| 211 | 211 | array( |
| 212 | - 'name' => __( 'Goal Format', 'give' ), |
|
| 213 | - 'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
| 214 | - 'id' => $prefix . 'goal_format', |
|
| 212 | + 'name' => __('Goal Format', 'give'),
|
|
| 213 | + 'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
|
|
| 214 | + 'id' => $prefix.'goal_format', |
|
| 215 | 215 | 'type' => 'radio_inline', |
| 216 | 216 | 'default' => 'amount', |
| 217 | 217 | 'row_classes' => 'give-subfield', |
| 218 | 218 | 'options' => array( |
| 219 | - 'amount' => __( 'Amount ', 'give' ), |
|
| 220 | - 'percentage' => __( 'Percentage', 'give' ), |
|
| 219 | + 'amount' => __('Amount ', 'give'),
|
|
| 220 | + 'percentage' => __('Percentage', 'give'),
|
|
| 221 | 221 | ), |
| 222 | 222 | ), |
| 223 | 223 | array( |
| 224 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
| 225 | - 'id' => $prefix . 'goal_color', |
|
| 224 | + 'name' => __('Goal Progress Bar Color', 'give'),
|
|
| 225 | + 'id' => $prefix.'goal_color', |
|
| 226 | 226 | 'type' => 'colorpicker', |
| 227 | 227 | 'row_classes' => 'give-subfield', |
| 228 | 228 | 'default' => '#2bc253', |
| 229 | 229 | ), |
| 230 | 230 | ) |
| 231 | 231 | ) |
| 232 | - ) ); |
|
| 232 | + )); |
|
| 233 | 233 | |
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * Content Field |
| 237 | 237 | */ |
| 238 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
| 238 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
|
|
| 239 | 239 | 'id' => 'form_content_options', |
| 240 | - 'title' => __( 'Form Content', 'give' ), |
|
| 241 | - 'object_types' => array( 'give_forms' ), |
|
| 240 | + 'title' => __('Form Content', 'give'),
|
|
| 241 | + 'object_types' => array('give_forms'),
|
|
| 242 | 242 | 'context' => 'normal', |
| 243 | 243 | 'priority' => 'high', //Show above Content WYSIWYG |
| 244 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 244 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array(
|
|
| 245 | 245 | //Donation Option |
| 246 | 246 | array( |
| 247 | - 'name' => __( 'Display Content', 'give' ), |
|
| 248 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
| 249 | - 'id' => $prefix . 'content_option', |
|
| 247 | + 'name' => __('Display Content', 'give'),
|
|
| 248 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'),
|
|
| 249 | + 'id' => $prefix.'content_option', |
|
| 250 | 250 | 'type' => 'select', |
| 251 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 252 | - 'none' => __( 'No content', 'give' ), |
|
| 253 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
| 254 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
| 251 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 252 | + 'none' => __('No content', 'give'),
|
|
| 253 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'),
|
|
| 254 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'),
|
|
| 255 | 255 | ) |
| 256 | 256 | ), |
| 257 | 257 | 'default' => 'none', |
| 258 | 258 | ), |
| 259 | 259 | array( |
| 260 | - 'name' => __( 'Content', 'give' ), |
|
| 261 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
| 262 | - 'id' => $prefix . 'form_content', |
|
| 260 | + 'name' => __('Content', 'give'),
|
|
| 261 | + 'description' => __('This content will display on the single give form page.', 'give'),
|
|
| 262 | + 'id' => $prefix.'form_content', |
|
| 263 | 263 | 'row_classes' => 'give-subfield', |
| 264 | 264 | 'type' => 'wysiwyg' |
| 265 | 265 | ), |
| 266 | 266 | ) |
| 267 | 267 | ) |
| 268 | - ) ); |
|
| 268 | + )); |
|
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * Display Options |
| 273 | 273 | */ |
| 274 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
| 274 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
|
|
| 275 | 275 | 'id' => 'form_display_options', |
| 276 | - 'title' => __( 'Form Display Options', 'give' ), |
|
| 277 | - 'object_types' => array( 'give_forms' ), |
|
| 276 | + 'title' => __('Form Display Options', 'give'),
|
|
| 277 | + 'object_types' => array('give_forms'),
|
|
| 278 | 278 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
| 279 | 279 | 'priority' => 'high', //Show above Content WYSIWYG |
| 280 | 280 | 'show_names' => true, // Show field names on the left |
| 281 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 281 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array(
|
|
| 282 | 282 | array( |
| 283 | - 'name' => __( 'Payment Fields', 'give' ), |
|
| 284 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
| 285 | - 'id' => $prefix . 'payment_display', |
|
| 283 | + 'name' => __('Payment Fields', 'give'),
|
|
| 284 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
|
|
| 285 | + 'id' => $prefix.'payment_display', |
|
| 286 | 286 | 'type' => 'select', |
| 287 | 287 | 'options' => array( |
| 288 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
| 289 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
| 290 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
| 288 | + 'onpage' => __('Show on Page', 'give'),
|
|
| 289 | + 'reveal' => __('Reveal Upon Click', 'give'),
|
|
| 290 | + 'modal' => __('Modal Window Upon Click', 'give'),
|
|
| 291 | 291 | ), |
| 292 | 292 | 'default' => 'onpage', |
| 293 | 293 | ), |
| 294 | 294 | array( |
| 295 | - 'id' => $prefix . 'reveal_label', |
|
| 296 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
| 297 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
| 295 | + 'id' => $prefix.'reveal_label', |
|
| 296 | + 'name' => __('Reveal / Modal Open Text', 'give'),
|
|
| 297 | + 'desc' => __('The button label for completing the donation.', 'give'),
|
|
| 298 | 298 | 'type' => 'text_small', |
| 299 | 299 | 'row_classes' => 'give-subfield', |
| 300 | 300 | 'attributes' => array( |
| 301 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 301 | + 'placeholder' => __('Donate Now', 'give'),
|
|
| 302 | 302 | ), |
| 303 | 303 | ), |
| 304 | 304 | array( |
| 305 | - 'id' => $prefix . 'checkout_label', |
|
| 306 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
| 307 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
| 305 | + 'id' => $prefix.'checkout_label', |
|
| 306 | + 'name' => __('Complete Donation Text', 'give'),
|
|
| 307 | + 'desc' => __('The button label for completing a donation.', 'give'),
|
|
| 308 | 308 | 'type' => 'text_small', |
| 309 | 309 | 'attributes' => array( |
| 310 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 310 | + 'placeholder' => __('Donate Now', 'give'),
|
|
| 311 | 311 | ), |
| 312 | 312 | ), |
| 313 | 313 | array( |
| 314 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 315 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
| 316 | - 'id' => $prefix . 'default_gateway', |
|
| 314 | + 'name' => __('Default Gateway', 'give'),
|
|
| 315 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
|
|
| 316 | + 'id' => $prefix.'default_gateway', |
|
| 317 | 317 | 'type' => 'default_gateway' |
| 318 | 318 | ), |
| 319 | 319 | array( |
| 320 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
| 321 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
| 322 | - 'id' => $prefix . 'logged_in_only', |
|
| 320 | + 'name' => __('Disable Guest Donations', 'give'),
|
|
| 321 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'),
|
|
| 322 | + 'id' => $prefix.'logged_in_only', |
|
| 323 | 323 | 'type' => 'checkbox' |
| 324 | 324 | ), |
| 325 | 325 | array( |
| 326 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
| 327 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 328 | - 'id' => $prefix . 'show_register_form', |
|
| 326 | + 'name' => __('Register / Login Form', 'give'),
|
|
| 327 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
|
|
| 328 | + 'id' => $prefix.'show_register_form', |
|
| 329 | 329 | 'type' => 'select', |
| 330 | 330 | 'options' => array( |
| 331 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
| 332 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
| 333 | - 'login' => __( 'Login Form Only', 'give' ), |
|
| 334 | - 'none' => __( 'None', 'give' ), |
|
| 331 | + 'both' => __('Registration and Login Forms', 'give'),
|
|
| 332 | + 'registration' => __('Registration Form Only', 'give'),
|
|
| 333 | + 'login' => __('Login Form Only', 'give'),
|
|
| 334 | + 'none' => __('None', 'give'),
|
|
| 335 | 335 | ), |
| 336 | 336 | 'default' => 'none', |
| 337 | 337 | ), |
| 338 | 338 | array( |
| 339 | - 'name' => __( 'Floating Labels', 'give' ), |
|
| 340 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
| 341 | - 'id' => $prefix . 'form_floating_labels', |
|
| 339 | + 'name' => __('Floating Labels', 'give'),
|
|
| 340 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")),
|
|
| 341 | + 'id' => $prefix.'form_floating_labels', |
|
| 342 | 342 | 'type' => 'select', |
| 343 | 343 | 'options' => array( |
| 344 | - '' => __( 'Use the global setting', 'give' ), |
|
| 345 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 346 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 344 | + '' => __('Use the global setting', 'give'),
|
|
| 345 | + 'enabled' => __('Enabled', 'give'),
|
|
| 346 | + 'disabled' => __('Disabled', 'give'),
|
|
| 347 | 347 | ), |
| 348 | 348 | 'default' => 'none', |
| 349 | 349 | ) |
@@ -355,47 +355,47 @@ discard block |
||
| 355 | 355 | /** |
| 356 | 356 | * Terms & Conditions |
| 357 | 357 | */ |
| 358 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
| 358 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
|
|
| 359 | 359 | 'id' => 'form_terms_options', |
| 360 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
| 361 | - 'object_types' => array( 'give_forms' ), |
|
| 360 | + 'title' => __('Terms and Conditions', 'give'),
|
|
| 361 | + 'object_types' => array('give_forms'),
|
|
| 362 | 362 | 'context' => 'normal', |
| 363 | 363 | 'priority' => 'high', //Show above Content WYSIWYG |
| 364 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 364 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(
|
|
| 365 | 365 | //Donation Option |
| 366 | 366 | array( |
| 367 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
| 368 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
| 369 | - 'id' => $prefix . 'terms_option', |
|
| 367 | + 'name' => __('Terms and Conditions', 'give'),
|
|
| 368 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
|
|
| 369 | + 'id' => $prefix.'terms_option', |
|
| 370 | 370 | 'type' => 'select', |
| 371 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 372 | - 'none' => __( 'No', 'give' ), |
|
| 373 | - 'yes' => __( 'Yes', 'give' ), |
|
| 371 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 372 | + 'none' => __('No', 'give'),
|
|
| 373 | + 'yes' => __('Yes', 'give'),
|
|
| 374 | 374 | ) |
| 375 | 375 | ), |
| 376 | 376 | 'default' => 'none', |
| 377 | 377 | ), |
| 378 | 378 | array( |
| 379 | - 'id' => $prefix . 'agree_label', |
|
| 380 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
| 381 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
| 379 | + 'id' => $prefix.'agree_label', |
|
| 380 | + 'name' => __('Agree to Terms Label', 'give'),
|
|
| 381 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
|
|
| 382 | 382 | 'type' => 'text', |
| 383 | 383 | 'row_classes' => 'give-subfield', |
| 384 | 384 | 'size' => 'regular', |
| 385 | 385 | 'attributes' => array( |
| 386 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
| 386 | + 'placeholder' => __('Agree to Terms?', 'give'),
|
|
| 387 | 387 | ), |
| 388 | 388 | ), |
| 389 | 389 | array( |
| 390 | - 'id' => $prefix . 'agree_text', |
|
| 390 | + 'id' => $prefix.'agree_text', |
|
| 391 | 391 | 'row_classes' => 'give-subfield', |
| 392 | - 'name' => __( 'Agreement Text', 'give' ), |
|
| 393 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 392 | + 'name' => __('Agreement Text', 'give'),
|
|
| 393 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
|
|
| 394 | 394 | 'type' => 'wysiwyg' |
| 395 | 395 | ), |
| 396 | 396 | ) |
| 397 | 397 | ) |
| 398 | - ) ); |
|
| 398 | + )); |
|
| 399 | 399 | |
| 400 | 400 | return $meta_boxes; |
| 401 | 401 | |
@@ -409,18 +409,18 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | <div class="table-container"> |
| 411 | 411 | <div class="table-row"> |
| 412 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
| 413 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
| 414 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
| 415 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
| 416 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
| 412 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div>
|
|
| 413 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div>
|
|
| 414 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div>
|
|
| 415 | + <?php do_action('give_donation_levels_table_head'); ?>
|
|
| 416 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div>
|
|
| 417 | 417 | |
| 418 | 418 | </div> |
| 419 | 419 | </div> |
| 420 | 420 | |
| 421 | 421 | <?php |
| 422 | 422 | } |
| 423 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
| 423 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
|
|
| 424 | 424 | |
| 425 | 425 | |
| 426 | 426 | /** |
@@ -437,24 +437,24 @@ discard block |
||
| 437 | 437 | * @param $object_type |
| 438 | 438 | * @param $field_type_object |
| 439 | 439 | */ |
| 440 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 440 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 441 | 441 | |
| 442 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
| 442 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
| 443 | 443 | |
| 444 | 444 | $field_options_array = array( |
| 445 | 445 | 'class' => 'give-hidden give-level-id-input', |
| 446 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
| 447 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
| 446 | + 'name' => $field_type_object->_name('[level_id]'),
|
|
| 447 | + 'id' => $field_type_object->_id('_level_id'),
|
|
| 448 | 448 | 'value' => $escaped_value, |
| 449 | 449 | 'type' => 'number', |
| 450 | 450 | 'desc' => '', |
| 451 | 451 | ); |
| 452 | 452 | |
| 453 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
| 454 | - echo $field_type_object->input( $field_options_array ); |
|
| 453 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
| 454 | + echo $field_type_object->input($field_options_array); |
|
| 455 | 455 | |
| 456 | 456 | } |
| 457 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
| 457 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
|
|
| 458 | 458 | |
| 459 | 459 | |
| 460 | 460 | /** |
@@ -466,13 +466,13 @@ discard block |
||
| 466 | 466 | * @param $object_type |
| 467 | 467 | * @param $field_type_object |
| 468 | 468 | */ |
| 469 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 470 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
| 471 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
| 469 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 470 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
|
|
| 471 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
| 472 | 472 | |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
| 475 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
|
|
| 476 | 476 | |
| 477 | 477 | |
| 478 | 478 | /** |
@@ -482,20 +482,20 @@ discard block |
||
| 482 | 482 | */ |
| 483 | 483 | function give_add_shortcode_to_publish_metabox() {
|
| 484 | 484 | |
| 485 | - if ( 'give_forms' !== get_post_type() ) {
|
|
| 485 | + if ('give_forms' !== get_post_type()) {
|
|
| 486 | 486 | return false; |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | global $post; |
| 490 | 490 | |
| 491 | 491 | //Only enqueue scripts for CPT on post type screen |
| 492 | - if ( 'give_forms' === $post->post_type ) {
|
|
| 492 | + if ('give_forms' === $post->post_type) {
|
|
| 493 | 493 | //Shortcode column with select all input |
| 494 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
| 495 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
| 494 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
|
|
| 495 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
|
|
| 496 | 496 | |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
| 501 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
|
|
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | // Exit if accessed directly |
| 43 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 43 | +if ( ! defined('ABSPATH')) {
|
|
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if ( ! class_exists( 'Give' ) ) : |
|
| 47 | +if ( ! class_exists('Give')) :
|
|
| 48 | 48 | /** |
| 49 | 49 | * Main Give Class |
| 50 | 50 | * |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | * @return Give |
| 160 | 160 | */ |
| 161 | 161 | public static function instance() {
|
| 162 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
|
|
| 162 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
|
|
| 163 | 163 | self::$instance = new Give; |
| 164 | 164 | self::$instance->setup_constants(); |
| 165 | 165 | |
| 166 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
| 166 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
|
|
| 167 | 167 | |
| 168 | 168 | self::$instance->includes(); |
| 169 | 169 | self::$instance->roles = new Give_Roles(); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function __clone() {
|
| 197 | 197 | // Cloning instances of the class is forbidden |
| 198 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 198 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function __wakeup() {
|
| 209 | 209 | // Unserializing instances of the class is forbidden |
| 210 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 210 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -220,33 +220,33 @@ discard block |
||
| 220 | 220 | private function setup_constants() {
|
| 221 | 221 | |
| 222 | 222 | // Plugin version |
| 223 | - if ( ! defined( 'GIVE_VERSION' ) ) {
|
|
| 224 | - define( 'GIVE_VERSION', '1.4.2' ); |
|
| 223 | + if ( ! defined('GIVE_VERSION')) {
|
|
| 224 | + define('GIVE_VERSION', '1.4.2');
|
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // Plugin Folder Path |
| 228 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
|
|
| 229 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 228 | + if ( ! defined('GIVE_PLUGIN_DIR')) {
|
|
| 229 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // Plugin Folder URL |
| 233 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
|
|
| 234 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 233 | + if ( ! defined('GIVE_PLUGIN_URL')) {
|
|
| 234 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Plugin Basename aka: "give/give.php" |
| 238 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
|
|
| 239 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
| 238 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) {
|
|
| 239 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Plugin Root File |
| 243 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
|
|
| 244 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
| 243 | + if ( ! defined('GIVE_PLUGIN_FILE')) {
|
|
| 244 | + define('GIVE_PLUGIN_FILE', __FILE__);
|
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // Make sure CAL_GREGORIAN is defined |
| 248 | - if ( ! defined( 'CAL_GREGORIAN' ) ) {
|
|
| 249 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 248 | + if ( ! defined('CAL_GREGORIAN')) {
|
|
| 249 | + define('CAL_GREGORIAN', 1);
|
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
@@ -260,107 +260,107 @@ discard block |
||
| 260 | 260 | private function includes() {
|
| 261 | 261 | global $give_options; |
| 262 | 262 | |
| 263 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/register-settings.php'; |
|
| 263 | + require_once GIVE_PLUGIN_DIR.'includes/admin/register-settings.php'; |
|
| 264 | 264 | $give_options = give_get_settings(); |
| 265 | 265 | |
| 266 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
| 267 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
| 268 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
| 269 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
| 270 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
| 271 | - |
|
| 272 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
| 273 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
| 274 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
| 275 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
| 276 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
| 277 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
| 278 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
| 279 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
| 280 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
| 281 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
| 282 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
| 283 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
| 284 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
| 285 | - |
|
| 286 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
| 287 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
| 288 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
| 289 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
| 290 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
| 291 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
| 292 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
| 293 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
| 294 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
| 295 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
| 296 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
| 297 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
| 298 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
| 299 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
| 300 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
| 301 | - |
|
| 302 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
| 303 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
| 304 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
| 305 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
| 306 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-donators-gravatars.php'; |
|
| 307 | - |
|
| 308 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
| 309 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
| 310 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
| 311 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
| 312 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
| 313 | - |
|
| 314 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
| 315 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
| 316 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
| 317 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
| 318 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
| 319 | - |
|
| 320 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
|
| 321 | - |
|
| 322 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
| 323 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
| 324 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
| 325 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
| 326 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
| 327 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
| 328 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 329 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/export-functions.php'; |
|
| 330 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 332 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 333 | - |
|
| 334 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 335 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 336 | - |
|
| 337 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 338 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 339 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 340 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 341 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 342 | - |
|
| 343 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 344 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
| 345 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 346 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 347 | - |
|
| 348 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 349 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 350 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 351 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 352 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 353 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 354 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 355 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 356 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 357 | - |
|
| 358 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 359 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
| 266 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
| 267 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
| 268 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
| 269 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
| 270 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
| 271 | + |
|
| 272 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
| 273 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
| 274 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
| 275 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
| 276 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
| 277 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
| 278 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
| 279 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
| 280 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
| 281 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
| 282 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
| 283 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
| 284 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
| 285 | + |
|
| 286 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
| 287 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
| 288 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
| 289 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
| 290 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
| 291 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
| 292 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
| 293 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
| 294 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
| 295 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
| 296 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
| 297 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
| 298 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
| 299 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
| 300 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
| 301 | + |
|
| 302 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
| 303 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
| 304 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
| 305 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
| 306 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-donators-gravatars.php'; |
|
| 307 | + |
|
| 308 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
| 309 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
| 310 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
| 311 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
| 312 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
| 313 | + |
|
| 314 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
| 315 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
| 316 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
| 317 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
| 318 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
| 319 | + |
|
| 320 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
|
|
| 321 | + |
|
| 322 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
| 323 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
| 324 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
| 325 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
| 326 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
| 327 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
| 328 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 329 | + require_once GIVE_PLUGIN_DIR.'includes/admin/export-functions.php'; |
|
| 330 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 332 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 333 | + |
|
| 334 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 335 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 336 | + |
|
| 337 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 338 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 339 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 340 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 341 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 342 | + |
|
| 343 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 344 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
| 345 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 346 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 347 | + |
|
| 348 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 349 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 350 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 351 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 352 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 353 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 354 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 355 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 356 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 357 | + |
|
| 358 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 359 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 360 | 360 | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 363 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 364 | 364 | |
| 365 | 365 | } |
| 366 | 366 | |
@@ -373,26 +373,26 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | public function load_textdomain() {
|
| 375 | 375 | // Set filter for Give's languages directory |
| 376 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 377 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 376 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 377 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 378 | 378 | |
| 379 | 379 | // Traditional WordPress plugin locale filter |
| 380 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 381 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 380 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 381 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 382 | 382 | |
| 383 | 383 | // Setup paths to current locale file |
| 384 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 385 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 384 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 385 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 386 | 386 | |
| 387 | - if ( file_exists( $mofile_global ) ) {
|
|
| 387 | + if (file_exists($mofile_global)) {
|
|
| 388 | 388 | // Look in global /wp-content/languages/give folder |
| 389 | - load_textdomain( 'give', $mofile_global ); |
|
| 390 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 389 | + load_textdomain('give', $mofile_global);
|
|
| 390 | + } elseif (file_exists($mofile_local)) {
|
|
| 391 | 391 | // Look in local location from filter `give_languages_directory` |
| 392 | - load_textdomain( 'give', $mofile_local ); |
|
| 392 | + load_textdomain('give', $mofile_local);
|
|
| 393 | 393 | } else {
|
| 394 | 394 | // Load the default language files packaged up w/ Give |
| 395 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 395 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | } |