コード例 #1
0
 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;
 }
コード例 #2
0
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 />&nbsp;
                    </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 />&nbsp;
                    </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 
}