Blame
Date:
Fri Apr 1 04:00:22 2022 UTC
Message:
Daily backup
01
2021-12-17
jrmu
<?php if (!defined('PmWiki')) exit();
02
2021-12-17
jrmu
/* Copyright 2004-2019 Patrick R. Michaud (pmichaud@pobox.com)
03
2021-12-17
jrmu
This file is part of PmWiki; you can redistribute it and/or modify
04
2021-12-17
jrmu
it under the terms of the GNU General Public License as published
05
2021-12-17
jrmu
by the Free Software Foundation; either version 2 of the License, or
06
2021-12-17
jrmu
(at your option) any later version. See pmwiki.php for full details.
07
2021-12-17
jrmu
08
2021-12-17
jrmu
This script adds a graphical button bar to the edit page form.
09
2021-12-17
jrmu
The buttons are placed in the $GUIButtons array; each button
10
2021-12-17
jrmu
is specified by an array of five values:
11
2021-12-17
jrmu
- the position of the button relative to others (a number)
12
2021-12-17
jrmu
- the opening markup sequence
13
2021-12-17
jrmu
- the closing markup sequence
14
2021-12-17
jrmu
- the default text if none was highlighted
15
2021-12-17
jrmu
- the text of the button, either (a) HTML markup or (b) the
16
2021-12-17
jrmu
url of a gif/jpg/png image to be used for the button
17
2021-12-17
jrmu
(along with optional "title" text in quotes).
18
2021-12-17
jrmu
19
2021-12-17
jrmu
The buttons specified in this file are the default buttons
20
2021-12-17
jrmu
for the standard markups. Some buttons (e.g., the attach/upload
21
2021-12-17
jrmu
button) are specified in their respective cookbook module.
22
2021-12-17
jrmu
23
2021-12-17
jrmu
Script maintained by Petko YOTOV www.pmwiki.org/petko
24
2021-12-17
jrmu
*/
25
2021-12-17
jrmu
26
2021-12-17
jrmu
SDVA($HTMLHeaderFmt, array('guiedit' => "<script type='text/javascript'
27
2021-12-17
jrmu
src='\$FarmPubDirUrl/guiedit/guiedit.js'></script>\n"));
28
2021-12-17
jrmu
29
2021-12-17
jrmu
SDV($GUIButtonDirUrlFmt,'$FarmPubDirUrl/guiedit');
30
2021-12-17
jrmu
31
2021-12-17
jrmu
if(IsEnabled($EnableGUIButtons,0)) {
32
2021-12-17
jrmu
SDVA($GUIButtons, array(
33
2021-12-17
jrmu
'em' => array(100, "''", "''", '$[Emphasized]',
34
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/em.gif"$[Emphasized (italic)]"',
35
2021-12-17
jrmu
'$[ak_em]'),
36
2021-12-17
jrmu
'strong' => array(110, "'''", "'''", '$[Strong]',
37
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/strong.gif"$[Strong (bold)]"',
38
2021-12-17
jrmu
'$[ak_strong]'),
39
2021-12-17
jrmu
'pagelink' => array(200, '[[', ']]', '$[Page link]',
40
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/pagelink.gif"$[Link to internal page]"'),
41
2021-12-17
jrmu
'extlink' => array(210, '[[', ']]', 'http:// | $[link text]',
42
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/extlink.gif"$[Link to external page]"'),
43
2021-12-17
jrmu
'big' => array(300, "'+", "+'", '$[Big text]',
44
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/big.gif"$[Big text]"'),
45
2021-12-17
jrmu
'small' => array(310, "'-", "-'", '$[Small text]',
46
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/small.gif"$[Small text]"'),
47
2021-12-17
jrmu
'sup' => array(320, "'^", "^'", '$[Superscript]',
48
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/sup.gif"$[Superscript]"'),
49
2021-12-17
jrmu
'sub' => array(330, "'_", "_'", '$[Subscript]',
50
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/sub.gif"$[Subscript]"'),
51
2021-12-17
jrmu
'h2' => array(400, '\\n!! ', '\\n', '$[Heading]',
52
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/h.gif"$[Heading]"'),
53
2021-12-17
jrmu
'center' => array(410, '%center%', '', '',
54
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/center.gif"$[Center]"')));
55
2021-12-17
jrmu
56
2021-12-17
jrmu
if(IsEnabled($EnableGuiEditFixUrl)) {
57
2021-12-17
jrmu
$GUIButtons['fixurl'] = array($EnableGuiEditFixUrl, 'FixSelectedURL', '', '',
58
2021-12-17
jrmu
'$GUIButtonDirUrlFmt/fixurl.png"$[Encode special characters in URL link addresses]"');
59
2021-12-17
jrmu
}
60
2021-12-17
jrmu
61
2021-12-17
jrmu
Markup('e_guibuttons', 'directives',
62
2021-12-17
jrmu
'/\\(:e_guibuttons:\\)/', 'GUIButtonCode');
63
2021-12-17
jrmu
}
64
2021-12-17
jrmu
65
2021-12-17
jrmu
function cb_gbcompare($a, $b) {return $a[0]-$b[0];}
66
2021-12-17
jrmu
function GUIButtonCode() {
67
2021-12-17
jrmu
global $GUIButtons;
68
2021-12-17
jrmu
extract($GLOBALS["MarkupToHTML"]); # get $pagename
69
2021-12-17
jrmu
70
2021-12-17
jrmu
usort($GUIButtons, 'cb_gbcompare');
71
2021-12-17
jrmu
72
2021-12-17
jrmu
$out = "<script type='text/javascript'><!--\n";
73
2021-12-17
jrmu
foreach ($GUIButtons as $k => $g) {
74
2021-12-17
jrmu
if (!$g) continue;
75
2021-12-17
jrmu
@list($when, $mopen, $mclose, $mtext, $tag, $mkey) = $g;
76
2021-12-17
jrmu
if (@$ta[0] == '<') {
77
2021-12-17
jrmu
$out .= "document.write(\"$tag\");\n";
78
2021-12-17
jrmu
continue;
79
2021-12-17
jrmu
}
80
2021-12-17
jrmu
if (preg_match('/^(.*\\.(gif|jpg|png))("([^"]+)")?$/', $tag, $m)) {
81
2021-12-17
jrmu
$title = (@$m[4] > '') ? "title='{$m[4]}'" : '';
82
2021-12-17
jrmu
$tag = "<img src='{$m[1]}' $title style='border:0px;' />";
83
2021-12-17
jrmu
}
84
2021-12-17
jrmu
$mopen = str_replace(array('\\', "'"), array('\\\\', "\\\\'"), $mopen);
85
2021-12-17
jrmu
$mclose = str_replace(array('\\', "'"), array('\\\\', "\\\\'"), $mclose);
86
2021-12-17
jrmu
$mtext = str_replace(array('\\', "'"), array('\\\\', "\\\\'"), $mtext);
87
2021-12-17
jrmu
$out .=
88
2021-12-17
jrmu
"insButton(\"$mopen\", \"$mclose\", '$mtext', \"$tag\", \"$mkey\");\n";
89
2021-12-17
jrmu
}
90
2021-12-17
jrmu
$out .= '//--></script>';
91
2021-12-17
jrmu
return Keep(FmtPageName($out, $pagename));
92
2021-12-17
jrmu
}
93
2021-12-17
jrmu
94
2021-12-17
jrmu
95
2021-12-17
jrmu
IRCNow