plugin_podcast: media links having a (configurable) CSS class style are

ignored (not replaced by players or added to RSS).
This commit is contained in:
Grischa Brockhaus 2012-03-11 03:01:14 +01:00
parent 9bd307ad39
commit 6b98172baa
5 changed files with 41 additions and 4 deletions

View file

@ -1,5 +1,8 @@
# $Id$
1.34:
* media links having a (configurable) CSS class style are ignored (not replaced by players or added to RSS).
1.33: Small lang update
1.32:

View file

@ -25,6 +25,8 @@
@define('PLUGIN_PODCAST_ALIGN_NONE', 'keine');
@define('PLUGIN_PODCAST_FIRSTMEDIAONLY', 'Nur die erste Mediendatei an den Feed Eintrag hängen');
@define('PLUGIN_PODCAST_FIRSTMEDIAONLY_DESC', 'Die RSS Spezifikation unterstützt nur einen Medienanhang pro Eintrag. Wird diese Option angeschaltet, so wird nur die erste gefundene Mediendatei pro Artikel an den Feed Eintrag angehängt.');
@define('PLUGIN_PODCAST_NOPODCASTING_CLASS', 'Ignorieren über CSS class');
@define('PLUGIN_PODCAST_NOPODCASTING_CLASS_DESC', 'Wenn ein Medien Link dieses Class Style bekommt, dann wird er ignoriert (kein Player und kein Eintrag im RSS).');
@define('PLUGIN_PODCAST_EXTATTRSETTINGS', '<br/><h3>Podcasting über die erweiterten Artikel Attribute:</h3>');
@define('PLUGIN_PODCAST_EXTATTR', 'Erweiterte Artikel Attribute');
@ -47,7 +49,7 @@
@define('PLUGIN_PODCAST_MFEXT_DESC', 'Erweiterungen, die mit dem Flash Player abgespielt werden sollen.');
@define('PLUGIN_PODCAST_XSPFEXT', 'XSPF Flashplayer Audio Erweiterungen');
@define('PLUGIN_PODCAST_XSPFEXT_DESC', 'Audio Erweiterungen, die mit dem XSPF Flashplayer abgespielt werden sollen. Dieser kann normaler Weise nur MP3 und XSPF Dateien abspielen.');
@define('PLUGIN_PODCAST_AUEXT', 'Quicktime Miniplaer Audio Erweiterungen');
@define('PLUGIN_PODCAST_AUEXT', 'Quicktime Miniplayer Audio Erweiterungen');
@define('PLUGIN_PODCAST_AUEXT_DESC', 'Audio Erweiterungen, die mit dem Quicktime Mini Player abgespielt werden sollen.');
@define('PLUGIN_PODCAST_FLVEXT', 'FLV Player Erweiterungen');
@define('PLUGIN_PODCAST_FLVEXT_DESC', 'Erweiterungen, die mit dem FLV Player abgespielt werden sollen. FLV ist ein Videoformat, dass für Flashplayer gedacht ist und somit Plattform unabhängig ist! Man kann normale Videoformate mit kostenlosen Konvertern in das FLV Format umwandeln (PC http://www.rivavx.com/index.php?id=483&L=0 und Mac http://www.versiontracker.com/dyn/moreinfo/macosx/15473).');

View file

@ -25,6 +25,8 @@
@define('PLUGIN_PODCAST_ALIGN_NONE', 'keine');
@define('PLUGIN_PODCAST_FIRSTMEDIAONLY', 'Nur die erste Mediendatei an den Feed Eintrag hängen');
@define('PLUGIN_PODCAST_FIRSTMEDIAONLY_DESC', 'Die RSS Spezifikation unterstützt nur einen Medienanhang pro Eintrag. Wird diese Option angeschaltet, so wird nur die erste gefundene Mediendatei pro Artikel an den Feed Eintrag angehängt.');
@define('PLUGIN_PODCAST_NOPODCASTING_CLASS', 'Ignorieren über CSS class');
@define('PLUGIN_PODCAST_NOPODCASTING_CLASS_DESC', 'Wenn ein Medien Link dieses Class Style bekommt, dann wird er ignoriert (kein Player und kein Eintrag im RSS).');
@define('PLUGIN_PODCAST_EXTATTRSETTINGS', '<br/><h3>Podcasting über die erweiterten Artikel Attribute:</h3>');
@define('PLUGIN_PODCAST_EXTATTR', 'Erweiterte Artikel Attribute');
@ -47,7 +49,7 @@
@define('PLUGIN_PODCAST_MFEXT_DESC', 'Erweiterungen, die mit dem Flash Player abgespielt werden sollen.');
@define('PLUGIN_PODCAST_XSPFEXT', 'XSPF Flashplayer Audio Erweiterungen');
@define('PLUGIN_PODCAST_XSPFEXT_DESC', 'Audio Erweiterungen, die mit dem XSPF Flashplayer abgespielt werden sollen. Dieser kann normaler Weise nur MP3 und XSPF Dateien abspielen.');
@define('PLUGIN_PODCAST_AUEXT', 'Quicktime Miniplaer Audio Erweiterungen');
@define('PLUGIN_PODCAST_AUEXT', 'Quicktime Miniplayer Audio Erweiterungen');
@define('PLUGIN_PODCAST_AUEXT_DESC', 'Audio Erweiterungen, die mit dem Quicktime Mini Player abgespielt werden sollen.');
@define('PLUGIN_PODCAST_FLVEXT', 'FLV Player Erweiterungen');
@define('PLUGIN_PODCAST_FLVEXT_DESC', 'Erweiterungen, die mit dem FLV Player abgespielt werden sollen. FLV ist ein Videoformat, dass für Flashplayer gedacht ist und somit Plattform unabhängig ist! Man kann normale Videoformate mit kostenlosen Konvertern in das FLV Format umwandeln (PC http://www.rivavx.com/index.php?id=483&L=0 und Mac http://www.versiontracker.com/dyn/moreinfo/macosx/15473).');

View file

@ -25,6 +25,8 @@
@define('PLUGIN_PODCAST_ALIGN_NONE', 'nothing');
@define('PLUGIN_PODCAST_FIRSTMEDIAONLY', 'Embed first media only as RSS enclosure');
@define('PLUGIN_PODCAST_FIRSTMEDIAONLY_DESC', 'The RSS specification supports only one enclosure per entry. If this option is enabled, the RSS specification is respected and only the first media file found will be enclosured into the RSS feed.');
@define('PLUGIN_PODCAST_NOPODCASTING_CLASS', 'Ignore by CSS class');
@define('PLUGIN_PODCAST_NOPODCASTING_CLASS_DESC', 'When media links do have this class style, they will be ignored (won\'t be replaced by players and won\'t show up in RSS).');
@define('PLUGIN_PODCAST_EXTATTRSETTINGS', '<br/><h3>Podcasting using extended article attributes:</h3>');
@define('PLUGIN_PODCAST_EXTATTR', 'Extended article attributes');

View file

@ -14,7 +14,7 @@ if (file_exists($probelang)) {
include_once dirname(__FILE__) . '/lang_en.inc.php';
include_once dirname(__FILE__) . '/podcast_player.php';
@define("SERENDIPITY_EVENT_PODCAST_VERSION", "1.33");
@define("SERENDIPITY_EVENT_PODCAST_VERSION", "1.34");
class serendipity_event_podcast extends serendipity_event {
/**
@ -71,6 +71,7 @@ class serendipity_event_podcast extends serendipity_event{
'height',
'align',
'firstmedia_only',
'nopodcasting_class',
'epheader',
'extendet_enclosure_attributes',
'extendet_enclosure_position',
@ -211,7 +212,13 @@ class serendipity_event_podcast extends serendipity_event{
$propbag->add('select_values', $this->GetAlignOptionsArray());
$propbag->add('default', 'left');
break;
case 'nopodcasting_class':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_PODCAST_NOPODCASTING_CLASS);
$propbag->add('description', PLUGIN_PODCAST_NOPODCASTING_CLASS_DESC);
$propbag->add('default', 'nopodcast');
break;
case 'firstmedia_only':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_PODCAST_FIRSTMEDIAONLY);
@ -541,8 +548,21 @@ class serendipity_event_podcast extends serendipity_event{
// Last, also match the '<a href>' style, if "use_player" is disabled and thus no <embed> might exist.
$this->log("Matching playerRewritePattern");
$nopodcasting_class = $this->get_config('nopodcasting_class','nopodcast');
if (!empty($nopodcasting_class)) {
$classPattern = '@class\s*=\s*(\'|")\s*' . $nopodcasting_class . '\s*(\'|")+@si';
}
if (!$use_player && preg_match_all($patterns['playerRewritePattern'], $matchSource, $matches)) {
for ($i = 0, $maxi = count($matches[1]); $i < $maxi; $i++){
$complete = $matches[0];
if (!empty($nopodcasting_class) && preg_match($classPattern, $complete)) {
$this->log("NoPodcasting class found!");
continue;
}
else {
$this->log("NoPodcasting class not found! [" . $classPattern . "]");
}
$url = $matches[2][$i];
$fileInfo = $this->GetFileInfo($url);
$type = $fileInfo['mime'];
@ -783,6 +803,14 @@ class serendipity_event_podcast extends serendipity_event{
function playerRewriteCallBack($treffer) {
global $serendipity;
$this->log('playerRewriteCallBack: treffer=' . print_r($treffer,true));
// Check for nopodcasting class
$nopodcasting_class = $this->get_config('nopodcasting_class','nopodcast');
if (!empty($nopodcasting_class)) {
$classPattern = '@class\s*=\s*(\'|")\s*' . $nopodcasting_class . '\s*(\'|")+@si';
if (preg_match($classPattern , $treffer[0])) return $treffer[0];
}
$fileUrl = $serendipity['baseURL'] . $treffer[2];
if (serendipity_db_bool($this->get_config('automatic_size', 'false'))) {
$fileInfo = $this->GetFileInfo($treffer[2]);