Files
Festive-Seasons-Pro/includes/class-festive-admin.php

60 lines
2.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
class Festive_Admin {
public static function init() {
add_action('admin_menu', [__CLASS__, 'menu']);
add_action('admin_init', [__CLASS__, 'register_settings']);
}
public static function menu() {
add_options_page(
'Festive Seasons Pro',
'Festive Seasons',
'manage_options',
'festive-seasons-pro',
[__CLASS__, 'page']
);
}
public static function register_settings() {
foreach (Festive_Seasons_Pro::get_festives() as $key => $f) {
register_setting('fsp_options', "fsp_enable_$key");
}
register_setting('fsp_options', 'fsp_music_consent');
}
public static function page() {
?>
<div class="wrap">
<h1>Festive Seasons Pro Einstellungen</h1>
<form method="post" action="options.php">
<?php settings_fields('fsp_options'); do_settings_sections('fsp_options'); ?>
<table class="form-table">
<?php foreach (Festive_Seasons_Pro::get_festives() as $key => $f): ?>
<tr>
<th scope="row"><?php echo esc_html($f['name']); ?></th>
<td>
<label>
<input type="checkbox" name="fsp_enable_<?php echo $key; ?>" value="yes" <?php checked(get_option("fsp_enable_$key", 'yes'), 'yes'); ?>>
Aktiviert
</label>
</td>
</tr>
<?php endforeach; ?>
<tr>
<th scope="row">Weihnachtsmusik mit Consent-Popup</th>
<td>
<label>
<input type="checkbox" name="fsp_music_consent" value="yes" <?php checked(get_option('fsp_music_consent', 'yes'), 'yes'); ?>>
Ja, Consent-Fenster anzeigen
</label>
</td>
</tr>
</table>
<?php submit_button('Speichern'); ?>
</form>
</div>
<?php
}
}
Festive_Admin::init();