Subversion Repositories pub

Compare Revisions

No changes between revisions

Ignore whitespace Rev 109 → Rev 110

/wp-js-syntax-highlighter/branches/0.4.2+3.0.83/plugin.php
0,0 → 1,42
<?php
 
/*
* Plugin Name: JS Syntax Highlighter
* Plugin URI: http://p.outlyer.net./wordpress/
* Feed URI:
* Description: Adds automatic syntax highlighting of code from JavaScript. Using Alex Gorbatchev's SyntaxHighlighter code. It requires jQuery to work properly, which will be loaded from javascript if not present. It tries to make it less intrusive and allow for valid XHTML. See js/loader.full.js for details.
* Version: 0.4.1+3.0.83
* Author: Toni Corvera
* Author URI: http://corvera.eu./
*/ // $Id$
 
class syntax_highlighter_plugin {
function header() {
$base_path = self::r('');
$loader = self::r('/loader.js');
if (!is_file($loader)) {
$loader = self::r('/loader.full.js');
}
// Everything is loaded dinamically
echo <<<EOF
<!--BEG js-sh-p-->
<script type="text/javascript" src="{$loader}"></script>
<script type="text/javascript">shLoader.init({path:'{$base_path}'});</script>
<!--END js-sh-p-->\n
EOF
;
}
 
/** Resolve file URL */
function r($file) {
// Try to use '/PATH' instead of 'http://SERVER/PATH'
$s = "http://{$_SERVER['HTTP_HOST']}";
// http://codex.wordpress.org/Function_Reference/plugins_url [since WP 2.6.0]
return preg_replace("|$s|", '', plugins_url($file,__FILE__));
}
}
 
add_action('wp_head', array('syntax_highlighter_plugin', 'header'));
 
 
/* vim:set ts=4 et ai: */ ?>
Property changes:
Added: svn:keywords
+Rev Id Date
\ No newline at end of property