diff --git a/lib/admin-page.php b/lib/admin-page.php index 8680089..1801485 100644 --- a/lib/admin-page.php +++ b/lib/admin-page.php @@ -449,6 +449,72 @@ function classicpress_check_can_migrate() { // TODO: Add instructions if WP too old. echo "\n"; + // Check: Conflicting Theme + $theme = wp_get_theme(); + if ( isset( $parameters['themes'] ) && + in_array( $theme->stylesheet, (array) $parameters['themes'] ) || + ( is_child_theme() && in_array( $theme->parent()->stylesheet, (array) $parameters['themes'] ) ) + ) { + $preflight_checks['theme'] = false; + echo "\n$icon_preflight_fail\n\n"; + printf( __( + /* translators: active theme name */ + 'It looks like you are using the %1$s theme. Unfortuantely it is incompatible with ClassicPress.', + 'switch-to-classicpress' + ), $theme->name ); + echo "
\n"; + _e( + 'Consider switching to a different theme, perhaps an older core theme, and try again.', + 'switch-to-classicpress' + ); + } else { + $preflight_checks['theme'] = true; + echo "\n$icon_preflight_warn\n\n"; + printf( __( + /* translators: active theme name */ + 'It looks like you are using the %1$s theme. We are not aware of any incompatibilities between this theme and ClassicPress.', + 'switch-to-classicpress' + ), $theme->name ); + } + echo "\n"; + + // Check: Conflicting Plugins + $plugins = get_option( 'active_plugins' ); + if ( isset( $parameters['plugins'] ) && $plugins !== array_diff( $plugins, $parameters['plugins'] ) ) { + $preflight_checks['plugins'] = false; + + $conflicting_plugins = array_intersect( $parameters['plugins'], $plugins ); + $conflicting_plugin_names = array(); + foreach( $conflicting_plugins as $conflicting_plugin ) { + $conflicting_plugin_data[] = get_plugin_data( WP_CONTENT_DIR . '/plugins/' . $conflicting_plugin ); + $conflicting_plugin_names[] = $conflicting_plugin_data[0]['Name']; + } + + echo "\n$icon_preflight_fail\n\n"; + _e( + 'We have detected one or more incompatible plugins that prevent migrating your site to ClassicPress.', + 'switch-to-classicpress' + ); + echo "
\n"; + _e( + 'Please deactivate the following plugins if you wish to continue migrating your site to ClassicPress:', + 'switch-to-classicpress' + ); + echo "
\n"; + /* translators: List of conflicting plugin names */ + printf( __( + '%s', + 'switch-to-classicpress' + ), implode( ', ', $conflicting_plugin_names ) ); + } else { + $preflight_checks['plugins'] = true; + echo "\n$icon_preflight_warn\n\n"; + _e( + 'We are not aware that any of your active plugins are incompatible with ClassicPress.', + 'switch-to-classicpress' + ); + } + // Check: Supported PHP version $php_version_min = '5.6'; if ( version_compare( PHP_VERSION, $php_version_min, 'lt' ) ) { @@ -600,6 +666,8 @@ function classicpress_check_can_migrate() { if ( $preflight_checks['wp_version'] && + $preflight_checks['theme'] && + $preflight_checks['plugins'] && $preflight_checks['php_version'] && $preflight_checks['wp_http_supports_ssl'] ) {