This repository has been archived by the owner on Nov 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
class-reception.php
118 lines (103 loc) · 2.37 KB
/
class-reception.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* Réception: page d'accueil des membres BuddyPress personnalisable à l'aide de blocs WordPress.
*
* @package reception
* @author imath
* @license GPL-2.0+
* @link https://imathi.eu
*
* @wordpress-plugin
* Plugin Name: Réception
* Plugin URI: https://github.com/imath/reception
* Description: Page d'accueil des membres BuddyPress personnalisable à l'aide de blocs WordPress.
* Version: 1.0.0
* Author: imath
* Author URI: https://imathi.eu
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages/
* Text Domain: reception
* GitHub Plugin URI: https://github.com/imath/reception
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Main Class
*
* @since 1.0.0
*/
final class Reception {
/**
* Instance of this class.
*
* @var object
*/
protected static $instance = null;
/**
* Initializes the plugin.
*
* @since 1.0.0
*/
private function __construct() {
// Autoload Classes.
spl_autoload_register( array( $this, 'autoload' ) );
// Includes path.
$inc_path = plugin_dir_path( __FILE__ ) . 'inc/';
// Load Globals & Functions.
require $inc_path . 'globals.php';
require $inc_path . 'functions.php';
require $inc_path . 'capabilities.php';
if ( wp_using_themes() ) {
require $inc_path . 'templates.php';
}
// Load Admin.
if ( is_admin() ) {
require $inc_path . 'admin.php';
}
}
/**
* Class Autoload function.
*
* @since 1.0.0
*
* @param string $class The class name.
*/
public function autoload( $class ) {
$name = str_replace( '_', '-', strtolower( $class ) );
if ( 0 !== strpos( $name, 'reception' ) ) {
return;
}
$path = plugin_dir_path( __FILE__ ) . "inc/classes/class-{$name}.php";
// Sanity check.
if ( ! file_exists( $path ) ) {
return;
}
require $path;
}
/**
* Returns an instance of this class.
*
* @since 1.0.0
*/
public static function start() {
// If the single instance hasn't been set, set it now.
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
}
/**
* Starts the plugin.
*
* @since 1.0.0
*
* @return Reception The main instance of the plugin.
*/
function reception() {
return Reception::start();
}
add_action( 'bp_include', 'reception', 7 );