Skip to content

Commit

Permalink
Merge branch 'release/2.0' into issue/339
Browse files Browse the repository at this point in the history
* release/2.0:
  Check action instead of $_POST or ajax
  Add comment
  Fix #2637
  Fixed - Not processing donation issue
  Fix #2634
  Ran gulp

# Conflicts:
#	assets/js/admin/admin-scripts.min.js
#	assets/js/plugins/float-labels.js
#	assets/js/plugins/float-labels.min.js
#	assets/sourcemaps/give-admin.css.map
  • Loading branch information
DevinWalker committed Jan 10, 2018
2 parents a2f9bd1 + d9e462c commit 62a4fe7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions includes/admin/upgrades/class-give-updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ public function setup() {

if ( is_admin() ) {
add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );

if( give_test_ajax_works() ) {
add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
}
add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
}
}

Expand Down Expand Up @@ -238,6 +235,10 @@ function __change_donations_label() {
* @access public
*/
public function __register_menu() {
// Bailout.
if( ! give_test_ajax_works() ) {
return;
}

// Load plugin updates.
$this->__register_plugin_addon_updates();
Expand Down
3 changes: 2 additions & 1 deletion includes/ajax-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@

/**
* Check if AJAX works as expected
* Note: Do not use this function before init hook.
*
* @since 1.0
*
* @return bool True if AJAX works, false otherwise
*/
function give_test_ajax_works() {
// Handle ajax.
if( wp_doing_ajax() ) {
if( doing_action( 'wp_ajax_nopriv_give_test_ajax' ) ) {
wp_die( 0, 200 );
}

Expand Down
2 changes: 1 addition & 1 deletion includes/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ function give_load_admin_scripts( $hook ) {
'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ),
'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
/* translators : %s: Donation form options metabox */
'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ),
'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ),
'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ),
'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ),
'search_placeholder' => __( 'Type to search all forms', 'give' ),
Expand Down

0 comments on commit 62a4fe7

Please sign in to comment.