feat: scaffold plugin foundation
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: WP Content Sync
|
||||
* Description: Bidirectional content synchronization between WordPress instances.
|
||||
* Version: 0.1.0
|
||||
* Requires at least: 5.6
|
||||
* Requires PHP: 7.4
|
||||
* Author: WP Content Sync Contributors
|
||||
* License: GPL-2.0-or-later
|
||||
* Text Domain: wp-content-sync
|
||||
*
|
||||
* @package WPContentSync
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'WPCS_PLUGIN_FILE', __FILE__ );
|
||||
define( 'WPCS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'WPCS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'WPCS_VERSION', '0.1.0' );
|
||||
|
||||
$wpcs_autoload = __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
if ( ! file_exists( $wpcs_autoload ) ) {
|
||||
add_action(
|
||||
'admin_notices',
|
||||
static function (): void {
|
||||
printf(
|
||||
'<div class="notice notice-error"><p>%s</p></div>',
|
||||
esc_html__( 'WP Content Sync dependencies are missing. Run composer install before activating the plugin.', 'wp-content-sync' )
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once $wpcs_autoload;
|
||||
|
||||
register_activation_hook( __FILE__, array( \WPContentSync\Activator::class, 'activate' ) );
|
||||
register_deactivation_hook( __FILE__, array( \WPContentSync\Deactivator::class, 'deactivate' ) );
|
||||
|
||||
add_action(
|
||||
'plugins_loaded',
|
||||
static function (): void {
|
||||
$plugin = \WPContentSync\Plugin::create();
|
||||
$plugin->register();
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user