Note: You are currently viewing documentation for Moodle 3.11. Up-to-date documentation for the latest stable version of Moodle may be available here: PHP.

PHP

From MoodleDocs
Revision as of 02:35, 21 May 2006 by K. Dicky (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<?php if (!function_exists('geshi_highlight')) { /**

    * Easy way to highlight stuff. Behaves just like highlight_string
    * 
    * @param string The code to highlight
    * @param string The language to highlight the code in
    * @param string The path to the language files. You can leave this blank if you need
    *               as from version 1.0.7 the path should be automatically detected
    * @param boolean Whether to return the result or to echo
    * @return string The code highlighted (if $return is true)
    * @since 1.0.2
    */

function geshi_highlight ($string, $language, $path, $return = false) { $geshi = new GeSHi($string, $language, $path); $geshi->set_header_type(GESHI_HEADER_NONE); if ($return) { return '' . $geshi->parse_code() . ''; } echo '' . $geshi->parse_code() . ''; if ($geshi->error()) { return false; } return true; } }

?>