$setting = $args[$setting]; } } } public function passes() { $passes = $this->php_passes() && $this->wp_passes(); if ( ! $passes ) { add_action( 'admin_notices', array( $this, 'deactivate' ) ); } return $passes; } public function deactivate() { if ( isset( $this->file ) ) { deactivate_plugins( plugin_basename( $this->file ) ); } } 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; } } private static function __php_at_least( $min_version ) { return version_compare( phpversion(), $min_version, '>=' ); } public function php_version_notice() { echo '
The “" . esc_html( $this->title ) . "” plugin cannot run on PHP versions older than " . $this->php . '. Please contact your host and ask them to upgrade.
'; echo 'The “" . esc_html( $this->title ) . "” plugin cannot run on WordPress versions older than " . $this->wp . '. Please update WordPress.
'; echo '