updated plugin GP Premium
version 1.11.2
This commit is contained in:
@ -1,15 +1,25 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
/**
|
||||
* This file handles resetting of options.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
add_action( 'generate_admin_right_panel', 'generate_premium_reset_metabox', 25 );
|
||||
|
||||
/**
|
||||
* Add the reset options to the Dashboard.
|
||||
*/
|
||||
function generate_premium_reset_metabox() {
|
||||
?>
|
||||
<div class="postbox generate-metabox" id="generate-reset">
|
||||
<h3 class="hndle"><?php _e( 'Reset Settings', 'gp-premium' );?></h3>
|
||||
<h3 class="hndle"><?php esc_html_e( 'Reset Settings', 'gp-premium' ); ?></h3>
|
||||
<div class="inside">
|
||||
<form method="post">
|
||||
<span class="show-advanced"><?php _e( 'Advanced', 'gp-premium' ); ?></span>
|
||||
<span class="show-advanced"><?php esc_html_e( 'Advanced', 'gp-premium' ); ?></span>
|
||||
<div class="reset-choices advanced-choices">
|
||||
<label><input type="checkbox" name="module_group[]" value="generate_settings" checked /><?php _ex( 'Core', 'Module name', 'gp-premium' ); ?></label>
|
||||
|
||||
@ -47,7 +57,7 @@ function generate_premium_reset_metabox() {
|
||||
|
||||
<?php if ( generatepress_is_module_active( 'generate_package_copyright', 'GENERATE_COPYRIGHT' ) ) { ?>
|
||||
<label><input type="checkbox" name="module_group[]" value="copyright" checked /><?php _ex( 'Copyright', 'Module name', 'gp-premium' ); ?></label>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<p><input type="hidden" name="generate_reset_action" value="reset_settings" /></p>
|
||||
<p style="margin-bottom:0">
|
||||
@ -61,7 +71,7 @@ function generate_premium_reset_metabox() {
|
||||
false,
|
||||
array(
|
||||
'onclick' => esc_js( $warning ),
|
||||
'id' => '' ,
|
||||
'id' => '',
|
||||
)
|
||||
);
|
||||
?>
|
||||
@ -73,9 +83,11 @@ function generate_premium_reset_metabox() {
|
||||
}
|
||||
|
||||
add_action( 'admin_init', 'generate_premium_process_reset' );
|
||||
|
||||
/**
|
||||
* Process the reset functions.
|
||||
*/
|
||||
function generate_premium_process_reset() {
|
||||
if ( empty( $_POST['generate_reset_action'] ) || 'reset_settings' != $_POST['generate_reset_action'] ) {
|
||||
if ( empty( $_POST['generate_reset_action'] ) || 'reset_settings' !== $_POST['generate_reset_action'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -133,11 +145,11 @@ function generate_premium_process_reset() {
|
||||
|
||||
$data = array(
|
||||
'mods' => array(),
|
||||
'options' => array()
|
||||
'options' => array(),
|
||||
);
|
||||
|
||||
foreach ( $theme_mods as $theme_mod ) {
|
||||
if ( 'generate_copyright' == $theme_mod ) {
|
||||
if ( 'generate_copyright' === $theme_mod ) {
|
||||
if ( in_array( 'copyright', $_POST['module_group'] ) ) {
|
||||
remove_theme_mod( $theme_mod );
|
||||
}
|
||||
@ -154,13 +166,23 @@ function generate_premium_process_reset() {
|
||||
}
|
||||
}
|
||||
|
||||
// Delete our dynamic CSS option.
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
|
||||
// Reset our dynamic CSS file updated time so it regenerates.
|
||||
$dynamic_css_data = get_option( 'generatepress_dynamic_css_data', array() );
|
||||
|
||||
if ( isset( $dynamic_css_data['updated_time'] ) ) {
|
||||
unset( $dynamic_css_data['updated_time'] );
|
||||
}
|
||||
|
||||
update_option( 'generatepress_dynamic_css_data', $dynamic_css_data );
|
||||
|
||||
// Delete any GeneratePress Site CSS in Additional CSS.
|
||||
$additional_css = wp_get_custom_css_post();
|
||||
|
||||
if ( ! empty ( $additional_css ) ) {
|
||||
if ( ! empty( $additional_css ) ) {
|
||||
$additional_css->post_content = preg_replace( '#(/\\* GeneratePress Site CSS \\*/).*?(/\\* End GeneratePress Site CSS \\*/)#s', '', $additional_css->post_content );
|
||||
wp_update_custom_css_post( $additional_css->post_content );
|
||||
}
|
||||
@ -170,7 +192,9 @@ function generate_premium_process_reset() {
|
||||
}
|
||||
|
||||
add_action( 'admin_head', 'generate_reset_options_css', 100 );
|
||||
|
||||
/**
|
||||
* Add CSS to the dashboard.
|
||||
*/
|
||||
function generate_reset_options_css() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
@ -223,7 +247,9 @@ function generate_reset_options_css() {
|
||||
}
|
||||
|
||||
add_action( 'admin_footer', 'generate_reset_options_scripts', 100 );
|
||||
|
||||
/**
|
||||
* Add scripts to the Dashboard.
|
||||
*/
|
||||
function generate_reset_options_scripts() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
|
Reference in New Issue
Block a user