AnsPress_Syntax_Highlighter::scripts()
Description #
Register scripts and styles.
Source #
File: addons/free/syntaxhighlighter.php
public static function scripts() {
$js_url = ANSPRESS_URL . '/assets/syntaxhighlighter/scripts/';
$css_url = ANSPRESS_URL . '/assets/syntaxhighlighter/styles/';
$scripts = array(
'brush-bash' => 'shBrushBash.js',
'brush-coldfusion' => 'shBrushColdFusion.js',
'brush-cpp' => 'shBrushCpp.js',
'brush-csharp' => 'shBrushCSharp.js',
'brush-css' => 'shBrushCss.js',
'brush-delphi' => 'shBrushDelphi.js',
'brush-diff' => 'shBrushDiff.js',
'brush-groovy' => 'shBrushGroovy.js',
'brush-java' => 'shBrushJava.js',
'brush-javafx' => 'shBrushJavaFX.js',
'brush-jscript' => 'shBrushJScript.js',
'brush-perl' => 'shBrushPerl.js',
'brush-perl' => 'shBrushPerl.js',
'brush-php' => 'shBrushPhp.js',
'brush-plain' => 'shBrushPlain.js',
'brush-powershell' => 'shBrushPowerShell.js',
'brush-python' => 'shBrushPython.js',
'brush-ruby' => 'shBrushRuby.js',
'brush-scala' => 'shBrushScala.js',
'brush-sql' => 'shBrushSql.js',
'brush-vb' => 'shBrushVb.js',
'brush-xml' => 'shBrushXml.js',
'brush-clojure' => 'shBrushClojure.js',
'brush-fsharp' => 'shBrushFSharp.js',
'brush-latex' => 'shBrushLatex.js',
'brush-matlabkey' => 'shBrushMatlabKey.js',
'brush-objc' => 'shBrushObjC.js',
'brush-r' => 'shBrushR.js',
);
echo '<script type="text/javascript">AP_Brushes = ' . wp_json_encode( self::$brushes ) . ';</script>';
wp_register_script( 'syntaxhighlighter-core', $js_url . 'shCore.js', [], AP_VERSION );
foreach ( $scripts as $key => $script ) {
wp_register_script( 'syntaxhighlighter-' . $key, $js_url . $script, [ 'syntaxhighlighter-core' ], AP_VERSION );
}
// Register theme stylesheets.
wp_register_style( 'syntaxhighlighter-core', $css_url . 'shCore.css', [], AP_VERSION );
wp_register_style( 'syntaxhighlighter-theme-default', $css_url . 'shThemeDefault.css', [ 'syntaxhighlighter-core' ], AP_VERSION );
}
Expand full source code Collapse full source code View on GitHub: addons/free/syntaxhighlighter.php:51
Add your comment