You are not logged in.
an7_filter replaces text strings defined by a customizable array located in the script. Basically, this means you can finally include emoticons (smilies), instant messenger style! It can also be used for undesirable language filtering or keyword link insertion.
While an7_filter does not automate this process entirely, it does make it fairly easy. Used as a wrap tag, it will filter the contained text using an array specified in the plugin (the default is setup for emoticon replacement). The array is setup in a simple "text" => "replace" format and the wrap tags are reasonably concise; <txp:an7_filter>…content…</txp:an7_filter>.
Currently in alpha
Visit the site for more information and examples.
VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios
Offline
Hi!
I am using your plugin, it works fine!
Now I am wondering if it’s possible to use it in the comments form. If so, how?
Thank you!
Offline
alex9142, you just wrap your comment messages with the an7_filter tags. whenever a commenter types in a symbol like :), the comment will show an image smiley for that symbol.
<txp:Ruhh />
Offline
Hi Ruhh!
Thank you for your help.
I will accept your solution.
Offline
Thanks for this plugin, works a treat.
Just thought it really should contain alt=”“ to validate, i.e:
‘imgb’ => ‘.png” alt=”“ class=“emoticon” /> ‘, // defines the second half of the image, including file format
Cheers
iMac 3.06 GHz 2 GB SDRAM
OSX 10.6.2
Offline
I’m trying to get this plugin to work, but I get an error message that I don’t really understand:
Parse error: syntax error, unexpected T_STRING, expecting ')' in /var/www/site.com/vf/textpattern/lib/txplib_misc.php(574) : eval()'d code on line 11 The above errors were caused by the plugin:an7_filter Tag error: <txp:an7_filter> -> Textpattern Warning: tag does not exist on line 983
I’m running Txp 4.0.6. It seems as if a closing parenthesis is missing, but where?
The plugin looks like this:
function an7_filter($atts, $thing=’‘) {
global $thisarticle;
global $thiscomment;
extract(lAtts(array(
‘imga’ => ‘ <img src=”/images/emoticons/’, // defines the first half of the image, sans filename
‘imgb’ => ‘.png” class=“emoticon” /> ‘, // defines the second half of the image, including file format
),$atts));
$replacements = array( // “bodystep” => “<span class=“red”>body</span>step”
$wrap = parse($thing);
$filtered = strtr($wrap, $replacements);
return $filtered;
}
Textpattern n00b
Offline
You’re missing a closing parenthesis on $replacements, and you’re also not escaping the quotes for bodystep (""foo"" needs to be "\"foo\"" or '"foo"').
$replacements = array(
"bodystep" => '<span class="red">body</span>step',
);
Offline
Great, thanks!
It works fine as long as the word isn’t written with caps as Txp encloses these with <span class=“caps”> and thereby breaks this plugin which is kinda annoying.
But your adjustments helped and we’ll just have to write these words in lower case.
Textpattern n00b
Offline
Oops, guess that Txp’s <span class=“caps”> does not break the plugin, but it is the plugin that is case sensitive. My mistake. :-)
Textpattern n00b
Offline
Spot wrote:
Thanks for this plugin, works a treat.
Just thought it really should contain alt=”“ to validate, i.e:
‘imgb’ => ‘.png” alt=”“ class=“emoticon” /> ‘,
Thanks for pointing that out!
I’ve just posted version 0.2.0 which fixes the image validating, and corrects the CSS to comply with plugin standards (using, by default, the plugin name to define styles for elements generated by the plugin).
Mr. Smith wrote:
…It works fine as long as the word isn’t written with caps…
The case sensitivity has not been addressed yet, as there is no native case-insensitive strtr function in PHP (that I’ve found). There is code to do it, but it’s not particularly short, and I haven’t picked through it yet.
JM and others, thanks for answering questions! I can’t always keep up with support questions, and really appreciate the help. :D
Last edited by iaian7 (2008-07-17 20:12:09)
VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios
Offline