/** * Validate options */ public function validate_options($options) { $defaults = Igemutato::get_default_settings(); $options['tipW'] = !is_numeric($options['tipW']) || $options['tipW'] < 100 ? $defaults['tipW'] : $options['tipW']; $options['tipH'] = !is_numeric($options['tipH']) || $options['tipH'] < 50 ? $defaults['tipH'] : $options['tipH']; $options['fontSize'] = !is_numeric($options['fontSize']) || $options['fontSize'] < 5 ? $defaults['fontSize'] : $options['fontSize']; $options['tipShow'] = !is_numeric($options['tipShow']) || $options['tipShow'] < 0 ? $defaults['tipShow'] : $options['tipShow']; $options['tipHide'] = !is_numeric($options['tipHide']) || $options['tipHide'] < 0 ? $defaults['tipHide'] : $options['tipHide']; $options['forditas'] = !in_array($options['forditas'], array('SZIT', 'KNB', 'KG', 'UF')) ? $defaults['forditas'] : $options['forditas']; $options['excludeTags'] = isset($options['excludeTags']) ? $options['excludeTags'] : $defaults['excludeTags']; $options['enableFormatting'] = !empty($options['enableFormatting']); $options['showNumbers'] = !empty($options['showNumbers']); return $options; }
<?php $O = Igemutato::OPTION_NAME; $options = Igemutato::validate_options(get_option($O)); ?> <div class="wrap"> <h2>Igemutató beállítások</h2> <form method="post" action="options.php"> <?php settings_fields('igemutato-settings'); ?> <table class="form-table"> <tr valign="top"> <th scope="row"><label for="<?php echo $O . "[forditas]"; ?> ">Fordítás</label></th> <td> <select id="<?php echo $O . "[forditas]"; ?> " name="<?php echo $O . "[forditas]"; ?> "> <option value="KNB" <?php selected($options['forditas'], 'KNB', true); ?> >Káldi-Neovulgáta (katolikus)</option> <option value="SZIT" <?php