Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Auto Link to Two Word terms
meshugy
✭✭
@peregrine This plugin is great, thanks! Is there a way to get it to autolink to two word terms? I'd like it to create auto links for the titles of books and other products. I tried this but it didn't work:
$wordlinkArray = array( "Unaccompanied Django" => "http://www.djangobooks.com/Item/unaccompanied_django");
0
Comments
as is, the plugin only does one word.
@meshugy with the following change.
try this
it may do one word two word phrase and 3 word phrase. - let me know how it works for you.
in class.autolink.plugin.php
look for
$search = '/(\b\p{L}{4,15}\b)/u';
and change to...
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@meshugy
@meshugy pitching. Its a fast ball, high and inside, bases loaded. last inning. two outs, two strikes. peregrine swings for the stands. The crowd is breathless...
and @meshugy is also umpire.
and ....
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine Grand Slam! that worked great....
Now, to win the pennant, here's another problem to fix.
If some has already posted a url that has an term set to autolink, the plugin will mangle the original url. For example, if I have the term "calendar" set to autolink and there's url posted in the forum like this:
then the autolink changes it to this:
Is there an easy way to get the plugin to ignore terms already embedded within links?
I may have to sit out the pennant.
let me think about a decent way to rule that out.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine I figured this may be a tricky one. It's by no mean essential, but would make the plugin much more useful as I could be much more liberal with the terms I set to autolink. I'll pledge $20 for development of this feature
@meshugy
try this see how it works for you
it may be the pennnant and a bonus
I haven't tested completely but seems to work.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
well, it's a close game. That change made the "calendar" example work. But I just noticed this link got mangled with the term "tailpiece"
My user posted this internal link:
The Autolink plugin changed it to:
@meshugy you're pitching a tough game extra innings.
steroids maybe?
$search = array('/(\/?-?\b\p{L}{4,15}\b)/u', '/(\b\p{L}{4,15}\b \b\p{L}{4,15}\b)/u','/(\b\p{L}{4,15}\b \b\p{L}{4,15}\b \b\p{L}{4,15}\b)/u');
resolves the -
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@meshugy
here's a better one
edited:
$search = array('/(\/?-?\??\=?\b\p{L}{4,15}\b)/u', '/(\b\p{L}{4,15}\b \b\p{L}{4,15}\b)/u','/(\b\p{L}{4,15}\b \b\p{L}{4,15}\b \b\p{L}{4,15}\b)/u');
for these types as well
http://www.djangobooks.com/blog/q?calendar
I'll update the plugin (in a day) once you sign off on whether it is working properly or not with your parameters.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
that fixed the previous scenario, but not this one. The search term "Guzz" is set to autolink. This image link has term "guzz" in the the title:
You can see the result here: http://www.djangobooks.com/forum/discussion/11852/guzz-s3-skinny-guitar-pick-2-pack
@Meshugy hurling too many pitches, peregrine battered. The changeup and @Meshugy throws a knuckleball, peregrine stands frozen like a deer in the headlights, falls from exhaustion and is taken to the dugout
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@Meshugy
a simple solution to the title dilemma.
title="Guzz S3 Skinny Guitar Pick (2 Pack)"
title="-Guzz S3 Skinny Guitar Pick (2 Pack)"
just put a dash in front of the items that might be tags in your title.
I suspect not many users are adding titles to their images on your forum and you can edit your own images with titles and everything will work perfectly with the other mods i gave you.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine yes! That works....thanks for all your help.
@meshugy
thanks for the donation and thanks for being a magnanimous umpire and mensch! and ability to bend with some issues.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Uh, this is an interesting plugin i have in my thoughts for some time now. Never tried it. I also have the situation that i would liken to link certain words and phrases into my Wiki.
@peregrine: May i ask you, if this is a performance heavy task? Because i have a quite big community approximately: 1.400 comments a day.
it doesn't do additional database lookups if you only choose autolinks. but it does parse the body of each discussion. So it would be computational. You would have to give it a try and see if it has any significant impact, I would think not much here.
however if you choose autolink tags it does a database tag lookup. possibly more impact.
you would have to give it a try and see if you discern any deleterious impact, since you have the ideal test site with lots of hits.
that said, I don't think you will see significant impact, but you are the arbiter.
by the way it doesn't do unicode.
good luck!
btw, version 1.4 is now available with the changes requested by meshugy.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.