| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Version Info |
| 4 |
* Plugin URI: https://wordpress.org/plugins/version-info |
| 5 |
* Description: Show current WordPress, PHP, Web Server and MySQL versions in admin footer. |
| 6 |
* Author: Gaucho Plugins |
| 7 |
* Author URI: https://gauchoplugins.com |
| 8 |
* Version: 1.3.1 |
| 9 |
* License: GPLv3 |
| 10 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 11 |
* Text Domain: version-info |
| 12 |
*/ |
| 13 |
// pseudo namespace |
| 14 |
class VersionInfo { |
| 15 |
|
| 16 |
private $db; |
| 17 |
|
| 18 |
public function __construct( wpdb $wpdb ) { |
| 19 |
$this->db = $wpdb; |
| 20 |
add_action( 'plugins_loaded', array( $this, 'load_text_domain' ) ); |
| 21 |
add_filter( 'update_footer', array( $this, 'version_in_footer' ), 11 ); |
| 22 |
} |
| 23 |
|
| 24 |
public function load_text_domain() { |
| 25 |
load_plugin_textdomain( 'version-info' ); |
| 26 |
} |
| 27 |
|
| 28 |
public function version_in_footer() { |
| 29 |
$update = core_update_footer(); |
| 30 |
$wp_version = strpos( $update, '<strong>' ) === 0 ? get_bloginfo( 'version' ) . ' (' . $update . ')' : get_bloginfo( 'version' ); |
| 31 |
|
| 32 |
$footer = sprintf( esc_attr__( 'You are running WordPress %s | PHP %s | %s | MySQL %s', 'version-info' ), $wp_version, phpversion(), $_SERVER['SERVER_SOFTWARE'], $this->db->get_var('SELECT VERSION();') ); |
| 33 |
|
| 34 |
if ((getenv('WP_ENVIRONMENT_TYPE') || defined('WP_ENVIRONMENT_TYPE')) && function_exists('wp_get_environment_type')) { |
| 35 |
$footer .= sprintf(' | Environment <code>%s</code>', wp_get_environment_type()); |
| 36 |
} |
| 37 |
|
| 38 |
return $footer; |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
global $wpdb; |
| 43 |
new VersionInfo( $wpdb ); |
| 44 |
|