-
Notifications
You must be signed in to change notification settings - Fork 0
/
bp-cl-oauth.php
42 lines (34 loc) · 1.18 KB
/
bp-cl-oauth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Plugin Name: Bonnier OAuth Plugin
* Version: 2.3.6
* Plugin URI: https://github.com/BenjaminMedia/wp-cl-oauth
* Description: This plugin allows you to integrate your site with an OAuth2 service
* Author: Bonnier
* License: GPL v3
*/
// Do not access this file directly
if (!defined('ABSPATH')) {
exit;
}
require_once (__DIR__ . '/vendor/autoload.php');
require_once (__DIR__ . '/src/api.php');
spl_autoload_register(function ($className) {
$namespace = 'Bonnier\\WP\\OAuth\\';
if (str_contains($className, $namespace)) {
// Convert `Bonnier\WP\OAuth\Providers\CommonLoginProvider`
// to `__DIR__/src/Providers/CommonLoginProvider`
$className = str_replace([$namespace, '\\'], [__DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $className);
$file = $className . '.php';
if(file_exists($file)) {
require_once($className . '.php');
} else {
throw new Exception(sprintf('\'%s\' does not exist!', $file));
}
}
});
function register_bp_cl_oauth()
{
return \Bonnier\WP\OAuth\WpOAuth::instance();
}
add_action('plugins_loaded', 'register_bp_cl_oauth', 10);