Skip to content

Commit

Permalink
Merge branch 'develop' into fix/GIVE-509
Browse files Browse the repository at this point in the history
  • Loading branch information
jonwaldstein authored Oct 30, 2024
2 parents f47aa56 + a27f7ae commit b80de51
Show file tree
Hide file tree
Showing 245 changed files with 5,384 additions and 1,170 deletions.
1 change: 1 addition & 0 deletions assets/src/css/admin/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ a.give-delete {
}

img {
object-fit: contain;
width: 100%;
}

Expand Down
Binary file added assets/src/images/admin/paypal-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion assets/src/images/admin/paypal-logo.svg

This file was deleted.

2 changes: 1 addition & 1 deletion assets/src/js/admin/admin-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3149,7 +3149,7 @@ const gravatar = require('gravatar');
orderedOptions.push({
text: option.textContent,
value: option.value,
selected: false,
selected: option.selected,
});
}
});
Expand Down
10 changes: 5 additions & 5 deletions assets/src/js/admin/onboarding-wizard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Vendor dependencies
import React from 'react';
import ReactDOM from 'react-dom';
import {createRoot} from 'react-dom/client';

// Onboarding Wizard app
import App from './app/index.js';
Expand All @@ -13,7 +13,7 @@ import App from './app/index.js';
import './style.scss';

// Render application
ReactDOM.render(
<App />,
document.getElementById( 'onboarding-wizard-app' )
);
const element = document.getElementById('onboarding-wizard-app');
if (element) {
createRoot(element).render(<App />);
}
1 change: 1 addition & 0 deletions assets/src/js/admin/paypal-commerce/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ window.addEventListener('DOMContentLoaded', function () {
formData.append('action', 'give_paypal_commerce_disconnect_account');
formData.append('mode', button.getAttribute('data-mode'));
formData.append('keep-webhooks', Boolean(keepWebhooks));
formData.append('_ajax_nonce', button.getAttribute('data-nonce'));

requestData.method = 'POST';
requestData.body = formData;
Expand Down
16 changes: 9 additions & 7 deletions assets/src/js/admin/reports/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
// Vendor dependencies
import { HashRouter as Router } from 'react-router-dom';
import React from 'react';
import ReactDOM from 'react-dom';
import {createRoot} from 'react-dom/client';

// Reports app
import App from './app/index.js';

ReactDOM.render(
<Router>
<App />
</Router>,
document.getElementById( 'reports-app' )
);
const element = document.getElementById('reports-app');
if (element) {
createRoot(element).render(
<Router>
<App />
</Router>
);
}
8 changes: 3 additions & 5 deletions assets/src/js/admin/reports/widget.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Entry point for dashboard widget

// Vendor dependencies
import ReactDOM from 'react-dom';
import {createRoot} from 'react-dom/client';
import moment from 'moment';

// Reports widget
Expand Down Expand Up @@ -30,10 +30,8 @@ const initialState = {
const container = document.getElementById('givewp-reports-widget');

if (container) {
ReactDOM.render(
<StoreProvider initialState={initialState} reducer={reducer}>
createRoot(container).render(<StoreProvider initialState={initialState} reducer={reducer}>
<Widget />
</StoreProvider>,
document.getElementById('givewp-reports-widget')
</StoreProvider>
);
}
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"paypal/paypal-checkout-sdk": "^1.0",
"kjohnson/format-object-list": "^0.1.0",
"fakerphp/faker": "^1.9",
"myclabs/php-enum": "^1.6",
"symfony/http-foundation": "^v3.4.47",
"moneyphp/money": "v3.3.1",
"stellarwp/field-conditions": "^1.1",
Expand Down
68 changes: 5 additions & 63 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions give.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
* Author: GiveWP
* Author URI: https://givewp.com/
* Version: 3.15.1
* Version: 3.17.1
* Requires at least: 6.4
* Requires PHP: 7.2
* Text Domain: give
Expand Down Expand Up @@ -190,6 +190,7 @@ final class Give
private $container;

/**
* @since 3.17.0 added Settings service provider
* @since 2.25.0 added HttpServiceProvider
* @since 2.19.6 added Donors, Donations, and Subscriptions
* @since 2.8.0
Expand Down Expand Up @@ -241,6 +242,7 @@ final class Give
Give\BetaFeatures\ServiceProvider::class,
Give\FormTaxonomies\ServiceProvider::class,
Give\DonationSpam\ServiceProvider::class,
Give\Settings\ServiceProvider::class
];

/**
Expand Down Expand Up @@ -406,7 +408,7 @@ private function setup_constants()
{
// Plugin version.
if (!defined('GIVE_VERSION')) {
define('GIVE_VERSION', '3.15.1');
define('GIVE_VERSION', '3.17.1');
}

// Plugin Root File.
Expand Down
6 changes: 3 additions & 3 deletions includes/admin/admin-actions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Give\Framework\Database\DB;
use Give\Helpers\Utils;
use Give\Log\ValueObjects\LogType;

/**
Expand Down Expand Up @@ -680,6 +681,7 @@ function showReactTable () {
/**
* Avoid insecure usage of `unserialize` when the data could be submitted by the user.
*
* @since 3.16.1 Use Utils::giveMaybeSafeUnserialize() method
* @since 3.5.0
*
* @param string $data Data that might be unserialized.
Expand All @@ -688,9 +690,7 @@ function showReactTable () {
*/
function give_maybe_safe_unserialize($data)
{
return is_serialized($data)
? @unserialize(trim($data), ['allowed_classes' => false])
: $data;
return Utils::maybeSafeUnserialize($data);
}

/**
Expand Down
8 changes: 7 additions & 1 deletion includes/admin/class-addon-activation-banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@
/**
* Class Give_Addon_Activation_Banner
*
* @unreleased added $user_id property to class
* @since 2.1.0 Added pleasing interface when multiple add-ons are activated.
*/
class Give_Addon_Activation_Banner {
/**
* @unreleased
* @var int
*/
protected $user_id;

/**
/**
* Class constructor.
*
* @since 1.0
Expand Down
4 changes: 3 additions & 1 deletion includes/admin/class-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ public static function get_settings_pages() {
* For example: if you register a setting page with give-settings menu slug
* then filter will be give-settings_get_settings_pages
*
* @since 3.17.1 cast to array
* @since 1.8
*
* @param array $settings Array of settings class object.
*/
self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', [] );
self::$settings = (array)apply_filters( self::$setting_filter_prefix . '_get_settings_pages', [] );

return self::$settings;
}
Expand Down Expand Up @@ -956,6 +957,7 @@ class="give-select-chosen give-chosen-settings"
style="<?php echo esc_attr( $value['style'] ); ?>"
name="<?php echo esc_attr( $name ); ?>"
id="<?php echo esc_attr( $value['id'] ); ?>"
data-placeholder="<?php echo esc_attr__( 'Select Some Options', 'give'); ?>"
<?php
echo "{$type} {$allow_new_values}";
echo implode( ' ', $custom_attributes );
Expand Down
13 changes: 6 additions & 7 deletions includes/admin/forms/dashboard-columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function give_form_columns( $give_form_columns ) {
/**
* Render Give Form Columns
*
* @since 3.16.0 Add new filters for the "donations count" and "revenue" columns
* @since 1.0
*
* @param string $column_name Column name
Expand Down Expand Up @@ -86,6 +87,7 @@ function give_render_form_columns( $column_name, $post_id ) {
break;
case 'goal':
if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
do_action('give_admin_form_list_view_donations_goal_column_before', $post_id);

echo give_admin_form_goal_stats( $post_id );

Expand All @@ -105,7 +107,7 @@ function give_render_form_columns( $column_name, $post_id ) {
printf(
'<a href="%1$s">%2$s</a>',
esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ),
give_get_form_sales_stats( $post_id )
apply_filters('give_admin_form_list_view_donations_count_column_value', give_get_form_sales_stats( $post_id ), $post_id)
);
} else {
echo '-';
Expand All @@ -116,7 +118,7 @@ function give_render_form_columns( $column_name, $post_id ) {
printf(
'<a href="%1$s">%2$s</a>',
esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ),
give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), [ 'sanitize' => false ] ) )
apply_filters('give_admin_form_list_view_revenue_column_value', give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), [ 'sanitize' => false ] ) ), $post_id)
);
} else {
echo '-';
Expand Down Expand Up @@ -168,7 +170,8 @@ function give_sortable_form_columns( $columns ) {
/**
* Sorts Columns in the Forms List Table
*
* @since 3.14.0 Use the 'give_donate_form_get_sales" filter to ensure the correct donation count will be used
* @since 3.16.0 Remove "give_donate_form_get_sales" filter logic
* @since 3.14.0 Use the "give_donate_form_get_sales" filter to ensure the correct donation count will be used
* @since 1.0
*
* @param array $vars Array of all the sort variables.
Expand All @@ -181,10 +184,6 @@ function give_sort_forms( $vars ) {
return $vars;
}

add_filter('give_donate_form_get_sales', function ($sales, $donationFormId) {
return (new Give\MultiFormGoals\ProgressBar\Model(['ids' => [$donationFormId]]))->getDonationCount();
}, 10, 2);

switch ( $vars['orderby'] ) {
// Check if 'orderby' is set to "sales".
case 'sales':
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/settings/class-settings-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function get_settings() {
],
],
[
'name' => 'GiveWP Cache',
'name' => __( 'GiveWP Cache', 'give' ),
'id' => 'give-clear-cache',
'buttonTitle' => __( 'Clear Cache', 'give' ),
'desc' => __( 'Click this button if you want to clear GiveWP\'s cache. The plugin stores common settings and queries in cache to optimize performance. Clearing cache will remove and begin rebuilding these saved queries.', 'give' ),
Expand Down
2 changes: 1 addition & 1 deletion includes/class-give-license-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class Give_License
* @param string $_account_url
* @param int $_item_id
*
* @unreleased removed unused auto_updater_obj property assignment
* @since 1.0
*/
public function __construct(
Expand Down Expand Up @@ -230,7 +231,6 @@ public function __construct(
self::$api_url = is_null( $_api_url ) ? self::$api_url : $_api_url;
self::$checkout_url = is_null( $_checkout_url ) ? self::$checkout_url : $_checkout_url;
self::$account_url = is_null( $_account_url ) ? self::$account_url : $_account_url;
$this->auto_updater_obj = null;

// Add plugin to registered licenses list.
array_push( self::$licensed_addons, plugin_basename( $this->file ) );
Expand Down
9 changes: 7 additions & 2 deletions includes/donors/class-give-donors-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,19 @@ private function get_order_query() {

// Create query.
foreach ( $ordersby as $orderby => $order ) {
/**
* @since 3.16.2 Prevent SQL Injection by not using the user defined order value directly in the query.
*/
$sanitizedOrder = $order === 'ASC' ? 'ASC' : 'DESC';

switch ( $table_columns[ $orderby ] ) {
case '%d':
case '%f':
$query[] = "{$this->table_name}.{$orderby}+0 {$order}";
$query[] = "{$this->table_name}.{$orderby}+0 {$sanitizedOrder}";
break;

default:
$query[] = "{$this->table_name}.{$orderby} {$order}";
$query[] = "{$this->table_name}.{$orderby} {$sanitizedOrder}";
}
}

Expand Down
Loading

0 comments on commit b80de51

Please sign in to comment.