Subversion Repositories pub

Compare Revisions

No changes between revisions

Ignore whitespace Rev 99 → Rev 102

/wp-js-syntax-highlighter/branches/0.4.0+3.0.83/plugin.php
4,25 → 4,39
* 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. It tries to make it less intrusive and allow for valid XHTML. See loader.js for details.
* Version: 0.3.0+1.5.1
* 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.0+3.0.83
* Author: Toni Corvera
* Author URI: http://outlyer.net./
*/
* Author URI: http://corvera.eu./
*/ // $Id$
 
function syntax_highlighter_header() {
$base_path = get_settings('siteurl').'/wp-content/plugins/js-syntax-highlighter';
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
;
}
 
echo '<!-- JS Syntax Highlighter Plugin -->'."\n".
// Dinamically loaded:
// '<link type="text/css" rel="stylesheet" href="'.$base_path.'/SyntaxHighlighter.css" />'."\n".
'<script type="text/javascript" src="'.$base_path.'/js/shCore.js"></script>'."\n".
'<script type="text/javascript" src="'.$base_path.'/js/loader.js"></script>'."\n".
'<script type="text/javascript">dpLoader.init("'.$base_path.'");</script>'."\n".
'<!--/JS Syntax Highlighter Plugin -->'."\n";
/** 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', 'syntax_highlighter_header');
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