当前位置: 首页>>代码示例>>PHP>>正文


PHP Stream::get_base_url方法代码示例

本文整理汇总了PHP中Stream::get_base_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Stream::get_base_url方法的具体用法?PHP Stream::get_base_url怎么用?PHP Stream::get_base_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stream的用法示例。


在下文中一共展示了Stream::get_base_url方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: play_url

 /**
  * play_url
  * This returns a "PLAY" url for the video in question here, this currently feels a little
  * like a hack, might need to adjust it in the future
  */
 public static function play_url($oid, $additional_params = '', $sid = '', $force_http = '')
 {
     $video = new Video($oid);
     if (!$video->id) {
         return false;
     }
     $uid = intval($GLOBALS['user']->id);
     $oid = intval($video->id);
     $url = Stream::get_base_url() . "type=video&uid=" . $uid . "&oid=" . $oid;
     return Stream_URL::format($url . $additional_params);
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:16,代码来源:video.class.php

示例2: play_url

 /**
  * play_url
  * This function takes all the song information and correctly formats a
  * a stream URL taking into account the downsmapling mojo and everything
  * else, this is the true function
  */
 public static function play_url($oid, $additional_params = '', $player = null, $local = false)
 {
     $song = new Song_Preview($oid);
     $user_id = $GLOBALS['user']->id ? scrub_out($GLOBALS['user']->id) : '-1';
     $type = $song->type;
     $song_name = rawurlencode($song->get_artist_name() . " - " . $song->title . "." . $type);
     $url = Stream::get_base_url($local) . "type=song_preview&oid=" . $song->id . "&uid=" . $user_id . "&name=" . $song_name;
     return Stream_URL::format($url . $additional_params);
 }
开发者ID:cheese1,项目名称:ampache,代码行数:15,代码来源:song_preview.class.php

示例3: play_url

 /**
  * play_url
  * This returns the special play URL for democratic play, only open to ADMINs
  */
 public function play_url()
 {
     $link = Stream::get_base_url() . 'uid=' . scrub_out($GLOBALS['user']->id) . '&demo_id=' . scrub_out($this->id);
     return Stream_URL::format($link);
 }
开发者ID:cheese1,项目名称:ampache,代码行数:9,代码来源:democratic.class.php

示例4: generate_playlist

 public function generate_playlist($type, $redirect = false)
 {
     if (!count($this->urls)) {
         debug_event('stream_playlist', 'Error: Empty URL array for ' . $this->id, 2);
         return false;
     }
     debug_event('stream_playlist', 'Generating a {' . $type . '} object...', 5);
     $ext = $type;
     switch ($type) {
         case 'download':
         case 'democratic':
         case 'localplay':
         case 'web_player':
             // These are valid, but witchy
             $ct = "";
             $redirect = false;
             unset($ext);
             break;
         case 'asx':
             $ct = 'video/x-ms-wmv';
             break;
         case 'pls':
             $ct = 'audio/x-scpls';
             break;
         case 'ram':
             $ct = 'audio/x-pn-realaudio ram';
             break;
         case 'simple_m3u':
             $ext = 'm3u';
             $ct = 'audio/x-mpegurl';
             break;
         case 'xspf':
             $ct = 'application/xspf+xml';
             break;
         case 'm3u':
         default:
             // Assume M3U if the pooch is screwed
             $ext = $type = 'm3u';
             $ct = 'audio/x-mpegurl';
             break;
     }
     if ($redirect) {
         // Our ID is the SID, so we always want to include it
         AmpConfig::set('require_session', true, true);
         header('Location: ' . Stream::get_base_url() . 'uid=' . scrub_out($this->user) . '&type=playlist&playlist_type=' . scrub_out($type));
         exit;
     }
     if (isset($ext)) {
         header('Cache-control: public');
         header('Content-Disposition: filename=ampache_playlist.' . $ext);
         header('Content-Type: ' . $ct . ';');
     }
     $this->{'create_' . $type}();
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:54,代码来源:stream_playlist.class.php

示例5: generic_play_url

 /**
  * Generate generic play url.
  * @param string $object_type
  * @param int $object_id
  * @param string $additional_params
  * @param boolean $local
  * @return string
  */
 public static function generic_play_url($object_type, $object_id, $additional_params, $player = null, $local = false)
 {
     $media = new $object_type($object_id);
     if (!$media->id) {
         return null;
     }
     $uid = $GLOBALS['user']->id ? scrub_out($GLOBALS['user']->id) : '-1';
     $type = $media->type;
     // Checking if the media is gonna be transcoded into another type
     // Some players doesn't allow a type streamed into another without giving the right extension
     $transcode_cfg = AmpConfig::get('transcode');
     $valid_types = Song::get_stream_types_for_type($type, $player);
     if ($transcode_cfg == 'always' || $transcode_cfg != 'never' && !in_array('native', $valid_types)) {
         $transcode_settings = $media->get_transcode_settings(null);
         if ($transcode_settings) {
             debug_event("media", "Changing play url type from {" . $type . "} to {" . $transcode_settings['format'] . "} due to encoding settings...", 5);
             $type = $transcode_settings['format'];
         }
     }
     $media_name = $media->get_stream_name() . "." . $type;
     $media_name = str_replace("/", "-", $media_name);
     $media_name = str_replace("?", "", $media_name);
     $media_name = str_replace("#", "", $media_name);
     $media_name = rawurlencode($media_name);
     $url = Stream::get_base_url($local) . "type=" . $object_type . "&oid=" . $object_id . "&uid=" . $uid . $additional_params;
     if ($player) {
         $url .= "&player=" . $player;
     }
     $url .= "&name=" . $media_name;
     return Stream_URL::format($url);
 }
开发者ID:nioc,项目名称:ampache,代码行数:39,代码来源:song.class.php

示例6: play_url

 /**
  * play_url
  * This function takes all the song information and correctly formats a
  * a stream URL taking into account the downsmapling mojo and everything
  * else, this is the true function
  */
 public static function play_url($oid, $additional_params = '')
 {
     $song = new Song($oid);
     $user_id = $GLOBALS['user']->id ? scrub_out($GLOBALS['user']->id) : '-1';
     $type = $song->type;
     // Checking if the song is gonna be transcoded into another type
     // Some players doesn't allow a type streamed into another without giving the right extension
     $transcode_cfg = AmpConfig::get('transcode');
     $transcode_mode = AmpConfig::get('transcode_' . $type);
     if ($transcode_cfg == 'always' || $transcode_cfg != 'never' && $transcode_mode == 'required') {
         $transcode_settings = $song->get_transcode_settings(null);
         if ($transcode_settings) {
             debug_event("song.class.php", "Changing play url type from {" . $type . "} to {" . $transcode_settings['format'] . "} due to encoding settings...", 5);
             $type = $transcode_settings['format'];
         }
     }
     $song_name = $song->get_artist_name() . " - " . $song->title . "." . $type;
     $song_name = str_replace("/", "-", $song_name);
     $song_name = str_replace("?", "", $song_name);
     $song_name = str_replace("#", "", $song_name);
     $song_name = rawurlencode($song_name);
     $url = Stream::get_base_url() . "type=song&oid=" . $song->id . "&uid=" . $user_id . $additional_params . "&name=" . $song_name;
     return Stream_URL::format($url);
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:30,代码来源:song.class.php


注:本文中的Stream::get_base_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。