関数
SettingsPage::addSettingsPage()
戻り値 戻り値
ファイル: src/Admin/Pages/SettingsPage.php
public static function addSettingsPage() {
if (!current_user_can('manage_options')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
if (isset($_POST['wcexics_update_options']) && (int)wp_unslash(sanitize_text_field($_POST['wcexics_update_options'])) === 1) {
$opts = self::getOptions();
if (isset($_POST[self::ENABLE_ITEMCSV_OPT])) {
$optv = trim(wp_unslash(sanitize_text_field($_POST[self::ENABLE_ITEMCSV_OPT])));
if ($optv === 'yes' || $optv === 'no') {
$opts[self::ENABLE_ITEMCSV_OPT] = $optv;
}
}
update_option(self::OPTION_KEY, $opts);
}
?>
<div class="wrap">
<h1><?php esc_html_e('WCEX Item Combo-Set', 'wcexics'); ?></h1>
<form method="post" action="">
<?php settings_fields(self::OPTION_KEY); ?>
<table class="form-table" role="presentation">
<?php self::enableItemCSVSection(); ?>
</table>
<input type="hidden" name="wcexics_update_options" value="1" />
<?php submit_button(); ?>
</form>
</div>
<?php
}