From edd28d7249d221b1c0aa857b28e82cdb4504814c Mon Sep 17 00:00:00 2001 From: Muhammad Zohaib Date: Sat, 30 Sep 2023 16:27:44 +0500 Subject: [PATCH 1/3] Fixed a minor bug --- helpers/class-defaults.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/class-defaults.php b/helpers/class-defaults.php index f7fc8d9..557db49 100644 --- a/helpers/class-defaults.php +++ b/helpers/class-defaults.php @@ -15,7 +15,7 @@ class Defaults { function __construct() { // General - Self::$default = 'default'; + self::$default = 'default'; } From ed6f8dfbc113a600ebdf5a997d948923a235ab80 Mon Sep 17 00:00:00 2001 From: Muhammad Zohaib Date: Sat, 30 Sep 2023 16:28:47 +0500 Subject: [PATCH 2/3] Added debug property --- helpers/class-plugin-options.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/helpers/class-plugin-options.php b/helpers/class-plugin-options.php index eabd01e..a6b7cbb 100644 --- a/helpers/class-plugin-options.php +++ b/helpers/class-plugin-options.php @@ -7,7 +7,7 @@ namespace Xe_Plugin\Helpers; -use Xe_Plugin\Helpers\Helpers as Helper; +use Xe_Plugin\Helpers\Helpers; use Xe_Plugin\Helpers\Defaults as De; class Plugin_Options { @@ -18,7 +18,7 @@ class Plugin_Options { function __construct() { // Assign Option values to variables - add_action('init', array($this, 'init_vars')); + add_action( 'init', [ $this, 'init_vars' ] ); } @@ -28,10 +28,30 @@ function __construct() { public function init_vars() { // Others + $this->debug = $this->debug(); $this->localhost = $this->localhost(); } + /** + * # Check if debug mode and log is enabled + */ + protected function debug() { + + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { + + if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { + + return true; + + } + + } + + return false; + + } + /** * # Check if its localhost */ @@ -42,10 +62,14 @@ protected function localhost() { '::1' ); - if (in_array($_SERVER['REMOTE_ADDR'], $localhost)){ + if ( in_array( $_SERVER['REMOTE_ADDR'], $localhost ) ) { + return true; + } else { + return false; + } } From 687aee3292b10e65ba0e06b723e8684321b20b22 Mon Sep 17 00:00:00 2001 From: Muhammad Zohaib Date: Sat, 30 Sep 2023 16:29:31 +0500 Subject: [PATCH 3/3] Closed #43 --- helpers/class-plugin-options.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/helpers/class-plugin-options.php b/helpers/class-plugin-options.php index eabd01e..a6b7cbb 100644 --- a/helpers/class-plugin-options.php +++ b/helpers/class-plugin-options.php @@ -7,7 +7,7 @@ namespace Xe_Plugin\Helpers; -use Xe_Plugin\Helpers\Helpers as Helper; +use Xe_Plugin\Helpers\Helpers; use Xe_Plugin\Helpers\Defaults as De; class Plugin_Options { @@ -18,7 +18,7 @@ class Plugin_Options { function __construct() { // Assign Option values to variables - add_action('init', array($this, 'init_vars')); + add_action( 'init', [ $this, 'init_vars' ] ); } @@ -28,10 +28,30 @@ function __construct() { public function init_vars() { // Others + $this->debug = $this->debug(); $this->localhost = $this->localhost(); } + /** + * # Check if debug mode and log is enabled + */ + protected function debug() { + + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { + + if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { + + return true; + + } + + } + + return false; + + } + /** * # Check if its localhost */ @@ -42,10 +62,14 @@ protected function localhost() { '::1' ); - if (in_array($_SERVER['REMOTE_ADDR'], $localhost)){ + if ( in_array( $_SERVER['REMOTE_ADDR'], $localhost ) ) { + return true; + } else { + return false; + } }