Code: Alles auswählen
<?php
/**
* --------------------------------------------------------------------
*
* Modul-Output: WYSIWYGImage, wysiwyg-Text mit Bild/Bildergalerie
* Version: 1.9, 20.01.2011
*
* 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
$rexname = rex_request("rexname", "array");
$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)
* rexname[10] Filter für das MouseOver-Bild (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
* REX_MEDIA_BUTTON[1] MouseOver-Bild
*
* --------------------------------------------------------------------
*
* Changelog:
* 20.01.2011 Version 1.9
* - Anpassung an REDAXO 4.3.x
* - erweitert für Addon fancybox, rexfancy
* 23.07.2009 Version 1.8
* - Anpassung an REDAXO 4.2.x ($REX_USER -> $REX['USER'])
* - jetzt auch Kategorie + Einzelauswahl möglich
* - MouseOver-Bild möglich
* - leichte Anpassung des Backends
* - Code für Aktion rexnames angepasst ($rexname = rex_request...)
* - Funktion wysiwygimg_cleanWysiwygCode entfernt
* - Filter jetzt auch bei nur einem Bild, Popup-Größe angepasst falls maximale
* Größe vorgegeben ist
* 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);
/**
* Bei Verwendung von markitUp statt TinyMCE für das Textfeld (ab Redaxo 4.0)
* auch im Input-Modul auf true setzen!
*/
$rxmodule['markitup'] = true;
/**
* 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($rxm)
{
global $REX;
$rxmodule = $rxm;
if (@count($rxmodule['imagelist']) < 2) { return $rxmodule; }
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());
} else { // ab REDAXO 4.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'] .= "\n";
if ($rxmodule['displaytype'] == "popup" ) {
$rxmodule['imghtml'] .= '<a style="width:0px;height:0px;font-size:0px;overflow:hidden;display:block;" rel="fancybox_gallery" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
if ($rxmodule['displaytype'] == "fancybox" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="fancybox" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '">' . $rxmodule['imagelist'][$i] . '</a>';
}
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'] == "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'] == "rexfancy" ) {
$rxmodule['imghtml'] .= '<a style="display:none;" rel="rexfancy" 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>';
}
}
return $rxmodule;
}
} // End function_exists
/**
* --------------------------------------------------------------------
* Start Modul-Ausgabe
* --------------------------------------------------------------------
*/
$rxmodule['moduleversion'] = 'WYSIWYGImage 1.9';
// 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);
$rxmodule['htmlvalue'] = $textile;
}
/**
* 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]);
// Filter für das MouseOver-Bild (ab REDAXO 4.0.x)
$rxmodule['overimage'] = trim('REX_FILE[1]');
// Filter für das MouseOver-Bild (ab REDAXO 4.0.x)
$rxmodule['overfilter'] = trim($rxmodule['rexname'][10]);
// 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) {
$rxmodule['filetypes'] = array('jpg','gif','jpeg','png','bmp');
if (is_array($rxmodule['imagelist']) and (count($rxmodule['imagelist'])==1) and ($rxmodule['imagelist'][0]=='')) {
$rxmodule['imagelist'] = array();
}
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']);
$rxmodule['pwidth'] = $rxmodule['info'][0]+20;
$rxmodule['pheight'] = $rxmodule['info'][1]+30;
if ((isset($rxmodule['galimgsize']) and ($rxmodule['galimgsize'] <> '')) or ( $rxmodule['galfilter'] <> '')) {
if ($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';
}
} else {
if ($rxmodule['info'][0] > $rxmodule['info'][1]) {
$rxmodule['resizeto'] = $rxmodule['info'][0];
} else {
$rxmodule['resizeto'] = $rxmodule['info'][1];
}
$rxmodule['resizes'] = 'a';
}
$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];
$rxmodule['owidth'] = $rxmodule['info'][0];
$rxmodule['oheight'] = $rxmodule['info'][1];
if ($rxmodule['resizes']=='h') {
$rxmodule['pheight'] = $rxmodule['resizeto'];
$rxmodule['pwidth'] = $rxmodule['resizeto'] * $rxmodule['owidth'] / $rxmodule['oheight'];
$rxmodule['pwidth'] = intval($rxmodule['pwidth']);
} else
if ($rxmodule['resizes']=='a') {
if ($rxmodule['owidth'] <= $rxmodule['oheight']) {
$rxmodule['pheight'] = $rxmodule['resizeto'];
$rxmodule['pwidth'] = $rxmodule['resizeto'] * $rxmodule['owidth'] / $rxmodule['oheight'];
$rxmodule['pwidth'] = intval($rxmodule['pwidth']);
} else {
$rxmodule['pwidth'] = $rxmodule['resizeto'];
$rxmodule['pheight'] = $rxmodule['resizeto'] * $rxmodule['oheight'] / $rxmodule['owidth'];
$rxmodule['pheight'] = intval($rxmodule['pheight']);
}
} else {
$rxmodule['pwidth'] = $rxmodule['resizeto'];
$rxmodule['pheight'] = $rxmodule['resizeto'] * $rxmodule['oheight'] / $rxmodule['owidth'];
$rxmodule['pheight'] = intval($rxmodule['pheight']);
}
if ( (trim($rxmodule['pwidth']) == '') or (trim($rxmodule['pwidth']) == '0') or (trim($rxmodule['pheight']) == '') or (trim($rxmodule['pheight']) == '0') ) {
$rxmodule['pwidth'] = $rxmodule['owidth'];
$rxmodule['pheight'] = $rxmodule['oheight'];
}
$rxmodule['pwidth'] = $rxmodule['pwidth']+20;
$rxmodule['pheight'] = $rxmodule['pheight']+30;
}
if ((isset($rxmodule['galimgsize']) and ($rxmodule['galimgsize'] <> '')) or ( $rxmodule['galfilter'] <> '')) {
if ( $rxmodule['galfilter'] <> '') {
$va = explode(',', $rxmodule['galfilter']);
foreach( $va as $fi ) {
$rxmodule['original'] .= '&rex_filter[]=' . trim($fi);
}
}
}
$rxmodule['smallimage'] = $REX['HTDOCS_PATH'] . 'files/' . $rxmodule['imagelist'][0];
$rxmodule['overimageout'] = $REX['HTDOCS_PATH'] . 'files/' . $rxmodule['overimage'];
$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']) <> '') or ($rxmodule['filter'] <> '')) {
if (trim($rxmodule['resizeto'])=='') {
if ($rxmodule['info'][0] > $rxmodule['info'][1]) {
$rxmodule['resizeto'] = $rxmodule['info'][0];
} else {
$rxmodule['resizeto'] = $rxmodule['info'][1];
}
$rxmodule['resizes'] = 'a';
}
$rxmodule['smallimage'] = $REX['HTDOCS_PATH'] . "index.php?rex_resize=" . $rxmodule['resizeto'] . $rxmodule['resizes'] . "__" . $rxmodule['imagelist'][0];
$rxmodule['overimageout'] = $REX['HTDOCS_PATH'] . "index.php?rex_resize=" . $rxmodule['resizeto'] . $rxmodule['resizes'] . "__" . $rxmodule['overimage'];
}
if ($rxmodule['filter'] <> '') {
$va = explode(',', $rxmodule['filter']);
foreach( $va as $fi ) {
$rxmodule['smallimage'] .= '&rex_filter[]=' . trim($fi);
}
}
if ($rxmodule['overfilter'] <> '') {
$va = explode(',', $rxmodule['overfilter']);
foreach( $va as $fi ) {
$rxmodule['overimageout'] .= '&rex_filter[]=' . trim($fi);
}
}
$rxmodule['overhtml'] = '';
if ($rxmodule['overimage']<>'') {
$rxmodule['overhtml'] = ' onmouseover="this.src=\''.$rxmodule['overimageout'].'\';" onmouseout="this.src=\''.$rxmodule['smallimage'].'\';" ';
}
$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());
} else { // ab REDAXO 4.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'] .'" '.$rxmodule['overhtml'].'/>';
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'] == "fancybox" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="fancybox" href="' . $rxmodule['original'] . '" title="' . $rxmodule['mediatitle'] . '" ' . $rxmodule['target'] . '>' . $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'] == "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'] == "rexfancy" ) {
$rxmodule['imghtml'] = '<a class="' . $rxmodule['cssclass'] . '" rel="rexfancy" 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>';
}
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 ($rxmodule['imgtitle'] != '') {
$rxmodule['imghtml'] .= "\n".'<div class="' . $rxmodule['cssclass'] . 'title">' . html_entity_decode($rxmodule['imgtitle']) . '</div>';
}
$rxmodule = wysiwygimg_imageLinks($rxmodule);
if ( $REX['REDAXO'] == '1' ) { // Im Backend keine Links generieren
$rxmodule['imghtml'] = $rxmodule['imgtag'];
$rxmodule['imghtml'] .= "\n".'<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'].'">';
switch ($rxmodule['imgpos']):
case 0: // im Text links (Textumfluss)
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'left">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
echo "\n".'<div class="'.$rxmodule['cssclass'].'clear"></div>';
break;
case 1: // im Text rechts (Textumfluss)
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'right">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
echo "\n".'<div class="'.$rxmodule['cssclass'].'clear"></div>';
break;
case 2: // links vom Text
echo "\n".'<table border="0" cellspacing="0" cellpadding="0"><tr>';
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<td class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'leftcol">'."\n".$rxmodule['imghtml']."\n".'</td>';
}
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<td class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</td>'; }
echo "\n".'</tr></table>';
break;
case 3: // rechts vom Text
echo "\n".'<table border="0" cellspacing="0" cellpadding="0"><tr>';
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<td class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</td>'; }
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<td class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'rightcol">'."\n".$rxmodule['imghtml']."\n".'</td>';
}
echo "\n".'</tr></table>';
break;
case 4: // über dem Text links
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'topleft">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
echo "\n".'<div class="'.$rxmodule['cssclass'].'clear"></div>';
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
break;
case 5: // über dem Text mittig
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'topcenter">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
break;
case 6: // über dem Text rechts
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'topright">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
echo "\n".'<div class="'.$rxmodule['cssclass'].'clear"></div>';
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
break;
case 7: // unter dem Text links
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'bottomleft">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
echo "\n".'<div class="'.$rxmodule['cssclass'].'clear"></div>';
break;
case 8: // unter dem Text mittig
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'bottomcenter">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
break;
case 9: // unter dem Text rechts
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'bottomright">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
echo "\n".'<div class="'.$rxmodule['cssclass'].'clear"></div>';
break;
default: // Default im Text links (Textumfluss)
if ($rxmodule['imagelist'][0] != '') {
echo "\n".'<div class="'.$rxmodule['cssclass'].'wrap '.$rxmodule['cssclass'].'left">'."\n".$rxmodule['imghtml']."\n".'</div>';
}
if ($rxmodule['htmlvalue']<>'') { echo "\n".'<div class="'. $rxmodule['cssclass'].'text">'."\n".$rxmodule['htmlvalue']."\n".'</div>'; }
echo "\n".'<div class="'.$rxmodule['cssclass'].'clear"></div>';
endswitch;
echo "\n".'</div>';
if ($rxmodule['posthtml']<>'') {
echo "\n" . html_entity_decode($rxmodule['posthtml']);
}
echo "\n<!-- end " . $rxmodule['moduleversion'] . " -->\n";
} else {
if ( $REX['REDAXO'] == '1' ) {
echo '<font color="#cc0000">Kein Text und keine Bilder ausgewählt!</font><br />';
}
}
unset($rxmodule);
?>