SignpostMarv Martin. Author: Joel Bennett Author URI: http://www.HuddledMasses.org Copyright (c) 2003 Released under the GPL license http://www.gnu.org/licenses/gpl.txt This file is part of WordPress. WordPress is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // different types of ubernyms: define("uttReplace", "uttReplace"); define("uttJustLink", "uttJustLink" ); define("uttAbbreviation", "uttAbbreviation" ); define("uttAcronym", "uttAcronym" ); define("uttInitialism", "uttInitialism" ); function ubernyms_load_settings() { global $ubernyms_settings; if( empty($ubernyms_settings) ) { $ubernyms_settings = get_option("ubernyms_settings"); if( empty($ubernyms_settings) ) { update_option("ubernyms_settings", array( true, true, true, true, true) ); } } } function ubernyms_load() { global $ubernyms_collection; ubernyms_load_settings(); if( empty($ubernyms_collection) ) { $ubernyms_collection = get_option("ubernyms_collection"); // First, we define all the things we're going to replace, without using parenthesis or pipes (|) // ESPECIALLY note that they all end with commas EXCEPT the last one if( empty($ubernyms_collection) ) { // $type, $abbr, $text, $description = NULL, $english = FALSE, $makeLink = NULL, $appendLink = NULL $ubernyms_collection = array( new ubernym( uttInitialism, "AOL", "America Online", "Still the largest internet service provider in the world", false, NULL, "http://www.aol.com" ), new ubernym( uttAcronym, "AIM", "AOL Instant Messenger", "The most popular instant messaging service was originally for AOL members only.", false, NULL, "http://www.aim.com" ), new ubernym( uttAcronym, "AJAX", "Asynchronous Javascript And XML", "How we make web-pages truly dynamic", true, NULL, NULL ), new ubernym( uttInitialism, "CSS", "Cascading Style Sheets", "", true, NULL, "http://www.w3.org/Style/CSS/"), new ubernym( uttInitialism, "HTML", "HyperText Markup Language","Link to the spec:",false, NULL,"http://www.w3.org/MarkUp/"), new ubernym( uttInitialism, "HTTP", "HyperText Transfer Protocol","",false, NULL, NULL), new ubernym( uttInitialism, "PDF", "Portable Document Format","",false, NULL, NULL), new ubernym( uttInitialism, "PHP", "PHP: Hypertext Preprocessor","",false ,"http://www.php.net"), new ubernym( uttInitialism, "PNG", "Portable Network Graphics","", false, "http://www.w3.org/Graphics/PNG/", NULL), new ubernym( uttInitialism, "RDF", "Resource Description Framework", "", true ,"http://www.w3.org/RDF/", NULL), new ubernym( uttInitialism, "RSS", "Really Simple Syndication","",false, NULL, NULL), new ubernym( uttJustLink, "ubernyms", "A WordPress plugin", "The original acronym and autolinker plugins all rolled into one slick plugin with fancy tooltips and more.", false, NULL, "http://www.huddledmasses.org/category/development/wordpress/ubernyms-plugin/" ), new ubernym( uttInitialism, "URL", "Uniform Resource Locator","",false, NULL, NULL), new ubernym( uttInitialism, "USB", "Universal Serial Bus","",false, NULL, NULL), new ubernym( uttInitialism, "VBS", "Visual Basic Script", "", true, NULL, NULL), new ubernym( uttAcronym, "VOIP", "Voice Over Internet Protocol", "Allows you to make voice phone calls over the internet, which makes it much cheaper, and in many cases, free.", false, NULL, NULL), new ubernym( uttInitialism, "W3C", "World Wide Web Consortium","",false ,"http://www.w3.org/", NULL), new ubernym( uttAbbreviation,"WCAG", "Web Content Accessibility Guidelines","",false ,"http://www.w3.org/TR/WAI-WEBCONTENT", NULL), new ubernym( uttAcronym, "WYSIWYG", "what you see is what you get","",false, NULL, NULL), new ubernym( uttInitialism, "XHTML", "eXtensible HyperText Markup Language - HTML reformulated as XML","",false ,"http://www.w3.org/MarkUp/", NULL), new ubernym( uttInitialism, "XML", "eXtensible Markup Language","",false ,"http://www.w3.org/XML/", NULL), new ubernym( uttAbbreviation,"XRX", "Xerox (stock ticker symbol)","",false ,"http://www.google.com/finance?XRX", NULL), new ubernym( uttInitialism, "XSL", "eXtensible Stylesheet Language","",false ,"http://www.w3.org/Style/XSL/", NULL), new ubernym( uttInitialism, "XSLT", "eXtensible Stylesheet Language Transformation", "", true ,"http://www.w3.org/Style/XSL/", NULL) ); update_option("ubernyms_collection", $ubernyms_collection ); } } } function ubernyms_make_config_page() { if ( function_exists('add_submenu_page') ) add_submenu_page('plugins.php', 'Ubernyms Configuration', 'Ubernyms Configuration', 1, basename(__FILE__), 'ubernyms_config_page'); } function ubernyms_config_page() { global $ubernyms_collection, $ubernyms_settings; ubernyms_load(); if (isset($_POST['ubernyms_update'])) { ?>
Settings updated!
"" && $_POST['uber_text'][$utt] > "" ) { $uttstored++; $ubernyms_collection[$utt] = new ubernym( $_POST['ubertt_type'][$utt], // One of: uttReplace, uttAbbreviation, uttAcronym, uttInitialism wp_specialchars(stripslashes($_POST['uber_abbr'][$utt])), // the search text wp_specialchars(stripslashes($_POST['uber_text'][$utt])), // the replacement text (or tooltip text) wp_specialchars(stripslashes($_POST['uber_description'][$utt])), // additional text (in parenthesis, or in DomTT) ( $_POST['uber_english'][$utt] == "true" ), // TRUE to show the full description the first time the text appears wp_specialchars(stripslashes($_POST['uber_makeLink'][$utt])), // URL to convert text into a link (leave NULL to not link) wp_specialchars(stripslashes($_POST['uber_appendLink'][$utt]))); // URL to append a (link) to the tooltip (or text if not using DomTT) } } update_option("ubernyms_collection", $ubernyms_collection ); print( "$uttstored ubernyms stored." ); ?>
The purpose of Ubernyms is to allow you configure a set of frequently used abbreviations that will be automatically coded nicely whenever you use them. The goal is to make them visible in a way that is literate for both humans and computers. In the future, I'll probably put the list of acronyms here on this page and store them in the database, but for now you have to actually edit the plugin to add, remove or change ubernyms.
There is a setting for each ubernym that lets you define if it is an acronym or an initialism, or just a plain old abbreviation. You can also specify special text that you want replaced completely, and even add links. In fact, you can add HTML to the replacements or even to the tooltips if you use the DomTT method.