Skip to content

Commit

Permalink
Merge pull request #44 from zohaib87/debug_mode
Browse files Browse the repository at this point in the history
Debug mode
  • Loading branch information
zohaib87 authored Sep 30, 2023
2 parents 8e8c41f + bf10148 commit 77ff6f4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion helpers/class-defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Defaults {
function __construct() {

// General
Self::$default = 'default';
self::$default = 'default';

}

Expand Down
30 changes: 27 additions & 3 deletions helpers/class-plugin-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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' ] );

}

Expand All @@ -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
*/
Expand All @@ -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;

}

}
Expand Down

0 comments on commit 77ff6f4

Please sign in to comment.