| 1 |
<?php |
| 2 |
/** |
| 3 |
* Returns an array of all the default campaign fields. |
| 4 |
* |
| 5 |
* @package Charitable/Campaign Fields |
| 6 |
* @author David Bisset |
| 7 |
* @copyright Copyright (c) 2023, WP Charitable LLC |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.6.0 |
| 10 |
* @version 1.8.9.1 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Filter the set of default campaign fields. |
| 20 |
* |
| 21 |
* This filter is provided primarily for internal use by Charitable |
| 22 |
* extensions, as it allows us to add to the registered campaign fields |
| 23 |
* as soon as possible. |
| 24 |
* |
| 25 |
* @since 1.6.0 |
| 26 |
* |
| 27 |
* @param array $fields The multi-dimensional array of keys in $key => $args format. |
| 28 |
*/ |
| 29 |
return apply_filters( |
| 30 |
'charitable_default_campaign_fields', |
| 31 |
array( |
| 32 |
'ID' => array( |
| 33 |
'label' => __( 'Campaign ID', 'charitable' ), |
| 34 |
'data_type' => 'core', |
| 35 |
'value_callback' => 'charitable_get_campaign_post_field', |
| 36 |
'admin_form' => false, |
| 37 |
'email_tag' => false, |
| 38 |
'show_in_export' => true, |
| 39 |
), |
| 40 |
'description' => array( |
| 41 |
'label' => __( 'Description', 'charitable' ), |
| 42 |
'data_type' => 'meta', |
| 43 |
'admin_form' => array( |
| 44 |
'section' => 'campaign-top', |
| 45 |
'type' => 'textarea', |
| 46 |
'view' => 'metaboxes/campaign-description', |
| 47 |
'priority' => 4, |
| 48 |
), |
| 49 |
'email_tag' => false, |
| 50 |
'show_in_export' => true, |
| 51 |
), |
| 52 |
'goal' => array( |
| 53 |
'label' => __( 'Goal', 'charitable' ), |
| 54 |
'data_type' => 'meta', |
| 55 |
'admin_form' => array( |
| 56 |
'section' => 'campaign-top', |
| 57 |
'type' => 'number', |
| 58 |
'view' => 'metaboxes/campaign-goal', |
| 59 |
'priority' => 6, |
| 60 |
'description' => __( 'Leave empty for campaigns without a fundraising goal.', 'charitable' ), |
| 61 |
), |
| 62 |
'email_tag' => false, |
| 63 |
'show_in_export' => true, |
| 64 |
), |
| 65 |
'monetary_goal' => array( |
| 66 |
'label' => __( 'Goal ($)', 'charitable' ), |
| 67 |
'data_type' => 'core', |
| 68 |
'value_callback' => false, |
| 69 |
'admin_form' => false, |
| 70 |
'email_tag' => array( |
| 71 |
'tag' => 'campaign_goal', |
| 72 |
'description' => __( 'Display the campaign\'s fundraising goal', 'charitable' ), |
| 73 |
'preview' => '$15,000', |
| 74 |
), |
| 75 |
'show_in_export' => false, |
| 76 |
), |
| 77 |
'end_date' => array( |
| 78 |
'label' => __( 'End Date', 'charitable' ), |
| 79 |
'data_type' => 'meta', |
| 80 |
'admin_form' => array( |
| 81 |
'section' => 'campaign-top', |
| 82 |
'type' => 'date', |
| 83 |
'view' => 'metaboxes/campaign-end-date', |
| 84 |
'priority' => 8, |
| 85 |
'description' => __( 'Leave empty for ongoing campaigns.', 'charitable' ), |
| 86 |
), |
| 87 |
'email_tag' => array( |
| 88 |
'tag' => 'campaign_end_date', |
| 89 |
'description' => __( 'The end date of the campaign', 'charitable' ), |
| 90 |
'preview' => date( get_option( 'date_format', 'd/m/Y' ) ), // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date |
| 91 |
), |
| 92 |
'show_in_export' => true, |
| 93 |
), |
| 94 |
'end_time' => array( |
| 95 |
'label' => __( 'End Date Timestamp', 'charitable' ), |
| 96 |
'data_type' => 'core', |
| 97 |
'value_callback' => false, |
| 98 |
'donation_form' => false, |
| 99 |
'admin_form' => false, |
| 100 |
'email_tag' => false, |
| 101 |
'show_in_export' => false, |
| 102 |
), |
| 103 |
'suggested_donations' => array( |
| 104 |
'label' => __( 'Suggested Donation Amounts', 'charitable' ), |
| 105 |
'data_type' => 'meta', |
| 106 |
'admin_form' => array( |
| 107 |
'section' => 'campaign-donation-options', |
| 108 |
'type' => 'array', |
| 109 |
'view' => 'metaboxes/campaign-donation-options/suggested-amounts', |
| 110 |
'priority' => 4, |
| 111 |
), |
| 112 |
'email_tag' => false, |
| 113 |
'show_in_export' => false, |
| 114 |
), |
| 115 |
'allow_custom_donations' => array( |
| 116 |
'label' => __( 'Allow Custom Donations', 'charitable' ), |
| 117 |
'data_type' => 'meta', |
| 118 |
'admin_form' => array( |
| 119 |
'section' => 'campaign-donation-options', |
| 120 |
'type' => 'checkbox', |
| 121 |
'priority' => 6, |
| 122 |
), |
| 123 |
'email_tag' => false, |
| 124 |
'show_in_export' => false, |
| 125 |
), |
| 126 |
'minimum_donation_amount' => array( |
| 127 |
'label' => __( 'Minimum Donation Amount', 'charitable' ), |
| 128 |
'data_type' => 'meta', |
| 129 |
'value_callback' => false, |
| 130 |
'admin_form' => array( |
| 131 |
'section' => 'campaign-donation-options', |
| 132 |
'type' => 'number', |
| 133 |
'title' => __( 'Minimum Donation Amount', 'charitable' ), |
| 134 |
'view' => 'metaboxes/campaign-minimum-donation-amount', |
| 135 |
'description' => __( 'Leave empty to allow no restrictions on how small the donation can be.', 'charitable' ), |
| 136 |
'priority' => 11, |
| 137 |
), |
| 138 |
'email_tag' => false, |
| 139 |
'show_in_export' => true, |
| 140 |
), |
| 141 |
'post_title' => array( |
| 142 |
'label' => __( 'Title', 'charitable' ), |
| 143 |
'data_type' => 'core', |
| 144 |
'value_callback' => 'charitable_get_campaign_post_field', |
| 145 |
'admin_form' => false, |
| 146 |
'email_tag' => array( |
| 147 |
'tag' => 'campaign_title', |
| 148 |
'description' => __( 'The title of the campaign', 'charitable' ), |
| 149 |
'preview' => __( 'Fake Campaign', 'charitable' ), |
| 150 |
), |
| 151 |
'show_in_export' => true, |
| 152 |
), |
| 153 |
'post_date' => array( |
| 154 |
'label' => __( 'Date Created', 'charitable' ), |
| 155 |
'data_type' => 'core', |
| 156 |
'value_callback' => 'charitable_get_campaign_post_field', |
| 157 |
'admin_form' => false, |
| 158 |
'email_tag' => false, |
| 159 |
'show_in_export' => true, |
| 160 |
), |
| 161 |
'timestamp' => array( |
| 162 |
'label' => __( 'Date Created as Timestamp', 'charitable' ), |
| 163 |
'data_type' => 'core', |
| 164 |
'value_callback' => 'charitable_get_campaign_date_as_timestamp', |
| 165 |
'donation_form' => false, |
| 166 |
'admin_form' => false, |
| 167 |
'show_in_export' => false, |
| 168 |
'email_tag' => false, |
| 169 |
), |
| 170 |
'post_author' => array( |
| 171 |
'label' => __( 'Campaign Creator ID', 'charitable' ), |
| 172 |
'data_type' => 'core', |
| 173 |
'value_callback' => 'charitable_get_campaign_post_field', |
| 174 |
'admin_form' => array( |
| 175 |
'section' => 'campaign-creator', |
| 176 |
'type' => 'text', |
| 177 |
'view' => 'metaboxes/campaign-creator', |
| 178 |
'priority' => 2, |
| 179 |
), |
| 180 |
'email_tag' => false, |
| 181 |
'show_in_export' => true, |
| 182 |
), |
| 183 |
'post_content' => array( |
| 184 |
'label' => __( 'Extended Description', 'charitable' ), |
| 185 |
'data_type' => 'core', |
| 186 |
'value_callback' => 'charitable_get_campaign_post_field', |
| 187 |
'admin_form' => array( |
| 188 |
'section' => 'campaign-extended-description', |
| 189 |
'type' => 'text', |
| 190 |
'view' => 'metaboxes/campaign-extended-description', |
| 191 |
'priority' => 2, |
| 192 |
), |
| 193 |
'email_tag' => false, |
| 194 |
'show_in_export' => false, |
| 195 |
), |
| 196 |
'page_settings' => array( |
| 197 |
'label' => __( 'Campaign Summary', 'charitable' ), |
| 198 |
'data_type' => 'core', |
| 199 |
'value_callback' => 'charitable_get_campaign_post_field', |
| 200 |
'admin_form' => array( |
| 201 |
'section' => 'campaign-page-settings', |
| 202 |
'type' => 'text', |
| 203 |
'view' => 'metaboxes/campaign-page-settings', |
| 204 |
'priority' => 2, |
| 205 |
), |
| 206 |
'email_tag' => false, |
| 207 |
'show_in_export' => false, |
| 208 |
), |
| 209 |
'image' => array( |
| 210 |
'label' => __( 'Featured Image', 'charitable' ), |
| 211 |
'data_type' => 'meta', |
| 212 |
'value_callback' => 'charitable_get_campaign_featured_image', |
| 213 |
'admin_form' => false, |
| 214 |
'email_tag' => false, |
| 215 |
'show_in_export' => false, |
| 216 |
), |
| 217 |
'campaign_creator_name' => array( |
| 218 |
'label' => __( 'Campaign Creator', 'charitable' ), |
| 219 |
'data_type' => 'core', |
| 220 |
'value_callback' => false, |
| 221 |
'admin_form' => false, |
| 222 |
'email_tag' => array( |
| 223 |
'tag' => 'campaign_creator', |
| 224 |
'description' => __( 'The name of the campaign creator', 'charitable' ), |
| 225 |
'preview' => 'Harry Ferguson', |
| 226 |
), |
| 227 |
'show_in_export' => true, |
| 228 |
), |
| 229 |
'campaign_creator_email' => array( |
| 230 |
'label' => __( 'Campaign Creator Email', 'charitable' ), |
| 231 |
'data_type' => 'core', |
| 232 |
'value_callback' => false, |
| 233 |
'admin_form' => false, |
| 234 |
'email_tag' => array( |
| 235 |
'description' => __( 'The email address of the campaign creator', 'charitable' ), |
| 236 |
'preview' => 'harry@example.com', |
| 237 |
), |
| 238 |
'show_in_export' => true, |
| 239 |
), |
| 240 |
'goal_achieved_message' => array( |
| 241 |
'label' => __( 'Achieved Goal?', 'charitable' ), |
| 242 |
'data_type' => 'core', |
| 243 |
'value_callback' => false, |
| 244 |
'admin_form' => false, |
| 245 |
'email_tag' => array( |
| 246 |
'tag' => 'campaign_achieved_goal', |
| 247 |
'description' => __( 'Display whether the campaign reached its goal. Add a `success` parameter as the message when the campaign was successful, and a `failure` parameter as the message when the campaign is not successful', 'charitable' ), |
| 248 |
'preview' => __( 'The campaign achieved its fundraising goal.', 'charitable' ), |
| 249 |
), |
| 250 |
'show_in_export' => false, |
| 251 |
), |
| 252 |
'donated_amount' => array( |
| 253 |
'label' => __( 'Amount Donated', 'charitable' ), |
| 254 |
'data_type' => 'core', |
| 255 |
'value_callback' => false, |
| 256 |
'admin_form' => false, |
| 257 |
'email_tag' => false, |
| 258 |
'show_in_export' => true, |
| 259 |
), |
| 260 |
'donated_amount_formatted' => array( |
| 261 |
'label' => __( 'Amount Donated', 'charitable' ), |
| 262 |
'data_type' => 'core', |
| 263 |
'value_callback' => false, |
| 264 |
'admin_form' => false, |
| 265 |
'email_tag' => array( |
| 266 |
'tag' => 'campaign_donated_amount', |
| 267 |
'description' => __( 'Display the total amount donated to the campaign', 'charitable' ), |
| 268 |
'preview' => '$16,523', |
| 269 |
), |
| 270 |
'show_in_export' => false, |
| 271 |
), |
| 272 |
'percent_donated' => array( |
| 273 |
'label' => __( 'Percent Donated', 'charitable' ), |
| 274 |
'data_type' => 'core', |
| 275 |
'value_callback' => false, |
| 276 |
'admin_form' => false, |
| 277 |
'email_tag' => array( |
| 278 |
'tag' => 'campaign_percent_donated', |
| 279 |
'description' => __( 'Display the percentage donated to the campaign', 'charitable' ), |
| 280 |
'preview' => '34%', |
| 281 |
), |
| 282 |
'show_in_export' => false, |
| 283 |
), |
| 284 |
'percent_donated_raw' => array( |
| 285 |
'label' => __( 'Percent Donated', 'charitable' ), |
| 286 |
'data_type' => 'core', |
| 287 |
'value_callback' => false, |
| 288 |
'admin_form' => false, |
| 289 |
'email_tag' => false, |
| 290 |
'show_in_export' => true, |
| 291 |
), |
| 292 |
'donor_count' => array( |
| 293 |
'label' => __( 'Number of Donors', 'charitable' ), |
| 294 |
'data_type' => 'core', |
| 295 |
'value_callback' => false, |
| 296 |
'admin_form' => false, |
| 297 |
'email_tag' => array( |
| 298 |
'tag' => 'campaign_donor_count', |
| 299 |
'description' => __( 'Display the number of campaign donors', 'charitable' ), |
| 300 |
'preview' => 23, |
| 301 |
), |
| 302 |
'show_in_export' => true, |
| 303 |
), |
| 304 |
'status' => array( |
| 305 |
'label' => __( 'Campaign Status', 'charitable' ), |
| 306 |
'data_type' => 'core', |
| 307 |
'value_callback' => false, |
| 308 |
'admin_form' => false, |
| 309 |
'email_tag' => false, |
| 310 |
'show_in_export' => true, |
| 311 |
), |
| 312 |
'permalink' => array( |
| 313 |
'label' => __( 'Campaign Permalink', 'charitable' ), |
| 314 |
'data_type' => 'core', |
| 315 |
'value_callback' => false, |
| 316 |
'admin_form' => false, |
| 317 |
'email_tag' => array( |
| 318 |
'tag' => 'campaign_url', |
| 319 |
'description' => __( 'Display the campaign\'s URL', 'charitable' ), |
| 320 |
'preview' => 'http://www.example.com/campaigns/fake-campaign', |
| 321 |
), |
| 322 |
'show_in_export' => true, |
| 323 |
), |
| 324 |
'admin_edit_link' => array( |
| 325 |
'label' => __( 'Campaign Edit Link', 'charitable' ), |
| 326 |
'data_type' => 'core', |
| 327 |
'value_callback' => false, |
| 328 |
'admin_form' => false, |
| 329 |
'email_tag' => array( |
| 330 |
'tag' => 'campaign_dashboard_url', |
| 331 |
'description' => __( 'Display a link to the campaign in the dashboard', 'charitable' ), |
| 332 |
'preview' => admin_url( 'post.php?post=1&action=edit' ), |
| 333 |
), |
| 334 |
'show_in_export' => false, |
| 335 |
), |
| 336 |
'categories' => array( |
| 337 |
'label' => __( 'Categories', 'charitable' ), |
| 338 |
'data_type' => 'taxonomy', |
| 339 |
'value_callback' => 'charitable_get_campaign_taxonomy_terms_list', |
| 340 |
'admin_form' => false, |
| 341 |
'email_tag' => array( |
| 342 |
'description' => __( 'Display a comma-separated list of campaign categories', 'charitable' ), |
| 343 |
'preview' => 'Category 1, Category 2', |
| 344 |
), |
| 345 |
'show_in_export' => true, |
| 346 |
), |
| 347 |
'tags' => array( |
| 348 |
'label' => __( 'Tags', 'charitable' ), |
| 349 |
'data_type' => 'taxonomy', |
| 350 |
'value_callback' => 'charitable_get_campaign_taxonomy_terms_list', |
| 351 |
'admin_form' => false, |
| 352 |
'email_tag' => array( |
| 353 |
'description' => __( 'Display a comma-separated list of campaign tags', 'charitable' ), |
| 354 |
'preview' => 'Tag 1, Tag 2, Tag 3', |
| 355 |
), |
| 356 |
'show_in_export' => true, |
| 357 |
), |
| 358 |
) |
| 359 |
); |
| 360 |
|