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
 public static function activate_plugin()
 {
     // Add the default player
     $default_player = new JWP6_Player();
     $default_player->save();
     // Set default option for tracking
     add_option(JWP6 . 'allow_anonymous_tracking', true, '', true);
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
// Check for administrator
if (!current_user_can('administrator')) {
    exit;
}
// Check for valid action.
$available_actions = array('migrate', 'revert');
if (!isset($_GET['a']) || !in_array($_GET['a'], $available_actions)) {
    exit('error...');
}
require_once JWP6_PLUGIN_DIR . '/jwp6-class-plugin.php';
require_once JWP6_PLUGIN_DIR . '/jwp6-class-player.php';
require_once JWP6_PLUGIN_DIR . '/jwp6-class-legacy.php';
if ('migrate' == $_GET['a']) {
    // Create the default player
    $default = new JWP6_Player();
    $default->save();
    // Import various plugin preferences
    JWP6_Legacy::import_jwp5_settings();
    // Import JWP5 player configs
    $players = JWP6_Legacy::import_jwp5_players();
    add_option(JWP6 . 'imported_jwp5_players', $players);
    // Set update message
    $license_page = admin_url('admin.php?page=' . JWP6 . 'menu_licensing');
    $message = "You have upgraded to JW Player 6. Please remember to ";
    $message .= "<strong><a href='{$license_page}'>enter your player license key</a></strong> ";
    $message .= "to enable all the license specific settings of the player.";
    update_option(JWP6 . 'notification', $message);
    // Redirect to the new overview
    wp_redirect(admin_url('admin.php?page=' . JWP6 . 'menu_import'));
}
if ('revert' == $_GET['a']) {