Skip to content

Commit

Permalink
Merge branch 'develop' into feature/phone-number-form-GIVE-532
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubersilva committed Apr 16, 2024
2 parents cb7b7bc + 2f2310d commit 7d1cd5e
Show file tree
Hide file tree
Showing 45 changed files with 1,343 additions and 89 deletions.
11 changes: 11 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
== Changelog ==
= 3.7.0: April 10th, 2024 =
* New: Added pre-requisite form builder compatibility for upcoming constant contact add-on release
* New: Added phone number field to the donor details page, more updates for this field will come in future releases!
* Enhancement: Updated the form block option to select more available forms than the original limit of 10
* Enhancement: Updated the form builder left-side menu to open automatically when entering the build screen
* Security: Added sanitizing and escaping to shortcodes
* Fix: Resolved a conflict with GiveWP and WordPress bulk actions functionality

= 3.6.2: April 5th, 2024 =
* Fix: Resolved an issue with WordPress 6.5 and the visual form builder that was making it difficult to interact with blocks

= 3.6.1: March 21st, 2024 =
* Fix: Resolved an issue with PayPal donations and currency switcher on donation forms using the visual form builder

Expand Down
6 changes: 3 additions & 3 deletions give.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
* Author: GiveWP
* Author URI: https://givewp.com/
* Version: 3.6.2
* Requires at least: 6.0
* Version: 3.7.0
* Requires at least: 6.3
* Requires PHP: 7.2
* Text Domain: give
* Domain Path: /languages
Expand Down Expand Up @@ -404,7 +404,7 @@ private function setup_constants()
{
// Plugin version.
if (!defined('GIVE_VERSION')) {
define('GIVE_VERSION', '3.6.2');
define('GIVE_VERSION', '3.7.0');
}

// Plugin Root File.
Expand Down
4 changes: 2 additions & 2 deletions includes/admin/donors/donor-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Processes a donor edit.
*
* @unreleased Add support to the "phone" field
* @since 3.7.0 Add support to the "phone" field
* @since 1.0
*
* @param array $args The $_POST array being passed.
Expand Down Expand Up @@ -132,7 +132,7 @@ function give_edit_donor( $args ) {
* @param array $args The sanitized data submitted.
* @param int $donor_id The donor ID.
*
* @unreleased
* @since 3.7.0
*/
do_action('give_admin_donor_details_updating', $args, $donor->id);

Expand Down
2 changes: 1 addition & 1 deletion includes/admin/donors/donors.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function give_render_donor_view( $view, $callbacks ) {
/**
* View a donor
*
* @unreleased Add "phone" field
* @since 3.7.0 Add "phone" field
* @since 1.0
*
* @param Give_Donor $donor The Donor object being displayed.
Expand Down
11 changes: 6 additions & 5 deletions includes/class-notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ public static function print_frontend_errors( $errors ) {
* Print frontend notice.
* Notice: notice type can be success/error/warning
*
* @since 3.7.0 Escape attributes
* @since 1.8.9
* @access public
*
Expand Down Expand Up @@ -691,11 +692,11 @@ public static function print_frontend_notice( $message, $echo = true, $notice_ty
</p>
%6$s
</div>',
$notice_type,
give_clean( $notice_args['dismissible'] ),
absint( $notice_args['dismiss_interval'] ),
give_clean( $notice_args['dismiss_type'] ),
$message,
esc_attr($notice_type),
esc_attr( $notice_args['dismissible'] ),
esc_attr( $notice_args['dismiss_interval'] ),
esc_attr( $notice_args['dismiss_type'] ),
esc_html($message),
$close_icon
);

Expand Down
2 changes: 2 additions & 0 deletions includes/donors/class-give-donor-wall.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function setup_actions() {
/**
* Displays donors in a grid layout.
*
* @since 3.7.0 Sanitize attributes
* @since 2.27.0 Moved AJAX nonce verification to ajax_handler method.
* @since 2.2.0
*
Expand Down Expand Up @@ -114,6 +115,7 @@ public function setup_actions() {
* @return string|bool The markup of the form grid or false.
*/
public function render_shortcode( $atts ) {
$atts = give_clean($atts);

$give_settings = give_get_settings();

Expand Down
4 changes: 2 additions & 2 deletions includes/login-register.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ function give_login_form( $login_redirect = '', $logout_redirect = '' ) {
give_get_template(
'shortcode-login',
array(
'give_login_redirect' => esc_url($login_redirect),
'give_logout_redirect' => esc_url($logout_redirect),
'give_login_redirect' => $login_redirect,
'give_logout_redirect' => $logout_redirect,
)
);

Expand Down
28 changes: 23 additions & 5 deletions includes/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*
* Displays a user's donation history.
*
* @since 3.7.0 Sanitize attributes
* @since 3.1.0 pass form id by reference in give_totals shortcode.
* @since 1.0
*
Expand All @@ -34,7 +35,7 @@
* @return string|bool
*/
function give_donation_history( $atts, $content = false ) {

$atts = give_clean($atts);
$donation_history_args = shortcode_atts(
[
'id' => true,
Expand Down Expand Up @@ -132,6 +133,7 @@ function give_donation_history( $atts, $content = false ) {
*
* Show the Give donation form.
*
* @since 3.7.0 Sanitize attributes
* @since 3.4.0 Add additional validations to check if the form is valid and has the 'published' status.
* @since 2.30.0 Add short-circuit filter to allow for custom output.
* @since 1.0
Expand All @@ -142,6 +144,7 @@ function give_donation_history( $atts, $content = false ) {
* @return string
*/
function give_form_shortcode( $atts ) {
$atts = give_clean($atts);
$atts = shortcode_atts( give_get_default_form_shortcode_args(), $atts, 'give_form' );

if('fullForm' === $atts['display_style']) {
Expand Down Expand Up @@ -210,6 +213,7 @@ function give_form_shortcode( $atts ) {
*
* Show the Give donation form goals.
*
* @since 3.7.0 Sanitize attributes
* @since 3.4.0 Add additional validations to check if the form is valid and has the 'published' status.
* @since 1.0
*
Expand All @@ -218,6 +222,7 @@ function give_form_shortcode( $atts ) {
* @return string
*/
function give_goal_shortcode( $atts ) {
$atts = give_clean($atts);
$atts = shortcode_atts(
[
'id' => '',
Expand Down Expand Up @@ -266,6 +271,7 @@ function give_goal_shortcode( $atts ) {
* Shows a login form allowing users to users to log in. This function simply
* calls the give_login_form function to display the login form.
*
* @since 3.7.0 Sanitize attributes
* @since 1.0
*
* @param array $atts Shortcode attributes.
Expand All @@ -275,7 +281,7 @@ function give_goal_shortcode( $atts ) {
* @return string
*/
function give_login_form_shortcode( $atts ) {

$atts = give_clean($atts);
$atts = shortcode_atts(
[
// Add backward compatibility for redirect attribute.
Expand All @@ -300,6 +306,7 @@ function give_login_form_shortcode( $atts ) {
*
* Shows a registration form allowing users to users to register for the site.
*
* @since 3.7.0 Sanitize attributes
* @since 1.0
*
* @param array $atts Shortcode attributes.
Expand All @@ -309,6 +316,7 @@ function give_login_form_shortcode( $atts ) {
* @return string
*/
function give_register_form_shortcode( $atts ) {
$atts = give_clean($atts);
$atts = shortcode_atts(
[
'redirect' => '',
Expand All @@ -327,6 +335,7 @@ function give_register_form_shortcode( $atts ) {
*
* Shows a donation receipt.
*
* @since 3.7.0 Sanitize and escape attributes
* @since 1.0
*
* @param array $atts Shortcode attributes.
Expand All @@ -337,6 +346,8 @@ function give_receipt_shortcode( $atts ) {

global $give_receipt_args;

$atts = give_clean($atts);

$give_receipt_args = shortcode_atts(
[
'error' => __( 'You are missing the donation id to view this donation receipt.', 'give' ),
Expand Down Expand Up @@ -378,8 +389,8 @@ function give_receipt_shortcode( $atts ) {
return sprintf(
'<div id="give-receipt" data-shortcode="%1$s" data-receipt-type="%2$s" data-donation-key="%3$s" >%4$s</div>',
htmlspecialchars( wp_json_encode( $give_receipt_args ) ),
$receipt_type,
$donation_id,
esc_attr($receipt_type),
esc_attr($donation_id),
ob_get_clean()
);
}
Expand All @@ -400,6 +411,7 @@ function give_receipt_shortcode( $atts ) {
* folder. Please visit the Give Documentation for more information on how the
* templating system is used.
*
* @since 3.7.0 Sanitize attributes
* @since 1.0
*
* @param array $atts Shortcode attributes.
Expand All @@ -408,6 +420,8 @@ function give_receipt_shortcode( $atts ) {
*/
function give_profile_editor_shortcode( $atts ) {

$atts = give_clean($atts);

ob_start();

// Restrict access to donor profile, if donor and user are disconnected.
Expand Down Expand Up @@ -612,6 +626,7 @@ function give_process_profile_editor_updates( $data ) {
*
* Shows a donation total.
*
* @since 3.7.0 Sanitize attributes
* @since 2.1
*
* @param array $atts Shortcode attributes.
Expand Down Expand Up @@ -641,6 +656,8 @@ function give_totals_shortcode( $atts ) {
// Total Goal.
$total_goal = give_maybe_sanitize_amount( $atts['total_goal'] );

$atts = give_clean($atts);

/**
* Give Action fire before the shortcode is rendering is started.
*
Expand Down Expand Up @@ -818,6 +835,7 @@ static function ($id) {
/**
* Displays donation forms in a grid layout.
*
* @since 3.7.0 Sanitize attributes
* @since 2.1.0
*
* @since 3.1.0 Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus
Expand Down Expand Up @@ -855,7 +873,7 @@ static function ($id) {
* @return string|bool The markup of the form grid or false.
*/
function give_form_grid_shortcode( $atts ) {

$atts = give_clean($atts);
$give_settings = give_get_settings();

$atts = shortcode_atts(
Expand Down
14 changes: 11 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Contributors: givewp, dlocc, webdevmattcrom, ravinderk, mehul0810, kevinwhoffman, jason_the_adams, henryholtgeerts, kbjohnson90, alaca, benmeredithgmailcom, jonwaldstein, joshuadinh, glaubersilvawp, pauloiankoski
Donate link: https://go.givewp.com/home
Tags: donation, donate, recurring donations, fundraising, crowdfunding
Requires at least: 6.0
Requires at least: 6.3
Tested up to: 6.5
Requires PHP: 7.2
Stable tag: 3.6.2
Stable tag: 3.7.0
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -167,7 +167,7 @@ Here’s a few ways you can contribute to GiveWP:

= Minimum Requirements =

* WordPress 6.0 or greater
* WordPress 6.3 or greater
* PHP version 7.2 or greater
* MySQL version 5.7 or greater
* MariaDB version 10 or later
Expand Down Expand Up @@ -262,6 +262,14 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri
10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on.

== Changelog ==
= 3.7.0: April 10th, 2024 =
* New: Added pre-requisite form builder compatibility for upcoming constant contact add-on release
* New: Added phone number field to the donor details page, more updates for this field will come in future releases!
* Enhancement: Updated the form block option to select more available forms than the original limit of 10
* Enhancement: Updated the form builder left-side menu to open automatically when entering the build screen
* Security: Added sanitizing and escaping to shortcodes
* Fix: Resolved a conflict with GiveWP and WordPress bulk actions functionality

= 3.6.2: April 5th, 2024 =
* Fix: Resolved an issue with WordPress 6.5 and the visual form builder that was making it difficult to interact with blocks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface FormOption extends Form {
}

/**
* @since 3.7.0 Increase the per_page attribute to 100 to accommodate for more forms.
* @since 3.2.0 include isLegacyForm, isLegacyFormTemplate & link.
* @since 3.0.0
*/
Expand All @@ -22,11 +23,16 @@ export default function useFormOptions(): {
const formOptions = [];

const {forms, isResolving} = useSelect((select) => {
const query = {per_page: 100};
return {
// @ts-ignore
forms: select('core').getEntityRecords<Post[]>('postType', 'give_forms'),
forms: select('core').getEntityRecords<Post[]>('postType', 'give_forms', query),
// @ts-ignore
isResolving: select('core/data').getIsResolving('core', 'getEntityRecords', ['postType', 'give_forms']),
isResolving: select('core/data').getIsResolving('core', 'getEntityRecords', [
'postType',
'give_forms',
query,
]),
};
}, []);

Expand Down
4 changes: 2 additions & 2 deletions src/DonationForms/Properties/FormSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ class FormSettings implements Arrayable, Jsonable
*/
public $designSettingsImageOpacity;

/* @unreleased
/* @since 3.7.0
* @var string
*/
public $formExcerpt;

/**
* @unreleased Added formExcerpt
* @since 3.7.0 Added formExcerpt
/**
* @since 3.2.0 Added registrationNotification
Expand Down
5 changes: 4 additions & 1 deletion src/DonationForms/Repositories/DonationFormRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getById(int $id)
}

/**
*
* @since 3.7.0 Add post_excerpt to the list of fields being inserted
* @since 3.0.0
*
* @return void
Expand Down Expand Up @@ -103,6 +103,7 @@ public function insert(DonationForm $donationForm)
'post_modified_gmt' => get_gmt_from_date($dateCreatedFormatted),
'post_status' => $donationForm->status->getValue(),
'post_type' => 'give_forms',
'post_excerpt' => $donationForm->settings->formExcerpt,
'post_parent' => 0,
'post_title' => $donationForm->title,
'post_content' => (new BlockCollection([]))->toJson(), // @todo Repurpose as form page.
Expand Down Expand Up @@ -146,6 +147,7 @@ public function insert(DonationForm $donationForm)
}

/**
* @since 3.7.0 Add post_excerpt to the list of fields being updated
* @since 3.0.0
*
* @param DonationForm $donationForm
Expand Down Expand Up @@ -179,6 +181,7 @@ public function update(DonationForm $donationForm)
'post_modified_gmt' => get_gmt_from_date($date),
'post_status' => $donationForm->status->getValue(),
'post_title' => $donationForm->title,
'post_excerpt' => $donationForm->settings->formExcerpt,
'post_content' => (new BlockCollection([]))->toJson(), // @todo Repurpose as form page.
'post_name' => $donationForm->settings->pageSlug,
]);
Expand Down
Loading

0 comments on commit 7d1cd5e

Please sign in to comment.