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


PHP phutil_safe_html函数代码示例

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


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

示例1: restore

 public function restore($corpus)
 {
     if ($this->map) {
         $corpus = phutil_safe_html(str_replace(array_reverse(array_keys($this->map)), array_map('phutil_escape_html', array_reverse($this->map)), phutil_escape_html($corpus)));
     }
     return $corpus;
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:7,代码来源:PhutilRemarkupBlockStorage.php

示例2: renderInput

 protected function renderInput()
 {
     self::requireLib();
     $uri = new PhutilURI(PhabricatorEnv::getEnvConfig('phabricator.base-uri'));
     $protocol = $uri->getProtocol();
     $use_ssl = $protocol == 'https';
     return phutil_safe_html(recaptcha_get_html(PhabricatorEnv::getEnvConfig('recaptcha.public-key'), $error = null, $use_ssl));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:AphrontFormRecaptchaControl.php

示例3: overwriteStoredText

 public function overwriteStoredText($token, $new_text)
 {
     if ($this->isTextMode()) {
         $new_text = phutil_safe_html($new_text);
     }
     $this->storage->overwrite($token, $new_text);
     return $this;
 }
开发者ID:jasteele12,项目名称:prb_lint_tests,代码行数:8,代码来源:PhutilRemarkupEngine.php

示例4: renderExample

 public function renderExample()
 {
     $out = '';
     $out .= $this->renderTestThings('AphrontProgressBarView', 13, 10);
     $out .= $this->renderTestThings('AphrontGlyphBarView', 13, 10);
     $out .= $this->renderWeirdOrderGlyphBars();
     $out .= $this->renderAsciiStarBar();
     return phutil_safe_html($out);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:9,代码来源:PhabricatorAphrontBarExample.php

示例5: buildResources

 private function buildResources()
 {
     $css = array('application/config/config-template.css', 'application/config/setup-issue.css');
     $webroot = dirname(phutil_get_library_root('phabricator')) . '/webroot/';
     $resources = array();
     foreach ($css as $path) {
         $resources[] = phutil_tag('style', array('type' => 'text/css'), phutil_safe_html(Filesystem::readFile($webroot . '/rsrc/css/' . $path)));
     }
     return phutil_implode_html("\n", $resources);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:10,代码来源:PhabricatorConfigResponse.php

示例6: buildResources

 private function buildResources()
 {
     $paths = $this->getResources();
     $webroot = dirname(phutil_get_library_root('phabricator')) . '/webroot/';
     $resources = array();
     foreach ($paths as $path) {
         $resources[] = phutil_tag('style', array('type' => 'text/css'), phutil_safe_html(Filesystem::readFile($webroot . '/rsrc/' . $path)));
     }
     return phutil_implode_html("\n", $resources);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:10,代码来源:AphrontStandaloneHTMLResponse.php

示例7: restore

 public function restore($corpus, $text_mode = false)
 {
     if ($this->map) {
         if ($text_mode) {
             $corpus = str_replace(array_reverse(array_keys($this->map)), array_reverse($this->map), $corpus);
         } else {
             $corpus = phutil_safe_html(str_replace(array_reverse(array_keys($this->map)), array_map('phutil_escape_html', array_reverse($this->map)), phutil_escape_html($corpus)));
         }
     }
     return $corpus;
 }
开发者ID:lsubra,项目名称:libphutil,代码行数:11,代码来源:PhutilRemarkupBlockStorage.php

示例8: renderTemplate

 private function renderTemplate($__template__, array $__scope__)
 {
     chdir($this->getPath());
     ob_start();
     if (Filesystem::pathExists($this->getPath($__template__))) {
         // Fool lint.
         $__evil__ = 'extract';
         $__evil__($__scope__ + $this->getDefaultScope());
         require $this->getPath($__template__);
     }
     return phutil_safe_html(ob_get_clean());
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:12,代码来源:PhameBasicTemplateBlogSkin.php

示例9: didReceiveResult

 protected function didReceiveResult($result)
 {
     list($err, $stdout, $stderr) = $result;
     if (!$err && strlen($stdout)) {
         // Strip off fluff Pygments adds.
         $stdout = preg_replace('@^<div class="highlight"><pre>(.*)</pre></div>\\s*$@s', '\\1', $stdout);
         if ($this->scrub) {
             $stdout = preg_replace('/^.*\\n/', '', $stdout);
         }
         return phutil_safe_html($stdout);
     }
     throw new PhutilSyntaxHighlighterException($stderr, $err);
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:13,代码来源:PhutilDefaultSyntaxHighlighterEnginePygmentsFuture.php

示例10: getHighlightFuture

 public function getHighlightFuture($source)
 {
     $source = phutil_escape_html($source);
     // This highlighter isn't perfect but tries to do an okay job at getting
     // some of the basics at least. There's lots of room for improvement.
     $blocks = explode("\n\n", $source);
     foreach ($blocks as $key => $block) {
         if (preg_match('/^[^ ](?! )/m', $block)) {
             $blocks[$key] = $this->highlightBlock($block);
         }
     }
     $source = implode("\n\n", $blocks);
     $source = phutil_safe_html($source);
     return new ImmediateFuture($source);
 }
开发者ID:lsubra,项目名称:libphutil,代码行数:15,代码来源:PhutilDivinerSyntaxHighlighter.php

示例11: applyIntralineDiff

 public static function applyIntralineDiff($str, $intra_stack)
 {
     $buf = '';
     $p = $s = $e = 0;
     // position, start, end
     $highlight = $tag = $ent = false;
     $highlight_o = '<span class="bright">';
     $highlight_c = '</span>';
     $is_html = false;
     if ($str instanceof PhutilSafeHTML) {
         $is_html = true;
         $str = $str->getHTMLContent();
     }
     $n = strlen($str);
     for ($i = 0; $i < $n; $i++) {
         if ($p == $e) {
             do {
                 if (empty($intra_stack)) {
                     $buf .= substr($str, $i);
                     break 2;
                 }
                 $stack = array_shift($intra_stack);
                 $s = $e;
                 $e += $stack[1];
             } while ($stack[0] == 0);
         }
         if (!$highlight && !$tag && !$ent && $p == $s) {
             $buf .= $highlight_o;
             $highlight = true;
         }
         if ($str[$i] == '<') {
             $tag = true;
             if ($highlight) {
                 $buf .= $highlight_c;
             }
         }
         if (!$tag) {
             if ($str[$i] == '&') {
                 $ent = true;
             }
             if ($ent && $str[$i] == ';') {
                 $ent = false;
             }
             if (!$ent) {
                 $p++;
             }
         }
         $buf .= $str[$i];
         if ($tag && $str[$i] == '>') {
             $tag = false;
             if ($highlight) {
                 $buf .= $highlight_o;
             }
         }
         if ($highlight && ($p == $e || $i == $n - 1)) {
             $buf .= $highlight_c;
             $highlight = false;
         }
     }
     if ($is_html) {
         return phutil_safe_html($buf);
     }
     return $buf;
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:64,代码来源:ArcanistDiffUtils.php

示例12: addTaskToTree

 private function addTaskToTree($task)
 {
     $cdate = $this->getTaskCreatedDate($task);
     $date_created = phabricator_date($cdate, $this->viewer);
     $udate = $this->getTaskModifiedDate($task);
     $last_updated = phabricator_date($udate, $this->viewer);
     $status = $task->getStatus();
     $owner_link = $this->setOwnerLink($this->handles, $task);
     $priority = $this->getPriority($task);
     $priority_name = $this->getPriorityName($task);
     $is_open = ManiphestTaskStatus::isOpenStatus($task->getStatus());
     if ($this->blocker === true && $is_open === true) {
         $blockericon = $this->getIconforBlocker();
     } else {
         $blockericon = '';
     }
     if ($this->blocked === true && $is_open === true) {
         $blockedicon = $this->getIconforBlocked();
     } else {
         $blockedicon = '';
     }
     $output = array();
     $output[] = array(phutil_safe_html(phutil_tag('a', array('href' => '/' . $task->getMonogram(), 'class' => $status !== 'open' ? 'phui-tag-core-closed' : ''), array($this->buildTaskLink($task), $blockericon, $blockedicon))), $cdate, $date_created, $udate, $last_updated, $owner_link, $priority, $priority_name, $this->points, $status);
     return $output;
 }
开发者ID:kanarip,项目名称:phabricator-extensions-Sprint,代码行数:25,代码来源:TaskTableDataProvider.php

示例13: renderChangesetTable

 public final function renderChangesetTable($content)
 {
     $props = null;
     if ($this->shouldRenderPropertyChangeHeader()) {
         $props = $this->renderPropertyChangeHeader();
     }
     $notice = null;
     if ($this->getIsTopLevel()) {
         $force = !$content && !$props;
         $notice = $this->renderChangeTypeHeader($force);
     }
     $result = $notice . $props . $content;
     // TODO: Let the user customize their tab width / display style.
     // TODO: We should possibly post-process "\r" as well.
     // TODO: Both these steps should happen earlier.
     $result = str_replace("\t", '  ', $result);
     return phutil_safe_html($result);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:18,代码来源:DifferentialChangesetRenderer.php

示例14: loadContent

 private function loadContent(array $pastes)
 {
     $cache = new PhabricatorKeyValueDatabaseCache();
     $cache = new PhutilKeyValueCacheProfiler($cache);
     $cache->setProfiler(PhutilServiceProfiler::getInstance());
     $keys = array();
     foreach ($pastes as $paste) {
         $keys[] = $this->getContentCacheKey($paste);
     }
     $caches = $cache->getKeys($keys);
     $results = array();
     $need_raw = array();
     foreach ($pastes as $key => $paste) {
         $key = $this->getContentCacheKey($paste);
         if (isset($caches[$key])) {
             $paste->attachContent(phutil_safe_html($caches[$key]));
             $results[$paste->getID()] = $paste;
         } else {
             $need_raw[$key] = $paste;
         }
     }
     if (!$need_raw) {
         return $results;
     }
     $write_data = array();
     $need_raw = $this->loadRawContent($need_raw);
     foreach ($need_raw as $key => $paste) {
         $content = $this->buildContent($paste);
         $paste->attachContent($content);
         $write_data[$this->getContentCacheKey($paste)] = (string) $content;
         $results[$paste->getID()] = $paste;
     }
     $cache->setKeys($write_data);
     return $results;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:PhabricatorPasteQuery.php

示例15: renderTextChange

 public function renderTextChange($range_start, $range_len, $rows)
 {
     $hunk_starts = $this->getHunkStartLines();
     $context_not_available = null;
     if ($hunk_starts) {
         $context_not_available = javelin_tag('tr', array('sigil' => 'context-target'), phutil_tag('td', array('colspan' => 6, 'class' => 'show-more'), pht('Context not available.')));
     }
     $html = array();
     $old_lines = $this->getOldLines();
     $new_lines = $this->getNewLines();
     $gaps = $this->getGaps();
     $reference = $this->getRenderingReference();
     $left_id = $this->getOldChangesetID();
     $right_id = $this->getNewChangesetID();
     // "N" stands for 'new' and means the comment should attach to the new file
     // when stored, i.e. DifferentialInlineComment->setIsNewFile().
     // "O" stands for 'old' and means the comment should attach to the old file.
     $left_char = $this->getOldAttachesToNewFile() ? 'N' : 'O';
     $right_char = $this->getNewAttachesToNewFile() ? 'N' : 'O';
     $changeset = $this->getChangeset();
     $copy_lines = idx($changeset->getMetadata(), 'copy:lines', array());
     $highlight_old = $this->getHighlightOld();
     $highlight_new = $this->getHighlightNew();
     $old_render = $this->getOldRender();
     $new_render = $this->getNewRender();
     $original_left = $this->getOriginalOld();
     $original_right = $this->getOriginalNew();
     $depths = $this->getDepths();
     $mask = $this->getMask();
     for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) {
         if (empty($mask[$ii])) {
             // If we aren't going to show this line, we've just entered a gap.
             // Pop information about the next gap off the $gaps stack and render
             // an appropriate "Show more context" element. This branch eventually
             // increments $ii by the entire size of the gap and then continues
             // the loop.
             $gap = array_pop($gaps);
             $top = $gap[0];
             $len = $gap[1];
             $end = $top + $len - 20;
             $contents = array();
             if ($len > 40) {
                 $is_first_block = false;
                 if ($ii == 0) {
                     $is_first_block = true;
                 }
                 $contents[] = javelin_tag('a', array('href' => '#', 'mustcapture' => true, 'sigil' => 'show-more', 'meta' => array('ref' => $reference, 'range' => "{$top}-{$len}/{$top}-20")), $is_first_block ? pht('Show First 20 Lines') : pht("▲ Show 20 Lines"));
             }
             $contents[] = javelin_tag('a', array('href' => '#', 'mustcapture' => true, 'sigil' => 'show-more', 'meta' => array('type' => 'all', 'ref' => $reference, 'range' => "{$top}-{$len}/{$top}-{$len}")), pht('Show All %d Lines', $len));
             $is_last_block = false;
             if ($ii + $len >= $rows) {
                 $is_last_block = true;
             }
             if ($len > 40) {
                 $contents[] = javelin_tag('a', array('href' => '#', 'mustcapture' => true, 'sigil' => 'show-more', 'meta' => array('ref' => $reference, 'range' => "{$top}-{$len}/{$end}-20")), $is_last_block ? pht('Show Last 20 Lines') : pht("▼ Show 20 Lines"));
             }
             $context = null;
             $context_line = null;
             if (!$is_last_block && $depths[$ii + $len]) {
                 for ($l = $ii + $len - 1; $l >= $ii; $l--) {
                     $line = $new_lines[$l]['text'];
                     if ($depths[$l] < $depths[$ii + $len] && trim($line) != '') {
                         $context = $new_render[$l];
                         $context_line = $new_lines[$l]['line'];
                         break;
                     }
                 }
             }
             $container = javelin_tag('tr', array('sigil' => 'context-target'), array(phutil_tag('td', array('colspan' => 2, 'class' => 'show-more'), phutil_implode_html(" • ", $contents)), phutil_tag('th', array('class' => 'show-context-line'), $context_line ? (int) $context_line : null), phutil_tag('td', array('colspan' => 3, 'class' => 'show-context'), phutil_safe_html($context))));
             $html[] = $container;
             $ii += $len - 1;
             continue;
         }
         $o_num = null;
         $o_classes = '';
         $o_text = null;
         if (isset($old_lines[$ii])) {
             $o_num = $old_lines[$ii]['line'];
             $o_text = isset($old_render[$ii]) ? $old_render[$ii] : null;
             if ($old_lines[$ii]['type']) {
                 if ($old_lines[$ii]['type'] == '\\') {
                     $o_text = $old_lines[$ii]['text'];
                     $o_class = 'comment';
                 } else {
                     if ($original_left && !isset($highlight_old[$o_num])) {
                         $o_class = 'old-rebase';
                     } else {
                         if (empty($new_lines[$ii])) {
                             $o_class = 'old old-full';
                         } else {
                             $o_class = 'old';
                         }
                     }
                 }
                 $o_classes = $o_class;
             }
         }
         $n_copy = hsprintf('<td class="copy" />');
         $n_cov = null;
         $n_colspan = 2;
//.........这里部分代码省略.........
开发者ID:denghp,项目名称:phabricator,代码行数:101,代码来源:DifferentialChangesetTwoUpRenderer.php


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