-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpressbooks-saml-sso.php
More file actions
55 lines (48 loc) · 2.6 KB
/
pressbooks-saml-sso.php
File metadata and controls
55 lines (48 loc) · 2.6 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* Plugin Name: Pressbooks SAML2 Single Sign-On
* Plugin URI: https://pressbooks.org
* Description: SAML2 Single Sign-On integration for Pressbooks (Shibboleth, Microsoft ADFS, Google Apps, etc.)
* Version: 2.5.0
* Requires at least: 6.5
* Requires PHP: 8.1
* Requires Plugins: pressbooks
* Author: Pressbooks (Book Oven Inc.)
* Author URI: https://pressbooks.org
* License: GPL v3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: pressbooks-saml-sso
* Domain Path: /languages
* Network: True
* GitHub Plugin URI: pressbooks/pressbooks-saml-sso
* Release Asset: true
*/
// -------------------------------------------------------------------------------------------------------------------
// Class autoloader
// -------------------------------------------------------------------------------------------------------------------
\HM\Autoloader\register_class_path( 'PressbooksSamlSso', __DIR__ . '/inc' );
// -------------------------------------------------------------------------------------------------------------------
// Composer autoloader
// -------------------------------------------------------------------------------------------------------------------
if ( ! class_exists( '\OneLogin\Saml2\Auth' ) ) {
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
} else {
$title = __( 'Dependencies Missing', 'pressbooks-saml-sso' );
$body = __( 'Please run <code>composer install</code> from the root of the Pressbooks SAML2 Single Sign-On plugin directory.', 'pressbooks-saml-sso' );
$message = "<h1>{$title}</h1><p>{$body}</p>";
wp_die( $message, $title );
}
}
// -------------------------------------------------------------------------------------------------------------------
// Requires
// -------------------------------------------------------------------------------------------------------------------
require( __DIR__ . '/inc/namespace.php' );
// -------------------------------------------------------------------------------------------------------------------
// Hooks
// -------------------------------------------------------------------------------------------------------------------
add_action( 'plugins_loaded', function() {
\Pressbooks\Container::get( 'Blade' )->addNamespace( 'PressbooksSamlSso', __DIR__ . '/templates' );
} );
add_action( 'plugins_loaded', [ '\PressbooksSamlSso\SAML', 'init' ] );
add_action( 'plugins_loaded', [ '\PressbooksSamlSso\Admin', 'init' ] );