$setting = $args[ $setting ]; } } } /** * Check if the install passes the requirements. * * @since 1.0.0 * @access public * * @return bool True if the install passes the requirements, false otherwise. */ public function passes() { $passes = $this->php_passes() && $this->wp_passes(); if ( ! $passes ) { add_action( 'admin_notices', array( $this, 'deactivate' ) ); } return $passes; } /** * Deactivates the plugin again. * * @since 1.0.0 * @access public */ public function deactivate() { if ( null !== $this->file ) { deactivate_plugins( plugin_basename( $this->file ) ); } } /** * Checks if the PHP version passes the requirement. * * @since 1.0.0 * @access protected * * @return bool True if the PHP version is high enough, false otherwise. */ protected function php_passes() { if ( self::_php_at_least( $this->php ) ) { return true; } add_action( 'admin_notices', array( $this, 'php_version_notice' ) ); return false; } /** * Compares the current PHP version with the minimum required version. * * @since 1.0.0 * @access protected * * @param string $min_version The minimum required version. * @return bool True if the PHP version is high enough, false otherwise. */ protected static function _php_at_least( $min_version ) { return version_compare( PHP_VERSION, $min_version, '>=' ); } /** * Displays the PHP version notice. * * @since 1.0.0 * @access public */ public function php_version_notice() { ?>

title ), $this->php ); ?>

wp ) ) { return true; } add_action( 'admin_notices', array( $this, 'wp_version_notice' ) ); return false; } /** * Compare the current WordPress version with the minimum required version. * * @since 1.0.0 * @access protected * * @param string $min_version Minimum required WordPress version. * @return bool True if the WordPress version is high enough, false otherwise. */ protected static function _wp_at_least( $min_version ) { return version_compare( get_bloginfo( 'version' ), $min_version, '>=' ); } /** * Show the WordPress version notice. * * @since 1.0.0 * @access public */ public function wp_version_notice() { ?>

title ), $this->wp ); ?>