# --- BEGIN PLUGIN HELP ---

I cannot take much credit for this plugin. Joel, who kindly released his code under the GPL, did all the heavy lifting. All I did was figure out how to pull the TXP content into the plugin and get it back out.

This plugin is intended to replace the <txp:excerpt /> and <txp:body /> tags. The usage is as follows:

<txp:cng_acronym content="value" />

The "value" can be either "excerpt" or "body." If no "value" is specified, it defaults to "body."

The plugin will pull the content from the "excerpt" or "body," depending on what is assigned to the content value, and then parse it through the acronym array. It will then return the entire content with the <acronym></acronym> tags surrounding any found acronyms.

So, in your article form where you might have the following:

<div class="articles">
<txp:excerpt />
<txp:body />
</div>

you would change it to this to use the plugin:

<div class="articles">
<txp:cng_acronym content="excerpt" />
<txp:cng_acronym content="body" />
</div>

The list of acronyms is within the plugin and can be edited to add or delete acronyms. The correct format for the acronym list is as follows:

"ACRONYM" => "Descriptive text goes here",

Note the comma at the end. There must be a comma after each entry in the acronym list except for the last entry, after which there should be no comma. Thus:

"FAQ" => "Frequently Asked Questions",

would then wrap any found instance of "FAQ" with tags, e.g., "<acronym title="Frequently Asked Questions">FAQ</acronym>". You can then add a CSS rule for your acronym tags in your stylesheet, like this:

acronym, abbr, span.caps
{
font-size: 1.1em;
letter-spacing: .07em;
border-bottom: 1px dashed #999;
cursor: help;
}

If there are any acronyms that you do not wish to have wrapped in <acronym></acronym> tags, then wrap dollar signs around the acronym, like so:

$FAQ$

In this case, the dollars signs would be stripped and the acronym would be left alone.

Finally, in the plugin code you will note that there are different "expressions" that are available if one finds that the plugin is acting wonky. One of these will allow lower-case acronyms to be wrapped in the tags. If you decide to try one of these other expressions, then be sure to comment out the default one by inserting two forward slashes (//) at the start of the line containing the default expression. The original plugin author added some commentary about this which I have left intact. For most folks, however, the defaults will work fine.

Thanks and enjoy!

# --- END PLUGIN HELP --- "deffintion", // ESPECIALLY note that they all end with commas EXCEPT the last one global $acronym_acronym; global $thisarticle; extract(lAtts(array( 'content' => 'body', ),$atts)); $text = $thisarticle["$content"]; if( empty($acronym_acronym) ) { $acronym_acronym = array( "AOL" => "America Online", "API" => "Application Programming Interface", "BTW" => "By The Way", "BPL" => "Broadband over Power Lines", "CD" => "Compact Disk", "CGI" => "Common Gateway Interface", "CLI" => "Common Language Interpreter", "CMS" => "Content Management System", "CSS" => "Cascading Style Sheets", "CVS" => "Concurrent Versions System", "DNS" => "Domain Name System", "DOM" => "Document Object Model", "DSL" => "Digital Subscriber Line (broadband over phone lines)", "DTD" => "Document Type Definition", "DVD" => "Digital Video Disc", "EBI" => "Elim Bible Institute (Bible College in upstate NY)", "EGC" => "Elim Gospel Church (my church)", "EF" => "Elim Fellowship (an association of evangelical ministers)", "FAQ" => "Frequently Asked Questions", "FCC" => "Federal Communications Commission", "FOAF" => "Friend Of A Friend is a RDF dialect for describing relationships", "F/OSS" => "Free and Open Source Software", "FSF" => "Free Software Foundation", "FTP" => "File Transfer Protocol", "FTTH" => "Fiber to the Home", "GB" => "Gigabyte", "GFDL" => "GNU Free Documentation License", "GNU" => "Gnu's Not Unix", "GPG" => "Gnu PG (Open source public key encryption)", "GPL" => "GNU General Public License", "GTK" => "GUI ToolKit - The GIMP Tool Kit for dcreating user-interfaces", "GUI" => "Graphical User Interface", "HDTV" => "High Definition TeleVision", "HTML" => "HyperText Markup Language", "HTTP" => "HyperText Transfer Protocol", "IE" => "Internet Explorer", "ICANN" => "Internet Corporation for Assigned Names and Numbers", "IHOP" => "International House of Pancakes", "IIRC" => "if I remember correctly", "IIS" => "Internet Infomation Server", "IM" => "Instant Message", "IMAP" => "Internet Message Access Protocol", "IP" => "Internet Protocol", "IRC" => "Internet Relay Chat - like Instant Messaging for groups", "JSP" => "Java Server Pages", "KB" => "Kilobyte", "KDE" => "K Desktop Environment", "KVM" => "Keyboard, Video, Mouse switch for controlling multiple computers", "LDAP" => "Lightweight Directory Access Protocol", "LGPL" => "GNU Lesser General Public License", "MAPI" => "Mail Application Programming Interface", "MB" => "Megabyte", "MP3" => "MPEG Layer 3 - a common audio codec for music files", "MS" => "Microsoft", "MSDN" => "Microsoft Developer Network", "MSIE" => "Microsoft Internet Explorer", "MSN" => "Microsoft Network", "NNTP" => "Network News Transfer Protocol - the protocol used for NewsGroups", "NYC" => "New York City", "OPML" => "Outline Processor Markup Language", "P2P" => "Peer To Peer", "PBS" => "Public Broadcasting System", "PDF" => "Portable Document Format", "PGP" => "Pretty Good Privacy (public key encryption)", "PHP" => "Hypertext PreProcessing", "PNG" => "Portable Network Graphics", "POP" => "Short for POP3, the Post Office Protocol for email", "POP3" => "Post Office Protocol 3 (for email)", "RAID" => "Redundant Array of Independent Disks", "RDF" => "Resource Description Framework", "RPC" => "Remote Procedure Call", "RSS" => "Really Simple Syndication", "SIG" => "Special Interest Group", "SOAP" => "Simple Object Access Protocol", "SQL" => "Structured Query Language (a database standard)", "SSH" => "Secure SHell (encrypted protocol replaces telnet and FTP)", "SSN" => "Social Security Number", "SSL" => "Secure Sockets Layer (a security protocol)", "SVG" => "Scalable Vector Graphics", "TCP" => "Transmission Control Protocol", "TXP" => "Textpattern", "UDP" => "User Datagram Protocol", "URI" => "Uniform Resource Identifier", "URL" => "Uniform Resource Locator", "USB" => "Universal Serial Bus", "VB" => "Visual Basic", "VBS" => "Visual Basic Script", "VM" => "Virtual Machine", "VNC" => "Virtual Network Computing", "W3C" => "World Wide Web Consortium", "WCAG" => "Web Content Accessibility Guidelines", "WYSIWYG" => "what you see is what you get", "XHTML" => "eXtensible HyperText Markup Language - HTML reformulated as XML", "XML" => "eXtensible Markup Language", "XSL" => "eXtensible Stylesheet Language", "XSLT" => "eXtensible Stylesheet Language Transformation", "YMMV" => "Your Mileage May Vary" ); } $text = " $text "; foreach($acronym_acronym as $acronym => $description) { /* For advanced users, there are several possible regular expressions here.... * The safest, "default" one is at the top ... * You (or I) may choose to use one of the others! * Pick whichever you want, and make SURE there is only one that isn't preceded by slashes: // */ // NEW DEFAULT // ANOTHER ATTEMPT (v2.8) $text = preg_replace("|(?!<[^<>]*?)(?]*?>)|imsU","$acronym" , $text); // DEFAULT: // OLD DEFAULT: CONSERVATIVE ******************************************************************************** /// $text = preg_replace("|([\s\>])$acronym([\s\<\.,;:\\/\-])|imsU" , "$1$acronym$2" , $text); // NEW DEFAULT: MORE DARING ******************************************************************************** /// $text = preg_replace("|([^./?&]\b)$acronym(\b[^:])|imsU" , "$1$acronym$2" , $text); //do it twice, in case they used the same acronym in their title and alt tag... /// $text = preg_replace("|(<[A-Za-z]+[^>]*)$acronym([^>]*>)|imsU" , "$1$acronym$2" , $text); /// $text = preg_replace("|(<[A-Za-z]+[^>]*)$acronym([^>]*>)|imsU" , "$1$acronym$2" , $text); /// $text = preg_replace("|(<[A-Za-z]+[^>]*)$acronym([^>]*>)|imsU" , "$1$acronym$2" , $text); // SAME AS ABOVE, but CASE SENSITIVE ******************************************************************************** /// $text = preg_replace("|([^./]\b)$acronym(\b[^:])|msU" , "$1$acronym$2" , $text); /// $text = preg_replace("|(<[A-Za-z]* [^>]*)$acronym([^<]*>)|msU" , "$1$acronym$2" , $text); // BY REQUEST: if you UNCOMMENT the last commented line here: ******************************************************************************** // acronyms wrapped in dollar signs will just be unwrapped: // So: $AOL$ will become AOL, without the AOL $text = preg_replace("|[$]$acronym[$]|imsU" , "$acronym" , $text); } return trim( $text ); } # --- END PLUGIN CODE --- ?>