Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- Plugin Name: Quicktag Extender
- Plugin URI:
- Description:
- Author: Benjamin Sterling
- Version: 1.0
- Author URI: http://benjaminsterling.com
- File Name: quicktag-extender.php
- */
- /*
- follow this pattern
- edButtons[edButtons.length] =
- new edButton('ed_h3'
- ,'h3' // human readablel h3 will show on the botton
- ,'<h3>' // open tag
- ,'</h3>' // close tag
- ,'3' // access key
- //, -1 optional, set to -1 if tag does not need to be closed, which mean
- // that you will not need a close tag
- );
- * edit below
- *-----------------------------------------------*/
- $quickscripts = <<<qs
- edButtons[edButtons.length] =
- new edButton('ed_h1'
- ,'h1'
- ,'<h1>'
- ,'</h1>'
- ,'1'
- );
- edButtons[edButtons.length] =
- new edButton('ed_h2'
- ,'h2'
- ,'<h2>'
- ,'</h2>'
- ,'2'
- );
- edButtons[edButtons.length] =
- new edButton('ed_h3'
- ,'h3'
- ,'<h3>'
- ,'</h3>'
- ,'3'
- );
- edButtons[edButtons.length] =
- new edButton('ed_h4'
- ,'h4'
- ,'<h4>'
- ,'</h4>'
- ,'4'
- );
- edButtons[edButtons.length] =
- new edButton('ed_h5'
- ,'h5'
- ,'<h5>'
- ,'</h5>'
- ,'5'
- );
- qs;
- /*
- * end edit
- *--------------------------------------------------*/
- /**
- * Load WP-Config File If This File Is Called Directly
- */
- if (!function_exists('add_action')) {
- require_once('../../wp-config.php');
- } // end : if (!function_exists('add_action'))
- // borrowed from tiny_mce_config
- function _getFileContents($path) {
- if ( function_exists('realpath') )
- $path = realpath($path);
- if ( ! $path || ! @is_file($path) )
- return '';
- if ( function_exists('file_get_contents') )
- return @file_get_contents($path);
- $content = '';
- $fp = @fopen($path, 'r');
- if ( ! $fp )
- return '';
- while ( ! feof($fp) )
- $content .= fgets($fp);
- fclose($fp);
- return $content;
- }
- if( isset( $_GET['dorunquicktag'] ) && !empty( $_GET['dorunquicktag'] ) ){
- $quicktagsContent = _getFileContents('../../wp-includes/js/quicktags.js');
- echo $quicktagsContent,$quickscripts;
- exit(0);
- }
- $blogurl = get_option('wpurl');
- $pluginurl = $blogurl . '/wp-content/plugins/' . basename(__FILE__);
- function dome(){
- global $wp_scripts;
- $wp_scripts->scripts['quicktags']->src = '/wp-content/plugins/' . basename(__FILE__) . '?dorunquicktag=true';
- }
- add_action( 'admin_print_scripts', dome);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement