diff --git a/gitea-updater-settings.php b/gitea-updater-settings.php index 9d72f34..96f3837 100644 --- a/gitea-updater-settings.php +++ b/gitea-updater-settings.php @@ -4,56 +4,122 @@ defined( 'ABSPATH' ) or exit; class Gitea_Updater_Settings { + private static $_instance; + + public static function getInstance() { + if (!(self::$_instance instanceof self)) { + self::$_instance = new self(); + } + return self::$_instance; + } + function __construct() { add_action('admin_menu', array($this, 'admin_menu')); - add_action('admin_init', array($this, 'admin_init')); } function admin_menu() { - add_options_page('Gitea Upater', 'Gitea Upater', 'manage_options', 'gitea-upater', array($this, 'options_page')); - } - - function admin_init() { - register_setting('gitea_options_page', 'gitea_options'); - - // add_settings_section( - // 'gitea_options_section', - // __('Your section description', 'gitea'), - // '__return_false', - // 'gitea_options_page' - // ); - - // add_settings_field( - // 'gitea_acces_token', - // __('Access token', 'gitea'), - // array($this, 'access_token'), - // 'gitea_options_page', - // 'gitea_options_section' - // ); - } - - function access_token() { - $options = get_option('gitea_options'); - ?> - '> - get_gitea_all(); + } + if (isset($_POST['gitea_options'])) { + update_option('gitea_options', $_POST['gitea_options']); + } + $options = (array)get_option('gitea_options'); + $repositories = $this->get_repositories(); + $titles = array( + 'plugin' => __('Plugins'), + 'theme' => __('Themes'), + ); ?> -