Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 24
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3use function NewfoldLabs\WP\ModuleLoader\register;
4
5if ( function_exists( 'add_action' ) ) {
6
7    add_action(
8        'plugins_loaded',
9        function () {
10
11            // Unregister actions from the sso.php mu-plugin in case they exist
12            // This ensures that this code always takes priority for SSO handling
13            remove_action( 'wp_ajax_nopriv_sso-check', 'sso_check' );
14            remove_action( 'wp_ajax_sso-check', 'sso_check' );
15
16            register(
17                array(
18                    'name'     => 'sso',
19                    'label'    => __( 'SSO', 'wp-module-sso' ),
20                    'callback' => function () {
21
22                        if ( ! defined( 'NFD_SSO_DIR' ) ) {
23                            define( 'NFD_SSO_DIR', __DIR__ );
24                        }
25                        if ( ! defined( 'NFD_SSO_URL' ) ) {
26                            define( 'NFD_SSO_URL', plugins_url( '', __DIR__ . '/sso.php' ) );
27                        }
28                        if ( ! defined( 'NFD_SSO_VERSION' ) ) {
29                            // Update on every release. Used as the asset cache-buster for
30                            // enqueued styles/scripts. There is currently no `version` field
31                            // in this module's composer.json, so this is the de-facto source.
32                            define( 'NFD_SSO_VERSION', '1.3.0' );
33                        }
34
35                        require __DIR__ . '/sso.php';
36                    },
37                    'isActive' => true,
38                    'isHidden' => true,
39                )
40            );
41        }
42    );
43
44}