bmsterling
By: a guest | Jun 15th, 2008 | Syntax:
PHP | Size: 2.29 KB | Hits: 1,210 | Expires: Never
<?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
*/
require_once('../../wp-config.php');
} // end : if (!function_exists('add_action'))
// borrowed from tiny_mce_config
function _getFileContents($path) {
if ( ! $path || ! @is_file($path) )
return '';
$content = '';
$fp = @fopen($path, 'r');
if ( ! $fp )
return '';
return $content;
}
if( isset( $_GET['dorunquicktag'] ) && !empty( $_GET['dorunquicktag'] ) ){
$quicktagsContent = _getFileContents('../../wp-includes/js/quicktags.js');
echo $quicktagsContent,$quickscripts;
}
$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);
?>