protected function process_overview_post_data($post_data)
 {
     $new_player = false;
     if (!count($this->form_error_fields)) {
         $new_player_id = JWP6_Player::next_player_id();
         if (isset($_POST['copy_from_player']) && $_POST['copy_from_player']) {
             $from = intval($_POST['copy_from_player']);
             $players = get_option(JWP6 . "players");
             if (in_array($from, $players)) {
                 $from = new JWP6_Player($from);
                 $new_player = new JWP6_Player($new_player_id, $from->get_config());
                 $new_description = "Copy of \"{$new_player->get('description')}\"";
                 $new_player->set('description', $new_description);
                 $new_player->save();
             }
         } else {
             $new_player = new JWP6_Player($new_player_id);
             wp_redirect($new_player->admin_url($this));
             exit;
         }
         //$new_player->save();
     }
     wp_redirect($this->page_url());
     exit;
 }
Ejemplo n.º 2
0
 static function import_jwp5_player_from_xml($name, $config_file)
 {
     $old_config = simplexml_load_file($config_file);
     $new_config = JWP6_Legacy::map_jwp5_config($old_config);
     $new_player_id = JWP6_Player::next_player_id();
     $player = new JWP6_Player($new_player_id, $new_config);
     $player->set('description', $name);
     $player->save();
     return $new_player_id;
 }