Skip to content

Commit

Permalink
Adding player_resolutions. See: #179
Browse files Browse the repository at this point in the history
  • Loading branch information
JasWSInc committed Aug 13, 2014
1 parent 1dde68b commit d66bc4d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions s2member/includes/classes/sc-files-in.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,19 @@ public static function sc_get_stream($attr = array(), $content = '', $shortcode

unset($key, $value); // Ditch these now. We don't want these bleeding into Hooks/Filters anyway.

if(!empty($config) && isset($config['file_download'])) // Looking for a File Download URL?
if(!empty($config) && isset($config['download'])) // Looking for a File Download URL?
{
if($attr['player_resolutions']) // There are multiple variations of the file; in various resolutions?
foreach(preg_split('/[,;\s]+/', $attr['player_resolutions'], NULL, PREG_SPLIT_NO_EMPTY) as $_resolution)
{
// @TODO Need to finish this up.
}
{
// @TODO I need to finish this up.
$download_extension = strtolower(ltrim((string)strrchr(basename($config['download']), '.'), '.'));
$download_resolution_wo_extension = substr($config['download'], 0, -strlen($download_extension + 1) /* For the dot. */);
$download_wo_resolution_extension = preg_replace('/\-R[0-9]$/i', '', $download_resolution_wo_extension);

$download_resolutions[] = array(); // Initialize the array of resolutions.
foreach(preg_split('/[,;\s]+/', $attr['player_resolutions'], NULL, PREG_SPLIT_NO_EMPTY) as $_player_resolution)
$download_resolutions[] = $download_wo_resolution_extension.'-'.urlencode(ltrim($_player_resolution, 'Rr')).'.'.$download_extension;
}
$_get = c_ws_plugin__s2member_files::create_file_download_url($config, TRUE);

if(is_array($_get) && !empty($_get) && $attr['player'] && is_file($template = dirname(dirname(__FILE__)).'/templates/players/'.$attr['player'].'.php') && $attr['player_id'] && $attr['player_path'])
Expand Down

0 comments on commit d66bc4d

Please sign in to comment.