-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlockdown-wp-admin.php
50 lines (43 loc) · 1.38 KB
/
lockdown-wp-admin.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
49
50
<?php
/*
Plugin Name: Lockdown WP Admin
Plugin URI: http://seanfisher.co/lockdown-wp-admin/
Donate link: http://seanfisher.co/donate/
Description: Securing the WordPress Administration interface by concealing the administration dashboard and changing the login page URL.
Version: 2.3.2
Author: Sean Fisher
Author URI: http://seanfisher.co/
License: GPL
Text Domain: lockdown-wp-admin
*/
if ( ! defined( 'ABSPATH' ) ) { exit; }
// Lockdown WP Admin File Name.
define( 'LD_FILE_NAME', __FILE__ );
define( 'LD_PLUGIN_DIR', dirname( __FILE__ ) );
/**
* The function called at 'init'.
* Sets up the object
*
* One can overwrite the class used by Lockdown WP Admin by filtering `ld_class`.
* Adding a filter must be done before `init`.
*
* @return object
* @access private
* @since 1.0
* @see do_action() Called by the 'init' action.
* @throws Exception
*/
function ld_setup_auth() {
// Include Manager
require_once( LD_PLUGIN_DIR . '/src/Lockdown/Manager.php' );
// Instantiate the object
$class = apply_filters( 'ld_class', 'Lockdown_Manager' );
$object = call_user_func( $class.'::instance' );
// Ensure application integrity
if ( ! ( $object instanceof Lockdown_Manager ) ) {
throw new Exception( __( 'Lockdown Manager Class must be instance of Lockdown_Manager.', 'lockdown-wp-admin' ) );
}
return $object;
}
// Add default action to `init`
add_action( 'init', 'ld_setup_auth', 20 );