rename to gitea updater; first steps in settings page
This commit is contained in:
parent
c40304736e
commit
952734c915
2 changed files with 473 additions and 0 deletions
59
gitea-updater-settings.php
Normal file
59
gitea-updater-settings.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue