vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Show Thread Enhancements - Acronyms for vB (https://vborg.vbsupport.ru/showthread.php?t=113846)

RolandvonGilead 04-22-2006 10:00 PM

Acronyms for vB
 

//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 04-23-2006 12:53 PM

Quote:

Its an normal Acronym-Explanation-Mod.
any more details please?

RolandvonGilead 04-23-2006 01:07 PM

Quote:

Originally Posted by Gizmo5h1t3
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 04-23-2006 01:13 PM

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 04-23-2006 01:19 PM

Good! :-)

RolandvonGilead 04-23-2006 02:24 PM

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 04-23-2006 02:26 PM

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 04-23-2006 02:32 PM

Quote:

Originally Posted by apfparadise
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 04-23-2006 03:09 PM

// 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 04-25-2006 03:14 AM

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 04-25-2006 07:40 PM

So I finished!

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

Roland

UK Jimbo 04-26-2006 12:03 AM

I think you're confusing acronyms with abbreviations :)

TomasDR 04-26-2006 01:31 AM

New Install! Very nice.

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

RolandvonGilead 04-26-2006 07:39 AM

Quote:

Originally Posted by TomasDR
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.


Quote:

Originally Posted by UK Jimbo
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 04-26-2006 09:01 AM

Quote:

Originally Posted by RolandvonGilead
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 04-26-2006 09:23 AM

Quote:

Originally Posted by UK Jimbo
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 04-27-2006 07:29 AM

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 04-27-2006 05:46 PM

Quote:

Originally Posted by Neo_obs
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.

PHP Code:

<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:

PHP Code:

border-bottom1px dotted #082ceb; 

Roland

Neo_obs 04-27-2006 07:57 PM

OK thanks but color isnt showing up using this
Code:

<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 09-15-2006 06:00 PM

so this is working fine with 3.5.4?

rareclownfish 09-15-2006 08:07 PM

This didn't work for me

JenniferK 09-16-2006 03:49 AM

will this work with 3.6?

rareclownfish 09-17-2006 02:23 AM

Anyone here??

rareclownfish 09-18-2006 03:30 PM

Man no support

Puntoboy 12-09-2006 08:35 PM

Just installed this and is caused a database error as soon as I put the first Acronym into the settings.

Feechen 05-19-2007 06:58 PM

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 in the German forum in the thread "[vB 3.5.x]Akronyme f?r vB".

Feechen 05-20-2007 08:35 PM

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 in the thread "[vB 3.5.x]Akronyme f?r vB".

I hope you might find this new version useful.

Best regards,
ibeji
in the name of Feechen

Feechen 05-21-2007 01:10 PM

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 06-05-2007 03:09 PM

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()".

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 06-05-2007 03:30 PM

Sorry,

the regular expression delimiter character '#' should of course be escaped by "preg_quote()" as well, in order to avoid crashes...

Best regards,
ibeji
in the name of Feechen

Feechen 06-09-2007 09:38 AM

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 Seite 2
preg_replace() preg_quote() Arrays foreach strlen() uksort() create_function()

Feechen 08-18-2007 07:09 AM

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 09-12-2007 02:22 AM

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 10-08-2007 10:22 AM

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 11-06-2007 12:47 PM

Quote:

Originally Posted by VIPER-MAN (Post 1337383)
(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 11-06-2007 12:49 PM

Quote:

Originally Posted by ragtek (Post 1355397)
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

You 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 04-22-2008 06:28 PM

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 09-20-2008 01:19 PM

Any chance of this working with 3.7.3 or am I going to have to buy GAL?

Texas-Hunter 03-05-2009 09:33 PM

Any idea if this will work with 3.8.1 ?

TinhNhi 05-03-2009 11:51 PM

can we replace the acronym instead of make it pop up their meaning on windows, I am just curious


All times are GMT. The time now is 04:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01377 seconds
  • Memory Usage 1,851KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete