array( 'label' => string, 'value' => mixed ). */ class SystemInfo { /** * Ad Commander plugin information. * * @return array */ public static function adcommander() { $info = array( 'version' => array( 'label' => __( 'Version', 'ad-commander' ), 'value' => AdCommander::version(), ), 'db_version' => array( 'label' => __( 'Database Version', 'ad-commander' ), 'value' => Util::get_dbversion(), ), 'pro_loaded' => array( 'label' => __( 'Pro Loaded', 'ad-commander' ), 'value' => ProBridge::instance()->is_pro_loaded(), ), ); if ( ProBridge::instance()->is_pro_loaded() ) { $info['pro_version'] = array( 'label' => __( 'Pro Version', 'ad-commander' ), 'value' => defined( 'ADCMDR_PRO_LOADED' ) && class_exists( '\ADCmdr\AdCommanderPro' ) ? \ADCmdr\AdCommanderPro::version() : '—', ); $info['pro_license'] = array( 'label' => __( 'Pro License', 'ad-commander' ), 'value' => ProBridge::instance()->is_pro_license_added(), ); } return $info; } /** * WordPress environment. * * @return array */ public static function environment() { return array( 'home_url' => array( 'label' => __( 'Home URL', 'ad-commander' ), 'value' => home_url(), ), 'site_url' => array( 'label' => __( 'Site URL', 'ad-commander' ), 'value' => site_url(), ), 'rest_url' => array( 'label' => __( 'REST API Base URL', 'ad-commander' ), 'value' => rest_url(), ), 'wp_version' => array( 'label' => __( 'WordPress Version', 'ad-commander' ), 'value' => get_bloginfo( 'version' ), ), 'multisite' => array( 'label' => __( 'WordPress Multisite', 'ad-commander' ), 'value' => is_multisite(), ), 'wp_memory' => array( 'label' => __( 'WordPress Memory Limit', 'ad-commander' ), 'value' => WP_MEMORY_LIMIT, ), 'debug_mode' => array( 'label' => __( 'WordPress Debug Mode', 'ad-commander' ), 'value' => defined( 'WP_DEBUG' ) && WP_DEBUG, ), 'debug_log' => array( 'label' => __( 'WordPress Debug Log', 'ad-commander' ), 'value' => defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG, ), 'wp_cron' => array( 'label' => __( 'WordPress Cron', 'ad-commander' ), 'value' => ! ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ), ), 'locale' => array( 'label' => __( 'WordPress Locale', 'ad-commander' ), 'value' => get_locale(), ), ); } /** * Active theme details. * * @return array */ public static function theme() { $theme = wp_get_theme(); $info = array( 'name' => array( 'label' => __( 'Theme Name', 'ad-commander' ), 'value' => $theme->get( 'Name' ), ), 'version' => array( 'label' => __( 'Theme Version', 'ad-commander' ), 'value' => $theme->get( 'Version' ), ), 'author' => array( 'label' => __( 'Theme Author', 'ad-commander' ), 'value' => wp_strip_all_tags( (string) $theme->get( 'Author' ) ), ), ); if ( $theme->parent() ) { $info['parent_name'] = array( 'label' => __( 'Parent Theme', 'ad-commander' ), 'value' => $theme->parent()->get( 'Name' ), ); $info['parent_version'] = array( 'label' => __( 'Parent Theme Version', 'ad-commander' ), 'value' => $theme->parent()->get( 'Version' ), ); } return $info; } /** * Active plugins: name => array with author/version detail. * * @return array */ public static function active_plugins() { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $active_plugins = get_option( 'active_plugins', array() ); $all_plugins = get_plugins(); $plugins = array(); foreach ( $active_plugins as $plugin_path ) { if ( ! isset( $all_plugins[ $plugin_path ] ) ) { continue; } $plugin = $all_plugins[ $plugin_path ]; $plugins[ $plugin_path ] = array( 'name' => $plugin['Name'], 'author' => isset( $plugin['AuthorName'] ) ? $plugin['AuthorName'] : '', 'version' => $plugin['Version'], ); } return $plugins; } /** * Server environment. * * @return array */ public static function server() { return array( 'web_server' => array( 'label' => __( 'Web Server', 'ad-commander' ), 'value' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : __( 'Unknown', 'ad-commander' ), ), 'php_version' => array( 'label' => __( 'PHP Version', 'ad-commander' ), 'value' => function_exists( 'phpversion' ) ? phpversion() : __( 'Unknown', 'ad-commander' ), ), 'php_memory_limit' => array( 'label' => __( 'PHP Memory Limit', 'ad-commander' ), 'value' => function_exists( 'ini_get' ) ? ini_get( 'memory_limit' ) : __( 'Unknown', 'ad-commander' ), ), 'php_max_execution' => array( 'label' => __( 'PHP Max Execution Time', 'ad-commander' ), 'value' => function_exists( 'ini_get' ) ? ini_get( 'max_execution_time' ) : __( 'Unknown', 'ad-commander' ), ), 'php_max_upload' => array( 'label' => __( 'PHP Max Upload Size', 'ad-commander' ), 'value' => function_exists( 'ini_get' ) ? ini_get( 'upload_max_filesize' ) : __( 'Unknown', 'ad-commander' ), ), 'php_max_post' => array( 'label' => __( 'PHP Max Post Size', 'ad-commander' ), 'value' => function_exists( 'ini_get' ) ? ini_get( 'post_max_size' ) : __( 'Unknown', 'ad-commander' ), ), 'curl' => array( 'label' => __( 'cURL Enabled', 'ad-commander' ), 'value' => function_exists( 'curl_version' ) ? __( 'Yes', 'ad-commander' ) . ' (' . curl_version()['version'] . ')' : __( 'No', 'ad-commander' ), ), 'openssl' => array( 'label' => __( 'OpenSSL', 'ad-commander' ), 'value' => defined( 'OPENSSL_VERSION_TEXT' ) ? OPENSSL_VERSION_TEXT : __( 'No', 'ad-commander' ), ), ); } /** * Database environment. * * @return array */ public static function database() { global $wpdb; return array( 'system' => array( 'label' => __( 'Database System', 'ad-commander' ), 'value' => ! empty( $wpdb->db_server_info() ) ? $wpdb->db_server_info() : __( 'Unknown', 'ad-commander' ), ), 'version' => array( 'label' => __( 'Database Version', 'ad-commander' ), 'value' => $wpdb->db_version(), ), 'charset' => array( 'label' => __( 'Database Character Set', 'ad-commander' ), 'value' => ! empty( $wpdb->charset ) ? $wpdb->charset : __( 'Unknown', 'ad-commander' ), ), 'collation' => array( 'label' => __( 'Database Collation', 'ad-commander' ), 'value' => ! empty( $wpdb->collate ) ? $wpdb->collate : __( 'Unknown', 'ad-commander' ), ), 'prefix' => array( 'label' => __( 'Database Prefix', 'ad-commander' ), 'value' => $wpdb->prefix, ), ); } /** * Date and time. * * @return array */ public static function datetime() { return array( 'timezone' => array( 'label' => __( 'WordPress Timezone', 'ad-commander' ), 'value' => wp_timezone_string(), ), 'server_time' => array( 'label' => __( 'Server Time (UTC)', 'ad-commander' ), 'value' => gmdate( 'Y-m-d H:i:s' ), ), 'local_time' => array( 'label' => __( 'Local Time', 'ad-commander' ), 'value' => wp_date( 'Y-m-d H:i:s' ), ), ); } }