-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssopress.php
48 lines (45 loc) · 1.67 KB
/
ssopress.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
43
44
45
46
47
48
<?php if(!defined('ABSPATH')) die(); ?>
<?php
/*
Plugin Name: SSO Press
Plugin URI: https://github.com/justinoue/SSOPress
Description: Easy Single Sign-on for Wordpress. Adds a Single Sign-on menu option to the settings menu <a href="/wp-admin/options-general.php?page=ssopress"> here</a>.
Version: 0.2.2
Author: Justin Ouellette
Author URI: http://jouellette.com
*/
if(!class_exists('SSOPress')){
require('requires.php');
class SSOPress{
public static $options_var = 'ssopress';
public static $flash_messages_var = 'ssopress_flash_messages';
public function __construct(){
$this->activation_hooks();
$this->hooks();
}
public function hooks(){
add_action('init', [new \SSOPress\Core\URLRewriter, 'init']);
add_action('parse_query', [new \SSOPress\Core\Router, 'parse_query']);
add_action('admin_menu', [new \SSOPress\Controllers\AdminController, 'admin_menu']);
add_action('init', [new \SSOPress\Controllers\LoginController, 'init'], 0);
}
public function activation_hooks(){
register_activation_hook(__FILE__, [$this, 'activate'], 0);
register_deactivation_hook(__FILE__, [$this, 'deactivate'], 0);
}
public function activate(){
if(get_option(self::$options_var)){
delete_option(self::$options_var);
}
add_option(self::$options_var, \SSOPress\Core\Config::$defaults, '', 'yes');
flush_rewrite_rules();
}
public function deactivate(){
delete_option(self::$options_var);
flush_rewrite_rules();
}
}
}
if(class_exists('SSOPress')){
$ssopress = new SSOPress();
}