Migrate) and the note that points to it. * * For every table plugin found on the site: what was found, where it is used, what carries over and what does * not, a recommendation, and the actions (copy, keep old shortcodes working). Source data is never changed. * * @package NitidaTables */ namespace NitidaTables; defined( 'ABSPATH' ) || exit; require_once __DIR__ . '/class-kses.php'; /** * Admin UI for Migrate. */ final class MigrateAdmin { const SLUG = 'nitida-tables-migrate'; const DISMISSED = 'nitida_tables_migrate_notice_dismissed'; public static function init() { add_action( 'admin_menu', array( __CLASS__, 'register_menu' ), 15 ); add_action( 'admin_post_nitida_tables_migrate', array( __CLASS__, 'handle' ) ); add_action( 'admin_post_nitida_tables_dismiss_migrate_notice', array( __CLASS__, 'handle_dismiss' ) ); add_action( 'nitida_tables_migrate_takeover', array( __CLASS__, 'purge_page_caches' ) ); } public static function url( array $args = array() ) { return add_query_arg( array_merge( array( 'page' => self::SLUG ), $args ), admin_url( 'admin.php' ) ); } public static function register_menu() { add_submenu_page( Admin::SLUG, __( 'Migrate to Nitida Tables', 'nitida-tables' ), __( 'From other plugins', 'nitida-tables' ), 'manage_options', self::SLUG, array( __CLASS__, 'render' ), 3 ); } /** Pages render the old shortcodes differently now: clear the page caches we know about. */ public static function purge_page_caches() { if ( function_exists( 'rocket_clean_domain' ) ) { rocket_clean_domain(); } do_action( 'litespeed_purge_all' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- LiteSpeed Cache hook. if ( function_exists( 'w3tc_flush_all' ) ) { w3tc_flush_all(); } if ( function_exists( 'wp_cache_clear_cache' ) ) { wp_cache_clear_cache(); } } /* --------------------------------------------------------------------- * Note on the All tables screen * ------------------------------------------------------------------ */ public static function notice() { if ( ! current_user_can( 'manage_options' ) || get_user_meta( get_current_user_id(), self::DISMISSED, true ) ) { return; } $p = Migrate::pending(); if ( $p['tables'] < 1 ) { return; } $scan = Migrate::scan(); $parts = array(); foreach ( $p['sources'] as $key => $n ) { $parts[] = $scan[ $key ]['label'] . ': ' . (int) $n; } $dismiss = wp_nonce_url( admin_url( 'admin-post.php?action=nitida_tables_dismiss_migrate_notice' ), 'nitida_tables_dismiss_migrate_notice' ); echo '
' . esc_html( sprintf( _n( '%1$d table block with five or more columns, in %2$d post or page. It is part of the post, so it is not copied here.', '%1$d table blocks with five or more columns, in %2$d posts and pages. They are part of each post, so they are not copied here.', (int) $core['tables'], 'nitida-tables' ), $core['tables'], $core['posts'] ) ) . '
'; if ( $pro ) { echo '