updated plugin GP Premium version 1.11.2

This commit is contained in:
2020-08-13 14:53:39 +00:00
committed by Gitium
parent 3f0f8d3ac9
commit 885bbdd113
151 changed files with 11329 additions and 6954 deletions

View File

@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
* Allows plugins to use their own update API.
*
* @author Easy Digital Downloads
* @version 1.6.18
* @version 1.7.1
*/
class EDD_SL_Plugin_Updater {
@ -117,6 +117,7 @@ class EDD_SL_Plugin_Updater {
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
$no_update = false;
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
$_transient_data->response[ $this->name ] = $version_info;
@ -124,11 +125,25 @@ class EDD_SL_Plugin_Updater {
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
$_transient_data->response[ $this->name ]->plugin = $this->name;
} else {
$no_update = new stdClass();
$no_update->id = '';
$no_update->slug = $this->slug;
$no_update->plugin = $this->name;
$no_update->new_version = $version_info->new_version;
$no_update->url = $version_info->homepage;
$no_update->package = $version_info->package;
$no_update->icons = $version_info->icons;
$no_update->banners = $version_info->banners;
$no_update->banners_rtl = array();
}
$_transient_data->last_checked = time();
$_transient_data->checked[ $this->name ] = $this->version;
if ( $no_update ) {
$_transient_data->no_update[ $this->name ] = $no_update;
}
}
return $_transient_data;
@ -185,6 +200,10 @@ class EDD_SL_Plugin_Updater {
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
}
if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
$version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
}
$this->set_version_info_cache( $version_info );
}
@ -192,14 +211,29 @@ class EDD_SL_Plugin_Updater {
return;
}
$no_update = false;
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
$update_cache->response[ $this->name ] = $version_info;
} else {
$no_update = new stdClass();
$no_update->id = '';
$no_update->slug = $this->slug;
$no_update->plugin = $this->name;
$no_update->new_version = $version_info->new_version;
$no_update->url = $version_info->homepage;
$no_update->package = $version_info->package;
$no_update->icons = $version_info->icons;
$no_update->banners = $version_info->banners;
$no_update->banners_rtl = array();
}
$update_cache->last_checked = time();
$update_cache->last_checked = time();
$update_cache->checked[ $this->name ] = $this->version;
if ( $no_update ) {
$update_cache->no_update[ $this->name ] = $no_update;
}
set_site_transient( 'update_plugins', $update_cache );
@ -283,10 +317,8 @@ class EDD_SL_Plugin_Updater {
)
);
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
// Get the transient where we store the api request for this plugin for 24 hours
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
$edd_api_request_transient = $this->get_cached_version_info();
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
if ( empty( $edd_api_request_transient ) ) {
@ -294,7 +326,7 @@ class EDD_SL_Plugin_Updater {
$api_response = $this->api_request( 'plugin_information', $to_send );
// Expires in 3 hours
$this->set_version_info_cache( $api_response, $cache_key );
$this->set_version_info_cache( $api_response );
if ( false !== $api_response ) {
$_data = $api_response;
@ -319,6 +351,11 @@ class EDD_SL_Plugin_Updater {
$_data->icons = $this->convert_object_to_array( $_data->icons );
}
// Convert contributors into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
}
if( ! isset( $_data->plugin ) ) {
$_data->plugin = $this->name;
}
@ -341,7 +378,7 @@ class EDD_SL_Plugin_Updater {
private function convert_object_to_array( $data ) {
$new_data = array();
foreach ( $data as $key => $value ) {
$new_data[ $key ] = $value;
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
}
return $new_data;
@ -454,6 +491,9 @@ class EDD_SL_Plugin_Updater {
return $request;
}
/**
* If available, show the changelog for sites in a multisite install.
*/
public function show_changelog() {
global $edd_plugin_data;
@ -475,9 +515,7 @@ class EDD_SL_Plugin_Updater {
}
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
$beta = ! empty( $data['beta'] ) ? true : false;
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
$version_info = $this->get_cached_version_info( $cache_key );
$version_info = $this->get_cached_version_info();
if( false === $version_info ) {
@ -498,7 +536,6 @@ class EDD_SL_Plugin_Updater {
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
}
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
$version_info->sections = maybe_unserialize( $version_info->sections );
} else {
@ -511,17 +548,28 @@ class EDD_SL_Plugin_Updater {
}
}
$this->set_version_info_cache( $version_info, $cache_key );
$this->set_version_info_cache( $version_info );
// Delete the unneeded option
delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) );
}
if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
if ( isset( $version_info->sections ) ) {
$sections = $this->convert_object_to_array( $version_info->sections );
if ( ! empty( $sections['changelog'] ) ) {
echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
}
}
exit;
}
/**
* Gets the plugin's cached version information from the database.
*
* @param string $cache_key
* @return boolean|string
*/
public function get_cached_version_info( $cache_key = '' ) {
if( empty( $cache_key ) ) {
@ -544,6 +592,12 @@ class EDD_SL_Plugin_Updater {
}
/**
* Adds the plugin version information to the database.
*
* @param string $value
* @param string $cache_key
*/
public function set_version_info_cache( $value = '', $cache_key = '' ) {
if( empty( $cache_key ) ) {
@ -557,6 +611,8 @@ class EDD_SL_Plugin_Updater {
update_option( $cache_key, $data, 'no' );
// Delete the duplicate option
delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
}
/**

View File

@ -582,3 +582,20 @@ function generate_premium_wc_menu_item_active() {
return true;
}
/**
* Checks to see if we're using external CSS file.
*
* @since 1.11.0
*/
function generate_is_using_external_css_file_callback() {
if ( ! function_exists( 'generate_get_option' ) ) {
return false;
}
if ( 'file' === generate_get_option( 'css_print_method' ) ) {
return true;
}
return false;
}

View File

@ -15,9 +15,11 @@ if ( ! class_exists( 'GeneratePress_Action_Button_Control' ) ) {
public $type = 'gp_action_button';
public $data_type = '';
public $description = '';
public $nonce = '';
public function enqueue() {
wp_enqueue_script( 'gp-button-actions', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/button-actions.js', array( 'customize-controls' ), GP_PREMIUM_VERSION, true );
wp_enqueue_script( 'gp-button-actions', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/button-actions.js', array( 'customize-controls' ), GP_PREMIUM_VERSION, true );
wp_enqueue_style( 'gp-button-actions', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'css/button-actions.css', array(), GP_PREMIUM_VERSION );
}
public function to_json() {
@ -25,14 +27,17 @@ if ( ! class_exists( 'GeneratePress_Action_Button_Control' ) ) {
$this->json['data_type'] = $this->data_type;
$this->json['description'] = $this->description;
$this->json['nonce'] = $this->nonce;
}
public function content_template() {
?>
<button class="button" data-type="{{{ data.data_type }}}">{{{ data.label }}}</button>
<span class="description customize-control-description">
<p>{{{ data.description }}}</p>
</span>
<button class="button" data-type="{{{ data.data_type }}}" data-nonce="{{{ data.nonce }}}">{{{ data.label }}}</button>
<# if ( data.description ) { #>
<span class="description customize-control-description">
<p>{{{ data.description }}}</p>
</span>
<# } #>
<?php
}
}

View File

@ -34,8 +34,8 @@ class GeneratePress_Spacing_Control extends WP_Customize_Control {
}
$this->json[ 'element' ] = $this->element;
$this->json[ 'title' ] = __( 'Link values','generate-spacing' );
$this->json[ 'unlink_title' ] = __( 'Un-link values','generate-spacing' );
$this->json[ 'title' ] = __( 'Link values', 'gp-premium' );
$this->json[ 'unlink_title' ] = __( 'Un-link values', 'gp-premium' );
$this->json['label_top'] = esc_html__( 'Top', 'gp-premium' );
$this->json['label_right'] = esc_html__( 'Right', 'gp-premium' );

View File

@ -13,7 +13,6 @@
}
.alpha-color-picker-wrap a.iris-square-value:focus {
-webkit-box-shadow: none;
box-shadow: none;
}

View File

@ -0,0 +1,20 @@
button[data-type="regenerate_external_css"]:before {
font: normal 20px/.5 dashicons;
speak: none;
display: inline-block;
padding: 0;
top: 9px;
left: -4px;
position: relative;
vertical-align: top;
content: "\f463";
}
button[data-type="regenerate_external_css"].loading:before {
animation: rotation 1s infinite linear;
}
button[data-type="regenerate_external_css"].success:before {
content: "\f147";
color: #46b450;
}

View File

@ -4,8 +4,6 @@
height: 6px;
background-color: rgba(0,0,0,.10);
cursor: pointer;
-webkit-transition: background .5s;
-moz-transition: background .5s;
transition: background .5s;
}
@ -28,21 +26,14 @@
display: inline-block;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%) translateX(-4px);
transform: translateY(-50%) translateX(-4px);
border-radius: 50%;
cursor: pointer;
}
.customize-control-generatepress-pro-range-slider .wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
@ -51,8 +42,6 @@
padding: 0;
font-weight: 400;
width: 50px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
@ -126,8 +115,6 @@
}
.gp-range-title-area {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}

View File

@ -1,6 +1,4 @@
.gp-spacing-control-section-title-area {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
@ -17,8 +15,6 @@
}
.spacing-values-area {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}

View File

@ -3,11 +3,7 @@
}
.generatepress-weight-transform-wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}

View File

@ -26,4 +26,19 @@ jQuery( document ).ready( function( $ ) {
}( wp.customize ) );
} );
$( '[data-type="regenerate_external_css"]' ).on( 'click', function( e ) {
var $thisButton = $( this ); // eslint-disable-line no-var
e.preventDefault();
$thisButton.removeClass( 'success' ).addClass( 'loading' );
$.post( ajaxurl, {
action: 'generatepress_regenerate_css_file',
_nonce: $thisButton.data( 'nonce' ),
} ).done( function() {
$thisButton.removeClass( 'loading' ).addClass( 'success' );
} );
} );
} );

View File

@ -19,36 +19,48 @@
headerTextColorSetting = api.instance( 'generate_settings[header_text_color]' ),
headerTextColor = gpControls.headerTextColor;
if ( ! siteTitleFontSizeSetting._dirty && 25 !== siteTitleFontSizeSetting.get() ) {
if ( siteTitleFontSizeSetting && ! siteTitleFontSizeSetting._dirty && 25 !== siteTitleFontSizeSetting.get() ) {
siteTitleFontSize = siteTitleFontSizeSetting.get();
}
if ( ! mobileSiteTitleFontSizeSetting._dirty && 20 !== mobileSiteTitleFontSizeSetting.get() ) {
if ( mobileSiteTitleFontSizeSetting && ! mobileSiteTitleFontSizeSetting._dirty && 20 !== mobileSiteTitleFontSizeSetting.get() ) {
mobileSiteTitleFontSize = mobileSiteTitleFontSizeSetting.get();
}
if ( ! navTextColorSetting._dirty ) {
if ( navTextColorSetting && ! navTextColorSetting._dirty ) {
navTextColor = navTextColorSetting.get();
}
if ( ! headerTextColorSetting._dirty ) {
if ( headerTextColorSetting && ! headerTextColorSetting._dirty ) {
headerTextColor = headerTextColorSetting.get();
}
if ( newval ) {
navAlignmentSetting.set( 'right' );
siteTitleFontSizeSetting.set( 25 );
api.instance( 'generate_settings[site_title_color]' ).set( navTextColor );
if ( 'enable' !== mobileHeader ) {
if ( siteTitleFontSizeSetting ) {
siteTitleFontSizeSetting.set( 25 );
}
if ( api.instance( 'generate_settings[site_title_color]' ) ) {
api.instance( 'generate_settings[site_title_color]' ).set( navTextColor );
}
if ( mobileSiteTitleFontSizeSetting && 'enable' !== mobileHeader ) {
mobileSiteTitleFontSizeSetting.set( 20 );
}
} else {
navAlignmentSetting.set( navAlignment );
siteTitleFontSizeSetting.set( siteTitleFontSize );
api.instance( 'generate_settings[site_title_color]' ).set( headerTextColor );
if ( 'enable' !== mobileHeader ) {
if ( siteTitleFontSizeSetting ) {
siteTitleFontSizeSetting.set( siteTitleFontSize );
}
if ( api.instance( 'generate_settings[site_title_color]' ) ) {
api.instance( 'generate_settings[site_title_color]' ).set( headerTextColor );
}
if ( mobileSiteTitleFontSizeSetting && 'enable' !== mobileHeader ) {
mobileSiteTitleFontSizeSetting.set( mobileSiteTitleFontSize );
}
}
@ -138,7 +150,7 @@
*/
api( 'generate_menu_plus_settings[mobile_header_branding]', function( value ) {
value.bind( function( newval ) {
if ( 'title' === newval ) {
if ( api.instance( 'generate_settings[mobile_site_title_font_size]' ) && 'title' === newval ) {
api.instance( 'generate_settings[mobile_site_title_font_size]' ).set( 20 );
}
} );
@ -154,14 +166,16 @@
var mobileSiteTitleFontSizeSetting = api.instance( 'generate_settings[mobile_site_title_font_size]' ),
mobileSiteTitleFontSize = gpControls.mobileSiteTitleFontSize;
if ( ! mobileSiteTitleFontSizeSetting._dirty && 20 !== mobileSiteTitleFontSizeSetting.get() ) {
if ( mobileSiteTitleFontSizeSetting && ! mobileSiteTitleFontSizeSetting._dirty && 20 !== mobileSiteTitleFontSizeSetting.get() ) {
mobileSiteTitleFontSize = mobileSiteTitleFontSizeSetting.get();
}
if ( 'enable' === newval ) {
api.instance( 'generate_settings[mobile_site_title_font_size]' ).set( 20 );
} else {
api.instance( 'generate_settings[mobile_site_title_font_size]' ).set( mobileSiteTitleFontSize );
if ( api.instance( 'generate_settings[mobile_site_title_font_size]' ) ) {
if ( 'enable' === newval ) {
api.instance( 'generate_settings[mobile_site_title_font_size]' ).set( 20 );
} else {
api.instance( 'generate_settings[mobile_site_title_font_size]' ).set( mobileSiteTitleFontSize );
}
}
} );
} );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long