当前位置: 首页>>代码示例>>PHP>>正文


PHP Keep函数代码示例

本文整理汇总了PHP中Keep函数的典型用法代码示例。如果您正苦于以下问题:PHP Keep函数的具体用法?PHP Keep怎么用?PHP Keep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Keep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: FmtPageList

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'])) {
        return;
    }
    $matches = array();
    $fmtfn = @$FPLFunctions[$opt['fmt']];
    if (!function_exists($fmtfn)) {
        $fmtfn = 'FPLByGroup';
    }
    $out = $fmtfn($pagename, $matches, $opt);
    $FmtV['$MatchCount'] = count($matches);
    $GLOBALS['SearchIncl'] = array_merge((array) @$opt[''], (array) @$opt['+']);
    $GLOBALS['SearchExcl'] = array_merge((array) $opt['-']);
    $GLOBALS['SearchGroup'] = @$opt['group'];
    if ($fmt != '$MatchList') {
        $FmtV['$MatchList'] = $out;
        $out = FmtPageName($fmt, $pagename);
    }
    if ($out[0] == '<') {
        return '<div>' . Keep($out) . '</div>';
    }
    PRR();
    return $out;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:34,代码来源:pagelist.php

示例2: SearchBox

function SearchBox($pagename, $opt)
{
    global $SearchBoxFmt, $SearchBoxOpt, $SearchQuery, $EnablePathInfo;
    if (isset($SearchBoxFmt)) {
        return Keep(FmtPageName($SearchBoxFmt, $pagename));
    }
    SDVA($SearchBoxOpt, array('size' => '40', 'label' => FmtPageName('$[Search]', $pagename), 'value' => str_replace("'", "&#039;", $SearchQuery)));
    $opt = array_merge((array) $SearchBoxOpt, @$_GET, (array) $opt);
    $opt['action'] = 'search';
    $target = $opt['target'] ? MakePageName($pagename, $opt['target']) : $pagename;
    $out = FmtPageName(" class='wikisearch' action='\$PageUrl' method='get'>", $target);
    $opt['n'] = IsEnabled($EnablePathInfo, 0) ? '' : $target;
    $out .= "<input type='text' name='q' value='{$opt['value']}' \n    class='inputbox searchbox' size='{$opt['size']}' /><input type='submit' \n    class='inputbutton searchbutton' value='{$opt['label']}' />";
    foreach ($opt as $k => $v) {
        if ($v == '') {
            continue;
        }
        if ($k == 'q' || $k == 'label' || $k == 'value' || $k == 'size') {
            continue;
        }
        $k = str_replace("'", "&#039;", $k);
        $v = str_replace("'", "&#039;", $v);
        $out .= "<input type='hidden' name='{$k}' value='{$v}' />";
    }
    return '<form ' . Keep($out) . '</form>';
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:26,代码来源:pagelist.php

示例3: InputMarkup

function InputMarkup($pagename, $type, $args)
{
    global $InputTags, $InputAttrs, $InputValues, $FmtV;
    if (!@$InputTags[$type]) {
        return "(:input {$type} {$args}:)";
    }
    $opt = array_merge($InputTags[$type], ParseArgs($args));
    $args = @$opt[':args'];
    if (!$args) {
        $args = array('name', 'value');
    }
    while (count(@$opt['']) > 0 && count($args) > 0) {
        $opt[array_shift($args)] = array_shift($opt['']);
    }
    foreach ((array) @$opt[''] as $a) {
        if (!isset($opt[$a])) {
            $opt[$a] = $a;
        }
    }
    if (!isset($opt['value']) && isset($InputValues[@$opt['name']])) {
        $opt['value'] = $InputValues[$opt['name']];
    }
    $attr = array();
    foreach ($InputAttrs as $a) {
        if (!isset($opt[$a])) {
            continue;
        }
        $attr[] = "{$a}='" . str_replace("'", '&#39;', $opt[$a]) . "'";
    }
    $FmtV['$InputFormArgs'] = implode(' ', $attr);
    $out = FmtPageName($opt[':html'], $pagename);
    return Keep($out);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:33,代码来源:forms.php

示例4: BDropdownMenu

function BDropdownMenu($inp)
{
    $defaults = array('title' => 'Dropdown');
    $args = array_merge($defaults, ParseArgs($inp));
    $inline_code_begin = "<li class='dropdown'><a href='#' class='dropdown-toggle' data-toggle='dropdown'>" . $args['title'] . "<b class='caret'></b></a><ul class='dropdown-menu'>";
    $inline_code_end = "</ul></li>";
    // if we're using MakePageList, we have to pass ALL the opts along...
    // in this case, named $args
    $group_list = BGetWikiPages($args);
    $formatted_list = BBuildGroupList($group_list);
    return Keep($inline_code_begin . $formatted_list . $inline_code_end);
}
开发者ID:utexas-ghosh-group,项目名称:data.ece.utexas.edu,代码行数:12,代码来源:dropdown.php

示例5: HandyTocProcessMarkup

function HandyTocProcessMarkup($pagename, $argstr)
{
    global $HandyTocEndAt, $HandyTocStartAt, $HandyTocIgnoreSoleH1;
    global $HTMLFooterFmt;
    $args = ParseArgs($argstr);
    $title = $args[''] ? implode(' ', $args['']) : '';
    $start = $args['start'] ? $args['start'] : $HandyTocStartAt;
    $end = $args['end'] ? $args['end'] : $HandyTocEndAt;
    $ignoreh1 = $args['ignoreh1'] ? $args['ignoreh1'] : $HandyTocIgnoreSoleH1;
    $class = $args['class'] ? ' class="' . $args['class'] . '" ' : '';
    $HTMLFooterFmt['handytoc'] = " \n  <script language='javascript' type='text/javascript'\n     src='\$HandyTocPubDirUrl/handytoc.js'></script>\n  <script language='javascript' type='text/javascript'>TOC.set_args({start:{$start}, end:{$end}, ignoreh1:{$ignoreh1}});</script>\n";
    if ($title) {
        return Keep("<div {$class}id='htoc'><h3>{$title}</h3></div>");
    } else {
        return Keep("<div {$class}id='htoc'></div>");
    }
}
开发者ID:rubykat,项目名称:pmwiki-handytoc,代码行数:17,代码来源:handytoc.php

示例6: drawing

function drawing($str)
{
    global $EnableUpload;
    $output = "";
    if ($EnableUpload != 1) {
        // Helpful hint to make sure people turn on uploads!
        $output .= "<b>Please note your administrator *NEEDS* to enable uploads before you can save your drawings.</b><br/>";
    }
    $drawing = $str;
    $pos = strrpos($drawing, '.');
    $filenameExtension = $pos == false ? '' : strtolower(substr($drawing, $pos + 1));
    if (in_array($filenameExtension, array('', 'draw'))) {
        $output .= drawing_draw($str);
    } else {
        $output .= drawing_any($str);
    }
    return Keep($output);
}
开发者ID:microcosmx,项目名称:experiments,代码行数:18,代码来源:AnyWikiDraw.php

示例7: SearchBox

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' => str_replace("'", "&#039;", $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);
    if (!IsEnabled($EnablePathInfo, 0)) {
        $out .= "<input type='hidden' name='n' value='{$pagename}' />";
    }
    if ($group) {
        $out .= "<input type='hidden' name='group' value='{$group}' />";
    }
    $out .= "<input type='text' name='q' value='{$opt['value']}' \n    size='{$opt['size']}' /><input class='wikisearchbutton' \n    type='submit' value='{$opt['label']}' /></form>";
    return "<form " . Keep($out);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:19,代码来源:pagelist.php

示例8: InputActionForm

function InputActionForm($pagename, $type, $args) {
  global $InputAttrs;
  $args = ParseArgs($args);
  if (@$args['pagename']) $pagename = $args['pagename'];
  $opt = NULL;
  $html = InputToHTML($pagename, $type, $args, $opt);
  foreach(preg_grep('/^[\\w$]/', array_keys($args)) as $k) {
    if (is_array($args[$k]) || in_array($k, $InputAttrs)) continue;
    if ($k == 'n' || $k == 'pagename') continue;
    $html .= "<input type='hidden' name='$k' value='{$args[$k]}' />";
  }
  return Keep($html);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:13,代码来源:forms.php

示例9: MarkupExpression

function MarkupExpression($pagename, $expr)
{
    global $KeepToken, $KPV, $MarkupExpr;
    $rpat = "/{$KeepToken}(\\d+P){$KeepToken}/e";
    $rrep = '$KPV[\'$1\']';
    $expr = preg_replace('/([\'"])(.*?)\\1/e', "Keep(PSS('\$2'),'P')", $expr);
    $expr = preg_replace('/\\(\\W/e', "Keep(PSS('\$2'),'P')", $expr);
    while (preg_match('/\\((\\w+)(\\s[^()]*)?\\)/', $expr, $match)) {
        list($repl, $func, $params) = $match;
        $code = @$MarkupExpr[$func];
        ##  if not a valid function, save this string as-is and exit
        if (!$code) {
            break;
        }
        ##  if the code uses '$params', we just evaluate directly
        if (strpos($code, '$params') !== false) {
            $out = eval("return ({$code});");
            if ($expr == $repl) {
                $expr = $out;
                break;
            }
            $expr = str_replace($repl, $out, $expr);
            continue;
        }
        ##  otherwise, we parse arguments into $args before evaluating
        $argp = ParseArgs($params);
        $x = $argp['#'];
        $args = array();
        while ($x) {
            list($k, $v) = array_splice($x, 0, 2);
            if ($k == '' || $k == '+' || $k == '-') {
                $args[] = $k . preg_replace($rpat, $rrep, $v);
            }
        }
        ##  fix any quoted arguments
        foreach ($argp as $k => $v) {
            if (!is_array($v)) {
                $argp[$k] = preg_replace($rpat, $rrep, $v);
            }
        }
        $out = eval("return ({$code});");
        if ($expr == $repl) {
            $expr = $out;
            break;
        }
        $expr = str_replace($repl, Keep($out, 'P'), $expr);
    }
    return preg_replace($rpat, $rrep, $expr);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:49,代码来源:markupexpr.php

示例10: MarkupMarkup

function MarkupMarkup($pagename, $text, $opt = '') {
  global $MarkupWordwrapFunction;
  SDV($MarkupWordwrapFunction, 'wordwrap');
  $MarkupMarkupOpt = array('class' => 'vert');
  $opt = array_merge($MarkupMarkupOpt, ParseArgs($opt));
  $html = MarkupToHTML($pagename, $text, array('escape' => 0));
  if (@$opt['caption']) 
    $caption = str_replace("'", '&#039;', 
                           "<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>");
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:18,代码来源:stdmarkup.php

示例11: GroupDropdownMenu

function GroupDropdownMenu($inp)
{
    $defaults = array('title' => 'Dropdown');
    $args = array_merge($defaults, ParseArgs($inp));
    $inline_code_begin = "<li class='dropdown'><a href='#' class='dropdown-toggle' data-toggle='dropdown'>" . $args['title'] . "<b class='caret'></b></a><ul class='dropdown-menu'>";
    $inline_code_end = "</ul></li>";
    // NOTE: if pattern not present, will default to ALL pages in wiki
    // hrm. "pattern" should probably change to "include"....
    $pattern = $args['pattern'];
    $exclude = $args['exclude'];
    // initial implementation is a naive string-check
    // TODO: improve exclude pattern
    // look at http://www.pmwiki.org/wiki/PmWiki/PageLists
    $group_list = GetWikiPages($pattern, $exclude);
    $formatted_list = BuildGroupList($group_list);
    return Keep($inline_code_begin . $formatted_list . $inline_code_end);
}
开发者ID:pmskin,项目名称:pmwiki-bootstrap-skin,代码行数:17,代码来源:skin.php

示例12: MarkupMarkup

function MarkupMarkup($pagename, $text)
{
    return "(:divend:)" . Keep("<table class='markup' align='center'><tr><td class='markup1'><pre>" . wordwrap($text, 70) . "</pre></td></tr><tr><td class='markup2'>") . "\n{$text}\n(:divend:)</td></tr></table>\n";
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:4,代码来源:stdmarkup.php

示例13: FmtPageList

function FmtPageList($outfmt, $pagename, $opt)
{
    global $GroupPattern, $FmtV, $PageListArgPattern, $FPLFormatOpt, $FPLFunctions;
    # get any form or url-submitted request
    $rq = PHSC(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES);
    # build the search string
    $FmtV['$Needle'] = $opt['o'] . ' ' . $rq;
    # Handle "group/" at the beginning of the form-submitted request
    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'], $PageListArgPattern));
    # merge markup options with form and url
    if (@$opt['request'] && @$_REQUEST) {
        $rkeys = preg_grep('/^=/', array_keys($_REQUEST), PREG_GREP_INVERT);
        if ($opt['request'] != '1') {
            list($incl, $excl) = GlobToPCRE($opt['request']);
            if ($excl) {
                $rkeys = array_diff($rkeys, preg_grep("/{$excl}/", $rkeys));
            }
            if ($incl) {
                $rkeys = preg_grep("/{$incl}/", $rkeys);
            }
        }
        $cleanrequest = array();
        foreach ($rkeys as $k) {
            $cleanrequest[$k] = stripmagic($_REQUEST[$k]);
        }
        $opt = array_merge($opt, ParseArgs($rq, $PageListArgPattern), $cleanrequest);
    }
    # non-posted blank search requests return nothing
    if (@($opt['req'] && !$opt['-'] && !$opt[''] && !$opt['+'] && !$opt['q'])) {
        return '';
    }
    # terms and group to be included and excluded
    $GLOBALS['SearchIncl'] = array_merge((array) @$opt[''], (array) @$opt['+']);
    $GLOBALS['SearchExcl'] = (array) @$opt['-'];
    $GLOBALS['SearchGroup'] = @$opt['group'];
    $fmt = @$opt['fmt'];
    if (!$fmt) {
        $fmt = 'default';
    }
    $fmtopt = @$FPLFormatOpt[$fmt];
    if (!is_array($fmtopt)) {
        if ($fmtopt) {
            $fmtopt = array('fn' => $fmtopt);
        } elseif (@$FPLFunctions[$fmt]) {
            $fmtopt = array('fn' => $FPLFunctions[$fmt]);
        } else {
            $fmtopt = $FPLFormatOpt['default'];
        }
    }
    $fmtfn = @$fmtopt['fn'];
    if (!is_callable($fmtfn)) {
        $fmtfn = $FPLFormatOpt['default']['fn'];
    }
    $matches = array();
    $opt = array_merge($fmtopt, $opt);
    $out = $fmtfn($pagename, $matches, $opt);
    $FmtV['$MatchCount'] = count($matches);
    if ($outfmt != '$MatchList') {
        $FmtV['$MatchList'] = $out;
        $out = FmtPageName($outfmt, $pagename);
    }
    if ($out[0] == '<') {
        $out = Keep($out);
    }
    return PRR($out);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:70,代码来源:pagelist.php

示例14: doYouTube

function doYouTube ($pagename, $attrstr) {
	$attribs = new Attributes($attrstr);
	$attr = $attribs->getAttribs('html');
	if (isset($attr['id'])) {
		$attr['id'] = preg_replace('/\W/', '', $attr['id']);
		$w = isset($attr['width']) ? $attr['width'] : 425;
		$h = isset($attr['height']) ? $attr['height'] : 350;
		$ret = "<object width='$w' height='$h'>\n";
		$ret.= "<param name='movie' value='http://www.youtube.com/v/$attr[id]'/>\n";
	  	$ret.= "<param name='wmode' value='transparent'/>\n";
		$ret.= "<embed src='http://www.youtube.com/v/$attr[id]' type='application/x-shockwave-flash' wmode='transparent' width='$w' height='$h'/>\n";
		$ret.= "</object>";
		return Keep($ret);
	}
	return '';
}
开发者ID:hexerei-software,项目名称:XOX-Framework,代码行数:16,代码来源:html_markup.inc.php

示例15: MakeLink

function MakeLink($pagename, $tgt, $txt = NULL, $suffix = NULL, $fmt = NULL)
{
    global $LinkPattern, $LinkFunctions, $UrlExcludeChars, $ImgExtPattern, $ImgTagFmt;
    $t = preg_replace('/[()]/', '', trim($tgt));
    $t = preg_replace('/<[^>]*>/', '', $t);
    preg_match("/^({$LinkPattern})?(.+?)(\"(.*)\")?\$/", $t, $m);
    if (!$m[1]) {
        $m[1] = '<:page>';
    }
    if (preg_match("/(({$LinkPattern})([^{$UrlExcludeChars}]+{$ImgExtPattern}))(\"(.*)\")?\$/", $txt, $tm)) {
        $txt = $LinkFunctions[$tm[2]]($pagename, $tm[2], $tm[3], @$tm[5], $tm[1], $ImgTagFmt);
    } else {
        if (is_null($txt)) {
            $txt = preg_replace('/\\([^)]*\\)/', '', $tgt);
            if ($m[1] == '<:page>') {
                $txt = preg_replace('!^.*[^<]/!', '', $txt);
            }
            $txt = Keep($txt);
        }
        $txt .= $suffix;
    }
    $out = $LinkFunctions[$m[1]]($pagename, $m[1], $m[2], @$m[4], $txt, $fmt);
    return $out;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:24,代码来源:pmwiki.php


注:本文中的Keep函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。