-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjanw-plugin-base.php
47 lines (38 loc) · 1.44 KB
/
janw-plugin-base.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
<?php
/**
* Plugin Name: Janw Base Plugin
* Plugin URI: PLUGIN SITE HERE
* Description: PLUGIN DESCRIPTION HERE
* Author: janw.oostendorp
* Author URI: https://janw.me
* Text Domain: janw-plugin-base
* Domain Path: /languages
* Requires at least: 6.6
* Requires PHP: 8.2
* Version: 0.10.0
*
* @package Janw\Plugin_Base
*/
namespace Janw\Plugin_Base;
define( 'JANW_PLUGIN_BASE_VERSION', '0.10.0' );
define( 'JANW_PLUGIN_BASE_DIR', plugin_dir_path( __FILE__ ) ); // Full path with trailing slash.
define( 'JANW_PLUGIN_BASE_URL', plugin_dir_url( __FILE__ ) ); // With trailing slash.
define( 'JANW_PLUGIN_BASE_SLUG', basename( __DIR__ ) ); // janw-plugin-base.
if ( ! defined( 'ABSPATH' ) ) {
return; // WP not loaded.
}
/**
* Autoload internal classes.
*/
require_once JANW_PLUGIN_BASE_DIR . 'app/class-plugin.php';
spl_autoload_register( array( '\Janw\Plugin_Base\App\Plugin', 'autoloader' ) );
/**
* Hook everything.
*/
// Plugin (de)activation & uninstall.
register_activation_hook( __FILE__, array( '\Janw\Plugin_Base\App\Plugin', 'activate' ) );
register_deactivation_hook( __FILE__, array( '\Janw\Plugin_Base\App\Plugin', 'deactivate' ) );
register_uninstall_hook( __FILE__, array( '\Janw\Plugin_Base\App\Plugin', 'uninstall' ) );
// Add translation.
add_action( 'init', array( '\Janw\Plugin_Base\App\Plugin', 'load_textdomain' ), 9 );
// Add the rest of the hooks & filters.