updated plugin GP Premium
version 1.11.2
This commit is contained in:
@ -1,6 +1,17 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
/**
|
||||
* This file builds the sites to be imported.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
/**
|
||||
* Build each site UI.
|
||||
*/
|
||||
class GeneratePress_Site {
|
||||
|
||||
/**
|
||||
@ -88,10 +99,10 @@ class GeneratePress_Site {
|
||||
protected $documentation;
|
||||
|
||||
/**
|
||||
* Get the uploads URL.
|
||||
*
|
||||
* @var int|string
|
||||
*/
|
||||
* Get the uploads URL.
|
||||
*
|
||||
* @var int|string
|
||||
*/
|
||||
protected $uploads_url;
|
||||
|
||||
/**
|
||||
@ -104,53 +115,56 @@ class GeneratePress_Site {
|
||||
/**
|
||||
* Get it rockin'
|
||||
*
|
||||
* @param array $config
|
||||
* @param array $config The site configuration.
|
||||
*/
|
||||
public function __construct( $config = array() ) {
|
||||
|
||||
$config = wp_parse_args( $config, array(
|
||||
'directory' => '',
|
||||
'name' => '',
|
||||
'preview_url' => '',
|
||||
'author_name' => '',
|
||||
'author_url' => '',
|
||||
'icon' => 'icon.png',
|
||||
'screenshot' => 'screenshot.png',
|
||||
'page_builder' => array(),
|
||||
'uploads_url' => array(),
|
||||
'min_version' => GP_PREMIUM_VERSION,
|
||||
'plugins' => '',
|
||||
'documentation' => '',
|
||||
) );
|
||||
$config = wp_parse_args(
|
||||
$config,
|
||||
array(
|
||||
'directory' => '',
|
||||
'name' => '',
|
||||
'preview_url' => '',
|
||||
'author_name' => '',
|
||||
'author_url' => '',
|
||||
'icon' => 'icon.png',
|
||||
'screenshot' => 'screenshot.png',
|
||||
'page_builder' => array(),
|
||||
'uploads_url' => array(),
|
||||
'min_version' => GP_PREMIUM_VERSION,
|
||||
'plugins' => '',
|
||||
'documentation' => '',
|
||||
)
|
||||
);
|
||||
|
||||
$this->helpers = new GeneratePress_Sites_Helper();
|
||||
|
||||
$this->directory = trailingslashit( $config['directory'] );
|
||||
$this->directory = trailingslashit( $config['directory'] );
|
||||
|
||||
$provider = parse_url( $this->directory );
|
||||
$provider = parse_url( $this->directory ); // phpcs:ignore -- Prefer parse_url().
|
||||
|
||||
if ( ! isset( $provider['host'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! in_array( $provider['host'], ( array ) get_transient( 'generatepress_sites_trusted_providers' ) ) ) {
|
||||
if ( ! in_array( $provider['host'], (array) get_transient( 'generatepress_sites_trusted_providers' ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->name = $config['name'];
|
||||
$this->slug = str_replace( ' ', '_', strtolower( $this->name ) );
|
||||
$this->preview_url = $config['preview_url'];
|
||||
$this->author_name = $config['author_name'];
|
||||
$this->author_url = $config['author_url'];
|
||||
$this->description = $config['description'];
|
||||
$this->icon = $config['icon'];
|
||||
$this->screenshot = $config['screenshot'];
|
||||
$this->page_builder = $config['page_builder'];
|
||||
$this->min_version = $config['min_version'];
|
||||
$this->uploads_url = $config['uploads_url'];
|
||||
$this->plugins = $config['plugins'];
|
||||
$this->documentation = $config['documentation'];
|
||||
$this->installable = true;
|
||||
$this->name = $config['name'];
|
||||
$this->slug = str_replace( ' ', '_', strtolower( $this->name ) );
|
||||
$this->preview_url = $config['preview_url'];
|
||||
$this->author_name = $config['author_name'];
|
||||
$this->author_url = $config['author_url'];
|
||||
$this->description = $config['description'];
|
||||
$this->icon = $config['icon'];
|
||||
$this->screenshot = $config['screenshot'];
|
||||
$this->page_builder = $config['page_builder'];
|
||||
$this->min_version = $config['min_version'];
|
||||
$this->uploads_url = $config['uploads_url'];
|
||||
$this->plugins = $config['plugins'];
|
||||
$this->documentation = $config['documentation'];
|
||||
$this->installable = true;
|
||||
|
||||
if ( empty( $this->min_version ) ) {
|
||||
$this->min_version = GP_PREMIUM_VERSION;
|
||||
@ -160,16 +174,16 @@ class GeneratePress_Site {
|
||||
$this->installable = false;
|
||||
}
|
||||
|
||||
add_action( 'generate_inside_sites_container', array( $this, 'build_box' ) );
|
||||
add_action( "wp_ajax_generate_setup_demo_content_{$this->slug}", array( $this, 'setup_demo_content' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_check_plugins_{$this->slug}", array( $this, 'check_plugins' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_backup_options_{$this->slug}", array( $this, 'backup_options' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_import_options_{$this->slug}", array( $this, 'import_options' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_activate_plugins_{$this->slug}", array( $this, 'activate_plugins' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_import_site_options_{$this->slug}", array( $this, 'import_site_options' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_download_content_{$this->slug}", array( $this, 'download_content' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_import_content_{$this->slug}", array( $this, 'import_content' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_import_widgets_{$this->slug}", array( $this, 'import_widgets' ), 10, 0 );
|
||||
add_action( 'generate_inside_sites_container', array( $this, 'build_box' ) );
|
||||
add_action( "wp_ajax_generate_setup_demo_content_{$this->slug}", array( $this, 'setup_demo_content' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_check_plugins_{$this->slug}", array( $this, 'check_plugins' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_backup_options_{$this->slug}", array( $this, 'backup_options' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_import_options_{$this->slug}", array( $this, 'import_options' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_activate_plugins_{$this->slug}", array( $this, 'activate_plugins' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_import_site_options_{$this->slug}", array( $this, 'import_site_options' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_download_content_{$this->slug}", array( $this, 'download_content' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_import_content_{$this->slug}", array( $this, 'import_content' ), 10, 0 );
|
||||
add_action( "wp_ajax_generate_import_widgets_{$this->slug}", array( $this, 'import_widgets' ), 10, 0 );
|
||||
|
||||
// Don't do the WC setup. This wouldn't be necessary if they used an activation hook.
|
||||
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_true' );
|
||||
@ -183,10 +197,11 @@ class GeneratePress_Site {
|
||||
*/
|
||||
public function site_details() {
|
||||
|
||||
printf( '<div class="site-screenshot site-overview-screenshot">
|
||||
<img src="" alt="%s" />
|
||||
</div>',
|
||||
esc_attr( $this->name )
|
||||
printf(
|
||||
'<div class="site-screenshot site-overview-screenshot">
|
||||
<img src="" alt="%s" />
|
||||
</div>',
|
||||
esc_attr( $this->name )
|
||||
);
|
||||
|
||||
?>
|
||||
@ -217,11 +232,12 @@ class GeneratePress_Site {
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Site name */
|
||||
__( '%s is brought to you by ', 'gp-premium' ),
|
||||
$this->name
|
||||
esc_html( $this->name )
|
||||
);
|
||||
?>
|
||||
<a href="<?php echo esc_url( $this->author_url ); ?>" target="_blank" rel="noopener"><?php echo $this->author_name; ?></a>.
|
||||
<a href="<?php echo esc_url( $this->author_url ); ?>" target="_blank" rel="noopener"><?php echo esc_html( $this->author_name ); ?></a>.
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -253,7 +269,7 @@ class GeneratePress_Site {
|
||||
* @since 1.6
|
||||
*/
|
||||
public function loading_icon() {
|
||||
// Deprecated since 1.9
|
||||
// Deprecated since 1.9.
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,31 +280,31 @@ class GeneratePress_Site {
|
||||
public function build_box() {
|
||||
|
||||
$site_data = array(
|
||||
'slug' => $this->slug,
|
||||
'preview_url' => $this->preview_url,
|
||||
'plugins' => $this->plugins,
|
||||
'slug' => $this->slug,
|
||||
'preview_url' => $this->preview_url,
|
||||
'plugins' => $this->plugins,
|
||||
);
|
||||
|
||||
$page_builders = array();
|
||||
foreach ( ( array ) $this->page_builder as $builder ) {
|
||||
foreach ( (array) $this->page_builder as $builder ) {
|
||||
$page_builders = str_replace( ' ', '-', strtolower( $builder ) );
|
||||
}
|
||||
|
||||
$site_classes = array(
|
||||
'site-box',
|
||||
$page_builders,
|
||||
! $this->installable ? 'disabled-site' : ''
|
||||
! $this->installable ? 'disabled-site' : '',
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="<?php echo implode( ' ', $site_classes ); ?>" data-site-data="<?php echo htmlspecialchars( json_encode( $site_data ), ENT_QUOTES, 'UTF-8' ); ?>">
|
||||
<div class="<?php echo implode( ' ', $site_classes ); // phpcs:ignore -- Escaping not needed. ?>" data-site-data="<?php echo htmlspecialchars( json_encode( $site_data ), ENT_QUOTES, 'UTF-8' ); ?>">
|
||||
<div class="steps step-one">
|
||||
<div class="site-info">
|
||||
<div class="site-description">
|
||||
<h3><a class="site-details" href="#"><?php echo $this->name; ?></a></h3>
|
||||
<h3><a class="site-details" href="#"><?php echo esc_html( $this->name ); ?></a></h3>
|
||||
<?php
|
||||
if ( $this->description ) {
|
||||
echo '<a class="site-details" href="#"> ' . wpautop( $this->description ) . '</a>';
|
||||
echo '<a class="site-details" href="#"> ' . wpautop( $this->description ) . '</a>'; // phpcs:ignore -- No escaping necessary.
|
||||
}
|
||||
?>
|
||||
|
||||
@ -299,36 +315,45 @@ class GeneratePress_Site {
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<span class="version-required-message">
|
||||
<?php printf( _x( 'Requires GP Premium %s', 'required version number', 'gp-premium' ), $this->min_version ); ?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: GP Premium version */
|
||||
_x( 'Requires GP Premium %s', 'required version number', 'gp-premium' ),
|
||||
esc_html( $this->min_version )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="site-screenshot site-card-screenshot">
|
||||
<img class="lazyload" src="<?php echo GENERATE_SITES_URL; ?>/assets/images/screenshot.png" data-src="<?php echo esc_url( $this->directory . $this->screenshot ); ?>" alt="" />
|
||||
<img class="lazyload" src="<?php echo esc_url( GENERATE_SITES_URL ); ?>/assets/images/screenshot.png" data-src="<?php echo esc_url( $this->directory . $this->screenshot ); ?>" alt="" />
|
||||
</div>
|
||||
|
||||
<div class="site-title">
|
||||
<span class="author-name"><?php echo $this->author_name; ?></span>
|
||||
<h3><?php echo $this->name; ?></h3>
|
||||
<span class="author-name"><?php echo esc_html( $this->author_name ); ?></span>
|
||||
<h3><?php echo esc_html( $this->name ); ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="steps step-overview" style="display: none;">
|
||||
<div class="step-information">
|
||||
<h1 style="margin-bottom: 0;">
|
||||
<?php printf(
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Site name. */
|
||||
__( 'Welcome to %s.', 'gp-premium' ),
|
||||
$this->name
|
||||
); ?>
|
||||
esc_html( $this->name )
|
||||
);
|
||||
?>
|
||||
</h1>
|
||||
|
||||
<p><?php echo $this->description; ?></p>
|
||||
<p><?php echo $this->description; // phpcs:ignore -- Escaping not needed. ?></p>
|
||||
|
||||
<div class="action-area">
|
||||
<div class="action-buttons">
|
||||
<?php echo $this->action_button(); ?>
|
||||
<?php echo $this->action_button(); // phpcs:ignore -- Escaping not needed. ?>
|
||||
|
||||
<div class="loading" style="display: none;">
|
||||
<span class="site-message"></span>
|
||||
@ -373,7 +398,8 @@ class GeneratePress_Site {
|
||||
<?php _e( 'Things like pages, menus, widgets and plugins.', 'gp-premium' ); ?>
|
||||
</p>
|
||||
|
||||
<?php if ( $this->plugins ) :
|
||||
<?php
|
||||
if ( $this->plugins ) :
|
||||
$plugins = json_decode( $this->plugins, true );
|
||||
|
||||
if ( ! empty( $plugins ) ) :
|
||||
@ -381,17 +407,20 @@ class GeneratePress_Site {
|
||||
<div class="site-plugins">
|
||||
<p><?php _e( 'This site uses the following plugins.', 'gp-premium' ); ?></p>
|
||||
<ul>
|
||||
<?php foreach( $plugins as $name => $id ) {
|
||||
<?php
|
||||
foreach ( $plugins as $name => $id ) {
|
||||
printf(
|
||||
'<li>%s</li>',
|
||||
$name
|
||||
esc_html( $name )
|
||||
);
|
||||
} ?>
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endif; ?>
|
||||
endif;
|
||||
?>
|
||||
|
||||
<div class="plugin-area">
|
||||
<div class="no-plugins" style="display: none;">
|
||||
@ -433,27 +462,31 @@ class GeneratePress_Site {
|
||||
|
||||
$uploads_url = $uploads_url['baseurl'];
|
||||
|
||||
if ( $this->uploads_url ) : ?>
|
||||
if ( $this->uploads_url ) :
|
||||
?>
|
||||
<div class="replace-elementor-urls" style="display: none;">
|
||||
<h4><?php _e( 'Additional Cleanup', 'gp-premium' ); ?></h4>
|
||||
<p><?php _e( 'This site is using Elementor which means you will want to replace the imported image URLs.', 'gp-premium' ); ?> <a title="<?php _e( 'Learn more', 'gp-premium' ); ?>" href="https://docs.generatepress.com/article/replacing-urls-in-elementor/" target="_blank" rel="noopener">[?]</a></p>
|
||||
|
||||
<p>
|
||||
<?php printf(
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Elementor link */
|
||||
__( 'Go to %s, enter the below URLs and click the "Replace URL" button.', 'gp-premium' ),
|
||||
'<a href="' . admin_url( 'admin.php?page=elementor-tools#tab-replace_url' ) . '" target="_blank" rel="noopener">Elementor > Tools > Replace URLs</a>'
|
||||
) ?>
|
||||
'<a href="' . esc_url( admin_url( 'admin.php?page=elementor-tools#tab-replace_url' ) ) . '" target="_blank" rel="noopener">Elementor > Tools > Replace URLs</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<div class="elementor-urls">
|
||||
<label for="old-url"><?php _e( 'Old URL', 'gp-premium' ); ?></label>
|
||||
<input id="old-url" type="text" value="<?php echo $this->uploads_url; ?>" />
|
||||
<input id="old-url" type="text" value="<?php echo esc_url( $this->uploads_url ); ?>" />
|
||||
|
||||
<label for="new-url"><?php _e( 'New URL', 'gp-premium' ); ?></label>
|
||||
<input id="new-url" type="text" value="<?php echo $uploads_url; ?>" />
|
||||
<input id="new-url" type="text" value="<?php echo esc_url( $uploads_url ); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
@ -484,10 +517,13 @@ class GeneratePress_Site {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the action buttons.
|
||||
*/
|
||||
public function action_button() {
|
||||
|
||||
$options = GeneratePress_Sites_Helper::do_options_exist();
|
||||
@ -558,18 +594,18 @@ class GeneratePress_Site {
|
||||
|
||||
$data = array(
|
||||
'mods' => array(),
|
||||
'options' => array()
|
||||
'options' => array(),
|
||||
);
|
||||
|
||||
foreach ( $theme_mods as $theme_mod ) {
|
||||
$data['mods'][$theme_mod] = get_theme_mod( $theme_mod );
|
||||
$data['mods'][ $theme_mod ] = get_theme_mod( $theme_mod );
|
||||
}
|
||||
|
||||
foreach ( $settings as $setting ) {
|
||||
$data['options'][$setting] = get_option( $setting );
|
||||
$data['options'][ $setting ] = get_option( $setting );
|
||||
}
|
||||
|
||||
echo json_encode( $data );
|
||||
echo wp_json_encode( $data );
|
||||
|
||||
die();
|
||||
|
||||
@ -645,15 +681,15 @@ class GeneratePress_Site {
|
||||
|
||||
$data = array(
|
||||
'mods' => array(),
|
||||
'options' => array()
|
||||
'options' => array(),
|
||||
);
|
||||
|
||||
foreach ( $theme_mods as $theme_mod ) {
|
||||
$data['mods'][$theme_mod] = get_theme_mod( $theme_mod );
|
||||
$data['mods'][ $theme_mod ] = get_theme_mod( $theme_mod );
|
||||
}
|
||||
|
||||
foreach ( $settings as $setting ) {
|
||||
$data['options'][$setting] = get_option( $setting );
|
||||
$data['options'][ $setting ] = get_option( $setting );
|
||||
}
|
||||
|
||||
$backup_data['theme_options'] = $data;
|
||||
@ -662,7 +698,7 @@ class GeneratePress_Site {
|
||||
|
||||
$active_modules = array();
|
||||
foreach ( $modules as $name => $key ) {
|
||||
if ( 'activated' == get_option( $key ) ) {
|
||||
if ( 'activated' === get_option( $key ) ) {
|
||||
$active_modules[ $name ] = $key;
|
||||
}
|
||||
}
|
||||
@ -732,17 +768,15 @@ class GeneratePress_Site {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Import any images
|
||||
// Import any images.
|
||||
if ( is_array( $val ) || is_object( $val ) ) {
|
||||
foreach ( $val as $option_name => $option_value ) {
|
||||
if ( is_string( $option_value ) && preg_match( '/\.(jpg|jpeg|png|gif)/i', $option_value ) ) {
|
||||
|
||||
$data = GeneratePress_Sites_Helper::sideload_image( $option_value );
|
||||
|
||||
if ( ! is_wp_error( $data ) ) {
|
||||
$val[$option_name] = $data->url;
|
||||
$val[ $option_name ] = $data->url;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -754,6 +788,14 @@ class GeneratePress_Site {
|
||||
delete_option( 'generate_dynamic_css_output' );
|
||||
delete_option( 'generate_dynamic_css_cached_version' );
|
||||
|
||||
$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 );
|
||||
|
||||
// Custom CSS.
|
||||
$css = $settings['custom_css'];
|
||||
$css = '/* GeneratePress Site CSS */ ' . $css . ' /* End GeneratePress Site CSS */';
|
||||
@ -779,8 +821,10 @@ class GeneratePress_Site {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the content from the .xml file.
|
||||
*/
|
||||
public function download_content() {
|
||||
|
||||
check_ajax_referer( 'generate_sites_nonce', 'nonce' );
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
@ -835,7 +879,7 @@ class GeneratePress_Site {
|
||||
$backup_data['content'] = true;
|
||||
update_option( '_generatepress_site_library_backup', $backup_data );
|
||||
|
||||
// Import content
|
||||
// Import content.
|
||||
$content = get_transient( 'generatepress_sites_content_file' );
|
||||
|
||||
if ( $content ) {
|
||||
@ -898,15 +942,13 @@ class GeneratePress_Site {
|
||||
|
||||
delete_option( 'generate_page_header_global_locations' );
|
||||
|
||||
foreach( $settings['site_options'] as $key => $val ) {
|
||||
|
||||
switch( $key ) {
|
||||
|
||||
foreach ( $settings['site_options'] as $key => $val ) {
|
||||
switch ( $key ) {
|
||||
case 'page_for_posts':
|
||||
case 'page_on_front':
|
||||
$backup_data['site_options'][ $key ] = get_option( $key );
|
||||
GeneratePress_Sites_Helper::set_reading_pages( $key, $val, $this->slug );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'woocommerce_shop_page_id':
|
||||
case 'woocommerce_cart_page_id':
|
||||
@ -914,27 +956,27 @@ class GeneratePress_Site {
|
||||
case 'woocommerce_myaccount_page_id':
|
||||
$backup_data['site_options'][ $key ] = get_option( $key );
|
||||
GeneratePress_Sites_Helper::set_woocommerce_pages( $key, $val, $this->slug );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'nav_menu_locations':
|
||||
GeneratePress_Sites_Helper::set_nav_menu_locations( $val );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'page_header_global_locations':
|
||||
GeneratePress_Sites_Helper::set_global_page_header_locations( $val, $this->slug );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'page_headers':
|
||||
GeneratePress_Sites_Helper::set_page_headers( $val, $this->slug );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'element_locations':
|
||||
GeneratePress_Sites_Helper::set_element_locations( $val, $this->slug );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'element_exclusions':
|
||||
GeneratePress_Sites_Helper::set_element_exclusions( $val, $this->slug );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'custom_logo':
|
||||
$data = GeneratePress_Sites_Helper::sideload_image( $val );
|
||||
@ -946,20 +988,18 @@ class GeneratePress_Site {
|
||||
remove_theme_mod( 'custom_logo' );
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( in_array( $key, ( array ) generatepress_sites_disallowed_options() ) ) {
|
||||
if ( in_array( $key, (array) generatepress_sites_disallowed_options() ) ) {
|
||||
GeneratePress_Sites_Helper::log( 'Disallowed option: ' . $key );
|
||||
} else {
|
||||
$backup_data['site_options'][ $key ] = get_option( $key );
|
||||
delete_option( $key );
|
||||
update_option( $key, $val );
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set our backed up options.
|
||||
@ -998,11 +1038,11 @@ class GeneratePress_Site {
|
||||
|
||||
$pro_plugins = GeneratePress_Sites_Helper::check_for_pro_plugins();
|
||||
|
||||
foreach( $plugins as $plugin ) {
|
||||
foreach ( $plugins as $plugin ) {
|
||||
// If the plugin has a pro version and it exists, activate it instead.
|
||||
if ( array_key_exists( $plugin, $pro_plugins ) ) {
|
||||
if ( file_exists( WP_PLUGIN_DIR . '/' . $pro_plugins[$plugin] ) ) {
|
||||
$plugin = $pro_plugins[$plugin];
|
||||
if ( file_exists( WP_PLUGIN_DIR . '/' . $pro_plugins[ $plugin ] ) ) {
|
||||
$plugin = $pro_plugins[ $plugin ];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1053,9 +1093,9 @@ class GeneratePress_Site {
|
||||
}
|
||||
|
||||
$plugin_data = array();
|
||||
foreach( $data['plugins'] as $name => $slug ) {
|
||||
foreach ( $data['plugins'] as $name => $slug ) {
|
||||
$basename = strtok( $slug, '/' );
|
||||
$plugin_data[$name] = array(
|
||||
$plugin_data[ $name ] = array(
|
||||
'name' => $name,
|
||||
'slug' => $slug,
|
||||
'installed' => GeneratePress_Sites_Helper::is_plugin_installed( $slug ) ? true : false,
|
||||
@ -1067,10 +1107,12 @@ class GeneratePress_Site {
|
||||
$data['plugin_data'] = $plugin_data;
|
||||
}
|
||||
|
||||
wp_send_json( array(
|
||||
'plugins' => $data['plugins'],
|
||||
'plugin_data' => $data['plugin_data'],
|
||||
) );
|
||||
wp_send_json(
|
||||
array(
|
||||
'plugins' => $data['plugins'],
|
||||
'plugin_data' => $data['plugin_data'],
|
||||
)
|
||||
);
|
||||
|
||||
die();
|
||||
|
||||
@ -1082,7 +1124,7 @@ class GeneratePress_Site {
|
||||
* @param int $post_id Post ID.
|
||||
* @return void
|
||||
*/
|
||||
function track_post( $post_id ) {
|
||||
public function track_post( $post_id ) {
|
||||
update_post_meta( $post_id, '_generatepress_sites_imported_post', true );
|
||||
}
|
||||
|
||||
@ -1092,7 +1134,7 @@ class GeneratePress_Site {
|
||||
* @param int $term_id Term ID.
|
||||
* @return void
|
||||
*/
|
||||
function track_term( $term_id ) {
|
||||
public function track_term( $term_id ) {
|
||||
$term = get_term( $term_id );
|
||||
|
||||
update_term_meta( $term_id, '_generatepress_sites_imported_term', true );
|
||||
|
Reference in New Issue
Block a user