Dateien nach "includes" hochladen
This commit is contained in:
60
includes/class-festive-admin.php
Normal file
60
includes/class-festive-admin.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?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();
|
||||||
Reference in New Issue
Block a user