Making Everything2 Plugin, Have Question…
Alright, I’m working on a plugin that will allow one to use Everything2 Pipe Links in their posts (and soon, comments). After messing around with regular expressions and the like, I’ve got it pretty much working. You can check it out at http://sugardeath.net/e2-pipe-linker-plugin/
The problem is as follows:
[Crazy like a fox|I think you are insane] would produce a link to the “Crazy like a fox” node at Everything2 with the link text “I think you are insane.” The first bit of text has all the spaces changed to +’s to make it URL friendly. This first bit of text is also used in the title attribute of the A tag, but I can’t figure out how to grab that first bit AGAIN without the +’s.
The source can be seen at
I have tried something like
$title = preg_replace_callback( '#([w[^]]+)|#', 'title_return', $content);
where the function title_return just returns the string with no changes, but whenever I call $title in
‘$content = preg_replace( ‘#\[(\w[^\]]+)\|([^\]]+)\]#’, ‘< a href=”http://everything2.org/?node=$1″ title=”$title” >$2< /a >’, $content);’
it just outputs “$title” in the title attribute no matter what I do.
Anyone have any ideas?
Now, keep in mind, this is my very first plugin for WordPress. This is also the first time I’ve done more than just mess with variables and such.
- The topic ‘Making Everything2 Plugin, Have Question…’ is closed to new replies.