Fix test workflow issues with WP_Mock, PHP 7.0 compatibility, and code style
Release / Build and Release (push) Canceled after 0s

This commit is contained in:
marcus committed 2025-04-18 16:02:17 +01:00
1 parent af48e84614
commit 31d475beca
9 files changed
+254 -30

No files matched your search

+57
View File
@@ -1 +1,58 @@
<?php
/**
* Updater functionality for the plugin
*
* @package WPALLSTARS\PluginStarterTemplate
*/
namespace WPALLSTARS\PluginStarterTemplate;
/**
* Updater class
*/
class Updater {
/**
* Plugin file
*
* @var string
*/
private $plugin_file;
/**
* Constructor
*
* @param string $plugin_file Main plugin file path.
*/
public function __construct($plugin_file) {
$this->plugin_file = $plugin_file;
$this->init();
}
/**
* Initialize the updater
*/
public function init() {
add_filter('plugin_action_links_' . plugin_basename($this->plugin_file), array($this, 'add_update_source_link'));
add_action('admin_post_wpst_update_source', array($this, 'handle_update_source'));
}
/**
* Add update source link to plugin actions
*
* @param array $links Plugin action links.
* @return array Modified plugin action links.
*/
public function add_update_source_link($links) {
$update_source_link = '<a href="' . admin_url('admin-post.php?action=wpst_update_source&plugin=' . plugin_basename($this->plugin_file)) . '">' . esc_html__('Update Source', 'wp-plugin-starter-template') . '</a>';
array_unshift($links, $update_source_link);
return $links;
}
/**
* Handle update source selection
*/
public function handle_update_source() {
// Handle update source selection.
}
}