Ejemplo n.º 1
0
 /**
  * Build HTML for page options, manage also save/reset settings
  *
  * @return void
  * @author Amaury Balmer
  */
 public static function page_options()
 {
     // Get options
     $options = SimpleTags_Plugin::get_option();
     // Update or reset options
     if (isset($_POST['updateoptions'])) {
         check_admin_referer('updateresetoptions-simpletags');
         foreach ((array) $options as $key => $value) {
             $newval = isset($_POST[$key]) ? stripslashes($_POST[$key]) : '0';
             if ($newval != $value) {
                 $options[$key] = $newval;
             }
         }
         SimpleTags_Plugin::set_option($options);
         add_settings_error(__CLASS__, __CLASS__, __('Options saved', 'simpletags'), 'updated');
     } elseif (isset($_POST['reset_options'])) {
         check_admin_referer('updateresetoptions-simpletags');
         SimpleTags_Plugin::set_default_option();
         add_settings_error(__CLASS__, __CLASS__, __('Simple Tags options resetted to default options!', 'simpletags'), 'updated');
     }
     settings_errors(__CLASS__);
     include STAGS_DIR . '/views/admin/page-settings.php';
 }