Sonnie
Active member
Trying my first add-on in an attempt to parse smilies in HTML emails.
I have created a Listener.php file and uploaded it to the SonnieMail folder... there are a few smilies in there for testing, as we mainly want these for media reviews.
The addon.json file is showing up in the SonnieMail folder after creating the addon via the cPanel Terminal.
Now I am trying Add code event listener... and for the Callback I've tried several combinations, but get an error:
Needing some guidance... thanks!
I have created a Listener.php file and uploaded it to the SonnieMail folder... there are a few smilies in there for testing, as we mainly want these for media reviews.
Code:
namespace SonnieMail;
class Listener
{
public static templatePostRender(\XF\Template\Templater $templater, $type, $template, &$output)
{
if ($type !== 'email') {
return;
}
$output = strtr($output, [
':halfstar:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/half_star.png" border="0" />',
':1star:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/1_star.png" border="0" />,
':1.5stars:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/1.5_stars.png" border="0" />,
':2stars:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/2_stars.png" border="0" />,
':2.5stars:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/2.5_stars.png" border="0" />,
':3stars:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/3_stars.png" border="0" />,
':3.5stars:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/3.5_stars.png" border="0" />,
':4stars:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/4_stars.png" border="0" />,
':4.5stars:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/4.5_stars.png" border="0" />,
':5stars:' => '<img src="https://www.avnirvana.com/styles/default/xenforo/smilies/5_stars.png" border="0" />,
]);
}
}
The addon.json file is showing up in the SonnieMail folder after creating the addon via the cPanel Terminal.
Now I am trying Add code event listener... and for the Callback I've tried several combinations, but get an error:
Needing some guidance... thanks!