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


PHP Sanitizer::StripAllTags方法代码示例

本文整理汇总了PHP中Sanitizer::StripAllTags方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitizer::StripAllTags方法的具体用法?PHP Sanitizer::StripAllTags怎么用?PHP Sanitizer::StripAllTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sanitizer的用法示例。


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

示例1: RenderChemForm

function RenderChemForm($input, $argv)
{
    # add messages
    $link = false;
    $wikilink = false;
    $showthis = $input;
    $searchfor = $input;
    if (isset($argv["link"])) {
        $link = $argv["link"];
    }
    if (isset($argv["wikilink"])) {
        $wikilink = $argv["wikilink"];
    }
    if (isset($argv["query"])) {
        $searchfor = $argv["query"];
    }
    if (!$showthis) {
        $showthis = $searchfor;
    }
    $showthis = htmlentities(Sanitizer::StripAllTags($showthis));
    # tagstripping
    $showthis = preg_replace("/[0-9]+/", "<sub>\$0</sub>", $showthis);
    # All numbers down
    $showthis = preg_replace("/[\\+\\-]/", "<sup>\$0</sup>", $showthis);
    # + and - up
    $showthis = preg_replace("/<\\/sub><sup>/", "", $showthis);
    # </sub><sup> should not occur
    $showthis = preg_replace("/<sub>([0-9\\+\\-]+)<\\/sup>/", "<sup>\$1</sup>", $showthis);
    # and <sub>whatever</sup> to <sup>..</sup>
    $searchfor = htmlentities(Sanitizer::StripAllTags($searchfor));
    if (!($showthis . $searchfor)) {
        return wfMsg('chemFunctions_ChemFormInputError');
    }
    if ($link) {
        $title = SpecialPage::getTitleFor('Chemicalsources');
        $output = "<a href=\"" . $title->getFullUrl() . "?Formula=" . $searchfor . "\">" . $showthis . "</a>";
    } elseif ($wikilink) {
        $title = Title::makeTitleSafe(NS_MAIN, $searchfor);
        if ($title) {
            $revision = Revision::newFromTitle($title);
            if ($revision) {
                $output = "<a href=\"" . $title->getFullUrl() . "\">" . $showthis . "</a>";
            } else {
                $output = "<a href=\"" . $title->getFullUrl() . "?action=edit\" class=\"new\">" . $showthis . "</a>";
            }
        } else {
            $output = wfMsg('chemFunctions_ChemFormInputError');
        }
    } else {
        $output = $showthis;
    }
    return $output;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:53,代码来源:ChemFunctions.php

示例2: getNextResults

 public function getNextResults()
 {
     $this->wf->ProfileIn(__METHOD__);
     $this->response->setVal('status', true);
     $query = $this->request->getVal('query', $this->request->getVal('search'));
     $query = htmlentities(Sanitizer::StripAllTags($query), ENT_COMPAT, 'UTF-8');
     $page = $this->request->getVal('page', 1);
     $rank = $this->request->getVal('rank', 'default');
     $crossWikia = $this->request->getBool('crossWikia');
     $hub = false;
     $isCorporateWiki = !empty($this->wg->EnableWikiaHomePageExt);
     $isInterWiki = $crossWikia ? true : $isCorporateWiki;
     $cityId = $isInterWiki ? 0 : $this->wg->CityId;
     $params = array('page' => $page, 'length' => self::RESULTS_PER_PAGE, 'cityId' => $cityId, 'groupResults' => $isInterWiki, 'rank' => $rank, 'hub' => $hub, 'query' => $query);
     $searchConfig = F::build('WikiaSearchConfig', array($params));
     $results = $this->wikiaSearch->doSearch($searchConfig);
     $text = $this->app->getView('WikiaSearch', 'WikiaMobileResultList', array('currentPage' => $page, 'isInterWiki' => $isInterWiki, 'relevancyFunctionId' => WikiaSearch::RELEVANCY_FUNCTION_ID, 'results' => $results, 'resultsPerPage' => self::RESULTS_PER_PAGE, 'query' => $query))->render();
     $this->response->setVal('text', $text);
     $this->wf->ProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:20,代码来源:WikiaSearchAjaxController.class.php

示例3: setQuery

 /**
  * Used to store the query from the request as passed by the controller.
  * We remove any namespaces prefixes, but store the original query under the originalQuery param.
  * @see    WikiaSearchConfigTest::testQueryAndNamespaceMethods
  * @param  string $query
  * @return WikiaSearchConfig provides fluent interface
  */
 public function setQuery($query)
 {
     $query = html_entity_decode(Sanitizer::StripAllTags($query), ENT_COMPAT, 'UTF-8');
     $this->params['originalQuery'] = $query;
     $mwNamespace = F::build('MWNamespace');
     $queryNamespace = $mwNamespace->getCanonicalIndex(preg_replace('/^(.*):.*$/', '$1', strtolower($query)));
     if ($queryNamespace) {
         $namespaces = $this->getNamespaces();
         if (empty($namespaces) || !in_array($queryNamespace, $namespaces)) {
             $this->params['queryNamespace'] = $queryNamespace;
         }
         $query = implode(':', array_slice(explode(':', $query), 1));
     }
     $this->params['query'] = $query;
     return $this;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:23,代码来源:WikiaSearchConfig.class.php


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