Doh, I was just coming here to research to see if the wowitem code would work in articles... Anybody have a fix for this?
Ok here's what you must do
Open up <yourboarddir>/Sources/TPortal.php
now at the end (ok before the ?> ) add the following:
// Parse wowitems in the passed message.
function TPparseWoWItems($message)
{
global $sourcedir, $modSettings, $settings;
if ($settings['include_itemstats'])
{
$codefromcache = array();
$codetocache = array();
// Handle wowitem.
$codefromcache[] = '~\[wowitem](.+?)\[/wowitem\]~i';
if (empty($modSettings['enableWoWItemstats']) || isset($disabled['wowitem']))
$codetocache[] = '$1';
else
$codetocache[] = '<wowitem>$1</wowitem>';
$codefromcache[] = '~\[wowitem=(.+?),(.+?)](.+?)\[/wowitem\]~i';
if (empty($modSettings['enableWoWItemstats']) || isset($disabled['wowitem']))
$codetocache[] = '$3';
else
$codetocache[] = '<wowitem>$3,$2,$1</wowitem>';
$message = preg_replace($codefromcache, $codetocache, $message);
// wowitems need to be done twice or they won't work properly.
if (strpos($message, '<wowitem>') !== false)
{
preg_match_all("#<wowitem>(.+?)</wowitem>#s", $message, $match);
$array_count = count($match[1]);
for ($i = 0; $i < $array_count; $i++)
{
$wowarray = preg_split("/,/", $match[1][$i]);
if (count($wowarray) == 1)
$wowarray = $wowarray[0];
$wowhtml = itemstats_parse($wowarray);
if (count($wowhtml) > 1)
$wowhtml = $wowhtml[0];
$message = str_replace($match[0][$i], $wowhtml, $message);
}
}
}
return $message;
}
now in the same file somewhere in function TPortal_init() find the following:
// stripslashes for php article
if($row['useintro'] == -1 && !get_magic_quotes_gpc())
$row['body'] = stripslashes($row['body']);
after that one and before:
$t[] = array(
'id' => $row['id'],
'icon' => 'noicon',
'subject' => '<b>'.$row['subject'].'</b>' ,
'time' => timeformat($row['date']),
'timestamp' => $row['date'],
'body' => normalizeNewline($row['body']),
'href' => '' . $scripturl . '?page='.$row['id'],
'link' => $phplink,
'replies' => '-',
'new_comment' => doUBBC($row['intro']),
'poster' => array(
'id' => $row['authorID'],
'name' => $row['author'],
'href' => !empty($row['authorID']) ? '' . $scripturl . '?action=profile;u=' . $row['authorID'] : '',
'link' => !empty($row['authorID']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['authorID'] . '">' . $row['author'] . '</a>' : $row['author']
),
'is_last' => $row['frame']
);
add the following line:
$row['body'] = TPparseWoWItems($row['body']);
Now you can use the same syntax for posting wow items in Tinyportal articles.
Worked fine for me..
Does this work with WoW-Itemstats 1.25.9.2 ?
Because i can't get it to work :S
Any pointers? or upload the TPortal.php would be nice <3
bump
(btw email me at mygith_at_inbox_dot_com)