-
Notifications
You must be signed in to change notification settings - Fork 1
/
progress-planner.php
69 lines (60 loc) · 1.68 KB
/
progress-planner.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
<?php
/**
* A plugin to help you fight procrastination and get things done.
*
* @package Progress_Planner
*
* Plugin name: Progress Planner
* Plugin URI: https://prpl.fyi/home
* Description: A plugin to help you fight procrastination and get things done.
* Requires at least: 6.3
* Requires PHP: 7.4
* Version: 0.9.6
* Author: Team Emilia Projects
* Author URI: https://prpl.fyi/about
* License: GPL-3.0+
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: progress-planner
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'PROGRESS_PLANNER_FILE', __FILE__ );
define( 'PROGRESS_PLANNER_DIR', __DIR__ );
define( 'PROGRESS_PLANNER_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
/**
* Autoload classes.
*/
spl_autoload_register(
function ( $class_name ) {
$prefix = 'Progress_Planner\\';
if ( 0 !== \strpos( $class_name, $prefix ) ) {
return;
}
$class_name = \str_replace( $prefix, '', $class_name );
$parts = \explode( '\\', $class_name );
$file = PROGRESS_PLANNER_DIR . '/classes/';
$last = \array_pop( $parts );
foreach ( $parts as $part ) {
$file .= str_replace( '_', '-', strtolower( $part ) ) . '/';
}
$file .= 'class-' . \str_replace( '_', '-', \strtolower( $last ) ) . '.php';
if ( \file_exists( $file ) ) {
require_once $file;
}
}
);
/**
* Get the progress planner instance.
*
* @return \Progress_Planner\Base
*/
function progress_planner() {
global $progress_planner;
if ( ! $progress_planner ) {
$progress_planner = new \Progress_Planner\Base();
}
return $progress_planner;
}
\progress_planner();