feat(updates): wire PUC v5 registration into Plugin::boot()

register_update_checker() guards on is_file + class_exists so the plugin
degrades cleanly on installs that ship without the vendored lib (no update
notices, but plugin core remains functional).
This commit is contained in:
Vladimir Bryzgalov
2026-04-21 21:08:34 +05:00
parent e4c31e3c40
commit 5b8eeffecb
2 changed files with 31 additions and 0 deletions
+20
View File
@@ -50,10 +50,30 @@ final class Plugin
Dispatcher::register_hooks();
(new CF7Source())->register();
self::register_update_checker();
// Admin
if (is_admin()) {
(new Settings_Page())->register();
(new Dashboard_Widget())->register();
}
}
private static function register_update_checker(): void
{
$loader = CF7STG_PLUGIN_DIR . 'includes/lib/plugin-update-checker/plugin-update-checker.php';
if (!is_file($loader)) {
return;
}
require_once $loader;
if (!class_exists('YahnisElsts\\PluginUpdateChecker\\v5\\PucFactory')) {
return;
}
\YahnisElsts\PluginUpdateChecker\v5\PucFactory::buildUpdateChecker(
'https://git.netranking.ru/bryzgalov/cf7-spam-to-telegram/raw/branch/main/wp-plugin-info.json',
CF7STG_PLUGIN_FILE,
'cf7-spam-to-telegram'
);
}
}