本文整理匯總了PHP中Markup函數的典型用法代碼示例。如果您正苦於以下問題:PHP Markup函數的具體用法?PHP Markup怎麽用?PHP Markup使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Markup函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: TaggerSetup
function TaggerSetup()
{
global $TaggerGroups;
global $FmtPV;
if ($TaggerGroups) {
foreach ($TaggerGroups as $tagname => $catgroup) {
$FmtPV['$' . $tagname . 'Linked'] = "TaggerLinksVar(\$pn, '{$tagname}', '{$catgroup}', 'LinkedTitle')";
$FmtPV['$' . $tagname . 'LinkedName'] = "TaggerLinksVar(\$pn, '{$tagname}', '{$catgroup}', 'LinkedName')";
$FmtPV['$' . $tagname . 'Name'] = "TaggerLinksVar(\$pn, '{$tagname}', '{$catgroup}', 'Name')";
}
// markup to insert the links
$tags = array_keys($TaggerGroups);
$tagpat = implode('|', $tags);
if (function_exists('Markup_e')) {
# added by Petko Yotov
Markup_e("tagger", '<directives', '/^(\\(:)?(' . $tagpat . '):(.*?)(:\\))?$/', "TaggerLinks(\$pagename, \$m[1], \$m[2], \$m[3], \$m[4])");
// deal with the "hidden" PTVs
Markup_e('textvar:', '<split', '/\\(:(\\w[-\\w]*):((?!\\)).*?):\\)/s', "TaggerHiddenVars(\$pagename, \$m[1], \$m[2])");
} else {
Markup("tagger", '<directives', '/^(\\(:)?(' . $tagpat . '):(.*?)(:\\))?$/e', "TaggerLinks(\$pagename, '\$1', '\$2', '\$3', '\$4')");
// deal with the "hidden" PTVs
Markup('textvar:', '<split', '/\\(:(\\w[-\\w]*):((?!\\)).*?):\\)/se', "TaggerHiddenVars(\$pagename, '\$1', '\$2')");
}
// hidden Tagger PTVs get hidden after link-processing
Markup('textvar:ol', ">links", '/^\\(:\\w[-\\w]*:.*?:\\)$/', '');
}
}
示例2: htmlspecialchars
if (!isset($Author)) {
if (isset($_POST['author'])) {
$Author = htmlspecialchars(stripmagic($_POST['author']), ENT_QUOTES);
setcookie('author', $Author, $AuthorCookieExpires, $AuthorCookieDir);
} else {
$Author = htmlspecialchars(stripmagic(@$_COOKIE['author']), ENT_QUOTES);
}
$Author = preg_replace('/(^[^[:alpha:]]+)|[^-\\w ]/', '', $Author);
}
if (!isset($AuthorPage)) {
$AuthorPage = FmtPageName('$AuthorGroup/$Name', MakePageName($pagename, $Author));
}
SDV($AuthorLink, $Author ? "[[~{$Author}]]" : '?');
if (IsEnabled($EnableAuthorSignature, 1)) {
$ROSPatterns['/(?<!~)~~~~(?!~)/'] = '[[~$Author]] $CurrentTime';
$ROSPatterns['/(?<!~)~~~(?!~)/'] = '[[~$Author]]';
Markup('~~~~', '<links', '/(?<!~)~~~~(?!~)/', "[[~{$Author}]] {$CurrentTime}");
Markup('~~~', '>~~~~', '/(?<!~)~~~(?!~)/', "[[~{$Author}]]");
}
if (IsEnabled($EnablePostAuthorRequired, 0)) {
array_unshift($EditFunctions, 'RequireAuthor');
}
## RequireAuthor forces an author to enter a name before posting.
function RequireAuthor($pagename, &$page, &$new)
{
global $Author, $MessagesFmt, $AuthorRequiredFmt, $EnablePost;
if (!$Author) {
$MessagesFmt[] = $AuthorRequiredFmt;
$EnablePost = 0;
}
}
示例3: SDV
*/
## $LinkIndexFile is the index file for backlinks and link= option
if (IsEnabled($EnableLinkIndex, 1)) {
SDV($LinkIndexFile, "{$WorkDir}/.linkindex");
$EditFunctions[] = 'PostLinkIndex';
}
## $SearchPatterns holds patterns for list= option
SDVA($SearchPatterns['all'], array());
$SearchPatterns['normal'][] = '!\\.(All)?Recent(Changes|Uploads)$!';
$SearchPatterns['normal'][] = '!\\.Group(Print)?(Header|Footer|Attributes)$!';
SDV($SearchResultsFmt, "<div class='wikisearch'>\$[SearchFor]\n {$HTMLVSpace}\$MatchList\n {$HTMLVSpace}\$[SearchFound]{$HTMLVSpace}</div>");
SDV($SearchQuery, str_replace('$', '$', htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES)));
XLSDV('en', array('SearchFor' => 'Results of search for <em>$Needle</em>:', 'SearchFound' => '$MatchCount pages found out of $MatchSearched pages searched.'));
Markup('pagelist', 'directives', '/\\(:pagelist(\\s+.*?)?:\\)/ei', "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('\$1 ')))");
Markup('searchresults', 'directives', '/\\(:searchresults(\\s+.*?)?:\\)/ei', "FmtPageList(\$GLOBALS['SearchResultsFmt'], \$pagename,\n array('o' => PSS('\$1'), 'req' => 1))");
Markup('searchbox', '>links', '/\\(:searchbox(\\s.*?)?:\\)/e', "SearchBox(\$pagename, ParseArgs(PSS('\$1')))");
SDV($HandleActions['search'], 'HandleSearchA');
SDV($HandleAuth['search'], 'read');
## SearchBox generates the output of the (:searchbox:) markup.
## If $SearchBoxFmt is defined, that is used, otherwise a searchbox
## is generated. Options include group=, size=, label=.
function SearchBox($pagename, $opt)
{
global $SearchBoxFmt, $SearchBoxOpt, $SearchQuery, $EnablePathInfo;
if (isset($SearchBoxFmt)) {
return FmtPageName($SearchBoxFmt, $pagename);
}
SDVA($SearchBoxOpt, array('size' => '40', 'label' => FmtPageName('$[Search]', $pagename), 'group' => @$_REQUEST['group'], 'value' => $SearchQuery));
$opt = array_merge((array) $SearchBoxOpt, (array) $opt);
$group = $opt['group'];
$out[] = FmtPageName("\n class='wikisearch' action='\$PageUrl' method='get'><input\n type='hidden' name='action' value='search' />", $pagename);
示例4: Keep
the caller, and calls Keep() (preserves HTML) or PRR() (re-evaluate
as markup) as appropriate for the output being returned.
*/
## $SearchPatterns holds patterns for list= option
SDVA($SearchPatterns['all'], array());
$SearchPatterns['normal'][] = '!\\.(All)?Recent(Changes|Uploads)$!';
$SearchPatterns['normal'][] = '!\\.Group(Print)?(Header|Footer|Attributes)$!';
SDV($SearchResultsFmt, "<div class='wikisearch'>\$[SearchFor]\n {$HTMLVSpace}\$MatchList\n {$HTMLVSpace}\$[SearchFound]{$HTMLVSpace}</div>");
SDV($SearchBoxFmt, "<form class='wikisearch' action='{$ScriptUrl}'\n method='get'><input type='hidden' name='n'\n value='\$[Main/SearchWiki]' /><input class='wikisearchbox'\n type='text' name='q' value='\$SearchQuery' size='40' /><input\n class='wikisearchbutton' type='submit' value='\$[Search]' /></form>");
SDV($SearchQuery, str_replace('$', '$', htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES)));
XLSDV('en', array('SearchFor' => 'Results of search for <em>$Needle</em>:', 'SearchFound' => '$MatchCount pages found out of $MatchSearched pages searched.'));
## $FPLFunctions is a list of functions associated with fmt= options
SDVA($FPLFunctions, array('bygroup' => 'FPLByGroup', 'simple' => 'FPLSimple', 'group' => 'FPLGroup'));
Markup('pagelist', 'directives', '/\\(:pagelist(\\s+.*?)?:\\)/ei', "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('\$1 ')))");
Markup('searchresults', 'directives', '/\\(:searchresults(\\s+.*?)?:\\)/ei', "FmtPageList(\$GLOBALS['SearchResultsFmt'], \$pagename,\n array('o' => PSS('\$1'), 'req' => 1))");
Markup('searchbox', '>links', '/\\(:searchbox:\\)/ie', "FmtPageName(\$GLOBALS['SearchBoxFmt'], \$pagename)");
## FmtPageList combines options from markup, request form, and url,
## calls the appropriate formatting function, and returns the string
## (calling Keep() or PRR() as appropriate).
function FmtPageList($fmt, $pagename, $opt)
{
global $GroupPattern, $FmtV, $FPLFunctions;
# if (isset($_REQUEST['q']) && $_REQUEST['q']=='') $_REQUEST['q']="''";
$rq = htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES);
$FmtV['$Needle'] = $opt['o'] . ' ' . $rq;
if (preg_match("!^({$GroupPattern}(\\|{$GroupPattern})*)?/!i", $rq, $match)) {
$opt['group'] = @$match[1];
$rq = substr($rq, strlen(@$match[1]) + 1);
}
$opt = array_merge($opt, ParseArgs($opt['o'] . ' ' . $rq), @$_REQUEST);
if (@($opt['req'] && !$opt['-'] && !$opt[''] && !$opt['+'] && !$opt['q'])) {
示例5: markup
}
/* Copyright 2007 Patrick R. Michaud (pmichaud@pobox.com)
This file is part of PmWiki; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. See pmwiki.php for full details.
This script adds Creole v0.4 markup (http://www.wikicreole.org/)
to PmWiki. To activate this script, simply add the following into
a local customization file:
include_once('scripts/creole.php');
*/
## **strong**
Markup('**', 'inline', '/^\\*\\*(?>(.+?)\\*\\*)(?!\\S)|(?<!^)\\*\\*(.+?)\\*\\*/', '<strong>$1$2</strong>');
## //emphasized//
Markup('//', 'inline', '/(?<!http:|ftp:)\\/\\/(.*?)\\/\\//', '<em>$1</em>');
## == Headings ==
Markup('^=', 'block', '/^(={1,6})\\s?(.*?)(\\s*=*\\s*)$/e', "'<:block,1><h'.strlen('\$1').PSS('>\$2</h').strlen('\$1').'>'");
## Line breaks
Markup('\\\\', 'inline', '/\\\\\\\\/', '<br />');
## Preformatted
Markup('^{{{', '[=', "/^\\{\\{\\{\n(.*?\n)\\}\\}\\}[^\\S\n]*\n/sme", "Keep(PSS('<pre class=\"escaped\">\$1</pre>'))");
Markup('{{{', '>{{{', '/\\{\\{\\{(.*?)\\}\\}\\}/se', "Keep(PSS('<code class=\"escaped\">\$1</code>'))");
## Tables
Markup('|-table', '>^||', '/^\\|(.*)$/e', "FormatTableRow(PSS('\$0'), '\\|')");
## Images
Markup('{{', 'inline', '/\\{\\{(?>(\\L))([^|\\]]*)(?:\\|\\s*(.*?)\\s*)?\\}\\}/e', "Keep(\$GLOBALS['LinkFunctions']['\$1'](\$pagename, '\$1', '\$2', '\$3',\n '\$1\$2', \$GLOBALS['ImgTagFmt']),'L')");
## GUIButtons
SDVA($GUIButtons, array('em' => array(100, "//", "//", '$[Emphasized]', '$GUIButtonDirUrlFmt/em.gif"$[Emphasized (italic)]"', '$[ak_em]'), 'strong' => array(110, "**", "**", '$[Strong]', '$GUIButtonDirUrlFmt/strong.gif"$[Strong (bold)]"', '$[ak_strong]'), 'h2' => array(400, '\\n== ', ' ==\\n', '$[Heading]', '$GUIButtonDirUrlFmt/h.gif"$[Heading]"')));
示例6: Markup_e
function Markup_e($id, $when, $pat, $rep, $template = 'markup_e') {
if (!is_callable($rep)) $rep = PCCF($rep, $template);
Markup($id, $when, $pat, $rep);
}
示例7: SDV
## We don't bother to load it if we're not editing.
if ($action != 'edit') {
return;
}
SDV($PageEditForm, '$SiteGroup.EditForm');
SDV($PageEditFmt, '$EditForm');
if (@$_REQUEST['editform']) {
$PageEditForm = $_REQUEST['editform'];
$PageEditFmt = '$EditForm';
}
$Conditions['e_preview'] = '(boolean)$_POST["preview"]';
XLSDV('en', array('ak_save' => 's', 'ak_saveedit' => 'u', 'ak_preview' => 'p', 'ak_textedit' => ',', 'e_rows' => '25', 'e_cols' => '60'));
# (:e_preview:) displays the preview of formatted text.
Markup('e_preview', 'directives', '/^\\(:e_preview:\\)/e', "Keep(\$GLOBALS['FmtV']['\$PreviewText'])");
# If we didn't load guiedit.php, then set (:e_guibuttons:) to
# simply be empty.
Markup('e_guibuttons', 'directives', '/\\(:e_guibuttons:\\)/', '');
SDVA($InputTags['e_form'], array(':html' => "<form action='{\$PageUrl}?action=edit' method='post'><input \n type='hidden' name='action' value='edit' /><input \n type='hidden' name='n' value='{\$FullName}' /><input \n type='hidden' name='basetime' value='\$EditBaseTime' />"));
SDVA($InputTags['e_textarea'], array(':html' => "<textarea \$InputFormArgs \n onkeydown='if (event.keyCode==27) event.returnValue=false;' \n >\$EditText</textarea>", 'name' => 'text', 'id' => 'text', 'accesskey' => XL('ak_textedit'), 'rows' => XL('e_rows'), 'cols' => XL('e_cols')));
SDVA($InputTags['e_author'], array(':html' => "<input type='text' \$InputFormArgs />", 'name' => 'author', 'value' => $Author));
SDVA($InputTags['e_changesummary'], array(':html' => "<input type='text' \$InputFormArgs />", 'name' => 'csum', 'size' => '60', 'maxlength' => '100', 'value' => htmlspecialchars(stripmagic(@$_POST['csum']), ENT_QUOTES)));
SDVA($InputTags['e_minorcheckbox'], array(':html' => "<input type='checkbox' \$InputFormArgs />", 'name' => 'diffclass', 'value' => 'minor'));
if (@$_POST['diffclass'] == 'minor') {
SDV($InputTags['e_minorcheckbox']['checked'], 'checked');
}
SDVA($InputTags['e_savebutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'post', 'value' => ' ' . XL('Save') . ' ', 'accesskey' => XL('ak_save')));
SDVA($InputTags['e_saveeditbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'postedit', 'value' => ' ' . XL('Save and edit') . ' ', 'accesskey' => XL('ak_saveedit')));
SDVA($InputTags['e_savedraftbutton'], array(':html' => ''));
SDVA($InputTags['e_previewbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'preview', 'value' => ' ' . XL('Preview') . ' ', 'accesskey' => XL('ak_preview')));
SDVA($InputTags['e_cancelbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'cancel', 'value' => ' ' . XL('Cancel') . ' '));
SDVA($InputTags['e_resetbutton'], array(':html' => "<input type='reset' \$InputFormArgs />", 'value' => ' ' . XL('Reset') . ' '));
示例8: any
# Move any (:noleft:) or SetTmplDisplay('PageLeftFmt', 0); directives to variables for access in jScript.
$FmtPV['$LeftColumn'] = "\$GLOBALS['TmplDisplay']['PageLeftFmt']";
Markup('noleft', 'directives', '/\\(:noleft:\\)/ei', "SetTmplDisplay('PageLeftFmt',0)");
$FmtPV['$RightColumn'] = "\$GLOBALS['TmplDisplay']['PageRightFmt']";
Markup('noright', 'directives', '/\\(:noright:\\)/ei', "SetTmplDisplay('PageRightFmt',0)");
$FmtPV['$ActionBar'] = "\$GLOBALS['TmplDisplay']['PageActionFmt']";
Markup('noaction', 'directives', '/\\(:noaction:\\)/ei', "SetTmplDisplay('PageActionFmt',0)");
$FmtPV['$TabsBar'] = "\$GLOBALS['TmplDisplay']['PageTabsFmt']";
Markup('notabs', 'directives', '/\\(:notabs:\\)/ei', "SetTmplDisplay('PageTabsFmt',0)");
$FmtPV['$SearchBar'] = "\$GLOBALS['TmplDisplay']['PageSearchFmt']";
Markup('nosearch', 'directives', '/\\(:nosearch:\\)/ei', "SetTmplDisplay('PageSearchFmt',0)");
$FmtPV['$TitleGroup'] = "\$GLOBALS['TmplDisplay']['PageTitleGroupFmt']";
Markup('notitlegroup', 'directives', '/\\(:notitlegroup:\\)/ei', "SetTmplDisplay('PageTitleGroupFmt',0)");
Markup('notitle', 'directives', '/\\(:notitle:\\)/ei', "SetTmplDisplay('PageTitleFmt',0); SetTmplDisplay('PageTitleGroupFmt',0)");
Markup('fieldset', 'inline', '/\\(:fieldset:\\)/i', "<fieldset>");
Markup('fieldsetend', 'inline', '/\\(:fieldsetend:\\)/i', "</fieldset>");
# Override pmwiki styles otherwise they will override styles declared in css
global $HTMLStylesFmt;
$HTMLStylesFmt['pmwiki'] = '';
# Add a custom page storage location
global $WikiLibDirs;
$PageStorePath = dirname(__FILE__) . "/wikilib.d/{\$FullName}";
$where = count($WikiLibDirs);
if ($where > 1) {
$where--;
}
array_splice($WikiLibDirs, $where, 0, array(new PageStore($PageStorePath)));
# ----------------------------------------
# - Standard Skin Functions
# ----------------------------------------
function dg_SetSkinColor($default, $valid_colors)
示例9: markup
#### (:table:) markup (AdvancedTables)
function Cells($name, $attr)
{
global $MarkupFrame;
$attr = preg_replace('/([a-zA-Z]=)([^\'"]\\S*)/', "\$1'\$2'", $attr);
$tattr = @$MarkupFrame[0]['tattr'];
$name = strtolower($name);
if ($name == 'cell' || $name == 'cellnr') {
if (!@$MarkupFrame[0]['posteval']['cells']) {
$MarkupFrame[0]['posteval']['cells'] = "\$out .= '</td></tr></table>';";
return "<:block><table {$tattr}><tr><td {$attr}>";
} else {
if ($name == 'cellnr') {
return "<:block></td></tr><tr><td {$attr}>";
}
}
return "<:block></td><td {$attr}>";
}
$MarkupFrame[0]['tattr'] = $attr;
if (@$MarkupFrame[0]['posteval']['cells']) {
unset($MarkupFrame[0]['posteval']['cells']);
return '<:block></td></tr></table>';
}
return '<:block>';
}
Markup('^table', '<block', '/^\\(:(table|cell|cellnr|tableend)(\\s.*?)?:\\)/ie', "Cells('\$1',PSS('\$2'))");
#### special stuff ####
## (:markup:) for displaying markup examples
Markup('markup', '<[=', "/^\\(:markup:\\)[^\\S\n]*\\[=(.*?)=\\]/seim", "'\n'.Keep('<div class=\"markup\"><pre>'.wordwrap(PSS('\$1'),60).\n '</pre>').PSS('\n\$1\n<:block,0></div>\n')");
Markup('markupend', '>markup', "/^\\(:markup:\\)[^\\S\n]*\n(.*?)\\(:markupend:\\)/seim", "'\n'.Keep('<div class=\"markup\"><pre>'.wordwrap(PSS('\$1'),60).\n '</pre>').PSS('\n\$1\n<:block,0></div>\n')");
$HTMLStylesFmt['markup'] = "\n div.markup { border:2px dotted #ccf; \n margin-left:30px; margin-right:30px; \n padding-left:10px; padding-right:10px; }\n div.markup pre { border-bottom:1px solid #ccf; \n padding-top:10px; padding-bottom:10px; }\n p.question { font-weight:bold; }\n ";
示例10: SDV
<?php
if (!defined('PmWiki')) {
exit;
}
/* Copyright 2004-2015 Patrick R. Michaud (pmichaud@pobox.com)
This file is part of PmWiki; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. See pmwiki.php for full details.
Script maintained by Petko YOTOV www.pmwiki.org/petko
*/
SDV($WikiStylePattern, '%%|%[A-Za-z][-,=:#\\w\\s\'"().]*%');
## %% markup
Markup('%%', 'style', '%', 'return ApplyStyles($x);');
## %define=...% markup on a line by itself
Markup_e('%define=', '>split', "/^(?=%define=)((?:{$WikiStylePattern})\\s*)+\$/", "PZZ(ApplyStyles(\$m[0]))");
## restore links before applying styles
Markup_e('restorelinks', '<%%', "/{$KeepToken}(\\d+L){$KeepToken}/", '$GLOBALS[\'KPV\'][$m[1]]');
# define PmWiki's standard/default wikistyles
if (IsEnabled($EnableStdWikiStyles, 1)) {
## standard colors
foreach (array('black', 'white', 'red', 'yellow', 'blue', 'gray', 'silver', 'maroon', 'green', 'navy', 'purple', 'fuchsia', 'olive', 'lime', 'teal', 'aqua', 'orange') as $c) {
SDV($WikiStyle[$c]['color'], $c);
}
SDV($WikiStyle['grey']['color'], 'gray');
## %newwin% style opens links in a new window
SDV($WikiStyle['newwin']['target'], '_blank');
## %comment% style turns markup into a comment via display:none css
SDV($WikiStyle['comment']['display'], 'none');
示例11: SDV
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. See pmwiki.php for full details.
*/
SDV($WikiStylePattern,'%%|%[A-Za-z][-,=:#\\w\\s\'"().]*%');
## %% markup
Markup('%%','style','%','return ApplyStyles($x);');
## %define=...% markup on a line by itself
Markup('%define=', '>split',
"/^(?=%define=)((?:$WikiStylePattern)\\s*)+$/e",
"PZZ(ApplyStyles(PSS('$0')))");
## restore links before applying styles
Markup('restorelinks','<%%',"/$KeepToken(\\d+L)$KeepToken/e",
'$GLOBALS[\'KPV\'][\'$1\']');
# define PmWiki's standard/default wikistyles
if (IsEnabled($EnableStdWikiStyles,1)) {
## standard colors
foreach(array('black','white','red','yellow','blue','gray',
'silver','maroon','green','navy','purple') as $c)
SDV($WikiStyle[$c]['color'],$c);
## %newwin% style opens links in a new window
SDV($WikiStyle['newwin']['target'],'_blank');
## %comment% style turns markup into a comment via display:none css
SDV($WikiStyle['comment']['display'],'none');
## display, margin, padding, and border css properties
$WikiStyleCSS[] =
'float|display|(margin|padding|border)(-(left|right|top|bottom))?';
$WikiStyleCSS[] = 'white-space';
示例12: MakeLink
$out .= "<li class='nav nav-list'>{$group}<b class='caret'></b>";
$out .= "<ul class='dropdown-menu'>";
}
$out .= '<li>';
$out .= MakeLink($pagename, $page);
$out .= '</li>';
}
$out .= "</ul></li>";
return $out;
}
include_once "{$SkinDir}/dropdown.php";
global $BootButtons;
SDVA($BootButtons, array('em' => array(100, "''", "''", '$[Emphasized]', 'icon-italic', '$[ak_em]'), 'strong' => array(110, "'''", "'''", '$[Strong]', 'icon-bold', '$[ak_strong]'), 'big' => array(300, "'+", "+'", '$[Big text]', 'icon-fullscreen'), 'sup' => array(320, "'^", "^'", '$[Superscript]', 'icon-arrow-up'), 'sub' => array(330, "'_", "_'", '$[Subscript]', 'icon-arrow-down'), 'center' => array(410, '%center%', '', '', 'icon-align-center')));
/* sms($BootButtons); */
#sms('after the echo');
Markup('e_bootbuttons', 'directives', '/\\(:e_bootbuttons:\\)/', "Keep(FmtPageName(BootButtonCode(\$pagename), \$pagename))");
function BootButtonCode($pagename)
{
global $BootButtons;
$cmpfn = create_function('$a,$b', 'return $a[0]-$b[0];');
/* sms('inside of BootButtonCode'); */
/* sms('Buttons: '.$BootButtons); */
usort($BootButtons, $cmpfn);
$out = "<script type='text/javascript'><!--\n";
foreach ($BootButtons as $k => $g) {
if (!$g) {
continue;
}
@(list($when, $mopen, $mclose, $mtext, $class, $mkey) = $g);
// I will confess to not completely understanding what was happening, here
// I replaced "$tag" in the above line with "$class"
示例13: preg_replace
"<caption>{$opt['caption']}</caption>");
$class = preg_replace('/[^-\\s\\w]+/', ' ', @$opt['class']);
if (strpos($class, 'horiz') !== false)
{ $sep = ''; $pretext = $MarkupWordwrapFunction($text, 40); }
else
{ $sep = '</tr><tr>'; $pretext = $MarkupWordwrapFunction($text, 75); }
return Keep(@"<table class='markup $class' align='center'>$caption
<tr><td class='markup1' valign='top'><pre>$pretext</pre></td>$sep<td
class='markup2' valign='top'>$html</td></tr></table>");
}
Markup('markup', '<[=',
"/\\(:markup(\\s+([^\n]*?))?:\\)[^\\S\n]*\\[([=@])(.*?)\\3\\]/sei",
"MarkupMarkup(\$pagename, PSS('$4'), PSS('$2'))");
Markup('markupend', '>markup',
"/\\(:markup(\\s+([^\n]*?))?:\\)[^\\S\n]*\n(.*?)\\(:markupend:\\)/sei",
"MarkupMarkup(\$pagename, PSS('$3'), PSS('$1'))");
SDV($HTMLStylesFmt['markup'], "
table.markup { border:2px dotted #ccf; width:90%; }
td.markup1, td.markup2 { padding-left:10px; padding-right:10px; }
table.vert td.markup1 { border-bottom:1px solid #ccf; }
table.horiz td.markup1 { width:23em; border-right:1px solid #ccf; }
table.markup caption { text-align:left; }
div.faq p, div.faq pre { margin-left:2em; }
div.faq p.question { margin:1em 0 0.75em 0; font-weight:bold; }
div.faqtoc div.faq * { display:none; }
div.faqtoc div.faq p.question
{ display:block; font-weight:normal; margin:0.5em 0 0.5em 20px; line-height:normal; }
div.faqtoc div.faq p.question * { display:inline; }
");
示例14: Keep
of pages, formats the list somehow, and returns the results
to FmtPageList. FmtPageList then returns the output to
the caller, and calls Keep() (preserves HTML) or PRR() (re-evaluate
as markup) as appropriate for the output being returned.
*/
## $SearchPatterns holds patterns for list= option
SDVA($SearchPatterns['all'], array());
$SearchPatterns['normal'][] = '!\\.(All)?Recent(Changes|Uploads)$!';
$SearchPatterns['normal'][] = '!\\.Group(Print)?(Header|Footer|Attributes)$!';
SDV($SearchResultsFmt, "<div class='wikisearch'>\$[SearchFor]\n {$HTMLVSpace}\$MatchList\n {$HTMLVSpace}\$[SearchFound]{$HTMLVSpace}</div>");
XLSDV('en', array('SearchFor' => 'Results of search for <em>$Needle</em>:', 'SearchFound' => '$MatchCount pages found.'));
## $FPLFunctions is a list of functions associated with fmt= options
SDVA($FPLFunctions, array('bygroup' => 'FPLByGroup', 'simple' => 'FPLSimple', 'group' => 'FPLGroup'));
Markup('pagelist', 'directives', '/\\(:pagelist(\\s+.*?)?:\\)/ei', "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('\$1 ')))");
Markup('searchresults', 'directives', '/\\(:searchresults(\\s+.*?)?:\\)/ei', "FmtPageList(\$GLOBALS['SearchResultsFmt'], \$pagename,\n array('o' => PSS('\$1'), 'req' => 1))");
Markup('searchbox', '>links', '/\\(:searchbox:\\)/i', FmtPageName("<form class='wikisearch' action='\$ScriptUrl'\n method='get'><input type='hidden' name='n'\n value='\$[Main/SearchWiki]' /><input class='wikisearchbox'\n type='text' name='q' value='' size='40' /><input\n class='wikisearchbutton' type='submit' value='\$[Search]' /></form>", $pagename));
## FmtPageList combines options from markup, request form, and url,
## calls the appropriate formatting function, and returns the string
## (calling Keep() or PRR() as appropriate).
function FmtPageList($fmt, $pagename, $opt)
{
global $GroupPattern, $FmtV, $FPLFunctions;
if (isset($_REQUEST['q']) && $_REQUEST['q'] == '') {
$_REQUEST['q'] = "''";
}
$rq = htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES);
if (preg_match("!^({$GroupPattern}(\\|{$GroupPattern})*)?/!i", $rq, $match)) {
$opt['group'] = @$match[1];
$rq = substr($rq, strlen(@$match[1] + 1));
}
$needle = $opt['o'] . ' ' . $rq;
示例15: explode
//define the style for search-terms
$HTMLStylesFmt['highlight'] = ".highlight { background-color: #9999FF }";
//get the referrer and separate the arguments
$query = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
//initialisation
$terms = array();
//check arguments if they are search-terms
foreach ($query as $part) {
//separate argument in key-value-pairs
list($key, $value) = explode('=', $part);
//check if current argument is a search-term
if ($key == "q") {
//separate words and save them as search-terms
$terms = explode('+', $value);
}
}
//generate dynamic markup for each word the user was searching for
foreach ($terms as $term) {
if ($term) {
Markup("hl" . $term, "<_end", "/(<[^>]*>|" . $term . ")/ie", "highlight('\$1')");
}
}
function highlight($input)
{
$input = str_replace('\\"', '"', $input);
if ($input[0] == "<") {
return $input;
} else {
return "<span class='highlight'>" . $input . "</span>";
}
}