Skip to content

Commit

Permalink
Merge pull request #2854 from WordImpress/release/2.0.5
Browse files Browse the repository at this point in the history
Release/2.0.5
  • Loading branch information
Devin Walker authored Feb 28, 2018
2 parents 7abe749 + 5ffeaf9 commit f098b0c
Show file tree
Hide file tree
Showing 23 changed files with 387 additions and 188 deletions.
9 changes: 9 additions & 0 deletions assets/css/give-admin-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,15 @@ body.give_forms_page_give-reports table.export-options-table span#give-start-wra
float: right;
width: 33%; }

.settings-excludes-list {
max-height: 120px;
overflow: auto;
padding: 0.5rem;
border: 1px solid #ddd; }

.settings-excludes-list li {
margin: 3px 0; }

#give-tools-recount-form .notice-wrap {
position: relative;
min-height: 25px;
Expand Down
2 changes: 1 addition & 1 deletion assets/css/give-admin-rtl.min.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions assets/css/give-admin.css

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

2 changes: 1 addition & 1 deletion assets/css/give-admin.min.css

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions assets/js/frontend/give-donations.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ Give = {
* @returns {number}
*/
unFormatCurrency: function (price, decimal_separator) {
if( 'string' === typeof price ) {
var regex = ',' === decimal_separator.trim() ? /[^0-9\,-]+/g : /[^0-9\.-]+/g;

price = price.replace( regex, '' );

if( 0 === price.indexOf(decimal_separator) ) {
price = price.substr(1);
}else if( ( price.length -1 ) === price.indexOf(decimal_separator) ){
price = price.slice(0, -1);
}
}

return Math.abs(parseFloat(accounting.unformat(price, decimal_separator)));
},

Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/give-donations.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/frontend/give.all.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions assets/scss/admin/reports.scss
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ body.give_forms_page_give-reports table.export-options-table {

}

.settings-excludes-list {
max-height: 120px;
overflow: auto;
padding: 0.5rem;
border: 1px solid #ddd;
}

.settings-excludes-list li {
margin: 3px 0;
}
//---------------------------------------------------------
//Recount Stats Form
//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion assets/sourcemaps/give-admin.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/sourcemaps/give.css.map

Large diffs are not rendered by default.

11 changes: 6 additions & 5 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: 2.0.4
* Version: 2.0.5
* Text Domain: give
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/WordImpress/Give
Expand Down Expand Up @@ -275,7 +275,11 @@ public function __construct() {
*/
private function init_hooks() {
register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );

add_action( 'plugins_loaded', array( $this, 'init' ), 0 );

// Set up localization on init Hook.
add_action( 'init', array( $this, 'load_textdomain' ), 0 );
}

/**
Expand All @@ -292,9 +296,6 @@ public function init() {
*/
do_action( 'before_give_init' );

// Set up localization.
$this->load_textdomain();

$this->roles = new Give_Roles();
$this->api = new Give_API();
$this->give_settings = new Give_Admin_Settings();
Expand Down Expand Up @@ -365,7 +366,7 @@ private function setup_constants() {

// Plugin version
if ( ! defined( 'GIVE_VERSION' ) ) {
define( 'GIVE_VERSION', '2.0.4' );
define( 'GIVE_VERSION', '2.0.5' );
}

// Plugin Root File
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/dashboard-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function give_dashboard_sales_widget() {
<p class="give-dashboard-stat-total-label"><?php _e( 'Last Month', 'give' ); ?></p>
</td>
<td>
<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( give_get_total_earnings(), array( 'sanitize' => false ) ) ) ?></p>
<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year' ), array( 'sanitize' => false ) ) ) ?></p>

<p class="give-dashboard-stat-total-label"><?php _e( 'This Year', 'give' ); ?></p>
</td>
Expand Down
14 changes: 7 additions & 7 deletions includes/admin/shortcodes/abstract-shortcode-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,15 @@ protected function generate_post( $field ) {
);

$args = wp_parse_args( (array) $field['query_args'], $args );
$posts = new WP_Query( $args );
$posts = get_posts( $args );
$options = array();

if ( $posts->have_posts() ) {
while ( $posts->have_posts() ) {
$posts->the_post();
$post_title = get_the_title();
$post_id = get_the_ID();
$options[ absint( $post_id ) ] = ( empty( $post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $post_id ) : $post_title );
if ( ! empty( $posts ) ) {
/* @var WP_Post $post */
foreach ( $posts as $post ) {
$options[ absint( $post->ID ) ] = empty( $post->post_title ) ?
sprintf( __( 'Untitled (#%s)', 'give' ), $post->ID ) :
apply_filters( 'the_title', $post->post_title );
}

$field['type'] = 'listbox';
Expand Down
13 changes: 12 additions & 1 deletion includes/admin/tools/export/class-core-settings-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ public function headers() {
* @since 1.8.17
*/
public function json_core_settings_export() {
echo wp_json_encode( get_option( 'give_settings' ) );
$settings_excludes = give_clean( $_POST['settings_export_excludes'] );
$give_settings = get_option( 'give_settings' );

if ( is_array( $settings_excludes ) && ! empty( $settings_excludes ) ) {
foreach ( $settings_excludes as $key => $value ) {
if ( give_is_setting_enabled( $value ) ) {
unset( $give_settings[ $key ] );
}
}
}

echo wp_json_encode( $give_settings );
}

/**
Expand Down
21 changes: 21 additions & 0 deletions includes/admin/tools/views/html-admin-page-exports.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,27 @@ class="give-clearfix">
</td>
<td>
<form method="post">
<p class="settings-excludes-title"><?php echo __( 'Checked options from the list will not be exported', 'give' ); ?></p>
<ul class="settings-excludes-list">
<?php
$export_excludes = apply_filters( 'settings_export_excludes', array() );

if ( ! empty( $export_excludes ) ) {
foreach ( $export_excludes as $option_key => $option_label ) {
?>
<li>
<label for="settings_export_excludes[<?php echo $option_key?>]">
<input
type="checkbox" checked
name="settings_export_excludes[<?php echo $option_key?>]"
id="settings_export_excludes[<?php echo $option_key?>]"><?php echo esc_html( $option_label ); ?>
</label>
</li>
<?php
}
}
?>
</ul>
<input type="hidden" name="give-action" value="core_settings_export"/>
<input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" class="button-secondary"/>
</form>
Expand Down
54 changes: 28 additions & 26 deletions includes/admin/upgrades/class-give-updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,22 +521,11 @@ public function __health_background_update( $give_updates ) {
$log_data .= 'Updating batch' . "\n";
$log_data .= print_r( $batch, true );

$doing_upgrade_args['heading'] = sprintf( 'Update %s of %s', $doing_upgrade_args['update'], get_option( 'give_db_update_count' ) );
$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage();
update_option( 'give_doing_upgrade', $doing_upgrade_args );

if ( ! empty( $batch->key ) ) {
wp_cache_delete( $batch->key, 'options' );
update_option( $batch->key, $batch->data );
} else {

update_option( 'give_db_update_count', count( $batch->data ) );

$doing_upgrade_args['update'] = $give_updates->update;
$doing_upgrade_args['heading'] = sprintf( 'Update %s of %s', 1, count( $batch->data ) );

update_option( 'give_doing_upgrade', $doing_upgrade_args );

foreach ( $batch->data as $data ) {
Give_Updates::$background_updater->push_to_queue( $data );
}
Expand All @@ -549,27 +538,24 @@ public function __health_background_update( $give_updates ) {
/**
* Fix give_doing_upgrade option
*/
$update_option = false;
$fresh_new_db_count = $this->get_total_new_db_update_count( true );
if ( $fresh_new_db_count < $doing_upgrade_args['update'] ) {
update_option( 'give_db_update_count', $fresh_new_db_count );
$doing_upgrade_args['update'] = 1;
$doing_upgrade_args['heading'] = sprintf( 'Update %s of %s', 1, $fresh_new_db_count );
$update_option = true;
}

if ( 101 < $doing_upgrade_args['total_percentage'] ) {
$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage( true );
$update_option = true;
}
update_option( 'give_db_update_count', $fresh_new_db_count );

if ( $update_option ) {
update_option( 'give_doing_upgrade', $doing_upgrade_args );
$doing_upgrade_args['update'] = 1;
$doing_upgrade_args['heading'] = sprintf( 'Update %s of %s', 1, $fresh_new_db_count );
$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage( true );

$log_data .= 'Updated doing update:' . "\n";
$log_data .= print_r( $doing_upgrade_args, true ) . "\n";
// Remove already completed update from info.
if ( give_has_upgrade_completed( $doing_upgrade_args['update_info']['id'] ) ) {
$doing_upgrade_args['update_info'] = current( array_values( $batch->data ) );
$doing_upgrade_args['step'] = 1;
}

update_option( 'give_doing_upgrade', $doing_upgrade_args );

$log_data .= 'Updated doing update:' . "\n";
$log_data .= print_r( $doing_upgrade_args, true ) . "\n";
Give()->logs->add( 'Update Health Check', $log_data, 0, 'update' );
}

Expand Down Expand Up @@ -1141,6 +1127,22 @@ public function get_update_ids() {

return $all_update_ids;
}

/**
* Get offset count
*
* @since 2.0.5
* @access public
*
* @param int $process_item_count
*
* @return float|int
*/
public function get_offset( $process_item_count ) {
return ( 1 === $this->step ) ?
0 :
( $this->step - 1 ) * $process_item_count;
}
}

Give_Updates::get_instance()->setup();
Loading

0 comments on commit f098b0c

Please sign in to comment.