- Create main singleton class - Create activator with version checks - Create deactivator with rewrite flush - Update main file to include core classes This is a blocking fix (Rule 3) - Plan 01-01 was not completed but these files are required for Plan 01-02 to execute.
37 lines
833 B
PHP
37 lines
833 B
PHP
<?php
|
|
/**
|
|
* Plugin activation handler
|
|
*
|
|
* @package DDHH_Job_Manager
|
|
*/
|
|
|
|
// Exit if accessed directly.
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
/**
|
|
* Handles plugin activation
|
|
*/
|
|
class DDHH_JM_Activator {
|
|
|
|
/**
|
|
* Activation logic
|
|
*/
|
|
public static function activate() {
|
|
// Check WordPress version
|
|
if ( version_compare( get_bloginfo( 'version' ), '6.0', '<' ) ) {
|
|
wp_die( esc_html__( 'This plugin requires WordPress 6.0 or higher.', 'ddhh-job-manager' ) );
|
|
}
|
|
|
|
// Check PHP version
|
|
if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
|
|
wp_die( esc_html__( 'This plugin requires PHP 7.4 or higher.', 'ddhh-job-manager' ) );
|
|
}
|
|
|
|
// Store plugin version
|
|
update_option( 'ddhh_jm_version', DDHH_JM_VERSION );
|
|
|
|
// Set flag to flush rewrite rules on next init
|
|
set_transient( 'ddhh_jm_flush_rewrite_rules', 1, 60 );
|
|
}
|
|
}
|