PDA

View Full Version : Show Thread Enhancements - Acronyms for vB


RolandvonGilead
23 Apr 2006, 14:41
//EDIT: UPDATED 25.04 22:34

Please only use this new version! Replace old ones! THX


Its an normal Acronym-Explanation-Mod.

In the AdminCP you can enter Acronyms and Descriptions.

Then in the Posts This word is underlined and green, and when the Users passes over with the mouse he sees the Description.

Roland

Gizmo5h1t3
23 Apr 2006, 14:53
Its an normal Acronym-Explanation-Mod.


any more details please?

RolandvonGilead
23 Apr 2006, 15:07
any more details please?

In the AdminCP you can enter Acronyms and Descriptions.

Then in the Posts This word is underlined and red, and when the Users passes with the mouse he sees the Description.

Shack Networks
23 Apr 2006, 15:13
So its like a cut down version of Geeks Auto Linker ?

Sounds good m8 although I use GAL for the same purpose I am sure it will come in handy for helping newbies out getting to grips with some of the common terminology.

H

klaush
23 Apr 2006, 15:19
Good! :-)

RolandvonGilead
23 Apr 2006, 16:24
On vbhacks it was reported, that the hack works on local Installations but not in the productiv-Board...

Probably I'm not using the right Hook, or variable. I will look for an solution.

Roland

apfparadise
23 Apr 2006, 16:26
are we supposed to wait for the cron job to see the effects, 'cause nothing is happening. Acronym installed, tested it in several ways, nothing so far.

RolandvonGilead
23 Apr 2006, 16:32
are we supposed to wait for the cron job to see the effects, 'cause nothing is happening. Acronym installed, tested it in several ways, nothing so far.

:confused: Nope. There seems to be some Problem. The Hack only works on a local Testboard. So I will use another hook.

I will post it later.

Roland

RolandvonGilead
23 Apr 2006, 17:09
// Deleted the Hack for 1-2 Days because i haven't already found the perfekt hook.

global_complete has problems with the meta-infos...

Please uninstall the Hack until i finished.

THX
Roland

ChErAbOo
25 Apr 2006, 05:14
Look forward to this hope you can get it working a old site I use to browse running older VB has this and its a nice feature...anywhere key words like BBL for example are it underlines them and scroll over shows Be Back Later hope you get this working been looking for it for some time

RolandvonGilead
25 Apr 2006, 21:40
So I finished!

Bugs eliminated! Please delete elder ones! And only use the new one!

Roland

UK Jimbo
26 Apr 2006, 02:03
I think you're confusing acronyms with abbreviations :)

TomasDR
26 Apr 2006, 03:31
New Install! Very nice.

My Opera users see the question mark but no definitions. Any ideas?

RolandvonGilead
26 Apr 2006, 09:39
New Install! Very nice.

My Opera users see the question mark but no definitions. Any ideas?

Yeah, the actuall Opera 8 doesn't seems to understand the <acronym>-Tag right but the Opera 9 probably does. I don't will change this part because for Visual-Browsers. It's important to use the <acronym>-Tag.


I think you're confusing acronyms with abbreviations :)

??? You can Use this Hack for both, but I use the <acronym>-Tag not the <abbr>-Tag.

But in the next Version I will use both.

P.s. I know what Acronyms are ;)

UK Jimbo
26 Apr 2006, 11:01
P.s. I know what Acronyms are ;)

I am being very pedantic I know but it's a common misconception.

Are you with me that NATO and NASA are acronyms but USA and FBI aren't?

RolandvonGilead
26 Apr 2006, 11:23
Are you with me that NATO and NASA are acronyms but USA and FBI aren't?

Yeah! NATO is and USA is an initialism IMHO :alien:


Greet
Roland

Neo_obs
27 Apr 2006, 09:29
how can we change the color and make it not underlined or bold? I would like it to just change to a Gold instead of the normal purple we use on our site

RolandvonGilead
27 Apr 2006, 19:46
how can we change the color and make it not underlined or bold? I would like it to just change to a Gold instead of the normal purple we use on our site

If you Open your Plugin manager in the AdminCp.

You can change the colors in the Acronym-Plugin.


<span style=" font-weight:bold; color:#08bd09; border-bottom: 1px dotted #082ceb; cursor: help;">


color:#08bd09; is the FontColor (Change it :banana: )
&&
#082ceb; the UnderlineColor

If xou don't want it underlined delete:

border-bottom: 1px dotted #082ceb;

Roland

Neo_obs
27 Apr 2006, 21:57
OK thanks but color isnt showing up using this <span style=" font-weight: color:#FFCC00; cursor: help;">\\1</span>
Sorry fixed forgot to delete font-weight

Also how do I make this available without giving my moderators access to the user area in ACP?

I would like it to show to anyone who can administer plugins

NEVER MIND I FIGURED IT ALL OUT. Simplier than i thought.

rareclownfish
15 Sep 2006, 20:00
so this is working fine with 3.5.4?

rareclownfish
15 Sep 2006, 22:07
This didn't work for me

JenniferK
16 Sep 2006, 05:49
will this work with 3.6?

rareclownfish
17 Sep 2006, 04:23
Anyone here??

rareclownfish
18 Sep 2006, 17:30
Man no support

Puntoboy
09 Dec 2006, 22:35
Just installed this and is caused a database error as soon as I put the first Acronym into the settings.

Feechen
19 May 2007, 20:58
Dear Roland,

I hope this is the right thread to report bugfixes and enhancements to your add-on!

If not, please bear with me (I'm new to this) and tell me the right place, ok? :)

I installed this add-on of yours recently and I'm VERY fond of it!

However, since I wanted to make some changes, I came across something that appears to possibly be a little bug.

The file "product-acronym_mod.xml" contains a Perl regular sub-expression which reads as follows: (([.,:;-?!()\s"<\[]|$))

However, the part ";-?" in it means "including all characters from ; to ?" in Perl, i.e., the characters "; < = > ?" in ASCII or ISO-Latin-1.

This is probably not what was intended, I guess the dash itself was meant instead. To achieve this, and to free the dash from its special meaning in character classes, you need to escape it with a backslash, like so: (([.,:;\-?!()\s"<\[]|$))

Moreover, I found out that the add-on also does replacements inside of HTML tags, which can cause problems like creating letter salad and make hyperlinks stop from working.

In my case it was the "ALT" tag, which incidentally corresponds to an abbreviation in our forum (= Alanine-Amino-Transferase).

Therefore I introduced an additional, negative zero-width look-ahead expression to prevent substitutions inside of HTML tags, directly after the match of the abbreviation (or acronym ;)), like this: (?![^<>]*>)

This verifies that the intended substitution is not taking place inside an HTML tag by verifying that no closing ">" follows.

As a downside of this, abbreviations followed by a plain ">" somewhere in the middle of normal text (before the next HTML tag) will not work anymore. I personally do not find this very limiting, in practice, though.

However, abbreviations can be made to work in these circumstances if the ">" that follows is in reality written as "& gt ;" (without the blanks, of course).

For this, the list of non-word characters or separating characters in the add-on needs to be adapted to include at least the ampersand "&".

I found it convenient to put ALL punctuation and special characters into that list of possible separator characters, except for the backslash, which for a reason I haven't investigated yet did not work, and the "at" sign "@", because it might conflict easily with email addresses.

I also found it useful to make the separators to the left and the right of the match symmetrical. This has the added benefit of making staggered abbreviations, such as for instance in "TPO-AB", possible, i.e., it allows "TPO" to be recognised as an abbreviation for "thyroid peroxidase" and "AB" as an abbreviation for "antibodies" (in theory this feature would also allow something like "XX-YY-ZZ" to work, although I guess this won't be needed very often in practice).

The whole line now reads as follows: $post['message'] = preg_replace('#
(?<=[\s!"\#\$%&\'()*+,\-.\/:;?^`{|}~>\]]|^)(' . $acros_final['acro'] . ')(?![^<>]*>)
(([\s!"\#\$%&\'()*+,\-.\/:;?^`{|}~<\[]|$))#siU',
'<acronym title="'.$acros_final['desc'].'"><span style="border-bottom: 1px dotted #082ceb; cursor: help;">\\1</span></acronym>\\2', $post['message']);

I am attaching the original zip archive of the add-on as a reference, and also the modified file "product-acronym_mod.xml" itself (if this forum's configuration will let me).

BTW, I also changed the font style to be just underlined, not green and bold, in order not to disrupt normal reading too much.

I hope that these changes may be useful to others as well!

Best regards,
ibeji
in the name of Feechen

P.S.: I have based my changes on the German version, but I guess it should be no big deal to transfer the modifications to the English version, if those were different at all.

P.P.S.: See also my posting (http://www.vbhacks-germany.org/showpost.php?p=68331&postcount=37) in the German forum in the thread "[vB 3.5.x]Akronyme für vB (http://www.vbhacks-germany.org/showthread.php?t=3836)".

Feechen
20 May 2007, 22:35
Please find attached hereto an updated version of the file "product-acronym_mod.xml" with improved performance.

Since it seems (at least subjectively) that the time it takes to display a complete forum page is longer when the Acronyms-addon is installed, I applied some more modifications in an attempt to increase its performance.

Instead of matching the right separator character, capturing it and re-inserting it into the output stream (that's what the "\\2" does in the script), why not check the next character with a zero-width positive look-ahead regular expression?

(Especially since the left separator character is already checked with a zero-width positive look-behind regular expression?)

This saves the time that was needed before for the intermediate storage and interpolation (i.e., insertion) of the captured character into the output stream.

But better still, this now allows us to put the subexpression (?![^<>]*>) at the very end of the regular expression. Because when there is no valid right separator character anyway (which can be checked in a single step, in O(1) time complexity), it is not necessary to execute this search for a closing ">" (which can potentially run until the end of the input stream, and therefore has O(n) time complexity) anymore at all.

For an explanation in German of the nature of these modifications/improvements, please see also my corresponding posting (http://www.vbhacks-germany.org/showpost.php?p=68446&postcount=39) in the thread "[vB 3.5.x]Akronyme für vB (http://www.vbhacks-germany.org/showthread.php?t=3836)".

I hope you might find this new version useful.

Best regards,
ibeji
in the name of Feechen

Feechen
21 May 2007, 15:10
Dear all,

I have just overhauled the whole add-on which now contains - in addition to my modifications described before in this thread (now integrated into BOTH language versions) - also a number of fixes of typos. Please see the file "Acronym_Mod_fixed.zip" attached here.

The text file "Acronym_Mod_patch.txt" contains a context-diff between the original and the modified distribution. Programmers often use such a context-diff in order to create a modified version out of an unmodified one, with the help of the "patch" program (another invention of the creator of Perl, Larry Wall).

Best regards,
ibeji
in the name of Feechen

P.S.: We use version 3.6.7 of vBulletin!

Feechen
05 Jun 2007, 17:09
Dear all,

I've found a bug in this add-on which allows to introduce working Perl code into abbreviations.

For example, the abbreviation "P.S." (with two dots, where a dot means "any character" in Perl Regular Expressions, unless escaped with a backslash: "\.") does not only match the intended text "P.S.", but also "Post", or "PxSx" in general.

In order to fix this, one needs to insert a call to the PHP function "preg_quote() (http://www.php.net/manual/en/function.preg-quote.php)".

This has been done in the attached distribution file ("Acronym_Mod_fixed_2.zip").

The difference ("Acronym_Mod_patch_2.txt") between this modified distribution and the original one ("Acronym_Mod_new.zip") is attached here for the convenience of interested people only.

I hope this helps! :)

Best regards,
ibeji
in the name of Feechen

Feechen
05 Jun 2007, 17:30
Sorry,

the regular expression delimiter character '#' should of course be escaped by "preg_quote() (http://www.php.net/manual/en/function.preg-quote.php)" as well, in order to avoid crashes...

Best regards,
ibeji
in the name of Feechen

Feechen
09 Jun 2007, 11:38
In order to solve the problem of abbreviations (or acronyms) being a prefix of one another, such as in "DHEA" (= Dehydroepiandrosterone) and "DHEA-S" (= Dehydroepiandrosterone-sulfate), I have made a further modification to the Acronyms add-on.

Up to now such abbreviations were only recognized correctly if by chance the longer definition was entered first (and thus had a lower primary key index in the database).

The new version therefore first sorts all acronyms according to their length, and tries to find the longest match in the page to be displayed first. Only if that fails a shorter match is tried which then may be successful.

An additional term in the regular expression of the search pattern was introduced in order to avoid multiple replacements at the same location, very similar to the one to avoid replacements inside of HTML tags.

This means that if there were two abbreviations, for instance "DHEA" and "DHEA-S", then the text "DHEA-S" would match twice, once for "DHEA-S" and once for "DHEA". The result of such double replacements looks somewhat odd, therefore it has been prevented.

Moreover, it has been found that omitting the call to "preg_quote()" (see the previous two postings) in order to prevent the introduction of regular expressions into the definition of acronyms has its advantages:

This allows to define closely related variants of acronyms in a single definition (instead of a separate definition for each variant), such as for example "DHEA-?S". The question mark means that the preceding character is optional, i.e., this pattern would match "DHEAS" as well as "DHEA-S".

The advantage is conciseness, less acronym definitions to administrate, and improved speed (the more acronyms are defined, the longer it takes to display any given page).

The downside is that one needs at least a basic knowledge of (Perl) regular expressions in order to administrate the acronym definitions and that making a single error (e.g. a syntax error) will prevent the whole vBulletin board from working; all pages will display error messages instead of their contents, until the error is corrected.

It goes without saying that this implies that in this case, only knowledgeable and especially trustworthy people should have access to the Acronyms menu, which is not always possible or desirable to ensure.

Therefore two distributions have been prepared; the one with number "5" in its name is the "unsafe" one WITHOUT the call to "preg_quote()", and the one with number "6" in its name is the "safe" one (mnemonic: think of "safer sex", "6" = "sex") which prevents the introduction of Perl code into the definition of acronyms by escaping any characters with special meaning being found.

I hope you'll find these additions useful. :)

Best regards,
ibeji
in the name of Feechen

See also: [vB 3.5.x]Akronyme für vB (http://www.vbhacks-germany.org/showthread.php?t=3836) Seite 2 (http://www.vbhacks-germany.org/showthread.php?t=3836&page=2)
preg_replace() (http://www.php.net/manual/en/function.preg-replace.php) preg_quote() (http://www.php.net/manual/en/function.preg-quote.php) Arrays (http://www.php.net/manual/en/language.types.array.php) foreach (http://www.php.net/manual/en/control-structures.foreach.php) strlen() (http://www.php.net/manual/en/function.strlen.php) uksort() (http://www.php.net/manual/en/function.uksort.php) create_function() (http://www.php.net/manual/en/function.create-function.php)

Feechen
18 Aug 2007, 09:09
I just added the right apostrophe ("accent aigu") ´ as a possible separating character to the last two versions of the acronyms mod, because I had simply forgotten to include it in previous versions.

The left apostrophe ("accent grave") ` already was included since the beginning.

Best regards,
ibeji
in the name of Feechen

VIPER-MAN
12 Sep 2007, 04:22
Does this work on 3.6.8? And if so, which ZIP file is appropriate to download? There are like 10 of them posted throughout this thread.

Thx

ragtek
08 Oct 2007, 12:22
wouldn't it be better to replace the post when it is edited/safed instead of loaded?
the performance would be much better i think

Feechen
06 Nov 2007, 14:47
(1) Does this work on 3.6.8?
(2) And if so, which ZIP file is appropriate to download? There are like 10 of them posted throughout this thread. Thx(1) Yes, we use it under Version 3.6.8 Patch Level 1
(2) Of course the last two posted (5a, 6a), 5a if you want the power of Perl regular expressions in your acronyms, and 6a if you want the safer version without Perl code.
Best regards

Feechen
06 Nov 2007, 14:49
wouldn't it be better to replace the post when it is edited/safed instead of loaded? the performance would be much better i thinkYou are absolutely right on that, but firstly, we have some 205 acronyms defined in our forum and this doesn't slow down response times perceptively, and secondly, substituting at page load time has the advantage that the page will always be up to date, regardless of when (before or after the page was created or edited) changes to the acronym definitions have been made.
Cheers

stephansvl
22 Apr 2008, 20:28
I have problems with capital/small letters. Is it possible to exclude small letters? We use the acronyms for airport codes and therefore we just need capital letters.

IST for example is the shortcut for Istanbul, but the german ist is a verb and is used everywhere.

Puntoboy
20 Sep 2008, 15:19
Any chance of this working with 3.7.3 or am I going to have to buy GAL?

Texas-Hunter
05 Mar 2009, 23:33
Any idea if this will work with 3.8.1 ?

TinhNhi
04 May 2009, 01:51
can we replace the acronym instead of make it pop up their meaning on windows, I am just curious

EWGF
01 Jan 2010, 23:49
Works great on 3.8.4, lol

eridine
13 Jan 2010, 15:31
looks like it works under vB4.0.0PL1

Mike_K
05 Apr 2010, 18:44
I can confirm it: Works also with VB 4.02

Welshy2008
01 Aug 2010, 17:42
Does it work with 3.8.5, 3.8.6, 4.0.4, 4.05 and 4.06 Please?

Has anyone got any screenshot of it actually in use and a screenshot of the adminCP, please?


Many Thanks.

Mr_Running
21 Nov 2012, 17:01
Works on 4.2.0 p3 :)

Superorb
21 Nov 2012, 17:22
Works on 4.2.0 p3 :)
Which version did you use on 4.2 PL3?

Mr_Running
21 Nov 2012, 17:34
Acronyms for vB
Version: 3.5.4 works on 4.2 PL3

Superorb
21 Nov 2012, 17:48
Acronyms for vB
Version: 3.5.4 works on 4.2 PL3
Not the vB version, the plugin version that works on 4.2. What was the file name? There are a few in this thread.

Mr_Running
21 Nov 2012, 19:56
I am using the (Contributor) Version at the top :)

Superorb
21 Nov 2012, 20:40
I am using the (Contributor) Version at the top :)
The top of what? Do you mean the one in post #32 (http://www.vbulletin.org/forum/showpost.php?p=1320099&postcount=32)?

Mr_Running
21 Nov 2012, 22:19
(Contributor) Version at the top...see attachment.

Superorb
22 Nov 2012, 01:00
(Contributor) Version at the top...see attachment.
Oh, I see now. Contributor only means that the author is a contributor to vBulletin. His username is RolandvonGilead.

There were a few other downloadable versions in this thread so I wasn't sure which one you used.

Salvo
02 May 2013, 01:29
It works with 4.2.1, and it's fantastic!!

Gord Lacey
20 May 2013, 19:25
Wonderful! Just what I needed for users on my pinball forum. The number of acronyms/abbreviations is a bit overwhelming for new users, and this solves the problem. No issues with it on vB 4.2.

BirdOPrey5
16 Apr 2014, 18:15
Please note this modification was designed for vBulletin 3.5.x. I have moved it to this 3.6 section as it has been reported working on later versions. As always use at your own risk.

V8Owner
02 Mar 2015, 12:14
Just a heads up, not sure if it is a bug in the mod or an incompatibility with 4.2.2 you will get conflicts if your acronym explanations contain acronyms. Also if your explanations contain words that may be a pert of the acronym.