daily pastebin goal
38%
SHARE
TWEET

bmsterling

a guest Jun 15th, 2008 1,415 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.         Plugin Name: Quicktag Extender
  4.         Plugin URI:
  5.         Description:
  6.         Author: Benjamin Sterling
  7.         Version: 1.0
  8.         Author URI: http://benjaminsterling.com
  9.         File Name: quicktag-extender.php
  10. */
  11.  
  12. /*
  13. follow this pattern
  14.  
  15. edButtons[edButtons.length] =
  16. new edButton('ed_h3'
  17.         ,'h3'  // human readablel h3 will show on the botton
  18.         ,'<h3>'  // open tag
  19.         ,'</h3>' // close tag
  20.         ,'3' //  access key
  21.         //, -1 optional, set to -1 if tag does not need to be closed, which mean
  22.         // that you will not need a close tag
  23. );
  24.  
  25.  * edit below
  26.  *-----------------------------------------------*/
  27. $quickscripts = <<<qs
  28.  
  29. edButtons[edButtons.length] =
  30. new edButton('ed_h1'
  31.         ,'h1'
  32.         ,'<h1>'
  33.         ,'</h1>'
  34.         ,'1'
  35. );
  36.  
  37. edButtons[edButtons.length] =
  38. new edButton('ed_h2'
  39.         ,'h2'
  40.         ,'<h2>'
  41.         ,'</h2>'
  42.         ,'2'
  43. );
  44.  
  45. edButtons[edButtons.length] =
  46. new edButton('ed_h3'
  47.         ,'h3'
  48.         ,'<h3>'
  49.         ,'</h3>'
  50.         ,'3'
  51. );
  52.  
  53. edButtons[edButtons.length] =
  54. new edButton('ed_h4'
  55.         ,'h4'
  56.         ,'<h4>'
  57.         ,'</h4>'
  58.         ,'4'
  59. );
  60.  
  61. edButtons[edButtons.length] =
  62. new edButton('ed_h5'
  63.         ,'h5'
  64.         ,'<h5>'
  65.         ,'</h5>'
  66.         ,'5'
  67. );
  68.  
  69. qs;
  70.  
  71. /*
  72.  * end edit
  73.  *--------------------------------------------------*/
  74.  
  75.  
  76.  
  77. /**
  78.  *      Load WP-Config File If This File Is Called Directly
  79.  */
  80. if (!function_exists('add_action')) {
  81.         require_once('../../wp-config.php');
  82. } //  end : if (!function_exists('add_action'))
  83.  
  84. // borrowed from tiny_mce_config
  85. function _getFileContents($path) {
  86.  
  87.         if ( function_exists('realpath') )
  88.                 $path = realpath($path);
  89.  
  90.         if ( ! $path || ! @is_file($path) )
  91.                 return '';
  92.  
  93.         if ( function_exists('file_get_contents') )
  94.                 return @file_get_contents($path);
  95.  
  96.         $content = '';
  97.         $fp = @fopen($path, 'r');
  98.         if ( ! $fp )
  99.                 return '';
  100.  
  101.         while ( ! feof($fp) )
  102.                 $content .= fgets($fp);
  103.  
  104.         fclose($fp);
  105.         return $content;
  106. }
  107.  
  108. if( isset( $_GET['dorunquicktag'] ) && !empty( $_GET['dorunquicktag'] ) ){
  109.         $quicktagsContent = _getFileContents('../../wp-includes/js/quicktags.js');
  110.        
  111.         echo $quicktagsContent,$quickscripts;
  112.         exit(0);
  113. }
  114. $blogurl = get_option('wpurl');
  115. $pluginurl =  $blogurl . '/wp-content/plugins/' . basename(__FILE__);
  116.  
  117. function dome(){
  118.         global $wp_scripts;
  119.         $wp_scripts->scripts['quicktags']->src = '/wp-content/plugins/' . basename(__FILE__) . '?dorunquicktag=true';
  120. }
  121. add_action( 'admin_print_scripts', dome);
  122.  
  123.  
  124. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top