Skip to content

Commit

Permalink
Merge branch 'release/1.7' into release/1.8
Browse files Browse the repository at this point in the history
* release/1.7:
  Change log entry for #1244
  Gave a unique ID to the checkbox #1244
  Do not short array tag because we support PHP 5.3 >=
  show global and default tern and agreement text conditionally
  Renamed function give_purchase_form_required_fields to give_get_required_fields #896
  Sentence closures
  Fixed incorrect array ordering #896
  Fixed incorrect ordering #896
  Check for price-functions.php in unit test
  PHP docs
  Renamed process-purchase.php to process-donation.php #896
  Sentence closures
  Deprecate give_reset_store_items in favor of give_reset_items #896
  Deprecated usage of give_get_users_purchases_args in favor of give_get_users_donations_args #896
  • Loading branch information
Devin Walker committed Nov 16, 2016
2 parents 9fa1f9d + 1676bdd commit 2dd87d9
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 55 deletions.
2 changes: 1 addition & 1 deletion give.php
Expand Up @@ -337,7 +337,7 @@ private function includes() {
require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
Expand Down
Expand Up @@ -239,9 +239,9 @@ public function pre_fetch() {
);
}

// Allow filtering of items to remove with an unassociative array for each item
// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
$items = apply_filters( 'give_reset_store_items', $items );
// Allow filtering of items to remove with an unassociative array for each item.
// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method.
$items = apply_filters( 'give_reset_items', $items );

$this->store_data( 'give_temp_reset_ids', $items );
}
Expand Down
28 changes: 14 additions & 14 deletions includes/admin/reporting/tools/class-give-tools-reset-stats.php
Expand Up @@ -47,9 +47,9 @@ class Give_Tools_Reset_Stats extends Give_Batch_Export {
* Get the Export Data
*
* @access public
* @since 1.5
* @since 1.5
* @global object $wpdb Used to query the database using the WordPress
* Database API
* Database API
* @return array $data The data for the CSV file
*/
public function get_data() {
Expand All @@ -67,9 +67,9 @@ public function get_data() {
if ( $step_items ) {

$step_ids = array(
'customers' => array(),
'forms' => array(),
'other' => array(),
'customers' => array(),
'forms' => array(),
'other' => array(),
);

foreach ( $step_items as $item ) {
Expand Down Expand Up @@ -122,7 +122,7 @@ public function get_data() {
$sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids );
}


}

if ( ! empty( $sql ) ) {
Expand All @@ -140,7 +140,7 @@ public function get_data() {
}

/**
* Return the calculated completion percentage
* Return the calculated completion percentage.
*
* @since 1.5
* @return int
Expand Down Expand Up @@ -225,7 +225,7 @@ public function headers() {
* Perform the export
*
* @access public
* @since 1.5
* @since 1.5
* @return void
*/
public function export() {
Expand Down Expand Up @@ -278,21 +278,21 @@ public function pre_fetch() {

// Allow filtering of items to remove with an unassociative array for each item
// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
$items = apply_filters( 'give_reset_store_items', $items );
$items = apply_filters( 'give_reset_items', $items );

$this->store_data( 'give_temp_reset_ids', $items );
}

}

/**
* Given a key, get the information from the Database Directly
* Given a key, get the information from the Database Directly.
*
* @since 1.5
*
* @param string $key The option_name
*
* @return mixed Returns the data from the database
* @return mixed Returns the data from the database.
*/
private function get_stored_data( $key ) {
global $wpdb;
Expand All @@ -302,12 +302,12 @@ private function get_stored_data( $key ) {
}

/**
* Give a key, store the value
* Give a key, store the value.
*
* @since 1.5
*
* @param string $key The option_name
* @param mixed $value The value to store
* @param string $key The option_name.
* @param mixed $value The value to store.
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion includes/class-give-cli-commands.php
Expand Up @@ -913,7 +913,7 @@ private function get_donors_by_form_id( $form_id ) {
}

if ( ! empty( $donors ) ) {
$donors['donors'][] = current( $this->api->get_customers( (int) $donation->customer_id ) )[0];
$donors['donors'][] = current( current( $this->api->get_customers( (int) $donation->customer_id ) ) );
} else {
$donors = array_merge( $donors, $this->api->get_customers( (int) $donation->customer_id ) );
}
Expand Down
16 changes: 8 additions & 8 deletions includes/class-give-email-access.php
Expand Up @@ -71,7 +71,7 @@ class Give_Email_Access {
* @since 1.0
* @access private
*
* @var
* @var
*/
private $verify_throttle;

Expand All @@ -83,7 +83,7 @@ class Give_Email_Access {
*
* @var string
*/
private $token_expiration;
private $token_expiration;

/**
* Class Constructor
Expand Down Expand Up @@ -134,12 +134,12 @@ public function init() {
if ( $this->token_exists ) {
add_filter( 'give_can_view_receipt', '__return_true' );
add_filter( 'give_user_pending_verification', '__return_false' );
add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) );
add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) );
}
}

/**
* Prevent email spamming
* Prevent email spamming.
*
* @since 1.0
* @access public
Expand Down Expand Up @@ -203,7 +203,7 @@ public function send_email( $customer_id, $email ) {
//Nice subject and message
$subject = apply_filters( 'give_email_access_token_subject', sprintf( esc_html__( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) );

$message = esc_html__( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n";
$message = esc_html__( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n";
$message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . esc_html__( 'Access My Donation Details &raquo;', 'give' ) . '</a>' . "\n\n";
$message .= "\n\n";
$message .= esc_html__( 'Sincerely,', 'give' ) . "\n";
Expand Down Expand Up @@ -331,7 +331,7 @@ public function set_verify_key( $customer_id, $email, $verify_key ) {
* @return bool
*/
public function is_valid_verify_key( $token ) {
/* @var WPDB $wpdb */
/* @var WPDB $wpdb */
global $wpdb;

// See if the verify_key exists
Expand Down Expand Up @@ -364,11 +364,11 @@ public function is_valid_verify_key( $token ) {
* @since 1.0
* @access public
*
* @param $args User Purchases arguments.
* @param $args User Donations arguments.
*
* @return mixed
*/
public function users_purchases_args( $args ) {
public function users_donations_args( $args ) {
$args['user'] = $this->token_email;

return $args;
Expand Down
4 changes: 2 additions & 2 deletions includes/deprecated/deprecated-actions.php
Expand Up @@ -43,7 +43,7 @@ function give_deprecated_actions() {
'give_pre_process_donation' => 'give_pre_process_purchase',
'give_complete_donation' => 'give_complete_purchase',
'give_ajax_donation_errors' => 'give_ajax_checkout_errors',
'give_admin_sale_notice' => 'give_admin_donation_email',
'give_admin_donation_email' => 'give_admin_sale_notice',
);

return $give_deprecated_actions;
Expand All @@ -52,7 +52,7 @@ function give_deprecated_actions() {
/**
* Deprecated action mapping.
*
* @param mixed $data
* @param mixed $data
* @param string $arg_1
* @param string $arg_2
* @param string $arg_3
Expand Down
5 changes: 3 additions & 2 deletions includes/deprecated/deprecated-filters.php
Expand Up @@ -25,6 +25,7 @@ function give_deprecated_filters() {
'give_get_users_donations_args' => 'give_get_users_purchases_args',
'give_recount_donors_donation_statuses' => 'give_recount_customer_payment_statuses',
'give_donor_recount_should_process_donation' => 'give_customer_recount_should_process_payment',
'give_reset_items' => 'give_reset_store_items',
);

// Dynamic filters.
Expand All @@ -48,7 +49,7 @@ function give_deprecated_filters() {
*/
function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) {
$give_map_deprecated_filters = give_deprecated_filters();
$filter = current_filter();
$filter = current_filter();

if ( isset( $give_map_deprecated_filters[ $filter ] ) ) {
if ( has_filter( $give_map_deprecated_filters[ $filter ] ) ) {
Expand All @@ -57,7 +58,7 @@ function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3
if ( ! defined( 'DOING_AJAX' ) ) {
_give_deprecated_function(
sprintf(
/* translators: %s: filter name */
/* translators: %s: filter name */
__( 'The %s filter' ),
$give_map_deprecated_filters[ $filter ]
),
Expand Down
8 changes: 4 additions & 4 deletions includes/emails/functions.php
Expand Up @@ -15,14 +15,14 @@
}

/**
* Email Donation Receipt
* Email Donation Receipt.
*
* Email the donation confirmation to the donor via the customizable "Donation Receipt" settings
* Email the donation confirmation to the donor via the customizable "Donation Receipt" settings.
*
* @since 1.0
*
* @param int $payment_id Payment ID
* @param bool $admin_notice Whether to send the admin email notification or not (default: true)
* @param int $payment_id Payment ID.
* @param bool $admin_notice Whether to send the admin email notification or not (default: true).
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion includes/forms/functions.php
Expand Up @@ -324,7 +324,7 @@ function give_get_history_page_uri() {
*/
function give_field_is_required( $field = '', $form_id ) {

$required_fields = give_purchase_form_required_fields( $form_id );
$required_fields = give_get_required_fields( $form_id );

return array_key_exists( $field, $required_fields );
}
Expand Down
8 changes: 4 additions & 4 deletions includes/forms/template.php
Expand Up @@ -1464,8 +1464,8 @@ function give_terms_agreement( $form_id ) {
return false;
}

$label = get_post_meta( $form_id, '_give_agree_label', true );
$terms = get_post_meta( $form_id, '_give_agree_text', true );
$label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
$terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );

// Set term and conditions label and text on basis of per form and global setting.
// $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
Expand Down Expand Up @@ -1508,8 +1508,8 @@ function give_terms_agreement( $form_id ) {
aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
</div>

<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1" required aria-required="true" />
<label for="give_agree_to_terms"><?php echo $label; ?></label>
<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms-<?php echo $form_id; ?>" value="1" required aria-required="true" />
<label for="give_agree_to_terms-<?php echo $form_id; ?>"><?php echo $label; ?></label>

</fieldset>
<?php
Expand Down
11 changes: 6 additions & 5 deletions includes/price-functions.php
Expand Up @@ -106,21 +106,22 @@ function give_get_default_form_amount( $form_id ) {

}

return apply_filters('give_default_form_amount', $default_amount);
return apply_filters( 'give_default_form_amount', $default_amount );

}


/**
* Determine if custom price mode is enabled or disabled
* Determine if custom price mode is enabled or disabled.
*
* This function is wrapper function to Give_Donate_Form::is_custom_price_mode()
*
* @since 1.6
*
*
* @param int $form_id Form ID.
*
* @use Give_Donate_Form::is_custom_price_mode()
*
* @use Give_Donate_Form::is_custom_price_mode()
*
* @return bool
*/
function give_is_custom_price_mode( $form_id = 0 ) {
Expand Down
16 changes: 8 additions & 8 deletions includes/process-purchase.php → includes/process-donation.php
Expand Up @@ -401,7 +401,7 @@ function give_purchase_form_validate_agree_to_terms() {
}

/**
* Donation Form Required Fields
* Donation Form Required Fields.
*
* @access private
* @since 1.0
Expand All @@ -410,7 +410,7 @@ function give_purchase_form_validate_agree_to_terms() {
*
* @return array
*/
function give_purchase_form_required_fields( $form_id ) {
function give_get_required_fields( $form_id ) {

$payment_mode = give_get_chosen_gateway( $form_id );

Expand Down Expand Up @@ -507,8 +507,8 @@ function give_purchase_form_validate_logged_in_user() {
$user_data = get_userdata( $user_ID );

// Loop through required fields and show error messages.
foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
give_set_error( $value['error_id'], $value['error_message'] );
}
}
Expand Down Expand Up @@ -565,8 +565,8 @@ function give_purchase_form_validate_new_user() {
$pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false;

// Loop through required fields and show error messages.
foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
give_set_error( $value['error_id'], $value['error_message'] );
}
}
Expand Down Expand Up @@ -751,8 +751,8 @@ function give_purchase_form_validate_guest_user() {
}

// Loop through required fields and show error messages.
foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
give_set_error( $value['error_id'], $value['error_message'] );
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/user-functions.php
Expand Up @@ -52,7 +52,7 @@ function give_get_users_purchases( $user = 0, $number = 20, $pagination = false,
}
}

$args = apply_filters( 'give_get_users_purchases_args', array(
$args = apply_filters( 'give_get_users_donations_args', array(
'user' => $user,
'number' => $number,
'status' => $status,
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Expand Up @@ -182,6 +182,7 @@ We also really like WooCommerce. It's hands-down the most robust eCommerce platf
* Fix: User able to donate minimum amount then custom minimum amount with multi level donation form - https://github.com/WordImpress/Give/issues/712
* Fix: Clearing reports cache wasn't working for "Estimated monthly income for this period" - https://github.com/WordImpress/Give/issues/773
* Fix: Use only one text-domain "give" for i18n - https://github.com/WordImpress/Give/issues/964
* Fix: Multiple donation forms on a page with the Terms and Condition checkbox causes jumping when the checkbox is clicked by a secondary form - https://github.com/WordImpress/Give/issues/1244

= 1.6.4 =
* New: {form_title} email tag that outputs only the donation form title and improved the email tag display in the plugin's settings. [#943](https://github.com/WordImpress/Give/issues/943)
Expand Down
3 changes: 2 additions & 1 deletion tests/unit-tests/tests-give.php
Expand Up @@ -69,7 +69,8 @@ public function test_includes() {
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/shortcodes.php' );
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/formatting.php' );
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/error-tracking.php' );
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/process-purchase.php' );
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/price-functions.php' );
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/process-donation.php' );
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/login-register.php' );
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/user-functions.php' );
$this->assertFileExists( GIVE_PLUGIN_DIR . 'includes/payments/functions.php' );
Expand Down

0 comments on commit 2dd87d9

Please sign in to comment.