From 332e689a33f69ca2ea2265c1617ad90b480be366 Mon Sep 17 00:00:00 2001
From: dyszczo <krzysiek@inspirelabs.pl>
Date: Fri, 7 Dec 2018 14:16:46 +0100
Subject: [PATCH] requirement class can render or disable

---
 src/Basic_Requirement_Checker.php | 37 +++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/Basic_Requirement_Checker.php b/src/Basic_Requirement_Checker.php
index 538599d..104d548 100644
--- a/src/Basic_Requirement_Checker.php
+++ b/src/Basic_Requirement_Checker.php
@@ -340,19 +340,52 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
 	 * @return bool
 	 */
 	public static function is_setting_set( $name, $value ) {
-		return ini_get( $name ) === strval( $value );
+		return ini_get( $name ) === (string) $value;
 	}
 
 	/**
 	 * @return void
+     *
+     * @deprecated use render_notices or disable_plugin
 	 */
 	public function disable_plugin_render_notice() {
 		add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'render_notices_action' ) );
 	}
 
+    /**
+     * Renders requirement notices in admin panel
+     *
+     * @return void
+     */
+    public function render_notices() {
+        add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'render_notices_action' ) );
+    }
+
+    /**
+     * Renders requirement notices in admin panel
+     *
+     * @return void
+     */
+    public function disable_plugin() {
+        add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'deactivate_action' ) );
+    }
+
+    /**
+     * @internal Do not use as public. Public only for wp action.
+     *
+     * @return void
+     */
+    public function deactivate_action() {
+        if ( isset( $this->plugin_file ) ) {
+            deactivate_plugins( plugin_basename( $this->plugin_file ) );
+        }
+    }
+
 	/**
-	 * Shoud be called as WordPress action
+	 * Should be called as WordPress action
 	 *
+     * @internal Do not use as public. Public only for wp action.
+     *
 	 * @return void
 	 */
 	public function render_notices_action() {
-- 
GitLab