WordPress.org

Ready to get started?Download WordPress

Forums

Making Everything2 Plugin, Have Question... (5 posts)

  1. satoshi
    Member
    Posted 9 years ago #

    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
    http://sugardeath.net/wordpress/wp-content/plugins/e2pipe.phps

    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.

  2. satoshi
    Member
    Posted 9 years ago #

    No on likes me -_-

  3. skippy
    Member
    Posted 9 years ago #

    satoshi: I don't think it's a matter of whether we like you or not. It's a matter of "can we help you?". And the answer seems to be no.

    Regular expressions and callback functions are advanced topics, and beyond the scope of these forums. You might get help at on the WordPress Hackers mailing list, but I can't guarantee it.

  4. Ajay
    Member
    Posted 9 years ago #

    Alternatively you may find help on good php help forums / websites with I guess better qualified php professional.

    Unfortunately, you haven't got a reply like podz above because we wouldn't know what to reply :-S

  5. satoshi
    Member
    Posted 9 years ago #

    Heh, I know. I'm basing the "no one likes me" thing on the fact that none of my other topics ever get answered either... Oh well, thanks for the help. I'll look into those. I didn't know there was a WordPress Hackers mailing list. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic