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


PHP SDVA函数代码示例

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


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

示例1: EditDraft

function EditDraft(&$pagename, &$page, &$new)
{
    global $WikiDir, $DraftSuffix, $DeleteKeyPattern, $EnableDraftAtomicDiff, $DraftRecentChangesFmt, $RecentChangesFmt, $Now;
    SDV($DeleteKeyPattern, "^\\s*delete\\s*\$");
    $basename = preg_replace("/{$DraftSuffix}\$/", '', $pagename);
    $draftname = $basename . $DraftSuffix;
    if ($_POST['postdraft'] || $_POST['postedit']) {
        $pagename = $draftname;
    } else {
        if ($_POST['post'] && !preg_match("/{$DeleteKeyPattern}/", $new['text'])) {
            $pagename = $basename;
            if (IsEnabled($EnableDraftAtomicDiff, 0)) {
                $page = ReadPage($basename);
                foreach ($new as $k => $v) {
                    # delete draft history
                    if (preg_match('/:\\d+(:\\d+:)?$/', $k) && !preg_match("/:{$Now}(:\\d+:)?\$/", $k)) {
                        unset($new[$k]);
                    }
                }
                unset($new['rev']);
                SDVA($new, $page);
            }
            $WikiDir->delete($draftname);
        } else {
            if (PageExists($draftname) && $pagename != $draftname) {
                Redirect($draftname, '$PageUrl?action=edit');
                exit;
            }
        }
    }
    if ($pagename == $draftname && isset($DraftRecentChangesFmt)) {
        $RecentChangesFmt = $DraftRecentChangesFmt;
    }
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:34,代码来源:draft.php

示例2: FPLByGroup

 function FPLByGroup($pagename, &$matches, $opt)
 {
     global $FPLByGroupStartFmt, $FPLByGroupEndFmt, $FPLByGroupGFmt, $FPLByGroupIFmt, $FPLByGroupOpt;
     SDV($FPLByGroupStartFmt, "<dl class='fplbygroup'>");
     SDV($FPLByGroupEndFmt, '</dl>');
     SDV($FPLByGroupGFmt, "<dt><a href='\$ScriptUrl/\$Group'>\$Group</a> /</dt>\n");
     SDV($FPLByGroupIFmt, "<dd><a href='\$PageUrl'>\$Name</a></dd>\n");
     SDVA($FPLByGroupOpt, array('readf' => 0, 'order' => 'name'));
     $matches = MakePageList($pagename, array_merge((array) $FPLByGroupOpt, $opt), 0);
     if (@$opt['count']) {
         array_splice($matches, $opt['count']);
     }
     if (count($matches) < 1) {
         return '';
     }
     $out = '';
     foreach ($matches as $pn) {
         $pgroup = FmtPageName($FPLByGroupGFmt, $pn);
         if ($pgroup != @$lgroup) {
             $out .= $pgroup;
             $lgroup = $pgroup;
         }
         $out .= FmtPageName($FPLByGroupIFmt, $pn);
     }
     return FmtPageName($FPLByGroupStartFmt, $pagename) . $out . FmtPageName($FPLByGroupEndFmt, $pagename);
 }
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:26,代码来源:transition.php

示例3: AuthUserId

function AuthUserId($pagename, $id, $pw = NULL)
{
    global $AuthUser, $AuthUserPageFmt, $AuthUserFunctions, $AuthId, $AuthList, $MessagesFmt;
    $auth = $AuthUser;
    $authid = '';
    # load information from Site.AuthUser (or page in $AuthUserPageFmt)
    SDV($AuthUserPageFmt, '$SiteGroup.AuthUser');
    SDVA($AuthUserFunctions, array('htpasswd' => 'AuthUserHtPasswd', 'ldap' => 'AuthUserLDAP', $id => 'AuthUserConfig'));
    $pn = FmtPageName($AuthUserPageFmt, $pagename);
    $apage = ReadPage($pn, READPAGE_CURRENT);
    if ($apage && preg_match_all("/\n\\s*([@\\w][^\\s:]*):(.*)/", $apage['text'], $matches, PREG_SET_ORDER)) {
        foreach ($matches as $m) {
            if (!preg_match_all('/\\bldap:\\S+|[^\\s,]+/', $m[2], $v)) {
                continue;
            }
            if ($m[1][0] == '@') {
                foreach ($v[0] as $g) {
                    $auth[$g][] = $m[1];
                }
            } else {
                $auth[$m[1]] = array_merge((array) @$auth[$m[1]], $v[0]);
            }
        }
    }
    if (is_null($pw)) {
        $authid = $id;
    } else {
        foreach ($AuthUserFunctions as $k => $fn) {
            if ($auth[$k] && $fn($pagename, $id, $pw, $auth[$k])) {
                $authid = $id;
                break;
            }
        }
    }
    if (!$authid) {
        $GLOBALS['InvalidLogin'] = 1;
        return;
    }
    if (!isset($AuthId)) {
        $AuthId = $authid;
    }
    @session_start();
    $_SESSION['authid'] = $authid;
    $_SESSION['authlist']["id:{$authid}"] = 1;
    $_SESSION['authlist']["id:-{$authid}"] = -1;
    $_SESSION['authlist']["id:*"] = 1;
    foreach ((array) @$auth[$authid] as $g) {
        if ($g[0] == '@') {
            @($_SESSION['authlist'][$g] = 1);
        }
    }
    foreach ((array) @$auth['*'] as $g) {
        if ($g[0] == '@') {
            @($_SESSION['authlist'][$g] = 1);
        }
    }
    $AuthList = array_merge($AuthList, $_SESSION['authlist']);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:58,代码来源:authuser.php

示例4: AuthUserId

function AuthUserId($pagename, $id, $pw=NULL) {
  global $AuthUser, $AuthUserPageFmt, $AuthUserFunctions, 
    $AuthId, $MessagesFmt, $AuthUserPat;

  $auth = array();
  foreach((array)$AuthUser as $k=>$v) $auth[$k] = (array)$v;
  $authid = '';

  # load information from SiteAdmin.AuthUser (or page in $AuthUserPageFmt)
  SDV($AuthUserPageFmt, '$SiteAdminGroup.AuthUser');
  SDVA($AuthUserFunctions, array(
    'htpasswd' => 'AuthUserHtPasswd',
    'ldap' => 'AuthUserLDAP',
#    'mysql' => 'AuthUserMySQL',
    $id => 'AuthUserConfig'));

  SDV($AuthUserPat, "/^\\s*([@\\w][^\\s:]*):(.*)/m");
  $pn = FmtPageName($AuthUserPageFmt, $pagename);
  $apage = ReadPage($pn, READPAGE_CURRENT);
  if ($apage && preg_match_all($AuthUserPat, 
                               $apage['text'], $matches, PREG_SET_ORDER)) {
    foreach($matches as $m) {
      if (!preg_match_all('/\\bldaps?:\\S+|[^\\s,]+/', $m[2], $v))
        continue;
      if ($m[1]{0} == '@') 
        foreach($v[0] as $g) $auth[$g][] = $m[1];
      else $auth[$m[1]] = array_merge((array)@$auth[$m[1]], $v[0]);
    }
  }

  if (func_num_args()==2) $authid = $id;
  else
    foreach($AuthUserFunctions as $k => $fn) 
      if (@$auth[$k] && $fn($pagename, $id, $pw, $auth[$k], $authlist)) 
        { $authid = $id; break; }

  if (!$authid) { $GLOBALS['InvalidLogin'] = 1; return; }
  if (!isset($AuthId)) $AuthId = $authid;
  $authlist["id:$authid"] = 1;
  $authlist["id:-$authid"] = -1;
  foreach(preg_grep('/^@/', (array)@$auth[$authid]) as $g) 
    $authlist[$g] = 1;
  foreach(preg_grep('/^@/', (array)@$auth['*']) as $g) 
    $authlist[$g] = 1;
  foreach(preg_grep('/^@/', array_keys($auth)) as $g) # useless? PITS:01201
    if (in_array($authid, $auth[$g])) $authlist[$g] = 1;
  if ($auth['htgroup']) {
    foreach(AuthUserHtGroup($pagename, $id, $pw, $auth['htgroup']) as $g)
      $authlist["@$g"] = 1;
  }
  foreach(preg_grep('/^@/', (array)@$auth["-$authid"]) as $g) 
    unset($authlist[$g]);
  SessionAuth($pagename, array('authid' => $authid, 'authlist' => $authlist));
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:54,代码来源:authuser.php

示例5: FPLGroup

function FPLGroup($pagename, &$matches, $opt)
{
    global $FPLGroupStartFmt, $FPLGroupIFmt, $FPLGroupEndFmt, $FPLGroupOpt;
    SDV($FPLGroupStartFmt, "<ul class='fplgroup'>");
    SDV($FPLGroupEndFmt, "</ul>");
    SDV($FPLGroupIFmt, "<li><a href='\$ScriptUrl/\$Group'>\$Group</a></li>");
    SDVA($FPLGroupOpt, array('readf' => 0, 'order' => 'name'));
    $matches = MakePageList($pagename, array_merge((array) $FPLGroupOpt, $opt));
    $out = array();
    foreach ($matches as $pc) {
        $group = preg_replace('/\\.[^.]+$/', '', $pc['pagename']);
        if (@(!$seen[$group]++)) {
            $out[] = FmtPageName($FPLGroupIFmt, $pc['pagename']);
            if ($opt['count'] && count($out) >= $opt['count']) {
                break;
            }
        }
    }
    return FmtPageName($FPLGroupStartFmt, $pagename) . implode('', $out) . FmtPageName($FPLGroupEndFmt, $pagename);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:20,代码来源:pagelist.php

示例6: IncludeText

function IncludeText($pagename, $inclspec) {
  global $MaxIncludes, $IncludeOpt, $InclCount;
  SDV($MaxIncludes,50);
  SDVA($IncludeOpt, array('self'=>1));
  $npat = '[[:alpha:]][-\\w]*';
  if ($InclCount++>=$MaxIncludes) return Keep($inclspec);
  $args = array_merge($IncludeOpt, ParseArgs($inclspec));
  while (count($args['#'])>0) {
    $k = array_shift($args['#']); $v = array_shift($args['#']);
    if ($k=='') {
      preg_match('/^([^#\\s]*)(.*)$/', $v, $match);
      if ($match[1]) {                                 # include a page
        if (isset($itext)) continue;
        $iname = MakePageName($pagename, $match[1]);
        if (!$args['self'] && $iname == $pagename) continue;
        if (!PageExists($iname)) continue;
        $ipage = RetrieveAuthPage($iname, 'read', false, READPAGE_CURRENT);
        $itext = @$ipage['text'];
      }
      if (preg_match("/^#($npat)?(\\.\\.)?(#($npat)?)?$/", $match[2], $m)) {
        @list($x, $aa, $dots, $b, $bb) = $m;
        if (!$dots && !$b) $bb = $npat;
        if ($aa)
          $itext=preg_replace("/^.*?\n([^\n]*\\[\\[#$aa\\]\\])/s",
                              '$1', $itext, 1);
        if ($bb)
          $itext=preg_replace("/(\n)[^\n]*\\[\\[#$bb\\]\\].*$/s",
                              '$1', $itext, 1);
      }
      continue;
    }
    if (in_array($k, array('line', 'lines', 'para', 'paras'))) {
      preg_match('/^(\\d*)(\\.\\.(\\d*))?$/', $v, $match);
      @list($x, $a, $dots, $b) = $match;
      $upat = ($k{0} == 'p') ? ".*?(\n\\s*\n|$)" : "[^\n]*(?:\n|$)";
      if (!$dots) { $b=$a; $a=0; }
      if ($a>0) $a--;
      $itext=preg_replace("/^(($upat){0,$b}).*$/s",'$1',$itext,1);
      $itext=preg_replace("/^($upat){0,$a}/s",'',$itext,1);
      continue;
    }
  }
  $basepage = isset($args['basepage']) 
              ? MakePageName($pagename, $args['basepage'])
              : $iname;
  if ($basepage) $itext = Qualify(@$basepage, @$itext);
  return PVS(htmlspecialchars($itext, ENT_NOQUOTES));
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:48,代码来源:pmwiki.php

示例7: Blocklist

function Blocklist($pagename, $text) {
  global $BlocklistPages, $BlockedMessagesFmt, $BlocklistDownload,
    $BlocklistDownloadRefresh, $Now, $EnablePost, $WhyBlockedFmt,
    $MessagesFmt, $BlocklistMessageFmt, $EnableWhyBlocked, $IsBlocked;

  StopWatch("Blocklist: begin $pagename");

  $BlocklistDownload = (array)@$BlocklistDownload;
  SDV($BlocklistPages, 
    array_merge(array('$SiteAdminGroup.Blocklist', 
                      '$SiteAdminGroup.Blocklist-Farm'),
                array_keys($BlocklistDownload)));
  SDV($BlocklistMessageFmt, "<h3 class='wikimessage'>$[This post has been blocked by the administrator]</h3>");
  SDVA($BlockedMessagesFmt, array(
    'ip' => '$[Address blocked from posting]: ',
    'text' => '$[Text blocked from posting]: '));
  SDV($BlocklistDownloadRefresh, 86400);

  ##  Loop over all blocklist pages
  foreach((array)$BlocklistPages as $b) {

    ##  load the current blocklist page
    $pn = FmtPageName($b, $pagename);
    $page = ReadPage($pn, READPAGE_CURRENT);
    if (!$page) continue;

    ##  if the page being checked is a blocklist page, stop blocking
    if ($pagename == $pn) return;

    ##  If the blocklist page is managed by automatic download,
    ##  schedule any new downloads here
    if (@$BlocklistDownload[$pn]) {
      $bd = &$BlocklistDownload[$pn];
      SDVA($bd, array(
        'refresh' => $BlocklistDownloadRefresh,
        'url' => "http://www.pmwiki.org/blocklists/$pn" ));
      if (!@$page['text'] || $page['time'] < $Now - $bd['refresh'])
        register_shutdown_function('BlocklistDownload', $pn, getcwd());
    }

    ##  If the blocklist is simply a list of regexes to be matched, load 
    ##  them into $terms['block'] and continue to the next blocklist page.
    ##  Some regexes from remote sites aren't well-formed, so we have
    ##  to escape any slashes that aren't already escaped.
    if (strpos(@$page['text'], 'blocklist-format: regex') !==false) {
      if (preg_match_all('/^([^\\s#].+)/m', $page['text'], $match)) 
        foreach($match[0] as $m) {
          $m = preg_replace('#(?<!\\\\)/#', '\\/', trim($m));
          $terms['block'][] = "/$m/";
        }
      continue;
    }

    ##  Treat the page as a pmwiki-format blocklist page, with
    ##  IP addresses and "block:"-style declarations.  First, see
    ##  if we need to block the author based on a.b.c.d or a.b.c.*
    ##  IP addresses.
    $ip = preg_quote($_SERVER['REMOTE_ADDR']);
    $ip = preg_replace('/\\d+$/', '($0\\b|\\*)', $ip);
    if (preg_match("/\\b$ip/", @$page['text'], $match)) {
      $EnablePost = 0;
      $IsBlocked = 1;
      $WhyBlockedFmt[] = $BlockedMessagesFmt['ip'] . $match[0];
    }

    ##  Now we'll load any "block:" or "unblock:" specifications
    ##  from the page text.
    if (preg_match_all('/(un)?(?:block|regex):(.*)/', @$page['text'], 
                       $match, PREG_SET_ORDER)) 
      foreach($match as $m) $terms[$m[1].'block'][] = trim($m[2]);
  }

  ##  okay, we've loaded all of the terms, now subtract any 'unblock'
  ##  terms from the block set.
  StopWatch("Blocklist: diff unblock");
  $blockterms = array_diff((array)@$terms['block'], (array)@$terms['unblock']);

  ##  go through each of the remaining blockterms and see if it matches the
  ##  text -- if so, disable posting and add a message to $WhyBlockedFmt.
  StopWatch('Blocklist: blockterms (count='.count($blockterms).')');
  $itext = strtolower($text);
  foreach($blockterms as $b) {
    if ($b{0} == '/') {
      if (!preg_match($b, $text)) continue;
    } else if (strpos($itext, strtolower($b)) === false) continue;
    $EnablePost = 0;
    $IsBlocked = 1;
    $WhyBlockedFmt[] = $BlockedMessagesFmt['text'] . $b;
  }
  StopWatch('Blocklist: blockterms done');

  ##  If we came across any reasons to block, let's provide a message
  ##  to the author that it was blocked.  If $EnableWhyBlocked is set,
  ##  we'll even tell the author why.  :-)
  if (@$WhyBlockedFmt) {
    $MessagesFmt[] = $BlocklistMessageFmt;
    if (IsEnabled($EnableWhyBlocked, 0)) 
      foreach((array)$WhyBlockedFmt as $why) 
        $MessagesFmt[] = "<pre class='blocklistmessage'>$why</pre>\n";
  }
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:101,代码来源:blocklist.php

示例8: HandleFeed

function HandleFeed($pagename, $auth = 'read')
{
    global $FeedFmt, $action, $PCache, $FmtV, $ISOTimeFmt, $RSSTimeFmt, $FeedOpt, $FeedDescPatterns, $CategoryGroup, $EntitiesTable;
    SDV($ISOTimeFmt, '%Y-%m-%dT%H:%M:%SZ');
    SDV($RSSTimeFmt, 'D, d M Y H:i:s \\G\\M\\T');
    SDV($FeedDescPatterns, array('/<[^>]*$/' => ' ', '/\\w+$/' => '', '/<[^>]+>/' => ''));
    SDVA($FeedCategoryOpt, array('link' => $pagename, 'readf' => 1));
    SDVA($FeedTrailOpt, array('trail' => $pagename, 'count' => 10, 'readf' => 1));
    $f = $FeedFmt[$action];
    $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
    if (!$page) {
        Abort("?cannot generate feed");
    }
    $feedtime = $page['time'];
    # determine list of pages to display
    if (@($_REQUEST['trail'] || $_REQUEST['group'] || $_REQUEST['link'])) {
        $opt['readf'] = 1;
    } else {
        if ($action == 'dc') {
            $opt = array();
        } else {
            if (preg_match("/^{$CategoryGroup}\\./", $pagename)) {
                $opt = $FeedCategoryOpt;
            } else {
                $opt = $FeedTrailOpt;
            }
        }
    }
    if (!$opt) {
        PCache($pagename, $page);
        $pagelist = array(&$PCache[$pagename]);
    } else {
        $opt = array_merge($opt, @$_REQUEST);
        $pagelist = MakePageList($pagename, $opt);
    }
    # process list of pages in feed
    $rdfseq = '';
    foreach ($pagelist as $page) {
        $pn = $page['name'];
        if (!PageExists($pn)) {
            continue;
        }
        $pl[] = $pn;
        if (@$opt['count'] && count($pl) >= $opt['count']) {
            break;
        }
        $rdfseq .= FmtPageName("<rdf:li resource=\"\$PageUrl\" />\n", $pn);
        if ($page['time'] > $feedtime) {
            $feedtime = $page['time'];
        }
    }
    $pagelist = $pl;
    $FmtV['$FeedRDFSeq'] = $rdfseq;
    $FmtV['$FeedISOTime'] = gmstrftime($ISOTimeFmt, $feedtime);
    $FmtV['$FeedRSSTime'] = gmdate($RSSTimeFmt, $feedtime);
    # format start of feed
    $out = FmtPageName($f['feed']['_start'], $pagename);
    # format feed elements
    foreach ($f['feed'] as $k => $v) {
        if ($k[0] == '_' || !$v) {
            continue;
        }
        $x = FmtPageName($v, $pagename);
        if (!$x) {
            continue;
        }
        $out .= $v[0] == '<' ? $x : "<{$k}>{$x}</{$k}>\n";
    }
    # format items in feed
    if (@$f['feed']['_items']) {
        $out .= FmtPageName($f['feed']['_items'], $pagename);
    }
    foreach ($pagelist as $pn) {
        $page =& $PCache[$pn];
        $FmtV['$ItemDesc'] = @$page['description'] ? $page['description'] : trim(preg_replace(array_keys($FeedDescPatterns), array_values($FeedDescPatterns), @$page['excerpt']));
        $FmtV['$ItemISOTime'] = gmstrftime($ISOTimeFmt, $page['time']);
        $out .= FmtPageName($f['item']['_start'], $pn);
        foreach ((array) @$f['item'] as $k => $v) {
            if ($k[0] == '_' || !$v) {
                continue;
            }
            if (is_callable($v)) {
                $out .= $v($pn, $page, $k);
                continue;
            }
            if (strpos($v, '$LastModifiedBy') !== false && !@$page['author']) {
                continue;
            }
            if (strpos($v, '$Category') !== false) {
                if (preg_match_all("/(?<=^|,){$CategoryGroup}\\.([^,]+)/", @$page['targets'], $match)) {
                    foreach ($match[1] as $c) {
                        $FmtV['$Category'] = $c;
                        $out .= FmtPageName($v, $pn);
                    }
                }
                continue;
            }
            $x = FmtPageName($v, $pn);
            if (!$x) {
                continue;
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:101,代码来源:feeds.php

示例9: recode

 function recode($pagename, $a) {
   if(!$a) return false;
   global $Charset, $PageRecodeFunction, $DefaultPageCharset, $EnableOldCharset;
   if (function_exists($PageRecodeFunction)) return $PageRecodeFunction($a);
   if (IsEnabled($EnableOldCharset)) $a['=oldcharset'] = @$a['charset'];
   SDVA($DefaultPageCharset, array(''=>@$Charset)); # pre-2.2.31 RecentChanges
   if (@$DefaultPageCharset[$a['charset']]>'')  # wrong pre-2.2.30 encs. *-2, *-9, *-13
     $a['charset'] = $DefaultPageCharset[@$a['charset']];
   if (!$a['charset'] || $Charset==$a['charset']) return $a;
   $from = ($a['charset']=='ISO-8859-1') ? 'WINDOWS-1252' : $a['charset'];
   $to = ($Charset=='ISO-8859-1') ? 'WINDOWS-1252' : $Charset;
   if ($this->recodefn) $F = $this->recodefn;
   elseif ($to=='UTF-8' && $from=='WINDOWS-1252') # utf8 wiki & pre-2.2.30 doc
     $F = create_function('$s,$from,$to', 'return utf8_encode($s);');
   elseif ($to=='WINDOWS-1252' && $from=='UTF-8') # 2.2.31+ documentation
     $F = create_function('$s,$from,$to', 'return utf8_decode($s);');
   else return $a;
   foreach($a as $k=>$v) $a[$k] = $F($v,$from,$to);
   $a['charset'] = $Charset;
   return $a;
 }
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:21,代码来源:pmwiki.php

示例10: Markup

    the ancestry of the TrailPage to the current one.  The <|TrailPage|> 
    markup is like <<|TrailPage|>> except that "< PrevPage |" and 
    "| NextPage >" are omitted if at the beginning or end of the 
    trail respectively.  Thanks to John Rankin for contributing these
    markups and the original suggestion for WikiTrails.
*/

Markup('<<|','<links','/&lt;&lt;\\|([^|]+|\\[\\[(.+?)\\]\\])\\|&gt;&gt;/e',
  "MakeTrailStop(\$pagename,'$1')");
Markup('<|','><<|','/&lt;\\|([^|]+|\\[\\[(.+?)\\]\\])\\|&gt;/e',
  "MakeTrailStopB(\$pagename,'$1')");
Markup('^|','<links','/\\^\\|([^|]+|\\[\\[(.+?)\\]\\])\\|\\^/e',
  "MakeTrailPath(\$pagename,'$1')");

SDVA($SaveAttrPatterns, array(
   '/<<\\|([^|]+|\\[\\[(.+?)\\]\\])\\|>>/' => '$1',
   '/<\\|([^|]+|\\[\\[(.+?)\\]\\])\\|>/' => '$1',
   '/\\^\\|([^|]+|\\[\\[(.+?)\\]\\])\\|\\^/' => '$1'));

$Conditions['ontrail'] = 'CondOnTrail($pagename, $condparm)';

function CondOnTrail($pagename, $condparm) {
  @list($trailname, $pn) = preg_split('/\\s+/', $condparm, 2);
  $trail = ReadTrail($pagename, $trailname);
  if (!$trail) return false;
  $pn = ($pn > '') ? MakePageName($pagename, $pn) : $pagename;
  foreach($trail as $t)
    if ($t['pagename'] == $pn) return true;
  return false;
}

function ReadTrail($pagename, $trailname) {
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:32,代码来源:trails.php

示例11: foreach

    foreach (array('left', 'right', 'center', 'justify') as $c) {
        SDV($WikiStyle[$c], array('apply' => 'block', 'text-align' => $c));
    }
    ## frames, floating frames, and floats
    SDV($HTMLStylesFmt['wikistyles'], " \n    .frame \n      { border:1px solid #cccccc; padding:4px; background-color:#f9f9f9; }\n    .lfloat { float:left; margin-right:0.5em; }\n    .rfloat { float:right; margin-left:0.5em; }\n");
    SDV($WikiStyle['thumb'], array('width' => '100px'));
    SDV($WikiStyle['frame'], array('class' => 'frame'));
    SDV($WikiStyle['lframe'], array('class' => 'frame lfloat'));
    SDV($WikiStyle['rframe'], array('class' => 'frame rfloat'));
    SDV($WikiStyle['cframe'], array('class' => 'frame', 'margin-left' => 'auto', 'margin-right' => 'auto', 'width' => '200px', 'apply' => 'block', 'text-align' => 'center'));
    ##  preformatted text sections
    SDV($WikiStyle['pre'], array('apply' => 'block', 'white-space' => 'pre'));
    SDV($WikiStyle['sidehead'], array('apply' => 'block', 'class' => 'sidehead'));
}
SDVA($WikiStyleAttr, array('vspace' => 'img', 'hspace' => 'img', 'align' => 'img', 'value' => 'li', 'target' => 'a', 'accesskey' => 'a', 'rel' => 'a'));
SDVA($WikiStyleRepl, array('/^%(.*)%$/' => '$1', '/\\bbgcolor([:=])/' => 'background-color$1', '/\\b(\\d+)pct\\b/' => '$1%'));
$WikiStyleCSS[] = 'color|background-color';
$WikiStyleCSS[] = 'text-align|text-decoration';
$WikiStyleCSS[] = 'font-size|font-family|font-weight|font-style';
SDV($imgTag, '(?:img|object|embed)');
SDV($aTag, 'a');
SDV($spanTag, 'span');
function ApplyStyles($x)
{
    global $UrlExcludeChars, $WikiStylePattern, $WikiStyleRepl, $WikiStyle, $WikiStyleAttr, $WikiStyleCSS, $WikiStyleApply, $BlockPattern, $WikiStyleTag, $imgTag, $aTag, $spanTag, $WikiStyleAttrPrefix;
    $wt = @$WikiStyleTag;
    $ns = $WikiStyleAttrPrefix;
    $ws = '';
    $x = PPRE("/\\b(href|src)=(['\"]?)[^{$UrlExcludeChars}]+\\2/", "Keep(\$m[0])", $x);
    $x = PPRE("/\\bhttps?:[^{$UrlExcludeChars}]+/", "Keep(\$m[0])", $x);
    $parts = preg_split("/({$WikiStylePattern})/", $x, -1, PREG_SPLIT_DELIM_CAPTURE);
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:31,代码来源:wikistyles.php

示例12: MakeLink

                $out .= "</ul></li>";
            }
            $group = $matches[1];
            $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;
        }
开发者ID:pmskin,项目名称:pmwiki-bootstrap-skin,代码行数:31,代码来源:skin.php

示例13: SDV

    This script adds upload capabilities to PmWiki.  Uploads can be
    enabled by setting
        $EnableUpload = 1;
    in config.php.  In addition, an upload password must be set, as
    the default is to lock uploads.  In some configurations it may also
    be necessary to set values for $UploadDir and $UploadUrlFmt,
    especially if any form of URL rewriting is being performed.
    See the PmWiki.UploadsAdmin page for more information.
*/
## $EnableUploadOverwrite determines if we allow previously uploaded
## files to be overwritten.
SDV($EnableUploadOverwrite, 1);
## $UploadExts contains the list of file extensions we're willing to
## accept, along with the Content-Type: value appropriate for each.
SDVA($UploadExts, array('gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'bmp' => 'image/bmp', 'ico' => 'image/x-icon', 'wbmp' => 'image/vnd.wap.wbmp', 'mp3' => 'audio/mpeg', 'au' => 'audio/basic', 'wav' => 'audio/x-wav', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mov' => 'video/quicktime', 'qt' => 'video/quicktime', 'wmf' => 'text/plain', 'avi' => 'video/x-msvideo', 'zip' => 'application/zip', 'gz' => 'application/x-gzip', 'tgz' => 'application/x-gzip', 'rpm' => 'application/x-rpm', 'hqx' => 'application/mac-binhex40', 'sit' => 'application/x-stuffit', 'doc' => 'application/msword', 'ppt' => 'application/vnd.ms-powerpoint', 'xls' => 'application/vnd.ms-excel', 'mdb' => 'text/plain', 'exe' => 'application/octet-stream', 'pdf' => 'application/pdf', 'psd' => 'text/plain', 'ps' => 'application/postscript', 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'htm' => 'text/html', 'html' => 'text/html', 'css' => 'text/css', 'fla' => 'application/x-shockwave-flash', 'swf' => 'application/x-shockwave-flash', 'txt' => 'text/plain', 'rtf' => 'application/rtf', 'tex' => 'application/x-tex', 'dvi' => 'application/x-dvi', '' => 'text/plain'));
SDV($UploadMaxSize, 50000);
SDV($UploadPrefixQuota, 0);
SDV($UploadDirQuota, 0);
foreach ($UploadExts as $k => $v) {
    if (!isset($UploadExtSize[$k])) {
        $UploadExtSize[$k] = $UploadMaxSize;
    }
}
SDV($UploadDir, 'uploads');
SDV($UploadPrefixFmt, '/$Group');
SDV($UploadFileFmt, "{$UploadDir}{$UploadPrefixFmt}");
SDV($UploadUrlFmt, preg_replace('#/[^/]*$#', "/{$UploadDir}", $ScriptUrl, 1));
SDV($LinkUploadCreateFmt, "<a class='createlinktext' href='\$LinkUrl'>\$LinkText</a><a class='createlink' href='\$LinkUrl'>&nbsp;&#8657;</a>");
SDV($PageUploadFmt, array("\n  <h2 class='wikiaction'>\$[Attachments for] \$PageName</h2>\n  <h3>\$UploadResult</h3>\n  <form enctype='multipart/form-data' action='\$ScriptUrl' method='post'>\n  <input type='hidden' name='pagename' value='\$PageName' />\n  <input type='hidden' name='action' value='postupload' />\n  <table border='0'>\n    <tr><td align='right'>\$[File to upload:]</td><td><input\n      name='uploadfile' type='file' /></td></tr>\n    <tr><td align='right'>\$[Name attachment as:]</td>\n      <td><input type='text' name='upname' value='\$UploadName' />\n        <input type='submit' value=' \$[Upload] ' /><br />\n        </td></tr></table></form>", 'wiki:$[PmWiki.UploadQuickReference]'));
XLSDV('en', array('ULsuccess' => 'successfully uploaded', 'ULbadname' => 'invalid attachment name', 'ULbadtype' => '\'$upext\' is not an allowed file extension', 'ULtoobig' => 'file is larger than maximum allowed by webserver', 'ULtoobigext' => 'file is larger than allowed maximum of $upmax
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:30,代码来源:upload.php

示例14: SDVA

<?php

if (!defined('PmWiki')) {
    exit;
}
/*  Copyright 2005-2011 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.
*/
global $HTTPHeaders, $Charset, $DefaultPageCharset;
$HTTPHeaders[] = "Content-type: text/html; charset=iso-8859-13;";
$Charset = "ISO-8859-13";
SDVA($DefaultPageCharset, array('ISO-8859-1' => $Charset));
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:15,代码来源:xlpage-iso-8859-13.php

示例15: MakePageList

function MakePageList($pagename, $opt, $retpages = 1)
{
    global $MakePageListOpt, $SearchPatterns, $EnablePageListProtect, $PCache, $FmtV;
    StopWatch('MakePageList begin');
    SDVA($MakePageListOpt, array('list' => 'default'));
    $opt = array_merge((array) $MakePageListOpt, $opt);
    $readf = @$opt['readf'];
    # we have to read the page if order= is anything but name
    $order = @$opt['order'];
    $readf |= $order && $order != 'name' && $order != '-name';
    $pats = @(array) $SearchPatterns[$opt['list']];
    if (@$opt['group']) {
        $pats[] = FixGlob($opt['group'], '$1$2.*');
    }
    if (@$opt['name']) {
        $pats[] = FixGlob($opt['name'], '$1*.$2');
    }
    # inclp/exclp contain words to be included/excluded.
    $incl = array();
    $inclp = array();
    $inclx = false;
    $excl = array();
    $exclp = '';
    foreach ((array) @$opt[''] as $i) {
        $incl[] = $i;
    }
    foreach ((array) @$opt['+'] as $i) {
        $incl[] = $i;
    }
    foreach ((array) @$opt['-'] as $i) {
        $excl[] = $i;
    }
    foreach ($incl as $i) {
        $inclp[] = '$' . preg_quote($i) . '$i';
        $inclx |= preg_match('[^\\w\\x80-\\xff]', $i);
    }
    if ($excl) {
        $exclp = '$' . implode('|', array_map('preg_quote', $excl)) . '$i';
    }
    $searchterms = count($incl) + count($excl);
    $readf += $searchterms;
    # forced read if incl/excl
    if (@$opt['trail']) {
        $trail = ReadTrail($pagename, $opt['trail']);
        $list = array();
        foreach ($trail as $tstop) {
            $pn = $tstop['pagename'];
            $list[] = $pn;
            $tstop['parentnames'] = array();
            PCache($pn, $tstop);
        }
        foreach ($trail as $tstop) {
            $PCache[$tstop['pagename']]['parentnames'][] = @$trail[$tstop['parent']]['pagename'];
        }
    } else {
        $list = ListPages($pats);
    }
    if (IsEnabled($EnablePageListProtect, 1)) {
        $readf = 1000;
    }
    $matches = array();
    $FmtV['$MatchSearched'] = count($list);
    $terms = $incl ? PageIndexTerms($incl) : array();
    if (@$opt['link']) {
        $link = MakePageName($pagename, $opt['link']);
        $linkp = "/(^|,){$link}(,|\$)/i";
        $terms[] = " {$link} ";
        $readf++;
    }
    if ($terms) {
        $xlist = PageIndexGrep($terms, true);
        $a = count($list);
        $list = array_diff($list, $xlist);
        $a -= count($list);
        StopWatch("MakePageList: PageIndex filtered {$a} pages");
    }
    $xlist = array();
    StopWatch('MakePageList scanning ' . count($list) . " pages, readf={$readf}");
    foreach ((array) $list as $pn) {
        if ($readf) {
            $page = $readf >= 1000 ? RetrieveAuthPage($pn, 'read', false, READPAGE_CURRENT) : ReadPage($pn, READPAGE_CURRENT);
            if (!$page) {
                continue;
            }
            if (@$linkp && !preg_match($linkp, @$page['targets'])) {
                $xlist[] = $pn;
                continue;
            }
            if ($searchterms) {
                $text = $pn . "\n" . @$page['targets'] . "\n" . @$page['text'];
                if ($exclp && preg_match($exclp, $text)) {
                    continue;
                }
                foreach ($inclp as $i) {
                    if (!preg_match($i, $text)) {
                        if (!$inclx) {
                            $xlist[] = $pn;
                        }
                        continue 2;
                    }
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:101,代码来源:pagelist.php


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