$setting = $args[ $setting ]; } } } /** * @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; } /** * Deactivate the plugin again. */ public function deactivate() { if ( isset( $this->file ) ) { deactivate_plugins( plugin_basename( $this->file ) ); } } /** * @return bool True if the PHP version is high enough, false otherwise. */ private function php_passes() { if ( $this->__php_at_least( $this->php ) ) { return true; } else { add_action( 'admin_notices', array( $this, 'php_version_notice' ) ); return false; } } /** * Compare the current PHP version with the minimum required version. */ private static function __php_at_least( $min_version ) { return version_compare( phpversion(), $min_version, '>=' ); } /** * Show the PHP version notice. */ public function php_version_notice() { ?>

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

__wp_at_least( $this->wp ) ) { return true; } else { add_action( 'admin_notices', array( $this, 'wp_version_notice' ) ); return false; } } /** * Compare the current WordPress version with the minimum required version. */ private static function __wp_at_least( $min_version ) { return version_compare( get_bloginfo( 'version' ), $min_version, '>=' ); } /** * SHow the WordPress version notice. */ public function wp_version_notice() { ?>

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