Fix check for enabled components
Avoids a crash when CiviEvent or CiviContribute are not enabled. Seen on CiviCRM 5.73 with PHP 8.2.
"PHP message: Error: Class "Civi\Api4\Event" not found
in formprotection/Civi/Formprotection/Forms.php on line 200 #0 [internal function]: Civi\Formprotection\Forms::getEvents()
#1 civicrm-core/Civi/Core/Resolver.php(119): call_user_func_array()
#2 civicrm-core/Civi/Core/SettingsMetadata.php(172): Civi\Core\Resolver->call()
#3 civicrm-core/Civi/Core/SettingsMetadata.php(73): Civi\Core\SettingsMetadata::fillOptions()
#4 civicrm-core/CRM/Admin/Form/SettingTrait.php(69): Civi\Core\SettingsMetadata::getMetadata()
#5 civicrm-core/CRM/Admin/Form/SettingTrait.php(169): CRM_Admin_Form_Generic->getSettingsMetaData()