Server IP : 172.67.157.199 / Your IP : 18.227.48.248 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/defender-security/src/component/security-tweaks/ |
Upload File : |
<?php /** * Handles * * @package WP_Defender\Component\Security_Tweaks */ namespace WP_Defender\Component\Security_Tweaks; use Calotes\Base\Component; /** * Class WP_Version */ class WP_Version extends Component { /** * Component slug name. * * @var string */ public $slug = 'wp-version'; /** * Check whether the issue has been resolved or not. * * @return bool */ public function check() { return $this->is_resolved(); } /** * Here is the code for processing. * * @return bool */ public function process() { return true; } /** * This is for un-do stuff that has be done in @process. * * @return bool */ public function revert() { return true; } /** * Shield up. * * @return bool */ public function shield_up() { return true; } /** * Check whether the issue is resolved or not. * * @return bool */ private function is_resolved() { global $wp_version; return version_compare( $wp_version, $this->get_latest_version(), '=' ); } /** * Get the latest WordPress version. * * @return string|false on failure */ public function get_latest_version() { if ( ! function_exists( 'get_core_updates' ) ) { include_once ABSPATH . 'wp-admin/includes/update.php'; } $data = get_core_updates(); if ( empty( $data ) ) { wp_version_check( array(), true ); $data = get_core_updates( array( 'dismissed' => true ) ); } // For bool value and empty array. if ( empty( $data ) ) { return false; } return reset( $data )->version; } /** * Return a summary data of this tweak. * * @return array */ public function to_array() { return array( 'slug' => $this->slug, 'title' => esc_html__( 'Update WordPress to latest version', 'defender-security' ), 'errorReason' => sprintf( /* translators: %s: WP Version */ esc_html__( 'Your current WordPress version is out of date, which means you could be missing out on the latest security patches in v%s', 'defender-security' ), $this->get_latest_version() ), 'successReason' => esc_html__( 'You are using the latest version of WordPress, great job!', 'defender-security' ), 'misc' => array( 'latest_wp' => $this->get_latest_version(), 'core_update_url' => network_admin_url( 'update-core.php' ), ), 'bulk_description' => esc_html__( 'Your current WordPress version is out of date, which means you could be missing out on the latest update. We will upgrade WordPress version to the latest.', 'defender-security' ), 'bulk_title' => esc_html__( 'WordPress Version', 'defender-security' ), ); } }