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; }
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); }
protected function _init_from_post_data($alternative_post_data = false) { $post = $alternative_post_data && is_array($alternative_post_data) ? $alternative_post_data : $_POST; // First set the player $player = new JWP6_Player($post['player_name']); if ($player && $player->is_existing()) { $this->player = $player; } else { $this->player = new JWP6_Player(0); } foreach ($this->media_params as $param => $value) { if (isset($post[JWP6 . $param]) && $post[JWP6 . $param]) { $this->media_params[$param] = $post[JWP6 . $param]; } else { if (isset($post[$param]) && $post[$param]) { $this->media_params[$param] = $post[$param]; } } } }
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; }
require_once '../../../../wp-admin/includes/admin.php'; // 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')); }
public static function insert_player_html($post) { global $jwp6_global, $wp_version; $insert_with_player = isset($jwp6_global['insert_with_player']) ? $jwp6_global['insert_with_player'] : 0; $html = ""; $html .= "\n <select id='jwp6_insert_with_player' name='attachments[{$post->ID}][" . JWP6 . "insert_with_player]' style='width: 100%;'>\n "; foreach (get_option(JWP6 . 'players') as $player_id) { $selected = $insert_with_player == $player_id ? 'selected="selected"' : ''; $player = new JWP6_Player($player_id); $html .= "\n <option value='{$player_id}' {$selected}>{$player->full_description()}</option>\n "; } $html .= "\n </select>\n\n <p class='description'>Player template to use.</p>\n\n <div class='jwp6_hr'></div>\n "; if (isset($_GET["post_id"]) || version_compare($wp_version, '3.5', '<')) { $html .= "\n <input type='submit' class='button button-primary media-button' name='send[{$post->ID}]' value='Insert with JW Player' />\n "; } else { $html .= "\n <button class='insert_with_jwp6 button button-primary media-button'\n data-url='" . JWP6_PLUGIN_URL . "jwp6-media-embed.php'>\n Insert with JW Player\n </button>\n "; } $html .= JWP6_Media::insert_javascript_for_attachment_fields($post); return $html; }
function jwp6_media_embed_playlist($no_video_error = false) { global $type, $wp_version; //$redir_tab, $type; $jwp6m = new JWP6_Media(); define('MEDIA_MANAGER_35', version_compare($wp_version, '3.5', '>=')); if (!MEDIA_MANAGER_35) { media_upload_header(); } ?> <script type="text/javascript"> var JWP6_AJAX_URL = "<?php echo JWP6_PLUGIN_URL . 'jwp6-ajax.php'; ?> "; jQuery(function () { jQuery('#player_name, #<?php echo JWP6; ?> playlistid') .select2(jwp6media.SELECT2_SETTINGS) ; jwp6media.init_media_wizard(); }); </script> <form method="post" action="" name="jwp6_wizard_form" id="jwp6_wizard_form"> <?php if (!MEDIA_MANAGER_35) { ?> <h3 class="media-title">Insert JW Player Playlist</h3> <?php } ?> <?php if ($no_video_error) { ?> <div class="notice"> <strong>Please note:</strong> You need to pick at least a playlist to embed the JW Player. </div> <?php } ?> <p>Embed a playlist into your post with JW Player</p> <table> <tbody> <tr> <th scope="row" class="label"> <span class="alignleft"><label for="<?php echo JWP6; ?> playlistid">Playlist</label></span> </th> <td class="field"> <select name="<?php echo JWP6; ?> playlistid" id="<?php echo JWP6; ?> playlistid" data-placeholder="Pick a playlist..." style="width: 90%;"> <option value=""></option> <?php foreach ($jwp6m->playlists() as $playlist) { ?> <option value="<?php echo $playlist->ID; ?> "> <?php echo $jwp6m->playlist_name_with_info($playlist); ?> </option> <?php } ?> </select> </td> </tr> <tr> <th></th> <td> <p class="description"> Create playlists in <a target="_top" href="<?php echo admin_url("upload.php?page=" . JWP6 . "playlists"); ?> ">the media section</a>. <br /> </p> </td> </tr> <tr> <th scope="row" class="label"> <span class="alignleft"><label for="player_name">JW PLayer</label></span> </th> <td class="field"> <select id="player_name" name="player_name" style="width: 90%;"> <?php foreach ($jwp6m->players as $player_id) { ?> <?php $player = new JWP6_Player($player_id); ?> <option value="<?php echo $player_id; ?> "><?php echo $player->full_description(); ?> </option> <?php } ?> </select> </td> </tr> <tr> <th></th> <td> <p class="description"> Select the player you would like to use. You can add and manage players on the <a href="">Player configuration page</a> <br /> </p> </td> </tr> <tr> <th></th> <td class="field"> <button type="submit" class="button-primary" name="insert">Insert this player into your post</button> </td> </tr> </tbody> </table> </form><!-- end of jwp6_wizard_form --> </div><!-- end of wrapper --> <?php }