Kirk montgomery. Adds buttons to the post / page editor to take advantage of the Redoable (Sawchuk) scheme for K2 and its many post text styles. Version: 1.0 Author: Dean Robinson Author URI: http://www.deanjrobinson.com */ // INSTALLATION / INSTRUCTIONS: // // This plugin requires the Redoable theme for Wordpress. // Note: K2 is not required, Redoable is a stnadalone theme, which is based on K2. // // Upload entire directory to your wordpress plugins folder. Head to the plugins // menu and activate the plugin. Thats it. All these new buttons should be visible // the next time you write a post (in whatever editor you use). // // REFERENCES / THANKS // // Icons used come from the FamFamFam Silk Icon set http://www.famfamfam.com // Buttonsnap is a CLASS LIBRARY By Owen Winkler (http://asymptomatic.net) // This plugin uses a slightly modified version of buttonsnap done by // John W Vanderbeck of http://www.jwvanderbeck.com. Thanks to both of you, // for providing your code and hard work. // // This plugin is a modified version of the Sawchuk Buttons plugin by Kirk Montgomery. Thankyou, // it solved many of my problems and has served as a wonderful base for this. // // No warranty implied or otherwise, use at your own risk. // 1. Initialize the buttonsnap php include('buttonsnap.php'); // 2. Add an action so buttonsnap knows what to do // The action calls a function, defined below add_action('init', 'Rechuked_button_init'); function Rechuked_button_init() { // 3. Set up some unique button image URLs for the new buttons to use iin the WYSI toolbar (does nothing in the Quicktags) $Rechuked_button_blockquote_image_url = buttonsnap_dirname(__FILE__) . '/images/text_indent.png'; $Rechuked_button_alert_image_url = buttonsnap_dirname(__FILE__) . '/images/exclamation.png'; $Rechuked_button_callout_image_url = buttonsnap_dirname(__FILE__) . '/images/text_dropcaps.png'; $Rechuked_button_code_image_url = buttonsnap_dirname(__FILE__) . '/images/application_osx_terminal.png'; $Rechuked_button_construction_image_url = buttonsnap_dirname(__FILE__) . '/images/error.png'; $Rechuked_button_new_image_url = buttonsnap_dirname(__FILE__) . '/images/new.png'; $Rechuked_button_download_image_url = buttonsnap_dirname(__FILE__) . '/images/package_go.png'; $Rechuked_button_information_image_url = buttonsnap_dirname(__FILE__) . '/images/information.png'; $Rechuked_button_note_image_url = buttonsnap_dirname(__FILE__) . '/images/page_white_text.png'; //$Rechuked_button_php_image_url = buttonsnap_dirname(__FILE__) . '/images/other.png'; //$Rechuked_button_java_image_url = buttonsnap_dirname(__FILE__) . '/images/other.png'; //$Rechuked_button_js_image_url = buttonsnap_dirname(__FILE__) . '/images/other.png'; //$Rechuked_button_css_image_url = buttonsnap_dirname(__FILE__) . '/images/other.png'; //$Rechuked_button_html_image_url = buttonsnap_dirname(__FILE__) . '/images/other.png'; // 4. Create a vertical separator in the WYSI toolbar (does nothing in the Quicktags) buttonsnap_separator(); // 5. Create a button that uses Ajax to fetch replacement text from a WordPress plugin hook sink buttonsnap_ajaxbutton($Rechuked_button_blockquote_image_url, 'BlockQuote', 'Rechuked_blockquote_insert_hook'); buttonsnap_ajaxbutton($Rechuked_button_alert_image_url, 'Alert!', 'Rechuked_alert_insert_hook'); buttonsnap_ajaxbutton($Rechuked_button_callout_image_url, 'Callout', 'Rechuked_callout_insert_hook'); buttonsnap_ajaxbutton($Rechuked_button_code_image_url, 'Code', 'Rechuked_code_insert_hook'); buttonsnap_ajaxbutton($Rechuked_button_construction_image_url, 'Construction', 'Rechuked_construction_insert_hook'); buttonsnap_ajaxbutton($Rechuked_button_new_image_url, 'New', 'Rechuked_new_insert_hook'); buttonsnap_ajaxbutton($Rechuked_button_download_image_url, 'Download', 'Rechuked_download_insert_hook'); buttonsnap_ajaxbutton($Rechuked_button_information_image_url, 'Information', 'Rechuked_information_insert_hook'); buttonsnap_ajaxbutton($Rechuked_button_note_image_url, 'Note', 'Rechuked_note_insert_hook'); //buttonsnap_separator(); // Just another seperator to differentiate different types of Blockquotes //buttonsnap_ajaxbutton($Rechuked_button_php_image_url, 'PHP', 'Rechuked_php_insert_hook'); //buttonsnap_ajaxbutton($Rechuked_button_java_image_url, 'JAVA', 'Rechuked_java_insert_hook'); //buttonsnap_ajaxbutton($Rechuked_button_js_image_url, 'JS', 'Rechuked_js_insert_hook'); //buttonsnap_ajaxbutton($Rechuked_button_css_image_url, 'CSS', 'Rechuked_css_insert_hook'); //buttonsnap_ajaxbutton($Rechuked_button_html_image_url, 'HTML', 'Rechuked_html_insert_hook'); // 6. Add the filter to match the hook and sink together add_filter('Rechuked_blockquote_insert_hook', 'Rechuked_blockquote_insert_sink'); add_filter('Rechuked_alert_insert_hook', 'Rechuked_alert_insert_sink'); add_filter('Rechuked_callout_insert_hook', 'Rechuked_callout_insert_sink'); add_filter('Rechuked_code_insert_hook', 'Rechuked_code_insert_sink'); add_filter('Rechuked_construction_insert_hook', 'Rechuked_construction_insert_sink'); add_filter('Rechuked_new_insert_hook', 'Rechuked_new_insert_sink'); add_filter('Rechuked_download_insert_hook', 'Rechuked_download_insert_sink'); add_filter('Rechuked_information_insert_hook', 'Rechuked_information_insert_sink'); add_filter('Rechuked_note_insert_hook', 'Rechuked_note_insert_sink'); //add_filter('Rechuked_php_insert_hook', 'Rechuked_php_insert_sink'); //add_filter('Rechuked_java_insert_hook', 'Rechuked_java_insert_sink'); //add_filter('Rechuked_js_insert_hook', 'Rechuked_js_insert_sink'); //add_filter('Rechuked_css_insert_hook', 'Rechuked_css_insert_sink'); //add_filter('Rechuked_html_insert_hook', 'Rechuked_html_insert_sink'); } // 7. Each function below corresponds to one button and matches to an above // add_filter. The filter returns the selected text AND the before and after // text found in single quotes. Stripslashes is used because sometimes // text has quotes in it. function Rechuked_blockquote_insert_sink($selectedtext) { return '
' . stripslashes($selectedtext) . '
'; } function Rechuked_alert_insert_sink($selectedtext) { return '

' . stripslashes($selectedtext) . '

'; } function Rechuked_callout_insert_sink($selectedtext) { return '

' . stripslashes($selectedtext) . '

'; } function Rechuked_code_insert_sink($selectedtext) { return '

' . stripslashes($selectedtext) . '

'; } function Rechuked_construction_insert_sink($selectedtext) { return '

' . stripslashes($selectedtext) . '

'; } function Rechuked_new_insert_sink($selectedtext) { return '

' . stripslashes($selectedtext) . '

'; } function Rechuked_download_insert_sink($selectedtext) { return '

' . stripslashes($selectedtext) . '

'; } function Rechuked_information_insert_sink($selectedtext) { return '

' . stripslashes($selectedtext) . '

'; } function Rechuked_note_insert_sink($selectedtext) { return '

' . stripslashes($selectedtext) . '

'; } //function Rechuked_php_insert_sink($selectedtext) { //return '' . $selectedtext . ''; //} //function Rechuked_java_insert_sink($selectedtext) { //return '' . stripslashes($selectedtext) . ''; //} //function Rechuked_js_insert_sink($selectedtext) { //return '' . stripslashes($selectedtext) . ''; //} //function Rechuked_css_insert_sink($selectedtext) { //return '' . stripslashes($selectedtext) . ''; //} //function Rechuked_html_insert_sink($selectedtext) { //return '' . stripslashes($selectedtext) . ''; //} // Fin. ?>