@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function __construct() { |
| 48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
| 49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
| 49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
| 50 | 50 | |
| 51 | 51 | // Setup. |
| 52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
| 52 | + add_action('admin_init', array($this, 'setup')); |
|
| 53 | 53 | |
| 54 | 54 | // Add metabox. |
| 55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
| 55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
| 56 | 56 | |
| 57 | 57 | // Save form meta. |
| 58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
| 58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
| 59 | 59 | |
| 60 | 60 | // cmb2 old setting loaders. |
| 61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
| 62 | 62 | // Add offline donations options. |
| 63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
| 63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -83,18 +83,18 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function get_settings() { |
| 85 | 85 | $post_id = give_get_admin_post_id(); |
| 86 | - $price = give_get_form_price( $post_id ); |
|
| 87 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
| 88 | - $goal = give_get_form_goal( $post_id ); |
|
| 86 | + $price = give_get_form_price($post_id); |
|
| 87 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
| 88 | + $goal = give_get_form_goal($post_id); |
|
| 89 | 89 | |
| 90 | 90 | // No empty prices - min. 1.00 for new forms |
| 91 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
| 92 | - $price = esc_attr( give_format_decimal( '1.00' ) ); |
|
| 91 | + if (empty($price) && is_null($post_id)) { |
|
| 92 | + $price = esc_attr(give_format_decimal('1.00')); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Min. $1.00 for new forms |
| 96 | - if ( empty( $custom_amount_minimum ) ) { |
|
| 97 | - $custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) ); |
|
| 96 | + if (empty($custom_amount_minimum)) { |
|
| 97 | + $custom_amount_minimum = esc_attr(give_format_decimal('1.00')); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Start with an underscore to hide fields from custom fields list |
@@ -104,215 +104,215 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * Repeatable Field Groups |
| 106 | 106 | */ |
| 107 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
| 107 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
| 108 | 108 | 'id' => 'form_field_options', |
| 109 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 109 | + 'title' => __('Donation Options', 'give'), |
|
| 110 | 110 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
| 111 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 111 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
| 112 | 112 | // Donation Option |
| 113 | 113 | array( |
| 114 | - 'name' => __( 'Donation Option', 'give' ), |
|
| 115 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
| 116 | - 'id' => $prefix . 'price_option', |
|
| 114 | + 'name' => __('Donation Option', 'give'), |
|
| 115 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
| 116 | + 'id' => $prefix.'price_option', |
|
| 117 | 117 | 'type' => 'radio_inline', |
| 118 | 118 | 'default' => 'set', |
| 119 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 120 | - 'set' => __( 'Set Donation', 'give' ), |
|
| 121 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
| 122 | - ) ), |
|
| 119 | + 'options' => apply_filters('give_forms_price_options', array( |
|
| 120 | + 'set' => __('Set Donation', 'give'), |
|
| 121 | + 'multi' => __('Multi-level Donation', 'give'), |
|
| 122 | + )), |
|
| 123 | 123 | ), |
| 124 | 124 | array( |
| 125 | - 'name' => __( 'Set Donation', 'give' ), |
|
| 126 | - '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' ), |
|
| 127 | - 'id' => $prefix . 'set_price', |
|
| 125 | + 'name' => __('Set Donation', 'give'), |
|
| 126 | + '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'), |
|
| 127 | + 'id' => $prefix.'set_price', |
|
| 128 | 128 | 'type' => 'text_small', |
| 129 | 129 | 'data_type' => 'price', |
| 130 | 130 | 'attributes' => array( |
| 131 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 132 | - 'value' => give_format_decimal( $price ), |
|
| 131 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 132 | + 'value' => give_format_decimal($price), |
|
| 133 | 133 | 'class' => 'give-money-field', |
| 134 | 134 | ), |
| 135 | 135 | ), |
| 136 | 136 | // Display Style |
| 137 | 137 | array( |
| 138 | - 'name' => __( 'Display Style', 'give' ), |
|
| 139 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 140 | - 'id' => $prefix . 'display_style', |
|
| 138 | + 'name' => __('Display Style', 'give'), |
|
| 139 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
| 140 | + 'id' => $prefix.'display_style', |
|
| 141 | 141 | 'type' => 'radio_inline', |
| 142 | 142 | 'default' => 'buttons', |
| 143 | 143 | 'options' => array( |
| 144 | - 'buttons' => __( 'Buttons', 'give' ), |
|
| 145 | - 'radios' => __( 'Radios', 'give' ), |
|
| 146 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
| 144 | + 'buttons' => __('Buttons', 'give'), |
|
| 145 | + 'radios' => __('Radios', 'give'), |
|
| 146 | + 'dropdown' => __('Dropdown', 'give'), |
|
| 147 | 147 | ), |
| 148 | 148 | ), |
| 149 | 149 | // Custom Amount |
| 150 | 150 | array( |
| 151 | - 'name' => __( 'Custom Amount', 'give' ), |
|
| 152 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 153 | - 'id' => $prefix . 'custom_amount', |
|
| 151 | + 'name' => __('Custom Amount', 'give'), |
|
| 152 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
| 153 | + 'id' => $prefix.'custom_amount', |
|
| 154 | 154 | 'type' => 'radio_inline', |
| 155 | 155 | 'default' => 'disabled', |
| 156 | 156 | 'options' => array( |
| 157 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 158 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 157 | + 'enabled' => __('Enabled', 'give'), |
|
| 158 | + 'disabled' => __('Disabled', 'give'), |
|
| 159 | 159 | ), |
| 160 | 160 | ), |
| 161 | 161 | array( |
| 162 | - 'name' => __( 'Minimum Amount', 'give' ), |
|
| 163 | - 'description' => __( 'Enter the minimum custom donation amount.', 'give' ), |
|
| 164 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 162 | + 'name' => __('Minimum Amount', 'give'), |
|
| 163 | + 'description' => __('Enter the minimum custom donation amount.', 'give'), |
|
| 164 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 165 | 165 | 'type' => 'text_small', |
| 166 | 166 | 'data_type' => 'price', |
| 167 | 167 | 'attributes' => array( |
| 168 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 169 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
| 168 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 169 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
| 170 | 170 | 'class' => '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_medium', |
| 178 | 178 | 'attributes' => array( |
| 179 | 179 | 'rows' => 3, |
| 180 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
| 180 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
| 181 | 181 | ), |
| 182 | 182 | ), |
| 183 | 183 | // Donation Levels: Repeatable CMB2 Group |
| 184 | 184 | array( |
| 185 | - 'id' => $prefix . 'donation_levels', |
|
| 185 | + 'id' => $prefix.'donation_levels', |
|
| 186 | 186 | 'type' => 'group', |
| 187 | 187 | 'options' => array( |
| 188 | - 'add_button' => __( 'Add Level', 'give' ), |
|
| 189 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
| 188 | + 'add_button' => __('Add Level', 'give'), |
|
| 189 | + 'header_title' => __('Donation Level', 'give'), |
|
| 190 | 190 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
| 191 | 191 | ), |
| 192 | 192 | // Fields array works the same, except id's only need to be unique for this group. |
| 193 | 193 | // Prefix is not needed. |
| 194 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 194 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
| 195 | 195 | array( |
| 196 | - 'name' => __( 'ID', 'give' ), |
|
| 197 | - 'id' => $prefix . 'id', |
|
| 196 | + 'name' => __('ID', 'give'), |
|
| 197 | + 'id' => $prefix.'id', |
|
| 198 | 198 | 'type' => 'levels_id', |
| 199 | 199 | ), |
| 200 | 200 | array( |
| 201 | - 'name' => __( 'Amount', 'give' ), |
|
| 202 | - 'id' => $prefix . 'amount', |
|
| 201 | + 'name' => __('Amount', 'give'), |
|
| 202 | + 'id' => $prefix.'amount', |
|
| 203 | 203 | 'type' => 'text_small', |
| 204 | 204 | 'data_type' => 'price', |
| 205 | 205 | 'attributes' => array( |
| 206 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 206 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 207 | 207 | 'class' => 'give-money-field', |
| 208 | 208 | ), |
| 209 | 209 | ), |
| 210 | 210 | array( |
| 211 | - 'name' => __( 'Text', 'give' ), |
|
| 212 | - 'id' => $prefix . 'text', |
|
| 211 | + 'name' => __('Text', 'give'), |
|
| 212 | + 'id' => $prefix.'text', |
|
| 213 | 213 | 'type' => 'text', |
| 214 | 214 | 'attributes' => array( |
| 215 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
| 215 | + 'placeholder' => __('Donation Level', 'give'), |
|
| 216 | 216 | 'class' => 'give-multilevel-text-field', |
| 217 | 217 | ), |
| 218 | 218 | ), |
| 219 | 219 | array( |
| 220 | - 'name' => __( 'Default', 'give' ), |
|
| 221 | - 'id' => $prefix . 'default', |
|
| 220 | + 'name' => __('Default', 'give'), |
|
| 221 | + 'id' => $prefix.'default', |
|
| 222 | 222 | 'type' => 'give_default_radio_inline', |
| 223 | 223 | ), |
| 224 | - ) ), |
|
| 224 | + )), |
|
| 225 | 225 | ), |
| 226 | 226 | array( |
| 227 | 227 | 'name' => 'donation_options_docs', |
| 228 | 228 | 'type' => 'docs_link', |
| 229 | 229 | 'url' => 'http://docs.givewp.com/form-donation-options', |
| 230 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 230 | + 'title' => __('Donation Options', 'give'), |
|
| 231 | 231 | ), |
| 232 | 232 | ), |
| 233 | 233 | $post_id |
| 234 | 234 | ), |
| 235 | - ) ), |
|
| 235 | + )), |
|
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * Display Options |
| 239 | 239 | */ |
| 240 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
| 240 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
| 241 | 241 | 'id' => 'form_display_options', |
| 242 | - 'title' => __( 'Form Display', 'give' ), |
|
| 242 | + 'title' => __('Form Display', 'give'), |
|
| 243 | 243 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
| 244 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 244 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
| 245 | 245 | array( |
| 246 | - 'name' => __( 'Display Options', 'give' ), |
|
| 247 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
| 248 | - 'id' => $prefix . 'payment_display', |
|
| 246 | + 'name' => __('Display Options', 'give'), |
|
| 247 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
| 248 | + 'id' => $prefix.'payment_display', |
|
| 249 | 249 | 'type' => 'radio_inline', |
| 250 | 250 | 'options' => array( |
| 251 | - 'onpage' => __( 'All Fields', 'give' ), |
|
| 252 | - 'modal' => __( 'Modal', 'give' ), |
|
| 253 | - 'reveal' => __( 'Reveal', 'give' ), |
|
| 254 | - 'button' => __( 'Button', 'give' ), |
|
| 251 | + 'onpage' => __('All Fields', 'give'), |
|
| 252 | + 'modal' => __('Modal', 'give'), |
|
| 253 | + 'reveal' => __('Reveal', 'give'), |
|
| 254 | + 'button' => __('Button', 'give'), |
|
| 255 | 255 | ), |
| 256 | 256 | 'default' => 'onpage', |
| 257 | 257 | ), |
| 258 | 258 | array( |
| 259 | - 'id' => $prefix . 'reveal_label', |
|
| 260 | - 'name' => __( 'Continue Button', 'give' ), |
|
| 261 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
| 259 | + 'id' => $prefix.'reveal_label', |
|
| 260 | + 'name' => __('Continue Button', 'give'), |
|
| 261 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
| 262 | 262 | 'type' => 'text_small', |
| 263 | 263 | 'attributes' => array( |
| 264 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
| 264 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
| 265 | 265 | ), |
| 266 | 266 | ), |
| 267 | 267 | array( |
| 268 | - 'id' => $prefix . 'checkout_label', |
|
| 269 | - 'name' => __( 'Submit Button', 'give' ), |
|
| 270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
| 268 | + 'id' => $prefix.'checkout_label', |
|
| 269 | + 'name' => __('Submit Button', 'give'), |
|
| 270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
| 271 | 271 | 'type' => 'text_small', |
| 272 | 272 | 'attributes' => array( |
| 273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 273 | + 'placeholder' => __('Donate Now', 'give'), |
|
| 274 | 274 | ), |
| 275 | 275 | ), |
| 276 | 276 | array( |
| 277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 278 | - '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' ), |
|
| 279 | - 'id' => $prefix . 'default_gateway', |
|
| 277 | + 'name' => __('Default Gateway', 'give'), |
|
| 278 | + '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'), |
|
| 279 | + 'id' => $prefix.'default_gateway', |
|
| 280 | 280 | 'type' => 'default_gateway', |
| 281 | 281 | ), |
| 282 | 282 | array( |
| 283 | - 'name' => __( 'Guest Donations', 'give' ), |
|
| 284 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
| 285 | - 'id' => $prefix . 'logged_in_only', |
|
| 283 | + 'name' => __('Guest Donations', 'give'), |
|
| 284 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
| 285 | + 'id' => $prefix.'logged_in_only', |
|
| 286 | 286 | 'type' => 'radio_inline', |
| 287 | 287 | 'default' => 'enabled', |
| 288 | 288 | 'options' => array( |
| 289 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 290 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 289 | + 'enabled' => __('Enabled', 'give'), |
|
| 290 | + 'disabled' => __('Disabled', 'give'), |
|
| 291 | 291 | ), |
| 292 | 292 | ), |
| 293 | 293 | array( |
| 294 | - 'name' => __( 'Registration', 'give' ), |
|
| 295 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 296 | - 'id' => $prefix . 'show_register_form', |
|
| 294 | + 'name' => __('Registration', 'give'), |
|
| 295 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
| 296 | + 'id' => $prefix.'show_register_form', |
|
| 297 | 297 | 'type' => 'radio', |
| 298 | 298 | 'options' => array( |
| 299 | - 'none' => __( 'None', 'give' ), |
|
| 300 | - 'registration' => __( 'Registration', 'give' ), |
|
| 301 | - 'login' => __( 'Login', 'give' ), |
|
| 302 | - 'both' => __( 'Registration + Login', 'give' ), |
|
| 299 | + 'none' => __('None', 'give'), |
|
| 300 | + 'registration' => __('Registration', 'give'), |
|
| 301 | + 'login' => __('Login', 'give'), |
|
| 302 | + 'both' => __('Registration + Login', 'give'), |
|
| 303 | 303 | ), |
| 304 | 304 | 'default' => 'none', |
| 305 | 305 | ), |
| 306 | 306 | array( |
| 307 | - 'name' => __( 'Floating Labels', 'give' ), |
|
| 307 | + 'name' => __('Floating Labels', 'give'), |
|
| 308 | 308 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
| 309 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
| 310 | - 'id' => $prefix . 'form_floating_labels', |
|
| 309 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
| 310 | + 'id' => $prefix.'form_floating_labels', |
|
| 311 | 311 | 'type' => 'radio_inline', |
| 312 | 312 | 'options' => array( |
| 313 | - 'global' => __( 'Global Option', 'give' ), |
|
| 314 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 315 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 313 | + 'global' => __('Global Option', 'give'), |
|
| 314 | + 'enabled' => __('Enabled', 'give'), |
|
| 315 | + 'disabled' => __('Disabled', 'give'), |
|
| 316 | 316 | ), |
| 317 | 317 | 'default' => 'global', |
| 318 | 318 | ), |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | 'name' => 'form_display_docs', |
| 321 | 321 | 'type' => 'docs_link', |
| 322 | 322 | 'url' => 'http://docs.givewp.com/form-display-options', |
| 323 | - 'title' => __( 'Form Display', 'give' ), |
|
| 323 | + 'title' => __('Form Display', 'give'), |
|
| 324 | 324 | ), |
| 325 | 325 | ), |
| 326 | 326 | $post_id |
@@ -331,172 +331,172 @@ discard block |
||
| 331 | 331 | /** |
| 332 | 332 | * Donation Goals |
| 333 | 333 | */ |
| 334 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
| 334 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
| 335 | 335 | 'id' => 'donation_goal_options', |
| 336 | - 'title' => __( 'Donation Goal', 'give' ), |
|
| 336 | + 'title' => __('Donation Goal', 'give'), |
|
| 337 | 337 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
| 338 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
| 338 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
| 339 | 339 | // Goals |
| 340 | 340 | array( |
| 341 | - 'name' => __( 'Donation Goal', 'give' ), |
|
| 342 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 343 | - 'id' => $prefix . 'goal_option', |
|
| 341 | + 'name' => __('Donation Goal', 'give'), |
|
| 342 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
| 343 | + 'id' => $prefix.'goal_option', |
|
| 344 | 344 | 'type' => 'radio_inline', |
| 345 | 345 | 'default' => 'disabled', |
| 346 | 346 | 'options' => array( |
| 347 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 348 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 347 | + 'enabled' => __('Enabled', 'give'), |
|
| 348 | + 'disabled' => __('Disabled', 'give'), |
|
| 349 | 349 | ), |
| 350 | 350 | ), |
| 351 | 351 | array( |
| 352 | - 'name' => __( 'Goal Amount', 'give' ), |
|
| 353 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
| 354 | - 'id' => $prefix . 'set_goal', |
|
| 352 | + 'name' => __('Goal Amount', 'give'), |
|
| 353 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
| 354 | + 'id' => $prefix.'set_goal', |
|
| 355 | 355 | 'type' => 'text_small', |
| 356 | 356 | 'data_type' => 'price', |
| 357 | 357 | 'attributes' => array( |
| 358 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
| 359 | - 'value' => give_format_decimal( $goal ), |
|
| 358 | + 'placeholder' => give_format_decimal('0.00'), |
|
| 359 | + 'value' => give_format_decimal($goal), |
|
| 360 | 360 | 'class' => 'give-money-field', |
| 361 | 361 | ), |
| 362 | 362 | ), |
| 363 | 363 | |
| 364 | 364 | array( |
| 365 | - 'name' => __( 'Goal Format', 'give' ), |
|
| 366 | - 'description' => __( 'Do you want 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' ), |
|
| 367 | - 'id' => $prefix . 'goal_format', |
|
| 365 | + 'name' => __('Goal Format', 'give'), |
|
| 366 | + 'description' => __('Do you want 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'), |
|
| 367 | + 'id' => $prefix.'goal_format', |
|
| 368 | 368 | 'type' => 'radio_inline', |
| 369 | 369 | 'default' => 'amount', |
| 370 | 370 | 'options' => array( |
| 371 | - 'amount' => __( 'Amount', 'give' ), |
|
| 372 | - 'percentage' => __( 'Percentage', 'give' ), |
|
| 371 | + 'amount' => __('Amount', 'give'), |
|
| 372 | + 'percentage' => __('Percentage', 'give'), |
|
| 373 | 373 | ), |
| 374 | 374 | ), |
| 375 | 375 | array( |
| 376 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
| 377 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
| 378 | - 'id' => $prefix . 'goal_color', |
|
| 376 | + 'name' => __('Progress Bar Color', 'give'), |
|
| 377 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
| 378 | + 'id' => $prefix.'goal_color', |
|
| 379 | 379 | 'type' => 'colorpicker', |
| 380 | 380 | 'default' => '#2bc253', |
| 381 | 381 | ), |
| 382 | 382 | |
| 383 | 383 | array( |
| 384 | - 'name' => __( 'Close Form', 'give' ), |
|
| 385 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
| 386 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
| 384 | + 'name' => __('Close Form', 'give'), |
|
| 385 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
| 386 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
| 387 | 387 | 'type' => 'radio_inline', |
| 388 | 388 | 'default' => 'disabled', |
| 389 | 389 | 'options' => array( |
| 390 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 391 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 390 | + 'enabled' => __('Enabled', 'give'), |
|
| 391 | + 'disabled' => __('Disabled', 'give'), |
|
| 392 | 392 | ), |
| 393 | 393 | ), |
| 394 | 394 | array( |
| 395 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
| 396 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
| 397 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
| 395 | + 'name' => __('Goal Achieved Message', 'give'), |
|
| 396 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
| 397 | + 'id' => $prefix.'form_goal_achieved_message', |
|
| 398 | 398 | 'type' => 'wysiwyg', |
| 399 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 399 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
| 400 | 400 | ), |
| 401 | 401 | array( |
| 402 | 402 | 'name' => 'donation_goal_docs', |
| 403 | 403 | 'type' => 'docs_link', |
| 404 | 404 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
| 405 | - 'title' => __( 'Donation Goal', 'give' ), |
|
| 405 | + 'title' => __('Donation Goal', 'give'), |
|
| 406 | 406 | ), |
| 407 | 407 | ), |
| 408 | 408 | $post_id |
| 409 | 409 | ), |
| 410 | - ) ), |
|
| 410 | + )), |
|
| 411 | 411 | |
| 412 | 412 | /** |
| 413 | 413 | * Content Field |
| 414 | 414 | */ |
| 415 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
| 415 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
| 416 | 416 | 'id' => 'form_content_options', |
| 417 | - 'title' => __( 'Form Content', 'give' ), |
|
| 417 | + 'title' => __('Form Content', 'give'), |
|
| 418 | 418 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
| 419 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 419 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
| 420 | 420 | |
| 421 | 421 | // Donation content. |
| 422 | 422 | array( |
| 423 | - 'name' => __( 'Display Content', 'give' ), |
|
| 424 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
| 425 | - 'id' => $prefix . 'display_content', |
|
| 423 | + 'name' => __('Display Content', 'give'), |
|
| 424 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
| 425 | + 'id' => $prefix.'display_content', |
|
| 426 | 426 | 'type' => 'radio_inline', |
| 427 | 427 | 'options' => array( |
| 428 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 429 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 428 | + 'enabled' => __('Enabled', 'give'), |
|
| 429 | + 'disabled' => __('Disabled', 'give'), |
|
| 430 | 430 | ), |
| 431 | 431 | 'default' => 'disabled', |
| 432 | 432 | ), |
| 433 | 433 | |
| 434 | 434 | // Content placement. |
| 435 | 435 | array( |
| 436 | - 'name' => __( 'Content Placement', 'give' ), |
|
| 437 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
| 438 | - 'id' => $prefix . 'content_placement', |
|
| 436 | + 'name' => __('Content Placement', 'give'), |
|
| 437 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
| 438 | + 'id' => $prefix.'content_placement', |
|
| 439 | 439 | 'type' => 'radio_inline', |
| 440 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 441 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
| 442 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
| 440 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 441 | + 'give_pre_form' => __('Above fields', 'give'), |
|
| 442 | + 'give_post_form' => __('Below fields', 'give'), |
|
| 443 | 443 | ) |
| 444 | 444 | ), |
| 445 | 445 | 'default' => 'give_pre_form', |
| 446 | 446 | ), |
| 447 | 447 | array( |
| 448 | - 'name' => __( 'Content', 'give' ), |
|
| 449 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
| 450 | - 'id' => $prefix . 'form_content', |
|
| 448 | + 'name' => __('Content', 'give'), |
|
| 449 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
| 450 | + 'id' => $prefix.'form_content', |
|
| 451 | 451 | 'type' => 'wysiwyg', |
| 452 | 452 | ), |
| 453 | 453 | array( |
| 454 | 454 | 'name' => 'form_content_docs', |
| 455 | 455 | 'type' => 'docs_link', |
| 456 | 456 | 'url' => 'http://docs.givewp.com/form-content', |
| 457 | - 'title' => __( 'Form Content', 'give' ), |
|
| 457 | + 'title' => __('Form Content', 'give'), |
|
| 458 | 458 | ), |
| 459 | 459 | ), |
| 460 | 460 | $post_id |
| 461 | 461 | ), |
| 462 | - ) ), |
|
| 462 | + )), |
|
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * Terms & Conditions |
| 466 | 466 | */ |
| 467 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
| 467 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
| 468 | 468 | 'id' => 'form_terms_options', |
| 469 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
| 469 | + 'title' => __('Terms & Conditions', 'give'), |
|
| 470 | 470 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
| 471 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 471 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
| 472 | 472 | // Donation Option |
| 473 | 473 | array( |
| 474 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
| 475 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
| 476 | - 'id' => $prefix . 'terms_option', |
|
| 474 | + 'name' => __('Terms and Conditions', 'give'), |
|
| 475 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
| 476 | + 'id' => $prefix.'terms_option', |
|
| 477 | 477 | 'type' => 'radio_inline', |
| 478 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 479 | - 'global' => __( 'Global Option', 'give' ), |
|
| 480 | - 'enabled' => __( 'Customize', 'give' ), |
|
| 481 | - 'disabled' => __( 'Disable', 'give' ), |
|
| 478 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 479 | + 'global' => __('Global Option', 'give'), |
|
| 480 | + 'enabled' => __('Customize', 'give'), |
|
| 481 | + 'disabled' => __('Disable', 'give'), |
|
| 482 | 482 | ) |
| 483 | 483 | ), |
| 484 | 484 | 'default' => 'global', |
| 485 | 485 | ), |
| 486 | 486 | array( |
| 487 | - 'id' => $prefix . 'agree_label', |
|
| 488 | - 'name' => __( 'Agreement Label', 'give' ), |
|
| 489 | - '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' ), |
|
| 487 | + 'id' => $prefix.'agree_label', |
|
| 488 | + 'name' => __('Agreement Label', 'give'), |
|
| 489 | + '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'), |
|
| 490 | 490 | 'type' => 'text', |
| 491 | 491 | 'size' => 'regular', |
| 492 | 492 | 'attributes' => array( |
| 493 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
| 493 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
| 494 | 494 | ), |
| 495 | 495 | ), |
| 496 | 496 | array( |
| 497 | - 'id' => $prefix . 'agree_text', |
|
| 498 | - 'name' => __( 'Agreement Text', 'give' ), |
|
| 499 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 497 | + 'id' => $prefix.'agree_text', |
|
| 498 | + 'name' => __('Agreement Text', 'give'), |
|
| 499 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
| 500 | 500 | 'default' => give_get_option('agreement_text'), |
| 501 | 501 | 'type' => 'wysiwyg', |
| 502 | 502 | ), |
@@ -504,19 +504,19 @@ discard block |
||
| 504 | 504 | 'name' => 'terms_docs', |
| 505 | 505 | 'type' => 'docs_link', |
| 506 | 506 | 'url' => 'http://docs.givewp.com/form-terms', |
| 507 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
| 507 | + 'title' => __('Terms and Conditions', 'give'), |
|
| 508 | 508 | ), |
| 509 | 509 | ), |
| 510 | 510 | $post_id |
| 511 | 511 | ), |
| 512 | - ) ), |
|
| 512 | + )), |
|
| 513 | 513 | ); |
| 514 | 514 | |
| 515 | 515 | |
| 516 | 516 | /** |
| 517 | 517 | * Filter the metabox tabbed panel settings. |
| 518 | 518 | */ |
| 519 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
| 519 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
| 520 | 520 | |
| 521 | 521 | // Output. |
| 522 | 522 | return $settings; |
@@ -532,8 +532,8 @@ discard block |
||
| 532 | 532 | add_meta_box( |
| 533 | 533 | $this->get_metabox_ID(), |
| 534 | 534 | $this->get_metabox_label(), |
| 535 | - array( $this, 'output' ), |
|
| 536 | - array( 'give_forms' ), |
|
| 535 | + array($this, 'output'), |
|
| 536 | + array('give_forms'), |
|
| 537 | 537 | 'normal', |
| 538 | 538 | 'high' |
| 539 | 539 | ); |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | function enqueue_script() { |
| 550 | 550 | global $post; |
| 551 | 551 | |
| 552 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 552 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 553 | 553 | |
| 554 | 554 | } |
| 555 | 555 | } |
@@ -584,32 +584,32 @@ discard block |
||
| 584 | 584 | public function get_tabs() { |
| 585 | 585 | $tabs = array(); |
| 586 | 586 | |
| 587 | - if ( ! empty( $this->settings ) ) { |
|
| 588 | - foreach ( $this->settings as $setting ) { |
|
| 589 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
| 587 | + if ( ! empty($this->settings)) { |
|
| 588 | + foreach ($this->settings as $setting) { |
|
| 589 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
| 590 | 590 | continue; |
| 591 | 591 | } |
| 592 | 592 | $tab = array( |
| 593 | 593 | 'id' => $setting['id'], |
| 594 | 594 | 'label' => $setting['title'], |
| 595 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
| 595 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
| 596 | 596 | ); |
| 597 | 597 | |
| 598 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 599 | - if ( empty( $setting['sub-fields'] ) ) { |
|
| 598 | + if ($this->has_sub_tab($setting)) { |
|
| 599 | + if (empty($setting['sub-fields'])) { |
|
| 600 | 600 | $tab = array(); |
| 601 | 601 | } else { |
| 602 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
| 602 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
| 603 | 603 | $tab['sub-fields'][] = array( |
| 604 | 604 | 'id' => $sub_fields['id'], |
| 605 | 605 | 'label' => $sub_fields['title'], |
| 606 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
| 606 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
| 607 | 607 | ); |
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | - if ( ! empty( $tab ) ) { |
|
| 612 | + if ( ! empty($tab)) { |
|
| 613 | 613 | $tabs[] = $tab; |
| 614 | 614 | } |
| 615 | 615 | } |
@@ -626,27 +626,27 @@ discard block |
||
| 626 | 626 | */ |
| 627 | 627 | public function output() { |
| 628 | 628 | // Bailout. |
| 629 | - if ( $form_data_tabs = $this->get_tabs() ) { |
|
| 630 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
| 629 | + if ($form_data_tabs = $this->get_tabs()) { |
|
| 630 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
| 631 | 631 | ?> |
| 632 | 632 | <div class="give-metabox-panel-wrap"> |
| 633 | 633 | <ul class="give-form-data-tabs give-metabox-tabs"> |
| 634 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
| 635 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
| 634 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
| 635 | + <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
| 636 | 636 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
| 637 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
| 637 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
| 638 | 638 | <?php echo $form_data_tab['icon-html']; ?> |
| 639 | 639 | <?php else : ?> |
| 640 | 640 | <span class="give-icon give-icon-default"></span> |
| 641 | 641 | <?php endif; ?> |
| 642 | 642 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
| 643 | 643 | </a> |
| 644 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
| 644 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
| 645 | 645 | <ul class="give-metabox-sub-tabs give-hidden"> |
| 646 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
| 646 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
| 647 | 647 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
| 648 | 648 | <a href="#<?php echo $sub_tab['id']; ?>"> |
| 649 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
| 649 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
| 650 | 650 | <?php echo $sub_tab['icon-html']; ?> |
| 651 | 651 | <?php else : ?> |
| 652 | 652 | <span class="give-icon give-icon-default"></span> |
@@ -662,30 +662,30 @@ discard block |
||
| 662 | 662 | </ul> |
| 663 | 663 | |
| 664 | 664 | <?php $show_first_tab_content = true; ?> |
| 665 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
| 666 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
| 667 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
| 665 | + <?php foreach ($this->settings as $setting) : ?> |
|
| 666 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
| 667 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
| 668 | 668 | |
| 669 | 669 | <div id="<?php echo $setting['id']; ?>" |
| 670 | - class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
|
| 670 | + class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden'); |
|
| 671 | 671 | $show_first_tab_content = false; ?>"> |
| 672 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
| 673 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
| 674 | - <?php give_render_field( $field ); ?> |
|
| 672 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
| 673 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
| 674 | + <?php give_render_field($field); ?> |
|
| 675 | 675 | <?php endforeach; ?> |
| 676 | 676 | <?php endif; ?> |
| 677 | 677 | </div> |
| 678 | 678 | |
| 679 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
| 679 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
| 680 | 680 | <?php else: ?> |
| 681 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
| 682 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
| 683 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
| 681 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
| 682 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
| 683 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
| 684 | 684 | <div id="<?php echo $sub_fields['id']; ?>" |
| 685 | 685 | class="panel give_options_panel give-hidden"> |
| 686 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
| 687 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
| 688 | - <?php give_render_field( $sub_field ); ?> |
|
| 686 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
| 687 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
| 688 | + <?php give_render_field($sub_field); ?> |
|
| 689 | 689 | <?php endforeach; ?> |
| 690 | 690 | <?php endif; ?> |
| 691 | 691 | </div> |
@@ -709,9 +709,9 @@ discard block |
||
| 709 | 709 | * |
| 710 | 710 | * @return bool |
| 711 | 711 | */ |
| 712 | - private function has_sub_tab( $field_setting ) { |
|
| 712 | + private function has_sub_tab($field_setting) { |
|
| 713 | 713 | $has_sub_tab = false; |
| 714 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
| 714 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
| 715 | 715 | $has_sub_tab = true; |
| 716 | 716 | } |
| 717 | 717 | |
@@ -725,13 +725,13 @@ discard block |
||
| 725 | 725 | * @return array |
| 726 | 726 | */ |
| 727 | 727 | function cmb2_metabox_settings() { |
| 728 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
| 728 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
| 729 | 729 | $give_forms_settings = $all_cmb2_settings; |
| 730 | 730 | |
| 731 | 731 | // Filter settings: Use only give forms related settings. |
| 732 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
| 733 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
| 734 | - unset( $give_forms_settings[ $index ] ); |
|
| 732 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
| 733 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
| 734 | + unset($give_forms_settings[$index]); |
|
| 735 | 735 | } |
| 736 | 736 | } |
| 737 | 737 | |
@@ -749,114 +749,114 @@ discard block |
||
| 749 | 749 | * |
| 750 | 750 | * @return void |
| 751 | 751 | */ |
| 752 | - public function save( $post_id, $post ) { |
|
| 752 | + public function save($post_id, $post) { |
|
| 753 | 753 | |
| 754 | 754 | // $post_id and $post are required. |
| 755 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
| 755 | + if (empty($post_id) || empty($post)) { |
|
| 756 | 756 | return; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | // Don't save meta boxes for revisions or autosaves. |
| 760 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
| 760 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
| 761 | 761 | return; |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | // Check the nonce. |
| 765 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
| 765 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
| 766 | 766 | return; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
| 770 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
| 770 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
| 771 | 771 | return; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | // Check user has permission to edit. |
| 775 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 775 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 776 | 776 | return; |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | // Fire action before saving form meta. |
| 780 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
| 780 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
| 781 | 781 | |
| 782 | 782 | /** |
| 783 | 783 | * Filter the meta key to save. |
| 784 | 784 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
| 785 | 785 | */ |
| 786 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
| 786 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
| 787 | 787 | |
| 788 | 788 | // Save form meta data. |
| 789 | - if ( ! empty( $form_meta_keys ) ) { |
|
| 790 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
| 789 | + if ( ! empty($form_meta_keys)) { |
|
| 790 | + foreach ($form_meta_keys as $form_meta_key) { |
|
| 791 | 791 | |
| 792 | 792 | // Set default value for checkbox fields. |
| 793 | 793 | if ( |
| 794 | - ! isset( $_POST[ $form_meta_key ] ) |
|
| 795 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
| 794 | + ! isset($_POST[$form_meta_key]) |
|
| 795 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
| 796 | 796 | ) { |
| 797 | - $_POST[ $form_meta_key ] = ''; |
|
| 797 | + $_POST[$form_meta_key] = ''; |
|
| 798 | 798 | } |
| 799 | 799 | |
| 800 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
| 801 | - if ( $field_type = $this->get_field_type( $form_meta_key ) ) { |
|
| 802 | - switch ( $field_type ) { |
|
| 800 | + if (isset($_POST[$form_meta_key])) { |
|
| 801 | + if ($field_type = $this->get_field_type($form_meta_key)) { |
|
| 802 | + switch ($field_type) { |
|
| 803 | 803 | case 'textarea': |
| 804 | 804 | case 'wysiwyg': |
| 805 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
| 806 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 805 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
| 806 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 807 | 807 | break; |
| 808 | 808 | |
| 809 | 809 | case 'group': |
| 810 | 810 | $form_meta_value = array(); |
| 811 | 811 | |
| 812 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
| 812 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
| 813 | 813 | |
| 814 | 814 | // Do not save template input field values. |
| 815 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
| 815 | + if ('{{row-count-placeholder}}' === $index) { |
|
| 816 | 816 | continue; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | $group_meta_value = array(); |
| 820 | - foreach ( $group as $field_id => $field_value ) { |
|
| 821 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
| 820 | + foreach ($group as $field_id => $field_value) { |
|
| 821 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
| 822 | 822 | case 'wysiwyg': |
| 823 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
| 823 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
| 824 | 824 | break; |
| 825 | 825 | |
| 826 | 826 | default: |
| 827 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
| 827 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | - if ( ! empty( $group_meta_value ) ) { |
|
| 832 | - $form_meta_value[ $index ] = $group_meta_value; |
|
| 831 | + if ( ! empty($group_meta_value)) { |
|
| 832 | + $form_meta_value[$index] = $group_meta_value; |
|
| 833 | 833 | } |
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | |
| 837 | 837 | // Arrange repeater field keys in order. |
| 838 | - $form_meta_value = array_values( $form_meta_value ); |
|
| 838 | + $form_meta_value = array_values($form_meta_value); |
|
| 839 | 839 | |
| 840 | 840 | // Save data. |
| 841 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 841 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 842 | 842 | break; |
| 843 | 843 | |
| 844 | 844 | default: |
| 845 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
| 845 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
| 846 | 846 | |
| 847 | 847 | // Save data. |
| 848 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 848 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | // Fire after saving form meta key. |
| 852 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
| 852 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | // Fire action after saving form meta. |
| 859 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
| 859 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | |
@@ -869,10 +869,10 @@ discard block |
||
| 869 | 869 | * |
| 870 | 870 | * @return string |
| 871 | 871 | */ |
| 872 | - private function get_field_id( $field ) { |
|
| 872 | + private function get_field_id($field) { |
|
| 873 | 873 | $field_id = ''; |
| 874 | 874 | |
| 875 | - if ( array_key_exists( 'id', $field ) ) { |
|
| 875 | + if (array_key_exists('id', $field)) { |
|
| 876 | 876 | $field_id = $field['id']; |
| 877 | 877 | |
| 878 | 878 | } |
@@ -889,12 +889,12 @@ discard block |
||
| 889 | 889 | * |
| 890 | 890 | * @return array |
| 891 | 891 | */ |
| 892 | - private function get_fields_id( $setting ) { |
|
| 892 | + private function get_fields_id($setting) { |
|
| 893 | 893 | $meta_keys = array(); |
| 894 | 894 | |
| 895 | - if ( ! empty( $setting ) ) { |
|
| 896 | - foreach ( $setting['fields'] as $field ) { |
|
| 897 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 895 | + if ( ! empty($setting)) { |
|
| 896 | + foreach ($setting['fields'] as $field) { |
|
| 897 | + if ($field_id = $this->get_field_id($field)) { |
|
| 898 | 898 | $meta_keys[] = $field_id; |
| 899 | 899 | } |
| 900 | 900 | } |
@@ -912,14 +912,14 @@ discard block |
||
| 912 | 912 | * |
| 913 | 913 | * @return array |
| 914 | 914 | */ |
| 915 | - private function get_sub_fields_id( $setting ) { |
|
| 915 | + private function get_sub_fields_id($setting) { |
|
| 916 | 916 | $meta_keys = array(); |
| 917 | 917 | |
| 918 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
| 919 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 920 | - if ( ! empty( $fields['fields'] ) ) { |
|
| 921 | - foreach ( $fields['fields'] as $field ) { |
|
| 922 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 918 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
| 919 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 920 | + if ( ! empty($fields['fields'])) { |
|
| 921 | + foreach ($fields['fields'] as $field) { |
|
| 922 | + if ($field_id = $this->get_field_id($field)) { |
|
| 923 | 923 | $meta_keys[] = $field_id; |
| 924 | 924 | } |
| 925 | 925 | } |
@@ -940,14 +940,14 @@ discard block |
||
| 940 | 940 | private function get_meta_keys_from_settings() { |
| 941 | 941 | $meta_keys = array(); |
| 942 | 942 | |
| 943 | - foreach ( $this->settings as $setting ) { |
|
| 944 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 945 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
| 943 | + foreach ($this->settings as $setting) { |
|
| 944 | + if ($this->has_sub_tab($setting)) { |
|
| 945 | + $meta_key = $this->get_sub_fields_id($setting); |
|
| 946 | 946 | } else { |
| 947 | - $meta_key = $this->get_fields_id( $setting ); |
|
| 947 | + $meta_key = $this->get_fields_id($setting); |
|
| 948 | 948 | } |
| 949 | 949 | |
| 950 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
| 950 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | return $meta_keys; |
@@ -964,10 +964,10 @@ discard block |
||
| 964 | 964 | * |
| 965 | 965 | * @return string |
| 966 | 966 | */ |
| 967 | - function get_field_type( $field_id, $group_id = '' ) { |
|
| 968 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
| 967 | + function get_field_type($field_id, $group_id = '') { |
|
| 968 | + $field = $this->get_setting_field($field_id, $group_id); |
|
| 969 | 969 | |
| 970 | - $type = array_key_exists( 'type', $field ) |
|
| 970 | + $type = array_key_exists('type', $field) |
|
| 971 | 971 | ? $field['type'] |
| 972 | 972 | : ''; |
| 973 | 973 | |
@@ -985,12 +985,12 @@ discard block |
||
| 985 | 985 | * |
| 986 | 986 | * @return array |
| 987 | 987 | */ |
| 988 | - private function get_field( $setting, $field_id ) { |
|
| 988 | + private function get_field($setting, $field_id) { |
|
| 989 | 989 | $setting_field = array(); |
| 990 | 990 | |
| 991 | - if ( ! empty( $setting['fields'] ) ) { |
|
| 992 | - foreach ( $setting['fields'] as $field ) { |
|
| 993 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
| 991 | + if ( ! empty($setting['fields'])) { |
|
| 992 | + foreach ($setting['fields'] as $field) { |
|
| 993 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
| 994 | 994 | $setting_field = $field; |
| 995 | 995 | break; |
| 996 | 996 | } |
@@ -1010,12 +1010,12 @@ discard block |
||
| 1010 | 1010 | * |
| 1011 | 1011 | * @return array |
| 1012 | 1012 | */ |
| 1013 | - private function get_sub_field( $setting, $field_id ) { |
|
| 1013 | + private function get_sub_field($setting, $field_id) { |
|
| 1014 | 1014 | $setting_field = array(); |
| 1015 | 1015 | |
| 1016 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
| 1017 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 1018 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
| 1016 | + if ( ! empty($setting['sub-fields'])) { |
|
| 1017 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 1018 | + if ($field = $this->get_field($fields, $field_id)) { |
|
| 1019 | 1019 | $setting_field = $field; |
| 1020 | 1020 | break; |
| 1021 | 1021 | } |
@@ -1035,17 +1035,17 @@ discard block |
||
| 1035 | 1035 | * |
| 1036 | 1036 | * @return array |
| 1037 | 1037 | */ |
| 1038 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
| 1038 | + function get_setting_field($field_id, $group_id = '') { |
|
| 1039 | 1039 | $setting_field = array(); |
| 1040 | 1040 | |
| 1041 | 1041 | $_field_id = $field_id; |
| 1042 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
| 1042 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
| 1043 | 1043 | |
| 1044 | - if ( ! empty( $this->settings ) ) { |
|
| 1045 | - foreach ( $this->settings as $setting ) { |
|
| 1044 | + if ( ! empty($this->settings)) { |
|
| 1045 | + foreach ($this->settings as $setting) { |
|
| 1046 | 1046 | if ( |
| 1047 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
| 1048 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
| 1047 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
| 1048 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
| 1049 | 1049 | ) { |
| 1050 | 1050 | break; |
| 1051 | 1051 | } |
@@ -1054,9 +1054,9 @@ discard block |
||
| 1054 | 1054 | |
| 1055 | 1055 | |
| 1056 | 1056 | // Get field from group. |
| 1057 | - if ( ! empty( $group_id ) ) { |
|
| 1058 | - foreach ( $setting_field['fields'] as $field ) { |
|
| 1059 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
| 1057 | + if ( ! empty($group_id)) { |
|
| 1058 | + foreach ($setting_field['fields'] as $field) { |
|
| 1059 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
| 1060 | 1060 | $setting_field = $field; |
| 1061 | 1061 | } |
| 1062 | 1062 | } |
@@ -1075,14 +1075,14 @@ discard block |
||
| 1075 | 1075 | * |
| 1076 | 1076 | * @return mixed |
| 1077 | 1077 | */ |
| 1078 | - function add_offline_donations_setting_tab( $settings ) { |
|
| 1079 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
| 1080 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
| 1078 | + function add_offline_donations_setting_tab($settings) { |
|
| 1079 | + if (give_is_gateway_active('offline')) { |
|
| 1080 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
| 1081 | 1081 | 'id' => 'offline_donations_options', |
| 1082 | - 'title' => __( 'Offline Donations', 'give' ), |
|
| 1082 | + 'title' => __('Offline Donations', 'give'), |
|
| 1083 | 1083 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
| 1084 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
| 1085 | - ) ); |
|
| 1084 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
| 1085 | + )); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | return $settings; |
@@ -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 | |
@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page; |
| 34 | 34 | |
| 35 | 35 | //Payments |
| 36 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
| 37 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
| 36 | + $give_payment = get_post_type_object('give_payment'); |
|
| 37 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
| 38 | 38 | |
| 39 | 39 | //Donors |
| 40 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' ); |
|
| 40 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page'); |
|
| 41 | 41 | |
| 42 | 42 | //Reports` |
| 43 | 43 | $give_reports_page = add_submenu_page( |
| 44 | 44 | 'edit.php?post_type=give_forms', |
| 45 | - esc_html__( 'Donation Reports', 'give' ), |
|
| 46 | - esc_html__( 'Reports', 'give' ), |
|
| 45 | + esc_html__('Donation Reports', 'give'), |
|
| 46 | + esc_html__('Reports', 'give'), |
|
| 47 | 47 | 'view_give_reports', |
| 48 | 48 | 'give-reports', |
| 49 | 49 | array( |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | //Settings |
| 56 | 56 | $give_settings_page = add_submenu_page( |
| 57 | 57 | 'edit.php?post_type=give_forms', |
| 58 | - esc_html__( 'Give Settings', 'give' ), |
|
| 59 | - esc_html__( 'Settings', 'give' ), |
|
| 58 | + esc_html__('Give Settings', 'give'), |
|
| 59 | + esc_html__('Settings', 'give'), |
|
| 60 | 60 | 'manage_give_settings', |
| 61 | 61 | 'give-settings', |
| 62 | 62 | array( |
@@ -66,21 +66,21 @@ discard block |
||
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | 68 | //Tools. |
| 69 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
| 69 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
| 70 | 70 | Give()->give_settings, |
| 71 | 71 | 'output' |
| 72 | - ) ); |
|
| 72 | + )); |
|
| 73 | 73 | |
| 74 | 74 | //Add-ons |
| 75 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
| 75 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
| 76 | 76 | |
| 77 | 77 | //Upgrades |
| 78 | - $give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
| 78 | + $give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
| 83 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Determines whether the current admin page is a Give admin page. |
@@ -95,224 +95,224 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return bool True if Give admin page. |
| 97 | 97 | */ |
| 98 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
| 98 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
| 99 | 99 | |
| 100 | 100 | global $pagenow, $typenow; |
| 101 | 101 | |
| 102 | 102 | $found = false; |
| 103 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
| 104 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
| 105 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
| 106 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
| 107 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
| 108 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
| 109 | - |
|
| 110 | - switch ( $passed_page ) { |
|
| 103 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
| 104 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
| 105 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
| 106 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
| 107 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
| 108 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
| 109 | + |
|
| 110 | + switch ($passed_page) { |
|
| 111 | 111 | case 'give_forms': |
| 112 | - switch ( $passed_view ) { |
|
| 112 | + switch ($passed_view) { |
|
| 113 | 113 | case 'list-table': |
| 114 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
| 114 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
| 115 | 115 | $found = true; |
| 116 | 116 | } |
| 117 | 117 | break; |
| 118 | 118 | case 'edit': |
| 119 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
| 119 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
| 120 | 120 | $found = true; |
| 121 | 121 | } |
| 122 | 122 | break; |
| 123 | 123 | case 'new': |
| 124 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
| 124 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
| 125 | 125 | $found = true; |
| 126 | 126 | } |
| 127 | 127 | break; |
| 128 | 128 | default: |
| 129 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
| 129 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
| 130 | 130 | $found = true; |
| 131 | 131 | } |
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | break; |
| 135 | 135 | case 'categories': |
| 136 | - switch ( $passed_view ) { |
|
| 136 | + switch ($passed_view) { |
|
| 137 | 137 | case 'list-table': |
| 138 | 138 | case 'new': |
| 139 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
| 139 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
| 140 | 140 | $found = true; |
| 141 | 141 | } |
| 142 | 142 | break; |
| 143 | 143 | case 'edit': |
| 144 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
| 144 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
| 145 | 145 | $found = true; |
| 146 | 146 | } |
| 147 | 147 | break; |
| 148 | 148 | default: |
| 149 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
| 149 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
| 150 | 150 | $found = true; |
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | } |
| 154 | 154 | break; |
| 155 | 155 | case 'tags': |
| 156 | - switch ( $passed_view ) { |
|
| 156 | + switch ($passed_view) { |
|
| 157 | 157 | case 'list-table': |
| 158 | 158 | case 'new': |
| 159 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
| 159 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
| 160 | 160 | $found = true; |
| 161 | 161 | } |
| 162 | 162 | break; |
| 163 | 163 | case 'edit': |
| 164 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
| 164 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
| 165 | 165 | $found = true; |
| 166 | 166 | } |
| 167 | 167 | break; |
| 168 | 168 | default: |
| 169 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
| 169 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
| 170 | 170 | $found = true; |
| 171 | 171 | } |
| 172 | 172 | break; |
| 173 | 173 | } |
| 174 | 174 | break; |
| 175 | 175 | case 'payments': |
| 176 | - switch ( $passed_view ) { |
|
| 176 | + switch ($passed_view) { |
|
| 177 | 177 | case 'list-table': |
| 178 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
| 178 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
| 179 | 179 | $found = true; |
| 180 | 180 | } |
| 181 | 181 | break; |
| 182 | 182 | case 'edit': |
| 183 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) { |
|
| 183 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) { |
|
| 184 | 184 | $found = true; |
| 185 | 185 | } |
| 186 | 186 | break; |
| 187 | 187 | default: |
| 188 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
| 188 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
| 189 | 189 | $found = true; |
| 190 | 190 | } |
| 191 | 191 | break; |
| 192 | 192 | } |
| 193 | 193 | break; |
| 194 | 194 | case 'reports': |
| 195 | - switch ( $passed_view ) { |
|
| 195 | + switch ($passed_view) { |
|
| 196 | 196 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
| 197 | 197 | case 'earnings': |
| 198 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
| 198 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
| 199 | 199 | $found = true; |
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | 202 | case 'donors': |
| 203 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
| 203 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
| 204 | 204 | $found = true; |
| 205 | 205 | } |
| 206 | 206 | break; |
| 207 | 207 | case 'gateways': |
| 208 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
| 208 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
| 209 | 209 | $found = true; |
| 210 | 210 | } |
| 211 | 211 | break; |
| 212 | 212 | case 'export': |
| 213 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
| 213 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
| 214 | 214 | $found = true; |
| 215 | 215 | } |
| 216 | 216 | break; |
| 217 | 217 | case 'logs': |
| 218 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
| 218 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
| 219 | 219 | $found = true; |
| 220 | 220 | } |
| 221 | 221 | break; |
| 222 | 222 | default: |
| 223 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 223 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 224 | 224 | $found = true; |
| 225 | 225 | } |
| 226 | 226 | break; |
| 227 | 227 | } |
| 228 | 228 | break; |
| 229 | 229 | case 'settings': |
| 230 | - switch ( $passed_view ) { |
|
| 230 | + switch ($passed_view) { |
|
| 231 | 231 | case 'general': |
| 232 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
| 232 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
| 233 | 233 | $found = true; |
| 234 | 234 | } |
| 235 | 235 | break; |
| 236 | 236 | case 'gateways': |
| 237 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
| 237 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
| 238 | 238 | $found = true; |
| 239 | 239 | } |
| 240 | 240 | break; |
| 241 | 241 | case 'emails': |
| 242 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
| 242 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
| 243 | 243 | $found = true; |
| 244 | 244 | } |
| 245 | 245 | break; |
| 246 | 246 | case 'display': |
| 247 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
| 247 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
| 248 | 248 | $found = true; |
| 249 | 249 | } |
| 250 | 250 | break; |
| 251 | 251 | case 'licenses': |
| 252 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
| 252 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
| 253 | 253 | $found = true; |
| 254 | 254 | } |
| 255 | 255 | break; |
| 256 | 256 | case 'api': |
| 257 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
| 257 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
| 258 | 258 | $found = true; |
| 259 | 259 | } |
| 260 | 260 | break; |
| 261 | 261 | case 'advanced': |
| 262 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
| 262 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
| 263 | 263 | $found = true; |
| 264 | 264 | } |
| 265 | 265 | break; |
| 266 | 266 | case 'system_info': |
| 267 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
| 267 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
| 268 | 268 | $found = true; |
| 269 | 269 | } |
| 270 | 270 | break; |
| 271 | 271 | default: |
| 272 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
| 272 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
| 273 | 273 | $found = true; |
| 274 | 274 | } |
| 275 | 275 | break; |
| 276 | 276 | } |
| 277 | 277 | break; |
| 278 | 278 | case 'addons': |
| 279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
| 279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
| 280 | 280 | $found = true; |
| 281 | 281 | } |
| 282 | 282 | break; |
| 283 | 283 | case 'donors': |
| 284 | - switch ( $passed_view ) { |
|
| 284 | + switch ($passed_view) { |
|
| 285 | 285 | case 'list-table': |
| 286 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
| 286 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
| 287 | 287 | $found = true; |
| 288 | 288 | } |
| 289 | 289 | break; |
| 290 | 290 | case 'overview': |
| 291 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
| 291 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
| 292 | 292 | $found = true; |
| 293 | 293 | } |
| 294 | 294 | break; |
| 295 | 295 | case 'notes': |
| 296 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
| 296 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
| 297 | 297 | $found = true; |
| 298 | 298 | } |
| 299 | 299 | break; |
| 300 | 300 | default: |
| 301 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
| 301 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
| 302 | 302 | $found = true; |
| 303 | 303 | } |
| 304 | 304 | break; |
| 305 | 305 | } |
| 306 | 306 | break; |
| 307 | 307 | case 'reports': |
| 308 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 308 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 309 | 309 | $found = true; |
| 310 | 310 | } |
| 311 | 311 | break; |
| 312 | 312 | default: |
| 313 | 313 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page, $give_tools_page; |
| 314 | 314 | |
| 315 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
| 315 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
| 316 | 316 | $give_payments_page, |
| 317 | 317 | $give_settings_page, |
| 318 | 318 | $give_reports_page, |
@@ -323,19 +323,19 @@ discard block |
||
| 323 | 323 | $give_customers_page, |
| 324 | 324 | $give_tools_page, |
| 325 | 325 | 'widgets.php' |
| 326 | - ) ); |
|
| 327 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
| 326 | + )); |
|
| 327 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
| 328 | 328 | $found = true; |
| 329 | - if ( 'give-upgrades' === $page ) { |
|
| 329 | + if ('give-upgrades' === $page) { |
|
| 330 | 330 | $found = false; |
| 331 | 331 | } |
| 332 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
| 332 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
| 333 | 333 | $found = true; |
| 334 | 334 | } |
| 335 | 335 | break; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
| 338 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
| 339 | 339 | |
| 340 | 340 | } |
| 341 | 341 | |
@@ -347,37 +347,37 @@ discard block |
||
| 347 | 347 | * @param array $settings |
| 348 | 348 | * @return array |
| 349 | 349 | */ |
| 350 | -function give_settings_page_pages( $settings ) { |
|
| 351 | - include( 'abstract-admin-settings-page.php' ); |
|
| 352 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
| 350 | +function give_settings_page_pages($settings) { |
|
| 351 | + include('abstract-admin-settings-page.php'); |
|
| 352 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
| 353 | 353 | |
| 354 | 354 | $settings = array( |
| 355 | 355 | // General settings. |
| 356 | - include( 'settings/class-settings-general.php' ), |
|
| 356 | + include('settings/class-settings-general.php'), |
|
| 357 | 357 | |
| 358 | 358 | // Payment Gateways Settings. |
| 359 | - include( 'settings/class-settings-gateways.php' ), |
|
| 359 | + include('settings/class-settings-gateways.php'), |
|
| 360 | 360 | |
| 361 | 361 | // Display settings. |
| 362 | - include( 'settings/class-settings-display.php' ), |
|
| 362 | + include('settings/class-settings-display.php'), |
|
| 363 | 363 | |
| 364 | 364 | // Emails settings. |
| 365 | - include( 'settings/class-settings-email.php' ), |
|
| 365 | + include('settings/class-settings-email.php'), |
|
| 366 | 366 | |
| 367 | 367 | // Addons settings. |
| 368 | - include( 'settings/class-settings-addon.php' ), |
|
| 368 | + include('settings/class-settings-addon.php'), |
|
| 369 | 369 | |
| 370 | 370 | // License settings. |
| 371 | - include( 'settings/class-settings-license.php' ), |
|
| 371 | + include('settings/class-settings-license.php'), |
|
| 372 | 372 | |
| 373 | 373 | // Advanced settinns. |
| 374 | - include( 'settings/class-settings-advanced.php' ) |
|
| 374 | + include('settings/class-settings-advanced.php') |
|
| 375 | 375 | ); |
| 376 | 376 | |
| 377 | 377 | // Output. |
| 378 | 378 | return $settings; |
| 379 | 379 | } |
| 380 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
| 380 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
| 381 | 381 | |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -387,28 +387,28 @@ discard block |
||
| 387 | 387 | * @param array $settings |
| 388 | 388 | * @return array |
| 389 | 389 | */ |
| 390 | -function give_reports_page_pages( $settings ) { |
|
| 391 | - include( 'abstract-admin-settings-page.php' ); |
|
| 390 | +function give_reports_page_pages($settings) { |
|
| 391 | + include('abstract-admin-settings-page.php'); |
|
| 392 | 392 | |
| 393 | 393 | $settings = array( |
| 394 | 394 | // Earnings. |
| 395 | - include( 'reporting/class-settings-earnings.php' ), |
|
| 395 | + include('reporting/class-settings-earnings.php'), |
|
| 396 | 396 | |
| 397 | 397 | // Forms. |
| 398 | - include( 'reporting/class-settings-forms.php' ), |
|
| 398 | + include('reporting/class-settings-forms.php'), |
|
| 399 | 399 | |
| 400 | 400 | // Donors. |
| 401 | - include( 'reporting/class-settings-donors.php' ), |
|
| 401 | + include('reporting/class-settings-donors.php'), |
|
| 402 | 402 | |
| 403 | 403 | // Gateways. |
| 404 | - include( 'reporting/class-settings-gateways.php' ), |
|
| 404 | + include('reporting/class-settings-gateways.php'), |
|
| 405 | 405 | |
| 406 | 406 | ); |
| 407 | 407 | |
| 408 | 408 | // Output. |
| 409 | 409 | return $settings; |
| 410 | 410 | } |
| 411 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
| 411 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
| 412 | 412 | |
| 413 | 413 | /** |
| 414 | 414 | * Add setting tab to give-settings page |
@@ -417,31 +417,31 @@ discard block |
||
| 417 | 417 | * @param array $settings |
| 418 | 418 | * @return array |
| 419 | 419 | */ |
| 420 | -function give_tools_page_pages( $settings ) { |
|
| 421 | - include( 'abstract-admin-settings-page.php' ); |
|
| 420 | +function give_tools_page_pages($settings) { |
|
| 421 | + include('abstract-admin-settings-page.php'); |
|
| 422 | 422 | |
| 423 | 423 | $settings = array( |
| 424 | 424 | // System Info. |
| 425 | - include( 'tools/class-settings-system-info.php' ), |
|
| 425 | + include('tools/class-settings-system-info.php'), |
|
| 426 | 426 | |
| 427 | 427 | // Logs. |
| 428 | - include( 'tools/class-settings-logs.php' ), |
|
| 428 | + include('tools/class-settings-logs.php'), |
|
| 429 | 429 | |
| 430 | 430 | // API. |
| 431 | - include( 'tools/class-settings-api.php' ), |
|
| 431 | + include('tools/class-settings-api.php'), |
|
| 432 | 432 | |
| 433 | 433 | // Data. |
| 434 | - include( 'tools/class-settings-data.php' ), |
|
| 434 | + include('tools/class-settings-data.php'), |
|
| 435 | 435 | |
| 436 | 436 | // Export. |
| 437 | - include( 'tools/class-settings-export.php' ), |
|
| 437 | + include('tools/class-settings-export.php'), |
|
| 438 | 438 | |
| 439 | 439 | ); |
| 440 | 440 | |
| 441 | 441 | // Output. |
| 442 | 442 | return $settings; |
| 443 | 443 | } |
| 444 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
| 444 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | 447 | * Set default tools page tab. |
@@ -450,10 +450,10 @@ discard block |
||
| 450 | 450 | * @param string $default_tab Default tab name. |
| 451 | 451 | * @return string |
| 452 | 452 | */ |
| 453 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
| 453 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
| 454 | 454 | return 'system-info'; |
| 455 | 455 | } |
| 456 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
| 456 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
| 457 | 457 | |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * @param string $default_tab Default tab name. |
| 464 | 464 | * @return string |
| 465 | 465 | */ |
| 466 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
| 466 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
| 467 | 467 | return 'earnings'; |
| 468 | 468 | } |
| 469 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
| 470 | 469 | \ No newline at end of file |
| 470 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
| 471 | 471 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | * @since 1.0 |
| 36 | 36 | */ |
| 37 | 37 | public function __construct() { |
| 38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
| 39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
| 40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
| 39 | + add_action('admin_head', array($this, 'admin_head')); |
|
| 40 | + add_action('admin_init', array($this, 'welcome')); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | 51 | public function admin_menus() { |
| 52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
| 52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
| 53 | 53 | |
| 54 | 54 | // About Page |
| 55 | 55 | add_dashboard_page( |
| 56 | 56 | /* translators: %s: Give version */ |
| 57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
| 58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
| 57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
| 58 | + esc_html__('Welcome to Give', 'give'), |
|
| 59 | 59 | $this->minimum_capability, |
| 60 | 60 | 'give-about', |
| 61 | - array( $this, 'about_screen' ) |
|
| 61 | + array($this, 'about_screen') |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | // Changelog Page |
| 65 | 65 | add_dashboard_page( |
| 66 | - esc_html__( 'Give Changelog', 'give' ), |
|
| 67 | - esc_html__( 'Give Changelog', 'give' ), |
|
| 66 | + esc_html__('Give Changelog', 'give'), |
|
| 67 | + esc_html__('Give Changelog', 'give'), |
|
| 68 | 68 | $this->minimum_capability, |
| 69 | 69 | 'give-changelog', |
| 70 | - array( $this, 'changelog_screen' ) |
|
| 70 | + array($this, 'changelog_screen') |
|
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | // Getting Started Page |
| 74 | 74 | add_dashboard_page( |
| 75 | 75 | /* translators: %s: Give version */ |
| 76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
| 77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
| 76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
| 77 | + esc_html__('Getting started with Give', 'give'), |
|
| 78 | 78 | $this->minimum_capability, |
| 79 | 79 | 'give-getting-started', |
| 80 | - array( $this, 'getting_started_screen' ) |
|
| 80 | + array($this, 'getting_started_screen') |
|
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | 83 | // Credits Page |
| 84 | 84 | add_dashboard_page( |
| 85 | 85 | /* translators: %s: Give version */ |
| 86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
| 87 | - esc_html__( 'The people that build Give', 'give' ), |
|
| 86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
| 87 | + esc_html__('The people that build Give', 'give'), |
|
| 88 | 88 | $this->minimum_capability, |
| 89 | 89 | 'give-credits', |
| 90 | - array( $this, 'credits_screen' ) |
|
| 90 | + array($this, 'credits_screen') |
|
| 91 | 91 | ); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function admin_head() { |
| 102 | 102 | |
| 103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
| 104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
| 105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
| 106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
| 103 | + remove_submenu_page('index.php', 'give-about'); |
|
| 104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
| 105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
| 106 | + remove_submenu_page('index.php', 'give-credits'); |
|
| 107 | 107 | |
| 108 | 108 | } |
| 109 | 109 | |
@@ -115,24 +115,24 @@ discard block |
||
| 115 | 115 | * @return void |
| 116 | 116 | */ |
| 117 | 117 | public function tabs() { |
| 118 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
| 118 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
| 119 | 119 | ?> |
| 120 | 120 | <h2 class="nav-tab-wrapper"> |
| 121 | 121 | <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" |
| 122 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
| 123 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
| 122 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
| 123 | + <?php esc_html_e('About Give', 'give'); ?> |
|
| 124 | 124 | </a> |
| 125 | 125 | <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" |
| 126 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
| 127 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
| 126 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
| 127 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
| 128 | 128 | </a> |
| 129 | 129 | <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" |
| 130 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
| 131 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
| 130 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
| 131 | + <?php esc_html_e('Credits', 'give'); ?> |
|
| 132 | 132 | </a> |
| 133 | 133 | <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" |
| 134 | - href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
| 135 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
| 134 | + href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
| 135 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
| 136 | 136 | </a> |
| 137 | 137 | </h2> |
| 138 | 138 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @return void |
| 147 | 147 | */ |
| 148 | 148 | public function about_screen() { |
| 149 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
| 149 | + list($display_version) = explode('-', GIVE_VERSION); |
|
| 150 | 150 | ?> |
| 151 | 151 | <div class="wrap about-wrap"> |
| 152 | 152 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | <p class="about-text"><?php |
| 156 | 156 | printf( |
| 157 | 157 | /* translators: %s: https://givewp.com/documenation/ */ |
| 158 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
| 159 | - esc_url( 'https://givewp.com/documenation/' ) |
|
| 158 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
| 159 | + esc_url('https://givewp.com/documenation/') |
|
| 160 | 160 | ); |
| 161 | 161 | ?></p> |
| 162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | <div class="give-badge"><?php |
| 166 | 166 | printf( |
| 167 | 167 | /* translators: %s: Give version */ |
| 168 | - esc_html__( 'Version %s', 'give' ), |
|
| 168 | + esc_html__('Version %s', 'give'), |
|
| 169 | 169 | $display_version |
| 170 | 170 | ); |
| 171 | 171 | ?></div> |
@@ -175,17 +175,17 @@ discard block |
||
| 175 | 175 | <div class="feature-section clearfix introduction"> |
| 176 | 176 | |
| 177 | 177 | <div class="video feature-section-item"> |
| 178 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" |
|
| 179 | - alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
| 178 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" |
|
| 179 | + alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
| 180 | 180 | </div> |
| 181 | 181 | |
| 182 | 182 | <div class="content feature-section-item last-feature"> |
| 183 | 183 | |
| 184 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
| 184 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
| 185 | 185 | |
| 186 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
| 186 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
| 187 | 187 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
| 188 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
| 188 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
| 189 | 189 | <span class="dashicons dashicons-external"></span> |
| 190 | 190 | </a> |
| 191 | 191 | |
@@ -198,22 +198,22 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | <div class="content feature-section-item"> |
| 200 | 200 | |
| 201 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
| 201 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
| 202 | 202 | |
| 203 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
| 203 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
| 204 | 204 | |
| 205 | 205 | <h4>Find Out More:</h4> |
| 206 | 206 | <ul class="ul-disc"> |
| 207 | - <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li> |
|
| 208 | - <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li> |
|
| 209 | - <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li> |
|
| 207 | + <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li> |
|
| 208 | + <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li> |
|
| 209 | + <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li> |
|
| 210 | 210 | </ul> |
| 211 | 211 | |
| 212 | 212 | </div> |
| 213 | 213 | |
| 214 | 214 | <div class="content feature-section-item last-feature"> |
| 215 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>" |
|
| 216 | - alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
| 215 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>" |
|
| 216 | + alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
| 217 | 217 | </div> |
| 218 | 218 | |
| 219 | 219 | </div> |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @return void |
| 233 | 233 | */ |
| 234 | 234 | public function changelog_screen() { |
| 235 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
| 235 | + list($display_version) = explode('-', GIVE_VERSION); |
|
| 236 | 236 | ?> |
| 237 | 237 | <div class="wrap about-wrap"> |
| 238 | 238 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | <p class="about-text"><?php |
| 241 | 241 | printf( |
| 242 | 242 | /* translators: %s: Give version */ |
| 243 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
| 243 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
| 244 | 244 | $display_version |
| 245 | 245 | ); |
| 246 | 246 | ?></p> |
| 247 | 247 | <div class="give-badge"><?php |
| 248 | 248 | printf( |
| 249 | 249 | /* translators: %s: Give version */ |
| 250 | - esc_html__( 'Version %s', 'give' ), |
|
| 250 | + esc_html__('Version %s', 'give'), |
|
| 251 | 251 | $display_version |
| 252 | 252 | ); |
| 253 | 253 | ?></div> |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | <?php $this->tabs(); ?> |
| 256 | 256 | |
| 257 | 257 | <div class="changelog"> |
| 258 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
| 258 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
| 259 | 259 | |
| 260 | 260 | <div class="feature-section"> |
| 261 | 261 | <?php echo $this->parse_readme(); ?> |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | </div> |
| 264 | 264 | |
| 265 | 265 | <div class="return-to-dashboard"> |
| 266 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
| 266 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
| 267 | 267 | 'post_type' => 'give_forms', |
| 268 | 268 | 'page' => 'give-settings' |
| 269 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
| 269 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
| 270 | 270 | </div> |
| 271 | 271 | </div> |
| 272 | 272 | <?php |
@@ -280,36 +280,36 @@ discard block |
||
| 280 | 280 | * @return void |
| 281 | 281 | */ |
| 282 | 282 | public function getting_started_screen() { |
| 283 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
| 283 | + list($display_version) = explode('-', GIVE_VERSION); |
|
| 284 | 284 | ?> |
| 285 | 285 | <div class="wrap about-wrap get-started"> |
| 286 | 286 | |
| 287 | 287 | <?php $this->get_welcome_header() ?> |
| 288 | 288 | |
| 289 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
| 289 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
| 290 | 290 | |
| 291 | 291 | <?php give_get_newsletter(); ?> |
| 292 | 292 | |
| 293 | 293 | <div class="give-badge"><?php |
| 294 | 294 | printf( |
| 295 | 295 | /* translators: %s: Give version */ |
| 296 | - esc_html__( 'Version %s', 'give' ), |
|
| 296 | + esc_html__('Version %s', 'give'), |
|
| 297 | 297 | $display_version |
| 298 | 298 | ); |
| 299 | 299 | ?></div> |
| 300 | 300 | |
| 301 | 301 | <?php $this->tabs(); ?> |
| 302 | 302 | |
| 303 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
| 303 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
| 304 | 304 | |
| 305 | 305 | <div class="feature-section clearfix"> |
| 306 | 306 | |
| 307 | 307 | <div class="content feature-section-item"> |
| 308 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
| 308 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
| 309 | 309 | |
| 310 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
| 310 | + <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
| 311 | 311 | |
| 312 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p> |
|
| 312 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p> |
|
| 313 | 313 | </div> |
| 314 | 314 | |
| 315 | 315 | <div class="content feature-section-item last-feature"> |
@@ -326,9 +326,9 @@ discard block |
||
| 326 | 326 | </div> |
| 327 | 327 | |
| 328 | 328 | <div class="content feature-section-item last-feature"> |
| 329 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
| 329 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
| 330 | 330 | |
| 331 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
| 331 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
| 332 | 332 | </div> |
| 333 | 333 | |
| 334 | 334 | </div> |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | <div class="feature-section clearfix"> |
| 338 | 338 | |
| 339 | 339 | <div class="content feature-section-item add-content"> |
| 340 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
| 340 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
| 341 | 341 | |
| 342 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
| 342 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
| 343 | 343 | |
| 344 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
| 344 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
| 345 | 345 | </div> |
| 346 | 346 | |
| 347 | 347 | <div class="content feature-section-item last-feature"> |
@@ -358,9 +358,9 @@ discard block |
||
| 358 | 358 | </div> |
| 359 | 359 | |
| 360 | 360 | <div class="content feature-section-item last-feature"> |
| 361 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
| 361 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
| 362 | 362 | |
| 363 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
| 363 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
| 364 | 364 | </div> |
| 365 | 365 | |
| 366 | 366 | |
@@ -380,20 +380,20 @@ discard block |
||
| 380 | 380 | * @return void |
| 381 | 381 | */ |
| 382 | 382 | public function credits_screen() { |
| 383 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
| 383 | + list($display_version) = explode('-', GIVE_VERSION); |
|
| 384 | 384 | ?> |
| 385 | 385 | <div class="wrap about-wrap"> |
| 386 | 386 | |
| 387 | 387 | <?php $this->get_welcome_header() ?> |
| 388 | 388 | |
| 389 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
| 389 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
| 390 | 390 | |
| 391 | 391 | <?php give_get_newsletter(); ?> |
| 392 | 392 | |
| 393 | 393 | <div class="give-badge"><?php |
| 394 | 394 | printf( |
| 395 | 395 | /* translators: %s: Give version */ |
| 396 | - esc_html__( 'Version %s', 'give' ), |
|
| 396 | + esc_html__('Version %s', 'give'), |
|
| 397 | 397 | $display_version |
| 398 | 398 | ); |
| 399 | 399 | ?></div> |
@@ -403,8 +403,8 @@ discard block |
||
| 403 | 403 | <p class="about-description"><?php |
| 404 | 404 | printf( |
| 405 | 405 | /* translators: %s: https://github.com/WordImpress/give */ |
| 406 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
| 407 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
| 406 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
| 407 | + esc_url('https://github.com/WordImpress/give') |
|
| 408 | 408 | ); |
| 409 | 409 | ?></p> |
| 410 | 410 | |
@@ -421,21 +421,21 @@ discard block |
||
| 421 | 421 | * @return string $readme HTML formatted readme file |
| 422 | 422 | */ |
| 423 | 423 | public function parse_readme() { |
| 424 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
| 424 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
| 425 | 425 | |
| 426 | - if ( ! $file ) { |
|
| 427 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
| 426 | + if ( ! $file) { |
|
| 427 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
| 428 | 428 | } else { |
| 429 | - $readme = file_get_contents( $file ); |
|
| 430 | - $readme = nl2br( esc_html( $readme ) ); |
|
| 431 | - $readme = explode( '== Changelog ==', $readme ); |
|
| 432 | - $readme = end( $readme ); |
|
| 433 | - |
|
| 434 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
| 435 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
| 436 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
| 437 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
| 438 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
| 429 | + $readme = file_get_contents($file); |
|
| 430 | + $readme = nl2br(esc_html($readme)); |
|
| 431 | + $readme = explode('== Changelog ==', $readme); |
|
| 432 | + $readme = end($readme); |
|
| 433 | + |
|
| 434 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
| 435 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
| 436 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
| 437 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
| 438 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | return $readme; |
@@ -452,24 +452,24 @@ discard block |
||
| 452 | 452 | public function contributors() { |
| 453 | 453 | $contributors = $this->get_contributors(); |
| 454 | 454 | |
| 455 | - if ( empty( $contributors ) ) { |
|
| 455 | + if (empty($contributors)) { |
|
| 456 | 456 | return ''; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | $contributor_list = '<ul class="wp-people-group">'; |
| 460 | 460 | |
| 461 | - foreach ( $contributors as $contributor ) { |
|
| 461 | + foreach ($contributors as $contributor) { |
|
| 462 | 462 | $contributor_list .= '<li class="wp-person">'; |
| 463 | 463 | $contributor_list .= sprintf( |
| 464 | 464 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
| 465 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
| 466 | - esc_url( $contributor->avatar_url ), |
|
| 467 | - esc_attr( $contributor->login ) |
|
| 465 | + esc_url('https://github.com/'.$contributor->login), |
|
| 466 | + esc_url($contributor->avatar_url), |
|
| 467 | + esc_attr($contributor->login) |
|
| 468 | 468 | ); |
| 469 | 469 | $contributor_list .= sprintf( |
| 470 | 470 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
| 471 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
| 472 | - esc_html( $contributor->login ) |
|
| 471 | + esc_url('https://github.com/'.$contributor->login), |
|
| 472 | + esc_html($contributor->login) |
|
| 473 | 473 | ); |
| 474 | 474 | $contributor_list .= '</li>'; |
| 475 | 475 | } |
@@ -487,25 +487,25 @@ discard block |
||
| 487 | 487 | * @return array $contributors List of contributors |
| 488 | 488 | */ |
| 489 | 489 | public function get_contributors() { |
| 490 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
| 490 | + $contributors = Give_Cache::get('give_contributors', true); |
|
| 491 | 491 | |
| 492 | - if ( false !== $contributors ) { |
|
| 492 | + if (false !== $contributors) { |
|
| 493 | 493 | return $contributors; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
| 496 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
| 497 | 497 | |
| 498 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
| 498 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
| 499 | 499 | return array(); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 502 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
| 503 | 503 | |
| 504 | - if ( ! is_array( $contributors ) ) { |
|
| 504 | + if ( ! is_array($contributors)) { |
|
| 505 | 505 | return array(); |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
| 508 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
| 509 | 509 | |
| 510 | 510 | return $contributors; |
| 511 | 511 | } |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | */ |
| 518 | 518 | public function get_welcome_header() { |
| 519 | 519 | // Badge for welcome page |
| 520 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
| 520 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
| 521 | 521 | ?> |
| 522 | 522 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
| 523 | 523 | <?php $this->social_media_elements(); ?> |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
| 611 | 611 | printf( |
| 612 | 612 | /* translators: %s: Give twitter user @givewp */ |
| 613 | - esc_html_e( 'Follow %s', 'give' ), |
|
| 613 | + esc_html_e('Follow %s', 'give'), |
|
| 614 | 614 | '@givewp' |
| 615 | 615 | ); |
| 616 | 616 | ?></a> |
@@ -644,27 +644,27 @@ discard block |
||
| 644 | 644 | public function welcome() { |
| 645 | 645 | |
| 646 | 646 | // Bail if no activation redirect |
| 647 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) { |
|
| 647 | + if ( ! Give_Cache::get('_give_activation_redirect', true)) { |
|
| 648 | 648 | return; |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | // Delete the redirect transient |
| 652 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
| 652 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
| 653 | 653 | |
| 654 | 654 | // Bail if activating from network, or bulk |
| 655 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
| 655 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
| 656 | 656 | return; |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
| 659 | + $upgrade = get_option('give_version_upgraded_from'); |
|
| 660 | 660 | |
| 661 | - if ( ! $upgrade ) { // First time install |
|
| 662 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
| 661 | + if ( ! $upgrade) { // First time install |
|
| 662 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
| 663 | 663 | exit; |
| 664 | - } elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
| 664 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
| 665 | 665 | |
| 666 | 666 | } else { // Welcome is NOT disabled in settings |
| 667 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
| 667 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
| 668 | 668 | exit; |
| 669 | 669 | } |
| 670 | 670 | } |
@@ -10,13 +10,13 @@ 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 | 17 | // Load WP_List_Table if not loaded. |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | public function __construct() { |
| 119 | 119 | |
| 120 | 120 | // Set parent defaults. |
| 121 | - parent::__construct( array( |
|
| 122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 124 | - 'ajax' => false, // Does this table support ajax? |
|
| 125 | - ) ); |
|
| 121 | + parent::__construct(array( |
|
| 122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
| 123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
| 124 | + 'ajax' => false, // Does this table support ajax? |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | 127 | $this->get_payment_counts(); |
| 128 | 128 | $this->process_bulk_action(); |
| 129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -135,29 +135,29 @@ discard block |
||
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | 137 | public function advanced_filters() { |
| 138 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 139 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
| 140 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 138 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 139 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
| 140 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 141 | 141 | ?> |
| 142 | 142 | <div id="give-payment-filters"> |
| 143 | 143 | <span id="give-payment-date-filters"> |
| 144 | 144 | <label for="start-date" |
| 145 | - class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
| 145 | + class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
| 146 | 146 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
| 147 | 147 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
| 148 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
| 148 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
| 149 | 149 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
| 150 | 150 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
| 151 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
| 151 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
| 152 | 152 | </span> |
| 153 | - <?php if ( ! empty( $status ) ) : ?> |
|
| 154 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
| 153 | + <?php if ( ! empty($status)) : ?> |
|
| 154 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
| 155 | 155 | <?php endif; ?> |
| 156 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
| 157 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
| 158 | - class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
| 156 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
| 157 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
| 158 | + class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
| 159 | 159 | <?php endif; ?> |
| 160 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
| 160 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
| 161 | 161 | </div> |
| 162 | 162 | |
| 163 | 163 | <?php |
@@ -174,18 +174,18 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @return void |
| 176 | 176 | */ |
| 177 | - public function search_box( $text, $input_id ) { |
|
| 178 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
| 177 | + public function search_box($text, $input_id) { |
|
| 178 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
| 179 | 179 | return; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $input_id = $input_id . '-search-input'; |
|
| 182 | + $input_id = $input_id.'-search-input'; |
|
| 183 | 183 | |
| 184 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 185 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 184 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 185 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 186 | 186 | } |
| 187 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 188 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 187 | + if ( ! empty($_REQUEST['order'])) { |
|
| 188 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 189 | 189 | } |
| 190 | 190 | ?> |
| 191 | 191 | <p class="search-box" role="search"> |
@@ -197,11 +197,11 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @since 1.7 |
| 199 | 199 | */ |
| 200 | - do_action( 'give_payment_history_search' ); |
|
| 200 | + do_action('give_payment_history_search'); |
|
| 201 | 201 | ?> |
| 202 | 202 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 203 | 203 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 204 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
| 204 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
| 205 | 205 | </p> |
| 206 | 206 | <?php |
| 207 | 207 | } |
@@ -215,52 +215,52 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function get_views() { |
| 217 | 217 | |
| 218 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 219 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
| 220 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
| 221 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
| 222 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
| 223 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
| 224 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
| 225 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
| 226 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
| 218 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 219 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
| 220 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
| 221 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
| 222 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
| 223 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
| 224 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
| 225 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
| 226 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
| 227 | 227 | |
| 228 | 228 | $views = array( |
| 229 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
| 229 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
| 230 | 230 | 'status', |
| 231 | 231 | 'paged', |
| 232 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
| 233 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 232 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
| 233 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 234 | 234 | 'status' => 'publish', |
| 235 | 235 | 'paged' => false, |
| 236 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
| 237 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 236 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
| 237 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 238 | 238 | 'status' => 'pending', |
| 239 | 239 | 'paged' => false, |
| 240 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
| 241 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 240 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
| 241 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 242 | 242 | 'status' => 'refunded', |
| 243 | 243 | 'paged' => false, |
| 244 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
| 245 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 244 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
| 245 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 246 | 246 | 'status' => 'revoked', |
| 247 | 247 | 'paged' => false, |
| 248 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
| 249 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 248 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
| 249 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 250 | 250 | 'status' => 'failed', |
| 251 | 251 | 'paged' => false, |
| 252 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
| 253 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 252 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
| 253 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 254 | 254 | 'status' => 'cancelled', |
| 255 | 255 | 'paged' => false, |
| 256 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
| 257 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 256 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
| 257 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 258 | 258 | 'status' => 'abandoned', |
| 259 | 259 | 'paged' => false, |
| 260 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
| 260 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
| 261 | 261 | ); |
| 262 | 262 | |
| 263 | - return apply_filters( 'give_payments_table_views', $views ); |
|
| 263 | + return apply_filters('give_payments_table_views', $views); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -273,15 +273,15 @@ discard block |
||
| 273 | 273 | public function get_columns() { |
| 274 | 274 | $columns = array( |
| 275 | 275 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
| 276 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
| 277 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
| 278 | - 'status' => esc_html__( 'Status', 'give' ), |
|
| 279 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 280 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 281 | - 'details' => esc_html__( 'Details', 'give' ), |
|
| 276 | + 'donation' => esc_html__('Donation', 'give'), |
|
| 277 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
| 278 | + 'status' => esc_html__('Status', 'give'), |
|
| 279 | + 'date' => esc_html__('Date', 'give'), |
|
| 280 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 281 | + 'details' => esc_html__('Details', 'give'), |
|
| 282 | 282 | ); |
| 283 | 283 | |
| 284 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
| 284 | + return apply_filters('give_payments_table_columns', $columns); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -293,14 +293,14 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public function get_sortable_columns() { |
| 295 | 295 | $columns = array( |
| 296 | - 'donation' => array( 'ID', true ), |
|
| 297 | - 'donation_form' => array( 'donation_form', false ), |
|
| 298 | - 'status' => array( 'status', false ), |
|
| 299 | - 'amount' => array( 'amount', false ), |
|
| 300 | - 'date' => array( 'date', false ), |
|
| 296 | + 'donation' => array('ID', true), |
|
| 297 | + 'donation_form' => array('donation_form', false), |
|
| 298 | + 'status' => array('status', false), |
|
| 299 | + 'amount' => array('amount', false), |
|
| 300 | + 'date' => array('date', false), |
|
| 301 | 301 | ); |
| 302 | 302 | |
| 303 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
| 303 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
@@ -326,70 +326,70 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return string Column Name |
| 328 | 328 | */ |
| 329 | - public function column_default( $payment, $column_name ) { |
|
| 329 | + public function column_default($payment, $column_name) { |
|
| 330 | 330 | |
| 331 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
| 332 | - $row_actions = $this->get_row_actions( $payment ); |
|
| 331 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
| 332 | + $row_actions = $this->get_row_actions($payment); |
|
| 333 | 333 | |
| 334 | - switch ( $column_name ) { |
|
| 334 | + switch ($column_name) { |
|
| 335 | 335 | case 'donation' : |
| 336 | 336 | $value = sprintf( |
| 337 | 337 | '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', |
| 338 | 338 | $single_donation_url, |
| 339 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ), |
|
| 339 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID), |
|
| 340 | 340 | $payment->ID, |
| 341 | - esc_html__( 'by', 'give' ), |
|
| 342 | - $this->get_donor( $payment ) |
|
| 341 | + esc_html__('by', 'give'), |
|
| 342 | + $this->get_donor($payment) |
|
| 343 | 343 | ); |
| 344 | - $value .= $this->get_donor_email( $payment ); |
|
| 345 | - $value .= $this->row_actions( $row_actions ); |
|
| 344 | + $value .= $this->get_donor_email($payment); |
|
| 345 | + $value .= $this->row_actions($row_actions); |
|
| 346 | 346 | break; |
| 347 | 347 | |
| 348 | 348 | case 'amount' : |
| 349 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
| 350 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
| 351 | - $value .= sprintf( |
|
| 349 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
| 350 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
| 351 | + $value .= sprintf( |
|
| 352 | 352 | '<br><small>%1$s %2$s</small>', |
| 353 | - __( 'via', 'give' ), |
|
| 354 | - give_get_gateway_admin_label( $payment->gateway ) |
|
| 353 | + __('via', 'give'), |
|
| 354 | + give_get_gateway_admin_label($payment->gateway) |
|
| 355 | 355 | ); |
| 356 | 356 | break; |
| 357 | 357 | |
| 358 | 358 | case 'donation_form' : |
| 359 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
| 360 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
| 361 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
| 359 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
| 360 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
| 361 | + $level = give_get_payment_form_title($payment->meta, true); |
|
| 362 | 362 | |
| 363 | - if ( ! empty( $level ) ) { |
|
| 363 | + if ( ! empty($level)) { |
|
| 364 | 364 | $value .= $level; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | break; |
| 368 | 368 | |
| 369 | 369 | case 'date' : |
| 370 | - $date = strtotime( $payment->date ); |
|
| 371 | - $value = date_i18n( give_date_format(), $date ); |
|
| 370 | + $date = strtotime($payment->date); |
|
| 371 | + $value = date_i18n(give_date_format(), $date); |
|
| 372 | 372 | break; |
| 373 | 373 | |
| 374 | 374 | case 'status' : |
| 375 | - $value = $this->get_payment_status( $payment ); |
|
| 375 | + $value = $this->get_payment_status($payment); |
|
| 376 | 376 | break; |
| 377 | 377 | |
| 378 | 378 | case 'details' : |
| 379 | 379 | $value = sprintf( |
| 380 | 380 | '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', |
| 381 | 381 | $single_donation_url, |
| 382 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ) |
|
| 382 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID) |
|
| 383 | 383 | ); |
| 384 | 384 | break; |
| 385 | 385 | |
| 386 | 386 | default: |
| 387 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
| 387 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
| 388 | 388 | break; |
| 389 | 389 | |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
| 392 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /** |
@@ -402,17 +402,17 @@ discard block |
||
| 402 | 402 | * |
| 403 | 403 | * @return string Data shown in the Email column |
| 404 | 404 | */ |
| 405 | - public function get_donor_email( $payment ) { |
|
| 405 | + public function get_donor_email($payment) { |
|
| 406 | 406 | |
| 407 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 407 | + $email = give_get_payment_user_email($payment->ID); |
|
| 408 | 408 | |
| 409 | - if ( empty( $email ) ) { |
|
| 410 | - $email = esc_html__( '(unknown)', 'give' ); |
|
| 409 | + if (empty($email)) { |
|
| 410 | + $email = esc_html__('(unknown)', 'give'); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
| 413 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
| 414 | 414 | |
| 415 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
| 415 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /** |
@@ -424,18 +424,18 @@ discard block |
||
| 424 | 424 | * |
| 425 | 425 | * @return array $actions |
| 426 | 426 | */ |
| 427 | - function get_row_actions( $payment ) { |
|
| 427 | + function get_row_actions($payment) { |
|
| 428 | 428 | |
| 429 | 429 | $actions = array(); |
| 430 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 430 | + $email = give_get_payment_user_email($payment->ID); |
|
| 431 | 431 | |
| 432 | 432 | // Add search term string back to base URL. |
| 433 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
| 434 | - if ( ! empty( $search_terms ) ) { |
|
| 435 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
| 433 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
| 434 | + if ( ! empty($search_terms)) { |
|
| 435 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
| 438 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
| 439 | 439 | |
| 440 | 440 | $actions['email_links'] = sprintf( |
| 441 | 441 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | ), |
| 450 | 450 | 'give_payment_nonce' |
| 451 | 451 | ), |
| 452 | - sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), |
|
| 453 | - esc_html__( 'Resend Receipt', 'give' ) |
|
| 452 | + sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), |
|
| 453 | + esc_html__('Resend Receipt', 'give') |
|
| 454 | 454 | ); |
| 455 | 455 | |
| 456 | 456 | } |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | ), |
| 468 | 468 | 'give_donation_nonce' |
| 469 | 469 | ), |
| 470 | - sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), |
|
| 471 | - esc_html__( 'Delete', 'give' ) |
|
| 470 | + sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), |
|
| 471 | + esc_html__('Delete', 'give') |
|
| 472 | 472 | ); |
| 473 | 473 | |
| 474 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
| 474 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | |
@@ -485,10 +485,10 @@ discard block |
||
| 485 | 485 | * |
| 486 | 486 | * @return string Data shown in the Email column |
| 487 | 487 | */ |
| 488 | - function get_payment_status( $payment ) { |
|
| 489 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
| 490 | - if ( $payment->mode == 'test' ) { |
|
| 491 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
| 488 | + function get_payment_status($payment) { |
|
| 489 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
| 490 | + if ($payment->mode == 'test') { |
|
| 491 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | return $value; |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | * |
| 505 | 505 | * @return string Displays a checkbox. |
| 506 | 506 | */ |
| 507 | - public function column_cb( $payment ) { |
|
| 507 | + public function column_cb($payment) { |
|
| 508 | 508 | return sprintf( |
| 509 | 509 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
| 510 | 510 | 'payment', |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | * |
| 523 | 523 | * @return string Displays a checkbox. |
| 524 | 524 | */ |
| 525 | - public function get_payment_id( $payment ) { |
|
| 526 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
| 525 | + public function get_payment_id($payment) { |
|
| 526 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /** |
@@ -536,19 +536,19 @@ discard block |
||
| 536 | 536 | * |
| 537 | 537 | * @return string Data shown in the User column |
| 538 | 538 | */ |
| 539 | - public function get_donor( $payment ) { |
|
| 539 | + public function get_donor($payment) { |
|
| 540 | 540 | |
| 541 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
| 541 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
| 542 | 542 | |
| 543 | - if ( ! empty( $customer_id ) ) { |
|
| 544 | - $customer = new Give_Customer( $customer_id ); |
|
| 545 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
| 543 | + if ( ! empty($customer_id)) { |
|
| 544 | + $customer = new Give_Customer($customer_id); |
|
| 545 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
| 546 | 546 | } else { |
| 547 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 548 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
| 547 | + $email = give_get_payment_user_email($payment->ID); |
|
| 548 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
| 551 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | /** |
@@ -560,18 +560,18 @@ discard block |
||
| 560 | 560 | */ |
| 561 | 561 | public function get_bulk_actions() { |
| 562 | 562 | $actions = array( |
| 563 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
| 564 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
| 565 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
| 566 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
| 567 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
| 568 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
| 569 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
| 570 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
| 571 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ), |
|
| 563 | + 'delete' => esc_html__('Delete', 'give'), |
|
| 564 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
| 565 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
| 566 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
| 567 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
| 568 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
| 569 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
| 570 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
| 571 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give'), |
|
| 572 | 572 | ); |
| 573 | 573 | |
| 574 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
| 574 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | /** |
@@ -582,59 +582,59 @@ discard block |
||
| 582 | 582 | * @return void |
| 583 | 583 | */ |
| 584 | 584 | public function process_bulk_action() { |
| 585 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
| 585 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
| 586 | 586 | $action = $this->current_action(); |
| 587 | 587 | |
| 588 | - if ( ! is_array( $ids ) ) { |
|
| 589 | - $ids = array( $ids ); |
|
| 588 | + if ( ! is_array($ids)) { |
|
| 589 | + $ids = array($ids); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - if ( empty( $action ) ) { |
|
| 592 | + if (empty($action)) { |
|
| 593 | 593 | return; |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | - foreach ( $ids as $id ) { |
|
| 596 | + foreach ($ids as $id) { |
|
| 597 | 597 | |
| 598 | 598 | // Detect when a bulk action is being triggered. |
| 599 | - switch ( $this->current_action() ) { |
|
| 599 | + switch ($this->current_action()) { |
|
| 600 | 600 | |
| 601 | 601 | case'delete': |
| 602 | - give_delete_purchase( $id ); |
|
| 602 | + give_delete_purchase($id); |
|
| 603 | 603 | break; |
| 604 | 604 | |
| 605 | 605 | case 'set-status-publish': |
| 606 | - give_update_payment_status( $id, 'publish' ); |
|
| 606 | + give_update_payment_status($id, 'publish'); |
|
| 607 | 607 | break; |
| 608 | 608 | |
| 609 | 609 | case 'set-status-pending': |
| 610 | - give_update_payment_status( $id, 'pending' ); |
|
| 610 | + give_update_payment_status($id, 'pending'); |
|
| 611 | 611 | break; |
| 612 | 612 | |
| 613 | 613 | case 'set-status-refunded': |
| 614 | - give_update_payment_status( $id, 'refunded' ); |
|
| 614 | + give_update_payment_status($id, 'refunded'); |
|
| 615 | 615 | break; |
| 616 | 616 | case 'set-status-revoked': |
| 617 | - give_update_payment_status( $id, 'revoked' ); |
|
| 617 | + give_update_payment_status($id, 'revoked'); |
|
| 618 | 618 | break; |
| 619 | 619 | |
| 620 | 620 | case 'set-status-failed': |
| 621 | - give_update_payment_status( $id, 'failed' ); |
|
| 621 | + give_update_payment_status($id, 'failed'); |
|
| 622 | 622 | break; |
| 623 | 623 | |
| 624 | 624 | case 'set-status-cancelled': |
| 625 | - give_update_payment_status( $id, 'cancelled' ); |
|
| 625 | + give_update_payment_status($id, 'cancelled'); |
|
| 626 | 626 | break; |
| 627 | 627 | |
| 628 | 628 | case 'set-status-abandoned': |
| 629 | - give_update_payment_status( $id, 'abandoned' ); |
|
| 629 | + give_update_payment_status($id, 'abandoned'); |
|
| 630 | 630 | break; |
| 631 | 631 | |
| 632 | 632 | case 'set-status-preapproval': |
| 633 | - give_update_payment_status( $id, 'preapproval' ); |
|
| 633 | + give_update_payment_status($id, 'preapproval'); |
|
| 634 | 634 | break; |
| 635 | 635 | |
| 636 | 636 | case 'resend-receipt': |
| 637 | - give_email_donation_receipt( $id, false ); |
|
| 637 | + give_email_donation_receipt($id, false); |
|
| 638 | 638 | break; |
| 639 | 639 | } |
| 640 | 640 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | * @param int $id The ID of the payment. |
| 647 | 647 | * @param string $current_action The action that is being triggered. |
| 648 | 648 | */ |
| 649 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
| 649 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | } |
@@ -662,27 +662,27 @@ discard block |
||
| 662 | 662 | |
| 663 | 663 | $args = array(); |
| 664 | 664 | |
| 665 | - if ( isset( $_GET['user'] ) ) { |
|
| 666 | - $args['user'] = urldecode( $_GET['user'] ); |
|
| 667 | - } elseif ( isset( $_GET['s'] ) ) { |
|
| 668 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
| 669 | - if ( $is_user ) { |
|
| 670 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
| 671 | - unset( $args['s'] ); |
|
| 665 | + if (isset($_GET['user'])) { |
|
| 666 | + $args['user'] = urldecode($_GET['user']); |
|
| 667 | + } elseif (isset($_GET['s'])) { |
|
| 668 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
| 669 | + if ($is_user) { |
|
| 670 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
| 671 | + unset($args['s']); |
|
| 672 | 672 | } else { |
| 673 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
| 673 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
| 678 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
| 677 | + if ( ! empty($_GET['start-date'])) { |
|
| 678 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
| 682 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
| 681 | + if ( ! empty($_GET['end-date'])) { |
|
| 682 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - $payment_count = give_count_payments( $args ); |
|
| 685 | + $payment_count = give_count_payments($args); |
|
| 686 | 686 | $this->complete_count = $payment_count->publish; |
| 687 | 687 | $this->pending_count = $payment_count->pending; |
| 688 | 688 | $this->refunded_count = $payment_count->refunded; |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $this->cancelled_count = $payment_count->cancelled; |
| 692 | 692 | $this->abandoned_count = $payment_count->abandoned; |
| 693 | 693 | |
| 694 | - foreach ( $payment_count as $count ) { |
|
| 694 | + foreach ($payment_count as $count) { |
|
| 695 | 695 | $this->total_count += $count; |
| 696 | 696 | } |
| 697 | 697 | } |
@@ -706,26 +706,26 @@ discard block |
||
| 706 | 706 | public function payments_data() { |
| 707 | 707 | |
| 708 | 708 | $per_page = $this->per_page; |
| 709 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
| 710 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 711 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
| 712 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 713 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
| 714 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
| 715 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
| 716 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
| 717 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
| 718 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 719 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
| 720 | - |
|
| 721 | - if ( ! empty( $search ) ) { |
|
| 709 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
| 710 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 711 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
| 712 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 713 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
| 714 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
| 715 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
| 716 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
| 717 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
| 718 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 719 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
| 720 | + |
|
| 721 | + if ( ! empty($search)) { |
|
| 722 | 722 | $status = 'any'; // Force all payment statuses when searching. |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | $args = array( |
| 726 | 726 | 'output' => 'payments', |
| 727 | 727 | 'number' => $per_page, |
| 728 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
| 728 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
| 729 | 729 | 'orderby' => $orderby, |
| 730 | 730 | 'order' => $order, |
| 731 | 731 | 'user' => $user, |
@@ -739,12 +739,12 @@ discard block |
||
| 739 | 739 | 'end_date' => $end_date, |
| 740 | 740 | ); |
| 741 | 741 | |
| 742 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
| 742 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
| 743 | 743 | $args['search_in_notes'] = true; |
| 744 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
| 744 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - $p_query = new Give_Payments_Query( $args ); |
|
| 747 | + $p_query = new Give_Payments_Query($args); |
|
| 748 | 748 | |
| 749 | 749 | return $p_query->get_payments(); |
| 750 | 750 | |
@@ -764,17 +764,17 @@ discard block |
||
| 764 | 764 | */ |
| 765 | 765 | public function prepare_items() { |
| 766 | 766 | |
| 767 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
| 767 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
| 768 | 768 | |
| 769 | 769 | $columns = $this->get_columns(); |
| 770 | 770 | $hidden = array(); // No hidden columns. |
| 771 | 771 | $sortable = $this->get_sortable_columns(); |
| 772 | 772 | $data = $this->payments_data(); |
| 773 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
| 773 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
| 774 | 774 | |
| 775 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 775 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 776 | 776 | |
| 777 | - switch ( $status ) { |
|
| 777 | + switch ($status) { |
|
| 778 | 778 | case 'publish': |
| 779 | 779 | $total_items = $this->complete_count; |
| 780 | 780 | break; |
@@ -801,19 +801,19 @@ discard block |
||
| 801 | 801 | break; |
| 802 | 802 | default: |
| 803 | 803 | // Retrieve the count of the non-default-Give status. |
| 804 | - $count = wp_count_posts( 'give_payment' ); |
|
| 805 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
| 804 | + $count = wp_count_posts('give_payment'); |
|
| 805 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
| 806 | 806 | break; |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | $this->items = $data; |
| 810 | 810 | |
| 811 | - $this->set_pagination_args( array( |
|
| 811 | + $this->set_pagination_args(array( |
|
| 812 | 812 | 'total_items' => $total_items, |
| 813 | 813 | // We have to calculate the total number of items. |
| 814 | 814 | 'per_page' => $this->per_page, |
| 815 | 815 | // We have to determine how many items to show on a page. |
| 816 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 816 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 817 | 817 | // We have to calculate the total number of pages. |
| 818 | 818 | ) |
| 819 | 819 | ); |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | 'disabled' => __( 'Disabled', 'give' ), |
| 88 | 88 | ) |
| 89 | 89 | ), |
| 90 | - array( |
|
| 91 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
| 92 | - 'id' => 'display_settings_docs_link', |
|
| 93 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
| 94 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
| 95 | - 'type' => 'give_docs_link', |
|
| 96 | - ), |
|
| 90 | + array( |
|
| 91 | + 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
| 92 | + 'id' => 'display_settings_docs_link', |
|
| 93 | + 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
| 94 | + 'title' => __( 'Display Options Settings', 'give' ), |
|
| 95 | + 'type' => 'give_docs_link', |
|
| 96 | + ), |
|
| 97 | 97 | array( |
| 98 | 98 | 'id' => 'give_title_display_settings_1', |
| 99 | 99 | 'type' => 'sectionend' |
@@ -170,13 +170,13 @@ discard block |
||
| 170 | 170 | 'disabled' => __( 'Disabled', 'give' ), |
| 171 | 171 | ) |
| 172 | 172 | ), |
| 173 | - array( |
|
| 174 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
| 175 | - 'id' => 'post_types_settings_docs_link', |
|
| 176 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
| 177 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
| 178 | - 'type' => 'give_docs_link', |
|
| 179 | - ), |
|
| 173 | + array( |
|
| 174 | + 'name' => __( 'Post Types Docs Link', 'give' ), |
|
| 175 | + 'id' => 'post_types_settings_docs_link', |
|
| 176 | + 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
| 177 | + 'title' => __( 'Post Types Settings', 'give' ), |
|
| 178 | + 'type' => 'give_docs_link', |
|
| 179 | + ), |
|
| 180 | 180 | array( |
| 181 | 181 | 'id' => 'give_title_display_settings_2', |
| 182 | 182 | 'type' => 'sectionend' |
@@ -212,13 +212,13 @@ discard block |
||
| 212 | 212 | 'disabled' => __( 'Disabled', 'give' ), |
| 213 | 213 | ) |
| 214 | 214 | ), |
| 215 | - array( |
|
| 216 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
| 217 | - 'id' => 'taxonomies_settings_docs_link', |
|
| 218 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
| 219 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
| 220 | - 'type' => 'give_docs_link', |
|
| 221 | - ), |
|
| 215 | + array( |
|
| 216 | + 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
| 217 | + 'id' => 'taxonomies_settings_docs_link', |
|
| 218 | + 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
| 219 | + 'title' => __( 'Taxonomies Settings', 'give' ), |
|
| 220 | + 'type' => 'give_docs_link', |
|
| 221 | + ), |
|
| 222 | 222 | array( |
| 223 | 223 | 'id' => 'give_title_display_settings_3', |
| 224 | 224 | 'type' => 'sectionend' |
@@ -258,13 +258,13 @@ discard block |
||
| 258 | 258 | 'id' => 'agreement_text', |
| 259 | 259 | 'type' => 'wysiwyg' |
| 260 | 260 | ), |
| 261 | - array( |
|
| 262 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
| 263 | - 'id' => 'terms_settings_docs_link', |
|
| 264 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
| 265 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
| 266 | - 'type' => 'give_docs_link', |
|
| 267 | - ), |
|
| 261 | + array( |
|
| 262 | + 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
| 263 | + 'id' => 'terms_settings_docs_link', |
|
| 264 | + 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
| 265 | + 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
| 266 | + 'type' => 'give_docs_link', |
|
| 267 | + ), |
|
| 268 | 268 | array( |
| 269 | 269 | 'id' => 'give_title_display_settings_4', |
| 270 | 270 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Display' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Display')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Display. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->id = 'display'; |
| 30 | - $this->label = __( 'Display Options', 'give' ); |
|
| 30 | + $this->label = __('Display Options', 'give'); |
|
| 31 | 31 | |
| 32 | 32 | $this->default_tab = 'display-settings'; |
| 33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $settings = array(); |
| 45 | 45 | $current_section = give_get_current_setting_section(); |
| 46 | 46 | |
| 47 | - switch ( $current_section ) { |
|
| 47 | + switch ($current_section) { |
|
| 48 | 48 | case 'display-settings' : |
| 49 | 49 | $settings = array( |
| 50 | 50 | // Section 1: Display |
@@ -53,45 +53,45 @@ discard block |
||
| 53 | 53 | 'type' => 'title' |
| 54 | 54 | ), |
| 55 | 55 | array( |
| 56 | - 'name' => __( 'Default Give Styles', 'give' ), |
|
| 57 | - 'desc' => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ), |
|
| 56 | + 'name' => __('Default Give Styles', 'give'), |
|
| 57 | + 'desc' => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'), |
|
| 58 | 58 | 'id' => 'css', |
| 59 | 59 | 'type' => 'radio_inline', |
| 60 | 60 | 'default' => 'enabled', |
| 61 | 61 | 'options' => array( |
| 62 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 63 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 62 | + 'enabled' => __('Enabled', 'give'), |
|
| 63 | + 'disabled' => __('Disabled', 'give'), |
|
| 64 | 64 | ) |
| 65 | 65 | ), |
| 66 | 66 | array( |
| 67 | - 'name' => __( 'Floating Labels', 'give' ), |
|
| 67 | + 'name' => __('Floating Labels', 'give'), |
|
| 68 | 68 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
| 69 | - 'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your lables to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
| 69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your lables to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
| 70 | 70 | 'id' => 'floatlabels', |
| 71 | 71 | 'type' => 'radio_inline', |
| 72 | 72 | 'default' => 'disabled', |
| 73 | 73 | 'options' => array( |
| 74 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 75 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 74 | + 'enabled' => __('Enabled', 'give'), |
|
| 75 | + 'disabled' => __('Disabled', 'give'), |
|
| 76 | 76 | ) |
| 77 | 77 | ), |
| 78 | 78 | array( |
| 79 | - 'name' => __( 'Welcome Screen', 'give' ), |
|
| 79 | + 'name' => __('Welcome Screen', 'give'), |
|
| 80 | 80 | /* translators: %s: about page URL */ |
| 81 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
| 81 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))), |
|
| 82 | 82 | 'id' => 'welcome', |
| 83 | 83 | 'type' => 'radio_inline', |
| 84 | 84 | 'default' => 'enabled', |
| 85 | 85 | 'options' => array( |
| 86 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 87 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 86 | + 'enabled' => __('Enabled', 'give'), |
|
| 87 | + 'disabled' => __('Disabled', 'give'), |
|
| 88 | 88 | ) |
| 89 | 89 | ), |
| 90 | 90 | array( |
| 91 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
| 91 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
| 92 | 92 | 'id' => 'display_settings_docs_link', |
| 93 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
| 94 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
| 93 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
| 94 | + 'title' => __('Display Options Settings', 'give'), |
|
| 95 | 95 | 'type' => 'give_docs_link', |
| 96 | 96 | ), |
| 97 | 97 | array( |
@@ -108,73 +108,73 @@ discard block |
||
| 108 | 108 | 'type' => 'title' |
| 109 | 109 | ), |
| 110 | 110 | array( |
| 111 | - 'name' => __( 'Form Single Views', 'give' ), |
|
| 112 | - 'desc' => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
| 111 | + 'name' => __('Form Single Views', 'give'), |
|
| 112 | + 'desc' => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
| 113 | 113 | 'id' => 'forms_singular', |
| 114 | 114 | 'type' => 'radio_inline', |
| 115 | 115 | 'default' => 'enabled', |
| 116 | 116 | 'options' => array( |
| 117 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 118 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 117 | + 'enabled' => __('Enabled', 'give'), |
|
| 118 | + 'disabled' => __('Disabled', 'give'), |
|
| 119 | 119 | ) |
| 120 | 120 | ), |
| 121 | 121 | array( |
| 122 | - 'name' => __( 'Form Archives', 'give' ), |
|
| 123 | - 'desc' => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
| 122 | + 'name' => __('Form Archives', 'give'), |
|
| 123 | + 'desc' => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('options-permalink.php'))), |
|
| 124 | 124 | 'id' => 'forms_archives', |
| 125 | 125 | 'type' => 'radio_inline', |
| 126 | 126 | 'default' => 'enabled', |
| 127 | 127 | 'options' => array( |
| 128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 129 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 128 | + 'enabled' => __('Enabled', 'give'), |
|
| 129 | + 'disabled' => __('Disabled', 'give'), |
|
| 130 | 130 | ) |
| 131 | 131 | ), |
| 132 | 132 | array( |
| 133 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
| 134 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
| 133 | + 'name' => __('Form Excerpts', 'give'), |
|
| 134 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
| 135 | 135 | 'id' => 'forms_excerpt', |
| 136 | 136 | 'type' => 'radio_inline', |
| 137 | 137 | 'default' => 'enabled', |
| 138 | 138 | 'options' => array( |
| 139 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 140 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 139 | + 'enabled' => __('Enabled', 'give'), |
|
| 140 | + 'disabled' => __('Disabled', 'give'), |
|
| 141 | 141 | ) |
| 142 | 142 | ), |
| 143 | 143 | array( |
| 144 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
| 145 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
| 144 | + 'name' => __('Form Featured Image', 'give'), |
|
| 145 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
| 146 | 146 | 'id' => 'form_featured_img', |
| 147 | 147 | 'type' => 'radio_inline', |
| 148 | 148 | 'default' => 'enabled', |
| 149 | 149 | 'options' => array( |
| 150 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 151 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 150 | + 'enabled' => __('Enabled', 'give'), |
|
| 151 | + 'disabled' => __('Disabled', 'give'), |
|
| 152 | 152 | ) |
| 153 | 153 | ), |
| 154 | 154 | array( |
| 155 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
| 156 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
| 155 | + 'name' => __('Featured Image Size', 'give'), |
|
| 156 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
| 157 | 157 | 'id' => 'featured_image_size', |
| 158 | 158 | 'type' => 'select', |
| 159 | 159 | 'default' => 'large', |
| 160 | 160 | 'options' => give_get_featured_image_sizes() |
| 161 | 161 | ), |
| 162 | 162 | array( |
| 163 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
| 164 | - 'desc' => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
| 163 | + 'name' => __('Single Form Sidebar', 'give'), |
|
| 164 | + 'desc' => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
| 165 | 165 | 'id' => 'form_sidebar', |
| 166 | 166 | 'type' => 'radio_inline', |
| 167 | 167 | 'default' => 'enabled', |
| 168 | 168 | 'options' => array( |
| 169 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 170 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 169 | + 'enabled' => __('Enabled', 'give'), |
|
| 170 | + 'disabled' => __('Disabled', 'give'), |
|
| 171 | 171 | ) |
| 172 | 172 | ), |
| 173 | 173 | array( |
| 174 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
| 174 | + 'name' => __('Post Types Docs Link', 'give'), |
|
| 175 | 175 | 'id' => 'post_types_settings_docs_link', |
| 176 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
| 177 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
| 176 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
| 177 | + 'title' => __('Post Types Settings', 'give'), |
|
| 178 | 178 | 'type' => 'give_docs_link', |
| 179 | 179 | ), |
| 180 | 180 | array( |
@@ -191,32 +191,32 @@ discard block |
||
| 191 | 191 | 'type' => 'title' |
| 192 | 192 | ), |
| 193 | 193 | array( |
| 194 | - 'name' => __( 'Form Categories', 'give' ), |
|
| 195 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
| 194 | + 'name' => __('Form Categories', 'give'), |
|
| 195 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
| 196 | 196 | 'id' => 'categories', |
| 197 | 197 | 'type' => 'radio_inline', |
| 198 | 198 | 'default' => 'disabled', |
| 199 | 199 | 'options' => array( |
| 200 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 201 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 200 | + 'enabled' => __('Enabled', 'give'), |
|
| 201 | + 'disabled' => __('Disabled', 'give'), |
|
| 202 | 202 | ) |
| 203 | 203 | ), |
| 204 | 204 | array( |
| 205 | - 'name' => __( 'Form Tags', 'give' ), |
|
| 206 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
| 205 | + 'name' => __('Form Tags', 'give'), |
|
| 206 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
| 207 | 207 | 'id' => 'tags', |
| 208 | 208 | 'type' => 'radio_inline', |
| 209 | 209 | 'default' => 'disabled', |
| 210 | 210 | 'options' => array( |
| 211 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 212 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 211 | + 'enabled' => __('Enabled', 'give'), |
|
| 212 | + 'disabled' => __('Disabled', 'give'), |
|
| 213 | 213 | ) |
| 214 | 214 | ), |
| 215 | 215 | array( |
| 216 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
| 216 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
| 217 | 217 | 'id' => 'taxonomies_settings_docs_link', |
| 218 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
| 219 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
| 218 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
| 219 | + 'title' => __('Taxonomies Settings', 'give'), |
|
| 220 | 220 | 'type' => 'give_docs_link', |
| 221 | 221 | ), |
| 222 | 222 | array( |
@@ -233,36 +233,36 @@ discard block |
||
| 233 | 233 | 'type' => 'title' |
| 234 | 234 | ), |
| 235 | 235 | array( |
| 236 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
| 237 | - 'desc' => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ), |
|
| 236 | + 'name' => __('Terms and Conditions', 'give'), |
|
| 237 | + 'desc' => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'), |
|
| 238 | 238 | 'id' => 'terms', |
| 239 | 239 | 'type' => 'radio_inline', |
| 240 | 240 | 'default' => 'disabled', |
| 241 | 241 | 'options' => array( |
| 242 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 243 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 242 | + 'enabled' => __('Enabled', 'give'), |
|
| 243 | + 'disabled' => __('Disabled', 'give'), |
|
| 244 | 244 | ) |
| 245 | 245 | ), |
| 246 | 246 | array( |
| 247 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
| 248 | - 'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ), |
|
| 247 | + 'name' => __('Agree to Terms Label', 'give'), |
|
| 248 | + 'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'), |
|
| 249 | 249 | 'id' => 'agree_to_terms_label', |
| 250 | 250 | 'attributes' => array( |
| 251 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
| 251 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
| 252 | 252 | ), |
| 253 | 253 | 'type' => 'text' |
| 254 | 254 | ), |
| 255 | 255 | array( |
| 256 | - 'name' => __( 'Agreement Text', 'give' ), |
|
| 257 | - 'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ), |
|
| 256 | + 'name' => __('Agreement Text', 'give'), |
|
| 257 | + 'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'), |
|
| 258 | 258 | 'id' => 'agreement_text', |
| 259 | 259 | 'type' => 'wysiwyg' |
| 260 | 260 | ), |
| 261 | 261 | array( |
| 262 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
| 262 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
| 263 | 263 | 'id' => 'terms_settings_docs_link', |
| 264 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
| 265 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
| 264 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
| 265 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
| 266 | 266 | 'type' => 'give_docs_link', |
| 267 | 267 | ), |
| 268 | 268 | array( |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * Filter the display options settings. |
| 278 | 278 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
| 279 | 279 | */ |
| 280 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
| 280 | + $settings = apply_filters('give_settings_display', $settings); |
|
| 281 | 281 | |
| 282 | 282 | /** |
| 283 | 283 | * Filter the settings. |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * @since 1.8 |
| 286 | 286 | * @param array $settings |
| 287 | 287 | */ |
| 288 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 288 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 289 | 289 | |
| 290 | 290 | // Output. |
| 291 | 291 | return $settings; |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | public function get_sections() { |
| 301 | 301 | $sections = array( |
| 302 | - 'display-settings' => __( 'Display', 'give' ), |
|
| 303 | - 'post-types' => __( 'Post Types', 'give' ), |
|
| 304 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
| 305 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ) |
|
| 302 | + 'display-settings' => __('Display', 'give'), |
|
| 303 | + 'post-types' => __('Post Types', 'give'), |
|
| 304 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
| 305 | + 'term-and-conditions' => __('Terms and Conditions', 'give') |
|
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
| 308 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
@@ -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"', 'give' ), $field['title'] ) |
|
| 708 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $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 = give_get_meta( $postid, $field['id'], true ); |
|
| 730 | + $field_value = give_get_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,20 +756,20 @@ 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 | 761 | $description = ''; |
| 762 | 762 | |
| 763 | 763 | // Check for both `description` and `desc`. |
| 764 | - if ( isset( $field['description'] ) ) { |
|
| 764 | + if (isset($field['description'])) { |
|
| 765 | 765 | $description = $field['description']; |
| 766 | - } elseif ( isset( $field['desc'] ) ) { |
|
| 766 | + } elseif (isset($field['desc'])) { |
|
| 767 | 767 | $description = $field['desc']; |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | // Set if there is a description. |
| 771 | - if ( ! empty( $description ) ) { |
|
| 772 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
| 771 | + if ( ! empty($description)) { |
|
| 772 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | return $field_desc_html; |
@@ -785,18 +785,18 @@ discard block |
||
| 785 | 785 | * |
| 786 | 786 | * @return string |
| 787 | 787 | */ |
| 788 | -function give_get_custom_attributes( $field ) { |
|
| 788 | +function give_get_custom_attributes($field) { |
|
| 789 | 789 | // Custom attribute handling |
| 790 | 790 | $custom_attributes = array(); |
| 791 | 791 | |
| 792 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
| 792 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
| 793 | 793 | |
| 794 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
| 795 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
| 794 | + foreach ($field['attributes'] as $attribute => $value) { |
|
| 795 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
| 796 | 796 | } |
| 797 | 797 | } |
| 798 | 798 | |
| 799 | - return implode( ' ', $custom_attributes ); |
|
| 799 | + return implode(' ', $custom_attributes); |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | /** |
@@ -812,8 +812,8 @@ discard block |
||
| 812 | 812 | * |
| 813 | 813 | * @return string |
| 814 | 814 | */ |
| 815 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
| 816 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
| 815 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
| 816 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
| 817 | 817 | |
| 818 | 818 | /** |
| 819 | 819 | * Filter the specific repeater field value |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | * |
| 823 | 823 | * @param string $field_id |
| 824 | 824 | */ |
| 825 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
| 825 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
| 826 | 826 | |
| 827 | 827 | /** |
| 828 | 828 | * Filter the repeater field value |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | * |
| 832 | 832 | * @param string $field_id |
| 833 | 833 | */ |
| 834 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
| 834 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
| 835 | 835 | |
| 836 | 836 | return $field_value; |
| 837 | 837 | } |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | * |
| 850 | 850 | * @return string |
| 851 | 851 | */ |
| 852 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
| 852 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
| 853 | 853 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 854 | 854 | |
| 855 | 855 | // Get field id. |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | * |
| 863 | 863 | * @param string $field_id |
| 864 | 864 | */ |
| 865 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
| 865 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
| 866 | 866 | |
| 867 | 867 | /** |
| 868 | 868 | * Filter the repeater field id |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | * |
| 872 | 872 | * @param string $field_id |
| 873 | 873 | */ |
| 874 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
| 874 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
| 875 | 875 | |
| 876 | 876 | return $field_id; |
| 877 | 877 | } |
@@ -886,8 +886,8 @@ discard block |
||
| 886 | 886 | * |
| 887 | 887 | * @return string |
| 888 | 888 | */ |
| 889 | -function give_get_field_name( $field ) { |
|
| 890 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
| 889 | +function give_get_field_name($field) { |
|
| 890 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
| 891 | 891 | |
| 892 | 892 | /** |
| 893 | 893 | * Filter the field name. |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | * |
| 897 | 897 | * @param string $field_name |
| 898 | 898 | */ |
| 899 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
| 899 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
| 900 | 900 | |
| 901 | 901 | return $field_name; |
| 902 | 902 | } |
@@ -913,39 +913,39 @@ discard block |
||
| 913 | 913 | * |
| 914 | 914 | * @return void |
| 915 | 915 | */ |
| 916 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
| 916 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
| 917 | 917 | global $thepostid, $post; |
| 918 | 918 | |
| 919 | 919 | // Bailout. |
| 920 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
| 920 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
| 921 | 921 | return; |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 925 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 924 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 925 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 926 | 926 | ?> |
| 927 | 927 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" |
| 928 | 928 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
| 929 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
| 929 | + <?php if ( ! empty($fields['name'])) : ?> |
|
| 930 | 930 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
| 931 | 931 | <?php endif; ?> |
| 932 | 932 | |
| 933 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
| 933 | + <?php if ( ! empty($fields['description'])) : ?> |
|
| 934 | 934 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
| 935 | 935 | <?php endif; ?> |
| 936 | 936 | |
| 937 | 937 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
| 938 | 938 | <?php |
| 939 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
| 940 | - $header_title = isset( $fields['options']['header_title'] ) |
|
| 939 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
| 940 | + $header_title = isset($fields['options']['header_title']) |
|
| 941 | 941 | ? $fields['options']['header_title'] |
| 942 | - : esc_attr__( 'Group', 'give' ); |
|
| 942 | + : esc_attr__('Group', 'give'); |
|
| 943 | 943 | |
| 944 | 944 | $add_default_donation_field = false; |
| 945 | 945 | |
| 946 | 946 | // Check if level is not created or we have to add default level. |
| 947 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
| 948 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
| 947 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
| 948 | + $repeater_field_values = array_values($repeater_field_values); |
|
| 949 | 949 | } else { |
| 950 | 950 | $fields_count = 1; |
| 951 | 951 | $add_default_donation_field = true; |
@@ -958,59 +958,59 @@ discard block |
||
| 958 | 958 | <div class="give-row-head give-move"> |
| 959 | 959 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
| 960 | 960 | </button> |
| 961 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
| 961 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
| 962 | 962 | <h2> |
| 963 | 963 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 964 | 964 | </h2> |
| 965 | 965 | </div> |
| 966 | 966 | <div class="give-row-body"> |
| 967 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 968 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 967 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 968 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
| 969 | 969 | continue; |
| 970 | 970 | } ?> |
| 971 | 971 | <?php |
| 972 | 972 | $field['repeat'] = true; |
| 973 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
| 974 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 973 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
| 974 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 975 | 975 | '_', |
| 976 | 976 | '', |
| 977 | - ), $field['repeatable_field_id'] ); |
|
| 977 | + ), $field['repeatable_field_id']); |
|
| 978 | 978 | ?> |
| 979 | - <?php give_render_field( $field ); ?> |
|
| 979 | + <?php give_render_field($field); ?> |
|
| 980 | 980 | <?php endforeach; ?> |
| 981 | 981 | </div> |
| 982 | 982 | </td> |
| 983 | 983 | </tr> |
| 984 | 984 | |
| 985 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
| 985 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
| 986 | 986 | <!--Stored repeater field group--> |
| 987 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
| 987 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
| 988 | 988 | <tr class="give-row"> |
| 989 | 989 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 990 | 990 | <div class="give-row-head give-move"> |
| 991 | 991 | <button type="button" class="handlediv button-link"> |
| 992 | 992 | <span class="toggle-indicator"></span></button> |
| 993 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 993 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 994 | 994 | </sapn> |
| 995 | 995 | <h2> |
| 996 | 996 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 997 | 997 | </h2> |
| 998 | 998 | </div> |
| 999 | 999 | <div class="give-row-body"> |
| 1000 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 1001 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1000 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 1001 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
| 1002 | 1002 | continue; |
| 1003 | 1003 | } ?> |
| 1004 | 1004 | <?php |
| 1005 | 1005 | $field['repeat'] = true; |
| 1006 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
| 1007 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
| 1008 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 1006 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
| 1007 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
| 1008 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 1009 | 1009 | '_', |
| 1010 | 1010 | '', |
| 1011 | - ), $field['repeatable_field_id'] ); |
|
| 1011 | + ), $field['repeatable_field_id']); |
|
| 1012 | 1012 | ?> |
| 1013 | - <?php give_render_field( $field ); ?> |
|
| 1013 | + <?php give_render_field($field); ?> |
|
| 1014 | 1014 | <?php endforeach; ?> |
| 1015 | 1015 | </div> |
| 1016 | 1016 | </td> |
@@ -1018,14 +1018,14 @@ discard block |
||
| 1018 | 1018 | <?php endforeach; |
| 1019 | 1019 | ; ?> |
| 1020 | 1020 | |
| 1021 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
| 1021 | + <?php elseif ($add_default_donation_field) : ?> |
|
| 1022 | 1022 | <!--Default repeater field group--> |
| 1023 | 1023 | <tr class="give-row"> |
| 1024 | 1024 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 1025 | 1025 | <div class="give-row-head give-move"> |
| 1026 | 1026 | <button type="button" class="handlediv button-link"> |
| 1027 | 1027 | <span class="toggle-indicator"></span></button> |
| 1028 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 1028 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 1029 | 1029 | </sapn> |
| 1030 | 1030 | <h2> |
| 1031 | 1031 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1033,19 +1033,19 @@ discard block |
||
| 1033 | 1033 | </div> |
| 1034 | 1034 | <div class="give-row-body"> |
| 1035 | 1035 | <?php |
| 1036 | - foreach ( $fields['fields'] as $field ) : |
|
| 1037 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1036 | + foreach ($fields['fields'] as $field) : |
|
| 1037 | + if ( ! give_is_field_callback_exist($field)) { |
|
| 1038 | 1038 | continue; |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | 1041 | $field['repeat'] = true; |
| 1042 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
| 1043 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
| 1044 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 1042 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
| 1043 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
| 1044 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 1045 | 1045 | '_', |
| 1046 | 1046 | '', |
| 1047 | - ), $field['repeatable_field_id'] ); |
|
| 1048 | - give_render_field( $field ); |
|
| 1047 | + ), $field['repeatable_field_id']); |
|
| 1048 | + give_render_field($field); |
|
| 1049 | 1049 | endforeach; |
| 1050 | 1050 | ?> |
| 1051 | 1051 | </div> |
@@ -1056,9 +1056,9 @@ discard block |
||
| 1056 | 1056 | <tfoot> |
| 1057 | 1057 | <tr> |
| 1058 | 1058 | <?php |
| 1059 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
| 1059 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
| 1060 | 1060 | ? $add_row_btn_title = $fields['options']['add_button'] |
| 1061 | - : esc_html__( 'Add Row', 'give' ); |
|
| 1061 | + : esc_html__('Add Row', 'give'); |
|
| 1062 | 1062 | ?> |
| 1063 | 1063 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
| 1064 | 1064 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1088,10 +1088,10 @@ discard block |
||
| 1088 | 1088 | * |
| 1089 | 1089 | * @param string |
| 1090 | 1090 | */ |
| 1091 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
| 1091 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
| 1092 | 1092 | |
| 1093 | 1093 | // Get current tab. |
| 1094 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
| 1094 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
| 1095 | 1095 | |
| 1096 | 1096 | // Output. |
| 1097 | 1097 | return $current_tab; |
@@ -1115,10 +1115,10 @@ discard block |
||
| 1115 | 1115 | * |
| 1116 | 1116 | * @param string |
| 1117 | 1117 | */ |
| 1118 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
| 1118 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
| 1119 | 1119 | |
| 1120 | 1120 | // Get current section. |
| 1121 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
| 1121 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
| 1122 | 1122 | |
| 1123 | 1123 | // Output. |
| 1124 | 1124 | return $current_section; |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | */ |
| 1133 | 1133 | function give_get_current_setting_page() { |
| 1134 | 1134 | // Get current page. |
| 1135 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
| 1135 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
| 1136 | 1136 | |
| 1137 | 1137 | // Output. |
| 1138 | 1138 | return $setting_page; |
@@ -1152,13 +1152,13 @@ discard block |
||
| 1152 | 1152 | * |
| 1153 | 1153 | * @return string |
| 1154 | 1154 | */ |
| 1155 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
| 1156 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
| 1155 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
| 1156 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
| 1157 | 1157 | |
| 1158 | 1158 | if ( |
| 1159 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
| 1159 | + ! give_get_meta($postid, '_give_display_content', true) |
|
| 1160 | 1160 | && $show_content |
| 1161 | - && ( 'none' !== $show_content ) |
|
| 1161 | + && ('none' !== $show_content) |
|
| 1162 | 1162 | ) { |
| 1163 | 1163 | $field_value = 'enabled'; |
| 1164 | 1164 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | return $field_value; |
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
| 1169 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
| 1170 | 1170 | |
| 1171 | 1171 | |
| 1172 | 1172 | /** |
@@ -1183,12 +1183,12 @@ discard block |
||
| 1183 | 1183 | * |
| 1184 | 1184 | * @return string |
| 1185 | 1185 | */ |
| 1186 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
| 1187 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
| 1186 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
| 1187 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
| 1188 | 1188 | |
| 1189 | 1189 | if ( |
| 1190 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
| 1191 | - && ( 'none' !== $show_content ) |
|
| 1190 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
| 1191 | + && ('none' !== $show_content) |
|
| 1192 | 1192 | ) { |
| 1193 | 1193 | $field_value = $show_content; |
| 1194 | 1194 | } |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | return $field_value; |
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
| 1199 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
| 1200 | 1200 | |
| 1201 | 1201 | |
| 1202 | 1202 | /** |
@@ -1212,17 +1212,17 @@ discard block |
||
| 1212 | 1212 | * |
| 1213 | 1213 | * @return string |
| 1214 | 1214 | */ |
| 1215 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
| 1216 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
| 1215 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
| 1216 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
| 1217 | 1217 | |
| 1218 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
| 1219 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
| 1218 | + if (in_array($term_option, array('none', 'yes'))) { |
|
| 1219 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
| 1220 | 1220 | } |
| 1221 | 1221 | |
| 1222 | 1222 | return $field_value; |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
| 1225 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
| 1226 | 1226 | |
| 1227 | 1227 | |
| 1228 | 1228 | /** |
@@ -1239,17 +1239,17 @@ discard block |
||
| 1239 | 1239 | * |
| 1240 | 1240 | * @return string |
| 1241 | 1241 | */ |
| 1242 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
| 1243 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
| 1242 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
| 1243 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
| 1244 | 1244 | |
| 1245 | - if ( 'on' === $offline_donation ) { |
|
| 1245 | + if ('on' === $offline_donation) { |
|
| 1246 | 1246 | $field_value = 'enabled'; |
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | return $field_value; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
| 1252 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
| 1253 | 1253 | |
| 1254 | 1254 | |
| 1255 | 1255 | /** |
@@ -1265,17 +1265,17 @@ discard block |
||
| 1265 | 1265 | * |
| 1266 | 1266 | * @return string |
| 1267 | 1267 | */ |
| 1268 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
| 1269 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
| 1268 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
| 1269 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
| 1270 | 1270 | |
| 1271 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
| 1272 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
| 1271 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
| 1272 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | 1275 | return $field_value; |
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
| 1278 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
| 1279 | 1279 | |
| 1280 | 1280 | |
| 1281 | 1281 | /** |
@@ -1291,17 +1291,17 @@ discard block |
||
| 1291 | 1291 | * |
| 1292 | 1292 | * @return string |
| 1293 | 1293 | */ |
| 1294 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
| 1295 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
| 1294 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
| 1295 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
| 1296 | 1296 | |
| 1297 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
| 1298 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
| 1297 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
| 1298 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
| 1299 | 1299 | } |
| 1300 | 1300 | |
| 1301 | 1301 | return $field_value; |
| 1302 | 1302 | } |
| 1303 | 1303 | |
| 1304 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
| 1304 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
| 1305 | 1305 | |
| 1306 | 1306 | /** |
| 1307 | 1307 | * Set value for Donation Goal --> close Form. |
@@ -1317,17 +1317,17 @@ discard block |
||
| 1317 | 1317 | * |
| 1318 | 1318 | * @return string |
| 1319 | 1319 | */ |
| 1320 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
| 1321 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
| 1320 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
| 1321 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
| 1322 | 1322 | |
| 1323 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
| 1324 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
| 1323 | + if (in_array($close_form, array('yes', 'no'))) { |
|
| 1324 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
| 1325 | 1325 | } |
| 1326 | 1326 | |
| 1327 | 1327 | return $field_value; |
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
| 1330 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
| 1331 | 1331 | |
| 1332 | 1332 | |
| 1333 | 1333 | /** |
@@ -1343,17 +1343,17 @@ discard block |
||
| 1343 | 1343 | * |
| 1344 | 1344 | * @return string |
| 1345 | 1345 | */ |
| 1346 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
| 1347 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
| 1346 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
| 1347 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
| 1348 | 1348 | |
| 1349 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
| 1350 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
| 1349 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
| 1350 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
| 1351 | 1351 | } |
| 1352 | 1352 | |
| 1353 | 1353 | return $field_value; |
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
| 1356 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
| 1357 | 1357 | |
| 1358 | 1358 | /** |
| 1359 | 1359 | * Set value for Offline Donations --> Offline Donations. |
@@ -1369,17 +1369,17 @@ discard block |
||
| 1369 | 1369 | * |
| 1370 | 1370 | * @return string |
| 1371 | 1371 | */ |
| 1372 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
| 1373 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
| 1372 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
| 1373 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
| 1374 | 1374 | |
| 1375 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
| 1376 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
| 1375 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
| 1376 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
| 1377 | 1377 | } |
| 1378 | 1378 | |
| 1379 | 1379 | return $field_value; |
| 1380 | 1380 | } |
| 1381 | 1381 | |
| 1382 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
| 1382 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
| 1383 | 1383 | |
| 1384 | 1384 | |
| 1385 | 1385 | /** |
@@ -1394,14 +1394,14 @@ discard block |
||
| 1394 | 1394 | * |
| 1395 | 1395 | * @return mixed |
| 1396 | 1396 | */ |
| 1397 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
| 1397 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
| 1398 | 1398 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 1399 | 1399 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
| 1400 | 1400 | |
| 1401 | 1401 | return $field_id; |
| 1402 | 1402 | } |
| 1403 | 1403 | |
| 1404 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
| 1404 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
| 1405 | 1405 | |
| 1406 | 1406 | /** |
| 1407 | 1407 | * Set repeater field value for multi donation form. |
@@ -1415,13 +1415,13 @@ discard block |
||
| 1415 | 1415 | * |
| 1416 | 1416 | * @return mixed |
| 1417 | 1417 | */ |
| 1418 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
| 1419 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
| 1418 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
| 1419 | + $field_value = $field_group[$field['id']]['level_id']; |
|
| 1420 | 1420 | |
| 1421 | 1421 | return $field_value; |
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
| 1424 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
| 1425 | 1425 | |
| 1426 | 1426 | /** |
| 1427 | 1427 | * Set default value for _give_id field. |
@@ -1432,11 +1432,11 @@ discard block |
||
| 1432 | 1432 | * |
| 1433 | 1433 | * @return string |
| 1434 | 1434 | */ |
| 1435 | -function _give_set_field_give_id_default_value( $field ) { |
|
| 1435 | +function _give_set_field_give_id_default_value($field) { |
|
| 1436 | 1436 | return 0; |
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
| 1439 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
| 1440 | 1440 | |
| 1441 | 1441 | /** |
| 1442 | 1442 | * Set default value for _give_default field. |
@@ -1447,11 +1447,11 @@ discard block |
||
| 1447 | 1447 | * |
| 1448 | 1448 | * @return string |
| 1449 | 1449 | */ |
| 1450 | -function _give_set_field_give_default_default_value( $field ) { |
|
| 1450 | +function _give_set_field_give_default_default_value($field) { |
|
| 1451 | 1451 | return 'default'; |
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
| 1454 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
| 1455 | 1455 | |
| 1456 | 1456 | /** |
| 1457 | 1457 | * Set repeater field editor id for field type wysiwyg. |
@@ -1463,12 +1463,12 @@ discard block |
||
| 1463 | 1463 | * |
| 1464 | 1464 | * @return string |
| 1465 | 1465 | */ |
| 1466 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
| 1467 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
| 1468 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
| 1466 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
| 1467 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
| 1468 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
| 1469 | 1469 | } |
| 1470 | 1470 | |
| 1471 | 1471 | return $field_name; |
| 1472 | 1472 | } |
| 1473 | 1473 | |
| 1474 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
| 1474 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|
@@ -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 | |
@@ -62,26 +62,26 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @param array $request The Form Data passed into the batch processing |
| 64 | 64 | */ |
| 65 | - public function set_properties( $request ) { |
|
| 65 | + public function set_properties($request) { |
|
| 66 | 66 | |
| 67 | 67 | // Set data from form submission |
| 68 | - if ( isset( $_POST['form'] ) ) { |
|
| 69 | - parse_str( $_POST['form'], $this->data ); |
|
| 68 | + if (isset($_POST['form'])) { |
|
| 69 | + parse_str($_POST['form'], $this->data); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $this->form = $this->data['forms']; |
| 73 | 73 | |
| 74 | 74 | // Setup donor ids cache. |
| 75 | - if( ! empty( $this->form ) ) { |
|
| 75 | + if ( ! empty($this->form)) { |
|
| 76 | 76 | // Cache donor ids to output unique list of donor. |
| 77 | - $this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] ); |
|
| 78 | - if( ! ( $this->donor_ids = Give_Cache::get( $this->query_id, true ) ) ) { |
|
| 77 | + $this->query_id = give_clean($_REQUEST['give_export_option']['query_id']); |
|
| 78 | + if ( ! ($this->donor_ids = Give_Cache::get($this->query_id, true))) { |
|
| 79 | 79 | $this->donor_ids = array(); |
| 80 | - Give_Cache::set( $this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true ); |
|
| 80 | + Give_Cache::set($this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
| 84 | + $this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function csv_cols() { |
| 96 | 96 | |
| 97 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
| 97 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
| 98 | 98 | |
| 99 | 99 | // We need columns. |
| 100 | - if ( empty( $columns ) ) { |
|
| 100 | + if (empty($columns)) { |
|
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $cols = $this->get_cols( $columns ); |
|
| 104 | + $cols = $this->get_cols($columns); |
|
| 105 | 105 | |
| 106 | 106 | return $cols; |
| 107 | 107 | } |
@@ -113,38 +113,38 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return array |
| 115 | 115 | */ |
| 116 | - private function get_cols( $columns ) { |
|
| 116 | + private function get_cols($columns) { |
|
| 117 | 117 | |
| 118 | 118 | $cols = array(); |
| 119 | 119 | |
| 120 | - foreach ( $columns as $key => $value ) { |
|
| 120 | + foreach ($columns as $key => $value) { |
|
| 121 | 121 | |
| 122 | - switch ( $key ) { |
|
| 122 | + switch ($key) { |
|
| 123 | 123 | case 'full_name' : |
| 124 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
| 124 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
| 125 | 125 | break; |
| 126 | 126 | case 'email' : |
| 127 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
| 127 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
| 128 | 128 | break; |
| 129 | 129 | case 'address' : |
| 130 | - $cols['address_line1'] = esc_html__( 'Address', 'give' ); |
|
| 131 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
| 132 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
| 133 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
| 134 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
| 135 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
| 130 | + $cols['address_line1'] = esc_html__('Address', 'give'); |
|
| 131 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
| 132 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
| 133 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
| 134 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
| 135 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
| 136 | 136 | break; |
| 137 | 137 | case 'userid' : |
| 138 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
| 138 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
| 139 | 139 | break; |
| 140 | 140 | case 'date_first_donated' : |
| 141 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
| 141 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
| 142 | 142 | break; |
| 143 | 143 | case 'donations' : |
| 144 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
| 144 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
| 145 | 145 | break; |
| 146 | 146 | case 'donation_sum' : |
| 147 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
| 147 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
| 148 | 148 | break; |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -167,20 +167,20 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $i = 0; |
| 169 | 169 | |
| 170 | - if ( ! empty( $this->form ) ) { |
|
| 170 | + if ( ! empty($this->form)) { |
|
| 171 | 171 | |
| 172 | 172 | // Export donors of a specific product |
| 173 | 173 | global $give_logs; |
| 174 | 174 | |
| 175 | 175 | $args = array( |
| 176 | - 'post_parent' => absint( $this->form ), |
|
| 176 | + 'post_parent' => absint($this->form), |
|
| 177 | 177 | 'log_type' => 'sale', |
| 178 | 178 | 'posts_per_page' => 30, |
| 179 | 179 | 'paged' => $this->step, |
| 180 | 180 | ); |
| 181 | 181 | |
| 182 | 182 | // Check for price option |
| 183 | - if ( null !== $this->price_id ) { |
|
| 183 | + if (null !== $this->price_id) { |
|
| 184 | 184 | $args['meta_query'] = array( |
| 185 | 185 | array( |
| 186 | 186 | 'key' => '_give_log_price_id', |
@@ -189,44 +189,44 @@ discard block |
||
| 189 | 189 | ); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $logs = $give_logs->get_connected_logs( $args ); |
|
| 192 | + $logs = $give_logs->get_connected_logs($args); |
|
| 193 | 193 | |
| 194 | - if ( $logs ) { |
|
| 195 | - foreach ( $logs as $log ) { |
|
| 196 | - $payment_id = give_get_meta( $log->ID, '_give_log_payment_id', true ); |
|
| 197 | - $payment = new Give_Payment( $payment_id ); |
|
| 194 | + if ($logs) { |
|
| 195 | + foreach ($logs as $log) { |
|
| 196 | + $payment_id = give_get_meta($log->ID, '_give_log_payment_id', true); |
|
| 197 | + $payment = new Give_Payment($payment_id); |
|
| 198 | 198 | |
| 199 | 199 | // Continue if donor already included. |
| 200 | - if( in_array( $payment->customer_id , $this->donor_ids ) ) { |
|
| 200 | + if (in_array($payment->customer_id, $this->donor_ids)) { |
|
| 201 | 201 | continue; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $this->donor_ids[] = $payment->customer_id; |
| 205 | 205 | |
| 206 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
| 207 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
| 208 | - $i ++; |
|
| 206 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
| 207 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
| 208 | + $i++; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | // Cache donor ids only if admin export donor for specific form. |
| 212 | - Give_Cache::set( $this->query_id, array_unique( $this->donor_ids ), HOUR_IN_SECONDS, true ); |
|
| 212 | + Give_Cache::set($this->query_id, array_unique($this->donor_ids), HOUR_IN_SECONDS, true); |
|
| 213 | 213 | } |
| 214 | 214 | } else { |
| 215 | 215 | |
| 216 | 216 | // Export all donors. |
| 217 | - $offset = 30 * ( $this->step - 1 ); |
|
| 218 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
| 217 | + $offset = 30 * ($this->step - 1); |
|
| 218 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
| 219 | 219 | |
| 220 | - foreach ( $donors as $donor ) { |
|
| 220 | + foreach ($donors as $donor) { |
|
| 221 | 221 | |
| 222 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
| 223 | - $i ++; |
|
| 222 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
| 223 | + $i++; |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
| 228 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 229 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
| 228 | + $data = apply_filters('give_export_get_data', $data); |
|
| 229 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
| 230 | 230 | |
| 231 | 231 | return $data; |
| 232 | 232 | } |
@@ -242,18 +242,18 @@ discard block |
||
| 242 | 242 | $percentage = 0; |
| 243 | 243 | |
| 244 | 244 | // We can't count the number when getting them for a specific form |
| 245 | - if ( empty( $this->form ) ) { |
|
| 245 | + if (empty($this->form)) { |
|
| 246 | 246 | |
| 247 | 247 | $total = Give()->customers->count(); |
| 248 | 248 | |
| 249 | - if ( $total > 0 ) { |
|
| 249 | + if ($total > 0) { |
|
| 250 | 250 | |
| 251 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 251 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 252 | 252 | |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - if ( $percentage > 100 ) { |
|
| 256 | + if ($percentage > 100) { |
|
| 257 | 257 | $percentage = 100; |
| 258 | 258 | } |
| 259 | 259 | |
@@ -269,46 +269,46 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return mixed |
| 271 | 271 | */ |
| 272 | - private function set_donor_data( $i, $data, $donor ) { |
|
| 272 | + private function set_donor_data($i, $data, $donor) { |
|
| 273 | 273 | |
| 274 | 274 | $columns = $this->csv_cols(); |
| 275 | 275 | |
| 276 | 276 | // Set address variable |
| 277 | 277 | $address = ''; |
| 278 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
| 279 | - $address = give_get_donor_address( $donor->user_id ); |
|
| 278 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
| 279 | + $address = give_get_donor_address($donor->user_id); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | // Set columns |
| 283 | - if ( ! empty( $columns['full_name'] ) ) { |
|
| 284 | - $data[ $i ]['full_name'] = $donor->name; |
|
| 283 | + if ( ! empty($columns['full_name'])) { |
|
| 284 | + $data[$i]['full_name'] = $donor->name; |
|
| 285 | 285 | } |
| 286 | - if ( ! empty( $columns['email'] ) ) { |
|
| 287 | - $data[ $i ]['email'] = $donor->email; |
|
| 286 | + if ( ! empty($columns['email'])) { |
|
| 287 | + $data[$i]['email'] = $donor->email; |
|
| 288 | 288 | } |
| 289 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
| 290 | - |
|
| 291 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
| 292 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
| 293 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
| 294 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
| 295 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
| 296 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
| 289 | + if ( ! empty($columns['address_line1'])) { |
|
| 290 | + |
|
| 291 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
| 292 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
| 293 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
| 294 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
| 295 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
| 296 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
| 297 | 297 | } |
| 298 | - if ( ! empty( $columns['userid'] ) ) { |
|
| 299 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
| 298 | + if ( ! empty($columns['userid'])) { |
|
| 299 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
| 300 | 300 | } |
| 301 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
| 302 | - $data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); |
|
| 301 | + if ( ! empty($columns['date_first_donated'])) { |
|
| 302 | + $data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created)); |
|
| 303 | 303 | } |
| 304 | - if ( ! empty( $columns['donations'] ) ) { |
|
| 305 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
| 304 | + if ( ! empty($columns['donations'])) { |
|
| 305 | + $data[$i]['donations'] = $donor->purchase_count; |
|
| 306 | 306 | } |
| 307 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
| 308 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
| 307 | + if ( ! empty($columns['donation_sum'])) { |
|
| 308 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - return $data[ $i ]; |
|
| 311 | + return $data[$i]; |
|
| 312 | 312 | |
| 313 | 313 | } |
| 314 | 314 | |
@@ -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 | |
@@ -39,30 +39,30 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function csv_cols() { |
| 41 | 41 | $cols = array( |
| 42 | - 'id' => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
| 43 | - 'seq_id' => esc_html__( 'Payment Number', 'give' ), // sequential payment ID. |
|
| 44 | - 'email' => esc_html__( 'Email', 'give' ), |
|
| 45 | - 'first' => esc_html__( 'First Name', 'give' ), |
|
| 46 | - 'last' => esc_html__( 'Last Name', 'give' ), |
|
| 47 | - 'address1' => esc_html__( 'Address 1', 'give' ), |
|
| 48 | - 'address2' => esc_html__( 'Address 2', 'give' ), |
|
| 49 | - 'city' => esc_html__( 'City', 'give' ), |
|
| 50 | - 'state' => esc_html__( 'State', 'give' ), |
|
| 51 | - 'country' => esc_html__( 'Country', 'give' ), |
|
| 52 | - 'zip' => esc_html__( 'Zip / Postal Code', 'give' ), |
|
| 53 | - 'form_id' => esc_html__( 'Form ID', 'give' ), |
|
| 54 | - 'form_name' => esc_html__( 'Form Name', 'give' ), |
|
| 55 | - 'amount' => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
| 56 | - 'gateway' => esc_html__( 'Payment Method', 'give' ), |
|
| 57 | - 'trans_id' => esc_html__( 'Transaction ID', 'give' ), |
|
| 58 | - 'key' => esc_html__( 'Key', 'give' ), |
|
| 59 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 60 | - 'user' => esc_html__( 'User', 'give' ), |
|
| 61 | - 'status' => esc_html__( 'Status', 'give' ) |
|
| 42 | + 'id' => esc_html__('ID', 'give'), // unaltered payment ID (use for querying). |
|
| 43 | + 'seq_id' => esc_html__('Payment Number', 'give'), // sequential payment ID. |
|
| 44 | + 'email' => esc_html__('Email', 'give'), |
|
| 45 | + 'first' => esc_html__('First Name', 'give'), |
|
| 46 | + 'last' => esc_html__('Last Name', 'give'), |
|
| 47 | + 'address1' => esc_html__('Address 1', 'give'), |
|
| 48 | + 'address2' => esc_html__('Address 2', 'give'), |
|
| 49 | + 'city' => esc_html__('City', 'give'), |
|
| 50 | + 'state' => esc_html__('State', 'give'), |
|
| 51 | + 'country' => esc_html__('Country', 'give'), |
|
| 52 | + 'zip' => esc_html__('Zip / Postal Code', 'give'), |
|
| 53 | + 'form_id' => esc_html__('Form ID', 'give'), |
|
| 54 | + 'form_name' => esc_html__('Form Name', 'give'), |
|
| 55 | + 'amount' => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
| 56 | + 'gateway' => esc_html__('Payment Method', 'give'), |
|
| 57 | + 'trans_id' => esc_html__('Transaction ID', 'give'), |
|
| 58 | + 'key' => esc_html__('Key', 'give'), |
|
| 59 | + 'date' => esc_html__('Date', 'give'), |
|
| 60 | + 'user' => esc_html__('User', 'give'), |
|
| 61 | + 'status' => esc_html__('Status', 'give') |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 65 | - unset( $cols['seq_id'] ); |
|
| 64 | + if ( ! give_get_option('enable_sequential')) { |
|
| 65 | + unset($cols['seq_id']); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return $cols; |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | 'status' => $this->status |
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
| 89 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
| 90 | 90 | |
| 91 | 91 | $args['date_query'] = array( |
| 92 | 92 | array( |
| 93 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
| 94 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
| 93 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
| 94 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
| 95 | 95 | 'inclusive' => true |
| 96 | 96 | ) |
| 97 | 97 | ); |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Add category or tag to payment query if any. |
| 102 | - if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) { |
|
| 102 | + if ( ! empty($this->categories) || ! empty($this->tags)) { |
|
| 103 | 103 | $form_args = array( |
| 104 | 104 | 'post_type' => 'give_forms', |
| 105 | 105 | 'post_status' => 'publish', |
| 106 | - 'posts_per_page' => - 1, |
|
| 106 | + 'posts_per_page' => -1, |
|
| 107 | 107 | 'fields' => 'ids', |
| 108 | 108 | 'tax_query' => array( |
| 109 | 109 | 'relation' => 'AND', |
@@ -111,72 +111,72 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - if ( ! empty( $this->categories ) ) { |
|
| 114 | + if ( ! empty($this->categories)) { |
|
| 115 | 115 | $form_args['tax_query'][] = array( |
| 116 | 116 | 'taxonomy' => 'give_forms_category', |
| 117 | 117 | 'terms' => $this->categories, |
| 118 | 118 | ); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ( ! empty( $this->tags ) ) { |
|
| 121 | + if ( ! empty($this->tags)) { |
|
| 122 | 122 | $form_args['tax_query'][] = array( |
| 123 | 123 | 'taxonomy' => 'give_forms_tag', |
| 124 | 124 | 'terms' => $this->tags, |
| 125 | 125 | ); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $forms = new WP_Query( $form_args ); |
|
| 128 | + $forms = new WP_Query($form_args); |
|
| 129 | 129 | |
| 130 | - if ( empty( $forms->posts ) ) { |
|
| 130 | + if (empty($forms->posts)) { |
|
| 131 | 131 | return array(); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $args['give_forms'] = $forms->posts; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $payments = give_get_payments( $args ); |
|
| 137 | + $payments = give_get_payments($args); |
|
| 138 | 138 | |
| 139 | - if ( $payments ) { |
|
| 139 | + if ($payments) { |
|
| 140 | 140 | |
| 141 | - foreach ( $payments as $payment ) { |
|
| 142 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
| 143 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
| 144 | - $total = give_get_payment_amount( $payment->ID ); |
|
| 145 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 141 | + foreach ($payments as $payment) { |
|
| 142 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
| 143 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
| 144 | + $total = give_get_payment_amount($payment->ID); |
|
| 145 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
| 146 | 146 | |
| 147 | - if ( is_numeric( $user_id ) ) { |
|
| 148 | - $user = get_userdata( $user_id ); |
|
| 147 | + if (is_numeric($user_id)) { |
|
| 148 | + $user = get_userdata($user_id); |
|
| 149 | 149 | } else { |
| 150 | 150 | $user = false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $data[] = array( |
| 154 | 154 | 'id' => $payment->ID, |
| 155 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
| 155 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
| 156 | 156 | 'email' => $payment_meta['email'], |
| 157 | 157 | 'first' => $user_info['first_name'], |
| 158 | 158 | 'last' => $user_info['last_name'], |
| 159 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
| 160 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
| 161 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
| 162 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
| 163 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
| 164 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
| 165 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
| 166 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
| 167 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
| 168 | - 'gateway' => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
| 169 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
| 159 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
| 160 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
| 161 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
| 162 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
| 163 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
| 164 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
| 165 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
| 166 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
| 167 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
| 168 | + 'gateway' => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)), |
|
| 169 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
| 170 | 170 | 'key' => $payment_meta['key'], |
| 171 | 171 | 'date' => $payment->post_date, |
| 172 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
| 173 | - 'status' => give_get_payment_status( $payment, true ) |
|
| 172 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
| 173 | + 'status' => give_get_payment_status($payment, true) |
|
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 179 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
| 178 | + $data = apply_filters('give_export_get_data', $data); |
|
| 179 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
| 180 | 180 | |
| 181 | 181 | return $data; |
| 182 | 182 | |
@@ -196,27 +196,27 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $status = $this->status; |
| 198 | 198 | $args = array( |
| 199 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
| 200 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
| 199 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
| 200 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | - if ( 'any' == $status ) { |
|
| 203 | + if ('any' == $status) { |
|
| 204 | 204 | |
| 205 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
| 205 | + $total = array_sum((array) give_count_payments($args)); |
|
| 206 | 206 | |
| 207 | 207 | } else { |
| 208 | 208 | |
| 209 | - $total = give_count_payments( $args )->$status; |
|
| 209 | + $total = give_count_payments($args)->$status; |
|
| 210 | 210 | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $percentage = 100; |
| 214 | 214 | |
| 215 | - if ( $total > 0 ) { |
|
| 216 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 215 | + if ($total > 0) { |
|
| 216 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if ( $percentage > 100 ) { |
|
| 219 | + if ($percentage > 100) { |
|
| 220 | 220 | $percentage = 100; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @param array $request The Form Data passed into the batch processing. |
| 232 | 232 | */ |
| 233 | - public function set_properties( $request ) { |
|
| 234 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
| 235 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
| 236 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
| 237 | - $this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array(); |
|
| 238 | - $this->tags = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array(); |
|
| 233 | + public function set_properties($request) { |
|
| 234 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
| 235 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
| 236 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
| 237 | + $this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array(); |
|
| 238 | + $this->tags = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array(); |
|
| 239 | 239 | } |
| 240 | 240 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | public function csv_cols() { |
| 42 | 42 | |
| 43 | 43 | $cols = array( |
| 44 | - 'ID' => esc_html__( 'ID', 'give' ), |
|
| 45 | - 'post_name' => esc_html__( 'Slug', 'give' ), |
|
| 46 | - 'post_title' => esc_html__( 'Name', 'give' ), |
|
| 47 | - 'post_date' => esc_html__( 'Date Created', 'give' ), |
|
| 48 | - 'post_author' => esc_html__( 'Author', 'give' ), |
|
| 49 | - 'post_content' => esc_html__( 'Description', 'give' ), |
|
| 50 | - 'post_excerpt' => esc_html__( 'Excerpt', 'give' ), |
|
| 51 | - 'post_status' => esc_html__( 'Status', 'give' ), |
|
| 52 | - 'categories' => esc_html__( 'Categories', 'give' ), |
|
| 53 | - 'tags' => esc_html__( 'Tags', 'give' ), |
|
| 54 | - 'give_price' => esc_html__( 'Price', 'give' ), |
|
| 55 | - '_thumbnail_id' => esc_html__( 'Featured Image', 'give' ), |
|
| 56 | - '_give_form_sales' => esc_html__( 'Donations', 'give' ), |
|
| 57 | - '_give_download_earnings' => esc_html__( 'Income', 'give' ), |
|
| 44 | + 'ID' => esc_html__('ID', 'give'), |
|
| 45 | + 'post_name' => esc_html__('Slug', 'give'), |
|
| 46 | + 'post_title' => esc_html__('Name', 'give'), |
|
| 47 | + 'post_date' => esc_html__('Date Created', 'give'), |
|
| 48 | + 'post_author' => esc_html__('Author', 'give'), |
|
| 49 | + 'post_content' => esc_html__('Description', 'give'), |
|
| 50 | + 'post_excerpt' => esc_html__('Excerpt', 'give'), |
|
| 51 | + 'post_status' => esc_html__('Status', 'give'), |
|
| 52 | + 'categories' => esc_html__('Categories', 'give'), |
|
| 53 | + 'tags' => esc_html__('Tags', 'give'), |
|
| 54 | + 'give_price' => esc_html__('Price', 'give'), |
|
| 55 | + '_thumbnail_id' => esc_html__('Featured Image', 'give'), |
|
| 56 | + '_give_form_sales' => esc_html__('Donations', 'give'), |
|
| 57 | + '_give_download_earnings' => esc_html__('Income', 'give'), |
|
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | return $cols; |
@@ -86,43 +86,43 @@ discard block |
||
| 86 | 86 | 'paged' => $this->step |
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | - $downloads = new WP_Query( $args ); |
|
| 89 | + $downloads = new WP_Query($args); |
|
| 90 | 90 | |
| 91 | - if ( $downloads->posts ) { |
|
| 92 | - foreach ( $downloads->posts as $download ) { |
|
| 91 | + if ($downloads->posts) { |
|
| 92 | + foreach ($downloads->posts as $download) { |
|
| 93 | 93 | |
| 94 | 94 | $row = array(); |
| 95 | 95 | |
| 96 | - foreach ( $this->csv_cols() as $key => $value ) { |
|
| 96 | + foreach ($this->csv_cols() as $key => $value) { |
|
| 97 | 97 | |
| 98 | 98 | // Setup default value |
| 99 | - $row[ $key ] = ''; |
|
| 99 | + $row[$key] = ''; |
|
| 100 | 100 | |
| 101 | - if ( in_array( $key, $meta ) ) { |
|
| 101 | + if (in_array($key, $meta)) { |
|
| 102 | 102 | |
| 103 | - switch ( $key ) { |
|
| 103 | + switch ($key) { |
|
| 104 | 104 | |
| 105 | 105 | case '_thumbnail_id' : |
| 106 | 106 | |
| 107 | - $image_id = get_post_thumbnail_id( $download->ID ); |
|
| 108 | - $row[ $key ] = wp_get_attachment_url( $image_id ); |
|
| 107 | + $image_id = get_post_thumbnail_id($download->ID); |
|
| 108 | + $row[$key] = wp_get_attachment_url($image_id); |
|
| 109 | 109 | |
| 110 | 110 | break; |
| 111 | 111 | |
| 112 | 112 | case 'give_price' : |
| 113 | 113 | |
| 114 | - if ( give_has_variable_prices( $download->ID ) ) { |
|
| 114 | + if (give_has_variable_prices($download->ID)) { |
|
| 115 | 115 | |
| 116 | 116 | $prices = array(); |
| 117 | - foreach ( give_get_variable_prices( $download->ID ) as $price ) { |
|
| 118 | - $prices[] = $price['name'] . ': ' . $price['amount']; |
|
| 117 | + foreach (give_get_variable_prices($download->ID) as $price) { |
|
| 118 | + $prices[] = $price['name'].': '.$price['amount']; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $row[ $key ] = implode( ' | ', $prices ); |
|
| 121 | + $row[$key] = implode(' | ', $prices); |
|
| 122 | 122 | |
| 123 | 123 | } else { |
| 124 | 124 | |
| 125 | - $row[ $key ] = give_get_download_price( $download->ID ); |
|
| 125 | + $row[$key] = give_get_download_price($download->ID); |
|
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | |
@@ -132,54 +132,54 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | $files = array(); |
| 135 | - foreach ( give_get_download_files( $download->ID ) as $file ) { |
|
| 135 | + foreach (give_get_download_files($download->ID) as $file) { |
|
| 136 | 136 | $files[] = $file['file']; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $row[ $key ] = implode( ' | ', $files ); |
|
| 139 | + $row[$key] = implode(' | ', $files); |
|
| 140 | 140 | |
| 141 | 141 | break; |
| 142 | 142 | |
| 143 | 143 | default : |
| 144 | 144 | |
| 145 | - $row[ $key ] = give_get_meta( $download->ID, $key, true ); |
|
| 145 | + $row[$key] = give_get_meta($download->ID, $key, true); |
|
| 146 | 146 | |
| 147 | 147 | break; |
| 148 | 148 | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - } elseif ( isset( $download->$key ) ) { |
|
| 151 | + } elseif (isset($download->$key)) { |
|
| 152 | 152 | |
| 153 | - switch ( $key ) { |
|
| 153 | + switch ($key) { |
|
| 154 | 154 | |
| 155 | 155 | case 'post_author' : |
| 156 | 156 | |
| 157 | - $row[ $key ] = get_the_author_meta( 'user_login', $download->post_author ); |
|
| 157 | + $row[$key] = get_the_author_meta('user_login', $download->post_author); |
|
| 158 | 158 | |
| 159 | 159 | break; |
| 160 | 160 | |
| 161 | 161 | default : |
| 162 | 162 | |
| 163 | - $row[ $key ] = $download->$key; |
|
| 163 | + $row[$key] = $download->$key; |
|
| 164 | 164 | |
| 165 | 165 | break; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - } elseif ( 'tags' == $key ) { |
|
| 168 | + } elseif ('tags' == $key) { |
|
| 169 | 169 | |
| 170 | - $terms = get_the_terms( $download->ID, 'download_tag' ); |
|
| 171 | - if ( $terms ) { |
|
| 172 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
| 173 | - $row[ $key ] = implode( ' | ', $terms ); |
|
| 170 | + $terms = get_the_terms($download->ID, 'download_tag'); |
|
| 171 | + if ($terms) { |
|
| 172 | + $terms = wp_list_pluck($terms, 'name'); |
|
| 173 | + $row[$key] = implode(' | ', $terms); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
| 177 | - } elseif ( 'categories' == $key ) { |
|
| 177 | + } elseif ('categories' == $key) { |
|
| 178 | 178 | |
| 179 | - $terms = get_the_terms( $download->ID, 'download_category' ); |
|
| 180 | - if ( $terms ) { |
|
| 181 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
| 182 | - $row[ $key ] = implode( ' | ', $terms ); |
|
| 179 | + $terms = get_the_terms($download->ID, 'download_category'); |
|
| 180 | + if ($terms) { |
|
| 181 | + $terms = wp_list_pluck($terms, 'name'); |
|
| 182 | + $row[$key] = implode(' | ', $terms); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | } |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 194 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
| 193 | + $data = apply_filters('give_export_get_data', $data); |
|
| 194 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
| 195 | 195 | |
| 196 | 196 | return $data; |
| 197 | 197 | } |
@@ -210,20 +210,20 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | $args = array( |
| 212 | 212 | 'post_type' => 'give_forms', |
| 213 | - 'posts_per_page' => - 1, |
|
| 213 | + 'posts_per_page' => -1, |
|
| 214 | 214 | 'post_status' => 'any', |
| 215 | 215 | 'fields' => 'ids', |
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | - $downloads = new WP_Query( $args ); |
|
| 218 | + $downloads = new WP_Query($args); |
|
| 219 | 219 | $total = (int) $downloads->post_count; |
| 220 | 220 | $percentage = 100; |
| 221 | 221 | |
| 222 | - if ( $total > 0 ) { |
|
| 223 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 222 | + if ($total > 0) { |
|
| 223 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if ( $percentage > 100 ) { |
|
| 226 | + if ($percentage > 100) { |
|
| 227 | 227 | $percentage = 100; |
| 228 | 228 | } |
| 229 | 229 | |