Page 1 of 1
Help with small change to podcast plugin
Posted: Thu May 25, 2006 9:46 pm
by perlnerd
I have the plugin setup to use the [podcast:...] tag and it is working fine. I'd like to configure it to only show the player and not the link to the file beside the player.
I've had a look at the code but can't seem to spot where I could change this behaviour.
Any help is appreciated. A pointer to the line of code I could comment out or modify would be great.
Thanks
Perlnerd
Re: Help with small change to podcast plugin
Posted: Fri May 26, 2006 2:30 pm
by garvinhicking
Hi!
The magic lines that affect the output are those within the PHP filE:
Code: Select all
if ($tagging_switch == 'podcast') {
$eventData[$entryPos]['body'] = preg_replace(
$mediaLinkPattern,
'<a href="\4\5">\5</a>',
$entry['body']);
$eventData[$entryPos]['extended'] = preg_replace(
$mediaLinkPattern,
'<a href="\4\5">\5</a>',
$entry['extended']);
}
if ($use_player && is_array($eventData[$entryPos])) {
$eventData[$entryPos]['body'] = preg_replace(
$playerRewritePattern,
'"\0". sprintf($this->playerHTML[strtolower("\3")], "\2", "\2"); ',
$eventData[$entryPos]['body']);
$eventData[$entryPos]['extended'] = preg_replace(
$playerRewritePattern,
'"\0". sprintf($this->playerHTML[strtolower("\3")], "\2", "\2"); ',
$eventData[$entryPos]['extended']);
}
This uses the template for HTML as defined here:
Code: Select all
$playerRewritePattern =
'@<a\s+.*href\s*=\s*(\'|")([^\'"]+\.('.
implode('|', array_keys($this->playerHTML)).
'))\1[^>]*>.*</a>@Usie'; //won't match nested tags, like <a .. <b>.. </b></a>. but that's ugly anyway.
So if you change that <a href...> html to suit your needs in the preg_replacement call , you should work it out?
Something like this:
Code: Select all
if ($tagging_switch == 'podcast') {
$eventData[$entryPos]['body'] = preg_replace(
$mediaLinkPattern,
'\5',
$entry['body']);
$eventData[$entryPos]['extended'] = preg_replace(
$mediaLinkPattern,
'\5',
$entry['extended']);
}
So, stripping the <a> tag at the required places...
HTH,
Garvin
Posted: Fri May 26, 2006 3:34 pm
by perlnerd
The regex upon regex was making my brain hurt....
The solution I came up with was pretty simple:
Code: Select all
if ($tagging_switch == 'podcast') {
$eventData[$entryPos]['body'] = preg_replace(
$mediaLinkPattern,
'<a href="\4\5">\5</a>',
$entry['body']);
$eventData[$entryPos]['extended'] = preg_replace(
$mediaLinkPattern,
'<a href="\4\5">\5</a>',
$entry['extended']);
}
became:
Code: Select all
if ($tagging_switch == 'podcast') {
$eventData[$entryPos]['body'] = preg_replace(
$mediaLinkPattern,
//'<a href="\4\5">\5</a>',
'<a href="\4\5"> </a>',
$entry['body']);
$eventData[$entryPos]['extended'] = preg_replace(
$mediaLinkPattern,
//'<a href="\4\5">\5</a>',
'<a href="\4\5"> </a>',
$entry['extended']);
}
This seems to keep the regexes that follow happy but gets rid of any visible link.
Another question: Is there a way to get the podcast plugin to work on pages created with the "static pages" module?
Thanks
PerlNerd
Posted: Fri May 26, 2006 5:36 pm
by garvinhicking
Hi!
Glad you got it to work
Actually you should be able to make the podcast plugin also perform replacements on static pages, yes. You must enable the "Appl ymarkup transformations" option for the page then.
Regards,
Garvin
Posted: Mon Sep 25, 2006 10:10 pm
by bdconnolly
I am still not getting it to work in the static pages.
Thoughts?
Posted: Tue Sep 26, 2006 12:05 am
by judebert
Did you configure the static pages plugin to "Apply Markup Transformations"?
Posted: Tue Sep 26, 2006 1:15 am
by bdconnolly
yep.
I'm stumped.
Posted: Tue Sep 26, 2006 4:04 am
by judebert
Weird; looks like the code expects the plugin to be configured for markup, then calls frontend_display hook, then checks if "markup_staticpage" has been set. The only plugin that can do that is serendipity_event_smartymarkup.
So, if you've got the Smarty markup plugin, it'll always override any other static page markup. Is it installed?