<acronym> or <abbr> markup. Allows users to manage lists of acronyms and abbreviations through admin interface. Based on Joel Pan's Acronyms plugin, updated for WordPress 3.0 and HTML5. Version: 2.0.7 Author: Chris Cox Author URI: http://www.renaissance-design.net/ Copyright 2011 Chris Cox This program 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 */ class Acronyms { /* void install () * Creates tables and populates default acronyms. */ static function install() { // Populate defaults $acronyms = array( 'AFAIK' => 'As far as I know', 'AIM' => 'AOL Instant Messenger', 'AJAX' => 'Asynchronous JavaScript and XML', 'AOL' => 'America Online', 'API' => 'Application Programming Interface', 'ASAP' => 'As soon as possible', 'ASCII' => 'American Standard Code for Information Interchange', 'ASP' => 'Active Server Pages', 'BTW' => 'By The Way', 'CD' => 'Compact Disc', 'CGI' => 'Common Gateway Interface', 'CMS' => 'Content Management System', 'CSS' => 'Cascading Style Sheets', 'CVS' => 'Concurrent Versions System', 'DBA' => 'Database Administrator', 'DDOS' => 'Distributed Denial of Service', 'DHTML' => 'Dynamic HyperText Markup Language', 'DMCA' => 'Digital Millenium Copyright Act', 'DNS' => 'Domain Name Server', 'DOM' => 'Document Object Model', 'DTD' => 'Document Type Definition', 'DVD' => 'Digital Versatile Disc', 'EOF' => 'End of file', 'EOL' => 'End of line', 'EOM' => 'End of message', 'EOT' => 'End of text', 'FAQ' => 'Frequently Asked Questions', 'FDL' => 'GNU Free Documentation License', 'FTP' => 'File Transfer Protocol', 'FUD' => 'Fear, Uncertainty, and Doubt', 'GB' => 'Gigabyte', 'GHz' => 'Gigahertz', 'GIF' => 'Graphics Interchange Format', 'GPL' => 'GNU General Public License', 'GUI' => 'Graphical User Interface', 'HDD' => 'Hard Disk Drive', 'HTML' => 'HyperText Markup Language', 'HTTP' => 'HyperText Transfer Protocol', 'IANAL' => 'I am not a lawyer', 'ICANN' => 'Internet Corporation for Assigned Names and Numbers', 'IE' => 'Internet Explorer', 'IE5' => 'Internet Explorer 5', 'IE6' => 'Internet Explorer 6', 'IIRC' => 'If I remember correctly', 'IIS' => 'Internet Information Services', 'IM' => 'Instant Message', 'IMAP' => 'Internet Message Access Protocol', 'IMHO' => 'In my humble opinion', 'IMO' => 'In my opinion', 'IOT' => 'Internet of Things', 'IOW' => 'In other words', 'IP' => 'Internet Protocol', 'IRC' => 'Internet Relay Chat', 'IRL' => 'In real life', 'ISO' => 'International Organization for Standardization', 'ISP' => 'Internet Service Provider', 'JDK' => 'Java Development Kit', 'JPEG' => 'Joint Photographics Experts Group', 'JPG' => 'Joint Photographics Experts Group', 'JS' => 'JavaScript', 'JSON' => 'JavaScript Object Notation', 'KB' => 'Kilobyte', 'KISS' => 'Keep it simple, stupid', 'LGPL' => 'GNU Lesser General Public License', 'LOL' => 'Laughing out loud', 'MB' => 'Megabyte', 'MHz' => 'Megahertz', 'MIME' => 'Multipurpose Internet Mail Extension', 'MIT' => 'Massachusetts Institute of Technology', 'MML' => 'Mathematical Markup Language', 'MPEG' => 'Motion Picture Experts Group', 'MS' => 'Microsoft', 'MSDN' => 'Microsoft Developer Network', 'MSIE' => 'Microsoft Internet Explorer', 'MSN' => 'Microsoft Network', 'OMG' => 'Oh my god', 'OPML' => 'Outline Processor Markup Language', 'OS' => 'Operating System', 'OSS' => 'Open Source Software', 'OTOH' => 'On the other hand', 'P2P' => 'Peer to Peer', 'PDA' => 'Personal Digital Assistant', 'PDF' => 'Portable Document Format', 'PHP' => 'PHP: Hypertext Preprocessor (recursive acronym)', 'PICS' => 'Platform for Internet Content Selection', 'PIN' => 'Personal Identification Number', 'PITA' => 'Pain in the Ass', 'PNG' => 'Portable Network Graphics', 'POP' => 'Post Office Protocol', 'POP3' => 'Post Office Protocol 3', 'Perl' => 'Practical Extraction and Report Language', 'QoS' => 'Quality of Service', 'RAID' => 'Redundant Array of Inexpensive Disks', 'RDF' => 'Resource Description Framework', 'ROFL' => 'Rolling on the floor laughing', 'ROFLMAO' => 'Rolling on the floor laughing my ass off', 'RPC' => 'Remote Procedure Call', 'RSS' => 'Really Simple Syndication', 'RTF' => 'Rich Text File', 'RTFM' => 'Read The Fucking Manual', 'SCSI' => 'Small Computer System Interface', 'SDK' => 'Software Development Kit', 'SGML' => 'Standard General Markup Language', 'SMIL' => 'Synchronized Multimedia Integration Language', 'SMTP' => 'Simple Mail Transfer Protocol', 'SOAP' => 'Simple Object Access Protocol', 'SQL' => 'Structured Query Language', 'SSH' => 'Secure Shell', 'SSI' => 'Server Side Includes', 'SSL' => 'Secure Sockets Layer', 'SVG' => 'Scalable Vector Graphics', 'SVN' => 'Subversion', 'TIA' => 'Thanks In Advance', 'TIFF' => 'Tagged Image File Format', 'TLD' => 'Top Level Domain', 'TOC' => 'Table of Contents', 'URI' => 'Uniform Resource Identifier', 'URL' => 'Uniform Resource Locator', 'URN' => 'Uniform Resource Name', 'USB' => 'Universal Serial Bus', 'VB' => 'Visual Basic', 'VBA' => 'Visual Basic for Applications', 'W3C' => 'World Wide Web Consortium', 'WAN' => 'Wide Area Network', 'WAP' => 'Wireless Access Protocol', 'WML' => 'Wireless Markup Language', 'WP' => 'WordPress', 'WTF' => 'What the fuck', 'WWW' => 'World Wide Web', 'WYSIWYG' => 'What You See Is What You Get', 'XHTML' => 'eXtensible HyperText Markup Language', 'XML' => 'eXtensible Markup Language', 'XSL' => 'eXtensible Stylesheet Language', 'XSLT' => 'eXtensible Stylesheet Language Transformations', 'XUL' => 'XML User Interface Language', 'YMMV' => 'Your mileage may vary' ); add_option( 'acronym_acronyms', $acronyms ); // Add default options -- Options not currently modifiable by user add_option( 'acronym_content', 1 ); add_option( 'acronym_comments', 1 ); Acronyms::theme_html5_check(); } /* string get_textdomain () * * returns the text domain to be used for internationalisation */ static function get_textdomain() { return "Acronyms"; } /* void uninstall () */ static function uninstall() { delete_option( 'acronym_acronyms' ); delete_option( 'acronym_content' ); delete_option( 'acronym_comments' ); delete_option( 'acronym_html5' ); } /** * Adds the Management page to WordPress * * @return void * */ static function add_pages() { $domain = Acronyms::get_textdomain(); // Add the Manage page add_management_page( __( 'Manage Acronyms', $domain ), __( 'Acronyms', $domain ), "edit_others_posts", __FILE__, array( 'Acronyms', 'manage_acronyms' ) ); } /** * void management_handler () * * handles actions for adding, editing or deleting acronyms * */ static function management_handler() { $domain = Acronyms::get_textdomain(); load_plugin_textdomain( $domain, dirname( plugin_basename( __FILE__ ) ) ); $title = __( 'Acronyms', $domain ); $parent_file = 'tools.php?page=' . Acronyms::get_parent_url(); if ( 'acronyms.php' == substr( $parent_file, -12 ) ) { $acronyms = get_option( 'acronym_acronyms' ); wp_reset_vars( array( 'action', 'acronym' ) ); if ( isset( $_GET[ 'delete-acronyms' ] ) ) // Bulk delete array of acronyms $action = 'delete-acronyms'; else if ( isset( $_GET[ 'search' ] ) ) // Search term for redirecting to less crufty HTTP GET URL $action = 'search'; else $action = $_GET[ 'action' ]; switch ( $action ) { case 'add-acronym': check_admin_referer( 'add_acronym' ); $acronym = $_GET[ 'acronym' ]; $fulltext = $_GET[ 'fulltext' ]; if ( Acronyms::update( $acronym, $fulltext ) ) $message = 1; else $message = 4; wp_redirect( "$parent_file&message=$message" ); exit; break; case 'edit-acronym': $acronym = $_GET[ 'acronym' ]; $fulltext = $_GET[ 'fulltext' ]; check_admin_referer( 'edit_acronym' ); if ( Acronyms::update( $acronym, $fulltext ) ) $message = 3; else $message = 5; wp_redirect( "$parent_file&message=$message" ); exit; break; case 'delete-acronym': check_admin_referer( 'delete_acronym' ); if ( !current_user_can( 'manage_categories' ) ) wp_die( __( 'Cheatin’ uh?' ) ); $acronym = $_GET[ 'acronym' ]; Acronyms::delete( $acronym ); $message = 2; wp_redirect( "$parent_file&message=$message" ); exit; break; case 'delete-acronyms': check_admin_referer( 'delete-acronyms' ); if ( !current_user_can( 'manage_categories' ) ) wp_die( __( 'Cheatin’ uh?' ) ); $acronyms = $_GET[ 'delete_acronyms' ]; foreach ( (array) $acronyms as $acronym ) { Acronyms::delete( $acronym ); } if ( 1 < ( count( $acronyms ) ) ) $message = 6; else $message = 2; wp_redirect( "$parent_file&message=$message" ); exit; break; case 'search': $s = '&s=' . urlencode( $_GET[ 'search' ] ); $p = isset( $_GET[ 'p' ] ) ? '&p=' . $_GET[ 'p' ] : ''; $n = isset( $_GET[ 'n' ] ) && 15 != $_GET[ 'n' ] ? '&n=' . $_GET[ 'n' ] : ''; wp_redirect( "$parent_file$s$p$n" ); } } } /** * Manage Acronyms page * * @return void * */ static function manage_acronyms() { $domain = Acronyms::get_textdomain(); // Set any error/notice messages based on the 'message' GET value $message = $_GET[ 'message' ]; $messages[ 1 ] = __( 'Acronym added.', $domain ); $messages[ 2 ] = __( 'Acronym deleted.', $domain ); $messages[ 3 ] = __( 'Acronym updated.', $domain ); $messages[ 4 ] = __( 'Acronym not added.', $domain ); $messages[ 5 ] = __( 'Acronym not updated.', $domain ); $messages[ 6 ] = __( 'Acronyms deleted.', $domain ); if ( isset( $message ) ) { ?>