0 ) { $content = (string) get_post_field( 'post_content', $page ); $kind = has_shortcode( $content, 'woocommerce_checkout' ) ? 'shortcode' : ( has_block( 'woocommerce/checkout', $content ) ? 'Checkout block' : 'other' ); $add( 'Checkout page', '#' . $page . ' (' . $kind . ') ' . get_permalink( $page ) ); } else { $add( 'Checkout page', 'not set' ); } $lines[] = ''; $lines[] = '### WordPress'; $add( 'Site', home_url() ); $add( 'WordPress', get_bloginfo( 'version' ) ); $add( 'Multisite', is_multisite() ); $add( 'Language', get_locale() ); $add( 'WP_DEBUG', defined( 'WP_DEBUG' ) && WP_DEBUG ); $add( 'Object cache', wp_using_ext_object_cache() ); $add( 'Memory limit', WP_MEMORY_LIMIT ); $lines[] = ''; $lines[] = '### WooCommerce'; $add( 'WooCommerce', defined( 'WC_VERSION' ) ? WC_VERSION : '-' ); $hpos = class_exists( \Automattic\WooCommerce\Utilities\OrderUtil::class ) && method_exists( \Automattic\WooCommerce\Utilities\OrderUtil::class, 'custom_orders_table_usage_is_enabled' ) && \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled(); $add( 'HPOS', $hpos ); $add( 'Currency', function_exists( 'get_woocommerce_currency' ) ? get_woocommerce_currency() : '-' ); $add( 'Base country', function_exists( 'WC' ) && WC()->countries ? WC()->countries->get_base_country() : '-' ); $gateways = array(); if ( function_exists( 'WC' ) && WC()->payment_gateways() ) { foreach ( WC()->payment_gateways()->payment_gateways() as $id => $gateway ) { if ( is_object( $gateway ) && 'yes' === ( $gateway->enabled ?? 'no' ) ) { $gateways[] = (string) $id; } } } $add( 'Payment methods', $gateways ? implode( ', ', $gateways ) : '-' ); $lines[] = ''; $lines[] = '### Server'; $add( 'PHP', PHP_VERSION ); $add( 'Database', is_object( $wpdb ) && method_exists( $wpdb, 'db_server_info' ) ? (string) $wpdb->db_server_info() : '-' ); $add( 'Server', isset( $_SERVER['SERVER_SOFTWARE'] ) && is_string( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '-' ); $add( 'max_execution_time', (string) ini_get( 'max_execution_time' ) ); $add( 'memory_limit', (string) ini_get( 'memory_limit' ) ); $lines[] = ''; $lines[] = '### Theme'; $theme = wp_get_theme(); $add( 'Theme', $theme->get( 'Name' ) . ' ' . $theme->get( 'Version' ) ); if ( $theme->parent() ) { $add( 'Parent theme', $theme->parent()->get( 'Name' ) . ' ' . $theme->parent()->get( 'Version' ) ); } $add( 'Block theme', function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ); $lines[] = ''; $lines[] = '### Active plugins'; foreach ( self::plugins() as $plugin ) { $lines[] = $plugin; } $lines[] = ''; $lines[] = '### Settings (passwords, keys and tokens left out)'; $json = wp_json_encode( Transfer::data()['settings'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); $lines[] = is_string( $json ) ? $json : '{}'; /** * Filters the system information shown on the Tools tab. * * @since 1.6.0 * * @param string[] $lines Lines. */ return implode( "\n", (array) apply_filters( 'aiolos_system_info', $lines ) ); } /** * Active plugins (site and network) with their versions. * * @return string[] */ private static function plugins(): array { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all = get_plugins(); $active = (array) get_option( 'active_plugins', array() ); if ( is_multisite() ) { $active = array_merge( $active, array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) ) ); } $out = array(); foreach ( array_unique( array_filter( $active, 'is_string' ) ) as $file ) { $out[] = isset( $all[ $file ] ) ? $all[ $file ]['Name'] . ' ' . $all[ $file ]['Version'] . ' (' . $file . ')' : $file; } $mu = function_exists( 'get_mu_plugins' ) ? get_mu_plugins() : array(); foreach ( $mu as $file => $data ) { $out[] = $data['Name'] . ' ' . $data['Version'] . ' (must-use: ' . $file . ')'; } sort( $out, SORT_NATURAL | SORT_FLAG_CASE ); return $out; } }