59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
|
|
defined( 'ABSPATH' ) or exit;
|
|
|
|
class Gitea_Updater_Settings {
|
|
|
|
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');
|
|
?>
|
|
<input type='text' name='gitea_options[gitea_acces_token]' value='<?php echo $options['gitea_acces_token']; ?>'>
|
|
<?php
|
|
}
|
|
|
|
function options_page() {
|
|
?>
|
|
<form action='options.php' method='post'>
|
|
|
|
<h2>Gitea Upater</h2>
|
|
|
|
<?php
|
|
settings_fields('gitea_options_page');
|
|
// do_settings_sections('gitea_options_page');
|
|
?>
|
|
|
|
<?php submit_button(); ?>
|
|
</form>
|
|
<?php
|
|
}
|
|
|
|
}
|
|
|