Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug mode #44

Merged
merged 4 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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