Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2010-09-05 21:16:19

iaian7
Plugin Author
From: US
Registered: 2006-12-05
Posts: 57
Website

Re: an7_filter

Hmm, that does seem really odd. Not sure how things are set up on your site, but for example, here are my default article and comment forms…

Article:

<txp:an7_filter><txp:body /></txp:an7_filter> <txp:comments /> <h6><txp:if_comments_allowed><txp:an7_comments_invite /></txp:if_comments_allowed></h6> <h6><txp:output_form form="links_bookmark" /></h6>

Comment:

<div class="comments<txp:an7_comments_author />"> <small class="h4"><txp:comment_name />, <txp:comment_permlink><txp:comment_time /></txp:comment_permlink></small> <txp:an7_filter><txp:comment_message /></txp:an7_filter> </div>

You’ll note that the an7_fiter only contains small sections, and I’m careful to exclude the comments tag in the article form, since the comments are filtered already in their own form. Does that help?


VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios

Offline

#17 2011-06-15 21:14:31

wordgasm
Member
Registered: 2006-05-17
Posts: 83
Website

Re: an7_filter

Hi, could you help me work this code out? I’m trying to replace two things: a line break with an image, and the text <3 with &hearts;. The line break works, but the next one doesn’t.

$replacements = array(
	"<hr>"	=>	$imga."hr".$imgb,
	"<3"	=>	'<strong style="font:8px verdana; color:red;">&hearts;</strong>',
);

Is there something I can do about this? Thanks.

Offline

#18 2011-06-15 21:35:04

iaian7
Plugin Author
From: US
Registered: 2006-12-05
Posts: 57
Website

Re: an7_filter

What exactly isn’t working? Are there any errors? It might help if you can replace “<3” with something simple just to make sure it’s finding things correctly, and pinpoint if it’s the find or replace that’s messing up. :)


VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios

Offline

#19 2011-06-15 21:49:28

wordgasm
Member
Registered: 2006-05-17
Posts: 83
Website

Re: an7_filter

<3 remains <3 on the page instead of the html version of $hearts;.

Thanks for the quick reply!

Offline

#20 2011-06-15 22:02:24

iaian7
Plugin Author
From: US
Registered: 2006-12-05
Posts: 57
Website

Re: an7_filter

Hrm, odd. I honestly don’t know what the issue could be, as I haven’t run into issues like this on my own website. Have you checked the page source to make sure “<3” actually appears verbatim (in other words, is there any chance TXP is encoding it oddly)?


VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios

Offline

#21 2011-06-15 22:17:24

iaian7
Plugin Author
From: US
Registered: 2006-12-05
Posts: 57
Website

Re: an7_filter

Ah, of course! “<“is an HTML entity, so never actually appears on the page. Try this instead:

"&lt;3" => "<strong style=\"font:8px verdana; color:red;\">&hearts;</strong>");

(also make sure you end the array without a comma, or you may run into issues – if there’s no item to follow, a comma can screw things up)

Last edited by iaian7 (2011-06-15 22:55:50)


VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios

Offline

#22 2011-06-16 08:11:50

wordgasm
Member
Registered: 2006-05-17
Posts: 83
Website

Re: an7_filter

I figured that out too, but it’s still posting &lt;3 in the html instead of &hearts;. Also, if I use :heart: instead of <3, the rendered html is still the same—the replacement doesn’t work. But only for that line though.

——
Never mind, it works perfect now. Thanks for the help! Great plugin! :D

Last edited by wordgasm (2011-06-16 13:22:52)

Offline

#23 2011-06-16 15:47:56

iaian7
Plugin Author
From: US
Registered: 2006-12-05
Posts: 57
Website

Re: an7_filter

Did you remove the extra comma? Sounds like it’s an array issue now…


VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios

Offline

#24 2011-06-16 16:07:41

wordgasm
Member
Registered: 2006-05-17
Posts: 83
Website

Re: an7_filter

I’m actually not sure. I just copy-pasted your code from the previous reply. I might have overlooked a tiny detail when I edited the line myself, maybe the \ or the ", but it wasn’t the comma that’s for sure.:p My mistake.

Offline

#25 2011-06-16 16:16:19

iaian7
Plugin Author
From: US
Registered: 2006-12-05
Posts: 57
Website

Re: an7_filter

Got it working yet? Sorry I can’t be of much use remotely, PHP is difficult to debug without actually seeing it!


VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios

Offline

#26 2011-06-16 16:19:35

wordgasm
Member
Registered: 2006-05-17
Posts: 83
Website

Re: an7_filter

Sorry, I don’t know if you read this from the previous comment

Never mind, it works perfect now. Thanks for the help! Great plugin! :D

So yes, it’s working already. Thank you dear author.:p

I thought you just wanted to know how I fixed it.

Offline

#27 2011-06-16 16:24:21

iaian7
Plugin Author
From: US
Registered: 2006-12-05
Posts: 57
Website

Re: an7_filter

Haha, oh dear…completely missed the updated message. Glad you got it working!


VFX artist, photographer, designer, CG generalist, and hobbyist web developer
My TXP sites: blog | reels | portfolios

Offline

#28 2013-02-28 22:31:13

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: an7_filter

I’m converting Concrete5 site which uses TinyMCE editor and its emoticons.

For the new Txp site I do want to stay with Textile and get emoticons via an7_filter plugin, but I wonder if you can recommend/share some setup which goes nicely along with plugin’s default setup ?

Last edited by gour (2013-03-01 21:03:31)

Offline

#29 2013-03-01 21:09:05

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: an7_filter

gour wrote:

For the new Txp site I do want to stay with Textile and get emoticons via an7_filter plugin, but I wonder if you can recommend/share some setup which goes nicely along with plugin’s default setup ?

Here is my incomplete setup for the icons which come along with TinyMCE:

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'	=> '.gif" alt="" class="an7_filter" /> ',	// defines the second half of the image, including file format
),$atts));
$replacements = array(
	//
	" >:-o"		=>	$imga."smiley-yell".$imgb,
	" >:o"		=>	$imga."smiley-yell".$imgb,
	" x-o"		=>	$imga."smiley-yell".$imgb,
	" xo"		=>	$imga."smiley-yell".$imgb,
	" :angry:"	=>	$imga."smiley-yel".$imgb,
	" :-["		=>	$imga."smiley-embarassed".$imgb,
	" :["		=>	$imga."smiley-embarassed".$imgb,
	" :blush:"	=>	$imga."smiley-embarrassed".$imgb,
	" 8-)"		=>	$imga."smiley-cool".$imgb,
	" 8)"		=>	$imga."smiley-cool".$imgb,
	" :cool:"	=>	$imga."smiley-cool".$imgb,
	" :'("		=>	$imga."smiley-cry".$imgb,
	" :cry:"	=>	$imga."smiley-cry".$imgb,
	" :-!"		=>	$imga."eeeih".$imgb,
	" :!"		=>	$imga."eeeih".$imgb,
	" :eeeih:"	=>	$imga."eeeih".$imgb,
	" :-("		=>	$imga."smiley-frown".$imgb,
	" :("		=>	$imga."smiley-frown".$imgb,
	" :frown:"	=>	$imga."smiley-frown".$imgb,
	" =-o"		=>	$imga."gasp".$imgb,
	" :-o"		=>	$imga."gasp".$imgb,
	" :o"		=>	$imga."gasp".$imgb,
	" :gasp:"	=>	$imga."gasp".$imgb,
	" :-D"		=>	$imga."grin".$imgb,
	" :D"		=>	$imga."grin".$imgb,
	" :grin:"	=>	$imga."grin".$imgb,
	" o:-)"		=>	$imga."smiley-innocent".$imgb,
	" o:)"		=>	$imga."smiley-innocent".$imgb,
	" 0:-)"		=>	$imga."smiley-innocent".$imgb,
	" 0:)"		=>	$imga."smiley-innocent".$imgb,
	" :innocent:"	=>	$imga."smiley-innocent".$imgb,
	" :-*"		=>	$imga."smiley-kiss".$imgb,
	" :*"		=>	$imga."smiley-kiss".$imgb,
	" :kiss:"	=>	$imga."smiley-kiss".$imgb,
	" :-P"		=>	$imga."smiley-laughing".$imgb,
	" :P"		=>	$imga."smiley-laughing".$imgb,
	" :laugh:"	=>	$imga."smiley-laughing".$imgb,
	" :-$"		=>	$imga."smiley-money-mouth".$imgb,
	" :$"		=>	$imga."smiley-money-mouth".$imgb,
	" :money:"	=>	$imga."smiley-money-mouth".$imgb,
	" :-x"		=>	$imga."smiley-sealed".$imgb,
	" :x"		=>	$imga."smiley-sealed".$imgb,
	" :sealed:"	=>	$imga."smiley-sealed".$imgb,
	" :-)"		=>	$imga."smiley-smile".$imgb,
	" :)"		=>	$imga."smiley-smile".$imgb,
	" :smile:"	=>	$imga."smiley-smile".$imgb,
	" :-/"		=>	$imga."smiley-undecided".$imgb,
	" :/"		=>	$imga."smiley-undecided".$imgb,
	" :undecided:"=>	$imga."smiley-undecided".$imgb,
	" ;-)"		=>	$imga."smiley-wink".$imgb,
	" ;)"		=>	$imga."smiley-wink".$imgb,
	" :wink:"	=>	$imga."smiley-wink".$imgb);
$wrap = parse($thing);
$filtered = strtr($wrap, $replacements);
return $filtered;
}

Maybe it will be of help to someone and I’ll complete it when I finish some other stuff. ;)

Offline

#30 2020-02-27 17:07:40

M_i
Member
Registered: 2006-03-05
Posts: 122

Re: an7_filter

Hi all,

I’m updating an ancient Textpattern site that I built back in 2006 because my host is shutting off PHP 5.4 soon. I started out with Textpattern 4.0.4 on PHP 5.4 and have managed to update to Textpattern 4.7.3, which I have running on PHP 7.2. Now I’m dealing with the plugins which were all state of the art way back when, but now (unsurprisingly!) break the site. So I’ve turned them all off and am turning them back on one by one, fixing issues as I go.

an7_filter is not working in PHP 7.2 (“Too few arguments to function lAtts()”). Is there an easy way to modify the plugin to get it working on PHP 7.2 or — as nobody seems to be missing this plugin — is there a better way to do this in Textpattern anno 2020?

Any help is much appreciated!
Iris

Offline

Board footer

Powered by FluxBB