PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
← All changes | includes/charitable-core-functions.php +42 -1 1.8.12.2 → 1.8.13 View file →
@@ -8,9 +8,9 @@
8 8 * @author David Bisset
9 9 * @copyright Copyright (c) 2023, WP Charitable LLC
10 10 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 11 * @since 1.0.0
12 - * @version 1.6.37
12 + * @version 1.8.12.4
13 13 */
14 14
15 15 // Exit if accessed directly.
16 16 if ( ! defined( 'ABSPATH' ) ) {
@@ -1070,7 +1070,48 @@
1070 1070 * @return boolean
1071 1071 */
1072 1072 function charitable_is_square_addon_active() {
1073 1073 return is_plugin_active( 'charitable-square/charitable-square.php' );
1074 +}
1075 +
1076 +/**
1077 + * Whether the current visitor may upload through a picture field.
1078 + *
1079 + * Anonymous file writes are off unless a site explicitly opts in. This lives in one place
1080 + * so the AJAX handler and the picture field template cannot drift apart: a form that draws
1081 + * a working uploader must be a form whose uploads the endpoint will actually accept.
1082 + *
1083 + * @since 1.8.12.4
1084 + *
1085 + * @param string $field_id The picture field's key, where known.
1086 + * @param int $post_id The parent post the field uploads against, where known.
1087 + * @return boolean
1088 + */
1089 +function charitable_picture_uploads_enabled( $field_id = '', $post_id = 0 ) {
1090 + if ( is_user_logged_in() ) {
1091 + return true;
1092 + }
1093 +
1094 + /*
1095 + * Ambassadors has exposed charitable_ambassadors_allow_anonymous_photo_uploads since its
1096 + * 3.2.0 for its own gallery uploader. Its campaign and fundraiser picture fields upload
1097 + * through Charitable's endpoint, which that addon does not own and cannot gate, so seed
1098 + * the default from its filter: a site that deliberately opted in to anonymous photo
1099 + * uploads keeps working, and the gallery and picture fields agree in every configuration.
1100 + * Note this widens that opt-in to every picture field on the site, which is the intended
1101 + * reading of an explicit site-owner opt-in.
1102 + */
1103 + $allow = (bool) apply_filters( 'charitable_ambassadors_allow_anonymous_photo_uploads', false );
1104 +
1105 + /**
1106 + * Whether a logged-out visitor may upload through a picture field.
1107 + *
1108 + * @since 1.8.12.4
1109 + *
1110 + * @param boolean $allow Whether to allow the upload. Off by default.
1111 + * @param string $field_id The picture field's key, where known.
1112 + * @param int $post_id The parent post the field uploads against, where known.
1113 + */
1114 + return (bool) apply_filters( 'charitable_allow_anonymous_picture_uploads', $allow, $field_id, $post_id );
1074 1115 }
1075 1116
1076 1117 require_once dirname( __FILE__ ) . '/logger/charitable-log-functions.php';