[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/plugins/code_highlight_plugin/ -> _code_highlight.plugin.php (source)

   1  <?php
   2  /**

   3   * This file implements the AstonishMe Code plugin.

   4   *

   5   * This file is part of the b2evolution project - {@link http://b2evolution.net/}

   6   *

   7   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

   8   * Parts of this file are copyright (c)2005-2007 by Yabba/Scott - {@link http://astonishme.co.uk/contact/}.

   9   *

  10   * {@internal License choice

  11   * - If you have received this file as part of a package, please find the license.txt file in

  12   *   the same folder or the closest folder above for complete license terms.

  13   * - If you have received this file individually (e-g: from http://cvs.sourceforge.net/viewcvs.py/evocms/)

  14   *   then you must choose one of the following licenses before using the file:

  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  17   * }}

  18   *

  19   * {@internal Open Source relicensing agreement:

  20   * Yabba/Scott grant Francois PLANQUE the right to license

  21   * Yabba's/Scott's contributions to this file and the b2evolution project

  22   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  23   * }}

  24   *

  25   * @package plugins

  26   *

  27   * @author Yabba: Paul Jones - {@link http://astonishme.co.uk/}

  28   * @author Stk: Scott Kimler - {@link http://astonishme.co.uk/}

  29   *

  30   * @version $Id: _code_highlight.plugin.php,v 1.10 2007/07/09 19:07:44 fplanque Exp $

  31   */
  32  
  33  /**

  34   * AstonishMe Display Code plugin.

  35   *

  36   *    Features:

  37   *        1) Character entity rendering on-the-fly

  38   *        2) Easy to use, just cut'n-paste your code

  39   *        3) Automatically adds line numbers and alternate colouring

  40   *        4) Customizable CSS for integrating for your site

  41   *        5) XHTML (Strict) and CSS valid code

  42   *        6) Auto-senses code block length

  43   *        7) BBCode tags pass through and allow to highlight the code

  44   *        8) No accidental smilie rendering

  45   *        9) PHP Syntax highlighting

  46   *       10) Variable start line numbers

  47   *       11) Links php functions to the php.net documentation

  48   *       12) Code is preserved if plugin uninstalled ( stored as : <!--amphp--><pre>&lt;php echo 'hello world'; ?&gt;</pre><!--/amphp--> )

  49   *

  50   *    To use:

  51   *        ************************************** THIS WILL NEED REWRITING ******************************************

  52   *        * Upload and install the plugin via the back office

  53   *        * Paste your code between <amcode> </amcode> tags

  54   *        * Paste your php between <amphp> </amphp> tags

  55   *        * start from any line number with the line attribute

  56   *        * <amcode line="99"> or <amphp line="999">

  57   *

  58   * @todo fp> for semantic purposes, <code> </code> should be automagically added

  59   * yabs > I assume you mean that <code> block </code> should also be converted/highlighted

  60   * in which case "done", I also added in <php> </php> ( was an easier regex :p )

  61   * obviously we originally picked the tag names to suit ourselves

  62   *

  63   */
  64  
  65  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  66  
  67  /**

  68   * @package plugins

  69   */
  70  
  71  class code_highlight_plugin extends Plugin
  72  {
  73      var $name = 'Code highlight';
  74      var $code = 'evo_code';
  75      var $priority = 80;
  76      var $version = '1.10-dev';
  77      var $author = 'Astonish Me';
  78      var $group = 'rendering';
  79      var $help_url = 'http://b2evo.astonishme.co.uk/';
  80      var $apply_rendering = 'opt-out';
  81      var $number_of_installs = 1;
  82  
  83      /**

  84       * Text php functions array

  85       *

  86       * @access private

  87       */
  88      var $php_functions = array();
  89  
  90      /**

  91       * Text php syntax highlighting colours array

  92       *

  93       * @access private

  94       */
  95      var $highlight_colours = array();
  96  
  97  
  98      /**

  99       * EXPERIMENTAL - array language classes cache

 100       *

 101       * @access private

 102       */
 103      var $languageCache = array();
 104  
 105  
 106      /**

 107       * Init

 108       */
 109  	function PluginInit( & $params )
 110      {
 111          $this->short_desc = T_( 'Display computer code in a post.' );
 112          $this->long_desc = T_( 'Display computer code easily.  This plugin renders character entities on the fly, so you can cut-and-paste normal code directly into your posts and it will always look like normal code, even when editing the post (i.e., no preprocessing of the code is required). Include line numbers (customizable starting number).  The best part about the line numbers - visitors can cut-and-paste the code from your post, leaving the line numbers behind! Accepts BBcode tags and does not render smilies.  Colouration of PHP code, plus PHP manual links for PHP functions. Easy to install and easy to use. No hacks. Degrades nicely, if the plugin is off.  Styling completely customizable via your skins CSS file.' );
 113      }
 114  
 115  
 116      /**

 117       * Get the settings that the plugin can use.

 118       *

 119       * Those settings are transfered into a Settings member object of the plugin

 120       * and can be edited in the backoffice (Settings / Plugins).

 121       *

 122       * @see Plugin::GetDefaultSettings()

 123       * @see PluginSettings

 124       * @see Plugin::PluginSettingsValidateSet()

 125       * @return array

 126       */
 127  	function GetDefaultSettings( & $params )
 128      {
 129          $r = array(
 130              'strict' => array(
 131                      'label' => $this->T_( 'XHTML strict' ),
 132                      'type' => 'checkbox',
 133                      'defaultvalue' => '0', // use transitional as default
 134                      'note' => $this->T_( 'If enabled this will remove the \' target="_blank" \' from the PHP documentation links' ),
 135                  ),
 136              'toolbar_default' => array(
 137                      'label' => $this->T_( 'Display code toolbar' ),
 138                      'type' => 'checkbox',
 139                      'defaultvalue' => '1',
 140                      'note' => $this->T_( 'Check this to display the code toolbar in expert mode (indivdual users can override this).' ),
 141                  ),
 142              );
 143          return $r;
 144      }
 145  
 146  
 147  
 148      /**

 149       * Allowing the user to override the display of the toolbar.

 150       *

 151       * @see Plugin::GetDefaultSettings()

 152       * @see PluginSettings

 153       * @see Plugin::PluginSettingsValidateSet()

 154       *

 155       * @return array

 156       */
 157  	function GetDefaultUserSettings()
 158      {
 159          return array(
 160                  'display_toolbar' => array(
 161                      'label' => T_( 'Display code toolbar' ),
 162                      'defaultvalue' => $this->Settings->get('toolbar_default'),
 163                      'type' => 'checkbox',
 164                      'note' => $this->T_( 'Check this to display the code toolbar in expert mode' ),
 165                  ),
 166              );
 167      }
 168  
 169  
 170      /**

 171       * Display a toolbar in admin

 172       *

 173       * @param array Associative array of parameters

 174       * @return boolean did we display a toolbar?

 175       */
 176  	function AdminDisplayToolbar( & $params )
 177      {
 178          if( $params['edit_layout'] == 'simple' || !$this->UserSettings->get( 'display_toolbar' )  )
 179          {    // This is too complex for simple mode, or user doesn't want the toolbar, don't display it:
 180              return false;
 181          }
 182  
 183          echo '<div class="edit_toolbar">';
 184          echo T_('Code').': ';
 185          echo '<input type="button" id="codespan" title="'.T_('Insert codespan').'" class="quicktags" onclick="codespan_tag(\'\');" value="'.T_('codespan').'" />';
 186          echo '<input type="button" id="codeblock" title="'.T_('Insert codeblock').'" style="margin-left:8px;" class="quicktags" onclick="codeblock_tag(\'\');" value="'.T_('codeblock').'" />';
 187          echo '<input type="button" id="codeblock_xml" title="'.T_('Insert XML codeblock').'" class="quicktags" onclick="codeblock_tag(\'xml\');" value="'.T_('XML').'" />';
 188          echo '<input type="button" id="codeblock_php" title="'.T_('Insert PHP codeblock').'" class="quicktags" onclick="codeblock_tag(\'php\');" value="'.T_('PHP').'" />';
 189          // yabs > removed until css class is fully functional

 190          //echo '<input type="button" id="codeblock_css" title="'.T_('Insert CSS codeblock').'" class="quicktags" onclick="codeblock_tag(\'css\');" value="'.T_('CSS').'" />';

 191          echo '</div>';
 192  
 193          ?>
 194          <script type="text/javascript">
 195              //<![CDATA[

 196  			function codespan_tag( lang )
 197              {
 198                  tag = '[codespan]';
 199  
 200                  textarea_wrap_selection( b2evoCanvas, tag, '[/codespan]', 0 );
 201              }
 202  			function codeblock_tag( lang )
 203              {
 204                  tag = '[codeblock lang="'+lang+'" line="1"]';
 205  
 206                  textarea_wrap_selection( b2evoCanvas, tag, '[/codeblock]', 0 );
 207              }
 208              //]]>

 209          </script>
 210          <?php
 211  
 212          return true;
 213      }
 214  
 215  
 216    /**

 217     * Filters out the custom tag that would not validate, PLUS escapes the actual code.

 218     *

 219       * @param mixed $params

 220       */
 221  	function FilterItemContents( & $params )
 222      {
 223          $title   = & $params['title'];
 224          $content = & $params['content'];
 225  
 226          // echo 'FILTERING CODE';

 227  
 228          // Note : This regex is different from the original - just in case it gets moved again ;)

 229  
 230          // change all <codeblock> || [codeblock]  segments before format_to_post() gets a hold of them

 231          // 1 - amcode or codeblock

 232          // 2 - attribs : lang &| line

 233          // 3 - code block

 234          $content = preg_replace_callback( '#[<\[](codeblock)([^>\]]*?)[>\]]([\s\S]+?)?[<\[]/\1[>\]]#i',
 235                                  array( $this, 'filter_codeblock_callback' ), $content );
 236  
 237          // Quick and dirty escaping of inline code <codespan> || [codespan]:

 238          $content = preg_replace_callback( '#[<\[]codespan[>\]](.*?)[<\[]/codespan[>\]]#',
 239                                  array( $this, 'filter_codespan_callback' ), $content );
 240  
 241          return true;
 242      }
 243  
 244  
 245      /**

 246       * Format codespan for display

 247       *

 248       * @todo This is a bit quick 'n dirty.

 249       * @todo We might want to unfilter this too.

 250       * @todo We might want to highlight this too (based on a lang attribute).

 251       */
 252  	function filter_codespan_callback( $matches )
 253      {
 254          $code = $matches[1];
 255  
 256          return '<code class="codespan">'.str_replace( array( '&', '<', '>' ), array( '&amp;', '&lt;', '&gt;' ), $code).'</code>';
 257      }
 258  
 259  
 260      /**

 261       * Formats post contents ready for editing

 262       *

 263       * @param mixed $params

 264       */
 265  	function UnfilterItemContents( & $params )
 266      {
 267          $title   = & $params['title'];
 268          $content = & $params['content'];
 269  
 270          // 1 - attribs : lang &| line

 271          // 2 - codeblock

 272          $content = preg_replace_callback( '#\<\!--\s*codeblock([^-]*?)\s*-->\<pre><code>([\s\S]+?)</code>\</pre>\<\!--\s+/codeblock\s*-->#i', array( $this, 'format_to_edit' ), $content );
 273  
 274          return true;
 275      }
 276  
 277  
 278  
 279      /**

 280       * Perform rendering

 281       *

 282       * @see Plugin::RenderItemAsHtml()

 283       */
 284  	function RenderItemAsHtml( & $params )
 285      {
 286          $content = & $params['data'];
 287  
 288          // 2 - attribs : lang &| line

 289          // 4 - codeblock

 290          $content = preg_replace_callback( '#(\<p>)?\<!--\s*codeblock([^-]*?)\s*-->(\</p>)?\<pre><code>([\s\S]+?)</code>\</pre>(\<p>)?\<!--\s*/codeblock\s*-->(\</p>)?#i',
 291                                  array( $this, 'render_codeblock_callback' ), $content );
 292  
 293          return true;
 294      }
 295  
 296      /**

 297       * Perform rendering

 298       *

 299       * @see Plugin::RenderItemAsXml()

 300       *

 301       * Note : Do we actually want to do this? - yabs

 302       */
 303  	function RenderItemAsXml( & $params )
 304      {
 305          $this->RenderItemAsHtml( $params );
 306      }
 307  
 308  
 309      /**

 310       * Tidys up a block of code ready for numbering

 311       *

 312       * @param string $block - the code to be tidied up

 313       * @param string $line_seperator - the seperator between lines of code ( default \n )

 314       * @return string - the tidied code

 315       */
 316  	function tidy_code_output( $block, $line_seperator = "\n" )
 317      {
 318          // lets split the block into individual lines

 319          $code = explode( $line_seperator,
 320              // after removing windows garbage

 321              str_replace( "\r", '', $block ) );
 322  
 323          // time to rock and roll ;)

 324          $still_open = array(); // this holds all the spans that need closing and re-opening on the following code line

 325          for( $i = 0; $i < count( $code ); $i++ )
 326          {
 327              // we need to note all opening spans

 328              $spans =
 329                  // get rid of the first element, it's always empty

 330                  array_slice(
 331                  // split line at each opening span

 332                  explode( '<span class="',
 333                  // add any open spans back in

 334                  implode( '', $still_open )
 335                  .$code[$i] )
 336                  , 1 );
 337  //            pre_dump( $spans );

 338              // reset still_open array

 339              $still_open = array();
 340              // $spans now contains a list of opening spans

 341              for( $z = 0; $z < count( $spans ); $z++ )
 342              {
 343                  // add the span to the still_open array

 344                  $still_open[] = '<span class="'.substr( $spans[$z], 0, strpos( $spans[$z], '"' ) ).'">';
 345  //                pre_dump( $still_open );

 346                  // count all closing spans and remove them from the open spans list

 347                  if( $closed = substr_count( $spans[$z], '</span>' ) )
 348                      $still_open = array_slice( $still_open, 0, $closed * -1 );
 349              }
 350              // lets rebuild the code line and close any remaining spans

 351              $code[$i] = '<span class="'.implode( '<span class="', $spans ).str_repeat( '</span>', count( $still_open ) );
 352          }
 353          // lets stitch it all back together again

 354          $cleaned = implode( "\n", $code );
 355          // and get rid of any empty spans

 356          while( preg_match( '#\<span[^>]+?>\</span>#', $cleaned ) )
 357              $cleaned = preg_replace( '#\<span[^>]+?>\</span>#', '', $cleaned );
 358  //        pre_dump( $cleaned );

 359          // return the cleaned up code

 360          return $cleaned;
 361      }
 362  
 363  
 364      /**

 365       * Formats code ready for the database

 366       *

 367       * @param array $block ( 2 - attributes, 3 - the code )

 368       * @return string formatted code || empty

 369       */
 370  	function filter_codeblock_callback( $block )
 371      { // if code block exists then tidy everything up for the database, otherwise just remove the pointless tag
 372          return ( empty( $block[3] ) ||  !trim( $block[3] ) ? '' : '<!-- codeblock'.$block[2].' --><pre><code>'
 373                          .str_replace( array( '&', '<', '>' ), array( '&amp;', '&lt;', '&gt;' ), $block[3] )
 374                          .'</code></pre><!-- /codeblock -->' );
 375      }
 376  
 377  
 378      /**

 379       * Formats code ready for editing

 380       *

 381       * @param array $block ( 1 - attributes, 2 - the code )

 382       * @return string formatted code

 383       */
 384  	function format_to_edit( $block )
 385      {
 386          return '[codeblock'.$block[1].']'.str_replace( array( '&lt;', '&gt;', '&amp;' ), array( '<', '>', '&' ), $block[2] ).'[/codeblock]';
 387      }
 388  
 389  
 390      /**

 391       * Spits out the styles used

 392       *

 393       * @see Plugin::SkinBeginHtmlHead()

 394       */
 395  	function SkinBeginHtmlHead()
 396      {
 397           echo '<style type="text/css">
 398  /* AstonishMe code plugin styles */

 399  .amc0,.amc1,.amc2,.amc3,.amc4,.amc5,.amc6,
 400  .amc7,.amc8,.amc9 { background:
 401    url('.$this->get_plugin_url().'img/numbers.gif) no-repeat; }
 402  </style>';
 403  
 404          echo '<link rel="stylesheet" type="text/css" href="'.$this->get_plugin_url().'amcode.css" />
 405  <!--[if IE]>
 406  <style type="text/css">
 407  /* IE: make sure the last line is not hidden by a scrollbar */

 408  div.codeblock.amc_short table {
 409      margin-bottom: 2ex;
 410  }
 411  </style>
 412  <![endif]-->';
 413      }
 414  
 415  
 416      /**

 417       * Spits out the styles used

 418       *

 419       * @see Plugin::AdminEndHtmlHead()

 420       */
 421  	function AdminEndHtmlHead()
 422      {
 423          $this->SkinBeginHtmlHead();
 424      }
 425  
 426  
 427      /**

 428       * Formats code ready for displaying

 429       * With "SwipeFriendly" line numbers

 430       *

 431       * @todo fp> no table should be needed. Also since we have odd/even coloring, word wrapping may be ok.

 432       * yabs > unfortunately the tables are required to make the odd/even colouring and swipeable numbers work :(

 433       *

 434       * an example :

 435       * Danny uploaded a page to demo his colours of choice ( http://brendoman.com/dev/youtube.html )

 436       * if you scroll down to RenderItemAsHtml() you'll see it has 4 problems

 437       * 1) some lines wrap - but they wrap underneath the line number

 438       * 2) some lines don't wrap so they force a browser scrollbar

 439       *   ( although a scrollable div will cure this)

 440       * 3) the lines that don't wrap lose their background colour once they become longer than the browser width

 441       *   ( a scrollable div has the same problem )

 442       * 4) If you try and copy/paste the code you also get the line numbers

 443       *   ( like every other code formatter that we've seen on the web that uses line numbers ... which is why most don't ;) )

 444       *

 445       * compare that to the same section of code using this plugin ( http://cvs.astonishme.co.uk/index.php/2007/04/01/a_demo )

 446       *

 447       * fp> almost all that can be fixed with proper CSS and will have the advantage of not adding extra space in front of the lines when copy/pasting. I'll work on it when I have time.

 448       *

 449       * yabs> The operative word in that sentance is "almost" ;) ... I've removed the trailing spaces for all but empty lines ( required to "prop them open" ) ... I'd forgotten all about them :p

 450       *

 451       * @param string the code block to be wrapped up

 452       * @param string the attributes - currently only the starting line number

 453       * @param string the code type ( code || php )

 454       *

 455       * @return string formatted code

 456       */
 457  	function do_numbering( $code, $offset = 0, $type = 'code' )
 458      {
 459          $temp = str_replace( array( '&nbsp;&nbsp;', '  ', "\t", '[x', '[/x' ),  array( '&#160;&#160;', '&#160;&#160;', '&#160;&#160;', '[', '[/' ), $code );
 460          $temp = explode( "\n", $temp );
 461          $count = 0;
 462          $output = '';
 463          $odd_line = false;
 464          foreach( $temp as $line )
 465          {
 466              $output .= '<tr class="amc_code_'.( ( $odd_line = !$odd_line ) ? 'odd' : 'even' ).'"><td class="amc_line">'
 467                                      .$this->create_number( ++$count + $offset ).'</td><td><code>'.$line
 468                                      // add an &nbsp; to empty lines to stop them "collapsing"

 469                                      .( empty( $line ) ? '&nbsp;' : '' )
 470                                      .'</code></td></tr>'."\n";
 471          }
 472          // make "long" value a setting ? - yabs

 473          return '<p class="amcode">'.$this->languageCache[ $type ]->language_title.':</p><div class="codeblock amc_'.$type.' '.( $count < 26 ? 'amc_short' : 'amc_long' ).'"><table>'.$output.'</table></div>';
 474      }
 475  
 476  
 477      /**

 478       * Creates the SwipeFriendly line numbers

 479       *

 480       * @param integer the line number to produce

 481       * @return string the html for the line number

 482       */
 483  	function create_number( $num )
 484      {    // part of Swipe 'n' Paste magic ;)
 485          $result = '';
 486          $count = 0;
 487          while ( $num )
 488          {
 489              $result .= '<div class="amc'.( $num - ( floor( $num / 10 ) * 10 ) ).'">';
 490              $num = floor( $num / 10 );
 491              $count++;
 492          }
 493          $result .= str_repeat( '</div>', $count );
 494          return $result;
 495      }
 496  
 497  
 498      /**

 499       * Upgrade stuff for old style code posts

 500       *

 501       * @see Plugin::PluginVersionChanged()

 502       */
 503  	function PluginVersionChanged()
 504      {
 505          global $DB, $ItemCache;
 506          // find any posts with the previous versions tags

 507          $sql = 'select post_id
 508                              from T_items__item
 509                           where post_content like \'%<amcode><pre>%\'';
 510          $posts = $DB->get_results( $sql );
 511          foreach( $posts as $post )
 512          {    // loop through each post and upgrade them to the new versions tags and way of doing things
 513              $Item = & $ItemCache->get_by_ID( $post->post_id );
 514              $Item->set( 'content', str_replace( array( '<amcode><pre><code>', '</code></pre></amcode>', '[lt]', '[gt]', '[sq]', '[amp]' ),
 515                                      array( '<!-- codeblock --><pre><code>', '</code></pre><!-- /codeblock -->', '&lt;', '&gt;', "'", '&amp;' ), $Item->content ) );
 516              $Item->dbupdate();
 517          }
 518          return true;    // all done

 519      }
 520  
 521  
 522      /**

 523       * Formats codeblock ready for displaying

 524       * Each language is stored as a classfile

 525       * This would allow new languages to be added more easily

 526       * It would also allow Geshi to be used as the highlighter with no code changes ;)

 527       *

 528       * Replaces both (current) highlighter functions

 529       *

 530       * ..... still requires some more thought though :p

 531       *

 532       * @param array $block ( 2 - attributes, 4 - the code )

 533       * @return string formatted code

 534       */
 535  	function render_codeblock_callback( $block )
 536      {
 537          // set the offset if present - default : 0

 538          preg_match( '#line=("|\')([0-9]+?)\1#', $block[2], $match );
 539          $offset = ( empty( $match[2] ) ? 0 : $match[2] - 1 );
 540  
 541          // set the language if present - default : code

 542          preg_match( '#lang=("|\')([^\1]+?)\1#', $block[2], $match );
 543          $language = strtolower( ( empty( $match[2] ) ? 'code' : $match[2] ) );
 544  
 545          if( $code = trim( $block[4] ) )
 546          {    // we have a code block
 547              // is the relevant language highlighter already cached?

 548              if( empty( $this->languageCache[ $language ] ) )
 549              {    // lets attempt to load the language
 550                  $language_file = dirname(__FILE__).'/highlighters/'.$language.'.highlighter.php';
 551                  if( is_file( $language_file ) )
 552                  { // language class exists, lets load and cache an instance of it
 553                      require_once $language_file;
 554                      $class = 'am_'.$language.'_highlighter';
 555                      $this->languageCache[ $language ] = & new $class( $this );
 556                  }
 557                  else
 558                  {    // language class doesn't exists, fallback to default highlighter
 559                      $language = 'code';
 560                      if( empty( $this->languageCache[ $language ] ) )
 561                      {    // lets attempt to load the default language
 562                          $language_file = dirname(__FILE__).'/highlighters/'.$language.'.highlighter.php';
 563                          if( is_file( $language_file ) )
 564                          { // default lanugage exists
 565                              require_once $language_file;
 566                              $class = 'am_'.$language.'_highlighter';
 567                              // add the language to the cache

 568                              $this->languageCache[ $language ] = & new $class( $this );
 569                          }
 570                          else
 571                          { // if we hit this we might as well go to the pub ;)
 572                              // echo '***** error ***** no language or default language file is present';

 573                              return $code;
 574                          }
 575                      }
 576                  }
 577              }
 578              $this->languageCache[ $language ]->requested_language = $language;
 579              $this->languageCache[ $language ]->strict_mode = $this->Settings->get( 'strict' );
 580              $code = $this->languageCache[ $language ]->highlight_code( $code );
 581              // add the line numbers

 582              $code = $this->do_numbering( $code, $offset, $language );
 583          }
 584          return $code;
 585      }
 586  
 587  }
 588  
 589  /**

 590   * $Log: _code_highlight.plugin.php,v $

 591   * Revision 1.10  2007/07/09 19:07:44  fplanque

 592   * minor

 593   *

 594   * Revision 1.9  2007/07/05 07:59:34  yabs

 595   * added user setting for display toolbar on EdB's suggestion :

 596   * http://edb.evoblog.com/blogstuff/thoughts-while-i-clear-my-head

 597   *

 598   * Revision 1.8  2007/07/03 10:45:00  yabs

 599   * changed <codeblock/span> to [codeblock/span]

 600   *

 601   * Revision 1.7  2007/07/01 03:59:49  fplanque

 602   * rollback until clean implementation

 603   *

 604   * Revision 1.5  2007/06/26 02:40:53  fplanque

 605   * security checks

 606   *

 607   * Revision 1.4  2007/06/17 13:28:22  blueyed

 608   * Fixed doc

 609   *

 610   * Revision 1.3  2007/05/14 02:43:06  fplanque

 611   * Started renaming tables. There probably won't be a better time than 2.0.

 612   *

 613   * Revision 1.2  2007/05/04 20:43:08  fplanque

 614   * MFB

 615   *

 616   * Revision 1.1.2.4  2007/05/01 09:09:58  yabs

 617   * removed css toolbar button

 618   *

 619   * Revision 1.1.2.3  2007/04/23 11:59:11  yabs

 620   * removed old code

 621   * pass $this to language classes

 622   *

 623   * Revision 1.1.2.2  2007/04/20 02:50:14  fplanque

 624   * code highlight plugin aka AM code plugin

 625   *

 626   * Revision 1.1.2.15  2007/04/18 23:37:59  fplanque

 627   * removed old code

 628   *

 629   * Revision 1.1.2.14  2007/04/18 22:53:23  fplanque

 630   * minor

 631   *

 632   * Revision 1.1.2.13  2007/04/08 14:35:59  yabs

 633   * Minor bugfixes

 634   * Minor doc changes

 635   * Amended PluginVersionChanged() to the new <!-- codeblock --> tags

 636   * Added in an experimental highlighter utilising classes per language

 637   *

 638   * Revision 1.1.2.12  2007/04/07 22:20:24  fplanque

 639   * codespan + changed method names

 640   *

 641   * Revision 1.1.2.11  2007/04/07 15:38:15  fplanque

 642   * "codeblock"

 643   *

 644   * Revision 1.1.2.10  2007/04/07 07:26:36  yabs

 645   * Minor changes to classnames

 646   * Minor changes to docs

 647   * Added target="_blank" ++ setting for xhtml strict

 648   * Moved code tidying to a seperate function so it can be reused if we add more languages

 649   * Renamed highlighting functions to be more descriptive

 650   * Removed trailing space from do_numbering()

 651   * Probably added a few notes as well :p

 652   *

 653   * Revision 1.1.2.9  2007/04/05 22:43:00  fplanque

 654   * Added hook: UnfilterItemContents

 655   *

 656   * Revision 1.1.2.7  2007/04/01 13:36:26  yabs

 657   * rewritten the php syntax highlighter .... hopefully this one will work in all php version ;)

 658   *

 659   * Revision 1.1.2.6  2007/04/01 10:00:55  yabs

 660   * made some minor changes to the doc

 661   * made a few minor code changes ( line="99" etc )

 662   * added in styles for admin area

 663   * added in <code><php> tags

 664   * added a fair few comments

 665   *

 666   * Revision 1.1.2.5  2007/03/31 22:42:44  fplanque

 667   * FilterItemContent event

 668   *

 669   * Revision 1.1.2.4  2007/03/31 18:03:51  fplanque

 670   * doc / todos (not necessarily short term)

 671   *

 672   * Revision 1.1.2.3  2007/03/31 09:57:48  yabs

 673   * minor php5 corrections

 674   * removed highlighting bug ( would replace all occurences of colours with classnames )

 675   *

 676   * Revision 1.1.2.2  2007/03/31 09:07:16  yabs

 677   * Correcting highlighting for php5

 678   *

 679   * Revision 1.1.2.1  2007/03/31 07:22:28  yabs

 680   * Added to cvs

 681   *

 682   *

 683   */
 684  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics