| 1 |
<?php |
| 2 |
/** |
| 3 |
* Returns an array of all the default donation fields. |
| 4 |
* |
| 5 |
* @package Charitable/Donation Fields |
| 6 |
* @author Eric Daams |
| 7 |
* @copyright Copyright (c) 2019, Studio 164a |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.5.0 |
| 10 |
* @version 1.6.22 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Filter the set of default donation fields. |
| 20 |
* |
| 21 |
* This filter is provided primarily for internal use by Charitable |
| 22 |
* extensions, as it allows us to add to the registered donation fields |
| 23 |
* as soon as possible. |
| 24 |
* |
| 25 |
* @since 1.5.0 |
| 26 |
* |
| 27 |
* @param array $fields The multi-dimensional array of keys in $key => $args format. |
| 28 |
*/ |
| 29 |
return apply_filters( |
| 30 |
'charitable_default_donation_fields', |
| 31 |
array( |
| 32 |
'donation_id' => array( |
| 33 |
'label' => __( 'Donation ID', 'charitable' ), |
| 34 |
'data_type' => 'core', |
| 35 |
'value_callback' => false, // Charitable_Donation::get_donation_id(). |
| 36 |
'donation_form' => false, |
| 37 |
'admin_form' => false, |
| 38 |
'show_in_meta' => false, |
| 39 |
'email_tag' => array( |
| 40 |
'description' => __( 'The donation ID', 'charitable' ), |
| 41 |
'preview' => 164, |
| 42 |
), |
| 43 |
), |
| 44 |
'first_name' => array( |
| 45 |
'label' => __( 'First Name', 'charitable' ), |
| 46 |
'data_type' => 'user', |
| 47 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 48 |
'donation_form' => array( |
| 49 |
'label' => __( 'First name', 'charitable' ), |
| 50 |
'priority' => 4, |
| 51 |
'required' => true, |
| 52 |
), |
| 53 |
'admin_form' => array( |
| 54 |
'required' => false, |
| 55 |
), |
| 56 |
'show_in_meta' => false, |
| 57 |
'show_in_export' => true, |
| 58 |
'email_tag' => array( |
| 59 |
'tag' => 'donor_first_name', |
| 60 |
'description' => __( 'The first name of the donor', 'charitable' ), |
| 61 |
'preview' => 'John', |
| 62 |
), |
| 63 |
), |
| 64 |
'last_name' => array( |
| 65 |
'label' => __( 'Last Name', 'charitable' ), |
| 66 |
'data_type' => 'user', |
| 67 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 68 |
'donation_form' => array( |
| 69 |
'label' => __( 'Last name', 'charitable' ), |
| 70 |
'priority' => 6, |
| 71 |
'required' => true, |
| 72 |
), |
| 73 |
'admin_form' => array( |
| 74 |
'required' => false, |
| 75 |
), |
| 76 |
'show_in_meta' => false, |
| 77 |
'show_in_export' => true, |
| 78 |
'email_tag' => array( |
| 79 |
'tag' => 'donor_last_name', |
| 80 |
'description' => __( 'The last name of the donor', 'charitable' ), |
| 81 |
'preview' => 'Smith', |
| 82 |
), |
| 83 |
), |
| 84 |
'donor' => array( |
| 85 |
'label' => __( 'Donor', 'charitable' ), |
| 86 |
'data_type' => 'core', |
| 87 |
'value_callback' => false, |
| 88 |
'donation_form' => false, |
| 89 |
'admin_form' => false, |
| 90 |
'show_in_meta' => true, |
| 91 |
'show_in_export' => false, |
| 92 |
'email_tag' => array( |
| 93 |
'description' => __( 'The full name of the donor', 'charitable' ), |
| 94 |
'preview' => 'John Deere', |
| 95 |
), |
| 96 |
), |
| 97 |
'email' => array( |
| 98 |
'label' => __( 'Email', 'charitable' ), |
| 99 |
'data_type' => 'user', |
| 100 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 101 |
'donation_form' => array( |
| 102 |
'type' => 'email', |
| 103 |
'label' => __( 'Email', 'charitable' ), |
| 104 |
'priority' => 8, |
| 105 |
'required' => true, |
| 106 |
), |
| 107 |
'admin_form' => array( |
| 108 |
'required' => false, |
| 109 |
), |
| 110 |
'email_tag' => array( |
| 111 |
'tag' => 'donor_email', |
| 112 |
'description' => __( 'The email address of the donor', 'charitable' ), |
| 113 |
'preview' => 'john@example.com', |
| 114 |
), |
| 115 |
), |
| 116 |
'donor_address' => array( |
| 117 |
'label' => __( 'Address', 'charitable' ), |
| 118 |
'data_type' => 'core', |
| 119 |
'value_callback' => false, // Will use Charitable_Donation::get_donor_address(). |
| 120 |
'donation_form' => false, |
| 121 |
'admin_form' => false, |
| 122 |
'email_tag' => array( |
| 123 |
'description' => __( 'The donor\'s address', 'charitable' ), |
| 124 |
'preview' => charitable_get_location_helper()->get_formatted_address( |
| 125 |
array( |
| 126 |
'first_name' => 'John', |
| 127 |
'last_name' => 'Deere', |
| 128 |
'company' => 'Deere & Company', |
| 129 |
'address' => 'One John Deere Place', |
| 130 |
'city' => 'Moline', |
| 131 |
'state' => 'Illinois', |
| 132 |
'postcode' => '61265', |
| 133 |
'country' => 'US', |
| 134 |
) |
| 135 |
), |
| 136 |
), |
| 137 |
'show_in_meta' => true, |
| 138 |
'show_in_export' => true, |
| 139 |
), |
| 140 |
'address' => array( |
| 141 |
'label' => __( 'Address', 'charitable' ), |
| 142 |
'data_type' => 'user', |
| 143 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 144 |
'donation_form' => array( |
| 145 |
'priority' => 10, |
| 146 |
'required' => false, |
| 147 |
), |
| 148 |
'admin_form' => true, |
| 149 |
'email_tag' => false, |
| 150 |
'show_in_meta' => false, |
| 151 |
'show_in_export' => true, |
| 152 |
), |
| 153 |
'address_2' => array( |
| 154 |
'label' => __( 'Address 2', 'charitable' ), |
| 155 |
'data_type' => 'user', |
| 156 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 157 |
'donation_form' => array( |
| 158 |
'priority' => 12, |
| 159 |
'required' => false, |
| 160 |
), |
| 161 |
'admin_form' => true, |
| 162 |
'email_tag' => false, |
| 163 |
'show_in_meta' => false, |
| 164 |
'show_in_export' => true, |
| 165 |
), |
| 166 |
'city' => array( |
| 167 |
'label' => __( 'City', 'charitable' ), |
| 168 |
'data_type' => 'user', |
| 169 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 170 |
'donation_form' => array( |
| 171 |
'priority' => 14, |
| 172 |
'required' => false, |
| 173 |
), |
| 174 |
'admin_form' => true, |
| 175 |
'email_tag' => false, |
| 176 |
'show_in_meta' => false, |
| 177 |
'show_in_export' => true, |
| 178 |
), |
| 179 |
'state' => array( |
| 180 |
'label' => __( 'State', 'charitable' ), |
| 181 |
'data_type' => 'user', |
| 182 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 183 |
'donation_form' => array( |
| 184 |
'priority' => 16, |
| 185 |
'required' => false, |
| 186 |
), |
| 187 |
'admin_form' => true, |
| 188 |
'email_tag' => false, |
| 189 |
'show_in_meta' => false, |
| 190 |
'show_in_export' => true, |
| 191 |
), |
| 192 |
'postcode' => array( |
| 193 |
'label' => __( 'Postcode', 'charitable' ), |
| 194 |
'data_type' => 'user', |
| 195 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 196 |
'donation_form' => array( |
| 197 |
'priority' => 18, |
| 198 |
'required' => false, |
| 199 |
), |
| 200 |
'admin_form' => true, |
| 201 |
'email_tag' => false, |
| 202 |
'show_in_meta' => false, |
| 203 |
'show_in_export' => true, |
| 204 |
), |
| 205 |
'country' => array( |
| 206 |
'label' => __( 'Country', 'charitable' ), |
| 207 |
'data_type' => 'user', |
| 208 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 209 |
'donation_form' => array( |
| 210 |
'priority' => 20, |
| 211 |
'required' => false, |
| 212 |
'type' => 'select', |
| 213 |
'options' => charitable_get_location_helper()->get_countries(), |
| 214 |
'default' => charitable_get_option( 'country' ), |
| 215 |
), |
| 216 |
'admin_form' => true, |
| 217 |
'email_tag' => false, |
| 218 |
'show_in_meta' => false, |
| 219 |
'show_in_export' => true, |
| 220 |
), |
| 221 |
'phone' => array( |
| 222 |
'label' => __( 'Phone Number', 'charitable' ), |
| 223 |
'data_type' => 'user', |
| 224 |
'value_callback' => 'charitable_get_donor_meta_value', |
| 225 |
'donation_form' => array( |
| 226 |
'priority' => 22, |
| 227 |
'required' => false, |
| 228 |
), |
| 229 |
'admin_form' => true, |
| 230 |
'email_tag' => array( |
| 231 |
'tag' => 'donor_phone', |
| 232 |
'description' => __( 'The donor\'s phone number', 'charitable' ), |
| 233 |
'preview' => '1300 000 000', |
| 234 |
), |
| 235 |
'show_in_meta' => true, |
| 236 |
'show_in_export' => true, |
| 237 |
), |
| 238 |
'campaigns' => array( |
| 239 |
'label' => __( 'Campaigns', 'charitable' ), |
| 240 |
'data_type' => 'core', |
| 241 |
'value_callback' => false, // Will use Charitable_Donation::get_campaigns(). |
| 242 |
'donation_form' => false, |
| 243 |
'admin_form' => false, |
| 244 |
'email_tag' => array( |
| 245 |
'description' => __( 'The campaigns that were donated to', 'charitable' ), |
| 246 |
'preview' => __( 'Fake Campaign', 'charitable' ), |
| 247 |
), |
| 248 |
'show_in_meta' => false, |
| 249 |
'show_in_export' => false, |
| 250 |
), |
| 251 |
'campaign_categories_list' => array( |
| 252 |
'label' => __( 'Campaign Categories', 'charitable' ), |
| 253 |
'data_type' => 'core', |
| 254 |
'value_callback' => false, // Will use Charitable_Donation::get_campaign_categories_list(). |
| 255 |
'donation_form' => false, |
| 256 |
'admin_form' => false, |
| 257 |
'email_tag' => array( |
| 258 |
'tag' => 'campaign_categories', |
| 259 |
'description' => __( 'The categories of the campaigns that were donated to', 'charitable' ), |
| 260 |
'preview' => __( 'Fake Category', 'charitable' ), |
| 261 |
), |
| 262 |
'show_in_meta' => false, |
| 263 |
'show_in_export' => true, |
| 264 |
), |
| 265 |
'amount_formatted' => array( |
| 266 |
'label' => __( 'Donation Amount', 'charitable' ), |
| 267 |
'data_type' => 'core', |
| 268 |
'donation_form' => false, |
| 269 |
'admin_form' => false, |
| 270 |
'email_tag' => array( |
| 271 |
'tag' => 'donation_amount', |
| 272 |
'description' => __( 'The total amount donated', 'charitable' ), |
| 273 |
'preview' => '$50.00', |
| 274 |
), |
| 275 |
'show_in_meta' => false, |
| 276 |
'show_in_export' => false, |
| 277 |
), |
| 278 |
'date' => array( |
| 279 |
'label' => __( 'Date of Donation', 'charitable' ), |
| 280 |
'data_type' => 'core', |
| 281 |
'value_callback' => false, // Will use Charitable_Donation::get_date(). |
| 282 |
'donation_form' => false, |
| 283 |
'admin_form' => array( |
| 284 |
'type' => 'datepicker', |
| 285 |
'priority' => 4, |
| 286 |
'required' => true, |
| 287 |
'section' => 'meta', |
| 288 |
'default' => date_i18n( 'F d, Y', time() ), |
| 289 |
'value_callback' => 'charitable_get_donation_date_for_form_value', |
| 290 |
), |
| 291 |
'email_tag' => array( |
| 292 |
'tag' => 'donation_date', |
| 293 |
'description' => __( 'The date the donation was made', 'charitable' ), |
| 294 |
'preview' => date_i18n( get_option( 'date_format' ) ), |
| 295 |
), |
| 296 |
'show_in_meta' => false, |
| 297 |
'show_in_export' => true, |
| 298 |
), |
| 299 |
'time' => array( |
| 300 |
'label' => __( 'Time of Donation', 'charitable' ), |
| 301 |
'data_type' => 'core', |
| 302 |
'value_callback' => false, // Will use Charitable_Donation::get_time(). |
| 303 |
'donation_form' => false, |
| 304 |
'admin_form' => false, |
| 305 |
'email_tag' => false, |
| 306 |
'show_in_meta' => false, |
| 307 |
'show_in_export' => true, |
| 308 |
), |
| 309 |
'status' => array( |
| 310 |
'label' => __( 'Donation Status', 'charitable' ), |
| 311 |
'data_type' => 'core', |
| 312 |
'value_callback' => false, // Will use Charitable_Donation::get_status(). |
| 313 |
'donation_form' => false, |
| 314 |
'admin_form' => array( |
| 315 |
'type' => 'select', |
| 316 |
'priority' => 8, |
| 317 |
'required' => true, |
| 318 |
'section' => 'meta', |
| 319 |
'options' => charitable_get_valid_donation_statuses(), |
| 320 |
), |
| 321 |
'email_tag' => false, |
| 322 |
'show_in_meta' => false, |
| 323 |
'show_in_export' => false, |
| 324 |
), |
| 325 |
'status_label' => array( |
| 326 |
'label' => __( 'Donation Status', 'charitable' ), |
| 327 |
'data_type' => 'core', |
| 328 |
'value_callback' => false, // Will use Charitable_Donation::get_status_label(). |
| 329 |
'donation_form' => false, |
| 330 |
'admin_form' => false, |
| 331 |
'email_tag' => array( |
| 332 |
'tag' => 'donation_status', |
| 333 |
'description' => __( 'The status of the donation (pending, paid, etc.)', 'charitable' ), |
| 334 |
'preview' => __( 'Paid', 'charitable' ), |
| 335 |
), |
| 336 |
'show_in_meta' => false, |
| 337 |
'show_in_export' => true, |
| 338 |
), |
| 339 |
'donation_gateway' => array( |
| 340 |
'label' => __( 'Payment Method', 'charitable' ), |
| 341 |
'data_type' => 'meta', |
| 342 |
'value_callback' => 'charitable_get_donation_meta_value', |
| 343 |
'donation_form' => false, |
| 344 |
'admin_form' => array( |
| 345 |
'type' => 'hidden', |
| 346 |
'section' => 'meta', |
| 347 |
), |
| 348 |
'email_tag' => false, |
| 349 |
'show_in_meta' => false, |
| 350 |
'show_in_export' => false, |
| 351 |
), |
| 352 |
'gateway_label' => array( |
| 353 |
'label' => __( 'Payment Method', 'charitable' ), |
| 354 |
'data_type' => 'core', |
| 355 |
'value_callback' => false, // Will use Charitable_Donation::get_gateway_label(). |
| 356 |
'donation_form' => false, |
| 357 |
'admin_form' => false, |
| 358 |
'email_tag' => false, |
| 359 |
'show_in_meta' => true, |
| 360 |
'show_in_export' => true, |
| 361 |
), |
| 362 |
'donation_key' => array( |
| 363 |
'label' => __( 'Donation Key', 'charitable' ), |
| 364 |
'data_type' => 'core', |
| 365 |
'value_callback' => false, // Will use Charitable_Donation::get_donation_key(). |
| 366 |
'donation_form' => false, |
| 367 |
'admin_form' => false, |
| 368 |
'email_tag' => false, |
| 369 |
'show_in_meta' => true, |
| 370 |
'show_in_export' => false, |
| 371 |
), |
| 372 |
'gateway_transaction_id' => array( |
| 373 |
'label' => __( 'Gateway Transaction ID', 'charitable' ), |
| 374 |
'data_type' => 'meta', |
| 375 |
'value_callback' => false, |
| 376 |
'donation_form' => false, |
| 377 |
'admin_form' => false, |
| 378 |
'email_tag' => array( |
| 379 |
'description' => __( 'The payment gateway\'s transaction ID for the donation', 'charitable' ), |
| 380 |
'preview' => 'XYZ-2132323', |
| 381 |
), |
| 382 |
'show_in_meta' => true, |
| 383 |
'show_in_export' => true, |
| 384 |
), |
| 385 |
'test_mode' => array( |
| 386 |
'label' => __( 'Donation made in test mode?', 'charitable' ), |
| 387 |
'data_type' => 'core', |
| 388 |
'value_callback' => false, // Will use Charitable_Donation::get_test_mode_text(). |
| 389 |
'donation_form' => false, |
| 390 |
'admin_form' => false, |
| 391 |
'email_tag' => false, |
| 392 |
'show_in_meta' => true, |
| 393 |
'show_in_export' => true, |
| 394 |
), |
| 395 |
'donation_summary' => array( |
| 396 |
'label' => __( 'Summary', 'charitable' ), |
| 397 |
'data_type' => 'core', |
| 398 |
'value_callback' => false, // Will use Charitable_Donation::get_donation_summary(). |
| 399 |
'donation_form' => false, |
| 400 |
'admin_form' => false, |
| 401 |
'email_tag' => array( |
| 402 |
'description' => __( 'A summary of the donation', 'charitable' ), |
| 403 |
'preview' => __( 'Fake Campaign: $50.00', 'charitable' ) . PHP_EOL, |
| 404 |
), |
| 405 |
'show_in_meta' => false, |
| 406 |
'show_in_export' => false, |
| 407 |
), |
| 408 |
'contact_consent' => array( |
| 409 |
'label' => __( 'Contact Consent', 'charitable' ), |
| 410 |
'data_type' => 'core', |
| 411 |
'value_callback' => false, |
| 412 |
'donation_form' => false, |
| 413 |
'admin_form' => false, |
| 414 |
'email_tag' => array( |
| 415 |
'description' => __( 'Whether the donor gave consent to be contacted', 'charitable' ), |
| 416 |
'preview' => __( 'Given', 'charitable' ), |
| 417 |
), |
| 418 |
'show_in_meta' => false, |
| 419 |
'show_in_export' => true, |
| 420 |
), |
| 421 |
) |
| 422 |
); |
| 423 |
|