[ 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 (sommaire)

This file implements the AstonishMe Code plugin. This file is part of the b2evolution project - {@link http://b2evolution.net/}

Author: Yabba: Paul Jones - {@link http://astonishme.co.uk/}
Author: Stk: Scott Kimler - {@link http://astonishme.co.uk/}
Copyright: (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}
Version: $Id: _code_highlight.plugin.php,v 1.10 2007/07/09 19:07:44 fplanque Exp $
Poids: 684 lignes (24 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

code_highlight_plugin:: (20 méthodes):
  PluginInit()
  GetDefaultSettings()
  GetDefaultUserSettings()
  AdminDisplayToolbar()
  codespan_tag()
  codeblock_tag()
  FilterItemContents()
  filter_codespan_callback()
  UnfilterItemContents()
  RenderItemAsHtml()
  RenderItemAsXml()
  tidy_code_output()
  filter_codeblock_callback()
  format_to_edit()
  SkinBeginHtmlHead()
  AdminEndHtmlHead()
  do_numbering()
  create_number()
  PluginVersionChanged()
  render_codeblock_callback()


Classe: code_highlight_plugin  - X-Ref


PluginInit( & $params )   X-Ref
Init


GetDefaultSettings( & $params )   X-Ref
Get the settings that the plugin can use.

Those settings are transfered into a Settings member object of the plugin
and can be edited in the backoffice (Settings / Plugins).

return: array

GetDefaultUserSettings()   X-Ref
Allowing the user to override the display of the toolbar.

return: array

AdminDisplayToolbar( & $params )   X-Ref
Display a toolbar in admin

param: array Associative array of parameters
return: boolean did we display a toolbar?

codespan_tag( lang )   X-Ref
Pas de description

codeblock_tag( lang )   X-Ref
Pas de description

FilterItemContents( & $params )   X-Ref
Filters out the custom tag that would not validate, PLUS escapes the actual code.

param: mixed $params

filter_codespan_callback( $matches )   X-Ref
Format codespan for display


UnfilterItemContents( & $params )   X-Ref
Formats post contents ready for editing

param: mixed $params

RenderItemAsHtml( & $params )   X-Ref
Perform rendering


RenderItemAsXml( & $params )   X-Ref
Perform rendering


tidy_code_output( $block, $line_seperator = "\n" )   X-Ref
Tidys up a block of code ready for numbering

param: string $block - the code to be tidied up
param: string $line_seperator - the seperator between lines of code ( default \n )
return: string - the tidied code

filter_codeblock_callback( $block )   X-Ref
Formats code ready for the database

param: array $block ( 2 - attributes, 3 - the code )
return: string formatted code || empty

format_to_edit( $block )   X-Ref
Formats code ready for editing

param: array $block ( 1 - attributes, 2 - the code )
return: string formatted code

SkinBeginHtmlHead()   X-Ref
Spits out the styles used


AdminEndHtmlHead()   X-Ref
Spits out the styles used


do_numbering( $code, $offset = 0, $type = 'code' )   X-Ref
Formats code ready for displaying
With "SwipeFriendly" line numbers

param: string the code block to be wrapped up
param: string the attributes - currently only the starting line number
param: string the code type ( code || php )
return: string formatted code

create_number( $num )   X-Ref
Creates the SwipeFriendly line numbers

param: integer the line number to produce
return: string the html for the line number

PluginVersionChanged()   X-Ref
Upgrade stuff for old style code posts


render_codeblock_callback( $block )   X-Ref
Formats codeblock ready for displaying
Each language is stored as a classfile
This would allow new languages to be added more easily
It would also allow Geshi to be used as the highlighter with no code changes ;)

Replaces both (current) highlighter functions

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

param: array $block ( 2 - attributes, 4 - the code )
return: string formatted code



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