Skip to content

Commit

Permalink
Merge pull request #2225 from WordImpress/release/1.8.15
Browse files Browse the repository at this point in the history
Release 1.8.15 with licensing fix and current completed issues
  • Loading branch information
Devin Walker committed Oct 19, 2017
2 parents 7b7787f + 67c809a commit 3995a32
Show file tree
Hide file tree
Showing 30 changed files with 1,269 additions and 584 deletions.
2 changes: 2 additions & 0 deletions assets/js/admin/admin-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,8 @@ var give_setting_edit = false;
});
self.process_step(parseInt(response.step), data, self);
}
// Reset the form for preventing multiple ajax request.
$('#give-tools-recount-form')[0].reset();
}
}).fail(function (response) {
/**
Expand Down
4 changes: 2 additions & 2 deletions assets/js/admin/admin-scripts.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions give.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
* Author: WordImpress
* Author URI: https://wordimpress.com
* Version: 1.8.14
* Version: 1.8.15
* Text Domain: give
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/WordImpress/Give
Expand Down Expand Up @@ -180,7 +180,7 @@ final class Give {
/**
* Give notices Object
*
* @since 2.0
* @since 1.8.9
* @access public
*
* @var Give_Notices $notices
Expand Down Expand Up @@ -324,7 +324,7 @@ private function setup_constants() {

// Plugin version
if ( ! defined( 'GIVE_VERSION' ) ) {
define( 'GIVE_VERSION', '1.8.14' );
define( 'GIVE_VERSION', '1.8.15' );
}

// Plugin Folder Path
Expand Down
99 changes: 64 additions & 35 deletions includes/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function give_get_actions() {
$_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null;

// Add backward compatibility to give-action param ( $_GET )
if( empty( $_get_action ) ) {
if ( empty( $_get_action ) ) {
$_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null;
}

Expand Down Expand Up @@ -62,7 +62,7 @@ function give_post_actions() {


// Add backward compatibility to give-action param ( $_POST ).
if( empty( $_post_action ) ) {
if ( empty( $_post_action ) ) {
$_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null;
}

Expand All @@ -85,31 +85,34 @@ function give_post_actions() {
* Connect WordPress user with Donor.
*
* @since 1.7
*
* @param int $user_id User ID
* @param array $user_data User Data
*
* @return void
*/
function give_connect_donor_to_wpuser( $user_id, $user_data ){
function give_connect_donor_to_wpuser( $user_id, $user_data ) {
/* @var Give_Donor $donor */
$donor = new Give_Donor( $user_data['user_email'] );

// Validate donor id and check if do nor is already connect to wp user or not.
if( $donor->id && ! $donor->user_id ) {
if ( $donor->id && ! $donor->user_id ) {

// Update donor user_id.
if( $donor->update( array( 'user_id' => $user_id ) ) ) {
if ( $donor->update( array( 'user_id' => $user_id ) ) ) {
$donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id );
$donor->add_note( $donor_note );

// Update user_id meta in payments.
if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) {
foreach ( $donations as $donation ) {
if ( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) {
foreach ( $donations as $donation ) {
give_update_meta( $donation, '_give_payment_user_id', $user_id );
}
}
}
}
}

add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 );


Expand All @@ -118,41 +121,62 @@ function give_connect_donor_to_wpuser( $user_id, $user_data ){
*
* Note: if location of site changes then run cron to validate licenses
*
* @since 1.7
* @since 1.7
* @updated 1.8.15 - Resolved issue with endless looping because of URL mismatches.
* @return void
*/
function give_validate_license_when_site_migrated() {
// Store current site address if not already stored.
$homeurl = home_url();
if( ! get_option( 'give_site_address_before_migrate' ) ) {
$home_url_parts = parse_url( home_url() );
$home_url = isset( $home_url_parts['host'] ) ? $home_url_parts['host'] : false;
$home_url .= isset( $home_url_parts['path'] ) ? $home_url_parts['path'] : '';
$site_address_before_migrate = get_option( 'give_site_address_before_migrate' );

// Need $home_url to proceed
if ( ! $home_url ) {
return;
}

// Save site address
if ( ! $site_address_before_migrate ) {
// Update site address.
update_option( 'give_site_address_before_migrate', $homeurl );
update_option( 'give_site_address_before_migrate', $home_url );

return;
}

if( $homeurl !== get_option( 'give_site_address_before_migrate' ) ) {
// Backwards compat. for before when we were storing URL scheme.
if ( strpos( $site_address_before_migrate, 'http' ) ) {
$site_address_before_migrate = parse_url( $site_address_before_migrate );
$site_address_before_migrate = isset( $site_address_before_migrate['host'] ) ? $site_address_before_migrate['host'] : false;
// Add path for multisite installs.
$site_address_before_migrate .= isset( $site_address_before_migrate['path'] ) ? $site_address_before_migrate['path'] : '';
}

// If the two URLs don't match run CRON.
if ( $home_url !== $site_address_before_migrate ) {
// Immediately run cron.
wp_schedule_single_event( time() , 'give_validate_license_when_site_migrated' );
wp_schedule_single_event( time(), 'give_validate_license_when_site_migrated' );

// Update site address.
update_option( 'give_site_address_before_migrate', home_url() );
update_option( 'give_site_address_before_migrate', $home_url );
}

}
add_action( 'init', 'give_validate_license_when_site_migrated' );

add_action( 'admin_init', 'give_validate_license_when_site_migrated' );


/**
* Processing after donor batch export complete
*
* @since 1.8
*
* @param $data
*/
function give_donor_batch_export_complete( $data ) {
// Remove donor ids cache.
if(
if (
isset( $data['class'] )
&& 'Give_Batch_Donors_Export' === $data['class']
&& ! empty( $data['forms'] )
Expand All @@ -161,7 +185,8 @@ function give_donor_batch_export_complete( $data ) {
Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) );
}
}
add_action('give_file_export_complete', 'give_donor_batch_export_complete' );

add_action( 'give_file_export_complete', 'give_donor_batch_export_complete' );

/**
* Print css for wordpress setting pages.
Expand All @@ -172,44 +197,48 @@ function give_admin_quick_css() {
/* @var WP_Screen $screen */
$screen = get_current_screen();

if( ! ( $screen instanceof WP_Screen ) ) {
if ( ! ( $screen instanceof WP_Screen ) ) {
return false;
}

switch ( true ) {
case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ):
?>
<style>
tr.active.update + tr.give-addon-notice-tr td{
box-shadow:none;
-webkit-box-shadow:none;
tr.active.update + tr.give-addon-notice-tr td {
box-shadow: none;
-webkit-box-shadow: none;
}

tr.active + tr.give-addon-notice-tr td {
position: relative;
top: -1px;
}

tr.active + tr.give-addon-notice-tr .notice {
margin: 5px 20px 15px 40px;
}
tr.active + tr.give-addon-notice-tr td{
position: relative;
top:-1px;
}
tr.active + tr.give-addon-notice-tr .notice{
margin: 5px 20px 15px 40px;
}

tr.give-addon-notice-tr .dashicons {
color: #f56e28;
}
tr.give-addon-notice-tr td{
color: #f56e28;
}

tr.give-addon-notice-tr td {
border-left: 4px solid #00a0d2;
}

tr.give-addon-notice-tr td{
padding: 0!important;
tr.give-addon-notice-tr td {
padding: 0 !important;
}

tr.active.update + tr.give-addon-notice-tr .notice{
tr.active.update + tr.give-addon-notice-tr .notice {
margin: 5px 20px 5px 40px;
}
</style>
<?php
}
}

add_action( 'admin_head', 'give_admin_quick_css' );


Expand Down Expand Up @@ -244,7 +273,7 @@ function give_set_donation_levels_max_min_amount( $form_id ) {

// Set Minimum and Maximum amount for Multi Level Donation Forms
give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 );
give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount? give_sanitize_amount_for_db( $max_amount ) : 0 );
give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db( $max_amount ) : 0 );
}

add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 );
2 changes: 1 addition & 1 deletion includes/admin/payments/class-payments-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public function column_default( $payment, $column_name ) {

case 'amount' :
$amount = ! empty( $payment->total ) ? $payment->total : 0;
$value = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) );
$value = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false, 'donation_id' => $payment->ID ) ), give_get_payment_currency_code( $payment->ID ) );
$value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function get_data() {
$totals = 0;
}

$total = round( $total, give_currency_decimal_filter() );
$total = round( $total, give_get_price_decimals() );

$this->store_data( 'give_temp_recount_earnings', $total );

Expand Down
Loading

0 comments on commit 3995a32

Please sign in to comment.