Skip to content

Commit

Permalink
Merge pull request #1657 from WordImpress/release/1.8.7
Browse files Browse the repository at this point in the history
Release/1.8.7
  • Loading branch information
Devin Walker committed May 4, 2017
2 parents 45f118d + ee7184a commit bcc91eb
Show file tree
Hide file tree
Showing 55 changed files with 1,886 additions and 1,000 deletions.
2 changes: 1 addition & 1 deletion assets/js/admin/admin-scripts.min.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions assets/js/frontend/give.all.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/js/frontend/give.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ function give_open_form_modal($form_wrap, $form) {
jQuery.magnificPopup.open({
mainClass : give_global_vars.magnific_options.main_class,
closeOnBgClick : give_global_vars.magnific_options.close_on_bg_click,
fixedContentPos: true,
fixedBgPos: true,
items: {
src: $form,
type: 'inline'
Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/give.min.js

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

13 changes: 11 additions & 2 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.6
* Version: 1.8.7
* Text Domain: give
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/WordImpress/Give
Expand Down Expand Up @@ -214,6 +214,14 @@ public static function instance() {
self::$instance->template_loader = new Give_Template_Loader();
self::$instance->email_access = new Give_Email_Access();


/**
* Fire the action after Give core loads
*
* @since 1.8.7
*/
do_action( 'give_init', self::$instance );

}

return self::$instance;
Expand Down Expand Up @@ -260,7 +268,7 @@ private function setup_constants() {

// Plugin version
if ( ! defined( 'GIVE_VERSION' ) ) {
define( 'GIVE_VERSION', '1.8.6' );
define( 'GIVE_VERSION', '1.8.7' );
}

// Plugin Folder Path
Expand Down Expand Up @@ -305,6 +313,7 @@ private function includes() {
$give_options = give_get_settings();

require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
Expand Down
64 changes: 56 additions & 8 deletions includes/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ function give_get_actions() {

$_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null;

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

Expand All @@ -46,10 +46,9 @@ function give_get_actions() {
}

add_action( 'init', 'give_get_actions' );
add_action( 'admin_init', 'give_get_actions' );

/**
* Hooks Give actions, when present in the $_POST superglobal. Every give_action
* Hooks Give actions, when present in the $_POST super global. Every give_action
* present in $_POST is called using WordPress's do_action function. These
* functions are called on init.
*
Expand All @@ -62,8 +61,8 @@ function give_post_actions() {
$_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null;


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

Expand All @@ -81,7 +80,6 @@ function give_post_actions() {
}

add_action( 'init', 'give_post_actions' );
add_action( 'admin_init', 'give_post_actions' );

/**
* Connect WordPress user with Donor.
Expand All @@ -92,6 +90,7 @@ function give_post_actions() {
* @return void
*/
function give_connect_donor_to_wpuser( $user_id, $user_data ){
/* @var Give_Customer $donor */
$donor = new Give_Customer( $user_data['user_email'] );

// Validate donor id and check if do nor is already connect to wp user or not.
Expand Down Expand Up @@ -159,7 +158,56 @@ function give_donor_batch_export_complete( $data ) {
&& ! empty( $data['forms'] )
&& isset( $data['give_export_option']['query_id'] )
) {
delete_transient( $data['give_export_option']['query_id'] );
Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) );
}
}
add_action('give_file_export_complete', 'give_donor_batch_export_complete' );

/**
* Print css for wordpress setting pages.
*
* @since 1.8.7
*/
function give_admin_quick_css() {
/* @var WP_Screen $screen */
$screen = get_current_screen();

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

switch ( true ) {
case ( 'plugins' === $screen->base ):
?>
<style>
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.give-addon-notice-tr .dashicons {
color: #f56e28;
}
tr.give-addon-notice-tr td{
border-left: 4px solid #00a0d2;
}

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

tr.active.update + tr.give-addon-notice-tr .notice{
margin: 5px 20px 5px 40px;
}
</style>
<?php
}
}
add_action( 'admin_head', 'give_admin_quick_css' );
10 changes: 5 additions & 5 deletions includes/admin/EDD_SL_Plugin_Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Allows plugins to use their own update API.
*
* @author Easy Digital Downloads
* @version 1.6.11
* @version 1.6.12
*/
class EDD_SL_Plugin_Updater {

Expand Down Expand Up @@ -279,8 +279,8 @@ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
$new_sections = array();
foreach ( $_data->sections as $key => $key ) {
$new_sections[ $key ] = $key;
foreach ( $_data->sections as $key => $value ) {
$new_sections[ $key ] = $value;
}

$_data->sections = $new_sections;
Expand All @@ -289,8 +289,8 @@ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
$new_banners = array();
foreach ( $_data->banners as $key => $key ) {
$new_banners[ $key ] = $key;
foreach ( $_data->banners as $key => $value ) {
$new_banners[ $key ] = $value;
}

$_data->banners = $new_banners;
Expand Down
9 changes: 6 additions & 3 deletions includes/admin/add-ons.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,21 @@ function give_add_ons_page() {
function give_add_ons_get_feed() {

$addons_debug = false; //set to true to debug
$cache = get_transient( 'give_add_ons_feed' );
$cache = Give_Cache::get( 'give_add_ons_feed', true );

if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );

if ( ! is_wp_error( $feed ) ) {
if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
$cache = wp_remote_retrieve_body( $feed );
set_transient( 'give_add_ons_feed', $cache, 3600 );
Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
}
} else {
$cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>';
$cache = sprintf(
'<div class="error"><p>%s</p></div>',
esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
);
}
}

Expand Down
4 changes: 2 additions & 2 deletions includes/admin/admin-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ function give_hide_subscription_notices() {
// Transient key name.
$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";

if ( get_transient( $transient_key ) ) {
if ( Give_Cache::get( $transient_key, true ) ) {
return;
}

// Hide notice for 24 hours.
set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );

// Redirect user.
wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
Expand Down
Loading

0 comments on commit bcc91eb

Please sign in to comment.