-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodpress.php
More file actions
100 lines (88 loc) · 3.52 KB
/
Copy pathmodpress.php
File metadata and controls
100 lines (88 loc) · 3.52 KB
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
<?php
/**
* ModPress - A WordPress Plugin
*
* This is the main plugin file for the ModPress WordPress plugin. It contains the plugin metadata and initializes the plugin by including necessary files and setting up activation and deactivation hooks.
*
* Plugin Name: ModPress
* Plugin URI: https://modpress.dev
* Description: Modpres is a Wordpress plugin designed to manage and display plugins, mods & extensions in a portfolio.
* MrTrilB: MrTrilB
* MrTrilB URI: https://trilb.dev
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: modpress
* Domain Path: src/languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Currently plugin version.
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'MODPRESS_VERSION', '0.0.5' );
define( 'MODPRESS_NAME', 'modpress' );
define( 'MODPRESS_FILE', __FILE__ );
define( 'MODPRESS_DIR', plugin_dir_path( __FILE__ ) );
define( 'MODPRESS_URL', plugin_dir_url( __FILE__ ) );
define( 'MODPRESS_BASENAME', plugin_basename( __FILE__ ) );
define( 'MODPRESS_ROOT', MODPRESS_DIR );
define( 'MODPRESS_ROOT_URL', MODPRESS_URL );
define( 'MODPRESS_API', MODPRESS_DIR . 'src/API' );
define( 'MODPRESS_ASSETS', MODPRESS_DIR . 'src/Assets' );
define( 'MODPRESS_ASSETS_URL', MODPRESS_URL . 'src/Assets' );
define( 'MODPRESS_ADMIN', MODPRESS_DIR . 'src/Admin' );
define( 'MODPRESS_ADMIN_URL', MODPRESS_URL . 'src/Admin' );
define( 'MODPRESS_LANGUAGES', MODPRESS_DIR . 'src/Languages' );
define( 'MODPRESS_INCLUDES', MODPRESS_DIR . 'src/Includes' );
define( 'MODPRESS_CORE', MODPRESS_INCLUDES . '/Core' );
define( 'MODPRESS_SETTINGS', MODPRESS_INCLUDES . '/Settings' );
define( 'MODPRESS_PLUGINS', MODPRESS_INCLUDES . '/Plugins' );
define( 'MODPRESS_PLUGINS_URL', MODPRESS_URL . 'src/Includes/Plugins' );
$modpress_autoloader = MODPRESS_DIR . 'vendor/autoload.php';
if ( ! file_exists( $modpress_autoloader ) ) {
// Log error and deactivate plugin gracefully
add_action( 'admin_notices', function() {
echo '<div class="notice notice-error"><p><strong>ModPress Error:</strong> Composer dependencies are missing. Please run <code>composer install</code> in the plugin directory.</p></div>';
} );
return; // Exit early without loading the plugin
}
require_once $modpress_autoloader;
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-modpress-activator.php
*/
function activate_modpress() {
\ModPress\Includes\Core\WP\Activator::activate();
}
register_activation_hook( __FILE__, 'activate_modpress' );
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-modpress-deactivator.php
*/
function deactivate_modpress() {
\ModPress\Includes\Core\WP\Deactivator::deactivate();
}
register_deactivation_hook( __FILE__, 'deactivate_modpress' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require_once MODPRESS_DIR . 'src/Plugin.php';
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run_modpress() {
$plugin = new \ModPress\Plugin( MODPRESS_FILE, MODPRESS_NAME, MODPRESS_VERSION );
$plugin->run();
}
run_modpress();