Skip to content

Commit 137ff4a

Browse files
authored
Merge pull request #171 from ryanwelcher/feature/filter-debug-constants
Feature/filter debug constants
2 parents 5c9f647 + 45ca008 commit 137ff4a

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

aad-sso-wordpress.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Plugin URI: http://github.com/psignoret/aad-sso-wordpress
66
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.
77
Author: Philippe Signoret
8-
Version: 0.6.2
8+
Version: 0.6.3
99
Author URI: https://www.psignoret.com/
1010
Text Domain: aad-sso-wordpress
1111
Domain Path: /languages/
@@ -17,7 +17,7 @@
1717
define( 'AADSSO_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
1818
define( 'AADSSO_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
1919

20-
defined( 'AADSSO_DEBUG' ) or define( 'AADSSO_DEBUG', FALSE );
20+
defined( 'AADSSO_DEBUG' ) or define( 'AADSSP_DEBUG', FALSE );
2121
defined( 'AADSSO_DEBUG_LEVEL' ) or define( 'AADSSO_DEBUG_LEVEL', 0 );
2222

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

641-
// AADSSO_DEBUG and AADSSO_DEBUG_LEVEL are already defined.
642-
if ( AADSSO_DEBUG && AADSSO_DEBUG_LEVEL >= $level ) {
641+
/**
642+
* Allow other plugins or themes to set the debug status of this plugin.
643+
*
644+
* @since 0.6.3
645+
* @param bool The current debug status.
646+
*/
647+
$debug_enabled = apply_filters( 'aadsso_debug', AADSSO_DEBUG );
648+
649+
650+
/**
651+
* Allow other plugins or themes to set the debug level
652+
* @since 0.6.3
653+
* @param int
654+
*/
655+
$debug_level = apply_filters( 'aadsso_debug_level', AADSSO_DEBUG_LEVEL );
656+
657+
658+
if ( true === $debug_enabled && $debug_level >= $level ) {
643659
if ( false === strpos( $message, "\n" ) ) {
644660
error_log( 'AADSSO: ' . $message );
645661
} else {

0 commit comments

Comments
 (0)