-
Notifications
You must be signed in to change notification settings - Fork 1
/
version-info.php
52 lines (44 loc) · 1.61 KB
/
version-info.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* WordPress Version Info
*
* @package wp-version-info
* @author Alexander Goller <alpipego@gmail.com>
* @copyright 2019 Alexander Goller
* @license MIT
*
* @wordpress-plugin
*
* Plugin Name: WordPress Version Info
* Plugin URI: https://wordpress.org/plugins/version-info
* Description: Show current WordPress, PHP, Web Server and MySQL versions in admin footer
* Author: alpipego
* Author URI: http://alpipego.com/
* Version: 1.3.0
* License: MIT
* GitHub Plugin URI: https://github.com/alpipego/wp-version-info
* Text Domain: version-info
*/
// pseudo namespace
class VersionInfo {
private $db;
public function __construct( wpdb $wpdb ) {
$this->db = $wpdb;
add_action( 'plugins_loaded', array( $this, 'load_text_domain' ) );
add_filter( 'update_footer', array( $this, 'version_in_footer' ), 11 );
}
public function load_text_domain() {
load_plugin_textdomain( 'version-info' );
}
public function version_in_footer() {
$update = core_update_footer();
$wp_version = strpos( $update, '<strong>' ) === 0 ? get_bloginfo( 'version' ) . ' (' . $update . ')' : get_bloginfo( 'version' );
$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();') );
if ((getenv('WP_ENVIRONMENT_TYPE') || defined('WP_ENVIRONMENT_TYPE')) && function_exists('wp_get_environment_type')) {
$footer .= sprintf(' | Environment <code>%s</code>', wp_get_environment_type());
}
return $footer;
}
}
global $wpdb;
new VersionInfo( $wpdb );