mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
Merge branch 'wip-mdl-28101' of git://github.com/rajeshtaneja/moodle
This commit is contained in:
commit
aad69d8b1a
@ -38,26 +38,26 @@ function wiki_print_editor_wiki($pageid, $content, $editor, $version = -1, $sect
|
||||
}
|
||||
|
||||
///Get tags for every element we are displaying
|
||||
$tag = wiki_parser_get_token($editor, 'bold');
|
||||
$tag = getTokens($editor, 'bold');
|
||||
$wiki_editor['bold'] = array('ed_bold.gif', get_string('wikiboldtext', 'wiki'), $tag[0], $tag[1], get_string('wikiboldtext', 'wiki'));
|
||||
$tag = wiki_parser_get_token($editor, 'italic');
|
||||
$tag = getTokens($editor, 'italic');
|
||||
$wiki_editor['italic'] = array('ed_italic.gif', get_string('wikiitalictext', 'wiki'), $tag[0], $tag[1], get_string('wikiitalictext', 'wiki'));
|
||||
$tag = wiki_parser_get_token($editor, 'link');
|
||||
$tag = getTokens($editor, 'link');
|
||||
$wiki_editor['internal'] = array('ed_internal.gif', get_string('wikiinternalurl', 'wiki'), $tag[0], $tag[1], get_string('wikiinternalurl', 'wiki'));
|
||||
$tag = wiki_parser_get_token($editor, 'url');
|
||||
$tag = getTokens($editor, 'url');
|
||||
$wiki_editor['external'] = array('ed_external.gif', get_string('wikiexternalurl', 'wiki'), $tag[0], $tag[1], get_string('wikiexternalurl', 'wiki'));
|
||||
$tag = wiki_parser_get_token($editor, 'list');
|
||||
$tag = getTokens($editor, 'list');
|
||||
$wiki_editor['u_list'] = array('ed_ul.gif', get_string('wikiunorderedlist', 'wiki'), '\\n' . $tag[0], '', '');
|
||||
$wiki_editor['o_list'] = array('ed_ol.gif', get_string('wikiorderedlist', 'wiki'), '\\n' . $tag[1], '', '');
|
||||
$tag = wiki_parser_get_token($editor, 'image');
|
||||
$tag = getTokens($editor, 'image');
|
||||
$wiki_editor['image'] = array('ed_img.gif', get_string('wikiimage', 'wiki'), $tag[0], $tag[1], get_string('wikiimage', 'wiki'));
|
||||
$tag = wiki_parser_get_token($editor, 'header');
|
||||
$tag = getTokens($editor, 'header');
|
||||
$wiki_editor['h1'] = array('ed_h1.gif', get_string('wikiheader', 'wiki', 1), '\\n' . $tag . ' ', ' ' . $tag . '\\n', get_string('wikiheader', 'wiki', 1));
|
||||
$wiki_editor['h2'] = array('ed_h2.gif', get_string('wikiheader', 'wiki', 2), '\\n' . $tag . $tag . ' ', ' ' . $tag . $tag . '\\n', get_string('wikiheader', 'wiki', 2));
|
||||
$wiki_editor['h3'] = array('ed_h3.gif', get_string('wikiheader', 'wiki', 3), '\\n' . $tag . $tag . $tag . ' ', ' ' . $tag . $tag . $tag . '\\n', get_string('wikiheader', 'wiki', 3));
|
||||
$tag = wiki_parser_get_token($editor, 'line_break');
|
||||
$tag = getTokens($editor, 'line_break');
|
||||
$wiki_editor['hr'] = array('ed_hr.gif', get_string('wikihr', 'wiki'), '\\n' . $tag . '\\n', '', '');
|
||||
$tag = wiki_parser_get_token($editor, 'nowiki');
|
||||
$tag = getTokens($editor, 'nowiki');
|
||||
$wiki_editor['nowiki'] = array('ed_nowiki.gif', get_string('wikinowikitext', 'wiki'), $tag[0], $tag[1], get_string('wikinowikitext', 'wiki'));
|
||||
|
||||
$OUTPUT->heading(strtoupper(get_string('format' . $editor, 'wiki')));
|
||||
@ -82,3 +82,24 @@ function wiki_print_editor_wiki($pageid, $content, $editor, $version = -1, $sect
|
||||
echo '</form>';
|
||||
echo $OUTPUT->container_end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns escaped token used by a wiki language to represent a given tag or "object" (bold -> **)
|
||||
*
|
||||
* @param string $format format of page
|
||||
* @param array|string $token format tokens which needs to be escaped
|
||||
* @return array|string
|
||||
*/
|
||||
function getTokens($format, $token) {
|
||||
$tokens = wiki_parser_get_token($format, $token);
|
||||
|
||||
if (is_array($tokens)) {
|
||||
foreach ($tokens as $key => $value) {
|
||||
$tokens[$key] = urlencode(str_replace("'", "\'", $value));
|
||||
}
|
||||
} else {
|
||||
urlencode(str_replace("'", "\'", $token));
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user