ssaidz

Template.php JwPlayer Google Drive

Dec 22nd, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 KB | None | 0 0
  1. <?php
  2. function get_header($data, $preview)
  3. {
  4.     $header = array(
  5.         "title" => "This Is A Title",
  6.         "css"   => array("style.css"),
  7.         "js"    => array(),
  8.         "html"  => "",
  9.     );
  10.  
  11.     return $header;
  12. }
  13.  
  14. function get_body($data, $preview, $subtitle, $links)
  15. {
  16.     if ($subtitle) {
  17.         $subtitle = '
  18.        tracks: [{
  19.            file: "' . $subtitle . '",
  20.            label: "English",
  21.            kind: "captions",
  22.            "default": true
  23.        }],
  24.        captions: {
  25.            fontFamily: "' . $data->get("family") . '",
  26.            fontSize: ' . $data->get("font") . ',
  27.            color: "' . $data->get("color") . '",
  28.            backgroundOpacity: 0
  29.        },';
  30.     }
  31.  
  32.     $html = '
  33.    <div id="player"></div>
  34.    <script type="text/javascript">
  35.    ';
  36.     $script = '
  37.    var player = jwplayer("player");
  38.    player.setup(
  39.    {
  40.        width: "' . $data->get("width") . '",
  41.        height: "' . $data->get("height") . '",
  42.        skin: "seven",
  43.        preload: "' . $data->get("preload") . '",
  44.        controls: ' . $data->get("controls") . ',
  45.        displaytitle: false,
  46.        flashplayer: "' . $data->get("url") . '/player/jwplayer/assets/jwplayer.flash.swf",
  47.        aspectratio: "' . $data->get("aspect") . '",
  48.        fullscreen: "' . $data->get("fullscreen") . '",
  49.        primary: "html5",
  50.        provider: "http",
  51.        autostart: false,
  52.        image: "' . $preview . '",
  53.        sources: ' . json_encode($links) . ',
  54.        type: "video/mp4",
  55.        logo:
  56.        {
  57.            file: "' . $data->get("logo") . '",
  58.            link: "' . $data->get("logo_link") . '",
  59.        },' . $subtitle . '
  60.        abouttext: "' . $data->get("about") . '",
  61.        aboutlink: "' . $data->get("about_link") . '"
  62.    });
  63.    ';
  64.  
  65.     $packer = new JavaScriptPacker($script, 'Normal', true, false);
  66.     $packed = $packer->pack();
  67.     $html .= $packed;
  68.  
  69.     $html .= '
  70.    </script>
  71. ';
  72.     return $html;
  73. }
  74.  
  75. function get_footer($data)
  76. {
  77.     $html = null;
  78.     return $html;
  79. }
  80. $db->query("UPDATE files SET views=views+1 WHERE slug='{$var->get->id}'");
Add Comment
Please, Sign In to add comment