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:
@@ -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'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user