protected function _init_from_shortcode($shortcode)
 {
     $shortcode = JWP6_Legacy::check_shortcode($shortcode);
     // Player
     if (isset($shortcode['player'])) {
         $this->player = new JWP6_Player($shortcode['player']);
         unset($shortcode['player']);
     } else {
         $this->player = new JWP6_Player(0);
     }
     // Check fixed params
     foreach ($this->media_params as $param => $value) {
         if (isset($shortcode[$param])) {
             $this->media_params[$param] = $shortcode[$param];
             unset($shortcode[$param]);
         }
     }
     // Check if at least on media item has been set.
     $media_is_set = false;
     foreach (array('mediaid', 'file', 'playlist', 'playlistid') as $param) {
         if (!is_null($this->media_params[$param])) {
             $media_is_set = true;
         }
     }
     //if ( ! $media_is_set ) {
     //    exit('Error in shortcode. You need to specify at least mediaid, file, playlistid or playlist in the jwplayer shortcode.');
     //}
     // The other items in the shortcode can be
     $this->config_params = $shortcode;
 }
 public static function purge_settings($purge_jwp5_settings_too = false)
 {
     if ($purge_jwp5_settings_too && !get_option(JWP6 . 'jwp5_purged')) {
         JWP6_Legacy::purge_jwp5_settings();
     }
     global $wpdb;
     $meta_query = "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '" . JWP6 . "%';";
     $option_query = "DELETE FROM {$wpdb->options} WHERE option_name LIKE '" . JWP6 . "%'";
     $wpdb->query($meta_query);
     $wpdb->query($option_query);
 }
 static function import_jwp5_players()
 {
     $players = JWP6_Legacy::get_jwp5_players();
     foreach ($players as $name => $xml_file) {
         $new_player_id = JWP6_Legacy::import_jwp5_player_from_xml($name, $xml_file);
         $players[$name] = $new_player_id;
     }
     return $players;
 }
Example #4
0
// 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']) {
    JWP6_Plugin::purge_settings(false);
    add_option(JWP6 . 'plugin_version', $plugin_version, '', 'yes');
    wp_redirect(admin_url('admin.php?page=jwplayer-update'));
}