This commit is contained in:
brent s. 2016-03-18 21:07:47 -04:00
parent 07c9390292
commit b8bbb27871
1 changed files with 10 additions and 8 deletions

View File

@ -41,7 +41,7 @@ h5. bts_podcast_filename
The filename of the media file. Automatically generated from the title by default. The filename of the media file. Automatically generated from the title by default.


Attributes: Attributes:
*ext=* *type=*
File extension. Recommended is either _mp3_ or _ogg_. Default is _mp3_. File extension. Recommended is either _mp3_ or _ogg_. Default is _mp3_.


*name=* *name=*
@ -107,16 +107,16 @@ function bts_podcast_path($atts) {


function bts_podcast_filename($atts) { function bts_podcast_filename($atts) {
extract(lAtts(array( extract(lAtts(array(
'ext' => 'mp3', 'type' => 'mp3',
'name' => NULL, 'name' => NULL,
), $atts)); ), $atts));
if (! $name) { if (! $name) {
$raw_name = strtolower(title()); $raw_name = strtolower(title($atts));
$stripped = trim($raw_name); $stripped = trim($raw_name);
$replaced = preg_replace('(\s+|[^A-Za-z0-9\.\-]+)','.',$stripped); $replaced = preg_replace('(\s+|[^A-Za-z0-9\.\-]+)','.',$stripped);
$name = preg_replace('(\.+)','.',$replaced); $name = preg_replace('(\.+)','.',$replaced);
} }
return $name . '.' . $ext; return $name . '.' . $type;
} }




@ -129,7 +129,7 @@ function bts_podcast_guid ($atts) {


if (($byte == '1' && $db == '1') || ($string == '')) { if (($byte == '1' && $db == '1') || ($string == '')) {
//$checksum = safe_query('select checksum from sha256 where url_title = \'' . article_url_title() . '\' and filename = \'' . bts_podcast_filename() . '\''); //$checksum = safe_query('select checksum from sha256 where url_title = \'' . article_url_title() . '\' and filename = \'' . bts_podcast_filename() . '\'');
$checksum = fetch('checksum','sha256','filename',bts_podcast_filename()); $checksum = fetch('checksum','sha256','filename',bts_podcast_filename($atts));
} elseif ($byte == '1') { } elseif ($byte == '1') {
$checksum = hash_file('sha256',$string); $checksum = hash_file('sha256',$string);
} else { } else {
@ -140,9 +140,11 @@ return $checksum;




function bts_podcast_media_uri ($atts) { function bts_podcast_media_uri ($atts) {
extract(lAtts(array( $default_vals = array('type' => 'mp3');
'uri' => site_url() . bts_podcast_path() . bts_podcast_filename(), //$default_vals['uri'] = site_url($atts) . bts_podcast_path($type=$default_vals['type']) . bts_podcast_filename($type=$default_vals['type']);
), $atts)); $default_vals['uri'] = site_url($atts) . bts_podcast_path($atts) . bts_podcast_filename($atts);
extract(lAtts(array($default_vals), $atts));
//if ($uri == site_url() .
return $uri; return $uri;
} }