im Moment gibt es Probleme bei dem Download von Modulen.
Hier werden die "\" verschluckt.
Einfach bei dem Modul mal das Output-Feld löschen dann kommst Du wieder an den Artikel dran.
Code: Alles auswählen
<?php
/**
* --------------------------------------------------------------------
*
* Modul-Input: WYSIWYGImage, wysiwyg-Text mit Bild/Bildergalerie
* Version: 1.7, 02.07.2008
*
* Autor: Andreas Eberhard, andreas.eberhard@gmail.com
* http://rex.andreaseberhard.de
*
* Features:
* - Bild zum Text positionierbar
* - TinyMCE oder markitUp als Editor
* - Anzeige eines Zufallsbildes möglich
* - Bildergalerie über zusätzliches Addon möglich
*
* --------------------------------------------------------------------
*
* Das Modul benötigt die Aktion "rexnames", bei Presave-Action ADD+EDIT
* und bei Postsave-Action ADD+EDIT (REDAXO 4.x)
* [POST|ADD|EDIT] und [PRE|ADD|EDIT] bei Redaxo 3.x
*
* PHP-Code für Aktion "rexnames" (### entfernen!):
*
<###?php
$newname = "";
for ( $c = 0; $c < 99; $c++ ) {
if (isset($rexname[$c])) { $newname .= $rexname[$c] . '~~'; }
else { $newname .= '~~'; }
}
if ( isset($REX_ACTION['VALUE'][1]) and $REX_ACTION['VALUE'][1] != '') {
$rexname = split('~~', $REX_ACTION['VALUE'][1]);
} else {
$REX_ACTION['VALUE'][1] = $newname;
}
?###>
*
* --------------------------------------------------------------------
*
* Verwendete Redaxo-Variablen:
*
* REX_VALUE[1] rexnames
* rexname[0] -
* rexname[1] Anzeigetyp
* rexname[2] Schalter für Zufallsbild
* rexname[3] Schalter für Link in neuem Fenster
* rexname[4] optionale CSS-Klasse
* rexname[5] Bildbeschreibungen aus dem Medienpool (Bildergalerie)
* rexname[6] Pre-HTML
* rexname[7] Post-HTML
* rexname[8] Filter für das Bild (REDAXO 4.0.x)
* rexname[9] Filter für die Bildergalerie (REDAXO 4.0.x)
* REX_VALUE[2] Wysiwyg-Text
* REX_VALUE[3] Bildunterschrift
* REX_VALUE[4] Medienpool-Kategorie
* REX_VALUE[5] Bildausrichtung
* REX_VALUE[6] Bild-Größe
* REX_VALUE[7] Adresse externer Link
* REX_VALUE[8] Bild-Größe der Galeriebilder
* REX_MEDIALIST[1] ausgewählte Bilder aus dem Medienpool
* REX_LINK_ID[2] interner Link
*
* --------------------------------------------------------------------
*
* Changelog:
* 02.07.2008 Version 1.7
* - Action angepasst
* - markitUp als Editor möglich
* - erweitert für Addons Lytebox, Lightview
* 19.03.2008 Version 1.6
* - Anpassung an REDAXO 4.1.x
* - Bugfix bei Galerie mit Thickbox
* - Action angepasst
* 07.02.2008 Version 1.5
* - target="_blank" wird jetzt umgesetzt in onclick="window.open(this.href); return false;"
* - '<div align="center">' => '<div style="text-align:center;">'
* 10.12.2007 Version 1.4
* - Bild jetzt auch ohne Resize möglich
* - Größenangabe für die Galeriebilder möglich
* - PHP Warnings/Notices usw. entfernt
* - Anpassung an Redaxo-Versionen ab 3.01 inkl. 4.0.1
* - neue Option für Bildbeschreibungen (rexname[5])
* - neue Optionen PRE+POST-Html (rexname[6]+rexname[7])
* - neue Option Grafik-Filter (rexname[8], ab REDAXO 4.0.x)
* - neue Option Grafik-Filter für Bildergalerie (rexname[9], ab REDAXO 4.0.x)
* - CSS überarbeitet, IE7-Hack wg. Rollbalken
* - erweitert für Addons jQueryLightbox, Shadowbox
* - Backend überarbeitet
* 25.09.2007 Version 1.3
* INPUT-Modul
* - Anpassung an Redaxo 3.01 und 3.11
* - Anpassung Modulkonfiguration
* OUTPUT-Modul
* - Anpassung an Redaxo 3.01 und 3.11
* - Keine Ausgabe wenn kein Text und keine Bilder ausgewählt
* 22.09.2007 Version 1.2
* INPUT-Modul
* - Anpassung der Auswahl Medienpool-Kategorie an Redaxo 3.2.x und 3.3.x
* - Anpassung des WYSIWYG-Editors an Redaxo 3.2.x und 3.3.x
* - Bildervorschau jetzt unter dem REX_MEDIALIST_BUTTON
* - neue Option Zufallsbild anzeigen
* OUTPUT-Modul
* - Im Backend keine Links
* - Zufallsbild anzeigen
* 13.08.2007 Version 1.1
* INPUT-Modul
* - rexnames[] für weitere Optionen
* - Media-List statt Media-Button (mehrere Bilder möglich)
* - Medienpool-Kategorie als Bilderquelle auswählen (inkl. Zugriffs-Berechtigungen)
* - Erweitert um Popupimg/Lightbox/Thickbox/Greybox/Slimbox
* OUTPUT-Modul
* - rexnames[] für weitere Optionen
* - Erweitert um Popupimg/Lightbox/Thickbox/Greybox/Slimbox
* 13.11.2006 Version 1.0 Erste Version
*
* --------------------------------------------------------------------
*/
unset($rxmodule);
/**
* markitUp statt TiniMCE für das Textfeld (ab Redaxo 4.0)
* auch im Output-Modul auf true setzen!
*/
$rxmodule['markitup'] = false;
/**
* Im Backend für Vorschau Standard-CSS ausgeben
*/
if ( ($REX['REDAXO'] == '1') and function_exists('rex_register_extension') ) {
rex_register_extension('OUTPUT_FILTER', 'WYSIWYGImage_opf');
if (!function_exists('WYSIWYGImage_opf')) {
function WYSIWYGImage_opf($params) {
$content = $params['subject'];
$WYSIWYGImage_css =<<<END
<style type="text/css">
/**
* Modul WYSIWYGImage, Wysiwyg-Text mit Bild/Bildergalerie
*/
div.wysiwygimg {}
/* ----- Hack only for IE 7 ----- */
*+html div.wysiwygimg {overflow:hidden;}
.wysiwygimg .wysiwygimgclear {clear:both; display:block; font-size:1px; line-height:0px; margin:0; padding:0; position:relative;}
/* Text */
.wysiwygimg .wysiwygimgtext {}
/* Bild und Link */
.wysiwygimg img.wysiwygimg {border:0; margin:1px;}
.wysiwygimg img.wysiwygimg {border:solid 5px #f5f5f5; padding:1px;}
.wysiwygimg a.wysiwygimg img {border:0;padding:0px;vertical-align:top; margin:1px;}
.wysiwygimg a.wysiwygimg, .wysiwygimg a.wysiwygimg:link {border:solid 5px #f6f6f6; display:table; display:inline-block; line-height:0.0em;}
.wysiwygimg a.wysiwygimg:visited {}
.wysiwygimg a.wysiwygimg:hover {border:solid 5px #e4e4e4;}
.wysiwygimg a.wysiwygimg:focus {border:solid 5px #e4e4e4;}
.wysiwygimg a.wysiwygimg:active {border:solid 5px #e4e4e4;}
/* Bildunterschrift */
.wysiwygimg .wysiwygimgtitle {color:#666; font-size:0.8em; font-style:italic; margin:2px 0px;}
/* Wrapper-Classe um Bild und Bildunterschrift*/
.wysiwygimg .wysiwygimgwrap {}
/* Bild links im Text (Textumfluss) */
.wysiwygimg .wysiwygimgleft {float:left; margin:0 1.0em 0 0;}
/* Bild rechts im Text (Textumfluss) */
.wysiwygimg .wysiwygimgright {float: right; margin:0 0 0 1.0em;}
/* Bild oben links */
.wysiwygimg .wysiwygimgtopleft {float:left; margin-bottom:0.5em;}
/* Bild oben rechts */
.wysiwygimg .wysiwygimgtopright {float:right; margin-bottom:0.5em;}
/* Bild oben mittig */
.wysiwygimg .wysiwygimgtopcenter {margin-bottom:0.5em; text-align:center;}
.wysiwygimg .wysiwygimgtopcenter a.wysiwygimg {margin:0 auto;}
/* Bild unten links */
.wysiwygimg .wysiwygimgbottomleft {float:left; margin-top:0.5em;}
/* Bild unten rechts */
.wysiwygimg .wysiwygimgbottomright {float:right; margin-top:0.5em;}
/* Bild unten mittig */
.wysiwygimg .wysiwygimgbottomcenter {margin-top:0.5em; text-align:center;}
.wysiwygimg .wysiwygimgbottomcenter a.wysiwygimg {margin:0 auto;}
.wysiwygimg .wysiwygimgbottomcenter img.wysiwygimg {margin:0 auto;}
/* Für Bilder links/rechts vom Text */
.wysiwygimg table {border-spacing: 0px; font-size:1.0em;}
.wysiwygimg td {vertical-align:top; font-size:1.0em;}
/* Bild links vom Text */
.wysiwygimg td.wysiwygimgleftcol {padding-right:1.0em;}
/* Bild rechts vom Text */
.wysiwygimg td.wysiwygimgrightcol {padding-left:1.0em;}
</style>
END;
return str_replace('</head>', "\n" . $WYSIWYGImage_css . "\n" . '</head>', $content);
}
}
}
/**
* --------------------------------------------------------------------
* Links für weitere Bilder aufbereiten
* --------------------------------------------------------------------
*/
if (!function_exists('wysiwygimg_imageLinks')) {
function wysiwygimg_imageLinks( &$rxmodule ) {
global $REX;
if (@count($rxmodule['imagelist']) < 2) { return; }
for ($i = 1; $i <= @count($rxmodule['imagelist'])-1; $i++) {
$rxmodule['media'] = OOMedia::getMediaByName($rxmodule['imagelist'][$i]);
if ($rxmodule['media']) {
$rxmodule['mediatitle'] = '';
if ( in_array($rxmodule['rexversion'], array('3.01', '3.11', '32')) ) { // REDAXO 3.2.x, REDAXO 3.01, REDAXO 3.11
$rxmodule['w_title'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getTitle());
$rxmodule['w_desc'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getDescription());
$rxmodule['w_copy'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getCopyright());
}
if ( in_array($rxmodule['rexversion'], array('40', '41', '42')) ) { // REDAXO 4.0.x, 4.1.x, 4.2.x
$rxmodule['w_title'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getValue('title'));
$rxmodule['w_desc'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getValue('description'));
$rxmodule['w_copy'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getValue('copyright'));
}
if ($rxmodule['imgdesc'] == '1') {
$rxmodule['mediatitle'] = $rxmodule['w_title'];
}
if ($rxmodule['imgdesc'] == '2') {
$rxmodule['mediatitle'] = $rxmodule['w_desc'];
}
if ($rxmodule['imgdesc'] == '3') {
$rxmodule['mediatitle'] = $rxmodule['w_copy'];
}
if ($rxmodule['imgdesc'] == '4') {
$rxmodule['mediatitle'] = $rxmodule['w_title'] . ' ' . $rxmodule['w_desc'];
}
if ($rxmodule['imgdesc'] == '5') {
$rxmodule['mediatitle'] = $rxmodule['w_title'] . ' ' . $rxmodule['w_copy'];
}
if ($rxmodule['imgdesc'] == '6') {
$rxmodule['mediatitle'] = $rxmodule['w_desc'] . ' ' . $rxmodule['w_copy'];
}
if ($rxmodule['imgdesc'] == '7') {
$rxmodule['mediatitle'] = $rxmodule['w_title'] . ' ' . $rxmodule['w_desc'] . ' ' . $rxmodule['w_copy'];
}
} else {
$rxmodule['mediatitle'] = '';
}
if ($rxmodule['mediatitle'] == '') {
$rxmodule['mediatitle'] = ' ';
}
$rxmodule['original'] = $REX['HTDOCS_PATH'] . 'files/' . $rxmodule['imagelist'][$i];
if (isset($rxmodule['galimgsize']) and ($rxmodule['galimgsize'] <> '') ) {
$rxmodule['resizeto'] = $rxmodule['galimgsize'];
$rxmodule['resizes'] = substr($rxmodule['resizeto'], 0, 1);
if ( !in_array(substr($rxmodule['resizes'], 0, 1), array('a', 'h', 'w')) ) {
$rxmodule['resizes'] = 'w';
}
$rxmodule['resizeto'] = str_replace( array('w', 'h', 'a'), '', $rxmodule['resizeto']);
$rxmodule['original'] = $REX['HTDOCS_PATH'] . "index.php?rex_resize=" . $rxmodule['resizeto'] . $rxmodule['resizes'] . "__" . $rxmodule['imagelist'][$i];
if ( $rxmodule['galfilter'] <> '') {
$va = explode(',', $rxmodule['galfilter']);
foreach( $va as $fi ) {
$rxmodule['original'] .= '&rex_filter[]=' . trim($fi);
}
}
}
$rxmodule['imghtml'] .= '';
if ($rxmodule['displaytype'] == "greybox" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="gb_imageset[gb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "jquerylightbox" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="lightbox[jqlb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "lightbox" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="lightbox[lb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "lightview" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" class="lightview" rel="gallery[lv' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "lytebox" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="lytebox[lb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "pho2" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="pho2[pho2' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "shadowbox" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="shadowbox[sb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "slimbox" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="lightbox[sb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "thickbox" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" class="thickbox" rel="tb' . $rxmodule['wysiwygid'] . '" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
}
}
} // End function_exists
/**
* --------------------------------------------------------------------
* WYSIWYG-HTML-Code für die Ausgabe aufbereiten (valider code)
* --------------------------------------------------------------------
*/
if (!function_exists('wysiwygimg_cleanWysiwygCode')) {
function wysiwygimg_cleanWysiwygCode( $htmlcode ) {
$teximg_opts['codereplace'] = array(
'<hr>' => '<hr />' ,
'<br>' => '<br />' ,
'<b>' => '<strong>' ,
'</b>' => '</strong>' ,
'<i>' => '<em>' ,
'</i>' => '</em>' ,
'<tbody>' => '' ,
'</tbody>' => '' ,
'ä' => 'ä' ,
'ö' => 'ö' ,
'ü' => 'ü' ,
'Ä' => 'Ä' ,
'Ö' => 'Ö' ,
'Ü' => 'Ü' ,
'ß' => 'ß',
' ismap="ismap"'=> '',
' ismap="true"' => '',
' target="_self"' => '',
' target="_blank"' => ' onclick="window.open(this.href); return false;"',
'<div align="center">' => '<div style="text-align:center;">',
'<hr width="100%" size="2" />' => '<hr />'
);
$output = $htmlcode;
// Tags in Kleinbuchstaben
$output = preg_replace(',<(/?)([a-zA-Z]+)([^>]+)?(/?)>,ie', '"<\1".strtolower("\2")."\3\4>"', $output);
// Kommentare entfernen
$output = preg_replace ("#<!\-\-.*?\-\->#si", "", $output);
// JavaScript entfernen
$output = preg_replace ("#<script[^>]*?>.*?</script>#si", "", $output);
// Abschlusstags einfügen z.B. <img ...> wird <img ... />
$output = preg_replace ("/<(img|input|meta|base|basefont|param|link|area)(.*)>/sU","<\\1\\2 />", $output);
$output = str_replace(" / />", " />",$output);
// Attribute in Kleinbuchstaben und Anführungszeichen
$output = preg_replace ("/\s([a-zA-Z]+)=([a-zA-Z\d:punct:\/_\-@\.#\,\*\+\&\=äöü?]+)\s/mie", '" ".strtolower("\1")."=\"\2\" "' , $output);
$output = preg_replace ("/\s([a-zA-Z]+)=([a-zA-Z\d:punct:\/_\-@\.#\,\*\+\&\=äöü?]+)\s/mie", '" ".strtolower("\1")."=\"\2\" "' , $output);
$output = preg_replace ("/\s([a-zA-Z]+)=([a-zA-Z\d:punct:\/_\-@\.#\,\*\+\&\=äöü?]+)\>/mie", '" ".strtolower("\1")."=\"\2\">"' , $output);
$output = preg_replace ("/\s([a-zA-Z]+)=\"([a-zA-Z\d:punct:\/_\-@\.#\,\*\+\&\=äöü?]+)\"\s/mie", '" ".strtolower("\1")."=\"\2\" "' , $output);
// TABLE/TD bgcolor,height entfernen
$output = preg_replace("/<table([^>]*)bgcolor=([^>|\s]*)([^>]*)>/im", "<table $1 $3>", $output);
$output = preg_replace("/<table([^>]*)height=([^>|\s]*)([^>]*)>/im", "<table$1$3>", $output);
$output = preg_replace("/<td([^>]*)height=([^>|\s]*)([^>]*)>/im", "<td$1$3>", $output);
$output = preg_replace("/<td([^>]*)width=\"\"([^>|\s]*)([^>]*)>/im", "<td$1$3>", $output);
// fehlende Alt-tags einsetzen
$output = preg_replace("/<img([^>]*)alt=([^>]*)>/im", "<img$1`alt=$2>", $output);
$output = preg_replace("/<img([^`|>]*)>/im", "<img alt=\" \"$1>", $output);
$output = preg_replace("/<img([^>]*)`alt=([^>]*)>/im", "<img$1alt=$2>", $output);
// Tabelle mit Code-Ersetzungen
foreach( $teximg_opts['codereplace'] as $key => $unit ) {
$output = str_replace( $key, $unit, $output );
}
return "\n" . $output . "\n";
}
} // End function_exists
/**
* --------------------------------------------------------------------
* Start Modul-Ausgabe
* --------------------------------------------------------------------
*/
$rxmodule['moduleversion'] = 'WYSIWYGImage 1.7';
// REDAXO-Version
$rxmodule['rexversion'] = isset($REX['VERSION']) ? $REX['VERSION'] . $REX['SUBVERSION'] : $REX['version'] . $REX['subversion'];
$rxmodule['rexname'] = split("~~", "REX_VALUE[1]");
$rxmodule['rexnames_inuse'] = count($rxmodule['rexname']) > 1;
if (!$rxmodule['rexnames_inuse']) {
$rxmodule['rexname'] = array_fill(0, 99, '');
}
/**
* WYSIWYG-HTML in Variable übernehmen
*/
$rxmodule['htmlvalue'] =<<< EOT
REX_HTML_VALUE[2]
EOT;
$rxmodule['htmlvalue'] = trim($rxmodule['htmlvalue']);
if ($rxmodule['markitup'] === true) {
$textile = '';
$textile = htmlspecialchars_decode($rxmodule['htmlvalue']);
$textile = str_replace("<br />","",$textile);
$textile = rex_a79_textile($textile);
$textile = str_replace("###"," ",$textile);
$rxmodule['htmlvalue'] = $textile;
} else {
if ($rxmodule['htmlvalue'] <> '') {
$rxmodule['htmlvalue'] = wysiwygimg_cleanWysiwygCode($rxmodule['htmlvalue']);
}
}
/**
* sonstige Werte übernehmen
*/
// Bildbeschreibung
$rxmodule['imgtitle'] = stripslashes(trim("REX_VALUE[3]"));
// Medienpool-Kategorie
$rxmodule['mediacat'] = trim("REX_VALUE[4]");
// Bildausrichtung
$rxmodule['imgpos'] = trim("REX_VALUE[5]");
if (trim($rxmodule['imgpos'])=="") {
$rxmodule['imgpos'] = '0';
}
// Thumbnail-Größe
$rxmodule['imgsize'] = trim("REX_VALUE[6]");
if ( trim($rxmodule['imgsize']) <> '') {
if ( !in_array(substr($rxmodule['imgsize'], 0, 1), array('a', 'h', 'w')) ) {
$rxmodule['imgsize'] = 'w' . $rxmodule['imgsize'];
}
}
// Bild-Größe der Galeriebilder
$rxmodule['galimgsize'] = trim("REX_VALUE[8]");
if ( trim($rxmodule['galimgsize']) <> '') {
if ( !in_array(substr($rxmodule['galimgsize'], 0, 1), array('a', 'h', 'w')) ) {
$rxmodule['galimgsize'] = 'w' . $rxmodule['galimgsize'];
}
}
// Anzeigetyp
$rxmodule['displaytype'] = trim($rxmodule['rexname'][1]);
// interner Link
$rxmodule['intlink'] = "REX_LINK_ID[2]";
$rxmodule['intlinkurl'] = rex_GetUrl($rxmodule['intlink']);
// externer Link
$rxmodule['extlink'] = trim("REX_VALUE[7]");
// Zufallsbild
$rxmodule['randompic'] = trim($rxmodule['rexname'][2]);
// Link in neuem Fenster?
$rxmodule['newwindow'] = trim($rxmodule['rexname'][3]);
// CSS-Klasse
$rxmodule['cssclass'] = trim($rxmodule['rexname'][4]);
if ( ($REX['REDAXO'] == '1') or (trim($rxmodule['cssclass'])=='') ) {
$rxmodule['cssclass'] = 'wysiwygimg';
}
// Bildbeschreibungen aus dem Medienpool
$rxmodule['imgdesc'] = trim($rxmodule['rexname'][5]);
// Pre + Post-HTML
$rxmodule['prehtml'] = stripslashes(trim($rxmodule['rexname'][6]));
$rxmodule['posthtml'] = stripslashes(trim($rxmodule['rexname'][7]));
// Filter für das Bild (ab REDAXO 4.0.x)
$rxmodule['filter'] = trim($rxmodule['rexname'][8]);
// Filter für die Bildergalerie (ab REDAXO 4.0.x)
$rxmodule['galfilter'] = trim($rxmodule['rexname'][9]);
// damit das Modul mehrfach in einem Artikel verwendet werden kann
// wird hier eine Zufallszahl ermittelt!
srand((double)microtime()*1000000);
$rxmodule['wysiwygid'] = rand (100,900) . rand (100,900);
/**
* --------------------------------------------------------------------
* Bilder aus Medialist oder Medienpool-Kategorie ermitteln
* --------------------------------------------------------------------
*/
// Bilddateien aus Medialist
$rxmodule['imagelist'] = explode(',', trim("REX_MEDIALIST[1]"));
// Wenn eine Medienpool-Kategorie vorgegeben ist dann die Bilder aus dieser Kategorie verwenden
if (isset($rxmodule['mediacat']) and ($rxmodule['mediacat']<>'') and ($rxmodule['mediacat']<>'0')) {
$rxmodule['media'] = OOMediaCategory::getCategoryById($rxmodule['mediacat']);
if ($rxmodule['media']) {
$rxmodule['mediafiles'] = $rxmodule['media']->getFiles();
if (count($rxmodule['mediafiles']) > 0) {
unset($rxmodule['imagelist']);
$rxmodule['imagelist'] = array();
$rxmodule['filetypes'] = array('jpg','gif','jpeg','png','bmp');
foreach ($rxmodule['mediafiles'] as $rxmodule['mediafile']) {
$rxmodule['file'] = $rxmodule['mediafile']->getFileName();
$rxmodule['fileinfo'] = pathinfo($rxmodule['file']);
$rxmodule['extension'] = strtolower($rxmodule['fileinfo']['extension']);
if (in_array($rxmodule['extension'],$rxmodule['filetypes'])) {
$rxmodule['imagelist'][] = $rxmodule['file'];
}
}
}
}
}
// Array mischen wg. Zufallsbild
if ( ($rxmodule['randompic'] == '1') and (count($rxmodule['imagelist']) > 1) ) {
shuffle($rxmodule['imagelist']);
}
/**
* Bild vorhanden -> HTML-Code für Bild und evtl. Link zusammenbauen
*/
if ($rxmodule['imagelist'][0] != '') {
$rxmodule['original'] = $REX['HTDOCS_PATH'] . 'files/' . $rxmodule['imagelist'][0];
$rxmodule['info'] = getimagesize($rxmodule['original']);
if (isset($rxmodule['galimgsize']) and ($rxmodule['galimgsize'] <> '') ) {
$rxmodule['resizeto'] = $rxmodule['galimgsize'];
$rxmodule['resizes'] = substr($rxmodule['resizeto'], 0, 1);
if ( !in_array(substr($rxmodule['resizes'], 0, 1), array('a', 'h', 'w')) ) {
$rxmodule['resizes'] = 'w';
}
$rxmodule['resizeto'] = str_replace( array('w', 'h', 'a'), '', $rxmodule['resizeto']);
$rxmodule['original'] = $REX['HTDOCS_PATH'] . "index.php?rex_resize=" . $rxmodule['resizeto'] . $rxmodule['resizes'] . "__" . $rxmodule['imagelist'][0];
if ( $rxmodule['galfilter'] <> '') {
$va = explode(',', $rxmodule['galfilter']);
foreach( $va as $fi ) {
$rxmodule['original'] .= '&rex_filter[]=' . trim($fi);
}
}
}
$rxmodule['owidth'] = $rxmodule['info'][0];
$rxmodule['oheight'] = $rxmodule['info'][1];
$rxmodule['resizeto'] = $rxmodule['imgsize'];
$rxmodule['resizes'] = substr($rxmodule['resizeto'], 0, 1);
if ( !in_array(substr($rxmodule['resizes'], 0, 1), array('a', 'h', 'w')) ) {
$rxmodule['resizes'] = 'w';
}
$rxmodule['resizeto'] = str_replace( array('w', 'h', 'a'), '', $rxmodule['resizeto']);
if ( trim($rxmodule['resizeto']) <> '') {
$rxmodule['smallimage'] = $REX['HTDOCS_PATH'] . "index.php?rex_resize=" . $rxmodule['resizeto'] . $rxmodule['resizes'] . "__" . $rxmodule['imagelist'][0];
if ( $rxmodule['filter'] <> '') {
$va = explode(',', $rxmodule['filter']);
foreach( $va as $fi ) {
$rxmodule['smallimage'] .= '&rex_filter[]=' . trim($fi);
}
}
} else {
$rxmodule['smallimage'] = $rxmodule['original'];
$rxmodule['rwidth'] = $rxmodule['owidth'];
$rxmodule['rheight'] = $rxmodule['oheight'];
}
$rxmodule['pwidth'] = $rxmodule['info'][0]+20;
$rxmodule['pheight'] = $rxmodule['info'][1]+30;
$rxmodule['popup'] = $rxmodule['original'];
if (file_exists($REX['HTDOCS_PATH'] . 'files/popupimg.php')) {
$rxmodule['popup'] = 'files/popupimg.php?image=' . $rxmodule['original'];
}
if ( ($rxmodule['intlink'] == '') or ($rxmodule['intlink'] == 0) ) {
$rxmodule['intlink'] = '';
$rxmodule['intlinkurl'] = '';
}
if ($rxmodule['resizes']=='h') {
$rxmodule['rheight'] = $rxmodule['resizeto'];
$rxmodule['rwidth'] = $rxmodule['resizeto'] * $rxmodule['owidth'] / $rxmodule['oheight'];
$rxmodule['rwidth'] = intval($rxmodule['rwidth']);
} else
if ($rxmodule['resizes']=='a') {
if ($rxmodule['owidth'] <= $rxmodule['oheight']) {
$rxmodule['rheight'] = $rxmodule['resizeto'];
$rxmodule['rwidth'] = $rxmodule['resizeto'] * $rxmodule['owidth'] / $rxmodule['oheight'];
$rxmodule['rwidth'] = intval($rxmodule['rwidth']);
} else {
$rxmodule['rwidth'] = $rxmodule['resizeto'];
$rxmodule['rheight'] = $rxmodule['resizeto'] * $rxmodule['oheight'] / $rxmodule['owidth'];
$rxmodule['rheight'] = intval($rxmodule['rheight']);
}
} else {
$rxmodule['rwidth'] = $rxmodule['resizeto'];
$rxmodule['rheight'] = $rxmodule['resizeto'] * $rxmodule['oheight'] / $rxmodule['owidth'];
$rxmodule['rheight'] = intval($rxmodule['rheight']);
}
if ( (trim($rxmodule['rwidth']) == '') or (trim($rxmodule['rwidth']) == '0') or (trim($rxmodule['rheight']) == '') or (trim($rxmodule['rheight']) == '0') ) {
$rxmodule['rwidth'] = $rxmodule['owidth'];
$rxmodule['rheight'] = $rxmodule['oheight'];
}
$rxmodule['media'] = OOMedia::getMediaByName($rxmodule['imagelist'][0]);
if ($rxmodule['media']) {
$rxmodule['mediatitle'] = ' ';
if ( in_array($rxmodule['rexversion'], array('3.01', '3.11', '32')) ) { // REDAXO 3.2.x, REDAXO 3.01, REDAXO 3.11
$rxmodule['w_title'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getTitle());
$rxmodule['w_desc'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getDescription());
$rxmodule['w_copy'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getCopyright());
}
if ( in_array($rxmodule['rexversion'], array('40', '41', '42')) ) { // REDAXO 4.0.x, 4.1.x, 4.2.x
$rxmodule['w_title'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getValue('title'));
$rxmodule['w_desc'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getValue('description'));
$rxmodule['w_copy'] = str_replace(array("\r\n", "\n", "\r"), ' ', $rxmodule['media']->getValue('copyright'));
}
if ($rxmodule['imgdesc'] == '1') {
$rxmodule['mediatitle'] = $rxmodule['w_title'];
}
if ($rxmodule['imgdesc'] == '2') {
$rxmodule['mediatitle'] = $rxmodule['w_desc'];
}
if ($rxmodule['imgdesc'] == '3') {
$rxmodule['mediatitle'] = $rxmodule['w_copy'];
}
if ($rxmodule['imgdesc'] == '4') {
$rxmodule['mediatitle'] = $rxmodule['w_title'] . ' ' . $rxmodule['w_desc'];
}
if ($rxmodule['imgdesc'] == '5') {
$rxmodule['mediatitle'] = $rxmodule['w_title'] . ' ' . $rxmodule['w_copy'];
}
if ($rxmodule['imgdesc'] == '6') {
$rxmodule['mediatitle'] = $rxmodule['w_desc'] . ' ' . $rxmodule['w_copy'];
}
if ($rxmodule['imgdesc'] == '7') {
$rxmodule['mediatitle'] = $rxmodule['w_title'] . ' ' . $rxmodule['w_desc'] . ' ' . $rxmodule['w_copy'];
}
} else {
$rxmodule['mediatitle'] = ' ';
}
$rxmodule['target'] = '';
if ($rxmodule['newwindow'] == "1")
$rxmodule['target'] = ' onclick="window.open(this.href); return false;" ';
$rxmodule['imgtag'] = '<img class="' . $rxmodule['cssclass'] . '" src="'. $rxmodule['smallimage'] . '" title="' . $rxmodule['mediatitle'] . '" alt="' . $rxmodule['mediatitle'] . '"' . ' width="' . $rxmodule['rwidth'] . '" height="' . $rxmodule['rheight'] .'" />';
if ( ($rxmodule['displaytype'] == "showonly") or ($rxmodule['displaytype'] == "" ) ) {
$rxmodule['imghtml'] = $rxmodule['imgtag'];
}
if ($rxmodule['displaytype'] == "popup" ) {
$rxmodule['onclick'] = 'onclick="popup=window.open(\'' . $rxmodule['popup'] . '\',\'wysiwygimgpopup\',\'scrollbars=no,resizable=no, status=yes,menubar=no,width=' . $rxmodule['pwidth'] . ',height=' . $rxmodule['pheight'] . ',top=0,left=0\'); popup.focus(); return false;"';
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" href="' . $rxmodule['original'] . '" ' . $rxmodule['onclick'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "greybox" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="gb_imageset[gb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "jquerylightbox" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="lightbox[jqlb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "lightbox" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="lightbox[lb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "lightview" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . ' lightview" rel="gallery[lv' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "lytebox" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="lytebox[lb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "pho2" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="pho2[pho2' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "shadowbox" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="shadowbox[sb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "slimbox" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="lightbox[sb' . $rxmodule['wysiwygid'] . ']" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['displaytype'] == "thickbox" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . ' thickbox" rel="tb' . $rxmodule['wysiwygid'] . '" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imgtag'] . '</a>';
}
wysiwygimg_imageLinks($rxmodule);
if ($rxmodule['intlink'] != '') {
$rxmodule['imghtml'] = '<a class="'.$rxmodule['cssclass'] . '" href="' . $rxmodule['intlinkurl'] . '"' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ($rxmodule['extlink'] != '') {
$rxmodule['imghtml'] = '<a class="'.$rxmodule['cssclass'] . '" href="' . $rxmodule['extlink'] . '"' . $rxmodule['target'] . '>' . $rxmodule['imgtag'] . '</a>';
}
if ( $REX['REDAXO'] == '1' ) { // Im Backend keine Links generieren
$rxmodule['imghtml'] = $rxmodule['imgtag'];
}
if ($rxmodule['imgtitle'] != '') {
$rxmodule['imghtml'] .= '<div class="' . $rxmodule['cssclass'] . 'title">' . html_entity_decode($rxmodule['imgtitle']) . '</div>';
}
}
/**
* --------------------------------------------------------------------
* Ausgabe Text und Bild
* --------------------------------------------------------------------
*/
if ( ($rxmodule['htmlvalue'] != '') or ($rxmodule['imagelist'][0] != '') ) {
echo "\n<!-- " . $rxmodule['moduleversion'] . " -->";
if ($rxmodule['prehtml']) {
echo "\n" . html_entity_decode($rxmodule['prehtml']);
}
echo "\n".'<div class="'.$rxmodule['cssclass'].'">'."\n";
switch ($rxmodule['imgpos']):
case 0: // im Text links (Textumfluss)
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'left">'.$rxmodule['imghtml'].'</div>'."\n";
}
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
echo '<div class="'.$rxmodule['cssclass'].'clear"></div>'."\n";
break;
case 1: // im Text rechts (Textumfluss)
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'right">'. $rxmodule['imghtml'].'</div>'."\n";
}
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
echo '<div class="'.$rxmodule['cssclass'].'clear"></div>'."\n";
break;
case 2: // links vom Text
echo '<table border="0" cellspacing="0" cellpadding="0"><tr>'."\n";
if ($rxmodule['imagelist'][0] != '') {
echo '<td class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'leftcol">'. $rxmodule['imghtml'].'</td>'."\n";
}
if ($rxmodule['htmlvalue']<>'') { echo '<td class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</td>'."\n"; }
echo '</tr></table>'."\n";
break;
case 3: // rechts vom Text
echo '<table border="0" cellspacing="0" cellpadding="0"><tr>'."\n";
if ($rxmodule['htmlvalue']<>'') { echo '<td class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</td>'."\n"; }
if ($rxmodule['imagelist'][0] != '') {
echo '<td class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'rightcol">'. $rxmodule['imghtml'].'</td>'."\n";
}
echo '</tr></table>'."\n";
break;
case 4: // über dem Text links
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'topleft">'. $rxmodule['imghtml'].'</div>'."\n";
}
echo '<div class="'.$rxmodule['cssclass'].'clear"></div>'."\n";
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
break;
case 5: // über dem Text mittig
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'topcenter">'. $rxmodule['imghtml'].'</div>'."\n";
}
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
break;
case 6: // über dem Text rechts
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'topright">'. $rxmodule['imghtml'].'</div>'."\n";
}
echo '<div class="'.$rxmodule['cssclass'].'clear"></div>'."\n";
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
break;
case 7: // unter dem Text links
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'bottomleft">'. $rxmodule['imghtml'].'</div>'."\n";
}
echo '<div class="'.$rxmodule['cssclass'].'clear"></div>'."\n";
break;
case 8: // unter dem Text mittig
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'bottomcenter">'. $rxmodule['imghtml'].'</div>'."\n";
}
break;
case 9: // unter dem Text rechts
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'bottomright">'. $rxmodule['imghtml'].'</div>'."\n";
}
echo '<div class="'.$rxmodule['cssclass'].'clear"></div>'."\n";
break;
default: // Default im Text links (Textumfluss)
if ($rxmodule['imagelist'][0] != '') {
echo '<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'left">'. $rxmodule['imghtml'].'</div>'."\n";
}
if ($rxmodule['htmlvalue']<>'') { echo '<div class="'. $rxmodule['cssclass'].'text">'.$rxmodule['htmlvalue'].'</div>'."\n"; }
echo '<div class="'.$rxmodule['cssclass'].'clear"></div>'."\n";
endswitch;
echo '</div>'."\n";
if ($rxmodule['posthtml']) {
echo html_entity_decode($rxmodule['posthtml']) . "\n";
}
} else {
if ( $REX['REDAXO'] == '1' ) {
echo '<font color="#cc0000">Kein Text und keine Bilder ausgewählt!</font><br />';
}
}
?>