|Someone else took the name "Quick Code" and it was causing issues, so I have renamed the Quick Code plugin. Since this plugin is quick and dirty, I decided on the name "Dirty Code." This name also pays homage to one of my favorite movies of all time, Dirty Love and to the way I like my martinis =). This code is backwards compatible and will still work with all <quickcode></quickcode> tags.|
|Plugin Name:||Dirty Code|
|Works With:||WordPress 2.3-3.0|
|Download:||[ zip ]|
|Description:||Transforms any code (SQL, CSS, PHP, ASP, etc) between <dirtycode> and </dirtycode> into a good looking div which can disappear or reappear with a click.|
|=>>Thanks to NetLobo for the div hiding code and coffee2code for a portion of the formatting code.<<=|
1. Dirty Code
And here it's already busted out.
|1.||Download and extract the dirtycode.zip into your /wp-content/plugins/ directory. There are several ways to do this, here is one option:
open a shell, cd into your /wp-content/plugins/ directory and execute the following command(s):
curl -o dirtycode.zip http://blog.netnerds.net/code/dirtycode.zip && unzip dirtycode.zip && rm dirtycode.zip
|2.||Activate the plugin from your WordPress admin 'Plugins' page.|
|3.||Place your code between the <dirtycode> tag. You can do this three ways:
a. <dirtycode>Some code</dirtycode>
b. <dirtycode:Place Custom Title Here>Some code</dirtycode>
c. <dirtycode:noclick>Some code</dirtycode>
d. In the event that your WordPress editor tears out <dirtycode></dirtycode>, can also use brackets instead of carrots. ie. [dirtycode]Some code[/dirtycode].
|What It Does:|
|1.||dirtycode_add_options_page() adds a Dirty Code section to your Admin->Options page. Use this page to set whether you'd like your code to be auto-expanded in Single Posts. It is set to Yes by default.|
|2.||pretty_code_dirty() replaces the <dirtycode> text with pretty divs. It then extracts the title, if any, and adds it as the text to the hyperlink. If the parsed title is "noclick", it replaces the pretty divs with differnet divs to auto-expand the block of code.|
|1.||Default link text. It is currently "Dirty Code." Change this variable: $codeTitle="Dirty Code";|
|2.||In the CSS section, you can change the background color and default text.|
|3.||You can also change the type of CSS overflow style you'd like. Currently, it is set only to scroll horizontally (when necessary)|
|1.||If my code is silly looking its because I'm not a native PHP coder. I just wrote up the code in ASP and used asp2php.exe to transform.|
|2.||This script works with Firefox and IE. The ordering of the CSS elements overflow-y and overflow is important for cross-browser compatibility. Leave it as is.|
|1.||I've only noticed one -- do not use the dirtycode tag as the very first thing in your post or your formatting will mess up.|
* 26 Sept 2009 : v1.0 - Change the name from Quick Code to Dirty Code and made the plugin 2.8.4 (maybe less, maybe more) compliant.
* 13 Dec 2006 : v0.95 - Added a value for overflow-x to stop IE's truncation of the code.
* 18 May 2006 : v0.94 - Added image to auto expanded single links. Removed titles in single links if title is "noclick" or "Dirty Code".
* 15 May 2006 : v0.93 - Added support for brackets for people who want to use the built-in WordPress editor
* 11 May 2006 : v0.92 - Added title and line break to auto-expanded code in single posts.
* 28 Apr 2006 : v0.91 - Added Control Panel support to auto-expand code in single posts. Consolidated all the files into one directory.
* 20 Apr 2006 : v0.9 - Released to the public
|Copyright & Disclaimer:
Copyright (c) 2006 by Chrissy LeMaire
|Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:|
|The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.|
|THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.|