Skip to content

Commit

Permalink
Merge branch 'release/1.7' into issue/619
Browse files Browse the repository at this point in the history
* release/1.7: (29 commits)
  Merge 1.6.1 into 1.7
  Update filter give_payment_gateways --> give_donation_gateways
  Move payment-->donation in actions and filters
  Update general translation POT file
  update languages redame
  Delete PO/MO language files (Give)
  Delete PO/MO language files (CMB2)
  minor composer file update
  Readme: use https links
  Revert "Resolves #962"
  Resolves #962
  Revert "Regarding #962 -- updates to Payment Gateways Tab"
  Revert "Regarding #962 -- updates to Display Options Tab"
  Revert "Regarding #962 -- updates to Email Options Tab"
  Revert "Regarding #962 -- updates to Advanced Options Tab"
  Revert "Use `show_option_none` instead of no value for CMB2 compatibility"
  Revert "Final cleanup of settings."
  Final cleanup of settings.
  Use `show_option_none` instead of no value for CMB2 compatibility
  Regarding #962 -- updates to Advanced Options Tab
  ...
  • Loading branch information
Devin Walker committed Aug 30, 2016
2 parents c4ca573 + 2c6dfcc commit 1a101c7
Show file tree
Hide file tree
Showing 270 changed files with 2,295 additions and 81,505 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ We earn money by selling add-ons, not from the money you raise. What you raise i

### Easy to Customize and Enhance ###

Give is built by [WordImpress](http://wordimpress.com "Visit the the developers of Give - WordImpress"), our plugins are built from the ground up to be intuitive and easy to use. Along with the plugin is a support team that is dedicated, fast to respond, and always willing to squash bugs and help troubleshoot.
Give is built by [WordImpress](https://wordimpress.com "Visit the the developers of Give - WordImpress"), our plugins are built from the ground up to be intuitive and easy to use. Along with the plugin is a support team that is dedicated, fast to respond, and always willing to squash bugs and help troubleshoot.

### Connect with Give ###

Stay in touch with us for important plugin news and updates:

* **[Newsletter](http://eepurl.com/bggG99 "Subscribe via MailChimp")**
* **[Facebook](http://facebook.com/wpgive "Visit the Give on Facebook")**
* **[Facebook](https://facebook.com/wpgive "Visit the Give on Facebook")**
* **[GitHub](https://github.com/WordImpress/Give "Visit the the developers of Give - WordImpress")**
* **[WordImpress](http://wordimpress.com "Visit the the developers of Give - WordImpress")**
* **[WordImpress](https://wordimpress.com "Visit the the developers of Give - WordImpress")**

### Contribute to Give ###

This is a WordPress plugin and therefore is GPL / open source. We are always looking for more contributors. Whether you know another language, can code like no one's business, or just have an idea, we would love your help and input. To contribute to Give, please review our [contributing guidelines](CONTRIBUTING.md). Feel free to view/fork/watch this GitHub repository to learn more about what issues we're tackling and how the project is progressing.

## Installation ##

The easiest way to install the plugin is through the [WordPress.org plugin repository](http://wordpress.org/plugins/give "Give on the WordPress.org plugin repository").
The easiest way to install the plugin is through the [WordPress.org plugin repository](https://wordpress.org/plugins/give "Give on the WordPress.org plugin repository").

### Minimum Requirements ###

Expand All @@ -59,7 +59,7 @@ In the search field type "Give" and click Search Plugins. Once you have found th

### Manual installation ###

The manual installation method involves downloading the plugin and uploading it to your server via your favorite FTP application. The WordPress Codex contains [instructions on how to do this here](http://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation).
The manual installation method involves downloading the plugin and uploading it to your server via your favorite FTP application. The WordPress Codex contains [instructions on how to do this here](https://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation).

### Updating ###

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "wordimpress/give",
"type": "wordpress-plugin",
"license": "GPL",
"description": "Give - The best way to accept donations on WordPress",
"homepage": "http://givewp.com",
"description": "Give - Democratizing Generosity",
"homepage": "https://givewp.com",
"authors": [
{
"name": "Devin Walker",
Expand Down
24 changes: 12 additions & 12 deletions includes/admin/payments/class-payments-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ public function search_box( $text, $input_id ) {
*
* Allows you to add new elements before the search box.
*
* @since 1.0
* @since 1.7
*/
do_action( 'give_payment_history_search' );
do_action( 'give_donation_history_search' );
?>
<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
Expand Down Expand Up @@ -251,7 +251,7 @@ public function get_views() {
) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count )
);

return apply_filters( 'give_payments_table_views', $views );
return apply_filters( 'give_donations_table_views', $views );
}

/**
Expand All @@ -272,7 +272,7 @@ public function get_columns() {
'details' => esc_html__( 'Details', 'give' ),
);

return apply_filters( 'give_payments_table_columns', $columns );
return apply_filters( 'give_donations_table_columns', $columns );
}

/**
Expand All @@ -291,7 +291,7 @@ public function get_sortable_columns() {
'date' => array( 'date', false )
);

return apply_filters( 'give_payments_table_sortable_columns', $columns );
return apply_filters( 'give_donations_table_sortable_columns', $columns );
}

/**
Expand Down Expand Up @@ -375,7 +375,7 @@ public function column_default( $payment, $column_name ) {

}

return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
return apply_filters( 'give_donations_table_column', $value, $payment->ID, $column_name );
}

/**
Expand All @@ -398,7 +398,7 @@ public function get_donor_email( $payment ) {

$value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>';

return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
return apply_filters( 'give_donations_table_column', $value, $payment->ID, 'email' );
}

/**
Expand Down Expand Up @@ -455,7 +455,7 @@ function get_row_actions( $payment ) {
esc_html__( 'Delete', 'give' )
);

return apply_filters( 'give_payment_row_actions', $actions, $payment );
return apply_filters( 'give_donation_row_actions', $actions, $payment );
}


Expand Down Expand Up @@ -532,7 +532,7 @@ public function get_donor( $payment ) {
$value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
}

return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
return apply_filters( 'give_donations_table_column', $value, $payment->ID, 'donor' );
}

/**
Expand All @@ -555,7 +555,7 @@ public function get_bulk_actions() {
'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' )
);

return apply_filters( 'give_payments_table_bulk_actions', $actions );
return apply_filters( 'give_donations_table_bulk_actions', $actions );
}

/**
Expand Down Expand Up @@ -625,12 +625,12 @@ public function process_bulk_action() {
/**
* Fires after triggering bulk action on payments table.
*
* @since 1.0
* @since 1.7
*
* @param int $id The ID of the payment.
* @param string $current_action The action that is being triggered.
*/
do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
do_action( 'give_donations_table_do_bulk_action', $id, $this->current_action() );
}

}
Expand Down
8 changes: 4 additions & 4 deletions includes/admin/payments/payments-history.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ function give_payment_history_page() {
/**
* Fires in payment history screen, at the top of the page.
*
* @since 1.0
* @since 1.7
*/
do_action( 'give_payments_page_top' );
do_action( 'give_donations_page_top' );
?>

<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
Expand All @@ -57,9 +57,9 @@ function give_payment_history_page() {
/**
* Fires in payment history screen, at the bottom of the page.
*
* @since 1.0
* @since 1.7
*/
do_action( 'give_payments_page_bottom' );
do_action( 'give_donations_page_bottom' );
?>

</div>
Expand Down
12 changes: 6 additions & 6 deletions includes/admin/payments/view-order-details.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,21 +557,21 @@
*
* The hook is left here for backwards compatibility.
*
* @since 1.0
* @since 1.7
*
* @param array $payment_meta Payment meta.
* @param array $user_info User information.
*/
do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
do_action( 'give_donation_personal_details_list', $payment_meta, $user_info );

/**
* Fires in order details page, in the donor-details metabox.
*
* @since 1.0
* @since 1.7
*
* @param int $payment_id Payment id.
*/
do_action( 'give_payment_view_details', $payment_id );
do_action( 'give_donation_view_details', $payment_id );
?>

</div>
Expand Down Expand Up @@ -667,11 +667,11 @@
*
* Allows you to insert new billing address fields.
*
* @since 1.0
* @since 1.7
*
* @param int $payment_id Payment id.
*/
do_action( 'give_payment_billing_details', $payment_id );
do_action( 'give_donation_billing_details', $payment_id );
?>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function get_data() {

if ( $customers ) {

$allowed_payment_status = apply_filters( 'give_recount_customer_payment_statuses', give_get_payment_status_keys() );
$allowed_payment_status = apply_filters( 'give_recount_customer_donation_statuses', give_get_payment_status_keys() );

foreach ( $customers as $customer ) {

Expand Down Expand Up @@ -105,7 +105,7 @@ public function get_data() {
foreach ( $payments as $payment ) {

$should_process_payment = 'publish' == $payment->post_status ? true : false;
$should_process_payment = apply_filters( 'give_customer_recount_should_process_payment', $should_process_payment, $payment );
$should_process_payment = apply_filters( 'give_customer_recount_should_process_donation', $should_process_payment, $payment );

if ( true === $should_process_payment ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function get_data() {
}

$should_process_payment = 'publish' == $payment->post_status ? true : false;
$should_process_payment = apply_filters( 'give_customer_recount_should_process_payment', $should_process_payment, $payment );
$should_process_payment = apply_filters( 'give_customer_recount_should_process_donation', $should_process_payment, $payment );

if ( true === $should_process_payment ) {

Expand Down Expand Up @@ -231,7 +231,7 @@ public function export() {
*/
public function pre_fetch() {
if ( $this->step === 1 ) {
$allowed_payment_status = apply_filters( 'give_recount_customer_payment_statuses', give_get_payment_status_keys() );
$allowed_payment_status = apply_filters( 'give_recount_customer_donation_statuses', give_get_payment_status_keys() );

// Before we start, let's zero out the customer's data
$customer = new Give_Customer( $this->customer_id );
Expand Down
23 changes: 23 additions & 0 deletions includes/deprecated/deprecated-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@
'give_donation_history_row_start' => 'give_purchase_history_row_start',
'give_donation_history_row_end' => 'give_purchase_history_row_end',
'give_donation_form_top' => 'give_purchase_form_top',
'give_donation_history_search' => 'give_payment_history_search',
'give_donations_table_do_bulk_action' => 'give_payments_table_do_bulk_action',
'give_donations_page_top' => 'give_payments_page_top',
'give_donations_page_bottom' => 'give_payments_page_bottom',
'give_donation_personal_details_list' => 'give_payment_personal_details_list',
'give_donation_view_details' => 'give_payment_view_details',
'give_donation_billing_details' => 'give_payment_billing_details',
'give_donation_save' => 'give_payment_save',
'give_donation_delete' => 'give_payment_delete',
'give_donation_deleted' => 'give_payment_deleted',
'give_donation_receipt_before_table' => 'give_payment_receipt_before_table',
'give_donation_receipt_header_before' => 'give_payment_receipt_header_before',
'give_donation_receipt_header_after' => 'give_payment_receipt_header_after',
'give_donation_receipt_before' => 'give_payment_receipt_before',
'give_donation_receipt_after' => 'give_payment_receipt_after',
'give_donation_receipt_after_table' => 'give_payment_receipt_after_table',
'give_donation_mode_select' => 'give_payment_mode_select',
'give_donation_mode_top' => 'give_payment_mode_top',
'give_donation_mode_before_gateways_wrap' => 'give_payment_mode_before_gateways_wrap',
'give_donation_mode_before_gateways' => 'give_payment_mode_before_gateways',
'give_donation_mode_after_gateways' => 'give_payment_mode_after_gateways',
'give_donation_mode_after_gateways_wrap' => 'give_payment_mode_after_gateways_wrap',
'give_donation_mode_bottom' => 'give_payment_mode_bottom',
);

foreach ( $give_map_deprecated_actions as $new => $old ) {
Expand Down
57 changes: 51 additions & 6 deletions includes/deprecated/deprecated-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,59 @@
global $give_map_deprecated_filters;

$give_map_deprecated_filters = array(
// New filter hook Old filter hook.
'give_donation_data_before_gateway' => 'give_purchase_data_before_gateway',
'give_donation_form_required_fields' => 'give_purchase_form_required_fields',
'give_donation_stats_by_user' => 'give_purchase_stats_by_user',
'give_donation_from_name' => 'give_purchase_from_name',
'give_donation_from_address' => 'give_purchase_from_address',
// New filter hook Old filter hook.
'give_donation_data_before_gateway' => 'give_purchase_data_before_gateway',
'give_donation_form_required_fields' => 'give_purchase_form_required_fields',
'give_donation_stats_by_user' => 'give_purchase_stats_by_user',
'give_donation_from_name' => 'give_purchase_from_name',
'give_donation_from_address' => 'give_purchase_from_address',
'give_donation_labels' => 'give_payment_labels',
'give_donations_table_views' => 'give_payments_table_views',
'give_payments_table_columns' => 'give_payments_table_columns',
'give_donations_table_sortable_columns' => 'give_payments_table_sortable_columns',
'give_payments_table_column' => 'give_payments_table_column',
'give_donations_table_column' => 'give_payments_table_column',
'give_donation_row_actions' => 'give_payment_row_actions',
'give_donations_table_bulk_actions' => 'give_payments_table_bulk_actions',
'give_donation_gateways' => 'give_payment_gateways',
'give_donation_gateways_order' => 'give_payment_gateways_order',
'give_donation_meta' => 'give_payment_meta',
'give_donation_add_donation_args' => 'give_payment_add_donation_args',
'give_donation_fee_keys' => 'give_payment_fee_keys',
'give_donation_currency_default' => 'give_payment_currency_default',
'give_donation_completed_date' => 'give_payment_completed_date',
'give_donation_currency_code' => 'give_payment_currency_code',
'give_donation_gateway' => 'give_payment_gateway',
'give_donation_user_ip' => 'give_payment_user_ip',
'give_donation_customer_id' => 'give_payment_customer_id',
'give_donation_user_id' => 'give_payment_user_id',
'give_donation_user_email' => 'give_payment_user_email',
'give_donation_meta_user_info' => 'give_payment_meta_user_info',
'give_donation_address' => 'give_payment_address',
'give_donation_key' => 'give_payment_key',
'give_donation_form_id' => 'give_payment_form_id',
'give_donation_number' => 'give_payment_number',
'give_donation' => 'give_payment',
'give_donation_statuses' => 'give_payment_statuses',
'give_donation_currency' => 'give_payment_currency',
'give_donation_amount' => 'give_payment_amount',
'give_get_users_donations_args' => 'give_get_users_purchases_args',
'give_recount_customer_donation_statuses' => 'give_recount_customer_payment_statuses',
'give_customer_recount_should_process_donation' => 'give_customer_recount_should_process_payment',
'give_is_guest_donation' => 'give_is_guest_payment',




);


// Dynamic filters.
switch ( true ) {
case ( ! empty( $_GET['payment-confirmation'] ) ) :
$give_map_deprecated_filters[ "give_donation_confirm_{$_GET['payment-confirmation']}" ] = "give_payment_confirm_{$_GET['payment-confirmation']}";
}

foreach ( $give_map_deprecated_filters as $new => $old ){
add_filter( $new, 'give_deprecated_filter_mapping', 10, 4 );
}
Expand Down
36 changes: 8 additions & 28 deletions includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) {
return $number;
}

// Remove slash from amount.
// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
// To prevent notices and warning remove slash from amount/number.
$number = wp_unslash( $number );

$thousand_separator = give_get_price_thousand_separator();

$locale = localeconv();
Expand Down Expand Up @@ -131,39 +136,14 @@ function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) {
* @return string $amount Newly formatted amount or Price Not Available
*/
function give_format_amount( $amount, $decimals = true ) {

$thousands_sep = give_get_option( 'thousands_separator', ',' );
$decimal_sep = give_get_option( 'decimal_separator', '.' );

// Format the amount
if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) {
$whole = substr( $amount, 0, $sep_found );
$part = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) );
$amount = $whole . '.' . $part;
}

// Strip , from the amount (if set as the thousands separator)
if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
$amount = str_replace( ',', '', $amount );
}

// Strip . from the amount (if set as the thousands separator) AND , set to decimal separator
if ( $thousands_sep == '.' && $decimal_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
$amount = explode( '.', $amount );
$array_count = count( $amount );
if ( $decimals == true ) {
unset( $amount[ $array_count - 1 ] );
}
$amount = implode( '', $amount );
}

// Strip ' ' from the amount (if set as the thousands separator)
if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
$amount = str_replace( ' ', '', $amount );
}

if ( empty( $amount ) ) {
$amount = 0;
} else {
// Sanitize amount before formatting.
$amount = give_sanitize_amount( $amount );
}

$decimals = give_get_price_decimals();
Expand Down
Loading

0 comments on commit 1a101c7

Please sign in to comment.