-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
satispress.php
76 lines (65 loc) · 2.16 KB
/
satispress.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
<?php
/**
* SatisPress
*
* @package SatisPress
* @author Brady Vercher <[email protected]>
* @license GPL-2.0-or-later
*
* @wordpress-plugin
* Plugin Name: SatisPress
* Plugin URI: https://github.com/cedaro/satispress
* Description: Generate a Composer repository from installed WordPress plugins and themes.
* Version: 2.0.0
* Author: Cedaro
* Author URI: https://www.cedaro.com/
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: satispress
* Domain Path: /languages
* Requires PHP: 8.0
* Network: true
* GitHub Plugin URI: cedaro/satispress
* Release Asset: true
*/
declare ( strict_types = 1 );
namespace SatisPress;
// Exit if accessed directly.
if ( ! \defined( 'ABSPATH' ) ) {
exit;
}
/**
* Plugin version.
*
* @var string
*/
const VERSION = '2.0.0';
// Load the Composer autoloader.
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
// Display a notice and bail if dependencies are missing.
if ( ! function_exists( __NAMESPACE__ . '\autoloader_classmap' ) ) {
require_once __DIR__ . '/src/functions.php';
add_action( 'admin_notices', __NAMESPACE__ . '\display_missing_dependencies_notice' );
return;
}
// Autoload mapped classes.
spl_autoload_register( __NAMESPACE__ . '\autoloader_classmap' );
// Load the WordPress plugin administration API.
require_once ABSPATH . 'wp-admin/includes/plugin.php';
// Create a container and register a service provider.
$satispress_container = new Container();
$satispress_container->register( new ServiceProvider() );
// Initialize the plugin and inject the container.
$satispress = plugin()
->set_basename( plugin_basename( __FILE__ ) )
->set_directory( plugin_dir_path( __FILE__ ) )
->set_file( __DIR__ . '/satispress.php' )
->set_slug( 'satispress' )
->set_url( plugin_dir_url( __FILE__ ) )
->set_container( $satispress_container )
->register_hooks( $satispress_container->get( 'hooks.activation' ) )
->register_hooks( $satispress_container->get( 'hooks.deactivation' ) )
->register_hooks( $satispress_container->get( 'hooks.authentication' ) );
add_action( 'plugins_loaded', [ $satispress, 'compose' ], 5 );