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


PHP PHSC函数代码示例

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


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

示例1: ReadTrail

function ReadTrail($pagename, $trailname) {
  global $RASPageName, $SuffixPattern, $GroupPattern, $WikiWordPattern,
    $LinkWikiWords;
  if (preg_match('/^\\[\\[(.+?)(->|\\|)(.+?)\\]\\]$/', $trailname, $m)) 
    $trailname = ($m[2] == '|') ? $m[1] : $m[3];
  $trailtext = RetrieveAuthSection($pagename, $trailname);
  $trailname = $RASPageName;
  $trailtext = Qualify($trailname, $trailtext);
  $t = array();
  $n = 0;
  foreach(explode("\n", PHSC(@$trailtext, ENT_NOQUOTES)) 
          as $x) {
    $x = preg_replace("/\\[\\[([^\\]]*)->([^\\]]*)\\]\\]/",'[[$2|$1]]',$x);
    if (!preg_match("/^([#*:]+) \\s* 
          (\\[\\[([^:#!|][^|:]*?)(?:\".*?\")?(\\|.*?)?\\]\\]($SuffixPattern)
          | (($GroupPattern([\\/.]))?$WikiWordPattern)) (.*)/x",$x,$match))
       continue;
    if (@$match[6]) {
       if (!$LinkWikiWords) continue;
       $tgt = MakePageName($trailname, $match[6]);
    } else $tgt = MakePageName($trailname, $match[3]);
    $t[$n]['depth'] = $depth = strlen($match[1]);
    $t[$n]['pagename'] = $tgt;
    $t[$n]['markup'] = $match[2];
    $t[$n]['detail'] = $match[9];
    for($i=$depth;$i<10;$i++) $d[$i]=$n;
    if ($depth>1) $t[$n]['parent']=@$d[$depth-1];
    $n++;
  }
  return $t;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:31,代码来源:trails.php

示例2: HandleCrypt

function HandleCrypt($pagename, $auth='read') {
  global $ScriptUrl,$HTMLStartFmt,$HTMLEndFmt;
  PrintFmt($pagename,$HTMLStartFmt);
  $passwd = stripmagic(@$_POST["passwd"]);
  echo FmtPageName(
    "<form action='{\$ScriptUrl}' method='POST'><p>
      Enter password to encrypt: 
      <input type='text' name='passwd' value='"
      . PHSC($passwd, ENT_QUOTES) ."' />
      <input type='submit' />
      <input type='hidden' name='n' value='{\$FullName}' />
      <input type='hidden' name='action' value='crypt' /></p></form>",
    $pagename);
  if ($passwd) { 
    $crypt = pmcrypt($passwd);
    echo "<p class='vspace'>Encrypted password = $crypt</p>"; 
    echo "<p class='vspace'>To set a site-wide password, insert the line below
      in your <i>config.php</i> file, <br />replacing <tt>'type'</tt> with
      one of <tt>'admin'</tt>, <tt>'read'</tt>, <tt>'edit'</tt>,
      or <tt>'attr'</tt>.  <br />See <a 
      href='$ScriptUrl?n=PmWiki.PasswordsAdmin'>PasswordsAdmin</a> for more
      details.</p>
      <pre class='vspace'>  \$DefaultPasswords['type']='$crypt';</pre>";
  }
  PrintFmt($pagename,$HTMLEndFmt);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:26,代码来源:crypt.php

示例3: ExportActionHandler

function ExportActionHandler($pagename, $auth)
{
    // read the page and sort keys chronologically
    $page = ReadPage($pagename);
    if (!$page || !$page['name']) {
        return;
    }
    krsort($page);
    reset($page);
    // start with the latest version
    $versions = [];
    $version['author'] = $page['author'];
    $version['timestamp'] = $page['time'];
    $version['source'] = utf8_encode($page['text']);
    array_push($versions, $version);
    // use the page's diff keys to restore markup for older version
    foreach ($page as $key => $value) {
        if (!preg_match("/^diff:(\\d+):(\\d+):?([^:]*)/", $key, $match)) {
            continue;
        }
        // ignore the original diff tag, which is is not a delta
        // ignore blank changes
        // ignore some rare dupes
        if ($match[1] === $match[2]) {
            continue;
        }
        if (@$page[$match[0]] === '') {
            continue;
        }
        if (array_search($match[2], array_column($versions, 'timestamp'))) {
            continue;
        }
        // metadata
        $diffgmt = $match[1];
        $diffauthor = @$page["author:{$diffgmt}"];
        if (!$diffauthor) {
            @($diffauthor = $page["host:{$diffgmt}"]);
        }
        if (!$diffauthor) {
            $diffauthor = "unknown";
        }
        $diffchangesum = PHSC(@$page["csum:{$diffgmt}"]);
        // page version
        $version = [];
        $version['author'] = $diffauthor;
        $version['timestamp'] = $match[2];
        $version['commit_message'] = $diffchangesum;
        $version['source'] = utf8_encode(RestorePage($pagename, $page, $new, $match[0]));
        array_push($versions, $version);
    }
    // finalize response
    $response['page_name'] = $pagename;
    $response['versions'] = $versions;
    $response = json_encode($response);
    echo $response;
}
开发者ID:ryanvarick,项目名称:pmwiki-export,代码行数:56,代码来源:export.php

示例4: PrintAttrForm

function PrintAttrForm($pagename) {
  global $PageAttributes, $PCache, $FmtV;
  echo FmtPageName("<form action='\$PageUrl' method='post'>
    <input type='hidden' name='action' value='postattr' />
    <input type='hidden' name='n' value='\$FullName' />
    <table>",$pagename);
  $page = $PCache[$pagename];
  foreach($PageAttributes as $attr=>$p) {
    if (!$p) continue;
    if (strncmp($attr, 'passwd', 6) == 0) {
      $setting = PageVar($pagename, '$Passwd'.ucfirst(substr($attr, 6)));
      $value = '';
    } else { $setting = $value = PHSC(@$page[$attr]); }
    $prompt = FmtPageName($p,$pagename);
    echo "<tr><td>$prompt</td>
      <td><input type='text' name='$attr' value='$value' /></td>
      <td>$setting</td></tr>";
  }
  echo FmtPageName("</table><input type='submit' value='$[Save]' /></form>",
         $pagename);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:21,代码来源:pmwiki.php

示例5: DiffRenderSource

function DiffRenderSource($in, $out, $which) {
  global $WordDiffFunction, $EnableDiffInline;
  if (!IsEnabled($EnableDiffInline, 1)) {
    $a = $which? $out : $in;
    return str_replace("\n","<br />",PHSC(join("\n",$a)));  
  }
  $countdifflines = abs(count($in)-count($out));
  $lines = $cnt = $x2 = $y2 = array();
  foreach($in as $line) {
    $tmp = $countdifflines>20 ? array($line) : DiffPrepareInline($line);
    if(!$which) $cnt[] = array(count($x2), count($tmp));
    $x2 = array_merge($x2, $tmp);
  }
  foreach($out as $line) {
    $tmp = $countdifflines>20 ? array($line) : DiffPrepareInline($line);
    if($which) $cnt[] = array(count($y2), count($tmp));
    $y2 = array_merge($y2, $tmp);
  }
  $z = $WordDiffFunction(implode("\n", $x2), implode("\n", $y2));

  $z2 = array_map('PHSC', ($which? $y2 : $x2));
  array_unshift($z2, '');
  foreach (explode("\n", $z) as $zz) {
    if (preg_match('/^(\\d+)(,(\\d+))?([adc])(\\d+)(,(\\d+))?/',$zz,$m)) {
      $a1 = $a2 = $m[1];
      if ($m[3]) $a2=$m[3];
      $b1 = $b2 = $m[5];
      if ($m[7]) $b2=$m[7];

      if (!$which && ($m[4]=='c'||$m[4]=='d')) {
        $z2[$a1] = '<del>'. $z2[$a1];
        $z2[$a2] .= '</del>';
      }
      if ($which && ($m[4]=='c'||$m[4]=='a')) {
        $z2[$b1] = '<ins>'.$z2[$b1];
        $z2[$b2] .= '</ins>';
      }
    }
  }
  $line = array_shift($z2);
  $z2[0] = $line.$z2[0];
  foreach ($cnt as $a) $lines[] = implode('', array_slice($z2, $a[0], $a[1]));
  $ret = implode("\n", $lines);
  $ret = str_replace(array('</del> <del>', '</ins> <ins>'), ' ', $ret);
  $ret = preg_replace('/(<(ins|del)>|^) /', '$1&nbsp;', $ret);
  return str_replace(array("  ", "\n ", "\n"),array("&nbsp; ", "<br />&nbsp;", "<br />"),$ret);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:47,代码来源:pagerev.php

示例6: HandleUpload

function HandleUpload($pagename, $auth = 'upload') {
  global $FmtV,$UploadExtMax, $EnableReadOnly,
    $HandleUploadFmt,$PageStartFmt,$PageEndFmt,$PageUploadFmt;
  UploadAuth($pagename, $auth, 1);
  $FmtV['$UploadName'] = MakeUploadName($pagename,@$_REQUEST['upname']);
  $upresult = PHSC(@$_REQUEST['upresult']);
  $uprname = PHSC(@$_REQUEST['uprname']);
  $FmtV['$upext'] = PHSC(@$_REQUEST['upext']);
  $FmtV['$upmax'] = PHSC(@$_REQUEST['upmax']);
  $FmtV['$UploadResult'] = ($upresult) ?
    FmtPageName("<i>$uprname</i>: $[UL$upresult]",$pagename) : 
      (@$EnableReadOnly ? XL('Cannot modify site -- $EnableReadOnly is set'): '');
  SDV($HandleUploadFmt,array(&$PageStartFmt,&$PageUploadFmt,&$PageEndFmt));
  PrintFmt($pagename,$HandleUploadFmt);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:15,代码来源:upload.php

示例7: InputDefault

function InputDefault($pagename, $type, $args) {
  global $InputValues, $PageTextVarPatterns, $PCache;
  $args = ParseArgs($args);
  $args[''] = (array)@$args[''];
  $name = (isset($args['name'])) ? $args['name'] : array_shift($args['']);
  $name = preg_replace('/^\\$:/', 'ptv_', $name);
  $value = (isset($args['value'])) ? $args['value'] : array_shift($args['']);
  if (!isset($InputValues[$name])) $InputValues[$name] = $value;
  if (@$args['request']) {
    $req = array_merge($_GET, $_POST);
    foreach($req as $k => $v) 
      if (!isset($InputValues[$k])) 
        $InputValues[$k] = PHSC(stripmagic($v), ENT_NOQUOTES);
  }
  $source = @$args['source'];
  if ($source) {
    $source = MakePageName($pagename, $source);
    $page = RetrieveAuthPage($source, 'read', false, READPAGE_CURRENT);
    if ($page) {
      foreach((array)$PageTextVarPatterns as $pat)
        if (preg_match_all($pat, IsEnabled($PCache[$source]['=preview'], $page['text']), 
          $match, PREG_SET_ORDER))
          foreach($match as $m)
            if (!isset($InputValues['ptv_'.$m[2]]))
              $InputValues['ptv_'.$m[2]] = 
                PHSC(Qualify($source, $m[3]), ENT_NOQUOTES);
    }
  }
  return '';
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:30,代码来源:forms.php

示例8: FPLTemplateFormat

function FPLTemplateFormat($pagename, $matches, $opt, $tparts, &$output){
  global $Cursor, $FPLTemplateMarkupFunction, $PCache;
  SDV($FPLTemplateMarkupFunction, 'MarkupToHTML');
  $savecursor = $Cursor;
  $pagecount = $groupcount = $grouppagecount = $traildepth = 0;
  $pseudovars = array('{$$PageCount}' => &$pagecount, 
                      '{$$GroupCount}' => &$groupcount, 
                      '{$$GroupPageCount}' => &$grouppagecount,
                      '{$$PageTrailDepth}' => &$traildepth);

  foreach(preg_grep('/^[\\w$]/', array_keys($opt)) as $k) 
    if (!is_array($opt[$k]))
      $pseudovars["{\$\$$k}"] = PHSC($opt[$k], ENT_NOQUOTES);

  $vk = array_keys($pseudovars);
  $vv = array_values($pseudovars);

  $lgroup = ''; $out = '';
  if(count($matches)==0 ) {
    $t = 0;
    while($t < count($tparts)) {
      if($tparts[$t]=='template' && $tparts[$t+2]=='none') {
         $out .= MarkupRestore(FPLExpandItemVars($tparts[$t+4], $matches, 0, $pseudovars));
         $t+=4;
      }
      $t++;
    }
  } # else:
  foreach($matches as $i => $pn) {
    $traildepth = intval(@$PCache[$pn]['depth']);
    $group = PageVar($pn, '$Group');
    if ($group != $lgroup) { $groupcount++; $grouppagecount = 0; $lgroup = $group; }
    $grouppagecount++; $pagecount++;

    $t = 0;
    while ($t < count($tparts)) {
      if ($tparts[$t] != 'template') { $item = $tparts[$t]; $t++; }
      else {
        list($neg, $when, $control, $item) = array_slice($tparts, $t+1, 4); $t+=5;
        if($when=='none') continue;
        if (!$control) {
          if ($when == 'first' && ($neg xor ($i != 0))) continue;
          if ($when == 'last' && ($neg xor ($i != count($matches) - 1))) continue;
        } else {
          if ($when == 'first' || !isset($last[$t])) {
            $curr = FPLExpandItemVars($control, $matches, $i, $pseudovars);
            if ($when == 'first' && ($neg xor (($i != 0) && ($last[$t] == $curr))))
              { $last[$t] = $curr; continue; }
            $last[$t] = $curr;
          }
          if ($when == 'last') {
            $next = FPLExpandItemVars($control, $matches, $i+1, $pseudovars);
            if ($neg xor ($next == $last[$t] && $i != count($matches) - 1)) continue;
            $last[$t] = $next;
          }
        }
      }
      $item = FPLExpandItemVars($item, $matches, $i, $pseudovars);
      $out .= MarkupRestore($item);
    }
  }

  $class = preg_replace('/[^-a-zA-Z0-9\\x80-\\xff]/', ' ', @$opt['class']);
  if ($class) $class = " class='$class'";
  $wrap = @$opt['wrap'];
  if ($wrap != 'inline') {
    $out = $FPLTemplateMarkupFunction($pagename, $out, array('escape' => 0, 'redirect'=>1));
    if ($wrap != 'none') $out = "<div$class>$out</div>";
  }
  $Cursor = $savecursor;
  $output .= $out;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:72,代码来源:pagelist.php

示例9: SDV

SDV($AuthorCookieExpires, $Now + 60 * 60 * 24 * 30);
SDV($AuthorCookieDir, '/');
SDV($AuthorGroup, 'Profiles');
SDV($AuthorRequiredFmt, "<h3 class='wikimessage'>\$[An author name is required.]</h3>");
Markup('[[~', '<links', '/\\[\\[~(.*?)\\]\\]/', "[[{$AuthorGroup}/\$1]]");
$LogoutCookies[] = $AuthorCookie;
if (!isset($Author)) {
    if (isset($_POST['author'])) {
        $x = stripmagic($_POST['author']);
        setcookie($AuthorCookie, $x, $AuthorCookieExpires, $AuthorCookieDir);
    } elseif (@$_COOKIE[$AuthorCookie]) {
        $x = stripmagic(@$_COOKIE[$AuthorCookie]);
    } else {
        $x = @$AuthId;
    }
    $Author = PHSC(preg_replace("/[^{$AuthorNameChars}]/", '', $x), ENT_COMPAT);
}
if (!isset($AuthorPage)) {
    $AuthorPage = FmtPageName('$AuthorGroup/$Name', MakePageName($pagename, $Author));
}
SDV($AuthorLink, $Author ? "[[~{$Author}]]" : '?');
if (IsEnabled($EnableAuthorSignature, 1)) {
    SDVA($ROSPatterns, array('/(?<!~)~~~~(?!~)/e' => "FmtPageName('[[~\$Author]] \$CurrentTime', \$pagename)", '/(?<!~)~~~(?!~)/e' => "FmtPageName('[[~\$Author]]', \$pagename)"));
    Markup('~~~~', '<[[~', '/(?<!~)~~~~(?!~)/', "[[~{$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)
开发者ID:LOZORD,项目名称:UPL-Website-Revamp,代码行数:31,代码来源:author.php

示例10: urldecode

    in pagenames, since there's no way to determine which UTF-8
    characters are "letters" and which are punctuation.
*/
global $HTTPHeaders, $KeepToken, $pagename, $GroupPattern, $NamePattern, $WikiWordPattern, $SuffixPattern, $PageNameChars, $MakePageNamePatterns, $CaseConversions, $StringFolding, $Charset, $HTMLHeaderFmt, $StrFoldFunction, $AsSpacedFunction;
$Charset = 'UTF-8';
$HTTPHeaders['utf-8'] = 'Content-type: text/html; charset=UTF-8';
$HTMLHeaderFmt['utf-8'] = "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
$pagename = @$_REQUEST['n'];
if (!$pagename) {
    $pagename = @$_REQUEST['pagename'];
}
if (!$pagename && preg_match('!^' . preg_quote($_SERVER['SCRIPT_NAME'], '!') . '/?([^?]*)!', $_SERVER['REQUEST_URI'], $match)) {
    $pagename = urldecode($match[1]);
}
$pagename = preg_replace('!/+$!', '', $pagename);
$FmtPV['$RequestedPage'] = "'" . PHSC($pagename, ENT_QUOTES) . "'";
$GroupPattern = '[\\w\\x80-\\xfe]+(?:-[\\w\\x80-\\xfe]+)*';
$NamePattern = '[\\w\\x80-\\xfe]+(?:-[\\w\\x80-\\xfe]+)*';
$WikiWordPattern = '[A-Z][A-Za-z0-9]*(?:[A-Z][a-z0-9]|[a-z0-9][A-Z])[A-Za-z0-9]*';
$SuffixPattern = '(?:-?[A-Za-z0-9\\x80-\\xd6]+)*';
SDV($PageNameChars, '-[:alnum:]\\x80-\\xfe');
SDV($MakePageNamePatterns, array('/[?#].*$/' => '', "/'/" => '', "/[^{$PageNameChars}]+/" => ' ', '/(?<=^| )([a-z])/e' => "strtoupper('\$1')", '/(?<=^| )([\\xc0-\\xdf].)/e' => "utf8toupper('\$1')", '/ /' => ''));
SDV($StrFoldFunction, 'utf8fold');
$AsSpacedFunction = 'AsSpacedUTF8';
function utf8toupper($x)
{
    global $CaseConversions;
    if (strlen($x) <= 2 && @$CaseConversions[$x]) {
        return $CaseConversions[$x];
    }
    static $lower, $upper;
开发者ID:LOZORD,项目名称:UPL-Website-Revamp,代码行数:31,代码来源:xlpage-utf-8.php

示例11: HandleUpload

function HandleUpload($pagename, $auth = 'upload')
{
    global $FmtV, $UploadExtMax, $HandleUploadFmt, $PageStartFmt, $PageEndFmt, $PageUploadFmt;
    UploadAuth($pagename, $auth, 1);
    $FmtV['$UploadName'] = MakeUploadName($pagename, @$_REQUEST['upname']);
    $upresult = PHSC(@$_REQUEST['upresult']);
    $uprname = PHSC(@$_REQUEST['uprname']);
    $FmtV['$upext'] = PHSC(@$_REQUEST['upext']);
    $FmtV['$upmax'] = PHSC(@$_REQUEST['upmax']);
    $FmtV['$UploadResult'] = $upresult ? FmtPageName("<i>{$uprname}</i>: \$[UL{$upresult}]", $pagename) : '';
    SDV($HandleUploadFmt, array(&$PageStartFmt, &$PageUploadFmt, &$PageEndFmt));
    PrintFmt($pagename, $HandleUploadFmt);
}
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:13,代码来源:upload.php

示例12: InputDefault

function InputDefault($pagename, $type, $args) {
  global $InputValues, $PageTextVarPatterns, $PCache;
  $args = ParseArgs($args);
  $args[''] = (array)@$args[''];
  $name = (isset($args['name'])) ? $args['name'] : array_shift($args['']);
  $name = preg_replace('/^\\$:/', 'ptv_', $name);
  $value = (isset($args['value'])) ? $args['value'] : $args[''];
  if (!isset($InputValues[$name])) $InputValues[$name] = $value;
  if (@$args['request']) {
    $req = RequestArgs();
    foreach($req as $k => $v) {
      if (is_array($v)) {
        foreach($v as $vk=>$vv) {
          if(is_numeric($vk)) $InputValues["{$k}[]"][] = PHSC($vv, ENT_NOQUOTES);
          else $InputValues["{$k}[{$vk}]"] = PHSC($vv, ENT_NOQUOTES);
        }
      }
      else {
        if (!isset($InputValues[$k])) 
          $InputValues[$k] = PHSC($v, ENT_NOQUOTES);
      }
    }
  }
  $sources = @$args['source'];
  if ($sources) {
    foreach(explode(',', $sources) as $source) {
      $source = MakePageName($pagename, $source);
      if (!PageExists($source)) continue;
      $page = RetrieveAuthPage($source, 'read', false, READPAGE_CURRENT);
      if (! $page || ! isset($page['text'])) continue;
      foreach((array)$PageTextVarPatterns as $pat)
        if (preg_match_all($pat, IsEnabled($PCache[$source]['=preview'], $page['text']), 
          $match, PREG_SET_ORDER))
          foreach($match as $m)
#           if (!isset($InputValues['ptv_'.$m[2]])) PITS:01337
              $InputValues['ptv_'.$m[2]] = 
                PHSC(Qualify($source, $m[3]), ENT_NOQUOTES);
      break;
    }
  }
  return '';
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:42,代码来源:forms.php


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