示例#1
0
function calibrefx_db_upgrade_1001()
{
    calibrefx_set_option('feature_image_layout', 'full');
    calibrefx_set_option('calibrefx_db_version', '1001');
}
 /**
  * Register the settings option in wp_options.
  *
  * @return null Returns early if not on the correct admin page.
  */
 public function register_settings()
 {
     /** If this page doesn't store settings, no need to register them */
     if (!$this->settings_field) {
         return;
     }
     register_setting($this->settings_field, $this->settings_field);
     add_option($this->settings_field, $this->default_settings);
     if (!isset($_REQUEST['page']) or $this->page_id != absint($_REQUEST['page'])) {
         return;
     }
     if (calibrefx_get_option('reset', $this->settings_field)) {
         //prevent redirect loop
         calibrefx_set_option('reset', 0);
         wp_cache_flush();
         //refresh option caches
         if (update_option($this->settings_field, $this->default_settings)) {
             calibrefx_admin_redirect($this->page_id, array('reset' => 'true'));
         } else {
             calibrefx_admin_redirect($this->page_id, array('error' => 'true'));
         }
         exit;
     }
 }