Dungeonwatcher hat geschrieben:3. meist genutzten Smilies:
Die Statistik stimmt nicht im geringsten. Wo muss ich da was korrigieren/verändern?
Hierfür habe ich die Lösung mittlerweile gefunden:
-->
http://www.opentools.de/board/viewtopic.php?t=1904
Code: Alles auswählen
#
#-----[ ÖFFNE ]---------------------------------------------
#
/top_smilies/module.php
#
#-----[ FINDE ]---------------------------------------------
#
for ($i = 0; $i < count($smile_group); $i++)
{
$found = FALSE;
$match_regexp = '';
for ($j = 0; $j < count($smile_group[$i]['code']) && $found == FALSE; $j++)
{
if ($smile_pref == 0)
{
if (strstr($message, $smile_group[$i]['code'][$j]))
{
$all_smilies[$i]['count'] = $all_smilies[$i]['count'] + 1;
$found = TRUE;
}
}
else
{
$match_regexp .= ($match_regexp == '') ? '/(?<=.\W|\W.|^\W)' . preg_quote($smile_group[$i]['code'][$j], "/") . '(?=.\W|\W.|\W$)' : '|(?<=.\W|\W.|^\W)' . preg_quote($smile_group[$i]['code'][$j], "/") . '(?=.\W|\W.|\W$)';
}
}
if (!$found)
{
if ($match_regexp != '')
{
$match_regexp .= '/';
// echo "<br /><br />" . $match_regexp . "<br />";
// echo "#".$all_smilies[$i]['smile_url']."#";
preg_match_all($match_regexp, ' ' . $message . ' ', $matches);
// echo "<br />-" . count($matches[0]) . "-<br />";
$all_smilies[$i]['count'] = $all_smilies[$i]['count'] + count($matches[0]);
}
}
}
#
#-----[ ERSETZE DURCH ]---------------------------------------
#
// BEGIN: Modified to cycle through each message separately to correct count = 1 problem
for ($k = 0; $k < count($rows); $k++)
{
//$message .= $rows[$i]['post_text'];
$message = $rows[$k]['post_text'];
//}
//echo ";".$message.";";
for ($i = 0; $i < count($smile_group); $i++)
{
$found = FALSE;
$match_regexp = '';
for ($j = 0; $j < count($smile_group[$i]['code']) && $found == FALSE; $j++)
{
if ($smile_pref == 0)
{
if (strstr($message, $smile_group[$i]['code'][$j]))
{
$all_smilies[$i]['count'] = $all_smilies[$i]['count'] + 1;
$found = TRUE;
}
}
else
{
$match_regexp .= ($match_regexp == '') ? '/(?<=.\W|\W.|^\W)' . preg_quote($smile_group[$i]['code'][$j], "/") . '(?=.\W|\W.|\W$)' : '|(?<=.\W|\W.|^\W)' . preg_quote($smile_group[$i]['code'][$j], "/") . '(?=.\W|\W.|\W$)';
}
}
if (!$found)
{
if ($match_regexp != '')
{
$match_regexp .= '/';
// echo "<br /><br />" . $match_regexp . "<br />";
// echo "#".$all_smilies[$i]['smile_url']."#";
preg_match_all($match_regexp, ' ' . $message . ' ', $matches);
// echo "<br />-" . count($matches[0]) . "-<br />";
$all_smilies[$i]['count'] = $all_smilies[$i]['count'] + count($matches[0]);
}
}
}
}
// END: Modified to cycle through each message separately to correct count = 1 problem
#
#-----[ SPEICHER DIESE DATEI ]------------------------------------------
#
# EoM
Jetzt tut dieses Modul exakt was es soll.
Bye/2