Hi!
Vielen Dank! Der Patch müsste jedoch noch in ein paar dingen bearbeitet werden:
1. Bitte die Einrückung korrigieren; überall 4 Leerzeichen statt TABs nutzen, und darauf achten dass die Einrücktiefe mit dem Rest übereinstimmt.
2. Noch wichtiger, dass die Redundanz entfernt wird; es gibt jetzt nach dem Patch dreimal dieselbe foreach-Schleife über die Tagliste, die jedesmal die Fontsize ausrechnet. Das muss man nur einmal tun, diese ausgabe dann in einer Variable speichern und dann dafür sorgen, dass diese Variable mal mit, mal ohne htmlentities() oder so ausgegeben wird, wie's für das Flash benötigt wird. Ansonsten ist das recht unperformant.
Mir fehlt gerade die Zeit das vollständig zu optimieren, ich hab's aber mal versucht:
Code: Select all
if ($useFlash) {
echo "\n". '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' . $flashwidth .'" height="' . round($flashwidth * 0.75) . '" id="tagcloud" name="tagcloud">'. "\n";
echo '<param name="movie" value="' . $serendipity['serendipityHTTPPath'] .'plugins/serendipity_event_freetag/tagcloud.swf" />'. "\n";
echo '<param name="wmode" value="transparent" />'. "\n";
echo '<param name="flashvars" value="tcolor=0x' . $flashtagcolor . '&mode=tags&distr=true&tspeed=' . $flashspeed .'&tagcloud=%3Ctags%3E';
$tagparam = '';
foreach($tags AS $name => $quantity) {
if (empty($name)) {
continue;
}
if ($scaling) {
if ($scale==0) {
$fontSize = $maxSize;
} elseif ($scale==1) {
if ($quantity==$biggest) {
$fontSize = $maxSize;
} else {
$fontSize = $minSize;
}
} else {
$fontSize = round(($quantity - $smallest)*(($maxSize - $minSize)/($scale))) + $minSize;
}
} else {
$fontSize = 100;
}
$tagparam .= "%3Ca href='" . $taglink . serendipity_event_freetag::makeURLTag($name) . "' style='" . round($fontSize/5) . "'%3E" . str_replace(' ',' ',htmlspecialchars($name)) . "%3C/a%3E";
}
echo $tagparam;
echo '%3C/tags%3E" />' . "\n";
echo '<!--[if !IE]>-->' . "\n";
echo "\n" . '<object type="application/x-shockwave-flash" data="' . $serendipity['serendipityHTTPPath'] .'plugins/serendipity_event_freetag/tagcloud.swf" width="' . $flashwidth .'" height="' . round($flashwidth * 0.75) . '">'. "\n";
echo '<param name="wmode" value="transparent" />' . "\n";
echo '<param name="flashvars" value="tcolor=0x' . $flashtagcolor . '&mode=tags&distr=true&tspeed=' . $flashspeed .'&tagcloud=%3Ctags%3E';
echo $tagparam;
echo '%3C/tags%3E" />'. "\n";
echo '<!--<![endif]-->'. "\n";
}
Das wäre ein Beispiel um sc honmal aus 2 schleifen nur eine zu machen. Darunter kommts aber nochmal, da müsste man jetzt raussortieren wo der unterschied zu $tagparam davor genau liegt, ausser dass < und > urlencodet werden...
Viele Grüße,
Garvin