' . esc_html__( 'Ovanap Admin Toolkit is not running because the older OvKit plugin is still active. Deactivate OvKit; your settings are kept and picked up automatically.', 'ovanap-admin-toolkit' ) . '

'; } ); return; } define( 'OVKIT_VERSION', '3.10.1' ); define( 'OVKIT_FILE', __FILE__ ); define( 'OVKIT_PATH', plugin_dir_path( __FILE__ ) ); define( 'OVKIT_URL', plugin_dir_url( __FILE__ ) ); define( 'OVKIT_OPTION', 'ovkit_settings' ); // Core includes. require_once OVKIT_PATH . 'includes/helpers.php'; require_once OVKIT_PATH . 'includes/class-ovkit-feature-registry.php'; require_once OVKIT_PATH . 'includes/class-ovkit-feature-loader.php'; require_once OVKIT_PATH . 'includes/class-ovkit-scanner.php'; require_once OVKIT_PATH . 'includes/class-ovkit-activity-log.php'; require_once OVKIT_PATH . 'includes/class-ovkit-site-scan.php'; require_once OVKIT_PATH . 'includes/php-advisory.php'; // Admin page. if ( is_admin() ) { require_once OVKIT_PATH . 'admin/class-ovkit-admin-page.php'; } // Boot. add_action( 'plugins_loaded', function () { OVKIT_Feature_Registry::instance()->register_all(); OVKIT_Feature_Loader::instance()->load_enabled(); // Diagnostic comment, only with WP_DEBUG on and only for administrators. if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { add_action( 'wp_head', function () { if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) { return; } $s = get_option( OVKIT_OPTION, array() ); $tc = ! empty( $s['tracking_codes'] ) ? 'ON' : 'OFF'; $gtm = isset( $s['track_gtm_id'] ) ? $s['track_gtm_id'] : ''; $gtm_en = ! empty( $s['track_gtm_enable'] ) ? 'yes' : 'no'; echo '\n"; }, 0 ); } } ); // Activation: make sure the settings option exists. register_activation_hook( __FILE__, function () { if ( ! get_option( OVKIT_OPTION ) ) { update_option( OVKIT_OPTION, array() ); } } ); // Deactivation: undo side effects of enabled features. Settings are kept for re-activation. register_deactivation_hook( __FILE__, function () { $settings = get_option( OVKIT_OPTION, array() ); // Restore blog_public if maintenance mode was on. Prefer the captured // original over a blind '1', matching the maintenance disable_hook. if ( ! empty( $settings['maintenance_mode'] ) ) { $blog_public_backup = get_option( 'ovkit_blog_public_backup', null ); if ( null !== $blog_public_backup ) { update_option( 'blog_public', (string) $blog_public_backup ); delete_option( 'ovkit_blog_public_backup' ); } else { update_option( 'blog_public', '1' ); } } // Flush rewrite rules (cleans up custom login slug routes). flush_rewrite_rules(); delete_transient( 'ovkit_scan_results' ); } ); // WP-CLI: wp ovkit test. if ( defined( 'WP_CLI' ) && WP_CLI ) { WP_CLI::add_command( 'ovkit test', function () { require_once OVKIT_PATH . 'includes/class-ovkit-health-check.php'; $results = ( new OVKIT_Health_Check() )->run(); $labels = array( 'pass' => '[PASS]', 'warn' => '[WARN]', 'fail' => '[FAIL]', ); $pass = 0; $fail = 0; $warn = 0; foreach ( $results as $r ) { $label = $labels[ $r['status'] ] ?? '[----]'; WP_CLI::line( sprintf( '%s %s: %s', $label, $r['name'], $r['message'] ) ); if ( 'pass' === $r['status'] ) { ++$pass; } elseif ( 'fail' === $r['status'] ) { ++$fail; } else { ++$warn; } } WP_CLI::line( '' ); $summary = sprintf( 'Summary: %d/%d passed', $pass, count( $results ) ); if ( $fail > 0 ) { $summary .= sprintf( ', %d failed', $fail ); } if ( $warn > 0 ) { $summary .= sprintf( ', %d warnings', $warn ); } if ( $fail > 0 ) { WP_CLI::error( $summary, false ); } elseif ( $warn > 0 ) { WP_CLI::warning( $summary ); } else { WP_CLI::success( $summary ); } } ); }