/**
  * Step callback
  */
 public function callback()
 {
     $continue = filter_input(INPUT_POST, 'wpem_continue');
     $log = new WPEM_Log();
     $log->add_step_field('wpem_continue', $continue);
     if ('no' === $continue) {
         wpem_quit();
         return;
     }
     if (isset($log->geodata)) {
         new WPEM_Smart_Defaults($log->geodata);
     }
     wpem_mark_as_started();
 }
 /**
  * Step callback
  */
 public function callback()
 {
     $stylesheet = filter_input(INPUT_POST, 'wpem_selected_theme');
     $stylesheet = !empty($stylesheet) ? sanitize_key($stylesheet) : WP_DEFAULT_THEME;
     $log = new WPEM_Log();
     $log->add_step_field('wpem_selected_theme', $stylesheet);
     wpem_wp_cli_exec(array('theme', 'install', $stylesheet), array('activate' => true));
 }
 /**
  * Update options in bulk
  *
  * @param array $options
  */
 private function bulk_update_options($options)
 {
     if (empty($options) || !is_array($options)) {
         return;
     }
     foreach ($options as $option) {
         $name = sanitize_key($option['name']);
         $label = !empty($option['label']) ? $option['label'] : $name;
         $value = filter_input(INPUT_POST, $name);
         // Validate
         if (!empty($option['required']) && '' === $value) {
             wp_safe_redirect(add_query_arg(array('step' => $this->name, 'error' => true), wpem_get_wizard_url()));
             exit;
         }
         // Sanitize
         if (!empty($option['sanitizer']) && function_exists($option['sanitizer'])) {
             $value = call_user_func($option['sanitizer'], $value);
         }
         update_option($name, $value);
         $log = new WPEM_Log();
         $log->add_step_field($name, $value);
     }
 }