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)

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 07:47 AM.

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.01139 seconds
  • Memory Usage 1,745KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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