$sub = !empty($releaseinfo[2]) ? $releaseinfo[2] : 0;
        $plus = false;
        if (preg_match("/\\+\$/", $sub)) {
            $plus = true;
            $sub = preg_replace("/([^0-9])/", "", $sub);
            $sub = intval($sub);
            if ($plus) {
                $sub += 0.1;
            }
        }
        $release = floatval($major . $minor . $sub);
        if ($release > 153) {
            echo "\nvar config = new HTMLArea.Config();\n";
            print_editor_config();
        } else {
            print_editor_config();
        }
        ?>
// Register our custom buttons
config.registerButton("imagebank",  "<?php 
        print_string("imagebank", "netpublish");
        ?>
", "ed_image.gif", false, __insert_image);
config.toolbar.push(["imagebank"]);
HTMLArea.replaceAll(config);

//]]>
</script>
        <?php 
    }
    print_footer($course);
Пример #2
0
/**
 * Sets up the HTML editor on textareas in the current page.
 * If a field name is provided, then it will only be
 * applied to that field - otherwise it will be used
 * on every textarea in the page.
 *
 * In most cases no arguments need to be supplied
 *
 * @param string $name Form element to replace with HTMl editor by name
 */
function use_html_editor($name = '', $editorhidebuttons = '', $id = '')
{
    global $THEME;
    $editor = 'editor_' . md5($name);
    //name might contain illegal characters
    if ($id === '') {
        $id = 'edit-' . $name;
    }
    echo "\n" . '<script type="text/javascript" defer="defer">' . "\n";
    echo '//<![CDATA[' . "\n\n";
    // Extra \n is to fix odd wiki problem, MDL-8185
    echo "{$editor} = new HTMLArea('{$id}');\n";
    echo "var config = {$editor}.config;\n";
    echo print_editor_config($editorhidebuttons);
    if (empty($THEME->htmleditorpostprocess)) {
        if (empty($name)) {
            echo "\nHTMLArea.replaceAll({$editor}.config);\n";
        } else {
            echo "\n{$editor}.generate();\n";
        }
    } else {
        if (empty($name)) {
            echo "\nvar HTML_name = '';";
        } else {
            echo "\nvar HTML_name = \"{$name};\"";
        }
        echo "\nvar HTML_editor = {$editor};";
    }
    echo '//]]>' . "\n";
    echo '</script>' . "\n";
}
Пример #3
0
/**
 * Sets up the HTML editor on textareas in the current page.
 * If a field name is provided, then it will only be
 * applied to that field - otherwise it will be used
 * on every textarea in the page.
 *
 * In most cases no arguments need to be supplied
 *
 * @param string $name Form element to replace with HTMl editor by name
 */
function use_html_editor($name = '', $editorhidebuttons = '')
{
    echo '<script language="javascript" type="text/javascript" defer="defer">' . "\n";
    print_editor_config($editorhidebuttons);
    if (empty($name)) {
        echo "\n" . 'HTMLArea.replaceAll(config);' . "\n";
    } else {
        echo "\nHTMLArea.replace('edit-{$name}', config);\n";
    }
    echo '</script>' . "\n";
}