Skip to content

Commit

Permalink
Merge pull request #171 from ryanwelcher/feature/filter-debug-constants
Browse files Browse the repository at this point in the history
Feature/filter debug constants
  • Loading branch information
psignoret authored Feb 21, 2018
2 parents 5c9f647 + 45ca008 commit 137ff4a
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions aad-sso-wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: http://github.com/psignoret/aad-sso-wordpress
Description: Allows you to use your organization's Azure Active Directory user accounts to log in to WordPress. If your organization is using Office 365, your user accounts are already in Azure Active Directory. This plugin uses OAuth 2.0 to authenticate users, and the Azure Active Directory Graph to get group membership and other details.
Author: Philippe Signoret
Version: 0.6.2
Version: 0.6.3
Author URI: https://www.psignoret.com/
Text Domain: aad-sso-wordpress
Domain Path: /languages/
Expand All @@ -17,7 +17,7 @@
define( 'AADSSO_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'AADSSO_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );

defined( 'AADSSO_DEBUG' ) or define( 'AADSSO_DEBUG', FALSE );
defined( 'AADSSO_DEBUG' ) or define( 'AADSSP_DEBUG', FALSE );
defined( 'AADSSO_DEBUG_LEVEL' ) or define( 'AADSSO_DEBUG_LEVEL', 0 );

// Proxy to be used for calls, should be useful for tracing with Fiddler
Expand Down Expand Up @@ -638,8 +638,24 @@ public static function debug_log( $message, $level = 0 ) {
*/
do_action( 'aadsso_debug_log', $message );

// AADSSO_DEBUG and AADSSO_DEBUG_LEVEL are already defined.
if ( AADSSO_DEBUG && AADSSO_DEBUG_LEVEL >= $level ) {
/**
* Allow other plugins or themes to set the debug status of this plugin.
*
* @since 0.6.3
* @param bool The current debug status.
*/
$debug_enabled = apply_filters( 'aadsso_debug', AADSSO_DEBUG );


/**
* Allow other plugins or themes to set the debug level
* @since 0.6.3
* @param int
*/
$debug_level = apply_filters( 'aadsso_debug_level', AADSSO_DEBUG_LEVEL );


if ( true === $debug_enabled && $debug_level >= $level ) {
if ( false === strpos( $message, "\n" ) ) {
error_log( 'AADSSO: ' . $message );
} else {
Expand Down

0 comments on commit 137ff4a

Please sign in to comment.